/* Gestigarde — feuille de style de l'interface (ré-habillage étape 4 bis, doc16 §4 et §9).

   Source de vérité : le design system « Gestigarde » (doc16 §4, artifact
   Bq7Cb8YxxK3ryqxvQnbFoP, tokens.json) et les maquettes (doc16 §6). Les noms
   des variables ci-dessous sont EXACTEMENT ceux de tokens.json (surface-page,
   ink-muted, confidence-confirmed…) : ne jamais introduire une couleur en dur
   dans un gabarit, ajouter un token ici avec sa justification.

   Polices : hébergées localement (vendor/fonts.css) — jamais Google Fonts (D46).
   Écarts assumés par rapport à tokens.json / maquettes, tous justifiés par le
   contraste (WCAG 2.1 AA, doc16 §10, volontaire) et listés dans le journal :
     1. ink-faint (#8B958E) n'est jamais utilisé pour du texte informatif
        (2,8 à 3,1:1 sur fond clair) : notes et légendes utilisent ink-muted ;
     2. StatusTag « priorité faible » : texte en ink-muted (4,86:1 sur
        status-muted-bg) au lieu de status-muted (2,58:1) ;
     3. bordure des champs de saisie en ink-faint (3,09:1 sur blanc, seuil 3:1
        des composants d'interface) au lieu de border (1,46:1) ;
     4. intitulé de groupe de la navigation en ink-on-sidebar-muted (6,2:1)
        au lieu du #6E948D de la maquette (3,5:1).
*/

/* ------------------------------------------------------------------ tokens */
:root {
  --surface-page: #F6F4EE;
  --surface-card: #FFFFFF;
  --surface-sidebar: #0E3E3C;
  --surface-sunken: #EFEAE0;
  --ink: #1E2622;
  --ink-muted: #5C685F;
  --ink-faint: #8B958E;
  --ink-on-sidebar: #E1EFEC;
  --ink-on-sidebar-muted: #9FC2BC;
  --border: #DCD5C4;
  --border-strong: #BEDAD6;

  --brand: #0E3E3C;
  --brand-strong: #0A2E2C;
  --brand-soft: #E1EFEC;
  --accent-warm: #C9622E;
  --accent-warm-soft: #F4E3D6;

  --status-success: #1F6F6B;
  --status-success-bg: #E1EFEC;
  --status-attention: #8A5A10;
  --status-attention-bg: #F4E7CC;
  --status-attention-border: #E3CB9A;
  --status-critical: #A63B2A;
  --status-critical-bg: #F6E1DB;
  --status-critical-border: #E5BDB3;
  --status-muted: #8B958E;
  --status-muted-bg: #EFEAE0;

  --confidence-confirmed: #1F6F6B;
  --confidence-confirmed-bg: #E1EFEC;
  --confidence-estimated: #2E6E8E;
  --confidence-estimated-bg: #DEEAF1;
  --confidence-toverify: #8A5A10;
  --confidence-toverify-bg: #F4E7CC;
  --confidence-simulated: #6B4C9A;
  --confidence-simulated-bg: #EAE2F4;
  --confidence-unknown: #5C685F;
  --confidence-unknown-bg: #EFEAE0;

  --focus-ring: #0E3E3C;
  --brand-glow: #4FA89E; /* puce décorative sur fond sapin (hors tokens.json) */

  /* Ajouts pour le mode sombre : couleur du texte posé sur un fond « brand »
     (bouton principal, lien d'évitement) et sur une pastille pleine du StatusTag.
     Clair : identiques aux valeurs précédemment en dur. */
  --on-brand: var(--ink-on-sidebar);
  --on-status: #FFFFFF;
  color-scheme: light;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Public Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(30,38,34,0.06), 0 1px 1px rgba(30,38,34,0.04);
  --shadow-popover: 0 8px 24px rgba(14,62,60,0.16);

  /* Ajout hors tokens.json (repris tel quel de la maquette « Compléter mon
     foyer », champ à compléter) : fond très clair de la famille « attention ». */
  --status-attention-wash: #FBF6EC;
}

