/* GranuScan — primitives dark-mode. Toute valeur vient de tokens.css. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 78% 0, var(--canvas-glow), transparent 34%), var(--paper);
  color: var(--ink-2);
  font-family: var(--f-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

h1, h2 {
  margin: 0;
  font-family: var(--f-sans);
  font-weight: 600;
  color: var(--ink);
}
h1 { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--tr-display); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3, h4 {
  margin: 0;
  font-family: var(--f-sans);
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--ink);
}
p { margin: 0; }
input, select, button, textarea { font: inherit; color: inherit; }

/* ---------- utilitaires ---------- */

.fx { display: flex; }
.col { flex-direction: column; }
.ac { align-items: center; }
.jc { justify-content: center; }
.jb { justify-content: space-between; }
.gap4  { gap: var(--s1); }
.gap8  { gap: var(--s2); }
.gap12 { gap: var(--s3); }
.gap16 { gap: var(--s4); }
.gap24 { gap: var(--s5); }
.gap32 { gap: var(--s6); }
.grow  { flex: 1; }
.right { text-align: right; }

.mono  { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2  { color: var(--ink-2); }
.strong { font-weight: 500; color: var(--ink); }
.tiny  { font-size: var(--fs-tiny); }
.sm    { font-size: var(--fs-sm); }
.up {
  font-size: var(--fs-caps);
  font-weight: 600;
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--muted);
}
.sep { height: var(--hairline); background: var(--line); }

/* Icône en trait, à la taille du texte qui l'accompagne. Les écrans qui ont
   besoin d'un autre calibre redéfinissent width/height, jamais le tracé. */
.ic {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- coquille ---------- */

.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--t-base) var(--ease);
}
.app.reduit { grid-template-columns: var(--rail-mini) minmax(0, 1fr); }

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--s3);
  height: var(--topbar);
  padding: 0 var(--s5);
  background: var(--topbar-bg);
  border-bottom: var(--hairline) solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}

.brand { display: inline-flex; align-items: center; gap: var(--s2); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r1);
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--f-display);
  font-size: var(--fs-lg);
  line-height: 1;
}

.wordmark {
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--ink);
}
.wordmark .dot { color: var(--accent); }
a.wordmark:hover { text-decoration: none; color: var(--ink); }

.crumb {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  white-space: nowrap;
}
.crumb-label { color: var(--muted); }
.crumb-sep { color: var(--line-2); }
.crumb > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumb > :last-child { flex: 0 0 auto; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.crumb b { color: var(--ink); font-weight: 500; }

/* Menu de compte. Pas de JavaScript : <details> suffit et reste accessible. */
.acct { position: relative; }
.acct > summary { list-style: none; cursor: pointer; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary { display: inline-flex; align-items: center; gap: var(--s2); }
.avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r3);
  background: var(--accent-sft);
  color: var(--accent-ink);
  font-size: var(--fs-tiny);
  font-weight: 600;
}
.status-dot, .side-foot-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: var(--r3);
  background: var(--ok);
  box-shadow: var(--status-ring);
}
.algo { display: inline-flex; align-items: center; gap: var(--s2); }
.acct > .menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s2));
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding: var(--s1);
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--r1);
  box-shadow: var(--e3);
  z-index: 10;
}
.acct .menu a, .acct .menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: var(--r1);
  background: none;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.acct .menu a:hover, .acct .menu button:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

/* ---------- rail ---------- */

.side {
  position: relative;
  overflow: hidden;
  border-right: var(--hairline) solid var(--line);
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  padding: var(--s4) var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  transition: padding var(--t-base) var(--ease);
}
/* Un tas de granulats au pied du rail : le sujet de l'application, posé une
   fois, en fond. `multiply` mange le blanc du studio, le masque éteint le reste. */
.side::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 240px;
  background: url("../img/gravier.jpg") 45% 82% / 180% auto no-repeat;
  -webkit-mask-image: radial-gradient(104% 100% at 45% 96%, var(--masque-plein) 26%, transparent 74%);
  mask-image: radial-gradient(104% 100% at 45% 96%, var(--masque-plein) 26%, transparent 74%);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}
