/* RGAA Audit — design system minimal, accessible (WCAG AA), HTML-first. */

:root {
  /* Neutres biaisés indigo (choisis, pas hérités) — contrastes ≥ AA */
  --ground: #ffffff;
  --surface: #f4f6fb;
  --surface-2: #eaeef7;
  --ink: #161a26;
  --muted: #565d72;
  --border: #dbe1ee;
  --border-strong: #c3cbdd;

  /* Marque : navy (sobriété Access42) */
  --navy: #182142; --navy-2: #212c53; --on-navy: #f4f7ff; --navy-muted: #a9b4d8;

  /* Primaire indigo (AA sur blanc) + accent ambré (usage rare) */
  --accent: #2f43c4;
  --accent-hover: #22319b;
  --accent-wash: #eceffb;
  --on-accent: #ffffff;
  --gold: #f4b60a; --gold-ink: #3a2c00;

  /* Sémantique conformité (distincte de l'accent) */
  --ok: #12794a; --ok-wash: #e5f3ea;
  --danger: #c23524; --danger-wash: #fbe9e6;
  --warn: #8a5a00; --warn-wash: #fbefd7;
  --na: #5c6472; --na-wash: #eef0f4;

  --shadow: 0 1px 2px rgba(24,33,66,.06), 0 8px 24px -12px rgba(24,33,66,.18);
  --shadow-lg: 0 2px 4px rgba(24,33,66,.06), 0 24px 48px -20px rgba(24,33,66,.28);

  /* Typographie auto-hébergée (cf. fonts.css) */
  --font-sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Hanken Grotesk", var(--font-sans);
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Rythme */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --space: 1rem;
  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f1320; --surface: #161b2b; --surface-2: #1e2436; --ink: #e9edf7;
    --muted: #a2abc2; --border: #2a3145; --border-strong: #3a445c;
    --navy: #0c1122; --navy-2: #161f3d; --on-navy: #eef2ff; --navy-muted: #9aa6cf;
    --accent: #8ea3ff; --accent-hover: #aab8ff; --accent-wash: #1a2140; --on-accent: #0f1320;
    --gold: #f6c33d; --gold-ink: #241a00;
    --ok: #54c98a; --ok-wash: #123122; --danger: #f2857a; --danger-wash: #361a17;
    --warn: #e0aa4f; --warn-wash: #2e2410; --na: #98a1b5; --na-wash: #20263a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 28px 56px -24px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Lien d'évitement (skip-link) : visible au focus */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Focus visible marqué partout */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.01em;
  text-wrap: balance; }
h1 { font-size: 2rem; font-weight: 800; margin: 0 0 0.75rem; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }

code { font-family: var(--font-mono); font-size: 0.9em; }
/* « codes & données » : plus de mono — Public Sans à chiffres tabulaires (option B) */
.mono { font-variant-numeric: tabular-nums; font-weight: 600; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space);
}

/* En-tête — barre de marque navy */
.site-header {
  background: var(--navy);
  color: var(--on-navy);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--on-navy);
  text-decoration: none;
  font-size: 1.15rem;
}
.site-nav { display: flex; gap: 1.1rem; align-items: center; }
.site-nav a:not(.btn) { color: var(--navy-muted); text-decoration: none; font-weight: 500; }
.site-nav a:not(.btn):hover { color: var(--on-navy); }
.site-header .mono { color: var(--navy-muted); font-size: 0.85rem; }
.site-header :focus-visible { outline-color: var(--gold); }

/* Coquille d'application — rail de navigation navy (utilisateur authentifié) */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; width: 100%; }
.app-shell--anon { display: block; }
.shell-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.rail { flex: 0 0 236px; background: var(--navy); color: var(--on-navy);
  display: flex; flex-direction: column; gap: 4px; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; }