/* --------------------------------------------------------------- mode sombre
   Suit la préférence du système (prefers-color-scheme) ; aucun interrupteur,
   donc aucun JavaScript ni stockage (CSP, D46). Palette choisie ici (doc16 ne
   définit pas de thème sombre : HYPOTHÈSE de conception, à valider par Hugo),
   contrastes calculés : texte ≥ 7,5:1, texte de couleur d'état ≥ 6,5:1,
   bordure de champ 4,6:1. La barre latérale et l'écran de connexion gardent
   le sapin du thème clair (texte 10,0:1 et 6,2:1). */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-page: #111917;
    --surface-card: #18221F;
    --surface-sunken: #0D1412;
    --ink: #E9EEEB;
    --ink-muted: #A9B5AE;
    --ink-faint: #7F8B84;
    --border: #2D3B37;
    --border-strong: #3B5A54;

    --brand: #7FCFC4;
    --brand-strong: #A3E0D7;
    --brand-soft: #173330;
    --on-brand: #0A1F1D;
    --accent-warm: #E4915E;
    --accent-warm-soft: #3A2418;

    --status-success: #66C9BB;
    --status-success-bg: #133430;
    --status-attention: #E2B35C;
    --status-attention-bg: #352A10;
    --status-attention-border: #5E4A1F;
    --status-attention-wash: #241D0E;
    --status-critical: #EE9584;
    --status-critical-bg: #3D1F1A;
    --status-critical-border: #6E372D;
    --status-muted: #7F8B84;
    --status-muted-bg: #202B27;
    --on-status: #0E1513;

    --confidence-confirmed: #6FCBBF;
    --confidence-confirmed-bg: #133430;
    --confidence-estimated: #86BEDC;
    --confidence-estimated-bg: #152C3A;
    --confidence-toverify: #E2B35C;
    --confidence-toverify-bg: #352A10;
    --confidence-simulated: #BCA5E8;
    --confidence-simulated-bg: #2B2242;
    --confidence-unknown: #A9B5AE;
    --confidence-unknown-bg: #202B27;

    --focus-ring: #7FCFC4;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 1px 1px rgba(0,0,0,0.3);
    --shadow-popover: 0 8px 24px rgba(0,0,0,0.5);
  }
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 21px;
  background: var(--surface-page);
  color: var(--ink);
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

h1, h2, h3 { margin: 0; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-sunken); padding: 1px 5px; border-radius: var(--radius-sm); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--space-4); top: -60px; z-index: 100;
  background: var(--brand); color: var(--on-brand); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md); font-weight: 600;
}
.skip-link:focus { top: var(--space-2); }

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

.sidebar {
  width: 240px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-sidebar);
  color: var(--ink-on-sidebar);
  display: flex;
  flex-direction: column;
  padding: 28px var(--space-4);
  gap: 22px;
}

.brand { padding: 0 var(--space-2); display: flex; flex-direction: column; gap: 2px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 26px; color: var(--ink-on-sidebar); }
.brand-sub { font-size: 12px; line-height: 16px; color: var(--ink-on-sidebar-muted); overflow-wrap: anywhere; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,0.12); padding-top: var(--space-4); }
.nav-eyebrow {
  padding: 0 14px; margin-bottom: var(--space-1);
  font-size: 11.5px; line-height: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-on-sidebar-muted);
}
.nav-link {
  display: block; padding: 9px 14px; border-radius: 8px;
  font-size: 14px; line-height: 20px; color: var(--ink-on-sidebar-muted);
}
.nav-link:hover { color: var(--ink-on-sidebar); background: rgba(255,255,255,0.06); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--ink-on-sidebar); background: rgba(255,255,255,0.12); font-weight: 600; }
.sidebar :focus-visible { outline-color: var(--ink-on-sidebar); }