.side > * { position: relative; z-index: 1; }
.app.reduit .side::after { display: none; }
.side-head {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s2) var(--s3) var(--s4);
  border-bottom: var(--hairline) solid var(--line-2);
}
.side-head strong { color: var(--ink); font-size: var(--fs-body); }
.side-caption { color: var(--muted); font-size: var(--fs-tiny); }
.navgroup { display: flex; flex-direction: column; gap: var(--s0); }
.navgroup > .up { padding: 0 var(--s3) var(--s2); }
.side > .navgroup:last-of-type { margin-top: auto; }
.side-foot {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: auto;
  padding: var(--s3);
  border: var(--hairline) solid var(--line-2);
  border-radius: var(--r1);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-tiny);
}
.side-foot b, .side-foot small { display: block; }
.side-foot b { color: var(--ink); font-size: var(--fs-tiny); font-weight: 600; }
.side-foot small { color: var(--muted); margin-top: var(--s0); }
.nav {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r1);
  color: var(--ink-2);
  font-size: var(--fs-body);
  transition: background-color var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease);
}
.nav:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav.on {
  background: var(--accent-sft);
  color: var(--accent-ink);
  font-weight: 500;
  box-shadow: var(--glow-accent);
}
.nav.off { color: var(--muted); opacity: 0.72; pointer-events: none; }
.navicon, .reduction svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav:first-of-type .navicon { fill: currentColor; stroke: none; }
.app.reduit .side { padding-inline: var(--s2); }
.app.reduit .side > .navgroup > .up,
.app.reduit .navlabel,
.app.reduit .side-head,
.app.reduit .side-foot { display: none; }
.app.reduit .nav { justify-content: center; padding-inline: var(--s2); }
.app.reduit .reduction svg { transform: rotate(180deg); }

/* ---------- fil d'étapes ----------
   Une rangée de fiches, une par étape : le pictogramme dit laquelle, le titre
   son rang, la ligne du dessous ce qu'elle a produit, et le jalon de droite où
   elle en est. La rangée défile plutôt que de se replier quand la fenêtre se
   resserre — l'ordre des étapes est l'information, la sauter la détruit.

   Tout est cadré par `.rail` : `.etape` existe aussi sur la page de connexion,
   où il désigne un pion de parcours, et les deux ne doivent pas se croiser. */

.rail {
  flex-direction: row;
  align-items: stretch;
  gap: var(--s2);
  overflow-x: auto;
  padding-bottom: var(--s2);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.rail .etape {
  display: grid;
  grid-template-columns: var(--etape-pic) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s2);
  flex: 0 0 var(--etape-l);
  padding: var(--s2) var(--s3);
  border: var(--hairline) solid var(--line);
  border-radius: var(--r2);
  background: var(--surface);
  box-shadow: var(--e1);
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.rail .etape:hover {
  border-color: var(--card-border-accent);
  box-shadow: var(--e2);
  text-decoration: none;
}
.rail .txt { display: flex; flex-direction: column; min-width: 0; }
.rail .t,
.rail .s {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail .t { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.rail .s { font-size: var(--fs-tiny); color: var(--muted); }

.etape-pic {
  display: grid;
  place-items: center;
  width: var(--etape-pic);
  height: var(--etape-pic);
  border-radius: var(--r1);
  background: var(--accent-sft);
  color: var(--accent-ink);
}
.etape-pic .ic { width: 17px; height: 17px; }
/* La fiche de l'échantillon n'est pas une étape : elle ouvre la rangée et
   renvoie à la source, d'où le chevron à la place du jalon. */
.rail .ancre .t { white-space: normal; }
.etape-fleche { width: 15px; height: 15px; color: var(--line-2); }

/* Le jalon dit l'état sans recourir à la couleur seule : anneau vide pour ce
   qui reste à faire, coche pour ce qui est fait, disque plein pour l'ouvert. */
.jalon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: var(--hairline) solid var(--line-2);
  border-radius: var(--r3);
}
.jalon svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  visibility: hidden;
}

.rail .etape.done .t { color: var(--accent-ink); }
.rail .etape.done .jalon { background: var(--ok); border-color: var(--ok); }
.rail .etape.done .jalon svg { visibility: visible; }

.rail .etape.todo .etape-pic { background: var(--surface-2); color: var(--muted); }
.rail .etape.todo .t { color: var(--muted); }

.rail .etape.now {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--btn-glow-md);
}
.rail .etape.now .t { color: var(--on-accent); }
.rail .etape.now .s { color: var(--on-accent); opacity: 0.8; }
.rail .etape.now .etape-pic { background: var(--accent-voile); color: var(--on-accent); }
.rail .etape.now .jalon { background: var(--on-accent); border-color: var(--on-accent); }

.rail .etape.off { opacity: 0.5; pointer-events: none; }

/* Le pas suivant se range juste après l'étape ouverte, dans la rangée. Il reste
   discret : l'accent plein est déjà pris par la fiche de l'étape courante, et
   par l'action principale de la page — trois bleus se disputeraient l'œil. */
