/* Epistemik console — copycat Vercel (décision 05/12) : Geist, rayons 6px, badges full-round,
   ombres douces sur les surfaces flottantes. Ne restent d'Epistemik que les couleurs et le logo.
   Règle couleur (Vercel) : le cobalt = interactif, les sémantiques = états, le reste monochrome. */

:root {
  /* ----- SOMBRE (défaut console) ----- */
  --paper: #0f1113;            /* le sol */
  --card: #15181b;             /* surface */
  --surface: #1b1f23;          /* raised : th, hovers, menus */
  --tab-off: #0f1113;
  --ink: #f2f2ee;              /* texte */
  --muted: #9b9e95;
  --faint: #6b6e66;
  --line: rgba(242, 242, 238, .16);       /* border-strong */
  --line-soft: rgba(242, 242, 238, .09);  /* border */
  --blue: #5a78f5;             /* cobalt éclairci : texte, liens, icônes (AA) */
  --blue-fill: #244ee8;        /* le cobalt de la marque : aplats */
  --blue-fill-hover: #3c63f2;
  --selection: rgba(36, 78, 232, .14);    /* cobalt-soft */
  --green: #4ec27e;  --green-soft: rgba(78, 194, 126, .12);
  --red: #f07a76;    --red-soft: rgba(240, 122, 118, .12);
  --amber: #e3b341;  --amber-soft: rgba(227, 179, 65, .12);
  --bar-bg: #1b1f23; --bar-fg: var(--ink); --bar-muted: var(--muted);
  --shadow-bar: 0 -8px 24px rgba(0, 0, 0, .35);
  --shadow-pop: 0 8px 30px rgba(0, 0, 0, .45);
  --ring: 0 0 0 3px rgba(90, 120, 245, .28);
  --mark-p1: #6b6e66; --mark-p2: #9b9e95; --mark-p3: #f2f2ee;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", "SFMono-Regular", Consolas, monospace;
  --r: 6px; --r-sm: 4px; --r-full: 999px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 120ms; --t-med: 200ms; --t-slow: 300ms;
  --sidew: 180px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* ----- CLAIR (la charte papier epistemik.ai) ----- */
  --paper: #f5f5f2;
  --card: #ffffff;
  --surface: #eaece6;
  --tab-off: #efefeb;
  --ink: #111310;
  --muted: #666963;
  --faint: #8a8d85;
  --line: #aeb0a8;
  --line-soft: #d6d8d0;
  --blue: #244ee8;
  --blue-fill: #244ee8;
  --blue-fill-hover: #1a3bbf;
  --selection: #d9e0f8;
  --green: #1a7a3c;  --green-soft: #e4f1e8;
  --red: #c02828;    --red-soft: #f7e4e4;
  --amber: #9a6700;  --amber-soft: #f6edd8;
  --bar-bg: #111310; --bar-fg: #f5f5f2; --bar-muted: #c9cbc4;
  --shadow-bar: 0 -10px 22px rgba(17, 19, 16, .12);
  --shadow-pop: 0 12px 40px rgba(17, 19, 16, .18);
  --ring: 0 0 0 3px rgba(36, 78, 232, .22);
  --mark-p1: #aeb0a8; --mark-p2: #666963; --mark-p3: #111310;
  color-scheme: light;
}

/* focus clavier — ring Vercel sur les champs, outline cobalt sur le reste */
a:focus-visible, button:focus-visible, summary:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--blue) !important;
  box-shadow: var(--ring);
}
.skip { position: absolute; left: -9999px; }
.skip:focus {
  position: fixed; top: 10px; left: 10px; z-index: 50;
  background: var(--blue-fill); color: #fff; padding: 9px 14px; text-decoration: none;
}
* { box-sizing: border-box; }
html { interpolate-size: allow-keywords; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blue);
}
::selection { background: var(--selection); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--paper); border-radius: var(--r-full); }
::-webkit-scrollbar-track { background: transparent; }
a { color: inherit; }

/* ---------- icônes ---------- */
.ic { width: 15px; height: 15px; flex: none; vertical-align: -3px; }
.ic.lg { width: 20px; height: 20px; }

