/* TokenBill v3 — "The bill is the page"
 * Concept: the calculator output is composed as an itemized monthly cost
 * statement. Letterhead topbar, statement meta block, usage column
 * ("bill to"), charges column with a boxed AMOUNT DUE total under a
 * double rule, itemized line items, master rate card. Remove the logo and
 * the composition is still unmistakably a billing document.
 *
 * Restraint: no gradient, no glass, no blobs, no glow, no gradient text.
 * Radius: 0 everywhere; 50% for the live dot only. Elevation: none except
 * the sticky letterhead (real layering). One brand color (bill blue) doing
 * one job: interactive + cheapest-state. Money is communicated by rank,
 * the word "cheapest", and the boxed total — never by paint alone.
 * Uppercase tracked labels are used only where billing documents genuinely
 * use them (statement overline, AMOUNT DUE, data-table headers).
 */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibmplexmono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibmplexmono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibmplexmono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  /* v4 tokens: primitives -> semantic (warm editorial paper; bill-blue stays interaction-only) */
  --paper: #FAF7F2;
  --surface: #FFFDF9;
  --well: #F1EDE6;
  --ink: #1F1B16;
  --ink-2: #57504A;
  --ink-3: #6E665C;
  --line: #E7E0D5;
  --brand: #1B4BC0;
  --brand-deep: #143A94;
  --on-brand: #FFFFFF;
  --brand-wash: rgba(27, 75, 192, 0.07);
  /* provider series colors (Okabe-Ito based, CVD-safe; marks only — text never wears these) */
  --c-openai: #56B4E9;
  --c-anthropic: #D55E00;
  --c-google: #0072B2;
  --c-deepseek: #009E73;
  --c-xai: #E69F00;
  --c-other: #949494;
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h: 60px;
}

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-style: normal; margin: 0; overflow-wrap: anywhere; min-width: 0; }

/* every numeral on the page is data */
.num, .bill-meta dd, .due-cost, td.cost, td.r, .range-val,
.field input, .bar-row .val, .datestamp, .colophon, .share-url, .doc-meta {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }

::selection { background: var(--brand-wash); }

/* skip link */
.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 50;
  background: var(--ink);
  color: var(--on-brand);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  text-decoration: none;
  transition: top 150ms var(--ease-out);
}
.skip:focus { top: 12px; }

/* visible focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ============ letterhead ============ */
.topbar {
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
.topbar-inner {
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand .wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.brand .descriptor {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.topbar-right { display: flex; align-items: center; gap: 24px; }
.topnav { display: flex; gap: 20px; }
.topnav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.topnav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.datestamp {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
  margin: 0;
  white-space: nowrap;
}
.livedot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  flex: 0 0 auto;
}

/* ============ statement header ============ */
.statement { padding: 64px 0 0; }
.overline {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-deep);
  margin: 0 0 14px;
}
.statement h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 4.8vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 16ch;
  margin-bottom: 28px;
  text-wrap: balance;
}

/* statement meta block — provenance, not decoration */
.bill-meta {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(0, 1.6fr);
  margin: 0 0 28px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.bill-meta > div { padding: 14px 18px 12px 0; min-width: 0; }
.bill-meta > div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.bill-meta dt {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 3px;
}
.bill-meta dd {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statement .sub {
  color: var(--ink-2);
  font-size: 16px;
  max-width: 60ch;
  margin: 0 0 44px;
}

/* ============ view tabs ============ */
.tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}
.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 2px 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 140ms ease-out, border-color 140ms ease-out;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }

/* ============ the bill body ============ */
.bill {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: start;
  padding-bottom: 88px;
}
.bill-h {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 4px;
}
.usage-group { margin-bottom: 32px; }
.field-label {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 14px 0 4px;
}
.field-label .num { color: var(--ink-3); font-weight: 500; }

/* presets as bill line items */
.preset-list { display: block; }
.preset {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 13px 12px 13px 0;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 140ms ease-out;
}
.preset .pname { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 1px; }
.preset small { display: block; font-family: var(--font-data); font-size: 11.5px; color: var(--ink-3); }
.preset:hover { background: var(--surface); }
.preset[aria-pressed="true"] { background: var(--brand-wash); box-shadow: inset 3px 0 0 var(--brand); }
.preset[aria-pressed="true"] .pname { color: var(--brand-deep); }
.preset:active { transform: scale(0.995); }

