/* =====================================================================
   GEST JSP NATIONAL — feuille de style unique
   Famille visuelle : navy autorité + rouge alarme + laiton,
   Oswald (display) / Inter (texte) / JetBrains Mono (chiffres).
   ===================================================================== */

:root {
    --paper:      #f4f5f7;
    --surface:    #ffffff;
    --surface-2:  #fafbfc;
    --ink:        #12161c;
    --muted:      #5b6472;
    --muted-2:    #8b94a3;
    --line:       #e1e4ea;
    --navy:       #16305c;
    --navy-dk:    #0d1e3f;
    --navy-bg:    #eef1f6;
    --alarm:      #d72638;
    --alarm-dk:   #a91d2c;
    --alarm-bg:   #fdecec;
    --success:    #1a8a4a;
    --success-bg: #eafaf1;
    --warn:       #b26a00;
    --warn-bg:    #fff5e5;
    --brass:      #c99a3d;

    --radius:     12px;
    --radius-lg:  18px;
    --shadow-sm:  0 1px 3px rgba(13,30,63,.07);
    --shadow-md:  0 12px 34px rgba(13,30,63,.12);

    --font-display: 'Oswald', 'Arial Narrow', sans-serif;
    --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
    --ease:         .18s cubic-bezier(.4,0,.2,1);

    --sidebar-w:  244px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--alarm); }

/* ══ Signature maison : bande à chevrons (bandes réfléchissantes) ══ */
.chevrons {
    height: 6px;
    background: repeating-linear-gradient(135deg, var(--navy) 0 10px, var(--alarm) 10px 20px);
}
.chevrons--brass {
    background: repeating-linear-gradient(135deg, var(--navy-dk) 0 10px, var(--brass) 10px 20px);
}

/* ══════════════════════ SIDEBAR ══════════════════════ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--navy-dk);
    color: #cdd6e4;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar__title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #fff;
    margin: 0;
    line-height: 1.1;
}
.sidebar__sub {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brass);
    margin-top: 5px;
}
.sidebar__nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.sidebar__groupe {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: #6b7c96;
    padding: 14px 10px 7px;
}
.sidebar__lien {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #cdd6e4;
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--ease), color var(--ease);
}
.sidebar__lien:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar__lien--actif {
    background: var(--alarm);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(215,38,56,.32);
}
.sidebar__lien--actif:hover { background: var(--alarm); color: #fff; }
.sidebar__lien svg { width: 16px; height: 16px; flex: 0 0 16px; }

.sidebar__pied {
    padding: 14px 18px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 11px;
    color: #7b8aa3;
}

/* ══════════════════════ ZONE PRINCIPALE ══════════════════════ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 15px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar__eyebrow {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.topbar__titre {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--navy);
    margin: 1px 0 0;
    line-height: 1.15;
}
.topbar__user { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: .04em;
}
.topbar__nom { font-size: 13px; font-weight: 600; line-height: 1.2; }
.topbar__role { font-size: 11px; color: var(--muted); }

.contenu { padding: 24px 26px 60px; max-width: 1500px; width: 100%; }

/* ══════════════════════ COMPOSANTS ══════════════════════ */
.carte {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}
.carte__tete {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.carte__titre {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--navy);
    margin: 0;
}
.carte__aide { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }
.carte__corps { padding: 20px; }
.carte__corps--serre { padding: 0; }