/* ---------- marque ---------- */
.mark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.mark svg { width: 19px; height: 19px; }
.mark .p1 { stroke: var(--mark-p1); }
.mark .p2 { stroke: var(--mark-p2); }
.mark .p3 { stroke: var(--mark-p3); }
.wordmark { font-size: 14.5px; letter-spacing: .02em; font-weight: 740; text-transform: lowercase; text-decoration: none; }

/* ---------- coquille ---------- */
header.site { background: var(--paper); position: sticky; top: 0; z-index: 5; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 14px; padding: 0 14px; }
/* fil d'ariane à slashes dans la barre (pattern Vercel) */
.crumbbar { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; }
.crumbbar .slash { color: var(--line); font-size: 15px; font-weight: 300; flex: none; }
.crumbbar .seg { font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.crumbbar a.seg:hover { color: var(--blue); }
.crumbbar .seg.here { color: var(--ink); font-weight: 650; }
.org-seg { border: none !important; background: transparent !important; font-size: 12.5px !important;
  color: var(--ink) !important; font-weight: 650; padding: 2px 2px !important; max-width: 180px; cursor: pointer; }
.org-seg:hover { color: var(--blue) !important; }
#crumbs { display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; }
.top-right { display: flex; align-items: center; gap: 8px; }
.top-right select {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--r); padding: 4px 7px; max-width: 190px;
}
.kbd-hint {
  font: 10px/1 var(--mono); color: var(--muted); border: 1px solid var(--line-soft);
  padding: 4px 6px; background: var(--card); cursor: pointer; display: inline-flex; gap: 5px; align-items: center;
  border-radius: var(--r);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.kbd-hint:hover { color: var(--blue); border-color: var(--blue); }
kbd {
  font: 10px/1 var(--mono); border: 1px solid var(--line); border-bottom-width: 2px;
  background: var(--card); padding: 2px 4px; color: var(--ink); border-radius: var(--r-sm);
}
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; font-size: 12px; padding: 4px 7px; border: 1px solid transparent; border-radius: var(--r); }
details.menu summary::-webkit-details-marker { display: none; }
details.menu[open] summary { border-color: var(--line-soft); background: var(--surface); }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line-soft);
  min-width: 200px; z-index: 10; display: flex; flex-direction: column;
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-pop); padding: 4px;
}
.menu-body a, .menu-body button {
  padding: 7px 10px; font-size: 13px; text-decoration: none; border: none; background: none;
  color: var(--ink); text-align: left; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 8px; border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.menu-body a:hover, .menu-body button:hover { background: var(--surface); }
.menu-body .ks { margin-left: auto; font: 10.5px/1 var(--mono); color: var(--faint); }

/* ---------- onglets soulignés (indicateur glissant — pattern signature) ---------- */
.tabnav { position: relative; display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line-soft);
  overflow-x: auto; background: var(--paper); }
.tabnav button {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer;
  padding: 7px 11px 8px; margin: 2px 0 3px; white-space: nowrap; border-radius: var(--r);
  transition: color var(--t-fast), background var(--t-fast);
}
.tabnav button .ic { width: 14px; height: 14px; opacity: .8; }
.tabnav button:hover { color: var(--ink); background: var(--surface); }
.tabnav button.on { color: var(--ink); font-weight: 650; }
.tabnav button.on .ic { color: var(--blue); opacity: 1; }
.tabnav button.ghost { color: var(--faint); cursor: not-allowed; }
.tabnav button .badge { font: 10px/1 var(--mono); color: var(--blue); background: var(--selection); padding: 2px 6px; border-radius: var(--r-full); }
.tabnav .ind { position: absolute; bottom: 0; height: 2px; background: var(--blue-fill);
  transition: left var(--t-med) var(--ease), width var(--t-med) var(--ease); }

main { padding: 16px 0 48px; }
.content { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.crumb { font: 10.5px/1.7 var(--mono); color: var(--muted); margin: 0 0 8px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--blue); }
.inclus { font: 10px/1.6 var(--mono); color: var(--blue); border: 1px solid var(--selection); background: var(--selection); padding: 1px 8px; border-radius: var(--r-full); }

