/* Layout: shared top bar (part switcher) · left sidebar of numbered steps · one section at a time.
   Same shell for Plan, Process, Interpret and Deliver; only the part colour changes. */
:root {
  --paper: #fafaf9;
  --surface: #ffffff;
  --ink: #1a1a1f;
  --text: #3a3a40;
  --muted: #6b6b70;
  --rule: #e5e5e3;
  --rule-soft: #f0f0ee;
  --field: #c9c9c4;
  --part: #4A7537;          /* Interpret */
  --process: #2F6399;
  --interpret: #4A7537;
  --deliver: #95620F;
  --ok-bg: #EAF1E6; --ok-fg: #3B6A2A;
  --check-bg: #F7EBD9; --check-fg: #8A5A0B;
  --todo-bg: #EFEFEC; --todo-fg: #55555b;
  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--process); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--process); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-top: 3px solid var(--part); border-bottom: 1px solid var(--rule);
  padding: 10px max(16px, 2vw); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand a { font-family: var(--font-display); font-size: 20px; color: var(--ink); }
.brand a:hover { text-decoration: none; }
.brand span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.parts { display: flex; flex-wrap: wrap; gap: 6px; }
.part { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 12px; border: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.part i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.part[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.part[aria-disabled="true"] { color: var(--muted); }
.part small { font-size: 9.5px; letter-spacing: 0.08em; color: var(--muted); text-transform: none; }
.file-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; border: 1px solid var(--field);
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.field input, .field select, .field textarea { min-height: 38px; padding: 6px 10px; border: 1px solid var(--field); background: var(--surface); font-weight: 400; }
.field textarea { min-height: 90px; resize: vertical; font-family: var(--font-mono); font-size: 12.5px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.tickline { display: flex; align-items: center; gap: 10px; font-size: 13.5px; min-height: 32px; }
.tickline input { width: 18px; height: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 12px; }

/* ---------- banner ---------- */
.banner { padding: 8px max(16px, 2vw); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.banner.warn { background: var(--check-bg); color: var(--check-fg); }
.banner.error { background: #FBE9E7; color: #9A2B1E; }
.banner .spacer { flex: 1 1 auto; }

/* ---------- layout ---------- */
.layout { display: flex; flex-wrap: wrap; min-height: calc(100vh - 110px); }
.sidebar { flex: 1 1 240px; max-width: 272px; background: var(--surface); border-right: 1px solid var(--rule); padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; }
.sidebar .eyebrow { margin: 0 0 8px 10px; font-size: 10.5px; }
.sidebar .eyebrow.lib { margin-top: 18px; }
.nav { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 7px 10px; border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--text); text-align: left; }
.nav:hover { background: var(--rule-soft); }
.nav[aria-current="page"] { background: var(--rule-soft); color: var(--ink); font-weight: 600; }
.nav .num { width: 22px; height: 22px; flex: 0 0 22px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--field); color: var(--muted); }
.nav[aria-current="page"] .num { background: var(--ink); color: #fff; border-color: var(--ink); }
.nav .label { flex: 1 1 auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.dot.ready { background: var(--ok-fg); }
.dot.check { background: #B07A1E; }
.dot.todo { background: var(--field); }
.next-part { margin-top: auto; border: 1px solid var(--rule); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.next-part .eyebrow { margin: 0; color: var(--process); }
.next-part p { font-size: 13px; }
main { flex: 999 1 560px; min-width: 0; padding: clamp(18px, 3vw, 32px); display: flex; flex-direction: column; gap: 22px; max-width: 1200px; }

/* ---------- section header ---------- */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 24px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.head > div { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 3vw, 38px); line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance; }
.head p.what { color: var(--muted); font-size: 15px; }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; white-space: nowrap; }
.chip.ready { background: var(--ok-bg); color: var(--ok-fg); }
.chip.check { background: var(--check-bg); color: var(--check-fg); }
.chip.todo { background: var(--todo-bg); color: var(--todo-fg); }

/* ---------- cards ---------- */
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.card { background: var(--surface); border: 1px solid var(--rule); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 600; }
.card.wide { flex: 999 1 460px; }
.card.side { flex: 1 1 300px; max-width: 420px; }
.card.flush { padding: 0; gap: 0; }
.card.flush > h2 { padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.stats > div { background: var(--surface); padding: 16px; }
.stats b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1; }
.stats span { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.steps button { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border: none; border-top: 1px solid var(--rule-soft); background: var(--surface); text-align: left; cursor: pointer; min-height: 56px; }
.steps button:hover { background: var(--paper); }
.steps b { display: block; font-weight: 600; }
.steps small { display: block; font-size: 13px; color: var(--muted); }
ul.plain, ol.plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.issues li { color: var(--check-fg); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th { text-align: left; background: #f6f6f4; font-weight: 500; color: var(--muted); padding: 9px 12px; white-space: nowrap; }
td { padding: 6px 12px; border-top: 1px solid var(--rule-soft); vertical-align: middle; }
td.num, th.num { text-align: right; }
table.code { font-family: var(--font-mono); font-size: 12px; }
td input { width: 100%; min-width: 80px; min-height: 32px; padding: 4px 8px; border: 1px solid transparent; background: transparent; }
td input:hover { border-color: var(--rule); }
td input:focus { border-color: var(--field); background: var(--surface); }
td input.bad { border-color: #C9776B; background: #FDF3F1; }
.icon-btn { min-width: 32px; min-height: 32px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
.icon-btn:hover { border-color: var(--rule); color: var(--ink); }

/* ---------- spike gauge ---------- */
.gauge { position: relative; height: 48px; }
.gauge .track { position: absolute; left: 0; right: 0; top: 18px; height: 10px; background: var(--rule-soft); }
.gauge .range { position: absolute; top: 18px; height: 10px; }
.gauge .loq { position: absolute; top: 8px; height: 30px; width: 2px; background: var(--ink); }
.gauge .loq-label { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; }
.gauge .tick { position: absolute; top: 34px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
dl.kv { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; text-align: right; font-family: var(--font-mono); }
.verdict { padding: 10px 12px; font-size: 13.5px; font-weight: 500; }
.verdict.ready { background: var(--ok-bg); color: var(--ok-fg); }
.verdict.check { background: var(--check-bg); color: var(--check-fg); }

/* ---------- injection order ---------- */
.cells { display: flex; flex-wrap: wrap; gap: 3px; }
.cell { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 34px; border: 1px solid; font-family: var(--font-mono); font-size: 10px; font-weight: 500; }
.k-SB { background: #ECECE9; color: var(--ink); border-color: var(--field); }
.k-C { background: var(--process); color: #fff; border-color: var(--process); }
.k-CQ { background: #C9D6E8; color: var(--ink); border-color: #C9D6E8; }
.k-EB { background: var(--muted); color: #fff; border-color: var(--muted); }
.k-N { background: var(--deliver); color: #fff; border-color: var(--deliver); }
.k-QC { background: var(--ink); color: #fff; border-color: var(--ink); }
.k-S { background: #fff; color: var(--ink); border-color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; display: inline-block; border: 1px solid; }

/* ---------- keep row: every section ends with something to take away ---------- */
.keep { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 18px; border: 1px dashed var(--field); background: var(--surface); }
.keep .eyebrow { color: var(--ink); }
.keep p { font-size: 13px; color: var(--muted); flex: 1 1 260px; }

.docs a { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 13px 18px; border-top: 1px solid var(--rule-soft); color: var(--ink); }
.docs a:first-child { border-top: none; }
.docs a:hover { background: var(--paper); text-decoration: none; }

/* ---------- the example study's teaching notes ---------- */
.chip.example { background: #E7EEF6; color: #24507F; }
.example-note { border: 1px solid #C9D6E8; background: #F4F7FB; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.example-note .eyebrow { color: #24507F; }
.example-note p:not(.eyebrow) { font-size: 14px; max-width: 80ch; }
.welcome { border: 1px dashed var(--field); background: var(--surface); padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.welcome p { flex: 1 1 320px; }

#print-area { display: none; }
@media (max-width: 760px) {
  .sidebar { max-width: none; border-right: none; border-bottom: 1px solid var(--rule); }
  .next-part { display: none; }
  .file-actions { margin-left: 0; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .docs a { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; font-family: var(--font-body); color: #000; }
  #print-area h1 { font-family: var(--font-display); font-size: 20pt; font-weight: 400; margin-bottom: 4pt; }
  #print-area p { font-size: 10pt; margin-bottom: 10pt; }
  #print-area table { font-size: 10pt; }
  #print-area th, #print-area td { border: 1px solid #999; padding: 8pt 6pt; background: none; color: #000; }
}

/* ---------- Process additions ---------- */
.chip.example { background: #E7EEF6; color: #24507F; }
.example-note { border: 1px solid #C9D6E8; background: #F4F7FB; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.example-note .eyebrow { color: #24507F; }
.example-note p:not(.eyebrow) { font-size: 14px; max-width: 80ch; }
.welcome { border: 1px dashed var(--field); background: var(--surface); padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.welcome p { flex: 1 1 320px; }
.sidebar .eyebrow.group { margin-top: 14px; }
pre.code { margin: 0; padding: 12px 14px; background: #f6f6f4; border: 1px solid var(--rule); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; overflow-x: auto; white-space: pre; }
.radios { display: flex; flex-direction: column; gap: 6px; }
.radios label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 10px 12px; border: 1px solid var(--rule); cursor: pointer; }
.radios label:has(input:checked) { border-color: var(--part); background: #F4F7FB; }
.radios input { margin-top: 3px; width: 16px; height: 16px; }
.radios small { display: block; color: var(--muted); font-size: 12.5px; }
.gradebar { display: flex; height: 26px; border: 1px solid var(--rule); overflow: hidden; }
.gradebar span { display: block; height: 100%; }
.g-quantify { background: #2F6399; } .g-compare { background: #7FA3CC; } .g-identify { background: #D7DFEA; }
.g-background { background: #B07A1E; } .g-not_in_samples { background: #E5E5E3; } .g-not_graded { background: #fff; }
.glegend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; font-size: 13px; }
.glegend div { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.glegend i { width: 12px; height: 12px; display: inline-block; border: 1px solid var(--rule); }
.glegend b { font-weight: 600; }
.status-pass { color: var(--ok-fg); } .status-warn, .status-fail { color: var(--check-fg); } .status-not_run { color: var(--muted); }
.drop { border: 1px dashed var(--field); padding: 18px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; background: var(--surface); }
.drop.over { border-color: var(--part); background: #F4F7FB; }
.btn.primary { background: var(--part); border-color: var(--part); }
.btn.primary:hover { background: #24507F; }
.nav[aria-current="page"] .num { background: var(--part); border-color: var(--part); }
.part[aria-current="page"] { background: var(--part); border-color: var(--part); }