.nav-logout { margin: 0; padding: 0 var(--space-2); }
.nav-logout button {
  width: 100%; text-align: left; background: transparent; border: 1px solid rgba(255,255,255,0.25);
  color: var(--ink-on-sidebar); font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.nav-logout button:hover { background: rgba(255,255,255,0.08); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex-grow: 1; padding: 36px 44px; display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; max-width: 1180px; width: 100%; }

.topbar, .bottom-nav { display: none; }

/* Mobile : web responsive uniquement (doc16 §0) — barre haute + navigation basse
   à quatre entrées (maquette « Tableau de bord — mobile »). Le menu complet
   reste accessible par « Menu » : aucun écran n'est retiré par le responsive. */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    background: var(--surface-sidebar); color: var(--ink-on-sidebar);
    padding: 14px var(--space-4); position: sticky; top: 0; z-index: 30;
  }
  .topbar .brand-name { font-size: 19px; }
  .menu-mobile { position: static; }
  .menu-mobile summary {
    list-style: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-on-sidebar);
    border: 1px solid rgba(255,255,255,0.3); border-radius: var(--radius-pill); padding: 8px 16px; min-height: 44px; display: flex; align-items: center;
  }
  .menu-mobile summary::-webkit-details-marker { display: none; }
  .menu-mobile[open] .menu-panel {
    position: absolute; left: 0; right: 0; top: 100%; max-height: calc(100vh - 64px); overflow-y: auto;
    background: var(--surface-sidebar); padding: var(--space-4); display: flex; flex-direction: column; gap: 18px;
    box-shadow: var(--shadow-popover);
  }
  .topbar :focus-visible { outline-color: var(--ink-on-sidebar); }
  .main { padding: var(--space-6) var(--space-4) 96px; gap: var(--space-4); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface-card); border-top: 1px solid var(--border);
  }
  .bottom-nav a {
    flex: 1; text-align: center; padding: 12px 0 14px; min-height: 48px;
    font-size: 12px; font-weight: 500; color: var(--ink-muted);
  }
  .bottom-nav a[aria-current="page"] { color: var(--brand); font-weight: 700; box-shadow: inset 0 3px 0 var(--brand); }
  .bottom-nav a:hover { text-decoration: none; }
}

/* ---------------------------------------------------------- typographie */
.breadcrumb { font-size: 13px; color: var(--ink-muted); }
.breadcrumb:hover { color: var(--brand); }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); }
.page-header h1 { font-family: var(--font-display); font-weight: 600; font-size: 27px; line-height: 32px; color: var(--ink); }
.page-subtitle { font-size: 13px; line-height: 19px; color: var(--ink-muted); margin-top: var(--space-1); max-width: 70ch; }

