/* ==========================================================================
   IBM Bob — formation interactive en trois niveaux
   Feuille de style unique. Thème clair / sombre par variables CSS.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1f0ea;
  --surface-3: #e9e7df;
  --ink: #15171c;
  --ink-2: #454a56;
  --muted: #747a88;
  --line: #e3e1d9;
  --line-2: #cdcac0;
  --accent: #0f62fe;
  --accent-ink: #0043ce;
  --accent-soft: #e5efff;
  --accent-2: #8a3ffc;

  /* Couleurs des modes CSA2 (feux de routage : agir, confirmer, escalader) */
  --green-f: #dcf3d3;  --green-b: #5fae4c;  --green-t: #25631a;
  --yellow-f: #fff1bd; --yellow-b: #d4b035; --yellow-t: #6d5606;
  --red-f: #fbdcd1;    --red-b: #dc7555;    --red-t: #8a3218;
  --blue-f: #d4eefa;   --blue-b: #3fa6d2;   --blue-t: #0f5a7a;
  --swa-f: #fde3d9;    --swa-b: #e79a80;
  --gray-f: #efeee9;   --gray-b: #bdbab0;

  /* Graphiques */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-muted: #b9b7ae;
  --grid: #e6e4dc;
  --axis: #c3c2b7;

  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 6px 24px rgba(20, 20, 30, .06);
  --radius: 14px;
  --radius-sm: 9px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --col: 740px;
  --wide: 1060px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1c2029;
    --surface-3: #252a35;
    --ink: #eef0f5;
    --ink-2: #bac0cc;
    --muted: #8b92a1;
    --line: #2a2f3a;
    --line-2: #3b414e;
    --accent: #78a9ff;
    --accent-ink: #a6c8ff;
    --accent-soft: #1b2a4a;
    --accent-2: #be95ff;
    --green-f: #1d3a22;  --green-b: #5fae4c;  --green-t: #a6e39a;
    --yellow-f: #3a3218; --yellow-b: #cfae3a; --yellow-t: #f1d97c;
    --red-f: #42251d;    --red-b: #d9785a;    --red-t: #f5b29c;
    --blue-f: #15333f;   --blue-b: #4fb0d8;   --blue-t: #9fdcf5;
    --swa-f: #3d2a24;    --swa-b: #d9876d;
    --gray-f: #242833;   --gray-b: #4a5060;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-muted: #5a5f6b;
    --grid: #262a33;
    --axis: #3a3f4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015;
  --surface: #161920;
  --surface-2: #1c2029;
  --surface-3: #252a35;
  --ink: #eef0f5;
  --ink-2: #bac0cc;
  --muted: #8b92a1;
  --line: #2a2f3a;
  --line-2: #3b414e;
  --accent: #78a9ff;
  --accent-ink: #a6c8ff;
  --accent-soft: #1b2a4a;
  --accent-2: #be95ff;
  --green-f: #1d3a22;  --green-b: #5fae4c;  --green-t: #a6e39a;
  --yellow-f: #3a3218; --yellow-b: #cfae3a; --yellow-t: #f1d97c;
  --red-f: #42251d;    --red-b: #d9785a;    --red-t: #f5b29c;
  --blue-f: #15333f;   --blue-b: #4fb0d8;   --blue-t: #9fdcf5;
  --swa-f: #3d2a24;    --swa-b: #d9876d;
  --gray-f: #242833;   --gray-b: #4a5060;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-muted: #5a5f6b;
  --grid: #262a33;
  --axis: #3a3f4a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.68;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0; }
p { margin: 0 0 1em; }
strong { font-weight: 650; }
code, .mono { font-family: var(--font-mono); font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: .05em .35em; border-radius: 5px; }
sub, sup { line-height: 0; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- Barre de progression + en-tête ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; background: transparent; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--font-serif); font-weight: 600; font-size: 16px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.topbar .brand b { color: var(--accent); font-weight: 700; }
.topbar .current { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-width: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  cursor: pointer; font-size: 14px; color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.toc-toggle { display: none; }

/* ---------- Mise en page ---------- */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; max-width: 1400px; margin: 0 auto; }
.toc {
  position: sticky; top: 56px; align-self: start;
  height: calc(100vh - 56px); overflow-y: auto;
  padding: 26px 14px 40px 22px;
  font-size: 14px; line-height: 1.4;
  scrollbar-width: thin;
}
.toc h2 { font-family: var(--font-sans); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px 8px; font-weight: 600; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 1px 0; }
.toc a {
  display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none;
}
.toc a .n { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 18px; }
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.toc a.active .n { color: var(--accent-ink); }

main { min-width: 0; padding: 0 28px 120px; }