.rail .brand { color: var(--on-navy); font-size: 1.15rem; padding: 4px 10px; margin-bottom: 16px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a { color: var(--navy-muted); text-decoration: none; padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm); font-weight: 500; }
.rail-nav a:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-navy); }
.rail-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.10); color: var(--on-navy);
  box-shadow: inset 3px 0 0 var(--gold); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem;
  padding-top: 0.9rem; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.rail-user { color: var(--navy-muted); font-size: 0.78rem; word-break: break-all; }
.rail :focus-visible { outline-color: var(--gold); }
@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .rail { position: static; height: auto; flex-basis: auto; flex-direction: row;
    flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
  .rail .brand { margin-bottom: 0; }
  .rail-nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center;
    border-top: none; padding-top: 0; gap: 0.8rem; }
}

/* Contenu principal */
main { flex: 1 1 auto; }
main.container { padding-top: 2rem; padding-bottom: 3rem; }

/* Messages (django.contrib.messages) */
.messages { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }
.messages li {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--surface);
}
.messages li.success { border-left-color: var(--ok); }
.messages li.error { border-left-color: var(--danger); }
.messages li.warning { border-left-color: var(--warn); }

/* Boutons & formulaires */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}
.btn:active { transform: translateY(1px); }
.btn-secondary {
  background: var(--ground);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface); color: var(--accent); border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* Boutons de soumission bruts (formulaires allauth…) → allure de bouton primaire */
button[type="submit"]:not(.btn), input[type="submit"]:not(.btn) {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 0.55rem 1.1rem; border-radius: var(--radius-pill);
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
}
button[type="submit"]:not(.btn):hover, input[type="submit"]:not(.btn):hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
}

form p { margin: 0 0 1rem; display: grid; gap: 0.35rem; }
label { font-weight: 600; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  max-width: 100%;
}
.helptext { color: var(--muted); font-size: 0.85rem; }
.errorlist { color: var(--danger); margin: 0.25rem 0 0; padding-left: 1.1rem; }

/* Pied de page */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.25rem 0;
}

.muted { color: var(--muted); }

/* Listes de cartes (clients, accès rapides) */
.card-list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.5rem; }
.card-list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--surface);
}

/* Aide contextuelle : pictogramme « ? » flottant en haut à droite + panneau */
.help-fab { position: fixed; top: 14px; right: 18px; z-index: 60; }
.help-fab-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--ground); color: var(--accent); font-family: var(--font-display); font-weight: 800;
  font-size: 1.15rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.help-fab-btn:hover { border-color: var(--accent); background: var(--accent-wash); }
.help-panel-pop { position: fixed; top: 58px; right: 18px; width: min(380px, calc(100vw - 36px));
  max-height: min(70vh, 560px); overflow: auto; background: var(--ground);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 0.9rem 1rem; z-index: 60; }
.help-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem; }
.help-panel-head strong { font-family: var(--font-display); }
.help-panel-close { border: none; background: none; color: var(--muted); font-size: 1rem;
  cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.help-panel-close:hover { color: var(--ink); background: var(--surface); }
.help-content { color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.5rem; }

/* Badge « non applicable » (texte + fond, jamais couleur seule) */
.na-badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

/* Grille de saisie (critères d'une page) */
.grid-list { list-style: none; margin: 0.5rem 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }
.grid-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  background: var(--surface);
}
.grid-crit { flex: 1 1 320px; margin: 0; font-weight: 400; }
.grid-crit .mono { font-weight: 700; color: var(--accent); }
.grid-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0; }
.grid-controls input[type="text"] { min-width: 12rem; }
.grid-comment { flex: 1 1 100%; min-height: 3rem; resize: vertical; font: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--ground); color: inherit; }
.grid-comment-ro { display: block; white-space: pre-wrap; max-width: 42rem; }
.grid-help { flex: 0 0 auto; }
.grid-help[open] { flex: 1 1 100%; }  /* ouverte : le panneau prend sa propre ligne */
.grid-help-sum { cursor: pointer; color: var(--accent); font-size: 0.9rem; list-style: none;
  user-select: none; }