.eyebrow { font-size: 11.5px; line-height: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.figure { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.small { font-size: 12.5px; line-height: 18px; }

/* Pastille de mois (radius-pill : forme réservée aux statuts et aux mois) */
.pill {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 16px;
  background: var(--surface-card); color: var(--ink); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: var(--radius-pill); white-space: nowrap;
}
.pill-warn { background: var(--status-attention-bg); color: var(--status-attention); border-color: var(--status-attention-border); }
.pill-neutral { background: var(--surface-sunken); color: var(--ink-muted); }

/* --------------------------------------------------------------- Card */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 22px; color: var(--ink); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.card-accent { background: var(--brand-soft); border-color: var(--border-strong); }
.card-attention { background: var(--status-attention-bg); border-color: var(--status-attention-border); }
.card-dashed { background: var(--surface-sunken); border: 1px dashed var(--ink-faint); box-shadow: none; }
.card-foot { margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: 12.5px; line-height: 18px; color: var(--ink-muted); }

/* États de Card : « un manque reste un manque » (doc16 §2 n° 6) */
.etat-vide { font-size: 13px; line-height: 19px; color: var(--ink-muted); }
.etat-indisponible { font-size: 13px; line-height: 19px; color: var(--ink-muted); }
.etat-indisponible strong { display: block; color: var(--status-attention); font-size: 13px; margin-bottom: var(--space-1); }
.empty { font-size: 13px; line-height: 19px; color: var(--ink-muted); }

/* Tuiles de synthèse (StatTile) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--space-4); }
.stat {
  background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.stat.accent { background: var(--brand-soft); border-color: var(--border-strong); }
.stat-label { font-size: 12.5px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-muted); }
.stat.accent .stat-label { color: var(--brand); }
.stat-value { font-family: var(--font-mono); font-weight: 500; font-size: 28px; line-height: 32px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-note { font-size: 13px; line-height: 19px; color: var(--ink-muted); }

.two-col { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-4); align-items: start; }
.two-col-eq { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
@media (max-width: 900px) { .two-col, .two-col-eq, .three-col { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- Button */
button, .btn {
  font-family: var(--font-body); font-size: 13.5px; line-height: 18px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 9px 16px; min-height: 40px; border-radius: var(--radius-md); border: 1px solid var(--border-strong);
  background: var(--surface-card); color: var(--brand); cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-soft); text-decoration: none; color: var(--brand-strong); }
.btn-primary, button.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn-primary:hover, button.primary:hover { background: var(--brand-strong); color: var(--on-brand); border-color: var(--brand-strong); }
.btn-secondary { background: var(--surface-card); color: var(--brand); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--ink-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-danger, button.warn { background: var(--status-critical-bg); color: var(--status-critical); border-color: transparent; }
.btn-danger:hover, button.warn:hover { background: var(--status-critical-bg); color: var(--status-critical); filter: brightness(0.96); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 12.5px; }
.btn-lien { border: 0; background: transparent; padding: 0; min-height: 0; font-size: 13px; color: var(--brand); }
.btn-lien:hover { background: transparent; text-decoration: underline; }
form.inline { display: inline; }

/* Rappel « validation obligatoire » : toujours à proximité d'une action à risque élevé (règle n° 14) */
.rappel-validation {
  display: inline-block; font-family: var(--font-mono); font-size: 11.5px; line-height: 16px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--status-attention-bg); color: var(--status-attention);
}

/* -------------------------------------------------------- ConfidenceBadge */
.conf { position: relative; display: inline-block; vertical-align: middle; }
.conf > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 9px; border-radius: var(--radius-pill); font-size: 12.5px; line-height: 16px; font-weight: 600;
  min-height: 26px;
}
.conf > summary::-webkit-details-marker { display: none; }
.conf > summary::after {
  content: ''; width: 5px; height: 5px; margin-left: 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}
.conf[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.conf > summary .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin: 0; background: currentColor; }
.conf-confirmed > summary { background: var(--confidence-confirmed-bg); color: var(--confidence-confirmed); }
.conf-estimated > summary { background: var(--confidence-estimated-bg); color: var(--confidence-estimated); }
.conf-toverify > summary { background: var(--confidence-toverify-bg); color: var(--confidence-toverify); }
.conf-simulated > summary { background: var(--confidence-simulated-bg); color: var(--confidence-simulated); }
.conf-unknown > summary { background: var(--confidence-unknown-bg); color: var(--confidence-unknown); }
.conf-panel {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 340px; max-width: calc(100vw - 32px);
  background: var(--surface-card); color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover); padding: var(--space-4); font-size: 13px; line-height: 19px;
  display: flex; flex-direction: column; gap: var(--space-2); font-weight: 400; text-align: left;
}
.conf-droite .conf-panel { left: auto; right: 0; }
.conf-panel dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.conf-panel dt { color: var(--ink-muted); font-size: 12.5px; }
.conf-panel dd { margin: 0; overflow-wrap: anywhere; }
.conf-panel pre { margin: 0; white-space: pre-wrap; font-family: var(--font-mono); font-size: 12px; line-height: 17px; }
.conf-sep { border: 0; border-top: 1px solid var(--border); margin: 2px 0; width: 100%; }

/* Mot technique, réservé aux écrans techniques (Paramètres réglementaires, journal) */
.terme-technique { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em; }

