/* ============================================================
   Uniformat Design System — feuille unique de l'écran de connexion.
   Extrait de la maquette « uniformat-connexion.html ».
   Les webfonts (Lexend Deca, JetBrains Mono) sont chargées par
   <link> depuis Google Fonts dans le gabarit, pas via @font-face.
   ============================================================ */

/* ============================================================
   Uniformat — Color tokens
   Brand red #C8102E + slate neutrals, with conformity-status
   semantics (the product flags conforme / non-conforme).
   ============================================================ */
:root {
  /* ---- Brand red scale (anchored on the logo red #C8102E) ---- */
  --red-50:  #FDF2F4;
  --red-100: #F7E5E8;   /* soft tint card on white */
  --red-200: #F0B0B8;   /* light red, borders on red surfaces */
  --red-300: #E27885;
  --red-400: #D6455A;
  --red-500: #C8102E;   /* ★ brand primary — the logo red */
  --red-600: #A60D26;   /* hover / pressed */
  --red-700: #850A1E;
  --red-800: #5E0715;

  /* ---- Neutral slate scale ---- */
  --slate-0:   #FFFFFF;
  --slate-50:  #F9FAFB;
  --slate-100: #F3F4F6;
  --slate-200: #E5E7EB;
  --slate-300: #D1D5DB;
  --slate-400: #9CA3AF;
  --slate-500: #6B7280;
  --slate-600: #4B5563;
  --slate-700: #374151;
  --slate-800: #1F2937;   /* ★ primary ink */
  --slate-900: #111827;

  /* ---- Status palette (conformity reporting) ---- */
  --green-50:  #ECFDF3;
  --green-100: #D1FADF;
  --green-500: #12894B;   /* conforme */
  --green-600: #0E6E3C;

  --amber-50:  #FFF8EB;
  --amber-100: #FDEFC9;
  --amber-500: #B7791F;   /* avertissement */
  --amber-600: #92600F;

  --rose-50:   #FEF2F3;
  --rose-100:  #FBE0E2;
  --rose-500:  #C8102E;   /* non-conforme — shares brand red */
  --rose-600:  #A60D26;

  --blue-50:   #EFF6FF;
  --blue-100:  #DBEAFE;
  --blue-500:  #2563A8;   /* information */
  --blue-600:  #1E4E86;

  /* ============================================================
     Semantic aliases — reference these in components
     ============================================================ */
  --color-primary:        var(--red-500);
  --color-primary-hover:  var(--red-600);
  --color-primary-active: var(--red-700);
  --color-primary-tint:   var(--red-100);
  --color-on-primary:     var(--slate-0);

  /* text */
  --text-strong:   var(--slate-900);
  --text-body:     var(--slate-800);
  --text-muted:    var(--slate-600);
  --text-subtle:   var(--slate-500);
  --text-on-dark:  var(--slate-0);
  --text-on-primary: var(--slate-0);
  --text-link:     var(--red-600);

  /* surfaces */
  --surface-page:    var(--slate-50);
  --surface-card:    var(--slate-0);
  --surface-sunken:  var(--slate-100);
  --surface-inverse: var(--slate-900);
  --surface-tint:    var(--red-50);

  /* borders */
  --border-subtle:  var(--slate-200);
  --border-default: var(--slate-300);
  --border-strong:  var(--slate-400);
  --border-focus:   var(--red-500);

  /* status semantics */
  --status-pass-fg:   var(--green-600);
  --status-pass-bg:   var(--green-50);
  --status-pass-bd:   var(--green-100);
  --status-warn-fg:   var(--amber-600);
  --status-warn-bg:   var(--amber-50);
  --status-warn-bd:   var(--amber-100);
  --status-fail-fg:   var(--rose-600);
  --status-fail-bg:   var(--rose-50);
  --status-fail-bd:   var(--rose-100);
  --status-info-fg:   var(--blue-600);
  --status-info-bg:   var(--blue-50);
  --status-info-bd:   var(--blue-100);
}

/* ============================================================
   Uniformat — Typography tokens
   Inter for everything UI + display. JetBrains Mono for
   technical specs (font names, margins, template values).
   ============================================================ */
:root {
  --font-sans: 'Lexend Deca', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* weights */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-extra:    800;

  /* type scale (1.250 major-third-ish, tuned) */
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;
  --text-4xl:  48px;
  --text-5xl:  60px;

  /* line-heights */
  --leading-tight:   1.15;
  --leading-snug:    1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;

  /* letter-spacing */
  --tracking-tight:  -0.02em;
  --tracking-snug:   -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.04em;
  --tracking-eyebrow: 0.12em;   /* uppercase eyebrow labels */

  /* semantic roles */
  --type-display-weight: var(--weight-bold);
  --type-title-weight:   var(--weight-bold);
  --type-eyebrow-size:   var(--text-xs);
}

/* ============================================================
   Uniformat — Spacing, radius, shadow, border, motion tokens
   ============================================================ */
