:root {
  --ink: #172028;
  --muted: #5c6b76;
  --line: #d5dee4;
  --paper: #e7eef2;
  --sheet: #fbfcfd;
  --night: #102830;
  --positive: #0f6e62;
  --negative: #8e3a34;
  --pool: #8d6b2f;
  --focus: #0f6e62;
  --serif: "Newsreader", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Avenir Next", "Segoe UI", sans-serif;
  --measure: 68ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--sans);
}
a { color: #0c5c54; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  padding: 0.6rem 0.8rem;
}
.skip:focus { left: 0.6rem; top: 0.6rem; z-index: 9; }

.mast {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  padding: 1.1rem 1.4rem 0.9rem;
  background: var(--night);
  color: #e7eef0;
}
.mast a { color: inherit; text-decoration: none; }
.wordmark {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wordmark small {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0;
  color: #b7c6cc;
}
.draft-flag {
  border: 1px solid #3e5c66;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  color: #d5e2e6;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
}
.rail {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow: auto;
  padding: 1.2rem 1rem 2rem 1.3rem;
  border-right: 1px solid var(--line);
}
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail a {
  display: block;
  padding: 0.38rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}
.rail a[aria-current="true"] { color: var(--positive); font-weight: 600; }
.rail .back { margin-top: 1.4rem; font-size: 0.85rem; color: var(--muted); }

main { min-width: 0; padding: 1.4rem 1.6rem 4rem; max-width: 1100px; }

.decision h1 {
  font-family: var(--serif);
  font-weight: 460;
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 18ch;
  margin: 0 0 0.8rem;
}
.lede { max-width: var(--measure); color: var(--muted); margin: 0 0 1rem; }
.status-line { font-size: 0.92rem; max-width: var(--measure); }

.instrument {
  margin: 1.6rem 0 2.2rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 1rem 1rem 1.15rem;
}
.instrument-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 0.8rem;
}
.instrument h2 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.7rem;
  margin: 0;
  letter-spacing: -0.02em;
}
.controls { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: end; }
.controls label { display: grid; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.controls select, .seg button {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b7c4cc;
}
.controls select { padding: 0.45rem 0.55rem; min-width: 16rem; }
.seg { display: inline-flex; }
.seg button { padding: 0.45rem 0.8rem; cursor: pointer; }
.seg button + button { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--night); color: #fff; border-color: var(--night); }

.chart { width: 100%; min-width: 0; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: #e1e8ec; stroke-width: 1; }
.chart .zero { stroke: #31434d; stroke-width: 1.4; }
.chart .bar-pos { fill: var(--positive); }
.chart .bar-neg { fill: var(--negative); }
.chart .bar { cursor: pointer; }
.chart .bar[aria-current="true"] { stroke: var(--ink); stroke-width: 1.5; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .pool-line { fill: none; stroke: var(--night); stroke-width: 2.2; }
.chart .pool-ref { stroke: var(--pool); stroke-width: 1.4; stroke-dasharray: 4 4; }
.chart .dot { fill: var(--night); }

.legend { display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; margin: 0.7rem 0 0; font-size: 0.85rem; color: var(--muted); }
.legend i { display: inline-block; width: 0.9rem; height: 0.55rem; margin-right: 0.35rem; vertical-align: middle; }
.legend .pos { background: var(--positive); }
.legend .neg { background: var(--negative); }
.legend .ref { background: var(--pool); height: 0; border-top: 2px dashed var(--pool); width: 1.1rem; }

.readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.9rem;
}
.readout article { padding-top: 0.55rem; border-top: 2px solid var(--line); }
.readout span { display: block; color: var(--muted); font-size: 0.82rem; }
.readout strong {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 560;
  letter-spacing: -0.03em;
}
.readout .neg { color: var(--negative); }
.period-note { min-height: 1.4em; margin: 0.7rem 0 0; }

.chapter { padding: 1.5rem 0 0.4rem; border-top: 1px solid var(--line); }
.chapter h2 {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
}
.chapter p, .chapter li { max-width: var(--measure); }
.chapter ul { padding-left: 1.15rem; }
.chapter li { margin: 0.35rem 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.split h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--negative); }
.scroll { overflow-x: auto; max-height: 640px; border: 1px solid var(--line); background: var(--sheet); }
.scroll.short { max-height: none; }
td.context { max-width: 34ch; color: var(--muted); font-size: 0.85rem; }
.line-block { margin: 1.1rem 0 1.4rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.line-block h3 { font-family: var(--serif); font-size: 1.35rem; font-weight: 560; margin: 0 0 0.35rem; }
.chapter h3 { font-family: var(--serif); font-size: 1.25rem; font-weight: 560; margin: 1.1rem 0 0.35rem; }
.chapter ol { padding-left: 1.15rem; }
.chapter ol li { margin: 0.45rem 0; }
.scroll thead th { position: sticky; top: 0; background: #f3f6f8; }

.slots { padding-left: 1.1rem; max-width: var(--measure); }
.slots li { margin: 0.45rem 0; }
footer {
  padding: 1rem 1.4rem 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; z-index: 3; max-height: none; background: var(--paper); border-right: 0; border-bottom: 1px solid var(--line); padding: 0.5rem 0.8rem; }
  .rail ol { display: flex; gap: 0.8rem; overflow-x: auto; }
  .rail a { white-space: nowrap; }
  .rail .back { display: none; }
  .readout, .split { grid-template-columns: 1fr; }
  main { padding: 1rem 0.9rem 3rem; }
  .controls select { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .rail, .skip, .seg, .controls select { display: none; }
  .shell { display: block; }
  body { background: #fff; }
  .mast { color: #000; background: #fff; border-bottom: 1px solid #000; }
}