.field { margin-bottom: 18px; }
.field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.range-val { color: var(--ink); font-weight: 600; font-size: 13px; }
.field input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 17px;
  padding: 10px 12px;
  transition: border-color 140ms ease-out;
}
.field input[type="number"]:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
input[type="range"] { width: 100%; accent-color: var(--brand); margin: 6px 0 0; }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; margin: 4px 0 0; }

.models { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  padding: 7px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out, transform 140ms ease-out;
}
.chip .prov { color: var(--ink-3); font-size: 11px; margin-left: 6px; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip[aria-pressed="true"] .prov { color: inherit; opacity: 0.72; }
.chip:active { transform: scale(0.96); }
.picker-actions { display: flex; gap: 16px; }
.link-btn {
  appearance: none; background: none; border: none; padding: 2px 0;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--line);
}
.link-btn:hover { color: var(--brand-deep); text-decoration-color: var(--brand); }

/* ============ charges column ============ */
.charges-h {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 4px;
}

/* amount due — the boxed total under a double rule */
.amount-due {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px double var(--ink);
  padding: 26px 28px 24px;
  margin-bottom: 36px;
}
.due-label {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
}
.due-cost {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(52px, 6.5vw, 80px);
  line-height: 1;
  letter-spacing: -0.03em;
  display: block;
}
.due-model {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 12px 0 0;
}
.due-per { color: var(--ink-2); font-size: 14px; margin: 2px 0 0; }

#results-empty {
  border: 1px dashed var(--line);
  padding: 28px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  margin: 0 0 8px;
}

/* itemized charges */
table.results { width: 100%; border-collapse: collapse; }
table.results thead th {
  text-align: left;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--ink);
}
table.results thead th.cost { text-align: right; }
table.results td {
  padding: 13px 12px 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  vertical-align: baseline;
}
table.results td.cost {
  text-align: right;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}
table.results .save { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
table.results tr.winner-row td { background: var(--brand-wash); }
table.results tr.winner-row td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.results tr.winner-row td.cost { color: var(--brand-deep); }
table.results tr.winner-row .save { color: var(--brand-deep); font-weight: 700; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* relative scale — inline SVG horizontal bars (provider colors, zero-based) */
.chart { margin-top: 32px; }
.chart h3 {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.chart-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 12px;
  max-width: 60ch;
}
.chart svg, .svg-wrap svg { display: block; width: 100%; height: auto; }
.svg-wrap { position: relative; }

/* svg chart typography: ink carries the words, marks carry the identity */
.svg-lbl { font-family: var(--font-body); fill: var(--ink); }
.svg-val { font-family: var(--font-data); fill: var(--ink); font-weight: 600; }
.svg-tick { font-family: var(--font-data); fill: var(--ink-2); }
.svg-grid { stroke: var(--line); stroke-width: 1; }
.svg-axis { stroke: var(--ink-2); stroke-width: 1; }
.svg-rule { stroke: var(--ink); stroke-width: 1; opacity: 0.55; }

/* provider legend: color dot + ink text */
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 12px;
  font-size: 12.5px; color: var(--ink-2);
}
.legend .li { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

/* scatter hover tip */
.tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px double var(--ink);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 240px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.10);
}
.tip .t-name { font-weight: 700; color: var(--ink); display: block; margin-bottom: 2px; }
.tip .t-rates { font-family: var(--font-data); font-size: 11.5px; color: var(--ink-2); display: block; }
.tip .t-cost { font-family: var(--font-data); font-size: 13px; font-weight: 600; color: var(--ink); display: block; margin-top: 4px; }

/* you-save callout — the hero beat under AMOUNT DUE */
.save-callout {
  border: 1px solid var(--line);
  border-top: 4px double var(--ink);
  padding: 22px 28px 20px;
  margin: -20px 0 36px;
  background: var(--surface);
}
.save-label {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
}
.save-amount {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1;
  letter-spacing: -0.03em;
  display: block;
}
.save-vs { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin: 10px 0 0; }
.save-per { color: var(--ink-2); font-size: 14px; margin: 2px 0 0; }