:root {
  /* spacing — 4px base grid */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* radius — soft & rounded direction. Cards lightly→generously rounded,
     buttons fully pill, large marketing panels 24–32px. */
  --radius-xs:   6px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-pill: 999px;

  /* borders */
  --border-width: 1px;
  --border-width-strong: 1.5px;

  /* shadows — soft, neutral, low-spread. No colored shadows. */
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.08), 0 2px 4px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 12px 28px rgba(17, 24, 39, 0.12), 0 4px 8px rgba(17, 24, 39, 0.05);
  --shadow-focus: 0 0 0 3px rgba(200, 16, 46, 0.18);   /* red focus ring */

  /* motion */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1); /* @kind other */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1); /* @kind other */
  --duration-fast:   120ms; /* @kind other */
  --duration-normal: 200ms; /* @kind other */
  --duration-slow:   320ms; /* @kind other */

  /* layout */
  --container-max: 1200px;
  --sidebar-width: 248px;
}

/* ============================================================
   Uniformat — base element defaults (opt-in, lightweight).
   Sets document typography defaults using the tokens.
   ============================================================ */
:root {
  color-scheme: light;
}

body.uniformat,
.uniformat {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.uniformat ::selection {
  background: var(--red-100);
  color: var(--red-700);
}

/* Eyebrow label utility — used pervasively across the brand */
.uf-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ============================================================
   Uniformat — Vérificateur (chrome partagé des 3 écrans).
   Construit sur les tokens du design system (styles.css).
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-body);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
a { color: inherit; }
::selection { background: var(--red-100); color: var(--red-700); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 999px; border: 3px solid var(--surface-page); }

/* ---------- App header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.brand-lockup { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: block; box-shadow: var(--shadow-xs); }
.wordmark { font-size: 19px; font-weight: 800; letter-spacing: -0.025em; color: var(--slate-900); }
.wordmark span { color: var(--red-500); }
.brand-divider { width: 1px; height: 24px; background: var(--border-subtle); }
.tool-name { font-size: 14px; font-weight: 600; color: var(--text-muted); letter-spacing: -0.01em; }
.header-right { display: flex; align-items: center; gap: 14px; }
.estab-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill); background: var(--surface-card);
  font-size: 13px; font-weight: 600; color: var(--text-body);
}
.estab-chip svg { color: var(--text-subtle); }
.agent-chip { display: flex; align-items: center; gap: 10px; }
/* Les deux lignes nom/rôle, alignées à droite de l'avatar. */
.agent-identity { text-align: right; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--red-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
}
.agent-name { font-size: 13px; font-weight: 600; color: var(--text-body); line-height: 1.2; }
.agent-role { font-size: 11px; color: var(--text-subtle); }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle); background: var(--surface-card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast);
}
.icon-btn:hover { background: var(--slate-100); color: var(--text-body); }

/* ---------- Layout ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 38px 28px 80px; }

.eyebrow {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--red-500);
}
.h1 { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.025em; color: var(--text-strong); margin: 12px 0 0; line-height: var(--leading-tight); }
.lead { font-size: var(--text-md); color: var(--text-muted); margin: 12px 0 0; max-width: 60ch; line-height: var(--leading-relaxed); }
.lead a { color: var(--text-link); text-decoration: none; border-bottom: 1px solid var(--red-200); font-weight: 600; }
.lead a:hover { border-bottom-color: var(--red-500); }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-pill); padding: 11px 20px;
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast), border-color var(--duration-fast);
}
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn-primary { background: var(--red-500); color: #fff; }
.btn-primary:hover { background: var(--red-600); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary:active { transform: translateY(0.5px) scale(0.99); }
.btn-secondary { background: var(--surface-card); border-color: var(--border-default); color: var(--text-body); }
.btn-secondary:hover { background: var(--slate-100); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--slate-100); color: var(--text-body); }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn svg { flex: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.callout {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--red-500);
  border-radius: var(--radius-md); padding: 16px 18px;
}
.callout .callout-ic { flex: none; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--red-50); color: var(--red-500); display: flex; align-items: center; justify-content: center; }
.callout-title { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.callout-body { font-size: 13.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.55; }
.callout-body a { color: var(--text-link); text-decoration: none; border-bottom: 1px dotted var(--red-300); font-weight: 600; }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 22px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  color: var(--text-subtle); font-size: 12.5px;
}
.app-footer .secure { display: flex; align-items: center; gap: 8px; }
.app-footer nav { display: flex; gap: 18px; }
.app-footer a { color: var(--text-subtle); text-decoration: none; }
.app-footer a:hover { color: var(--text-body); }

/* ---------- Mono ---------- */
.mono { font-family: var(--font-mono); }

/* ============================================================
   Écran de connexion
   ============================================================ */
body { display: flex; flex-direction: column; }
.app-header .tool-name { font-weight: 500; }

/* Fond commun à toutes les pages : halo de marque discret en haut de <main>. */
main {
  /* body est en colonne flex : sans flex-grow, un contenu court (état de
     vérification, erreur) laisserait le pied de page remonter au milieu. */
  flex: 1;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--red-50) 0%, rgba(253, 242, 244, 0) 55%),
    var(--surface-page);
}