/* ── Chiffres clés : la signature de cette plateforme ── */
.chiffres {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.chiffre {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px 14px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.chiffre::after {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--navy);
}
.chiffre--alarme::after { background: var(--alarm); }
.chiffre--laiton::after { background: var(--brass); }
.chiffre--vert::after   { background: var(--success); }
.chiffre__label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.chiffre__valeur {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--navy);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.chiffre__note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ── Tableaux ── */
.tableau-wrap { overflow-x: auto; }
table.tableau {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.tableau th {
    background: var(--surface-2);
    text-align: left;
    padding: 11px 14px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.tableau td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.tableau tbody tr:hover { background: var(--navy-bg); }
table.tableau tbody tr:last-child td { border-bottom: 0; }
.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.num--fort { font-weight: 600; color: var(--navy); }
.tableau tfoot td {
    background: var(--navy-bg);
    font-weight: 700;
    border-top: 2px solid var(--navy);
    padding: 12px 14px;
}

/* ── Boutons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    background: var(--navy);
    color: #fff;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background var(--ease), transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.btn:hover { background: var(--navy-dk); color: #fff; transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--alarm); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--alarme { background: var(--alarm); }
.btn--alarme:hover { background: var(--alarm-dk); }
.btn--fantome { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn--fantome:hover { background: var(--navy-bg); color: var(--navy); border-color: var(--navy); }
.btn--petit { height: 31px; padding: 0 11px; font-size: 11.5px; }
.btn--large { width: 100%; }
.btn svg { width: 15px; height: 15px; }

/* ── Formulaires ── */
.champs { display: grid; gap: 14px; }
.champs--2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.champs--3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.champ label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 5px;
}
.champ input, .champ select, .champ textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    font-family: var(--font-body);
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.champ textarea { height: auto; padding: 10px 12px; resize: vertical; }
.champ input:focus, .champ select:focus, .champ textarea:focus {
    border-color: var(--navy);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(22,48,92,.12);
}
.champ input:disabled, .champ select:disabled { opacity: .55; }
.champ__aide { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ── Badges / alertes ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.badge--ok     { background: var(--success-bg); color: var(--success); }
.badge--erreur { background: var(--alarm-bg);   color: var(--alarm-dk); }
.badge--attente{ background: var(--warn-bg);    color: var(--warn); }
.badge--neutre { background: var(--navy-bg);    color: var(--navy); }
.badge--laiton { background: #faf3e3;           color: #8a6a1f; }

.alerte {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 18px;
    border: 1.5px solid transparent;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.alerte--succes { background: var(--success-bg); color: var(--success); border-color: #bfe9d3; }
.alerte--erreur { background: var(--alarm-bg);   color: var(--alarm-dk); border-color: #f7c9cd; }
.alerte--info   { background: var(--navy-bg);    color: var(--navy);    border-color: #ccd8ea; }
.alerte--warn   { background: var(--warn-bg);    color: var(--warn);    border-color: #f2dcb4; }

.vide {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
}
.vide__titre {
    font-family: var(--font-display);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--navy);
    margin-bottom: 6px;
}

/* ── Barre de progression ── */
.progression {
    height: 10px;
    background: var(--navy-bg);
    border-radius: 999px;
    overflow: hidden;
}
.progression__barre {
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(135deg, var(--navy) 0 10px, var(--alarm) 10px 20px);
    transition: width .25s ease;
}

/* ── Console de sortie (collecte / mutation) ── */
.console {
    background: #0d1420;
    color: #c8d3e5;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.65;
    padding: 14px 16px;
    border-radius: var(--radius);
    max-height: 340px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.console .ok    { color: #63d297; }
.console .ko    { color: #ff7b86; }
.console .info  { color: #7fb3ff; }
.console .titre { color: var(--brass); font-weight: 600; }

/* ── Barres de comparaison (répartition) ── */
.barres { display: grid; gap: 10px; }
.barre__tete {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12.5px;
    margin-bottom: 4px;
}
.barre__nom { font-weight: 600; }
.barre__val { font-family: var(--font-mono); color: var(--muted); }
.barre__piste { height: 8px; background: var(--navy-bg); border-radius: 999px; overflow: hidden; }
.barre__jauge { height: 100%; background: var(--navy); border-radius: 999px; }
.barre__jauge--recrue { background: #7f93b3; }
.barre__jauge--1 { background: #16305c; }
.barre__jauge--2 { background: #2a5490; }
.barre__jauge--3 { background: #4f7fbd; }
.barre__jauge--4 { background: #c99a3d; }
.barre__jauge--5 { background: #d72638; }

/* ── Filtres ── */
.filtres {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filtres .champ { min-width: 170px; }

/* ── Onglets ── */
.onglets { display: flex; gap: 4px; flex-wrap: wrap; }
.onglet {
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1.5px solid transparent;
    cursor: pointer;
}
.onglet:hover { background: var(--navy-bg); color: var(--navy); }
.onglet--actif { background: var(--navy); color: #fff; }
.onglet--actif:hover { background: var(--navy); color: #fff; }

/* ── Modale ── */
.modale {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(13,20,35,.55);
}
.modale.ouverte { display: flex; }
.modale__carte {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.modale__tete {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
}
.modale__titre {
    font-family: var(--font-display);
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--navy);
    margin: 0;
}
.modale__fermer {
    background: none; border: 0; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--muted);
    padding: 0 4px;
}
.modale__fermer:hover { color: var(--alarm); }
.modale__corps { padding: 20px; }

/* ── Divers ── */
.pastille {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.muted { color: var(--muted); }
.mono  { font-family: var(--font-mono); }
.right { text-align: right; }
.nowrap{ white-space: nowrap; }
.mb0   { margin-bottom: 0; }
.mt16  { margin-top: 16px; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

/* ══════════════════════ RESPONSIVE ══════════════════════ */
.burger {
    display: none;
    background: none;
    border: 1.5px solid var(--line);
    border-radius: 9px;
    width: 38px; height: 38px;
    cursor: pointer;
    color: var(--navy);
}

@media (max-width: 1000px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform var(--ease);
    }
    .sidebar.ouverte { transform: none; box-shadow: var(--shadow-md); }
    .burger { display: inline-flex; align-items: center; justify-content: center; }
    .contenu { padding: 18px 16px 60px; }
    .topbar { padding: 12px 16px; }
    .voile {
        display: none;
        position: fixed; inset: 0;
        background: rgba(13,20,35,.5);
        z-index: 40;
    }
    .voile.visible { display: block; }
}

@media (max-width: 620px) {
    .topbar__titre { font-size: 17px; }
    .chiffre__valeur { font-size: 25px; }
    .topbar__nom, .topbar__role { display: none; }
}

@media print {
    .sidebar, .topbar, .btn, .filtres, .burger { display: none !important; }
    .contenu { padding: 0; }
    .carte { box-shadow: none; border-color: #ccc; }
}