.rail .next-step {
  flex: 0 0 var(--etape-l);
  align-self: stretch;
  height: auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  padding: var(--s2) var(--s3);
  border-radius: var(--r2);
  border-style: dashed;
  font-size: var(--fs-tiny);
  font-weight: 400;
  line-height: 1.3;
  color: var(--muted);
}
.rail .next-step-title { font-size: var(--fs-sm); font-weight: 600; color: var(--accent-ink); }

/* Les paliers d'adaptation resserrent `--marge-page` plus bas : un décor
   d'écran qui déborde jusqu'au bord suit alors la gouttière au lieu de la
   dépasser d'un cran. */
.main { padding: var(--s6) var(--marge-page) var(--s7); max-width: var(--page-max); }
/* Le tableau de bord n'aligne pas des paragraphes mais des cartes : il prend
   toute la largeur utile, là où les écrans de lecture restent à --page-max. */
.main.ample { max-width: var(--page-ample); }
.sample-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  align-items: start;
}
.sample-content { width: 100%; min-width: 0; }
.sample-progress { width: 100%; }
.planche-icones { display: none; }

.pagehead { display: flex; align-items: flex-start; gap: var(--s5); margin-bottom: var(--s6); }
.pagehead p { color: var(--muted); margin-top: var(--s1); max-width: 62ch; }
/* Un titre d'écran porte le pictogramme de son étape, le même que dans le fil :
   on reconnaît où l'on est avant d'avoir lu. La ligne d'état se range sous le
   texte, pas sous l'icône, pour que les deux lignes partent du même bord. */
.tete { display: flex; align-items: center; gap: var(--s3); }
.tete + p { margin-left: calc(var(--pastille-tete) + var(--s3)); }
.tete-pic {
  display: grid;
  place-items: center;
  width: var(--pastille-tete);
  height: var(--pastille-tete);
  flex: none;
  border-radius: var(--r2);
  background: var(--accent-sft);
  color: var(--accent-ink);
}
.tete-pic svg { width: 22px; height: 22px; fill: currentColor; }
.tete-pic .ic { width: 21px; height: 21px; fill: none; }

.flash {
  position: sticky;
  top: var(--topbar);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-bottom: var(--s4);
}

/* ---------- carte ---------- */

.card {
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--r2);
  box-shadow: var(--e1);
  overflow-x: auto;
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.card > .hd {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  padding: var(--s4) var(--s4) var(--s2);
}
.card > .bd { padding: var(--s4); }
.card > .hd + .bd { padding-top: var(--s2); }
.card > .ft {
  padding: var(--s3) var(--s4);
  border-top: var(--hairline) solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r2) var(--r2);
}
/* Un en-tête qui porte une pastille se centre : la ligne de base ne veut plus
   rien dire dès qu'une icône entre dans la rangée. */
.card > .hd.ac { align-items: center; }
.hd-pic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--r1);
  background: var(--accent-sft);
  color: var(--accent-ink);
}
.hd-pic .ic { width: 17px; height: 17px; }
/* Un pied de carte qui commente ce qui précède : l'icône annonce une note, pas
   une alerte, et se cale sur la taille du texte qu'elle accompagne. */
.card > .ft.note { display: flex; align-items: center; gap: var(--s2); color: var(--muted); }
.card > .ft.note .ic { width: 15px; height: 15px; }

a.card:hover, .card.act:hover {
  box-shadow: var(--e2), var(--glow-accent);
  border-color: var(--card-border-accent);
  text-decoration: none;
}

/* ---------- boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: var(--ctrl);
  padding: 0 var(--s4);
  border-radius: var(--r1);
  border: var(--hairline) solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-base) var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn.pri {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--btn-glow);
}
.btn.pri:hover {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
  color: var(--on-accent);
  box-shadow: var(--btn-glow-md);
}
.btn.acc {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--btn-glow);
}
.btn.acc:hover {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
  color: var(--on-accent);
  box-shadow: var(--btn-glow-md);
}
.btn.on {
  background: var(--accent-sft);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.wide { width: 100%; }
/* Bouton réduit à son pictogramme. Le libellé n'est pas supprimé, il passe dans
   `aria-label` et `title` : sans eux la commande est muette. */