.auth-main {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
/* La carte seule est centrée verticalement : l'intro est sortie du flux et
   posée au-dessus, sinon sa hauteur décale la carte vers le bas. */
.auth-wrap { position: relative; width: 420px; max-width: 100%; }
.auth-intro { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 22px; }
.auth-intro h2 { margin: 0; font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.025em; color: var(--text-strong); }
.auth-intro p { margin: 10px 0 0; font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; }
.auth-card { padding: 26px 30px; }

/* Établissement : bloc d'affichage seul. Le produit ne gère qu'un seul
   établissement (une app Azure, une liste plate de domaines autorisés), donc
   pas de curseur, pas de focus, pas de menu — rien qui laisse croire à un choix. */
.estab-field { margin-top: 0; }
.field-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); margin-bottom: 8px; display: block; }
.estab-display {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 12px 14px; background: var(--surface-card);
}
.estab-logo { width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--slate-900); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; letter-spacing: -0.02em; flex: none; }
.estab-display .et { flex: 1; min-width: 0; }
.estab-display .et-name { font-size: var(--text-base); font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.estab-display .et-sub { font-size: 12px; color: var(--text-subtle); margin-top: 1px; }

.auth-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }

/* Petits écrans : le nom de l'outil casserait la hauteur fixe de l'en-tête.
   Dégradation progressive plutôt qu'un seul point de rupture, pour ne pas
   passer d'un coup d'un header complet à un header minimal. */
@media (max-width: 960px) {
  .app-header { padding: 0 20px; }
  /* Phrase descriptive : premier élément non essentiel à sacrifier. */
  .brand-divider,
  .app-header .tool-name { display: none; }
}
@media (max-width: 760px) {
  /* Le nom complet de l'établissement ne tient plus ; l'identité est déjà
     portée par la page elle-même. */
  .app-header .estab-chip { display: none; }
}
@media (max-width: 640px) {
  .app-header { padding: 0 16px; }
  /* Le rôle ("Espace personnel") est secondaire face au nom. */
  .agent-role { display: none; }
  .auth-card { padding: 22px 20px; }
}
@media (max-width: 460px) {
  /* Ne garder que l'avatar : le nom complet déborderait à côté du bouton
     de déconnexion sur les très petits écrans. */
  .agent-identity { display: none; }
  .agent-chip { gap: 0; }
}

/* Écran court : l'intro hors flux passerait sous l'en-tête. On la remet dans
   le flux et on centre l'ensemble. */
@media (max-height: 680px) {
  .auth-intro { position: static; margin-bottom: 22px; }
}

/* ============================================================
   Écran de dépôt — formats acceptés
   Reprise du bloc « composants de dépôt » de la maquette.
   ============================================================ */
.formats {
  list-style: disc;
  margin: 18px 0 0;
  padding-left: 1.35em;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  overflow: visible;
}
.formats li { margin-bottom: 2px; }
.formats strong { color: var(--text-body); font-weight: var(--weight-semibold); }
.formats code {
  font-family: var(--font-mono); font-size: 0.92em;
  background: var(--surface-sunken); border-radius: var(--radius-xs);
  padding: 1px 5px; color: var(--text-body);
}
/* Infobulle Overleaf : l'image est positionnée en absolu, donc .formats ne
   doit pas rogner le débordement, et elle doit passer au-dessus de la zone
   de dépôt qui suit. */
.hint-tooltip-anchor { position: relative; display: inline-flex; align-items: center; }
.hint-overleaf { cursor: help; border-bottom: 1px dashed var(--border-strong); }
.hint-tooltip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 3px;
  border-radius: 50%;
  background: var(--slate-400); color: var(--text-on-dark);
  font-size: 10px; font-weight: var(--weight-bold);
  vertical-align: middle;
}
.hint-tooltip-img {
  display: none;
  position: absolute; left: 0; top: calc(100% + 8px);
  width: 320px; max-width: 80vw;
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  pointer-events: none;
}
.hint-tooltip-anchor:hover .hint-tooltip-img,
.hint-tooltip-anchor:focus-within .hint-tooltip-img { display: block; }

/* ============================================================
   Écran de dépôt — zone de dépôt (form#uploader.dropzone)
   `.drag` vient de la maquette, `.dz-drag-hover` de Dropzone.js :
   les deux décrivent le même état, on les stylise ensemble.
   ============================================================ */
.dropzone {
  position: relative;
  margin-top: var(--space-6);
  border: var(--border-width-strong) dashed var(--border-default);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 140% at 50% 0%, var(--surface-card) 60%, var(--red-50) 130%);
  padding: 54px 28px; text-align: center; cursor: pointer;
  transition: border-color var(--duration-normal) var(--ease-standard),
              background var(--duration-normal), transform var(--duration-fast);
}
.dropzone:hover { border-color: var(--red-300); }
.dropzone:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.dropzone.drag,
.dropzone.dz-drag-hover { border-color: var(--red-500); background: var(--red-50); transform: scale(1.005); }
.dz-disc {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--red-50); color: var(--red-500);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; transition: transform var(--duration-normal) var(--ease-out);
}
.dropzone:hover .dz-disc { transform: translateY(-2px); }
.dz-title { font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); color: var(--text-strong); }
.dz-sub { font-size: var(--text-sm); color: var(--text-muted); margin-top: 7px; }
.dz-actions { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: var(--space-3); flex-wrap: wrap; }

