/* =========================
   VARIABLES
========================= */
:root {
    --brand:      #e30613;
    --brand-dark: #c0040f;
    --dark:       #111111;
    --bg:         #f4f6f9;
    --radius:     8px;
    --radius-lg:  10px;
}

/* =========================
   RESET
========================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================
   BASE
========================= */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--dark);
    padding-bottom: 70px;
    min-width: 320px;
}

img {
    max-width: 100%;
    display: block;
}

/* =========================
   NAVBAR
========================= */
.navbar {
    background: var(--dark);
    border-bottom: 3px solid var(--brand);
    padding: 0 24px;
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.navbar-container {
    display: grid;
    grid-template-columns: auto 1fr auto; /* logo | centre | droite */
    align-items: center;
    gap: 0;
    height: 100%;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ── Logo (colonne 1) ── */
.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    padding-right: 16px;
}
.logo img { height: 38px; }

/* ── Liens centre (colonne 2, desktop uniquement) ── */
.nav-links-desktop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}
.nav-links-desktop a {
    color: #cccccc;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 5px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.nav-links-desktop a:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}
.nav-link-special {
    color: white !important;
    background: rgba(227,6,19,0.15) !important;
    border: 1px solid rgba(227,6,19,0.4);
    border-radius: 5px;
}
.nav-link-special:hover { background: rgba(227,6,19,0.30) !important; }

/* ── Zone droite (colonne 3) ── */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    padding-left: 16px;
}

/* Auth desktop — masqué sur mobile */
.nav-desktop-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-sep {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.user {
    color: #aaaaaa;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.user-dot {
    width: 7px;
    height: 7px;
    background: #2ecc71;
    border-radius: 50%;
    flex-shrink: 0;
}

.btn-nav-users {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 5px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #cccccc;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.btn-nav-users:hover { background: rgba(255,255,255,0.08); color: white; }

.btn-login {
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 5px;
    background: var(--brand);
    color: white;
    text-decoration: none;
    border: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-login:hover { background: var(--brand-dark); color: white; }

.btn-logout {
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 5px;
    background: transparent;
    border: 1px solid var(--brand);
    color: white;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.btn-logout:hover { background: var(--brand); }

/* ── Langue (toujours visible) ── */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
}
.lang-btn {
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    opacity: 0.4;
    transition: opacity 0.15s, transform 0.15s;
    padding: 3px 4px;
    border-radius: 4px;
}
.lang-btn:hover { opacity: 0.85; transform: scale(1.15); }
.lang-btn.lang-active {
    opacity: 1;
    transform: scale(1.1);
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
}

/* ── Hamburger (mobile uniquement) ── */
.nav-hamburger {
    display: none;           /* caché sur desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    cursor: pointer;
    padding: 7px 9px;
    width: 40px;
    height: 38px;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.nav-hamburger:hover {
    background: var(--brand);
    border-color: var(--brand);
}
.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* =========================
   DRAWER MOBILE
========================= */
.nav-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1060;
    backdrop-filter: blur(2px);
}
.nav-mobile-overlay.show { display: block; }

.nav-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: #1a1a1a;
    z-index: 1070;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: -6px 0 24px rgba(0,0,0,0.5);
}
.nav-mobile-menu.open { transform: translateX(0); }

/* Header drawer */
.nav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    border-bottom: 2px solid var(--brand);
    flex-shrink: 0;
}
.nav-mobile-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}
.nav-mobile-close:hover { background: rgba(255,255,255,0.12); }

/* Bloc utilisateur */
.nav-mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(255,255,255,0.04);
}
.nav-mobile-username {
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex: 1;
}
.nav-mobile-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(227,6,19,0.2);
    color: #ff8080;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Séparateur */
.nav-mobile-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 0;
}

/* Liens nav */
.nav-mobile-links {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    flex: 1;
}
.nav-mobile-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c0c0c0;
    text-decoration: none;
    font-size: 15px;
    padding: 13px 20px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-mobile-links a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    border-left-color: rgba(255,255,255,0.2);
}
.nav-mobile-special {
    color: white !important;
    border-left-color: var(--brand) !important;
    background: rgba(227,6,19,0.12) !important;
}
.nav-mobile-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