.grid-help-sum::-webkit-details-marker { display: none; }
.grid-help-sum::before { content: "?"; display: inline-flex; align-items: center;
  justify-content: center; width: 1.1rem; height: 1.1rem; margin-right: 0.25rem;
  border: 1px solid currentColor; border-radius: 50%; font-size: 0.72rem; font-weight: 700; }
.grid-help[open] .grid-help-sum { font-weight: 700; }
.grid-help-panel { flex-basis: 100%; }
.grid-help-panel .criterion-help { margin-top: 0.5rem; padding: 0.6rem 0.9rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius); }
.grid-help-panel h3, .grid-help-panel h4 { margin: 0.3rem 0; font-size: 0.95rem; }
.saved { color: var(--ok); font-size: 0.85rem; min-width: 6rem; }

/* Indicateurs visuels de statut par critère (couleur + pastille, jamais la couleur seule) */
.grid-row { border-left-width: 4px; border-left-color: var(--border); }
.grid-flag { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--border); }
.grid-row[data-status="C"] { border-left-color: var(--ok); }
.grid-row[data-status="NC"] { border-left-color: var(--danger); }
.grid-row[data-status="NT"] { border-left-color: var(--warn); }
.grid-row[data-status="NA"] { border-left-color: var(--muted); }
.grid-row[data-status="C"] .grid-flag { background: var(--ok); }
.grid-row[data-status="NC"] .grid-flag { background: var(--danger); }
.grid-row[data-status="NT"] .grid-flag { background: var(--warn); }
.grid-row[data-status="NA"] .grid-flag { background: var(--muted); }

/* Motif d'en-tête d'écran : bouton retour + titre sur une ligne (haut à gauche) */
.page-head { display: flex; align-items: center; gap: 0.6rem; }
.page-head h1 { margin: 0; }
/* Infos de campagne (référentiel/statut/ouverte par) repliées derrière un picto « i ». */
.info-pop { position: relative; }
.info-pop-btn { list-style: none; cursor: pointer; width: 1.5rem; height: 1.5rem;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid var(--border-strong); color: var(--muted); font-family: var(--font-display);
  font-weight: 700; font-style: italic; font-size: 0.9rem; line-height: 1; user-select: none; }
.info-pop-btn::-webkit-details-marker { display: none; }
.info-pop-btn:hover { color: var(--ink); border-color: var(--ink); }
.info-pop[open] .info-pop-btn { color: var(--ink); border-color: var(--ink); }
.info-pop-panel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0;
  min-width: 15rem; margin: 0; padding: 0.7rem 0.9rem; background: var(--ground);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; }
.info-pop-panel dt { color: var(--muted); font-size: 0.82rem; }
.info-pop-panel dd { margin: 0; font-size: 0.9rem; word-break: break-word; }
.back { flex: 0 0 auto; display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--border-strong); color: var(--ink); text-decoration: none;
  font-size: 1.1rem; line-height: 1; }
.back:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.page-sub { margin: 0.3rem 0 0; }

/* Grille de saisie repensée — haut (scan condensé) + accordéons par thématique (S8.5) */
.grid-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.25rem; }
.grid-top-left { flex: 1 1 260px; min-width: 0; }  /* pousse le widget de scan en haut à droite */
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.prog-global { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-top: 0.6rem; font-size: 0.9rem; }
.bar { width: 150px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .2s ease; }

/* Widget de scan condensé, calé en haut à droite */
.scanbox { display: flex; align-items: center; gap: 0.7rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0.4rem 0.7rem 0.4rem 0.5rem;
  box-shadow: var(--shadow); flex: 0 0 auto; }
.scan-ring { --sp: 0; position: relative; width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--sp) * 1%), var(--surface-2) 0); }
.scan-ring::before { content: ""; position: absolute; width: 33px; height: 33px; border-radius: 50%;
  background: var(--surface); }