/* Message par défaut injecté par Dropzone.js (dictDefaultMessage) : mêmes
   rôles typographiques que .dz-title / .dz-sub de la maquette. */
.dropzone .dz-message { margin: 0; }
/* Dropzone.js pose .dz-started dès qu'un fichier est accepté : l'état vide
   s'efface au profit de l'aperçu. Règle répétée ici pour ne pas dépendre
   de la feuille de Dropzone. */
.dropzone.dz-started .dz-message { display: none; }
.dz-empty { display: block; }
.dropzone .dz-message .title {
  display: block;
  font-size: var(--text-lg); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight); color: var(--text-strong);
}
.dropzone .dz-message .subtitle {
  display: block;
  font-size: var(--text-sm); color: var(--text-muted); margin-top: 7px;
}

/* ============================================================
   Écran de dépôt — état « téléversement en cours » de la maquette
   ============================================================ */
.uploading { display: none; }
.uploading.show { display: block; }
.dropzone.busy { cursor: default; pointer-events: none; border-style: solid; border-color: var(--border-subtle); }
.up-file { display: flex; align-items: center; gap: 14px; max-width: 440px; margin: 0 auto; text-align: left; }
.up-ic {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  background: var(--status-info-bg); color: var(--blue-500);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.up-meta { flex: 1; min-width: 0; }
.up-name { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text-strong); }
.up-sub { font-size: 12.5px; color: var(--text-subtle); margin-top: 2px; }
.progress-track { height: var(--space-2); border-radius: var(--radius-pill); background: var(--slate-100); overflow: hidden; margin-top: var(--space-5); }
.progress-fill { height: 100%; width: 0%; background: var(--red-500); border-radius: var(--radius-pill); transition: width var(--duration-slow) var(--ease-out); }
.up-status { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-3); display: flex; align-items: center; justify-content: center; gap: var(--space-2); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--red-200); border-top-color: var(--red-500); animation: uf-spin 0.7s linear infinite; }
@keyframes uf-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Écran de dépôt — les trois étapes
   ============================================================ */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 26px; }
.step { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); }
.step-n {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-inverse); color: var(--text-on-dark);
  font-size: 12.5px; font-weight: var(--weight-bold);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.step-t { font-size: 13.5px; font-weight: var(--weight-bold); color: var(--text-strong); }
.step-d { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: var(--leading-normal); }

/* ============================================================
   Aperçu du fichier déposé (gabarit de prévisualisation d'app.js).
   Dropzone.js impose ses propres styles sur .dz-preview : les
   !important sont là pour les neutraliser, pas par confort.
   ============================================================ */
#file-preview:not(:empty) { padding: var(--space-4) 0 0; }

/* Espace entre l'aperçu du fichier (ou le bouton de reprise) et la section
   des résultats. Posé sur les états actifs seulement : au repos la section
   est vide, une marge y creuserait un blanc sous les cartes d'étapes. */
main.is-uploading #results-section,
main.is-success #results-section,
main.is-empty #results-section,
main.is-error #results-section { margin-top: var(--space-6); }
.dz-preview.dz-file-preview {
  width: 100%; max-width: 100%;
  margin: 0 !important;
  padding: var(--space-3) var(--space-4) !important;
  background: var(--surface-card) !important;
  border: var(--border-width) solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-xs);
  display: flex !important; flex-direction: row !important; align-items: center !important;
  gap: var(--space-3);
  position: relative !important; overflow: hidden;
  min-height: auto !important;
}
.dz-preview.dz-file-preview.dz-success { border-left: 3px solid var(--status-pass-fg) !important; }
.dz-preview.dz-file-preview.dz-error { border-left: 3px solid var(--status-fail-fg) !important; }
.dz-preview .dz-image { display: none; }
.dz-preview .dz-details {
  display: flex !important; flex-direction: column !important; align-items: flex-start !important;
  flex: 1; min-width: 0;
  margin: 0 !important; padding: 0 !important; opacity: 1 !important; position: relative !important;
}
.dz-preview .dz-filename {
  font-size: var(--text-sm) !important; font-weight: var(--weight-semibold) !important;
  color: var(--text-strong) !important; margin-bottom: 2px !important;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.dz-preview .dz-size { font-size: var(--text-xs) !important; color: var(--text-subtle) !important; margin-bottom: 0 !important; }
.dz-preview .dz-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: transparent; overflow: hidden;
}
.dz-preview .dz-progress .dz-upload {
  display: block; height: 100%; width: 0%;
  /* Vert : la barre atteint 100 % quand le fichier est bien reçu — c'est un
     signal de réussite, pas un verdict. Le rouge se lirait comme une erreur. */
  background: var(--green-500);
  transition: width var(--duration-normal) var(--ease-standard);
}
.dz-preview.dz-success .dz-progress,
.dz-preview.dz-error .dz-progress { display: none; }
.dz-preview .dz-status { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--status-pass-fg); display: none; }
.dz-preview.dz-success .dz-status { display: block; }
/* L'erreur est rendue par #results-section .error-state, jamais dans l'aperçu. */
.dz-preview .dz-error-message { display: none !important; }
.dz-preview .dz-remove {
  padding: 0; width: 26px; height: 26px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: var(--text-xs); color: var(--text-subtle);
  background: none; border: none; border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast);
}
.dz-preview .dz-remove:hover { background: var(--slate-100); color: var(--status-fail-fg); }
.dz-preview .dz-remove:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* « Téléverser un autre document » : au-dessus de l'aperçu, seulement
   une fois l'analyse terminée. */