/* Colonnes de lecture */
.col { max-width: var(--col); margin-left: auto; margin-right: auto; }
.wide { max-width: var(--wide); margin-left: auto; margin-right: auto; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 44px; align-items: center; max-width: var(--wide); margin: 0 auto; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 20px; }
.hero h1 { font-size: clamp(38px, 5.4vw, 64px); line-height: 1.04; letter-spacing: -.025em; margin-bottom: 18px; }
.hero h1 .v { color: var(--accent); }
.hero .lede { font-size: 20px; line-height: 1.55; color: var(--ink-2); margin-bottom: 26px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px 22px 16px; box-shadow: var(--shadow); }
.hero-card h3 { font-family: var(--font-sans); font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.hero-card .big { font-size: 15px; color: var(--ink-2); margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: var(--wide); margin: 40px auto 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; }
.stat .val { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .val small { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-left: 3px; }
.stat .lbl { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.4; }
.stat.accent .val { color: var(--accent); }

/* ---------- Chapitres ---------- */
.chapter { padding-top: 84px; }
.chapter-head { max-width: var(--col); margin: 0 auto 26px; }
.chapter-num { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.chapter-num::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chapter h2 { font-size: clamp(30px, 3.6vw, 42px); margin-bottom: 14px; }
.chapter .intro { font-size: 19px; color: var(--ink-2); line-height: 1.6; }
.chapter h3 { font-size: 25px; margin: 46px auto 14px; max-width: var(--col); }
.chapter h4 { font-family: var(--font-sans); font-size: 17px; font-weight: 700; margin: 26px auto 8px; max-width: var(--col); }
.prose { max-width: var(--col); margin: 0 auto; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--muted); }

.goals { max-width: var(--col); margin: 0 auto 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px 6px; }
.goals .t { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.goals ul { margin: 0 0 10px; padding-left: 1.2em; }
.goals li { margin: .2em 0; }

/* ---------- Encadrés ---------- */
.callout { max-width: var(--col); margin: 22px auto; border-radius: var(--radius); padding: 16px 20px 4px 56px; position: relative; border: 1px solid var(--line); background: var(--surface); }
.callout::before { position: absolute; left: 18px; top: 15px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.callout .ct { font-weight: 700; font-size: 14px; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 4px; }
.callout.intuition { background: var(--yellow-f); border-color: color-mix(in srgb, var(--yellow-b) 45%, transparent); }
.callout.intuition::before { content: "💡"; font-size: 17px; }
.callout.intuition .ct { color: var(--yellow-t); }
.callout.key { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.callout.key::before { content: "✓"; background: var(--accent); color: #fff; }
.callout.key .ct { color: var(--accent-ink); }
.callout.paper { background: var(--surface); border-left: 4px solid var(--ink-2); }
.callout.paper::before { content: "¶"; background: var(--surface-3); color: var(--ink-2); }
.callout.paper .ct { color: var(--ink-2); }
.callout.warn { background: var(--red-f); border-color: color-mix(in srgb, var(--red-b) 40%, transparent); }
.callout.warn::before { content: "!"; background: var(--red-b); color: #fff; }
.callout.warn .ct { color: var(--red-t); }
.callout.method { background: var(--surface-2); }
.callout.method::before { content: "≈"; background: var(--surface-3); color: var(--ink-2); }
.callout.method .ct { color: var(--ink-2); }

/* ---------- Formules ---------- */
.formula {
  max-width: var(--col); margin: 18px auto 22px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-serif); font-size: 21px; text-align: center; line-height: 1.6; overflow-x: auto;
}
.formula .eq { white-space: nowrap; }
.formula .tag { font-family: var(--font-sans); font-size: 13px; color: var(--muted); margin-left: 14px; }
.formula .legend { display: block; font-family: var(--font-sans); font-size: 14px; color: var(--ink-2); margin-top: 10px; line-height: 1.5; text-align: left; white-space: normal; }
.formula i { font-style: italic; }

/* ---------- Figures du papier ---------- */
.paper-fig { max-width: var(--wide); margin: 30px auto; }
.paper-fig.narrow { max-width: 820px; }
.paper-fig .frame {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: zoom-in; position: relative; box-shadow: var(--shadow);
}
.paper-fig .frame img { margin: 0 auto; }
.paper-fig .badge { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: #15171c; color: #fff; padding: 3px 8px; border-radius: 999px; opacity: .8; }
.paper-fig figcaption { max-width: var(--col); margin: 12px auto 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.paper-fig figcaption b { color: var(--ink); }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 14, .88); display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 88vh; background: #fff; border-radius: 10px; padding: 12px; }
.lightbox .cap { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: #dfe3ec; font-size: 14px; max-width: 90vw; text-align: center; }

/* ---------- Widgets ---------- */
.widget {
  max-width: var(--wide); margin: 30px auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden;
}
.widget-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.widget-head .tag { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #fff; background: var(--accent); padding: 4px 9px; border-radius: 999px; margin-top: 3px; }
.widget-head .tag.illus { background: var(--ink-2); }
.widget-head h4 { font-family: var(--font-sans); font-size: 17px; font-weight: 700; margin: 0; max-width: none; }
.widget-head p { margin: 2px 0 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.widget-body { padding: 18px 20px 20px; }
.widget-foot { padding: 10px 20px 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); line-height: 1.5; }

.controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin-bottom: 16px; }
.control { display: flex; flex-direction: column; gap: 4px; min-width: 170px; flex: 1; }
.control label, .control .lab { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; gap: 10px; }
.control label output, .control .lab output { font-family: var(--font-mono); font-weight: 600; color: var(--accent-ink); font-size: 13px; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 22px; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.btn-sm { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.btn-sm:hover { border-color: var(--ink-2); }
.btn-sm.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-sm:disabled { opacity: .45; cursor: default; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.readout .r { background: var(--surface-2); border-radius: 11px; padding: 10px 12px; }
.readout .r .k { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.readout .r .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.readout .r .v.long { font-size: 17px; line-height: 1.3; margin-top: 3px; }
.readout .r.hl { background: var(--accent-soft); }
.readout .r.hl .v { color: var(--accent-ink); }
.explain { margin-top: 14px; font-size: 15px; color: var(--ink-2); background: var(--surface-2); border-radius: 11px; padding: 12px 14px; line-height: 1.55; min-height: 3em; }
.explain b { color: var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 13px; height: 13px; border-radius: 4px; display: inline-block; border: 1.5px solid transparent; }

.sw-green { background: var(--green-f); border-color: var(--green-b) !important; }
.sw-yellow { background: var(--yellow-f); border-color: var(--yellow-b) !important; }
.sw-red { background: var(--red-f); border-color: var(--red-b) !important; }
.sw-blue { background: var(--blue-f); border-color: var(--blue-b) !important; }
.sw-swa { background: var(--swa-f); border-color: var(--swa-b) !important; }
.sw-gray { background: var(--gray-f); border-color: var(--gray-b) !important; }
.sw-accent { background: var(--accent); border-color: var(--accent) !important; }

svg text { font-family: var(--font-sans); }
.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz .grid line { stroke: var(--grid); stroke-width: 1; }
.viz .axis line, .viz .axis path { stroke: var(--axis); }
.viz .tick { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.viz .axis-title { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.viz .lbl { fill: var(--ink-2); font-size: 12px; }
.viz .lbl-strong { fill: var(--ink); font-size: 12.5px; font-weight: 700; }

.tooltip {
  position: fixed; z-index: 80; pointer-events: none; opacity: 0; transition: opacity .12s;
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.45; padding: 8px 11px; border-radius: 9px;
  max-width: 280px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.tooltip.show { opacity: 1; }
.tooltip b { font-weight: 700; }

/* ---------- Tableau ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-size: 12.5px; color: var(--ink-2); font-weight: 700; border-bottom: 1.5px solid var(--line-2); vertical-align: bottom; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data.compact th, table.data.compact td { padding: 6px 5px; font-size: 12px; }
table.data.compact td:first-child { white-space: normal; min-width: 90px; }
table.data td.best { font-weight: 800; color: var(--accent-ink); }
table.data td.second { text-decoration: underline; text-underline-offset: 3px; }
table.data td.cat { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
table.data .col-hl { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
table.simple { border-collapse: collapse; width: 100%; font-size: 15px; }
table.simple th, table.simple td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.simple th { font-size: 13px; color: var(--ink-2); font-weight: 700; }

/* ---------- Grilles de cartes ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; max-width: var(--wide); margin: 24px auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; }
.card h5 { font-size: 16px; font-weight: 700; margin: 0 0 6px; font-family: var(--font-sans); }
.card p { font-size: 15px; color: var(--ink-2); margin-bottom: .6em; line-height: 1.55; }
.card .num { font-size: 26px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.card .eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }

.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: var(--wide); margin: 26px auto; }
.pillar { border-radius: var(--radius); padding: 18px; background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.pillar .eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pillar h5 { font-family: var(--font-serif); font-size: 21px; margin: 6px 0 8px; font-weight: 600; }
.pillar p { font-size: 15px; color: var(--ink-2); margin: 0 0 .5em; }
.pillar .gain { font-weight: 700; color: var(--ink); font-size: 15px; }
.pillar.p1 { border-top: 4px solid var(--series-1); } .pillar.p1 .eyebrow { color: var(--series-1); }
.pillar.p2 { border-top: 4px solid var(--series-3); } .pillar.p2 .eyebrow { color: var(--series-3); }
.pillar.p3 { border-top: 4px solid var(--series-2); } .pillar.p3 .eyebrow { color: var(--series-2); }

/* ---------- Glossaire (info-bulles) ---------- */
.term { border-bottom: 1.5px dotted var(--accent); cursor: help; }

/* ---------- Quiz ---------- */
.quiz { max-width: var(--col); margin: 30px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px 14px; }
.quiz .qh { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; }
.quiz .q { font-weight: 650; margin-bottom: 10px; font-size: 16.5px; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opt { text-align: left; padding: 10px 14px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 15px; line-height: 1.45; }
.quiz .opt:hover { border-color: var(--accent); }
.quiz .opt.right { background: var(--green-f); border-color: var(--green-b); }
.quiz .opt.wrong { background: var(--red-f); border-color: var(--red-b); }
.quiz .fb { font-size: 14.5px; color: var(--ink-2); margin-top: 10px; display: none; line-height: 1.55; }
.quiz .fb.show { display: block; }
.quiz + .quiz { margin-top: -10px; }

/* ---------- Timeline / étapes ---------- */
.steps { max-width: var(--col); margin: 20px auto; counter-reset: st; padding: 0; list-style: none; }
.steps li { position: relative; padding: 0 0 18px 48px; }
.steps li::before { counter-increment: st; content: counter(st); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.steps li::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 4px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li b { display: block; margin-bottom: 2px; }

/* ---------- Divers widgets ---------- */
.token-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tok { font-family: var(--font-mono); font-size: 13.5px; padding: 5px 9px; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--surface); transition: background .2s, border-color .2s, transform .2s; }
.tok.prompt { background: var(--surface-2); }
.tok.new { background: var(--accent-soft); border-color: var(--accent); }
.tok.active { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 25%, transparent); }
.tok.cached { background: var(--green-f); border-color: var(--green-b); }
.tok.dim { opacity: .45; }

.kv-strip { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 10px; min-height: 34px; }
.kv-cell { width: 26px; height: 30px; border-radius: 6px; background: var(--green-f); border: 1.5px solid var(--green-b); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--green-t); font-family: var(--font-mono); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.panel-title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }

.layer-map { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 4px; }
.layer { aspect-ratio: 1 / 1.35; border-radius: 6px; border: 1.5px solid var(--gray-b); background: var(--gray-f); cursor: pointer; position: relative; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--ink-2); font-family: var(--font-mono); transition: transform .15s; padding: 0; }
.layer:hover { transform: translateY(-2px); }
.layer.sel { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.layer.full { background: var(--green-f); border-color: var(--green-b); color: var(--green-t); }
.layer.reuse { background: var(--yellow-f); border-color: var(--yellow-b); color: var(--yellow-t); }
.layer.reindex { background: var(--blue-f); border-color: var(--blue-b); color: var(--blue-t); }
.layer.swa { background: var(--swa-f); border-color: var(--swa-b); color: var(--red-t); }
.layer .eg { position: absolute; top: -7px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-2); color: #fff; font-size: 8.5px; display: grid; place-items: center; font-family: var(--font-sans); }
.row-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 12px 0 6px; display: flex; justify-content: space-between; }
.row-label span:last-child { font-weight: 500; color: var(--muted); }

.mode-diagram { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.mode-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); background: var(--surface); }
.mode-card h6 { margin: 0 0 8px; font-size: 14px; font-weight: 800; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 7px; border: 1.5px solid; margin: 2px 3px 2px 0; }

.grid-canvas { width: 100%; overflow-x: auto; }

.bytes-bar { display: flex; height: 38px; border-radius: 9px; overflow: hidden; background: var(--surface-2); margin: 6px 0 4px; }
.bytes-bar > div { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; transition: width .35s; border-right: 2px solid var(--surface); }
.bytes-bar > div:last-child { border-right: 0; }

.fp4-levels { display: flex; gap: 4px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12px; }
.fp4-levels span { padding: 3px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }

.matrix { display: inline-grid; gap: 3px; }
.matrix div { width: 44px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-family: var(--font-mono); font-weight: 600; }

.recap-table td:first-child { font-weight: 700; white-space: nowrap; }

.foot { max-width: var(--col); margin: 90px auto 0; padding-top: 24px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

.anchor-link { opacity: 0; margin-left: 8px; font-size: .7em; text-decoration: none; color: var(--muted); }
h3:hover .anchor-link, h2:hover .anchor-link { opacity: 1; }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt0 { margin-top: 0 !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc {
    position: fixed; top: 56px; left: 0; bottom: 0; width: min(320px, 86vw); height: auto; z-index: 70;
    background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow);
    transform: translateX(-104%); transition: transform .25s ease;
  }
  .toc.open { transform: none; }
  .toc-toggle { display: inline-flex; }
}
@media (max-width: 860px) {
  .hero { padding-top: 36px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pillars { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .fig-pair { grid-template-columns: minmax(0, 1fr); }
  .layer-map { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding: 0 16px 90px; }
  .topbar { padding: 9px 14px; }
  .topbar .current { display: none; }
  .hero .lede { font-size: 17.5px; }
  .chapter { padding-top: 60px; }
  .chapter .intro { font-size: 17px; }
  .chapter h3 { font-size: 22px; }
  .widget-body { padding: 14px 14px 16px; }
  .widget-head { padding: 14px 14px 10px; flex-direction: column; gap: 6px; }
  .formula { font-size: 17px; padding: 14px; }
  .callout { padding: 14px 16px 4px 48px; }
  .callout::before { left: 14px; }
  .paper-fig .frame { padding: 10px; }
  .stat .val { font-size: 25px; }
  .control { min-width: 100%; }
  .matrix div { width: 36px; height: 28px; font-size: 10px; }
  .mode-diagram { gap: 6px; }
  .mode-card { padding: 9px; }
  .mode-card h6 { font-size: 13px; margin-bottom: 4px; }
  .mode-card div { font-size: 12.5px !important; }
}

@media print {
  .topbar, .toc, .progress { display: none; }
  .layout { display: block; }
  .widget { break-inside: avoid; }
}
.panel-title.math { text-transform: none; letter-spacing: 0; font-size: 13.5px; }

/* Mobile : contrôles pleine largeur, formules qui passent à la ligne */
@media (max-width: 560px) {
  .control { flex: 1 1 100% !important; }
  .seg { max-width: 100%; }
  .seg button { padding: 6px 10px; font-size: 13px; }
  .formula .eq { white-space: normal; }
  .formula .tag { display: block; margin: 2px 0 0; }
}
@media (max-width: 560px) {
  .topbar .icon-btn span { display: none; }
  .topbar .brand { font-size: 15px; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
}

/* ==========================================================================
   Ajouts propres au cours Jev / System One
   ========================================================================== */

/* Couleurs des trois primitives */
:root {
  --choice: #2a78d6; --choice-f: #dcecfb; --choice-t: #0f4c8a;
  --score: #1baf7a;  --score-f: #d8f4e9;  --score-t: #0d6b49;
  --noul: #d9772f;   --noul-f: #fde6d2;   --noul-t: #8a4410;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --choice: #4f97ea; --choice-f: #16304a; --choice-t: #a9d0fa;
    --score: #2ec48f;  --score-f: #123a2c;  --score-t: #9be7c9;
    --noul: #ec9147;   --noul-f: #46291a;   --noul-t: #f7c79b;
  }
}
:root[data-theme="dark"] {
  --choice: #4f97ea; --choice-f: #16304a; --choice-t: #a9d0fa;
  --score: #2ec48f;  --score-f: #123a2c;  --score-t: #9be7c9;
  --noul: #ec9147;   --noul-f: #46291a;   --noul-t: #f7c79b;
}
.tag-choice, .tag-score, .tag-noul { display: inline-block; font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1.5px solid; }
.tag-choice { color: var(--choice-t); background: var(--choice-f); border-color: var(--choice); }
.tag-score { color: var(--score-t); background: var(--score-f); border-color: var(--score); }
.tag-noul { color: var(--noul-t); background: var(--noul-f); border-color: var(--noul); }
.sw-choice { background: var(--choice-f); border-color: var(--choice) !important; }
.sw-score { background: var(--score-f); border-color: var(--score) !important; }
.sw-noul { background: var(--noul-f); border-color: var(--noul) !important; }

/* Blocs de code avec onglets et bouton Copier */
.code { max-width: var(--wide); margin: 18px auto 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.code.narrow { max-width: var(--col); }
.code .code-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.code .code-bar button.tab { border: 0; background: transparent; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.code .code-bar button.tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.code .code-bar .src { margin-left: auto; font-size: 12px; color: var(--muted); padding-right: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code .code-bar .copy { flex: none; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; font-size: 12px; font-weight: 600; padding: 4px 10px; cursor: pointer; margin-bottom: 5px; color: var(--ink-2); }
.code .code-bar .copy:hover { color: var(--ink); border-color: var(--ink-2); }
.code .code-bar .copy.done { background: var(--green-f); border-color: var(--green-b); color: var(--green-t); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 13.2px; line-height: 1.55; tab-size: 4; }
.code pre[hidden] { display: none; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.code .k { color: #a626a4; } .code .s { color: #50a14f; } .code .c { color: #8b92a1; font-style: italic; } .code .n { color: #986801; } .code .f { color: #4078f2; } .code .p { color: var(--ink-2); }
:root[data-theme="dark"] .code .k, .dark-k { color: #c678dd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .code .k { color: #c678dd; } :root:not([data-theme="light"]) .code .s { color: #98c379; } :root:not([data-theme="light"]) .code .n { color: #d19a66; } :root:not([data-theme="light"]) .code .f { color: #61afef; } }
:root[data-theme="dark"] .code .s { color: #98c379; } :root[data-theme="dark"] .code .n { color: #d19a66; } :root[data-theme="dark"] .code .f { color: #61afef; }

/* Barres de probabilités */
.probs { display: grid; gap: 7px; }
.prob { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 54px; gap: 10px; align-items: center; font-size: 14px; }
.prob .k { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob .bar { height: 18px; border-radius: 6px; background: var(--surface-2); overflow: hidden; position: relative; }
.prob .bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--accent); transition: width .35s; }
.prob.win .bar > i { background: var(--accent); }
.prob:not(.win) .bar > i { background: var(--series-muted); }
.prob .v { font-family: var(--font-mono); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.prob.win .k, .prob.win .v { color: var(--accent-ink); font-weight: 700; }
.prob.scoreish .bar > i { background: var(--score); }
.prob.noulish .bar > i { background: var(--noul); }

/* Jauge 0–1 */
.gauge { position: relative; height: 26px; border-radius: 8px; background: linear-gradient(90deg, var(--red-f), var(--yellow-f), var(--green-f)); border: 1px solid var(--line); margin: 6px 0 14px; }
.gauge .needle { position: absolute; top: -6px; bottom: -6px; width: 3px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); transition: left .3s; }
.gauge .zone { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--ink-2); opacity: .5; }
.gauge .zlab { position: absolute; top: 100%; font-size: 11px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; margin-top: 2px; }
.gauge .ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; padding: 0 4px; font-size: 10.5px; color: var(--ink-2); align-items: center; font-family: var(--font-mono); }

/* Résultat de routage */
.route { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface-2); font-weight: 600; margin-top: 12px; }
.route .ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; flex: none; }
.route.act { background: var(--green-f); border-color: var(--green-b); color: var(--green-t); }
.route.ask { background: var(--yellow-f); border-color: var(--yellow-b); color: var(--yellow-t); }
.route.human { background: var(--red-f); border-color: var(--red-b); color: var(--red-t); }
.route.neutral { background: var(--surface-2); }
.route small { display: block; font-weight: 500; font-size: 13px; opacity: .85; }

/* Schémas de flux (HTML) */
.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.flow .node { flex: 1 1 150px; min-width: 0; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px 12px; background: var(--surface); font-size: 13.5px; line-height: 1.4; position: relative; }
.flow .node b { display: block; font-size: 13px; }
.flow .node.model { border-color: var(--accent); background: var(--accent-soft); }
.flow .node.code { border-style: dashed; }
.flow .arrow { flex: none; align-self: center; color: var(--muted); font-size: 20px; }
.flow .node.dim { opacity: .4; }
.flow .node.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
@media (max-width: 560px) { .flow { flex-direction: column; } .flow .arrow { transform: rotate(90deg); align-self: center; } }

/* Liste de questions (fan-out) */
.qlist { display: grid; gap: 6px; }
.qitem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; transition: opacity .25s; }
.qitem.off { opacity: .38; }
.qitem .ans { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-ink); white-space: nowrap; }
.qitem.off .ans { text-decoration: line-through; color: var(--muted); }

/* Accordéon */
.acc { max-width: var(--wide); margin: 16px auto; display: grid; gap: 8px; }
.acc details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 16px; }
.acc summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 15.5px; list-style: none; display: flex; gap: 10px; align-items: center; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::before { content: "+"; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; flex: none; }
.acc details[open] summary::before { content: "–"; }
.acc details > div { padding: 0 0 14px 32px; font-size: 15px; color: var(--ink-2); line-height: 1.55; }
.acc details > div ul { margin: 0; padding-left: 1.2em; }
.acc details > div p { margin-bottom: .6em; }

/* Vue JSON annotée */
.json { font-family: var(--font-mono); font-size: 13px; line-height: 1.6; background: var(--surface-2); border-radius: 11px; padding: 12px 14px; overflow-x: auto; white-space: pre; }
.json .hl { background: var(--accent-soft); border-radius: 4px; padding: 0 2px; outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.json .fk { color: var(--choice-t); } .json .fs { color: var(--score-t); } .json .fn { color: var(--noul-t); }
.json .key { color: var(--ink); font-weight: 600; } .json .str { color: #50a14f; } .json .num { color: #986801; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .json .str { color: #98c379; } :root:not([data-theme="light"]) .json .num { color: #d19a66; } }
:root[data-theme="dark"] .json .str { color: #98c379; } :root[data-theme="dark"] .json .num { color: #d19a66; }
.json-parts { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 16px; }
@media (max-width: 860px) { .json-parts { grid-template-columns: minmax(0, 1fr); } }
.hotspots { display: grid; gap: 6px; }
.hotspot { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); cursor: pointer; font-size: 14px; }
.hotspot b { font-family: var(--font-mono); font-size: 13px; }
.hotspot[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* Cartes cookbooks filtrables */
.cb-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cb { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.cb h5 { margin: 0; font-size: 15.5px; font-family: var(--font-sans); }
.cb p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.cb .num { font-size: 18px; font-weight: 800; color: var(--accent); }
.cb .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.cb a { font-size: 13px; }
.cb[hidden] { display: none; }

/* Comparaison LLM / System One */
.vs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.vs .side { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface-2); }
.vs .side h6 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.vs .side.one { border-color: var(--accent); background: var(--accent-soft); }
.vs .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.5; margin-bottom: 8px; }
.vs .bubble.text { font-family: var(--font-serif); font-style: italic; }
.vs .bubble.mono { font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; }
.vs .note { font-size: 13px; color: var(--ink-2); }
@media (max-width: 860px) { .vs { grid-template-columns: minmax(0, 1fr); } }

/* Stepper (étapes cliquables) */
.stepper { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 16px; }
.stepper .list { display: grid; gap: 4px; align-content: start; }
.stepper .list button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; cursor: pointer; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.stepper .list button .n { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--ink-2); flex: none; }
.stepper .list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.stepper .list button[aria-pressed="true"] .n { background: var(--accent); color: #fff; }
.stepper .pane { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); font-size: 15px; line-height: 1.55; min-height: 180px; }
.stepper .pane h6 { margin: 0 0 8px; font-size: 16px; }
.stepper .pane p { margin-bottom: .6em; }
@media (max-width: 860px) { .stepper { grid-template-columns: minmax(0, 1fr); } }

/* Frise / minuteur des allers-retours */
.lanes { display: grid; gap: 12px; }
.lane { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; }
.lane .name { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.lane .track { position: relative; height: 34px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.lane .call { position: absolute; top: 5px; bottom: 5px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 11.5px; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; padding: 0 6px; }
.lane .call.wait { background: var(--series-muted); }

/* Textes sélectionnables (exemples d'états) */
.picker { display: grid; gap: 6px; margin-bottom: 12px; }
.picker button { text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 9px 12px; cursor: pointer; font-size: 14px; line-height: 1.45; font-family: var(--font-serif); }
.picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.picker button .meta { display: block; font-family: var(--font-sans); font-size: 12px; color: var(--muted); margin-top: 3px; }

.small { font-size: 13.5px; color: var(--ink-2); }
.tbl-scroll { overflow-x: auto; }
.fig-svg { max-width: var(--wide); margin: 24px auto; }
.fig-svg svg { width: 100%; height: auto; display: block; }
.fig-svg figcaption { max-width: var(--col); margin: 10px auto 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.paper-fig .frame.dark-ok { background: var(--surface); }
.paper-fig .frame img.dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .paper-fig .frame img.dark { display: block; } :root:not([data-theme="light"]) .paper-fig .frame img.light { display: none; } }
:root[data-theme="dark"] .paper-fig .frame img.dark { display: block; } :root[data-theme="dark"] .paper-fig .frame img.light { display: none; }

/* Formules : retour à la ligne autorisé (expressions longues) */
.formula .eq { white-space: normal; }
@media (max-width: 560px) {
  .code .code-bar { flex-wrap: wrap; }
  .code .code-bar .src { display: none; }
  .code .code-bar button.tab { white-space: nowrap; padding: 7px 9px; font-size: 12.5px; }
  .code .code-bar .copy { margin-left: auto; }
}


/* ==========================================================================
   Formation IBM Bob — compléments
   ========================================================================== */
.level-band { display:flex; align-items:center; gap:12px; margin: 56px 0 8px; padding: 16px 20px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-ink); }
.level-band .lv { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity:.85; }
.level-band h2 { margin:0; font-size: 1.35rem; }
.level-band .pub { margin-left:auto; font-size: 13px; color: var(--ink-2); max-width: 46%; }
.objective { border-left: 4px solid var(--accent); background: var(--surface); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 18px 0; }
.objective .t { font-weight: 700; font-size: 13px; letter-spacing:.04em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px; }
.demo { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 18px 0; background: var(--surface); }
.demo .t { display:flex; align-items:center; gap:10px; font-weight:700; margin-bottom:8px; }
.demo .t .vid { font-family: var(--font-mono); font-size: 12px; background: var(--red-f); color: var(--red-t); padding: 2px 8px; border-radius: 999px; }
.demo ol { margin: 6px 0 0; padding-left: 22px; }
.demo ol li { margin: 6px 0; }
.demo .ts { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-right: 6px; }
.tp { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 16px 20px; margin: 20px 0; background: var(--surface-2); }
.tp .t { font-weight: 700; display:flex; gap:10px; align-items:center; margin-bottom: 6px; }
.tp .t .pill { background: var(--green-f); color: var(--green-t); }
.tp ol { padding-left: 22px; } .tp li { margin: 6px 0; }
.checklist { list-style: none; padding: 0; margin: 12px 0 0; }
.checklist li { display:flex; gap:10px; align-items:flex-start; padding: 7px 10px; border-radius: var(--radius-sm); }
.checklist li:hover { background: var(--surface); }
.checklist input { margin-top: 4px; accent-color: var(--accent); }
.checklist li.done label { color: var(--muted); text-decoration: line-through; }
.checklist-foot { display:flex; justify-content:space-between; align-items:center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.checklist-foot button { font: inherit; font-size: 12px; background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.cite { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-ink); text-decoration: none; background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.cite:hover { text-decoration: underline; }
.ui-mock { border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); overflow: hidden; font-size: 13px; }
.ui-mock .bar { display:flex; align-items:center; gap: 8px; padding: 6px 10px; background: var(--surface-3); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.ui-mock .bar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.chat { display:flex; flex-direction:column; gap: 10px; padding: 12px; min-height: 120px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--accent-soft); color: var(--ink); border-bottom-right-radius: 3px; }
.msg.bob { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.tool { align-self: stretch; background: var(--surface); border: 1px dashed var(--line-2); font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.msg.approve { align-self: stretch; background: var(--yellow-f); color: var(--yellow-t); border: 1px solid var(--yellow-b); }
.msg .who { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .7; margin-bottom: 3px; }
.msg .btns { display:flex; gap: 8px; margin-top: 8px; }
.msg .btns span { padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
.chat-input { display:flex; gap:8px; align-items:center; border-top: 1px solid var(--line); padding: 8px 10px; background: var(--surface-2); }
.chat-input .field { flex:1; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; background: var(--surface); color: var(--muted); font-size: 12.5px; }
.chat-input .mode { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: var(--surface-3); }
.sim-steps { display:flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.sim-steps button { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.sim-steps button[aria-current="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.sim-steps button.done { border-color: var(--accent); color: var(--accent-ink); }
.sim-note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px; }
.modes-grid { display:grid; grid-template-columns: 200px 1fr; gap: 14px; }
.modes-grid .list { display:flex; flex-direction:column; gap:6px; }
.modes-grid .list button { font: inherit; text-align:left; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); cursor:pointer; color: var(--ink); }
.modes-grid .list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tools-row { display:flex; flex-wrap:wrap; gap:6px; margin: 8px 0; }
.tools-row span { font-family: var(--font-mono); font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--green-f); color: var(--green-t); }
.tools-row span.off { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.tree { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; list-style: none; padding-left: 0; margin: 0; }
.tree ul { list-style: none; padding-left: 18px; margin: 0; border-left: 1px dashed var(--line-2); }
.tree li > button { font: inherit; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 1px 6px; border-radius: 5px; text-align: left; }
.tree li > button:hover, .tree li > button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.tree .dir { color: var(--accent-ink); font-weight: 600; }
.tree-grid { display:grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; }
.tree-detail { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.tree-detail pre { margin: 8px 0 0; font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--surface); padding: 10px; border-radius: 8px; border: 1px solid var(--line); }
.form-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 10px 0; }
.form-grid label { display:flex; flex-direction:column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.form-grid input, .form-grid select, .form-grid textarea { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); }
.out-json { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 10px 0 0; }
.calc-out { display:grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.calc-out .box { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.calc-out .box .v { font-size: 1.4rem; font-weight: 700; color: var(--accent-ink); }
.calc-out .box .l { font-size: 12px; color: var(--muted); }
.vd-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.vd-grid .col-v, .vd-grid .col-d { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.vd-grid .col-v { background: var(--red-f); color: var(--red-t); } .vd-grid .col-d { background: var(--blue-f); color: var(--blue-t); }
.vd-grid .h { font-weight: 700; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 6px; }
.vd-diff { margin-top: 10px; background: var(--yellow-f); color: var(--yellow-t); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.test .tq { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 10px 0; background: var(--surface); }
.test .tq .q { font-weight: 600; margin-bottom: 8px; }
.test .tq label { display:flex; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; align-items: flex-start; }
.test .tq label:hover { background: var(--surface-2); }
.test .tq.right { border-color: var(--green-b); } .test .tq.wrong { border-color: var(--red-b); }
.test .tq .ex { display:none; margin-top: 8px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); padding: 8px 10px; border-radius: 6px; }
.test .tq.right .ex, .test .tq.wrong .ex { display:block; }
.test .score { font-size: 1.1rem; font-weight: 700; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink); }
.gloss { display:grid; grid-template-columns: 1fr; gap: 6px; }
.gloss .row { display:grid; grid-template-columns: 160px 170px 1fr; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.gloss .row .en { font-weight: 700; } .gloss .row .fr { color: var(--accent-ink); }
.memo table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.memo th, .memo td { text-align:left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.memo th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.memo code { font-size: 12.5px; }
.refs-filters { display:flex; flex-wrap:wrap; gap: 8px; margin: 10px 0 14px; }
.ref-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0; background: var(--surface); scroll-margin-top: 80px; }
.ref-card .id { font-family: var(--font-mono); font-size: 12px; color: var(--accent-ink); }
.ref-card .ti { font-weight: 700; }
.ref-card .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ref-card .use { font-size: 13px; margin-top: 6px; }
.ref-card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline-v { list-style:none; padding:0; margin: 10px 0; border-left: 2px solid var(--line-2); }
.timeline-v li { position: relative; padding: 4px 0 10px 18px; font-size: 13.5px; }
.timeline-v li::before { content:""; position:absolute; left:-7px; top: 10px; width: 12px; height: 12px; border-radius:50%; background: var(--accent); }
.timeline-v .d { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .level-band { flex-wrap: wrap; } .level-band .pub { max-width: 100%; margin-left: 0; }
  .modes-grid, .tree-grid, .vd-grid { grid-template-columns: 1fr; }
  .gloss .row { grid-template-columns: 1fr; gap: 2px; }
}
