/* ═══════════════════════════════════════════════════════
   Audits — Design System v5
   Police: Poppins
   ═══════════════════════════════════════════════════════ */

:root {
    --bg:           #0d1117;
    --bg-2:         #161b22;
    --bg-3:         #1c2330;
    --border:       #2d3748;
    --border-light: #3a4a60;
    --text:         #e6edf3;
    --text-muted:   #7d8fa3;
    --text-dim:     #4a5568;
    --accent:       #00d9c0;
    --accent-dark:  #00a896;
    --accent-glow:  rgba(0, 217, 192, 0.15);
    --c-green:      #22c55e;
    --c-green-bg:   rgba(34, 197, 94, 0.12);
    --c-orange:     #f59e0b;
    --c-orange-bg:  rgba(245, 158, 11, 0.12);
    --c-red:        #ef4444;
    --c-red-bg:     rgba(239, 68, 68, 0.12);
    --c-grey:       #64748b;
    --c-grey-bg:    rgba(100, 116, 139, 0.12);
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
    --font: 'Poppins', sans-serif;
    --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.2; }
a { color: var(--accent); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .8; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: #0d1117;
    border-bottom: 1px solid var(--border);
}
.navbar-inner {
    /* Pas de max-width, pas de padding : full bleed */
    width: 100%;
    padding: 0;
    height: 58px;
    display: flex; align-items: stretch;
}

/* ── Logo ISOTOPIC — colle au bord gauche ── */
.navbar-left-group {
    display: flex; align-items: center;
    flex-shrink: 0;
}

.navbar-logo {
    display: flex; align-items: center; gap: var(--sp-3);
    text-decoration: none;
    padding: 0 var(--sp-5);
    height: 100%;
    background: transparent;
    transition: background .15s;
}
.navbar-logo:hover { opacity: 1; background: rgba(255,255,255,.04); }

.logo-check {
    flex-shrink: 0;
    width: 20px; height: 20px;
}

/* ── Texte ISOTOPIC ── */
.logo-text {
    font-family: var(--font);
    font-size: 1.5rem;   /* plus gros */
    font-weight: 900;
    letter-spacing: .01em;
    line-height: 1;
    text-transform: uppercase;
}