/* -------------------------------------------------------------- StatusTag */
.tag, .statut {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: 11.5px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--status-muted-bg); color: var(--ink-muted); white-space: nowrap;
}
.statut-haute, .tag-haute, .tag-eleve { background: var(--status-critical-bg); color: var(--status-critical); }
.statut-moyenne, .tag-moyenne, .tag-moyen { background: var(--status-attention-bg); color: var(--status-attention); }
.statut-faible, .tag-faible { background: var(--status-muted-bg); color: var(--ink-muted); }
.statut-attente { background: var(--status-attention-bg); color: var(--status-attention); }
.statut-traite, .statut-succes { background: var(--status-success-bg); color: var(--status-success); }
.statut-rejete { background: var(--status-critical-bg); color: var(--status-critical); }
.statut-neutre { background: var(--status-muted-bg); color: var(--ink-muted); }

/* Termes techniques de confiance (écrans techniques uniquement : doc16 §4.3) */
.tag-CERTAIN { background: var(--confidence-confirmed-bg); color: var(--confidence-confirmed); }
.tag-PROBABLE { background: var(--confidence-estimated-bg); color: var(--confidence-estimated); }
.tag-A_VERIFIER { background: var(--confidence-toverify-bg); color: var(--confidence-toverify); }
.tag-HYPOTHESE { background: var(--confidence-simulated-bg); color: var(--confidence-simulated); }
.tag-INCONNU { background: var(--confidence-unknown-bg); color: var(--confidence-unknown); }

/* ---------------------------------------------------- lignes et alertes */
.row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; }
.row + .row { margin-top: 2px; }
.row-title { font-size: 13.5px; line-height: 19px; color: var(--ink); }
.row-sub { font-size: 12.5px; line-height: 18px; color: var(--ink-muted); margin-top: 2px; }
.row-warn { background: var(--status-attention-bg); }
.row-neutral { background: var(--surface-sunken); }

.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot-ok { background: var(--status-success); }
.dot-warn { background: var(--status-attention); }
.dot-muted { background: var(--ink-muted); }

.alerte { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border-radius: 8px; }
.alerte + .alerte { margin-top: var(--space-2); }
.alerte .statut { margin-top: 1px; flex: none; }
.alerte-haute { background: var(--status-critical-bg); }
.alerte-moyenne { background: var(--status-attention-bg); }
.alerte-faible { background: var(--surface-sunken); }
.alerte-titre { font-size: 13.5px; line-height: 19px; font-weight: 600; color: var(--ink); }
.alerte-detail { font-size: 12.5px; line-height: 18px; color: var(--ink-muted); margin-top: 2px; }

.a-valider {
  border: 1px solid var(--status-attention-border); background: var(--status-attention-bg); border-radius: 8px;
  padding: var(--space-4); display: flex; flex-direction: column; gap: 10px;
}
.a-valider + .a-valider { margin-top: var(--space-2); }

.compteur {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--radius-pill); background: var(--status-attention); color: var(--on-status);
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
}

/* ------------------------------------------------------------ StepTracker */
.etapes { display: flex; flex-direction: column; max-width: 760px; }
.etape { display: flex; gap: var(--space-3); padding: 10px 0 10px 20px; border-left: 2px solid var(--border); margin-left: 11px; position: relative; align-items: flex-start; }
.etape:last-child { border-left-color: transparent; }
.etape-icone {
  position: absolute; left: -11px; top: 10px; width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; line-height: 1;
}
.etape-fait .etape-icone { background: var(--status-success-bg); color: var(--status-success); }
.etape-attente .etape-icone { background: var(--status-attention-bg); color: var(--status-attention); }
.etape-a-venir .etape-icone { background: var(--status-muted-bg); color: var(--ink-muted); }
.etape-indisponible .etape-icone { background: var(--status-attention-bg); color: var(--status-attention); }
.etape-texte { flex: 1; min-width: 0; font-size: 13.5px; line-height: 20px; color: var(--ink); }
.etape-sous { font-size: 12.5px; line-height: 18px; color: var(--ink-muted); margin-top: 2px; }
.etape-action {
  display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--status-attention);
  background: var(--status-attention-bg); padding: 4px 12px; border-radius: var(--radius-pill);
}
.etape-action:hover { text-decoration: none; filter: brightness(0.96); color: var(--status-attention); }
.etape-a-venir .etape-texte { color: var(--ink-muted); }