/* optimization recommendation row — text + svg only, no emoji */
.reco {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  background: var(--surface);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink);
  margin: 20px 0 0;
}
.reco svg { flex: 0 0 auto; margin-top: 3px; color: var(--brand); }
.reco strong { font-weight: 700; }

/* how-to: hairline ruled rows, mono step numbers */
.howto {
  border-top: 1px solid var(--ink);
  padding: 40px 0 88px;
  max-width: 880px;
}
.howto h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 3.2vw, 36px);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  text-wrap: balance;
}
.howto-steps { list-style: none; margin: 24px 0 0; padding: 0; }
.howto-steps li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.howto-steps li:last-child { border-bottom: 1px solid var(--line); }
.step-no {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  padding-top: 3px;
}
.howto-steps h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.howto-steps p { color: var(--ink-2); font-size: 14.5px; margin: 0; max-width: 64ch; }
.howto-steps strong { color: var(--ink); }

/* provider dot on model chips + table swatches (color beside ink text) */
.chip .pdot {
  width: 9px; height: 9px; border-radius: 50%;
  flex: 0 0 auto; margin-right: 8px;
}
.chip[aria-pressed="true"] .pdot { box-shadow: 0 0 0 1.5px var(--on-brand); }
.swatch {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  margin-right: 8px; vertical-align: baseline;
  transform: translateY(1px);
}

/* ============ v4 motion: place -> structure -> data -> hero -> support ============ */
@keyframes bar-grow { from { transform: scaleX(0); } }
@keyframes dot-pop { from { opacity: 0; transform: scale(0); } }
@keyframes draw-on { to { stroke-dashoffset: 0; } }
@keyframes label-fade { from { opacity: 0; } }

.svg-bar {
  transform-box: fill-box;
  transform-origin: left center;
  animation: bar-grow 0.7s var(--ease-out) backwards;
}
.svg-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: dot-pop 0.5s var(--ease-out) backwards;
}
.svg-curve { animation: draw-on 1.4s ease-in-out both; }
.svg-support { animation: label-fade 0.5s ease-out backwards; }

.share-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line);
}
.btn {
  appearance: none;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--on-brand);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 12px 24px;
  cursor: pointer;
  transition: transform 140ms ease-out, background 140ms ease-out, border-color 140ms ease-out;
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn:active { transform: scale(0.97); }
.share-url { font-size: 12px; color: var(--ink-3); word-break: break-all; }

/* ============ rate card tab ============ */
.board-head { margin-bottom: 24px; }
.board-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 42px);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  text-wrap: balance;
}
.price-note { color: var(--ink-2); font-size: 14px; max-width: 68ch; margin: 0; }
table.prices { width: 100%; border-collapse: collapse; min-width: 560px; }
table.prices thead th {
  position: sticky; top: var(--topbar-h);
  background: var(--paper);
  text-align: left;
  font-family: var(--font-data);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--ink);
}
table.prices td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
table.prices td.r, table.prices th.r { text-align: right; font-weight: 500; }
table.prices td:first-child { font-weight: 600; }
table.prices td:nth-child(2) { color: var(--ink-2); font-size: 13px; }
table.prices tbody tr:hover td { background: var(--surface); }