/* ---------- tuiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0 0 16px; }
.tile {
  background: var(--card); border: 1px solid var(--line-soft); padding: 10px 12px 9px;
  display: flex; flex-direction: column; gap: 1px; position: relative; overflow: hidden;
  border-radius: var(--r); transition: border-color var(--t-fast);
}
.tile:hover { border-color: var(--line); }
.tile .n { font: 22px/1.1 var(--mono); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .l { font: 12px/1.5 var(--sans); color: var(--muted);
  display: flex; align-items: center; gap: 5px; }
.tile .l .ic { width: 12px; height: 12px; }
.tile.accent { border-color: var(--blue-fill); }
.tile.accent .n { color: var(--blue); }
.tile::after {
  content: ""; position: absolute; right: -13px; bottom: -13px; width: 36px; height: 36px;
  border: 1.5px solid var(--line-soft); transform: rotate(14deg); pointer-events: none;
}
.tile.accent::after { border-color: var(--selection); }

/* ---------- onglets (soulignés façon Vercel, hover en pilule) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin: 12px 0 14px; flex-wrap: nowrap; overflow-x: auto; }
.tab {
  position: relative; padding: 6px 11px 9px; margin-bottom: 0; white-space: nowrap; flex: none; font-size: 13px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r) var(--r) 0 0;
  transition: color var(--t-fast), background var(--t-fast);
}
.tab .ic { width: 13px; height: 13px; }
.tab.active { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--blue-fill); }
.tab.active .ic { color: var(--blue); }
.tab.ghost { color: var(--faint); cursor: not-allowed; }
.tab:not(.ghost):not(.active):hover { color: var(--ink); background: var(--surface); }

/* ---------- lignes deployment-style ---------- */
.rows { border: 1px solid var(--line-soft); background: var(--card); border-radius: var(--r); overflow: hidden;
  transition: border-color var(--t-fast); }
.rows:hover { border-color: var(--line); }
.row {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft); text-decoration: none; font-size: 13px;
  transition: background var(--t-fast);
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface); }
.row .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.row .row-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .row-main .faint { color: var(--faint); margin-left: 7px; }
.row .row-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; flex: none;
  font-size: 12px; color: var(--muted); }
.row .chev { color: var(--faint); width: 13px; height: 13px; transition: transform var(--t-fast), color var(--t-fast); }
.row:hover .chev { transform: translateX(2px); color: var(--blue); }

/* ---------- à faire ---------- */
.afaire { border: 1px solid var(--line-soft); background: var(--card); margin: 0 0 16px;
  border-radius: var(--r); overflow: hidden; }
.afaire a {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft); text-decoration: none; font-size: 13px;
  transition: background var(--t-fast);
}
.afaire a:last-child { border-bottom: none; }
.afaire a:hover { background: var(--surface); }
.afaire a:hover .quoi { transform: translateX(2px); }
.afaire .quoi { font-weight: 650; color: var(--blue); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  transition: transform var(--t-fast); }

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 44px auto; padding: 0 20px; }
.auth .mark { margin-bottom: 18px; }
.auth .mark svg { width: 30px; height: 30px; }
.auth .card { padding: 20px 22px; }
.auth .switch { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
/* segmented control arrondi (bascules — pattern Vercel) */
.choice { display: flex; gap: 2px; margin: 14px 0 4px; border: 1px solid var(--line-soft);
  border-radius: var(--r); background: var(--surface); padding: 2px; }
.choice button { flex: 1; font: inherit; font-size: 13px; padding: 6px 8px; background: transparent;
  border: none; cursor: pointer; color: var(--muted); border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast); }
.choice button:hover { color: var(--ink); }
.choice button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }

.code-invitation { font: 17px/1 var(--mono); letter-spacing: .12em; background: var(--surface);
  border: 1px dashed var(--line); padding: 10px 14px; display: inline-block; border-radius: var(--r); }