/* Footer drawer */
.nav-mobile-footer { flex-shrink: 0; }

/* Langue dans le drawer */
.nav-mobile-langs {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    flex-wrap: wrap;
}
.nav-mobile-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #888;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-mobile-lang:hover { background: rgba(255,255,255,0.07); color: #ccc; }
.nav-mobile-lang--active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

/* Logout / Login mobile */
.btn-logout-mobile {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    background: rgba(227,6,19,0.15);
    border: 1px solid rgba(227,6,19,0.4);
    color: #ff8080;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-logout-mobile:hover { background: var(--brand); color: white; border-color: var(--brand); }

.btn-login-mobile {
    display: block;
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    background: var(--brand);
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-login-mobile:hover { background: var(--brand-dark); color: white; }

/* =========================
   CONTAINER
   Bootstrap gère déjà .container — on étend juste
========================= */
.container, .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
}

/* =========================
   PAGE HEADER
========================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--dark);
}

/* =========================
   CARD
========================= */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

.card-header {
    background: var(--dark);
    color: white;
    padding: 13px 16px;
    border-left: 4px solid var(--brand);
    font-weight: 600;
    font-size: 14px;
    border-radius: 0;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================
   TABLE
========================= */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th {
    background: var(--dark);
    color: white;
    padding: 11px 12px;
    text-align: left;
    font-size: 13px;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eeeeee;
    color: var(--dark);
    font-size: 14px;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: #fafafa;
}

/* =========================
   BADGES — surcharges Bootstrap
========================= */
.badge {
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.badge.bg-warning  { background-color: #fff3cd !important; color: #856404 !important; }
.badge.bg-info     { background-color: #cff4fc !important; color: #055160 !important; }
.badge.bg-success  { background-color: #d1e7dd !important; color: #0a3622 !important; }
.badge.bg-secondary{ background-color: #e2e3e5 !important; color: #41464b !important; }
.badge.bg-danger   { background-color: #f8d7da !important; color: #842029 !important; }

/* =========================
   BOUTONS GLOBALS
========================= */
.btn {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
}

/* =========================
   BOUTON PRINCIPAL (Ajouter)
========================= */
.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border: none;
    color: white;
    box-shadow: 0 2px 6px rgba(227, 6, 19, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark), #a0030c);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(227, 6, 19, 0.35);
}

/* =========================
   BOUTON VOIR
========================= */
.btn-outline-secondary {
    border: 1px solid #d1d5db;
    color: #444;
    background: white;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #cbd5e1;
    color: black;
}

/* =========================
   BOUTON MODIFIER
========================= */
.btn-outline-primary {
    border: 1px solid var(--brand);
    color: var(--brand);
    background: white;
}

.btn-outline-primary:hover {
    background: var(--brand);
    color: white;
    box-shadow: 0 2px 6px rgba(227, 6, 19, 0.25);
}

/* =========================
   BOUTON SUPPRIMER
========================= */
.btn-outline-danger {
    border: 1px solid #dc3545;
    color: #dc3545;
    background: white;
}

.btn-outline-danger:hover {
    background: #dc3545;
    color: white;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.25);
}

/* =========================
   GROUPES DE BOUTONS
========================= */
.btn-group {
    display: inline-flex;
    gap: 4px;
}

.btn-group .btn {
    border-radius: 6px !important;
}

/* =========================
   BOUTON AJOUT (gros bouton)
========================= */
.btn-add,
.btn-primary.btn-lg {
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
}

/* =========================
   EFFET CLICK
========================= */
.btn:active {
    transform: scale(0.97);
    box-shadow: none;
}

/* =========================
   FORMULAIRES
========================= */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.15) !important;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

input[type="text"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    color: var(--dark);
    background: white;
    min-height: 40px;
}

/* =========================
   ALERTS
========================= */
.alert-success {
    background: #d1e7dd !important;
    color: #0a3622 !important;
    border-left: 4px solid #198754;
}

.alert-danger {
    background: #f8d7da !important;
    color: #842029 !important;
    border-left: 4px solid var(--brand);
}

.alert-warning {
    background: #fff3cd !important;
    color: #664d03 !important;
    border-left: 4px solid #ffc107;
}

/* =========================
   FOOTER
========================= */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--dark);
    color: #aaaaaa;
    text-align: center;
    padding: 11px 16px;
    border-top: 3px solid var(--brand);
    font-size: 13px;
    z-index: 100;
}

.footer p {
    margin: 0;
}

/* =========================
   SIDEBAR (gauche)
========================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--dark);
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1040;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    line-height: 1;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    padding: 24px 20px 16px;
    text-align: center;
}

.sidebar-logo img {
    max-width: 160px;
    max-height: 70px;
    object-fit: contain;
    margin: 0 auto;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 6px 0;
}

.sidebar-nav {
    padding: 6px 0;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    color: #cccccc;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.sidebar-link.active {
    color: white;
    border-left-color: var(--brand);
    background: rgba(227, 6, 19, 0.1);
}

.sidebar-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 20px;
    padding: 13px 20px;
    background: var(--brand);
    color: white;
    font-size: 15px;
    font-weight: 600;
    border-radius: 50px;
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-cta:hover {
    background: var(--brand-dark);
    color: white;
}

.sidebar-footer {
    padding: 14px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-footer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #888888;
    font-size: 13px;
}

.sidebar-toggle {
    background: var(--dark);
    color: white;
    border: none;
    font-size: 20px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 14px;
    min-width: 44px;
    min-height: 44px;
    transition: background 0.15s;
}

.sidebar-toggle:hover {
    background: var(--brand);
}

/* =========================
   SHOW — INFO-GRID
========================= */
.info-grid {
    display: block;
}

.info-row {
    display: flex;
    align-items: baseline;
    padding: 9px 16px;
    border-bottom: 1px solid #eeeeee;
    gap: 12px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row dt {
    flex: 0 0 130px;
    font-size: 13px;
    color: #666666;
    font-weight: 400;
    white-space: nowrap;
}

.info-row dd {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    word-break: break-word;
}

/* =========================
   SHOW — DATE-CHIP
========================= */
.date-chip {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
}

.date-chip-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888888;
    font-weight: 600;
}

.date-chip-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
}

/* =========================
   TEMPS RÉEL
========================= */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #2ecc71;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    animation: livePulse 1.8s ease-in-out infinite;
}

.live-indicator.live-offline {
    color: #888888;
}

.live-indicator.live-offline .live-dot {
    background: #888888;
    animation: none;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.85); }
}