/* ============ motion: feedback and state change only ============ */
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes word-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes due-settle {
  0% { transform: scale(1); }
  30% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

/* the single entrance: statement header choreography */
.statement h1 .w {
  display: inline-block;
  animation: word-in 0.55s var(--ease-out) both;
  will-change: opacity, transform;
}
.statement > :not(h1) { animation: rise-in 0.5s var(--ease-out) both; }
.statement > :not(h1):nth-child(2) { animation-delay: 0.06s; }
.statement > :not(h1):nth-child(3) { animation-delay: 0.12s; }
.statement > :not(h1):nth-child(4) { animation-delay: 0.18s; }

/* state-change feedback */
#results-body tr.fresh { animation: row-in 0.3s var(--ease-out) both; }
.amount-due.settle .due-cost { animation: due-settle 0.4s var(--ease-out) both; }
.bill-meta dd.tick { animation: rise-in 0.4s var(--ease-out) both; }
[role="tabpanel"]:not([hidden]) { animation: rise-in 0.25s var(--ease-out) both; }

/* doc pages: one restrained scroll reveal (content pages only) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* ============ footer ============ */
footer { border-top: 1px solid var(--ink); padding: 32px 0 40px; }
.foot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
}
.footnav { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.footnav a { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; width: fit-content; }
.footnav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.sister { font-size: 13.5px; color: var(--ink-2); margin: 0; max-width: 34ch; }
.sister a { color: var(--brand-deep); font-weight: 600; }
.foot-note { font-size: 13px; color: var(--ink-2); margin: 0; max-width: 44ch; }
.endmark {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-align: center;
  margin: 36px 0 0;
}
.colophon {
  font-size: 11.5px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin: 20px 0 0;
  text-align: center;
}

/* ============ doc pages ============ */
.doc { padding: 56px 0 72px; }
.doc-inner { max-width: 68ch; }
.doc h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 4.2vw, 48px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 12px;
  text-wrap: balance;
}
.doc-meta { font-size: 12px; color: var(--ink-3); margin: 0 0 40px; }
.doc .lede-sub { color: var(--ink-2); font-size: 17px; margin: 0 0 44px; max-width: 56ch; }
.doc-section { border-top: 1px solid var(--ink); padding: 26px 0; }
.doc-section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.doc-section p { color: var(--ink-2); margin: 0 0 12px; max-width: 64ch; }
.doc-section p:last-child { margin-bottom: 0; }
.doc-section strong { color: var(--ink); }
.doc-section a { color: var(--brand-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.doc-section ol, .doc-section ul { color: var(--ink-2); padding-left: 24px; margin: 0 0 12px; }
.doc-section li { margin-bottom: 6px; }
.doc-section .figure {
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  padding: 16px 18px;
  margin: 16px 0;
}

/* ============ dark statement: designed tone scale, not an inversion ============
 * The bill stays a bill after hours: dark paper, light ink, the same single
 * blue lifted one step so it keeps its job (interactive + cheapest-state).
 * No new effects, no glow, no neon — quieter than the light theme. */
@media (prefers-color-scheme: dark) {
  :root {
    /* warm dark statement: three surface levels, accents lifted one step */
    --paper: #171410;
    --surface: #1F1B16;
    --well: #2A251E;
    --ink: #F5EFE6;
    --ink-2: #C4BAAE;
    --ink-3: #A69C8E;
    --line: #332D24;
    --brand: #8AA2FF;
    --brand-deep: #AABFFF;
    --on-brand: #131417;
    --brand-wash: rgba(138, 162, 255, 0.12);
    --c-openai: #7CC9F2;
    --c-anthropic: #F07418;
    --c-google: #3FA0D8;
    --c-deepseek: #2FC08D;
    --c-xai: #FFB81C;
    --c-other: #B8B8B8;
  }
  .topbar { box-shadow: 0 1px 2px rgb(0 0 0 / 0.4); }
}

/* ============ responsive: rethought, not shrunk ============ */
@media (max-width: 960px) {
  .bill { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .bill-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bill-meta > div:nth-child(4) { border-left: none; padding-left: 0; }
  .bill-meta > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-note { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .topnav { display: none; }
  .datestamp { font-size: 10.5px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .statement { padding-top: 44px; }
  .bill-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 24px; }
  .bill-meta > div { padding: 12px 12px 10px 0; }
  .bill-meta > div:nth-child(even) { border-left: 1px solid var(--line); padding-left: 14px; }
  .bill-meta > div:nth-child(odd) { border-left: none; padding-left: 0; }
  .bill-meta > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .bill-meta dd { font-size: 13px; }
  .bill-meta > div:last-child dd { white-space: normal; }
  .foot-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(0, 104px) minmax(0, 1fr) auto; gap: 10px; }
  .bar-row .val { min-width: 74px; font-size: 11.5px; }
  .amount-due { padding: 20px 20px 18px; }
  .save-callout { padding: 18px 20px 16px; margin-top: -16px; }
  .due-cost { font-size: clamp(48px, 15vw, 64px); }
  .howto-steps li { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
  table.prices thead th { top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