.eyebrow { font: 12px/1.7 var(--sans); color: var(--muted); }
h1 { font-size: clamp(19px, 2.4vw, 25px); letter-spacing: -.035em; line-height: 1.05; font-weight: 740; margin: 4px 0 8px; }
h2 { font-size: 14px; letter-spacing: -.015em; font-weight: 650; margin: 18px 0 7px; display: flex; align-items: center; gap: 7px; }
h2 .ic { color: var(--muted); width: 14px; height: 14px; }
p.lede { color: var(--muted); max-width: 64ch; margin: 0 0 14px; }

/* ---------- boutons (Vercel : noir/blanc, radius 6, hover en nuance) ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: var(--r);
  min-height: 32px; padding: 5px 13px; font: inherit; font-size: 13px; font-weight: 560; cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms, transform var(--t-fast);
}
.button .ic { width: 14px; height: 14px; }
.button:hover { background: color-mix(in srgb, var(--ink) 82%, var(--paper)); border-color: color-mix(in srgb, var(--ink) 82%, var(--paper)); }
.button.engage { background: var(--blue-fill); color: #fff; border-color: var(--blue-fill); }
.button.engage:hover { background: var(--blue-fill-hover); border-color: var(--blue-fill-hover); color: #fff; }
.button:active { transform: translateY(1px); }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.button.secondary:hover { color: var(--blue); border-color: var(--blue); background: transparent; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.small { min-height: 24px; padding: 1px 9px; font-size: 12px; }
.button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.button.danger:hover { background: color-mix(in srgb, var(--red) 84%, #000); border-color: color-mix(in srgb, var(--red) 84%, #000); }
:root[data-theme="light"] .button.danger:hover { background: color-mix(in srgb, var(--red) 86%, #fff); border-color: color-mix(in srgb, var(--red) 86%, #fff); }

input[type=text], input[type=password], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input[type=text]:hover, input[type=password]:hover, textarea:hover { border-color: var(--muted); }
textarea { min-height: 100px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 13px 0 4px; }

/* ---------- badges d'état : full-round avec pastille (pattern Vercel) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; font: 11px/1.6 var(--sans); font-weight: 500;
  padding: 1px 9px; border: 1px solid var(--line); border-radius: var(--r-full);
  white-space: nowrap; color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill .ic { display: none; } /* la pastille ::before remplace l'icône (badge Vercel) */
.pill.brouillon { background: var(--surface); }
.pill.registre_propose, .pill.en_edition { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.pill.valide, .pill.en_construction { background: var(--selection); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 40%, transparent); }
.pill.be_livre, .pill.fe_livre { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.pill.en_correction { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.pill.receptionnee { background: var(--green-soft); color: var(--green); border-color: var(--green); font-weight: 600; }
.pill.tick { animation: tick var(--t-slow) var(--ease); }
@keyframes tick { 0% { transform: scale(.92); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }

.niveau { font: 10.5px/1.6 var(--mono); padding: 1px 8px; border: 1px solid var(--line-soft); color: var(--muted); border-radius: var(--r-full); }
.niveau.metier { background: var(--selection); color: var(--blue); }
.niveau.critique { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- tables (Vercel : conteneur arrondi, en-têtes sobres, lignes denses) ---------- */
table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--r); }
/* le radius sans overflow:hidden (overflow casserait position:sticky du th) */
table > tr:first-child > *:first-child, table > tbody > tr:first-child > *:first-child { border-top-left-radius: var(--r); }
table > tr:first-child > *:last-child, table > tbody > tr:first-child > *:last-child { border-top-right-radius: var(--r); }
th { text-align: left; font: 500 11.5px/1.5 var(--sans);
     color: var(--muted); padding: 5px 10px; border-bottom: 1px solid var(--line-soft); background: var(--surface); }
td { padding: 4px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 13px; }
tr:last-child td { border-bottom: none; }
td.num, .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
tr.exclu td { color: var(--faint); }
tr.exclu .titre-ca { text-decoration: line-through; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface); }
tr.kfocus td { background: var(--selection); box-shadow: inset 2px 0 0 var(--blue-fill); }
/* en-tête sticky des longues tables de travail (sous la topbar) — le scroll est celui de la page.
   Pas d'overflow:hidden sur ces tables : il annulerait le sticky. */
table.sticky-head th { position: sticky; top: 44px; z-index: 3; }
table.sticky-head th::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--line); }