.scan-ring i { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.scan-ring b { font-family: var(--font-display); font-weight: 800; font-size: 0.78rem; }
.scan-ring small { font-size: 0.52rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.scan-ring.scanning { background: var(--surface-2); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--surface-2);
  border-top-color: var(--accent); animation: scan-spin .8s linear infinite; }
@keyframes scan-spin { to { transform: rotate(360deg); } }
.scan-meta { display: flex; flex-direction: column; gap: 0.25rem; }
.scan-live-line { font-size: 0.74rem; color: var(--muted); }
.scan-btn { align-self: flex-start; }

.themes { display: flex; flex-direction: column; gap: 0.6rem; }
details.theme { border: 1px solid var(--border); border-radius: var(--radius); background: var(--ground); }
details.theme[open] { box-shadow: var(--shadow); }
details.theme.is-complete { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.theme > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.9rem; flex-wrap: wrap; }
.theme > summary::-webkit-details-marker { display: none; }
.theme .chev { color: var(--muted); transition: transform .15s ease; flex: 0 0 auto; }
details.theme[open] .chev { transform: rotate(90deg); }
.theme-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; flex: 0 0 auto; }
.theme-bar { flex: 1 1 90px; max-width: 170px; height: 8px; border-radius: 99px;
  background: var(--surface-2); overflow: hidden; }