#new-analysis-btn { display: none; margin-top: var(--space-4); }
main.is-success #new-analysis-btn,
main.is-empty #new-analysis-btn { display: inline-flex; }

/* ============================================================
   Mention de confidentialité (partials/confidentialite.html)
   Repliée par défaut : la promesse reste lisible dans le <summary>.
   ============================================================ */
/* Volontairement neutre : dans cette page le rouge signifie « non conforme »
   (--status-fail dérive du même rouge que la marque). Une barre rouge sur un
   message de réassurance dirait le contraire de son texte. */
.privacy-note {
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin: var(--space-5) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}
.privacy-note-summary {
  display: flex; align-items: center; gap: 10px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer; list-style: none; user-select: none;
  border-radius: var(--radius-md);
}
/* Retire le triangle natif (WebKit puis standard) : on fournit un chevron. */
.privacy-note-summary::-webkit-details-marker { display: none; }
.privacy-note-summary::marker { content: ""; }
.privacy-note-summary:hover { background: var(--slate-50); }
.privacy-note-summary:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.privacy-note-icon { flex: none; color: var(--status-pass-fg); }
.privacy-note-lead { flex: 1; color: var(--text-body); }
.privacy-note-chevron { flex: none; color: var(--text-subtle); transition: transform var(--duration-fast) var(--ease-standard); }
.privacy-note[open] .privacy-note-chevron { transform: rotate(180deg); }
.privacy-note-body { padding: 0 var(--space-4) var(--space-4) 42px; }
.privacy-note-body p { margin: 0 0 var(--space-2); }
.privacy-note-more { margin-bottom: 0; }
.privacy-note-more a { color: var(--text-link); text-decoration: none; font-weight: var(--weight-semibold); }
.privacy-note-more a:hover { text-decoration: underline; }
.privacy-note-arrow { display: inline-block; transition: transform var(--duration-fast) var(--ease-standard); }
.privacy-note-more a:hover .privacy-note-arrow { transform: translateX(2px); }

/* ============================================================
   Bannière « gabarit périmé »
   ============================================================ */
.template-warning {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--status-warn-bg);
  border: var(--border-width) solid var(--status-warn-bd);
  border-left: 3px solid var(--status-warn-fg);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  color: var(--status-warn-fg);
}
.template-warning[hidden] { display: none; }
.template-warning-icon { flex: none; color: var(--status-warn-fg); font-size: var(--text-md); line-height: 1.4; }
.template-warning-message { font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--amber-600); }
.template-warning-message a { color: inherit; font-weight: var(--weight-semibold); text-decoration: underline; }
.template-warning-message a:hover { text-decoration-thickness: 2px; }

/* ============================================================
   État de traitement (analyse en cours)
   ============================================================ */
.processing {
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  margin-bottom: var(--space-4);
}
.processing-text {
  color: var(--text-strong); font-size: var(--text-md); font-weight: var(--weight-semibold);
  margin-bottom: var(--space-5); min-height: 1.4em;
  transition: opacity var(--duration-fast) var(--ease-standard);
}
.progress-bar {
  position: relative; height: var(--space-2);
  background: var(--slate-100); border-radius: var(--radius-pill);
  overflow: hidden; max-width: 480px; margin: 0 auto;
}
.progress-bar-fill {
  height: 100%; width: 0%;
  background: var(--red-500); border-radius: var(--radius-pill);
  transition: width var(--duration-slow) var(--ease-out);
  position: relative; overflow: hidden;
}
.progress-bar-fill.shimmer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%);
  animation: uf-progress-shimmer 1.6s linear infinite;
}
@keyframes uf-progress-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
.processing-hint { color: var(--text-subtle); font-size: var(--text-sm); margin-top: 14px; }
.processing-overtime {
  color: var(--text-subtle); font-size: var(--text-sm); margin-top: var(--space-2);
  opacity: 0; transition: opacity var(--duration-slow) var(--ease-standard);
}
.processing-overtime.visible { opacity: 1; }

/* ============================================================
   État d'erreur
   ============================================================ */