/* « Afficher plus » (pattern Vercel : pleine largeur, discret) */
.more-btn {
  display: block; width: 100%; text-align: center; font: inherit; font-size: 12.5px;
  color: var(--muted); background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 7px; cursor: pointer; margin: 8px 0;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.more-btn:hover { color: var(--blue); border-color: var(--line); }

/* pagination (Précédent / Suivant + « 1-25 sur 148 ») */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }
.pager .range { font: 12px/1.5 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.pager .pgbtns { display: flex; gap: 6px; }

/* recherche de liste */
.listsearch { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
.listsearch input { max-width: 300px; padding: 6px 10px; font-size: 13px; }

.mono { font-family: var(--mono); font-size: 11.5px; }

/* ---------- réception : cellule d'action à grille FIXE (l'alignement ne bouge jamais) ---------- */
td.cell-recep { white-space: nowrap; vertical-align: middle; }
.recep { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; }
.badge-recep {
  display: inline-flex; align-items: center; gap: 5px; font: 500 11px/1.6 var(--sans);
  padding: 1px 9px; border-radius: var(--r-full); border: 1px solid; white-space: nowrap;
}
.badge-recep::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-recep.acc { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.badge-recep.ref { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
/* le motif du refus vit sous le critère, pleine largeur de sa cellule — jamais dans la colonne d'action */
.motif-refus {
  margin-top: 4px; padding: 2px 0 2px 9px; border-left: 2px solid color-mix(in srgb, var(--red) 55%, transparent);
  color: var(--muted); font-size: 12px; white-space: normal;
}
.motif-refus b { color: var(--red); font-weight: 600; }

/* ---------- barre totale / réception ---------- */
.total-bar {
  position: sticky; bottom: 10px; background: var(--bar-bg); color: var(--bar-fg);
  border: 1px solid var(--line); border-radius: calc(var(--r) + 2px);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 14px; margin-top: 12px; flex-wrap: wrap;
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.total-bar .amount { font: 600 18px/1.2 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-bar .hint { font-size: 11.5px; color: var(--bar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) {
  .total-bar { flex-wrap: nowrap; }
  .total-bar > div:first-of-type { min-width: 0; }
  .total-bar .actions { flex-wrap: nowrap; flex: none; }
}
.total-bar .button.secondary { color: var(--bar-fg); border-color: var(--line); }
.total-bar .button.secondary:hover { color: #fff; border-color: var(--blue-fill); background: var(--blue-fill); }
.progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--line-soft); }
.progress i { display: block; height: 100%; background: var(--blue-fill); width: 0; transition: width var(--t-slow) var(--ease); }
.progress i.full { background: var(--green); }

/* ---------- cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line-soft); padding: 12px 14px; margin: 8px 0;
  border-radius: var(--r); transition: border-color var(--t-fast); }
.card.inkbg { background: var(--bar-bg); color: var(--bar-fg); border-color: var(--line); }
.card.inkbg .muted { color: var(--bar-muted); }
.muted { color: var(--muted); }
.ok { color: var(--green); font-weight: 650; }
.ko { color: var(--red); font-weight: 650; }

/* ---------- timeline / étapes ---------- */
.timeline { list-style: none; margin: 6px 0 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.timeline .ts { font-family: var(--mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; padding-top: 2px; }
.timeline .who { font-weight: 650; min-width: 80px; }
.timeline .what .detail { color: var(--muted); font-size: 11.5px; }

.steps { list-style: none; margin: 10px 0 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 5.5px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.steps .dot { width: 8px; height: 8px; border: 1px solid var(--line); background: var(--card); flex: none;
  border-radius: 50%; transition: background var(--t-med), border-color var(--t-med); }
.steps li.done .dot { background: var(--green); border-color: var(--green); }
.steps li.done { color: var(--muted); }
.steps li.current .dot { background: var(--blue-fill); border-color: var(--blue-fill); animation: pulse 1.2s infinite; }
.steps li.current { font-weight: 650; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- traces, accordéons ---------- */
.trace { background: var(--paper); border: 1px solid var(--line-soft); margin: 5px 0 2px; padding: 8px 10px; overflow-x: auto; border-radius: var(--r-sm); }
.trace pre { margin: 0; font: 10.5px/1.5 var(--mono); }
details > summary { cursor: pointer; }
details.fold::details-content {
  height: 0; overflow: clip;
  transition: height var(--t-med) var(--ease), content-visibility var(--t-med) allow-discrete;
}
details.fold[open]::details-content { height: auto; }
details.fold > summary:hover { color: var(--blue); }
/* la trace : repliée dans la colonne Preuve, inline et minuscule (la rangée tient sur une ligne) */
.trace-fold { display: inline; }
.trace-fold > summary { display: inline; font: 10.5px/1 var(--mono); color: var(--faint); margin-left: 7px; }
.trace-fold > summary::before { content: "▸ "; }
.trace-fold[open] > summary::before { content: "▾ "; }
.trace-fold[open] .trace { display: block; margin-top: 5px; max-width: 460px; }
#table-preuves .motif-refus { margin-top: 2px; }

.temoin {
  border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); color: var(--red);
  padding: 8px 12px; font: 11px/1.6 var(--mono); margin: 0 0 10px; border-radius: var(--r);
}
.banner { padding: 8px 12px; margin: 0 0 10px; font-size: 13px; border: 1px solid var(--line-soft);
  display: flex; gap: 9px; align-items: flex-start; background: var(--card); border-radius: var(--r); }
.banner .ic { margin-top: 2px; flex: none; }
.banner.info { background: var(--selection); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.banner.info .ic { color: var(--blue); }
.banner.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.banner.warn .ic { color: var(--amber); }
.banner.err { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--red); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- toasts ---------- */
.toast {
  position: fixed; right: 16px; bottom: 16px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line-soft); border-radius: calc(var(--r) + 2px); box-shadow: var(--shadow-pop);
  padding: 9px 14px; font-size: 13px; z-index: 40; max-width: 380px;
  display: flex; gap: 8px; align-items: center;
}
.toast .ic { color: var(--green); flex: none; }
.toast.err { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.toast.err .ic { color: var(--red); }

select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--r); padding: 5px 8px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

/* ---------- confirmation ---------- */
.confirm { position: fixed; inset: 0; background: rgba(5, 6, 7, .6); z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
:root[data-theme="light"] .confirm { background: rgba(17, 19, 16, .45); }
.confirm[hidden] { display: none; }
.confirm-body { max-width: 480px; box-shadow: var(--shadow-pop); border: 1px solid var(--line-soft);
  border-radius: calc(var(--r) + 4px); overflow: hidden; }

/* ---------- palette ⌘K ---------- */
.cmdk { position: fixed; inset: 0; background: rgba(5, 6, 7, .6); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding: 11vh 20px 20px; }
:root[data-theme="light"] .cmdk { background: rgba(17, 19, 16, .45); }
.cmdk[hidden] { display: none; }
.cmdk-body { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-pop); border-radius: calc(var(--r) + 4px); overflow: hidden; }
.cmdk input {
  border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 14px; font-size: 14px; background: var(--card);
}
.cmdk input:focus-visible { outline: none; box-shadow: none; border-color: var(--line) !important; }
.cmdk-list { max-height: 46vh; overflow-y: auto; }
.cmdk-list a, .cmdk-list button {
  display: flex; align-items: center; gap: 9px; padding: 7px 14px; font-size: 12.5px; width: 100%;
  text-decoration: none; border: none; background: none; color: var(--ink); cursor: pointer;
  font-family: inherit; text-align: left; border-bottom: 1px solid var(--line-soft);
}
.cmdk-list .sel { background: var(--selection); box-shadow: inset 2px 0 0 var(--blue-fill); }
.cmdk-list .ic { color: var(--muted); }
.cmdk-list .sel .ic { color: var(--blue); }
.cmdk-list .where { margin-left: auto; font: 10px/1 var(--mono); color: var(--faint); }
.cmdk-empty { padding: 16px 14px; color: var(--muted); font-size: 12.5px; }
.cmdk-foot { display: flex; gap: 12px; padding: 7px 14px; border-top: 1px solid var(--line-soft);
  font: 10px/1.6 var(--mono); color: var(--muted); background: var(--surface); }

.shortcuts table { border: none; background: transparent; }
.shortcuts td { border: none; padding: 4px 10px 4px 0; font-size: 12.5px; }

/* ---------- états vides (carte pointillée Vercel) ---------- */
.empty { padding: 24px 18px; text-align: center; color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line); background: transparent; border-radius: var(--r); }
.empty svg { display: block; margin: 0 auto 10px; width: 64px; height: 48px; }
.empty svg .e1 { stroke: var(--mark-p1); }
.empty svg .e2 { stroke: var(--mark-p2); }
.empty svg .e3 { stroke: var(--mark-p3); }
.empty b { color: var(--ink); font-weight: 650; display: block; margin-bottom: 2px; }

/* ---------- squelettes ---------- */
.skel { border: 1px solid var(--line-soft); background: var(--card); padding: 10px 12px; border-radius: var(--r); }
.skel i { display: block; height: 10px; background: var(--surface); margin: 7px 0; border-radius: var(--r-sm); }
.skel i:nth-child(2n) { width: 72%; }

@media (max-width: 760px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { min-width: 110px; }
  th:nth-child(2), td:nth-child(2) { min-width: 240px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

.auth .switch a { text-decoration: underline; text-underline-offset: 4px; }
.auth .switch a:hover { color: var(--blue); }

/* ---------- mouvement ---------- */
@media (prefers-reduced-motion: no-preference) {
  .content > * { animation: arrive var(--t-slow) var(--ease) backwards; }
  .content > *:nth-child(2) { animation-delay: 30ms; }
  .content > *:nth-child(3) { animation-delay: 60ms; }
  .content > *:nth-child(n+4) { animation-delay: 90ms; }
  @keyframes arrive { from { opacity: 0; transform: translateY(5px); } }

  .toast { animation: toast-in var(--t-med) var(--ease); }
  @keyframes toast-in { from { opacity: 0; transform: translateX(14px); } }

  .confirm-body, .cmdk-body { animation: pop 150ms var(--ease); }
  @keyframes pop { from { opacity: 0; transform: scale(.98) translateY(-4px); } }

  .timeline li { animation: arrive var(--t-med) var(--ease) backwards; }
  .timeline li:nth-child(1) { animation-delay: 0ms; }
  .timeline li:nth-child(2) { animation-delay: 35ms; }
  .timeline li:nth-child(3) { animation-delay: 70ms; }
  .timeline li:nth-child(n+4) { animation-delay: 100ms; }

  ::view-transition-old(root) { animation: vt-out var(--t-fast) ease-in both; }
  ::view-transition-new(root) { animation: vt-in var(--t-med) var(--ease) both; }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(4px); } }

  .brandplay .p { animation: align 700ms var(--ease) backwards; }
  .brandplay .p2 { animation-delay: 110ms; }
  .brandplay .p3 { animation-delay: 220ms; }
  .brandplay .sq { animation: settle 500ms var(--ease) 380ms backwards; }
  @keyframes align { from { opacity: 0; transform: translate(-7px, 5px) rotate(-5deg); } }
  @keyframes settle { from { opacity: 0; transform: scale(.7); } }

  .skel i { animation: shimmer 1.1s ease-in-out infinite; }
  @keyframes shimmer { 50% { opacity: .45; } }
}
@media (prefers-reduced-motion: reduce) {
  .steps li.current .dot { animation: none; }
  .pill.tick { animation: none; }
  * { transition-duration: 1ms !important; }
}

/* ---------- mobile : lignes empilées, topbar allégée ---------- */
@media (max-width: 760px) {
  .afaire a { flex-direction: column; align-items: flex-start; gap: 3px; }
  .afaire a span:first-child { white-space: normal; }
  .row { flex-wrap: wrap; row-gap: 3px; padding: 8px 12px; }
  .row .row-main { flex: 1 1 100%; white-space: normal; }
  .row .row-meta { margin-left: 18px; }
  .kbd-hint kbd { display: none; }
  details.menu summary .muted { display: none; }
  .org-seg { max-width: 120px; }
  .tile .n { font-size: 19px; }
}