/* Thème Dark : ISO blanc, TOPIC vert teal */
.logo-iso   { color: #ffffff; }
.logo-topic { color: var(--accent); }

/* Thème Bleu : ISO blanc, TOPIC bleu clair */
[data-theme="dsfr"] .logo-iso   { color: #ffffff; }
[data-theme="dsfr"] .logo-topic { color: #051e3a; }

/* Thème Automne : ISO blanc, TOPIC vert clair */
[data-theme="herb"] .logo-iso   { color: #ffffff; }
[data-theme="herb"] .logo-topic { color: #86efac; }

/* Check SVG — couleur selon thème */
[data-theme="dsfr"] .logo-check { color: #93c5fd; }
[data-theme="herb"]  .logo-check { color: #86efac; }

/* Nom de l'app */
.navbar-brand {
    display: flex; align-items: center; gap: var(--sp-2);
    color: var(--text-muted); font-family: var(--font);
    font-size: .88rem; font-weight: 500;
    text-decoration: none;
    padding: 0 var(--sp-4);
    border-left: 1px solid var(--border);
    height: 100%;
}
.navbar-brand:hover { color: var(--text); opacity: 1; }
.navbar-brand svg { color: var(--accent); flex-shrink: 0; }
[data-theme="dsfr"] .navbar-brand { border-left-color: rgba(255,255,255,.15); }
[data-theme="herb"]  .navbar-brand { border-left-color: rgba(255,255,255,.15); }

/* ── Partie droite — poussée tout à droite avec margin-left:auto ── */
/* Sélecteur de langue — droite */
.navbar-lang-btn {
    display: flex; align-items: center; gap: 5px;
    text-decoration: none; color: rgba(255,255,255,.75);
    font-size: .75rem; font-weight: 600; letter-spacing: .04em;
    padding: 4px 7px; border-radius: var(--r-md);
    transition: background .15s, color .15s;
}
.navbar-lang-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.navbar-lang-flag { width: 20px; height: auto; border-radius: 2px; flex-shrink: 0; }
.navbar-lang-code { font-size: .72rem; }

.navbar-right {
    display: flex; align-items: center; gap: var(--sp-3);
    margin-left: auto;          /* pousse tout à droite */
    padding: 0 var(--sp-5) 0 0; /* espace du bord droit */
}
.navbar-user {
    display: flex; align-items: center; gap: var(--sp-2);
    color: var(--text-muted); font-size: .82rem;
}

/* ── Theme select — à droite ── */
.theme-select-wrap {
    display: flex; align-items: center; gap: var(--sp-2);
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--r-md);
    padding: 5px var(--sp-3);
    cursor: pointer;
}
.theme-select-icon { color: rgba(255,255,255,.5); flex-shrink: 0; }
.theme-select {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.8);
    font-family: var(--font);
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    appearance: none;
    padding-right: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
}
.theme-select:hover, .theme-select:focus { color: #ffffff; }
.theme-select option { background: #1c2330; color: #e6edf3; }

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

/* ── Compte à rebours avant déconnexion pour inactivité ── */
.navbar-countdown {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums;
    color: rgba(255,255,255,.5);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--r-md);
    padding: 4px 9px;
    transition: color .2s, background-color .2s, border-color .2s;
    cursor: default;
}
.navbar-countdown svg { flex-shrink: 0; opacity: .8; }
.navbar-countdown--soon {
    color: #fff;
    background: rgba(245,158,11,.25);
    border-color: rgba(245,158,11,.55);
}
.navbar-countdown--warn {
    color: #fff;
    background: rgba(239,68,68,.28);
    border-color: rgba(239,68,68,.6);
    animation: navbar-countdown-pulse 1.1s ease-in-out infinite;
}
@keyframes navbar-countdown-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}

/* ── Dropdown navbar ── */
.navbar-dropdown { position: relative; }
.navbar-dropdown-btn { display: flex; align-items: center; gap: 5px; }
.navbar-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    z-index: 200;
    padding: 4px 0;
    animation: dropIn .12s ease;
}
.navbar-dropdown-menu.open { display: block; }
@keyframes dropIn {
    from { opacity:0; transform:translateX(-50%) translateY(-6px); }
    to   { opacity:1; transform:translateX(-50%) translateY(0); }
}
.navbar-dropdown-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 14px; font-size: .82rem; font-weight: 500;
    color: var(--text); text-decoration: none;
    transition: background .12s;
    white-space: nowrap;
}
.navbar-dropdown-item svg { color: var(--text-muted); flex-shrink: 0; }
.navbar-dropdown-item:hover { background: var(--hover-bg, rgba(255,255,255,.06)); color: var(--accent); }
.navbar-dropdown-item:hover svg { color: var(--accent); }

/* ─── Boutons — couleur texte TOUJOURS #ffffff ────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-md); border: none; cursor: pointer;
    font-family: var(--font); font-size: .85rem; font-weight: 600;
    color: #ffffff;                /* blanc partout */
    transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); opacity: 1; }
.btn:active { transform: translateY(0); }

/* Primaire */
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-dark); }
[data-theme="dsfr"] .btn-primary { background: #003189; color: #ffffff; }
[data-theme="dsfr"] .btn-primary:hover { background: #001f5e; }
[data-theme="herb"]  .btn-primary { background: #3d6b35; color: #ffffff; }
[data-theme="herb"]  .btn-primary:hover { background: #2a4a24; }

/* Outline */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: #ffffff;
}
.btn-outline:hover { border-color: var(--accent); color: #ffffff; background: rgba(0,217,192,.12); }
[data-theme="dsfr"] .btn-outline { border-color: #003189; color: #ffffff; }
[data-theme="dsfr"] .btn-outline:hover { background: #003189; }
[data-theme="herb"]  .btn-outline { border-color: #3d6b35; color: #ffffff; }
[data-theme="herb"]  .btn-outline:hover { background: #3d6b35; }

/* Ghost — texte un peu atténué mais reste blanc */
.btn-ghost { background: transparent; color: rgba(255,255,255,.75); }
.btn-ghost:hover { color: #ffffff; background: rgba(255,255,255,.08); }

/* Danger */
.btn-danger {
    background: var(--c-red-bg);
    border: 1px solid var(--c-red);
    color: #111111;
}
.btn-danger:hover { background: var(--c-red); color: #111111; }

.btn-sm   { padding: var(--sp-1) var(--sp-3); font-size: .78rem; }
.btn-xs   { padding: 3px var(--sp-2); font-size: .76rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Formulaires ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-5); }
.form-label {
    display: block; margin-bottom: var(--sp-2);
    font-size: .78rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .06em;
}
.form-input {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    font-family: var(--font); font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-dim); }
.input-wrapper { position: relative; }
.input-wrapper .form-input { padding-right: 44px; }
.toggle-pwd {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; display: flex; align-items: center;
}
.toggle-pwd:hover { color: var(--accent); }

/* ─── Indicateur de niveau (4 points) ───────────────────────────────────── */
.dot-display { display: inline-flex; gap: 3px; align-items: center; vertical-align: middle; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot--off { background: var(--bg-3); border: 1px solid var(--border); }
.dot-display--red    .dot--on { background: #ef4444; }
.dot-display--orange .dot--on { background: #f97316; }
.dot-display--lgr    .dot--on { background: #84cc16; }
.dot-display--green  .dot--on { background: #22c55e; }
.dots-none { color: var(--text-dim); font-size: .7rem; }

/* Dot picker interactif */
.dot-picker { display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; }
.dot-pick { width: 10px; height: 10px; border-radius: 50%; border: none; padding: 0; cursor: pointer; transition: transform .1s; outline: none; flex-shrink: 0; }
.dot-pick.dot--off { background: var(--bg-3); border: 1px solid var(--border-light); }
.dot-picker--red    .dot-pick.dot--on { background: #ef4444; }
.dot-picker--orange .dot-pick.dot--on { background: #f97316; }
.dot-picker--lgr    .dot-pick.dot--on { background: #84cc16; }
.dot-picker--green  .dot-pick.dot--on { background: #22c55e; }
.dot-pick:hover { transform: scale(1.4); }

/* ─── Alertes ────────────────────────────────────────────────────────────── */
.alert {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-5); font-size: .85rem;
}
.alert-error {
    background: var(--c-red-bg);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: var(--sp-6);
}
.modal-overlay--open { display: flex; }
.modal {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--r-xl); width: 100%; max-width: 520px;
    box-shadow: var(--shadow-lg); animation: modal-in .2s ease;
}
.modal--sm { max-width: 400px; }
@keyframes modal-in {
    from { opacity: 0; transform: translateY(-16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: .95rem; font-weight: 600; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.4rem; line-height: 1;
    padding: 2px 6px; border-radius: var(--r-sm);
}
.modal-close:hover { color: var(--text); background: var(--bg-3); }
.modal-body { padding: var(--sp-5) var(--sp-6); }
.modal-footer {
    display: flex; gap: var(--sp-3); justify-content: flex-end;
    padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border);
}
.selected-ref {
    padding: var(--sp-3) var(--sp-4); background: var(--bg-3);
    border: 1px solid var(--border); border-radius: var(--r-md);
    color: var(--text); font-size: .9rem;
}

/* ─── Layout principal ───────────────────────────────────────────────────── */
.main-content { padding: var(--sp-8) 0 var(--sp-12); }
/* Plus de max-width sur le container : full width sans padding latéral */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--sp-6);
}
.container--wide {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 var(--sp-6);
}

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: var(--sp-10); gap: var(--sp-4); flex-wrap: wrap;
}
.page-title { font-size: 1.8rem; font-weight: 700; margin-bottom: var(--sp-1); }
.page-subtitle { color: var(--text-muted); font-size: .9rem; }

/* ─── Sections ───────────────────────────────────────────────────────────── */
.section { margin-bottom: var(--sp-10); }
.section-title {
    font-size: 1rem; font-weight: 600; margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border);
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em;
}

/* ─── Score Ring (petit) ─────────────────────────────────────────────────── */
.score-ring { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.score-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-bg { fill: none; stroke: var(--bg-3); stroke-width: 3; }
.score-fill { fill: none; stroke-width: 3; stroke-linecap: round; stroke: var(--ring-color, var(--c-green)); }
.score-value {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem; font-weight: 700;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    gap: var(--sp-4); padding: var(--sp-12) var(--sp-6);
    color: var(--text-muted); text-align: center;
    background: var(--bg-2); border: 1px dashed var(--border); border-radius: var(--r-lg);
}
.empty-icon { color: var(--text-dim); }

/* ─── Back link ──────────────────────────────────────────────────────────── */
.back-link {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    color: var(--text-muted); font-size: .85rem; margin-bottom: var(--sp-4);
}
.back-link:hover { color: var(--accent); opacity: 1; }

/* ─── Bandeau société (logo + nom) — présent sur toutes les pages avec contexte société ─── */
.societe-bandeau {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 7px var(--sp-5);
}
.societe-bandeau__logo { width: 24px; height: 24px; border-radius: 5px; object-fit: contain; flex-shrink: 0; }
.societe-bandeau__initial {
    width: 24px; height: 24px; border-radius: 5px; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: .78rem; flex-shrink: 0;
}
.societe-bandeau__name { font-size: .85rem; font-weight: 700; color: var(--text); }

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
    .navbar, .btn, .rapport-filter, .rapport-header__right { display: none !important; }
    body { background: white; color: #111; }
    .rapport-section { page-break-inside: avoid; }
}