.error-state {
  background: var(--surface-card);
  border: var(--border-width) solid var(--status-fail-bd);
  border-left: 3px solid var(--status-fail-fg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}
.error-state-header { display: flex; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-5); }
.error-state-icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--status-fail-bg); color: var(--status-fail-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-lg); font-weight: var(--weight-bold);
}
.error-state-content { flex: 1; min-width: 0; }
.error-state-title { font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--status-fail-fg); margin-bottom: var(--space-1); }
.error-state-message { font-size: var(--text-sm); color: var(--text-muted); line-height: var(--leading-normal); }
.error-state-actions {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  margin-top: var(--space-5); padding-top: var(--space-5);
  border-top: var(--border-width) solid var(--border-subtle);
}

/* Bouton en cours de téléchargement (stream) : spinner + état bloqué. */
.btn.is-loading { opacity: 0.75; cursor: progress; pointer-events: none; }
.btn.is-loading::before {
  content: ""; width: 0.85em; height: 0.85em;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: uf-spin 0.6s linear infinite;
}

/* ============================================================
   Vue résultats — carte de synthèse
   ============================================================ */
.summary-card { padding: var(--space-6) 26px; }
.summary-top { display: flex; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; }
.file-id { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 240px; }
.file-ic {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  background: var(--status-info-bg); color: var(--blue-500);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.file-name {
  font-size: var(--text-lg); font-weight: var(--weight-extra);
  letter-spacing: var(--tracking-tight); color: var(--text-strong); line-height: var(--leading-tight);
  word-break: break-word;
}
.file-meta { font-size: 12.5px; color: var(--text-muted); margin-top: var(--space-1); }
/* La date reste dans la police et la taille du reste de la ligne : seul
   .mono (chiffres tabulaires) change, pas la famille de police. */
.file-meta .mono { font-family: inherit; font-size: inherit; color: var(--text-subtle); }

/* Verdict global. Une seule variante est posée par le JS (fail | warn | pass). */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); font-weight: var(--weight-bold); white-space: nowrap;
}
.badge .bdot { width: var(--space-2); height: var(--space-2); border-radius: 50%; flex: none; }
.badge.fail { background: var(--status-fail-bg); color: var(--status-fail-fg); border: var(--border-width) solid var(--status-fail-bd); }
.badge.fail .bdot { background: var(--rose-500); }
.badge.warn { background: var(--status-warn-bg); color: var(--status-warn-fg); border: var(--border-width) solid var(--status-warn-bd); }
.badge.warn .bdot { background: var(--amber-500); }
.badge.pass { background: var(--status-pass-bg); color: var(--status-pass-fg); border: var(--border-width) solid var(--status-pass-bd); }
.badge.pass .bdot { background: var(--green-500); }

.summary-divider { height: 1px; background: var(--border-subtle); margin: 22px 0; }
.summary-bottom { display: block; }

/* Seule action restante depuis le retrait des compteurs : le bouton
   occupe toute la largeur plutôt que de flotter à droite. Bloc simple,
   pas flex — .summary-bottom n'a plus qu'un seul enfant. */
.summ-actions .btn { width: 100%; }
/* Le bouton d'export est un <a class="btn"> masqué tant que le rapport n'est
   pas prêt : .btn est en inline-flex, ce qui écraserait [hidden]. */
.btn[hidden] { display: none; }

/* Message affiché quand le rapport n'est plus disponible côté serveur. */
.download-error { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--status-fail-fg); text-align: right; }
.download-error[hidden] { display: none; }

/* ============================================================
   Vue résultats — titre de liste et puces de filtrage
   ============================================================ */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 30px 0 0; }
.results-head h2 {
  margin: 0; font-size: var(--text-lg); font-weight: var(--weight-extra);
  letter-spacing: var(--tracking-tight); color: var(--text-strong);
}

.filter-bar { display: flex; gap: var(--space-2); margin: 22px 0 14px; flex-wrap: wrap; }
.fchip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 15px; border-radius: var(--radius-pill);
  border: var(--border-width) solid var(--border-subtle); background: var(--surface-card);
  font-family: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast), color var(--duration-fast);
}
.fchip:hover { border-color: var(--border-default); color: var(--text-body); }
.fchip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.fchip .fcount { font-weight: var(--weight-extra); color: var(--text-strong); }
.fchip .fdot { width: var(--space-2); height: var(--space-2); border-radius: 50%; flex: none; }
/* Le gabarit porte data-filter (contrat DOM), pas le data-f de la maquette. */
.fchip[data-filter="error"] .fdot { background: var(--rose-500); }
.fchip[data-filter="warning"] .fdot { background: var(--amber-500); }
.fchip[data-filter="success"] .fdot { background: var(--green-500); }
.fchip.active {
  background: var(--surface-inverse); border-color: var(--surface-inverse);
  color: var(--text-on-dark);
}
.fchip.active .fcount { color: var(--text-on-dark); }

/* ============================================================
   Vue résultats — liste des règles
   ============================================================ */
.card.results { overflow: hidden; }
.cat-head {
  padding: 10px var(--space-6);
  font-size: var(--text-xs); font-weight: var(--weight-bold);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle);
  background: var(--surface-sunken);
}
/* La carte arrondit ses coins ; le premier en-tête de catégorie doit suivre
   le même rayon, sinon un liseré blanc apparaît dans les coins. */