.btn.ico { width: var(--ctrl); padding: 0; }
.btn.ico .ic { width: 17px; height: 17px; }
.btn.sm { height: var(--ctrl-sm); padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn[disabled], .btn.dis { opacity: 0.45; pointer-events: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }

/* ---------- champs ---------- */

.field { display: flex; flex-direction: column; gap: var(--s1); }
.field > label { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.inp {
  height: var(--ctrl);
  padding: 0 var(--s3);
  border: var(--hairline) solid var(--line-2);
  border-radius: var(--r1);
  background: var(--surface);
  box-shadow: var(--inset);
  width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.inp:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--inset), var(--ring);
}
.inp.mono, .inp[type="number"] { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---------- chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  height: 22px;
  padding: 0 var(--s2);
  border-radius: var(--r3);
  border: var(--hairline) solid var(--line-2);
  background: var(--surface);
  font-size: var(--fs-tiny);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.acc  { background: var(--accent-sft); border-color: transparent; color: var(--accent-ink); }
.chip.ok   { background: var(--ok-sft);     border-color: transparent; color: var(--ok-ink); }
.chip.warn { background: var(--warn-sft);   border-color: transparent; color: var(--warn-ink); }
.chip.ink  { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip .pt { width: 6px; height: 6px; border-radius: var(--r3); background: currentColor; }
.chip .ic { width: 13px; height: 13px; }
a.chip:hover, button.chip:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- bannières ---------- */

.banner {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r1);
  background: var(--accent-sft);
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.banner > .ic { margin-top: var(--s0); }
.banner.warn { background: var(--warn-sft); color: var(--warn-ink); }
.banner.flat { background: var(--surface-2); color: var(--ink-2); }
.banner b { font-weight: 600; }
.banner .mk { font-family: var(--f-mono); font-size: var(--fs-tiny); white-space: nowrap; }

/* ---------- données ---------- */

.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); align-items: baseline; margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd {
  margin: 0;
  font-family: var(--f-mono);
  font-size: var(--fs-num);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stat, .metric {
  display: flex;
  flex-direction: column;
  gap: var(--s0);
  padding-bottom: var(--s2);
  border-bottom: var(--hairline) solid var(--line);
}
.stat .v, .metric .v {
  font-family: var(--f-mono);
  font-size: var(--fs-metric);
  line-height: 1.1;
  letter-spacing: var(--tr-metric);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat .u, .metric .u { font-family: var(--f-mono); font-size: var(--fs-tiny); color: var(--muted); }
.stat .k, .metric .k {
  font-size: var(--fs-caps);
  font-weight: 600;
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s1);
}

/* ---------- tableaux ---------- */

table.tb { width: 100%; border-collapse: collapse; font-size: var(--fs-num); }
table.tb th {
  text-align: left;
  font-size: var(--fs-caps);
  font-weight: 600;
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--s2) var(--s3);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
table.tb th.exact { text-transform: none; font-size: var(--fs-tiny); letter-spacing: 0; }
table.tb td { padding: var(--s2) var(--s3); border-bottom: var(--hairline) solid var(--line); }
table.tb tr:last-child td { border-bottom: 0; }
table.tb td.n, table.tb th.n {
  text-align: right;
  padding-right: var(--s5);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}
table.tb tbody tr:hover { background: var(--surface-2); transition: background-color var(--t-fast) var(--ease); }
table.tb tr.sel, table.tb tr.sel:hover { background: var(--accent-sft); }
table.tb td .inp { height: 26px; font-size: var(--fs-sm); text-align: right; }
.scroll { max-height: 460px; overflow: auto; }

.tb td.warn { color: var(--warn-ink); font-weight: 600; position: relative; }
.tb td.warn::before {
  content: "";
  position: absolute;
  left: var(--s1);
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: calc(var(--s0) * -1);
  border-radius: var(--r3);
  background: var(--warn);
}

.nd { color: var(--muted); font-size: var(--fs-tiny); font-style: normal; }
.nd::before { content: "— "; }

/* ---------- état vide ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s6) var(--s4);
  border: var(--hairline) dashed var(--line-2);
  border-radius: var(--r2);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.empty p { max-width: 46ch; }

/* ---------- figure ---------- */

.fig { display: flex; flex-direction: column; gap: var(--s2); }
.fig > .frame {
  border: var(--hairline) solid var(--line);
  border-radius: var(--r1);
  box-shadow: var(--e1);
  background: var(--surface);
  overflow: hidden;
}
.fig img, .fig svg { display: block; width: 100%; height: auto; }
/* La légende titre la figure : même traitement que les autres titres. */
.fig > figcaption, .fig > .cap {
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--ink);
}
.fig > .src { font-size: var(--fs-tiny); color: var(--muted); }

.ax  { stroke: var(--line-2); stroke-width: 1; }
.gl  { stroke: var(--line);   stroke-width: 1; }
.hbar { fill: var(--fig-ln); }
.dot { fill: none; stroke: var(--fig-ln); stroke-width: 1.3; }
.bx  { fill: var(--fig-fill); stroke: var(--fig-ln); stroke-width: 1.2; }
.whk { stroke: var(--fig-ln); stroke-width: 1; }
.med { stroke: var(--ink); stroke-width: 2; }
.rad { fill: var(--fig-fill); stroke: var(--fig-ln); stroke-width: 1.6; }
.crv { fill: none; stroke: var(--fig-ln); stroke-width: 1.8; }
.mk2 { fill: none; stroke: var(--fig-mk); stroke-width: 1.6; }
.cb  { fill: var(--fig-ln); }
.leg { font-size: var(--fs-sm); color: var(--muted); }
.xrow, .yhead {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: var(--fs-caps);
  color: var(--muted);
}
.xrow  { padding-top: var(--s1); }
.yhead { padding-bottom: var(--s1); }

/* ---------- planche ---------- */

.plate svg { display: block; width: 100%; height: auto; border-radius: var(--r1); }
.poly { fill: var(--poly); stroke: var(--poly-ln); stroke-width: 1.4; cursor: pointer; }
.poly:hover { fill: var(--poly-hi); }
.poly.sel { fill: var(--poly-sel); stroke: var(--poly-selln); stroke-width: 2.2; }
.poly.ex { fill: none; stroke: var(--poly-selln); stroke-dasharray: 4 3; stroke-width: 1.4; }
.roi { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 7 5; opacity: 0.5; }
.glabel {
  font-family: var(--f-mono);
  font-size: var(--fs-glabel);
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }

/* ---------- progression et journal ---------- */

.bar { height: 5px; border-radius: var(--r3); background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width var(--t-slow) var(--ease); }

.log { display: flex; flex-direction: column; }
.log .row {
  display: flex;
  gap: var(--s2);
  padding: var(--s2) 0;
  border-bottom: var(--hairline) dashed var(--line);
  font-size: var(--fs-sm);
}
.log .row:last-child { border-bottom: 0; }
.log .tm { font-family: var(--f-mono); font-size: var(--fs-caps); color: var(--muted); padding-top: var(--s0); }

/* ---------- grilles partagées ---------- */

.cols { display: grid; gap: var(--s5); align-items: start; }
.cols > * { min-width: 0; }
.cols.a { grid-template-columns: minmax(0, 1fr) 330px; }
.cols.b { grid-template-columns: minmax(0, 1fr) 380px; }
.cols.half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); }
.prm { display: grid; grid-template-columns: 1fr 110px; gap: var(--s2) var(--s3); align-items: center; }
.prm label { font-size: var(--fs-sm); color: var(--ink-2); }
.prm .inp { height: var(--ctrl-sm); font-size: var(--fs-sm); }
.thumb {
  border-radius: var(--r1);
  border: var(--hairline) solid var(--line);
  overflow: hidden;
  background: var(--surface-2);
}
.thumb svg, .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- adaptation ---------- */