@keyframes rowHighlight {
    0%   { background: rgba(227, 6, 19, 0.12); }
    100% { background: transparent; }
}

.row-new {
    animation: rowHighlight 3s ease-out forwards;
}

/* =========================
   PHOTO THUMB
========================= */
.photo-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #dddddd;
    display: block;
    transition: transform 0.15s;
}

.photo-thumb:hover {
    transform: scale(1.1);
}

/* =========================
   FICHE (legacy)
========================= */
.fiche {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.fiche-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eeeeee;
    margin-bottom: 16px;
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.fiche-section {
    margin-bottom: 20px;
}

.fiche-section h3 {
    margin-bottom: 10px;
    border-left: 4px solid var(--brand);
    padding-left: 10px;
    border-radius: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.description-box {
    background: var(--bg);
    padding: 12px;
    border-radius: 6px;
}

.photos {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.photos img {
    max-width: 100%;
    border-radius: 8px;
}

.fiche-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================
   RESPONSIVE — TABLETTE (≤ 900px)
   Desktop auth → masqué, hamburger → visible
========================= */
@media (max-width: 900px) {

    /* Grille navbar : logo | vide | droite (hamburger + langue) */
    .navbar-container {
        grid-template-columns: auto 1fr auto;
    }

    /* Masque les liens centraux */
    .nav-links-desktop { display: none; }

    /* Masque les éléments desktop-only (user, manage-users, logout, sep) */
    .nav-desktop-auth { display: none; }

    /* Affiche le hamburger */
    .nav-hamburger { display: flex; }

    .navbar { padding: 0 16px; }

    .container { padding: 12px; }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table th, .table td { white-space: nowrap; }

    .grid { grid-template-columns: repeat(2, 1fr); }

    .info-row dt { flex: 0 0 110px; }
}

/* =========================
   RESPONSIVE — MOBILE (≤ 600px)
========================= */
@media (max-width: 600px) {

    body { padding-bottom: 80px; }

    .navbar { padding: 0 12px; height: 54px; }
    .logo img { height: 32px; }

    .lang-btn { font-size: 1.05rem; }

    .photo-thumb { width: 36px; height: 36px; }

    /* Tableau compact sur mobile */
    .table-sm-mobile th,
    .table-sm-mobile td { padding: 8px; font-size: 12px; }

    /* Boutons d'actions incidents en colonne */
    .actions-btn-group { flex-direction: column; width: 100%; }
    .actions-btn-group .btn,
    .actions-btn-group form { width: 100%; }
    .actions-btn-group .btn { border-radius: 5px !important; margin-bottom: 2px; }

    .card-body { padding: 12px; }

    /* Info-grid : label au-dessus de la valeur */
    .info-row { flex-direction: column; gap: 2px; padding: 10px 12px; }
    .info-row dt {
        flex: none; font-size: 11px;
        text-transform: uppercase; letter-spacing: 0.03em; color: #999;
    }
    .info-row dd { font-size: 14px; }

    .date-chip-value { font-size: 14px; }
    .grid { grid-template-columns: 1fr; }
    .sidebar { width: 260px; }
    .footer { font-size: 11px; padding: 9px 12px; }
}

/* =========================
   RESPONSIVE — TRÈS PETIT (≤ 380px)
========================= */
@media (max-width: 380px) {

    .navbar { padding: 0 10px; }
    .logo img { height: 28px; }
    .lang-btn { font-size: 0.95rem; padding: 2px 2px; }
    .container { padding: 8px; }
    .sidebar { width: 100%; }
    .nav-mobile-menu { width: 100%; }
    .table th, .table td { font-size: 11px; padding: 6px; }
    .photo-thumb { width: 28px; height: 28px; }
}

/* ── Badge référence ANO ────────────────────────────────── */
.badge-ref {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(227, 6, 19, 0.08);
    color: var(--brand);
    border: 1px solid rgba(227, 6, 19, 0.2);
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   BARRE DE RECHERCHE + AUTOCOMPLETE
══════════════════════════════════════════════════════════ */
.search-bar-wrapper {
    position: relative;
    max-width: 540px;
}

/* Groupe input */
.search-input-group {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 12px;
    gap: 8px;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.search-input-group:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(227,6,19,0.1);
}
.search-icon {
    font-size: 15px;
    flex-shrink: 0;
    opacity: 0.5;
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 14px;
    background: transparent;
    color: var(--dark);
    min-width: 0;
}
.search-input::placeholder { color: #9ca3af; }
.search-clear {
    color: #9ca3af;
    font-size: 14px;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.search-clear:hover { background: #f1f5f9; color: var(--dark); }

/* Dropdown suggestions */
.search-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    list-style: none;
    padding: 6px 0;
    z-index: 500;
    max-height: 280px;
    overflow-y: auto;
}
.search-suggestions.open { display: block; }

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: background 0.12s;
}
.search-suggestion-item:hover,
.search-suggestion-item.active {
    background: #fef2f2;
}
.suggestion-icon { font-size: 15px; flex-shrink: 0; }
.suggestion-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.suggestion-content strong {
    font-size: 13px;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggestion-content small {
    font-size: 11px;
    color: #6b7280;
}
.suggestion-content mark {
    background: rgba(227,6,19,0.15);
    color: var(--brand);
    border-radius: 2px;
    padding: 0 1px;
}
.search-suggestion-empty {
    padding: 12px 16px;
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
}

/* Badge filtre actif */
.search-active-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.search-filter-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}
.search-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    background: rgba(227,6,19,0.08);
    color: var(--brand);
    border: 1px solid rgba(227,6,19,0.2);
    border-radius: 20px;
}
.search-filter-remove {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.search-filter-remove:hover { background: #fee2e2; color: var(--brand); }

@media (max-width: 600px) {
    .search-bar-wrapper { max-width: 100%; }
    .search-input { font-size: 16px; } /* évite zoom iOS */
}

/* ══════════════════════════════════════════════════════════
   TABLEAU DE BORD CHANTIER — KPIs + Chart
══════════════════════════════════════════════════════════ */

/* KPI cards */
.kpi-card {
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 4px solid transparent;
}
.kpi-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--dark);
}
.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    font-weight: 600;
}
.kpi-total   { background:#f8fafc; border-left-color:#94a3b8; }
.kpi-open    { background:#fef2f2; border-left-color:#ef4444; }
.kpi-open .kpi-value    { color:#ef4444; }
.kpi-closed  { background:#f0fdf4; border-left-color:#22c55e; }
.kpi-closed .kpi-value  { color:#22c55e; }
.kpi-progress{ background:#fffbeb; border-left-color:#f59e0b; }
.kpi-progress .kpi-value{ color:#f59e0b; }

/* Conteneur canvas */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
}

/* Légende custom */
.chart-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.chart-legend-label {
    flex: 1;
    font-size: 13px;
    color: var(--dark);
}
.chart-legend-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    min-width: 24px;
    text-align: right;
}

/* ══════════════════════════════════════════════════════════
   NAVBAR — DROPDOWN "TABLEAU ANOMALIE"
══════════════════════════════════════════════════════════ */
.nav-dropdown {
    position: relative;
    list-style: none;
}
.nav-dropdown-trigger {
    background: none;
    border: none;
    color: #cccccc;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.nav-dropdown-trigger:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}
.nav-dropdown-arrow {
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s;
}

/* Dropdown commun — s'ouvre via classe .open (JS) */
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 2px solid var(--brand);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    list-style: none;
    padding: 6px 0;
    min-width: 240px;
    z-index: 950;
}
.nav-dropdown-menu.open { display: block; }

/* Dropdown langue aligné à droite */
.lang-dropdown-menu {
    left: auto !important;
    right: 0 !important;
    transform: none !important;
    min-width: 155px;
}

.nav-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: #c0c0c0;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
    border-left: 3px solid transparent;
}
.nav-dropdown-menu li a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    border-left-color: rgba(255,255,255,0.2);
}
.nav-dropdown-menu li a.nav-dropdown-featured {
    color: white;
    border-left-color: var(--brand);
    background: rgba(227,6,19,0.1);
    font-weight: 600;
}
.nav-dropdown-menu li a.nav-dropdown-featured:hover {
    background: rgba(227,6,19,0.2);
}
.nav-dropdown-menu li a.lang-option-active {
    color: white;
    font-weight: 600;
    background: rgba(227,6,19,0.1);
}
.lang-check { margin-left: auto; color: var(--brand); font-size: 12px; }

/* Séparateur après le 1er item du menu tableau */
#tableauMenu li:first-child {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
    padding-bottom: 4px;
}

/* ══ Bouton trigger langue ══ */
.lang-dropdown {
    position: relative;
}
.lang-dropdown-trigger {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    padding: 5px 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.lang-dropdown-trigger:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
}
.lang-code { font-weight: 600; font-size: 12px; letter-spacing: .04em; }
.lang-arrow { font-size: 9px; opacity: 0.7; }

/* Taille des drapeaux flag-icons dans la navbar */
.nav-right .fi,
.nav-dropdown-menu .fi,
.nav-mobile-langs .fi {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    flex-shrink: 0;
}
.lang-dropdown-trigger .fi { width: 20px; height: 15px; }

/* (règles lang-dropdown-menu fusionnées dans le bloc nav-dropdown-menu ci-dessus) */

/* ── Page infos ── */
.infos-content p {
    font-size: clamp(15px, 2.5vw, 18px);
    line-height: 1.75;
    color: #374151;
    margin-bottom: 1rem;
}

/* ── Bouton PDF sidebar ─────────────────────────────────── */
.sidebar-pdf-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 20px 14px;
    padding: 11px 16px;
    background: rgba(227,6,19,0.12);
    border: 1px solid rgba(227,6,19,0.35);
    color: #ff8080;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    flex-wrap: wrap;
}
.sidebar-pdf-btn:hover {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}
.sidebar-pdf-filter {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.8;
    width: 100%;
    padding-left: 26px;
    margin-top: -4px;
}