.theme-bar > i { display: block; height: 100%; background: var(--ok); transition: width .2s ease; }
.theme-counts { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.mini { font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; border: 1px solid; }
.m-c { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.m-nc { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.m-na { color: var(--na); border-color: color-mix(in srgb, var(--na) 35%, transparent); }
.m-nt { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 38%, transparent); }
.theme .done { color: var(--ok); font-weight: 700; font-size: 0.82rem; }
.theme-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
.theme-body { border-top: 1px solid var(--border); padding: 0.2rem 0.9rem 0.6rem; }
.theme-body .grid-list { margin: 0; }
@media (max-width: 680px) { .grid-top { flex-direction: column; } .scanbox { width: 100%; } }

/* Synthèse d'avancement de la grille (boutons-filtres) */
.grid-synthese { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 1rem; margin: 0.5rem 0 1rem; background: var(--surface); }
.grid-synthese h2 { margin: 0.2rem 0 0.5rem; font-size: 1rem; }
.syn-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.syn { display: inline-flex; align-items: baseline; gap: 0.3rem; cursor: pointer; font: inherit; color: inherit; background: var(--ground); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.8rem; }
.syn:hover { border-color: var(--accent); }
.syn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.syn-pct { font-size: 1.15rem; font-weight: 700; }
.syn-n { color: var(--muted); }
.syn-n::before { content: "("; }
.syn-n::after { content: ")"; }
.syn-C .syn-pct { color: var(--ok); }
.syn-NC .syn-pct { color: var(--danger); }
.syn-NT .syn-pct { color: var(--warn); }
.syn-NA .syn-pct { color: var(--muted); }
.syn-status { margin: 0.5rem 0 0; min-height: 1.2em; }
/* Masquage effectif malgré le display:flex des lignes */
.grid-row[hidden], .grid-list[hidden] { display: none; }

/* Synthèse de conformité (S4.4) */
.synthese { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0.5rem 0 1rem; }
.synthese dt { font-weight: 600; color: var(--muted); }
.synthese dd { margin: 0; }

/* Synthèse de conformité — jauge + répartition (S8.4d) */
.conformity { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem;
  background: var(--ground); box-shadow: var(--shadow); margin: 0.5rem 0 1.25rem; }
.ring { --p: 0; position: relative; width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring::before { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%;
  background: var(--ground); }
.ring-val { position: relative; font-family: var(--font-display); font-weight: 800;
  font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1; }
.ring-prov { position: relative; font-size: 0.6rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-top: 2px; }
.conformity-meta { min-width: 0; flex: 1 1 16rem; }
.conformity .level { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
  margin: 0 0 0.2rem; }
.status-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }
.status-pills .badge { font-variant-numeric: tabular-nums; }
.conformity-actions { margin: 0.8rem 0 0; }

/* Pages de l'échantillon — taux + URL + démarrer/poursuivre (S8.5f) */
.page-list { list-style: none; margin: 0.5rem 0 1.5rem; padding: 0;
  display: flex; flex-direction: column; gap: 0.5rem; }
.page-item { display: flex; align-items: center; gap: 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.9rem; background: var(--ground); box-shadow: var(--shadow); }
.page-rate { flex: 0 0 auto; width: 54px; display: inline-flex; align-items: baseline;
  justify-content: center; gap: 1px; color: var(--ink); }
.page-rate b { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.page-rate small { color: var(--muted); font-size: 0.72rem; }
/* En cours : le grand chiffre est l'avancement (ton neutre/info), pas la conformité. */
.page-rate-prog { color: var(--accent); }
.page-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.page-label { font-weight: 600; }
.page-url { font-size: 0.82rem; word-break: break-all; }
.page-sub { font-size: 0.82rem; }
.page-go { flex: 0 0 auto; }
@media (max-width: 620px) { .page-item { flex-wrap: wrap; } }
.notice { border-left: 4px solid var(--border); padding: 0.5rem 0.8rem; border-radius: var(--radius); background: var(--surface); }
.notice-ok { border-left-color: var(--ok); }
.notice-blocked { border-left-color: var(--danger); }

/* Tableaux de données & badges de gravité (S6.1) */
.data-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1.5rem; }
.data-table th, .data-table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { border-bottom: 2px solid var(--border); color: var(--muted); }
.data-table tbody th[scope="row"] { font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); }
.badge-critique { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.badge-majeur { border-color: var(--warn); color: var(--warn); }
.badge-mineur { border-color: var(--muted); color: var(--muted); }
.badge-auto { border-color: var(--accent); color: var(--accent); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-partial { border-color: var(--warn); color: var(--warn); background: var(--warn-wash); }
/* Conformité : pastille pleine + point d'état (couleur ET forme, jamais la couleur seule) */
.badge-C  { color: var(--ok);     background: var(--ok-wash);     border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge-NC { color: var(--danger); background: var(--danger-wash); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-NA { color: var(--na);     background: var(--na-wash);     border-color: color-mix(in srgb, var(--na) 30%, transparent); }
.badge-NT { color: var(--warn);   background: var(--warn-wash);   border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.badge-C::before, .badge-NC::before, .badge-NA::before, .badge-NT::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.qsection { margin-bottom: 1rem; }
.qrow { margin: 0.4rem 0; }
.qopt { display: inline-flex; gap: 0.25rem; align-items: center; margin-right: 0.8rem; }
.qcard h3 { margin: 0.2rem 0; font-size: 0.95rem; }
.qcard-thumb { display: block; max-width: 180px; max-height: 100px; margin: 0.4rem 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  object-fit: contain; padding: 4px; }

/* Aperçu visuel guidé (S8.3b) */
/* Aperçu guidé pleine largeur + panneau de questions flottant (S8.5b) */
.guided-stage { position: relative; margin-top: 0.5rem; }
/* Barre d'outils compacte : on cherche à tenir device-switch + résolution/zoom + actions sur une
   ligne. Éléments dimensionnés serré ; retour à la ligne (en bloc) seulement si vraiment étroit. */
.stage-toolbar { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.device-switch { display: inline-flex; border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill); overflow: hidden; }
.device-switch button { font: inherit; font-weight: 600; font-size: 0.76rem; border: none;
  background: var(--ground); color: var(--muted); padding: 4px 9px; cursor: pointer; }
.device-switch button + button { border-left: 1px solid var(--border-strong); }
.device-switch button.on { background: var(--accent); color: var(--on-accent); }
.zoom-info { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.locate-hint { color: var(--warn); font-size: 0.75rem; }
.locate-banner { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.5rem;
  background: var(--warn-wash); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; color: var(--ink); font-size: 0.88rem; }
/* L'attribut `hidden` doit l'emporter sur le `display:flex` ci-dessus (sinon bannière vide figée). */
.locate-banner[hidden] { display: none; }
.locate-banner-close { margin-left: auto; border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 0.95rem; padding: 0 4px; flex: 0 0 auto; }
.locate-banner-close:hover { color: var(--ink); }
/* Outils d'aperçu (popins, CSS, texte, espacement) : groupés à droite, espacement régulier,
   passage à la ligne en bloc sur écran étroit ; teinte accent quand l'outil est actif. */
.stage-tools { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-left: auto; }
.stage-tools .btn-sm { padding: 0.28rem 0.6rem; font-size: 0.77rem; }
.stage-tools .btn-sm[aria-pressed="true"] { background: var(--accent); color: var(--on-accent);
  border-color: var(--accent); }
/* Émulation d'un viewport desktop : l'iframe est rendue large puis mise à l'échelle pour tenir. */
.preview-viewport { position: relative; height: 82vh; overflow: hidden; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); }
#preview-frame { display: block; border: 0; background: #fff; transform-origin: top left; }
.qfloat { position: absolute; right: 16px; bottom: 16px; width: min(560px, calc(100% - 32px));
  max-height: 72%; display: flex; flex-direction: column; z-index: 5;
  background: var(--ground); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); }
.qfloat.min { max-height: none; }
.qfloat-handle { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem;
  background: var(--surface); border-bottom: 1px solid var(--border); border-radius: 14px 14px 0 0;
  cursor: grab; touch-action: none; }
.qfloat.min .qfloat-handle { border-bottom: none; border-radius: 14px; }
.qfloat-handle:active { cursor: grabbing; }
.qgrip { color: var(--muted); letter-spacing: 2px; }
.qfloat-title { font-family: var(--font-display); font-weight: 700; }
.qfloat-tool { margin-left: auto; }
.qfloat-min { border: 1px solid var(--border-strong); background: var(--ground); color: var(--ink);
  border-radius: 8px; width: 30px; height: 28px; cursor: pointer; flex: 0 0 auto; }
.qfloat-body { padding: 0.7rem 0.9rem; overflow: auto; }
.qfloat.min .qfloat-body { display: none; }
@media (max-width: 700px) {
  #preview-frame { height: 68vh; }
  .qfloat { right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 58%; }
}
.review-list { list-style: none; margin: 0; padding: 0; }
.review-item { display: flex; gap: 0.5rem; align-items: baseline; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.35rem 0.5rem; margin: 0.25rem 0; }
.review-item:hover { border-color: var(--accent); }
.review-item[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.review-text { color: var(--muted); word-break: break-word; }
.preview-toolbar { margin-bottom: 0.4rem; }
.guide-card { border: 1px solid var(--border); border-left-width: 4px; border-left-color: var(--warn); border-radius: var(--radius); padding: 0.6rem 0.8rem; margin: 0.5rem 0; background: var(--ground); }
.guide-card[data-status="C"] { border-left-color: var(--ok); }
.guide-card[data-status="NC"] { border-left-color: var(--danger); }
.guide-card[data-status="NA"] { border-left-color: var(--muted); }
.guide-card h3 { margin: 0.2rem 0; font-size: 1rem; }
.guide-q { font-weight: 600; margin: 0.3rem 0; }
.guide-answer { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.guide-elements { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.guide-el { display: flex; gap: 0.4rem; align-items: baseline; padding: 0.1rem 0; }
.guide-tag { color: var(--accent); text-transform: uppercase; font-size: 0.72rem; }
.loc-el { background: none; border: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; text-align: left; word-break: break-word; }
.guide-el-missing > .loc-el { color: var(--danger); }
.guide-el-missing::before { content: "⚠ "; color: var(--danger); }
.guide-nav { display: flex; align-items: center; gap: 0.8rem; margin: 0.5rem 0; }
#guide-progress { font-weight: 600; }

/* Onglets par thématique — une seule thématique à la fois (S8.3f) */
.thematic-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0; }
.thematic-tab { font: inherit; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0.4rem 0.9rem; display: inline-flex; gap: 0.45rem; align-items: center; }
.thematic-tab:hover { color: var(--ink); border-color: var(--accent); }
.thematic-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.thematic-count { display: inline-block; min-width: 1.3em; padding: 0 0.4em; border-radius: var(--radius-pill); background: var(--border); color: var(--ink); font-size: 0.75rem; text-align: center; font-variant-numeric: tabular-nums; }
.thematic-tab[aria-selected="true"] .thematic-count { background: color-mix(in srgb, var(--on-accent) 22%, transparent); color: var(--on-accent); }
.thematic-done { color: var(--ok); font-weight: 800; }
.thematic-tab[aria-selected="true"] .thematic-done { color: var(--on-accent); }
/* Bloqueurs de conclusion d'une thématique (S8.5i) */
.pending-tag { color: var(--warn); font-weight: 700; font-size: 0.85rem; }
.thematic-panel h2 .done { color: var(--ok); font-weight: 700; font-size: 0.9rem; }
.blocker { border-left: 4px solid var(--warn); background: var(--warn-wash); color: var(--ink);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; margin: 0.4rem 0 0.6rem; font-size: 0.88rem; }
.qcard-done { border-left-color: var(--ok); opacity: 0.85; }
.qcard-check { color: var(--ok); font-weight: 800; float: right; }
/* Mutualisation des réponses (header/footer communs) */
.reused-tag { float: right; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--accent); background: var(--accent-wash);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius-pill);
  padding: 1px 8px; margin-left: 6px; }
.reused-note { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0 0.6rem;
  border-left: 3px solid var(--accent); padding-left: 0.6rem; }
/* Couverture RGAA de la thématique (états, dont « en attente ») */
.crit-states { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.2rem 0 0.7rem; }
.crit-states .badge { font-size: 0.72rem; }
.thematic-panel { padding-top: 0.3rem; }
/* Rebonds : poursuivre vers une autre thématique en fin de parcours (sans repasser par la grille). */
.thematic-rebonds { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.rebonds-title { margin: 0 0 0.4rem; font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.thematic-rebonds ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap;
  gap: 0.35rem; }
.rebond { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: none;
  font-weight: 600; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 0.4rem 0.9rem; }
.rebond:hover { border-color: var(--accent); color: var(--accent); }
/* Rebonds colorés selon l'avancement : vert = toutes les questions répondues, orange = il reste. */
.rebond-done { border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.rebond-done:hover { border-color: var(--ok); color: var(--ok); }
.rebond-todo { border-color: color-mix(in srgb, var(--warn) 55%, transparent); color: var(--warn); }
.rebond-todo:hover { border-color: var(--warn); color: var(--warn); }
/* Marqueur de thématique complète + bouton de retour à la grille. */
.thematic-done-banner { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-top: 0.9rem; padding: 0.6rem 0.8rem; border-radius: var(--radius);
  background: var(--ok-wash); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  font-size: 0.9rem; }
.tdb-check { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem;
  height: 1.4rem; border-radius: 50%; background: var(--ok); color: #fff; font-weight: 700;
  flex: 0 0 auto; }
.tdb-next { margin-left: auto; }
.guide-warn { color: var(--danger); font-size: 0.8rem; }
.img-judge { display: inline-flex; gap: 0.6rem; font-size: 0.85rem; margin-left: 0.4rem; }
.img-judge label { display: inline-flex; gap: 0.2rem; align-items: center; }

/* Restitution pédagogique — plan de correction par axe (S8.4) */
.restitution { margin: 1.5rem 0; }
.axis-block { border: 1px solid var(--border); border-radius: var(--radius); background: var(--ground);
  margin: 0.6rem 0; box-shadow: var(--shadow); }
.axis-block > summary { list-style: none; cursor: pointer; display: flex; align-items: center;
  gap: 0.7rem; padding: 0.8rem 1rem; font-family: var(--font-display); font-weight: 700; }
.axis-block > summary::-webkit-details-marker { display: none; }
.axis-block > summary::before { content: "▶"; color: var(--muted); font-size: 0.75rem;
  transition: transform .15s ease; flex: 0 0 auto; }
.axis-block[open] > summary::before { transform: rotate(90deg); }
.axis-name { font-size: 1.05rem; }
.axis-count { margin-left: auto; font-family: var(--font-sans); font-weight: 600;
  font-size: 0.82rem; color: var(--muted); }
.axis-intro { margin: 0 1rem 0.7rem; color: var(--muted); font-size: 0.92rem;
  border-left: 3px solid var(--accent); padding-left: 0.7rem; }
.nc-cards { list-style: none; margin: 0; padding: 0 1rem 1rem; display: flex;
  flex-direction: column; gap: 0.5rem; }
.nc-card { border: 1px solid var(--border); border-left-width: 4px; border-left-color: var(--muted);
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; background: var(--surface); }
.nc-sev-critique { border-left-color: var(--danger); }
.nc-sev-majeur { border-left-color: var(--warn); }
.nc-sev-mineur { border-left-color: var(--muted); }
.nc-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.nc-code { color: var(--accent); font-weight: 700; }
.nc-effort, .nc-scope { font-size: 0.74rem; color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 1px 8px; }
.nc-desc { margin: 0.4rem 0 0; }
.nc-reco { margin: 0.3rem 0 0; font-size: 0.92rem; }
.nc-reco strong { color: var(--ok); }

/* Guide utilisateur (S7.2) */
.guide-search { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.guide-search input[type="search"] { min-width: 16rem; }
.guide-toc { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 1rem; background: var(--surface); }
.guide-toc h2 { margin-top: 0.3rem; font-size: 1rem; }
.guide-section { margin: 1.5rem 0; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.guide-top { font-size: 0.8rem; text-decoration: none; margin-left: 0.4rem; }
@media print {
  .site-header, .site-footer, .guide-search, .help-panel, .skip-link { display: none; }
}

/* Tableau de bord (accueil) — cartes d'accès actionnables */
.dash-welcome { margin-bottom: 0.25rem; }
.dash-sub { color: var(--muted); max-width: 60ch; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem; margin-top: 1.5rem; }
.dash-card { display: flex; flex-direction: column; gap: 0.4rem; text-decoration: none;
  color: inherit; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; background: var(--ground); box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease; }
.dash-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.dash-card:active { transform: translateY(1px); }
.dash-card h2 { font-size: 1.1rem; margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.dash-card h2::after { content: "→"; margin-left: auto; color: var(--accent); font-weight: 700; }
.dash-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* Liste des campagnes — cartes scannables */
.audit-list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.6rem; }
.audit-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem;
  background: var(--ground); box-shadow: var(--shadow); transition: border-color .15s ease; }
.audit-card:hover { border-color: var(--accent); }
.audit-card-main { display: flex; flex-direction: column; gap: 0.1rem; text-decoration: none;
  color: inherit; min-width: 0; }
.audit-site { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.audit-status { flex: 0 0 auto; background: var(--surface); color: var(--muted); }

/* Listes d'entités en cartes (clients, sites, rapports…) — cohérent avec les campagnes */
.entity-list { list-style: none; margin: 1rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.entity-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7rem 1rem;
  background: var(--ground); box-shadow: var(--shadow); transition: border-color .15s ease; }
.entity-item:hover { border-color: var(--accent); }
.entity-main { display: flex; flex-direction: column; gap: 1px; min-width: 0;
  text-decoration: none; color: inherit; }
.entity-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.entity-sub { font-size: 0.85rem; word-break: break-word; }
.entity-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; flex: 0 0 auto; }
@media (max-width: 560px) { .entity-item { flex-wrap: wrap; } }

/* Finition — profondeur douce sur les surfaces-cartes (inspiration Stripe) */
.card-list li, .help-panel, .grid-synthese, .preview-items { box-shadow: var(--shadow); }
.card-list li { transition: border-color .15s ease, box-shadow .15s ease; }
.card-list li:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