.card.results > .cat-head:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* Grille : pastille de statut / textes / pastille de verdict / chevron. */
.rule {
  display: grid; grid-template-columns: var(--space-6) 1fr auto var(--space-5);
  align-items: start; gap: 14px;
  padding: var(--space-4) var(--space-6); cursor: pointer;
  border-top: var(--border-width) solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-standard);
}
.cat-head + .rule { border-top: none; }
.rule:hover { background: var(--slate-50); }
.rule.open { background: var(--slate-50); }
.rule:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--border-focus); }
.disc {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.disc.fail { background: var(--rose-100); color: var(--rose-600); }
.disc.warn { background: var(--amber-100); color: var(--amber-600); }
.disc.pass { background: var(--green-100); color: var(--green-600); }
.rule-name { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text-strong); }
.rule-desc { font-size: 12.5px; color: var(--text-subtle); margin-top: 3px; line-height: var(--leading-normal); max-width: 64ch;
  /* Les descriptions réelles sont longues : deux lignes dans la ligne,
     le texte complet vit dans .details-desc. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; padding: var(--space-1) 9px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-bold); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill.fail { background: var(--status-fail-bg); color: var(--status-fail-fg); }
.pill.warn { background: var(--status-warn-bg); color: var(--status-warn-fg); }
/* Plusieurs pastilles côte à côte quand une règle porte à la fois des
   erreurs et des avertissements. */
.pill-group { display: inline-flex; align-items: center; gap: 6px; margin-top: 1px; }
.chev { color: var(--text-subtle); margin-top: 2px; transition: transform var(--duration-fast) var(--ease-standard); }
.rule.open .chev { transform: rotate(90deg); color: var(--red-500); }

/* ============================================================
   Vue résultats — détails d'une règle
   ============================================================ */
.details {
  display: none;
  padding: var(--space-1) var(--space-6) 22px 62px;
  background: var(--slate-50);
}
.details.show { display: block; }
/* Description complète de la règle, en tête du panneau : la ligne n'en montre
   que deux lignes (les descriptions réelles sont des listes à puces). */
.details-desc {
  font-size: var(--text-sm); color: var(--text-muted);
  line-height: var(--leading-relaxed); white-space: pre-line;
  padding-bottom: var(--space-3); margin-bottom: var(--space-3);
  border-bottom: 1px dashed var(--border-subtle);
}
.detail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.detail-li {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 13.5px; color: var(--text-body); line-height: var(--leading-normal);
}
/* display:flex écraserait le [hidden] du navigateur : les éléments tronqués
   par DETAILS_VISIBLE_LIMIT doivent rester masqués. Même piège pour la
   troncature interne d'un message (.msg-overflow). */
.detail-li[hidden],
.detail-li .msg-overflow[hidden] { display: none; }
.detail-li > span:last-child { min-width: 0; word-break: break-word; }
.detail-li strong { font-weight: var(--weight-bold); color: var(--text-strong); }
.detail-ic {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; font-size: 11px; font-weight: var(--weight-extra);
}
.detail-ic.error { background: var(--rose-100); color: var(--rose-600); }
.detail-ic.warn { background: var(--amber-100); color: var(--amber-600); }
.detail-ic.info { background: var(--green-100); color: var(--green-600); }
/* Extraits de diff unifié (règle d'intégrité du fichier de mise en forme LaTeX). */
.detail-li.diff-block {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-word;
}
/* Attendu / obtenu, en chiffres. */
.spec { display: inline-flex; gap: 14px; flex-wrap: wrap; margin-top: 5px; }
.spec span { font-family: var(--font-mono); font-size: var(--text-xs); }
.spec .exp { color: var(--green-600); }
.spec .got { color: var(--rose-600); }
.spec b { color: var(--text-subtle); font-weight: var(--weight-semibold); }

/* Repli des éléments conformes à l'intérieur d'une règle. */
.valid-toggle {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 14px;
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: inherit; font-size: 12.5px; font-weight: var(--weight-semibold);
  color: var(--green-600);
}
.valid-toggle:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.valid-toggle .vchev { transition: transform var(--duration-fast) var(--ease-standard); }
.valid-toggle.open .vchev { transform: rotate(90deg); }
.valid-list { display: none; margin-top: 10px; }
.valid-list.show { display: flex; flex-direction: column; gap: 9px; }

/* Lien de retour vers le dépôt : bouton fantôme aligné sur la marge du texte. */
.back-link { padding-left: 0; }
.back-link:hover { background: transparent; color: var(--text-body); }

/* ============================================================
   Résultats — puces d'extrait (copie au clic)
   ============================================================ */
.excerpt-chip {
  position: relative; display: inline; max-width: 100%;
  margin: 0 0.15em; padding: 0.1em 0.45em;
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--slate-50); color: var(--text-body);
  font-family: inherit; font-size: 0.82em; line-height: 1.4;
  vertical-align: baseline; text-align: left; word-break: break-word;
  cursor: pointer;
}
.excerpt-chip:hover { background: var(--slate-100); border-color: var(--border-strong); }
.excerpt-chip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.excerpt-chip.copied { border-color: var(--status-pass-fg); background: var(--status-pass-bg); }
/* Bulle de confirmation « Copié ! » affichée brièvement au clic. */
.excerpt-chip.copied::after {
  content: "Copié !";
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  padding: 3px var(--space-2); border-radius: var(--radius-xs);
  background: var(--status-pass-fg); color: var(--text-on-dark);
  font-size: 11px; font-weight: var(--weight-semibold); line-height: 1.2;
  white-space: nowrap; pointer-events: none; z-index: 20;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   Vue résultats — listes tronquées
   ============================================================ */
/* « Voir les N éléments restants » sous une liste tronquée. */
.show-more-toggle {
  display: inline-flex; align-items: center;
  background: none; border: none; font-family: inherit;
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--text-link); cursor: pointer;
  padding: 6px var(--space-2); border-radius: var(--radius-xs);
  transition: background var(--duration-fast) var(--ease-standard);
}
.show-more-toggle:hover { background: var(--red-50); }
.show-more-toggle:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
/* display:inline-flex écrase le [hidden] du navigateur (même piège que
   .detail-li) : masquage explicite quand tout est déjà affiché. */