/* ---------------------------------------------------------------- tableaux */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; line-height: 14px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--surface-sunken); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

/* ---------------------------------------------------------------- formulaires */
select, input[type=text], input[type=number], input[type=month], input[type=date], input[type=email], input[type=password], input[type=file], textarea {
  font-family: var(--font-body); font-size: 14px; line-height: 20px; padding: 8px 12px; min-height: 40px;
  border-radius: var(--radius-sm); border: 1px solid var(--ink-faint); background: var(--surface-card); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input[type=text], input[type=number], input[type=month], input[type=date], input[type=email], input[type=password], select, textarea { max-width: 100%; }
.field input[type=text], .field input[type=number], .field input[type=month], .field input[type=date], .field input[type=email], .field input[type=password], .field select, .field textarea { width: 100%; }
input:disabled, select:disabled { background: var(--surface-sunken); color: var(--ink-muted); }
.champ-code { font-family: var(--font-mono); letter-spacing: 0.12em; text-align: center; font-size: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-muted); }
.field-hint { font-size: 12.5px; line-height: 18px; color: var(--ink-muted); }
.champ-manquant { border-color: var(--status-attention); background: var(--status-attention-wash); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; align-items: start; }
.checkbox-row { display: flex; align-items: center; gap: var(--space-2); font-size: 13.5px; }
.checkbox-row input { margin: 0; width: 18px; height: 18px; accent-color: var(--brand); }
.checkbox-row label { text-transform: none; font-size: 13.5px; font-weight: 400; letter-spacing: 0; color: var(--ink); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar label { font-size: 12.5px; font-weight: 600; color: var(--ink-muted); }

/* ------------------------------------------------------------- messages */
.flash { padding: 10px 14px; border-radius: var(--radius-md); font-size: 13.5px; line-height: 19px; }
.flash-success { background: var(--status-success-bg); color: var(--status-success); border: 1px solid var(--border-strong); }
.flash-error { background: var(--status-critical-bg); color: var(--status-critical); border: 1px solid var(--status-critical-border); }
.flash-warning { background: var(--status-attention-bg); color: var(--status-attention); border: 1px solid var(--status-attention-border); }
.champ-erreur { color: var(--status-critical); font-size: 12.5px; line-height: 18px; }
.bandeau-brouillon { background: var(--status-attention-bg); color: var(--status-attention); border: 1px solid var(--status-attention-border); border-radius: var(--radius-md); padding: 10px 14px; font-size: 13.5px; line-height: 19px; }
.etat-nomme { border-left: 4px solid var(--status-attention-border); }

.footnote { font-size: 12.5px; line-height: 18px; color: var(--ink-muted); margin-top: auto; max-width: 90ch; }

.explain { font-size: 12.5px; line-height: 18px; color: var(--ink-muted); background: var(--surface-sunken); border-radius: var(--radius-md); padding: 12px 14px; }
.explain pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12px; line-height: 17px; margin: 6px 0 0; }