.tiroir, .reduction { display: none; }
.nav-scrim { display: none; }

@media (min-width: 781px) {
  .reduction { display: inline-flex; }
}

@media (max-width: 1100px) {
  .main { --marge-page: var(--s5); padding: var(--s5) var(--marge-page) var(--s6); }
}

/* Le parcours ne doit jamais rogner les tableaux d'analyse. Il passe sous la
   page avant que les colonnes n'entrent en concurrence avec lui. */
@media (max-width: 1200px) {
  .sample-layout { gap: var(--s5); }
}

@media (max-width: 980px) {
  .cols.half, .cols.a, .cols.b { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 780px) {
  .app, .app.reduit { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    top: var(--topbar);
    bottom: 0;
    left: 0;
    width: var(--rail);
    padding: var(--s5) var(--s3);
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
    z-index: 6;
    box-shadow: var(--e3);
  }
  .app.ouvert .side { transform: translateX(0); }
  .app.ouvert .nav-scrim { display: block; position: fixed; inset: var(--topbar) 0 0; z-index: 5; border: 0; background: var(--nav-scrim); cursor: pointer; }
  .tiroir { display: inline-flex; }
  .crumb { display: none; }
  .account-name, .algo { display: none; }
  .topbar { gap: var(--s2); padding-inline: var(--s3); }
  .brand { margin-right: var(--s1); }
  .main { --marge-page: var(--s3); padding: var(--s5) var(--marge-page) var(--s6); }
  .sample-layout { gap: var(--s5); }
}

@media (max-width: 560px) {
  /* Plus la place de décaler la ligne d'état sous le titre : elle repart du
     bord, avec le pictogramme. */
  .tete + p { margin-left: 0; }
}