.show-more-toggle[hidden] { display: none; }
/* Le bouton d'une liste d'éléments conformes suit l'état replié de sa liste. */
.valid-list:not(.show) + .show-more-toggle { display: none; }
/* Variante inline, à l'intérieur d'un message unique. */
.show-more-toggle.show-more-lines { margin-top: var(--space-1); }

/* ============================================================
   États vides (aucun résultat, filtre sans résultat)
   ============================================================ */
.empty-state {
  padding: var(--space-12);
  text-align: center; color: var(--text-subtle); font-size: var(--text-base);
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   États d'affichage — la classe posée sur <main> pilote la page.
   Reprise à l'identique de style.css, en y ajoutant .formats
   et .steps, propres à la nouvelle maquette de dépôt.
   ============================================================ */
#results-section .processing,
#results-section .results-content,
#results-section .empty-results,
#results-section .empty-filter,
#results-section .error-state { display: none; }

main.is-uploading #results-section .processing { display: block; }
main.is-success #results-section .results-content { display: block; }
main.is-empty #results-section .empty-results { display: block; }
main.is-error #results-section .error-state { display: block; }
main.is-success #results-section .empty-filter.visible { display: block; }

/* Dès qu'on quitte l'état initial, la zone de dépôt et son décor
   (formats acceptés, étapes, mention de confidentialité) disparaissent :
   seul le résultat compte. */
main.is-uploading .privacy-note,
main.is-uploading #uploader,
main.is-uploading .formats,
main.is-uploading .steps,
main.is-success .privacy-note,
main.is-success #uploader,
main.is-success .formats,
main.is-success .steps,
main.is-empty .privacy-note,
main.is-empty #uploader,
main.is-empty .formats,
main.is-empty .steps,
main.is-error .privacy-note,
main.is-error #uploader,
main.is-error .formats,
main.is-error .steps {
  display: none;
}

/* Résultats affichés : le titre, l'invitation au téléversement et l'aperçu
   Dropzone n'ont plus lieu d'être — la carte de synthèse porte déjà le nom
   du fichier et le verdict, le lien retour tient lieu de contexte. */
main.is-success .page > .h1,
main.is-success .page > .lead,
main.is-success #file-preview,
main.is-empty .page > .h1,
main.is-empty .page > .lead,
main.is-empty #file-preview {
  display: none;
}

/* ============================================================
   Utilitaires émis par app.js
   `.visible` et `.open` restent volontairement portés par leur
   composant : leur display dépend du contexte (table-row, opacité…).
   ============================================================ */
.hidden { display: none !important; }
.fade-out { opacity: 0; }

/* ============================================================
   Adaptations petits écrans — dépôt et résultats
   ============================================================ */
@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dropzone { padding: 36px var(--space-5); }

  /* La carte de synthèse empile ses blocs : verdict sous l'identité du
     fichier, actions sous les compteurs. */
  .summary-card { padding: var(--space-5); }
  .summary-top { flex-direction: column; gap: var(--space-3); }
  .file-id { min-width: 0; }
  .summary-divider { margin: var(--space-4) 0; }
  .download-error { text-align: left; }

  /* Les puces de filtre défilent latéralement plutôt que de passer à la
     ligne : la barre garde une hauteur constante. */
  .filter-bar {
    flex-wrap: nowrap; overflow-x: auto; margin: var(--space-4) 0 var(--space-3);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .fchip { flex: none; }

  /* La règle passe en colonne : le verdict repasse sous le nom. */
  .rule {
    grid-template-columns: 22px 1fr var(--space-5);
    gap: var(--space-3); padding: var(--space-4);
  }
  .rule .pill { grid-column: 2; justify-self: start; margin-top: var(--space-2); }
  .cat-head { padding: var(--space-4) var(--space-4) var(--space-2); }
  .details { padding: var(--space-1) var(--space-4) var(--space-5) var(--space-4); }
}