/* ------------------------------------------------ écrans de garde (connexion) */
.garde { min-height: 100vh; display: flex; background: var(--surface-sidebar); }
.garde-marque {
  flex: 1; padding: var(--space-16); display: flex; flex-direction: column; justify-content: center; gap: 18px; color: var(--ink-on-sidebar);
}
.garde-marque .brand-name { font-size: 22px; }
.garde-titre { font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 46px; letter-spacing: -0.01em; color: var(--ink-on-sidebar); max-width: 440px; }
.garde-texte { font-size: 14px; line-height: 21px; color: var(--ink-on-sidebar-muted); max-width: 400px; }
.garde-points { display: flex; gap: 20px; margin-top: var(--space-6); flex-wrap: wrap; }
.garde-point { display: flex; align-items: center; gap: var(--space-2); font-size: 12.5px; color: var(--ink-on-sidebar-muted); }
.garde-point::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-glow); flex: none; }
.garde-formulaire {
  flex: none; width: 460px; background: var(--surface-page); display: flex; align-items: center; justify-content: center;
  padding: var(--space-8) var(--space-6);
}
.garde-contenu { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.garde-contenu > .card { box-shadow: none; border: 0; background: transparent; padding: 0; }
.garde-contenu > .card > .card-title { font-size: 21px; line-height: 26px; }
.garde-contenu .sr-h1 { margin: 0; }
@media (max-width: 900px) {
  .garde { flex-direction: column; }
  .garde-marque { padding: var(--space-8) var(--space-4); }
  .garde-titre { font-size: 27px; line-height: 32px; }
  .garde-formulaire { width: 100%; padding: var(--space-6) var(--space-4) var(--space-12); }
}

/* --------------------------------------------- alias hérités (à supprimer
   dès qu'aucun gabarit ne les référence plus — contrôle : grep var(--muted) etc.) */
:root {
  --bg: var(--surface-page);
  --sidebar: var(--surface-sidebar);
  --sidebar-ink: var(--ink-on-sidebar);
  --accent-light: var(--brand-soft);
  --accent-border: var(--border-strong);
  --accent-ink: var(--brand);
  --ok: var(--status-success);
  --muted: var(--ink-muted);
  --muted2: var(--ink-muted);
  --warn-bg: var(--status-attention-bg);
  --warn-border: var(--status-attention-border);
  --warn-ink: var(--status-attention);
  --neutral-bg: var(--surface-sunken);
  --white: var(--surface-card);
}
main#contenu { flex: 1; min-width: 0; display: flex; }

/* Compléments de gabarits (pas de style en ligne : la CSP les tolère, mais les tokens restent la seule source) */
.detail-cell { max-width: 320px; }
.champ-court { width: 170px; }
tr.total td { font-weight: 600; }
.btn-plein { width: 100%; }
.garde-contenu .toolbar { margin-top: var(--space-2); }
.alerte-titre { font-weight: 500; }
@media (max-width: 900px) { .alerte { flex-direction: column; gap: var(--space-2); } }
.etape-fait .etape-action { color: var(--brand); background: var(--brand-soft); }
.mt { margin-top: var(--space-3); }
.form-1col { grid-template-columns: 1fr; }
.info-titre { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin: var(--space-4) 0 6px; }
.info-para { margin: 4px 0; font-size: 13.5px; }

.card > form:not(.toolbar):not(.inline) { display: flex; flex-direction: column; gap: var(--space-4); }
td { overflow-wrap: anywhere; }
td.num { overflow-wrap: normal; }

/* StatusTag « pastille pleine » (maquette validée par Hugo le 29/09/2026 : les statuts prennent le style plein).
   Texte blanc sur jeton foncé : critical 6,5:1, attention 5,9:1, success 5,6:1, ink-muted 5,8:1 (>= 4,5:1). */
.statut { background: var(--ink-muted); }
.statut, .tag-haute, .tag-eleve, .tag-moyenne, .tag-moyen, .tag-faible { color: var(--on-status); }
.statut-haute, .tag-haute, .tag-eleve, .statut-rejete { background: var(--status-critical); color: var(--on-status); }
.statut-moyenne, .tag-moyenne, .tag-moyen, .statut-attente { background: var(--status-attention); color: var(--on-status); }
.statut-faible, .tag-faible, .statut-neutre { background: var(--ink-muted); color: var(--on-status); }
.statut-traite, .statut-succes { background: var(--status-success); color: var(--on-status); }
.rappel-validation { background: var(--status-attention); color: var(--on-status); }
