/* billing — "Ledger" visual system (Run 1 base). A well-set financial document:
   strong grid, generous margins, numbers that line up. Two designed palettes.
   Run 7: bundled OFL fonts (assets/fonts/, licences beside them) — Newsreader Display for headings
   and amounts, IBM Plex Sans for text and tables (tabular figures by default), IBM Plex Mono for codes. */

@font-face { font-family: "Ledger Display"; src: url("fonts/newsreader-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Ledger Display"; src: url("fonts/newsreader-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Ledger Text"; src: url("fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Ledger Text"; src: url("fonts/plex-sans-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Ledger Text"; src: url("fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Ledger Mono"; src: url("fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --serif: "Ledger Display", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Ledger Text", "Avenir Next", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Ubuntu, system-ui, sans-serif;
  --mono: "Ledger Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --paper: #f5f1e8;
  --surface: #fffcf5;
  --sunk: #ece6d9;
  --ink: #1d1b17;
  --ink-2: #3b3730;
  --muted: #6d675c;
  --rule: #dcd4c4;
  --rule-strong: #b9ae99;
  --accent: #1f5f4a;
  --accent-ink: #fffcf5;
  --accent-soft: #dfeae3;
  --good: #2c7a4d; --good-soft: #e1efe5;
  --warn: #9a6210; --warn-soft: #f6ead2;
  --bad: #ad3328;  --bad-soft: #f6e0dc;
  --focus: #0d5bd7;
  --shadow: 0 1px 0 rgba(29, 27, 23, .04), 0 8px 24px -16px rgba(29, 27, 23, .25);

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --t-xs: .8rem; --t-sm: .89rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.563rem; --t-2xl: 1.953rem; --t-3xl: 2.441rem;
  --radius: 3px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #14130f;
  --surface: #1b1a15;
  --sunk: #23211b;
  --ink: #ece6d8;
  --ink-2: #d2cab9;
  --muted: #a1998a;
  --rule: #322f28;
  --rule-strong: #4a453b;
  --accent: #7cc3a3;
  --accent-ink: #10130f;
  --accent-soft: #1f2e27;
  --good: #7cc39a; --good-soft: #1d2b22;
  --warn: #e0b061; --warn-soft: #2e2618;
  --bad: #ec8a7f;  --bad-soft: #33201d;
  --focus: #8ab4ff;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14130f; --surface: #1b1a15; --sunk: #23211b; --ink: #ece6d8; --ink-2: #d2cab9; --muted: #a1998a;
    --rule: #322f28; --rule-strong: #4a453b; --accent: #7cc3a3; --accent-ink: #10130f; --accent-soft: #1f2e27;
    --good: #7cc39a; --good-soft: #1d2b22; --warn: #e0b061; --warn-soft: #2e2618; --bad: #ec8a7f; --bad-soft: #33201d;
    --focus: #8ab4ff; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -18px rgba(0,0,0,.8); color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-md)/1.55 var(--sans); font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 var(--s3); }
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
p { margin: 0 0 var(--s4); }
code, kbd, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--sunk); padding: .08em .35em; border-radius: var(--radius); }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s6) 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: var(--s2) var(--s3); z-index: 10; }
.skip:focus { left: var(--s3); top: var(--s3); }
.visually-hidden { position: absolute !important; clip: rect(0 0 0 0); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }

/* ---------- app frame ---------- */
.frame { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  border-right: 1px solid var(--rule); background: var(--surface); padding: var(--s5) var(--s4) var(--s4);
}
.brand { display: flex; align-items: baseline; gap: var(--s2); text-decoration: none; color: var(--ink); margin: 0 var(--s2) var(--s5); }
.brand-mark { font: 600 1.45rem/1 var(--serif); letter-spacing: -.02em; }
.brand-mark::after { content: "."; color: var(--accent); }
.brand-sub { font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.workspace { margin: 0 var(--s2) var(--s5); padding: var(--s3) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.workspace .eyebrow { margin: 0; }
.workspace strong { display: block; font-family: var(--serif); font-size: var(--t-lg); font-weight: 600; }
.nav { display: grid; gap: 1px; margin: 0 0 var(--s5); padding: 0; list-style: none; }
.nav-head { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: var(--s4) var(--s2) var(--s2); }
.nav a {
  display: flex; align-items: center; justify-content: space-between; padding: .42rem var(--s2);
  border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-size: var(--t-sm);
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav .soon { font-size: .7rem; color: var(--muted); letter-spacing: .04em; }
.nav a[aria-current="page"] .soon { color: inherit; opacity: .7; }
.rail-foot { margin-top: auto; border-top: 1px solid var(--rule); padding: var(--s3) var(--s2) 0; font-size: var(--t-sm); }
.rail-foot .who { display: block; color: var(--ink); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-foot .role { color: var(--muted); font-size: var(--t-xs); }
.rail-foot form { display: inline; }
.rail-actions { display: flex; gap: var(--s3); align-items: center; margin-top: var(--s2); }

.main { padding: var(--s6) clamp(var(--s4), 4vw, var(--s8)) var(--s8); max-width: 78rem; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding-bottom: var(--s4); margin-bottom: var(--s5); border-bottom: 2px solid var(--ink); }
.page-head h1 { margin: 0; }
.eyebrow { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0 0 var(--s2); font-weight: 600; }
.lede { color: var(--ink-2); max-width: 46rem; font-size: 1.05rem; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* ---------- notices ---------- */
.notice { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: var(--s3) var(--s4); margin: 0 0 var(--s5); border-radius: 0 var(--radius) var(--radius) 0; animation: rise 180ms var(--ease); }
.notice.bad { border-color: var(--bad); background: var(--bad-soft); }
.notice.warn { border-color: var(--warn); background: var(--warn-soft); }
.notice p:last-child { margin: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ---------- figures ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 0 var(--s6); }
.figure { padding: var(--s4) var(--s4) var(--s4) 0; border-right: 1px solid var(--rule); }
.figure + .figure { padding-left: var(--s4); }
.figure:last-child { border-right: 0; }
.figure .label { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.figure .value { font: 600 var(--t-2xl)/1.1 var(--serif); font-variant-numeric: tabular-nums lining-nums; margin-top: var(--s1); }
.figure.hero .value { font-size: var(--t-3xl); color: var(--accent); }
.figure .note { font-size: var(--t-xs); color: var(--muted); }
.amt { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.amt .cur { color: var(--muted); font-size: .82em; margin-right: .08em; }

/* ---------- sections ---------- */
.section { margin: 0 0 var(--s7); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); margin-bottom: var(--s3); }
.section-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }
.panel h2, .panel h3 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table.ledger { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums lining-nums; }
.ledger th { position: sticky; top: 0; background: var(--paper); text-align: left; font-weight: 600; font-size: var(--t-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: var(--s3) var(--s3) var(--s2); border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.ledger td { padding: var(--s3); border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger tr:hover td { background: color-mix(in srgb, var(--sunk) 55%, transparent); }
.ledger .num { text-align: right; }
.ledger td.primary a { font-weight: 600; color: var(--ink); text-decoration: none; }
.ledger td.primary a:hover { text-decoration: underline; }
.ledger td.primary .sub { display: block; color: var(--muted); font-size: var(--t-xs); font-family: var(--mono); }
.empty { padding: var(--s6) 0; color: var(--muted); border-bottom: 1px solid var(--rule); }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s5); margin: 0; font-size: var(--t-sm); }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35em; font-size: .74rem; font-weight: 600; letter-spacing: .04em; padding: .12rem .5rem .14rem; border-radius: 99px; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.badge-good { color: var(--good); background: var(--good-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.badge-neutral { color: var(--muted); background: var(--sunk); }

/* ---------- forms ---------- */
.form { display: grid; gap: var(--s4); max-width: 34rem; }
.form.wide { max-width: 48rem; }
.field { display: grid; gap: var(--s1); }
.field label, .field .label { font-weight: 600; font-size: var(--t-sm); }
.field .hint { color: var(--muted); font-size: var(--t-xs); }
.field-error { color: var(--bad); font-size: var(--t-sm); margin: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--s4); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"], input[type="date"], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); padding: .6rem .7rem; transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[aria-invalid="true"] { border-color: var(--bad); }
input.mono { font-family: var(--mono); font-size: .92rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: var(--t-sm); margin-bottom: var(--s2); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s3); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: var(--s4); background: var(--surface); transition: border-color 140ms var(--ease), transform 140ms var(--ease), box-shadow 140ms var(--ease); }
.choice strong { display: block; font-family: var(--serif); font-size: var(--t-lg); }
.choice small { color: var(--muted); }
.choice:hover span { border-color: var(--ink-2); transform: translateY(-1px); }
.choice input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); font: 600 var(--t-sm)/1 var(--sans);
  padding: .68rem 1rem; border-radius: var(--radius); border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  cursor: pointer; text-decoration: none; transition: transform 120ms var(--ease), background-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.btn:hover { box-shadow: 0 4px 14px -8px rgba(0, 0, 0, .5); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.quiet:hover { border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.small { padding: .42rem .65rem; font-size: var(--t-xs); }
.btn.confirming { background: var(--bad); color: #fff; border-color: var(--bad); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.inline-form { display: inline-flex; gap: var(--s2); align-items: center; margin: 0; }
.inline-form select { width: auto; padding: .35rem .5rem; font-size: var(--t-sm); }

.copybox { display: flex; gap: var(--s2); align-items: stretch; }
.copybox input { font-family: var(--mono); font-size: .86rem; }
.secret-once { border: 1px dashed var(--warn); background: var(--warn-soft); padding: var(--s4); border-radius: var(--radius); }

/* checklist */
.checklist { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.checklist li { display: grid; grid-template-columns: 2rem 1fr; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--rule); counter-increment: step; }
.checklist li::before { content: counter(step, decimal-leading-zero); font: 600 var(--t-sm)/1.6 var(--mono); color: var(--muted); }
.checklist li.done { color: var(--muted); }
.checklist li.done::before { content: "✓"; color: var(--good); font-family: var(--sans); }
.checklist .later { font-size: var(--t-xs); color: var(--muted); }

/* timeline (audit) */
.timeline { list-style: none; margin: 0; padding: 0; font-size: var(--t-sm); }
.timeline li { display: grid; grid-template-columns: 8.5rem 1fr; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px dotted var(--rule); }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--t-xs); padding-top: .15em; }
.timeline .act { font-family: var(--mono); font-size: .82rem; }

/* state diagram strip */
.states { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; font-size: var(--t-xs); margin: var(--s3) 0 0; padding: 0; list-style: none; }
.states li { padding: .2rem .55rem; border: 1px solid var(--rule); border-radius: 99px; color: var(--muted); }
.states li.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.states li.sep { border: 0; padding: 0; }

/* ---------- auth / plain layouts ---------- */
.sheet { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.sheet-side { background: var(--ink); color: var(--paper); padding: var(--s7) clamp(var(--s5), 5vw, var(--s8)); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.sheet-side .brand { color: var(--paper); margin: 0; }
.sheet-side .brand-sub { color: color-mix(in srgb, var(--paper) 60%, transparent); }
.sheet-side .colophon { font-size: var(--t-xs); color: color-mix(in srgb, var(--paper) 55%, transparent); letter-spacing: .04em; }
.sheet-side .ruled { position: absolute; inset: 0; pointer-events: none; opacity: .09;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, currentColor 31px 32px); }
.sheet-side .statement { font: 500 clamp(1.6rem, 3vw, 2.4rem)/1.18 var(--serif); max-width: 22ch; letter-spacing: -.015em; position: relative; }
.sheet-side .statement em { font-style: italic; color: color-mix(in srgb, var(--paper) 72%, transparent); }
.sheet-main { padding: var(--s8) clamp(var(--s5), 6vw, 7rem); display: flex; flex-direction: column; justify-content: center; max-width: 40rem; }
.sheet-main h1 { font-size: var(--t-2xl); }
.sheet-foot { margin-top: var(--s6); font-size: var(--t-sm); color: var(--muted); }
.plain { max-width: 46rem; margin: 0 auto; padding: var(--s8) var(--s5); }
.plain .code { font: 600 5rem/1 var(--serif); color: var(--rule-strong); letter-spacing: -.04em; }

/* theme toggle */
.theme-toggle { background: none; border: 1px solid var(--rule); color: var(--muted); border-radius: 99px; padding: .2rem .55rem; font: 600 var(--t-xs)/1.4 var(--sans); cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .frame { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: var(--s3) var(--s4); }
  .rail .nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; margin: 0; padding-bottom: var(--s2); }
  .rail .nav-head, .workspace, .rail-foot { display: none; }
  .brand { margin-bottom: var(--s3); }
  .sheet { grid-template-columns: 1fr; }
  .sheet-side { padding: var(--s5); min-height: auto; }
  .sheet-side .statement { display: none; }
  .sheet-main { padding: var(--s6) var(--s5); }
  .figure { border-right: 0; border-bottom: 1px solid var(--rule); padding-left: 0 !important; }
  .figure:last-child { border-bottom: 0; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .rail, .actions, .theme-toggle, form { display: none !important; }
  .frame { display: block; }
  body { background: #fff; color: #000; }
}

/* utilities (CSP forbids inline style attributes) */
.mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); } .mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); }
.mb5 { margin-bottom: var(--s5); }
.filters { max-width: 40rem; }
.end { align-self: end; }
.pre-wrap { white-space: pre-wrap; }
.figure .value.status { font-size: 1.15rem; padding-top: .35rem; }
.plain.wide { max-width: 52rem; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.chart .line { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .forecast { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; opacity: .7; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.spark { width: 100%; height: 34px; display: block; margin: var(--s1) 0; }
.spark-line { stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
/* ---------- Run 5: own chart renderer (Billing\Core\Chart) ----------
   Series colours: accent, then a fixed ramp that holds contrast on both palettes. */
:root { --viz-0: var(--accent); --viz-1: #b0701e; --viz-2: #4662a0; --viz-3: #a0405a; --viz-4: #5c8034; --viz-5: #6e5a96; --viz-cmp: var(--muted); }
:root[data-theme="dark"] { --viz-1: #e0b061; --viz-2: #8caae6; --viz-3: #e68ca0; --viz-4: #aad278; --viz-5: #b4a0e1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-1: #e0b061; --viz-2: #8caae6; --viz-3: #e68ca0; --viz-4: #aad278; --viz-5: #b4a0e1; } }
.viz-fig { margin: 0 0 var(--s5); }
.viz-fig figcaption { display: flex; gap: var(--s3); align-items: baseline; flex-wrap: wrap; font-size: var(--t-xs); color: var(--muted); margin-top: var(--s1); }
.viz-act { font-size: var(--t-xs); }
.viz-data summary { cursor: pointer; font-size: var(--t-xs); color: var(--muted); margin-top: var(--s1); }
.viz-data .viz-table { font-size: var(--t-xs); margin-top: var(--s2); }
.viz { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--sans); }
.viz:focus { outline: none; }
.viz:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.viz .viz-grid { stroke: var(--rule); stroke-width: 1; }
.viz .viz-zero { stroke: var(--rule-strong); }
.viz .viz-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .viz-empty { fill: var(--muted); font-size: 13px; }
.viz .s0 { --c: var(--viz-0); } .viz .s1 { --c: var(--viz-1); } .viz .s2 { --c: var(--viz-2); }
.viz .s3 { --c: var(--viz-3); } .viz .s4 { --c: var(--viz-4); } .viz .s5 { --c: var(--viz-5); }
.viz .viz-cmp { --c: var(--viz-cmp); }
.viz .viz-line { stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.viz .viz-line.viz-cmp { stroke-dasharray: 5 4; stroke-width: 1.5; }
.viz-sparkline .viz-line { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.viz .viz-area { fill: color-mix(in srgb, var(--c) 16%, transparent); stroke: none; }
.viz .viz-bar, .viz .viz-slice, .viz .viz-key { fill: var(--c); }
.viz .viz-bar { opacity: .88; }
.viz .viz-dot { fill: var(--surface, var(--paper)); stroke: var(--c); stroke-width: 2; opacity: 0; transition: opacity 120ms var(--ease); }
.viz-sparkline .viz-dot { fill: var(--c); stroke: none; opacity: 1; }
.viz .viz-cell { fill: var(--sunk); }
.viz .viz-cell.q1 { fill: color-mix(in srgb, var(--viz-0) 18%, var(--sunk)); }
.viz .viz-cell.q2 { fill: color-mix(in srgb, var(--viz-0) 36%, var(--sunk)); }
.viz .viz-cell.q3 { fill: color-mix(in srgb, var(--viz-0) 55%, var(--sunk)); }
.viz .viz-cell.q4 { fill: color-mix(in srgb, var(--viz-0) 75%, var(--sunk)); }
.viz .viz-cell.q5 { fill: var(--viz-0); }
.viz .viz-donut-total { fill: var(--ink); font: 600 18px var(--serif); font-variant-numeric: tabular-nums; }
.viz .viz-legend-text { font-size: 12px; fill: var(--ink-2); }
.viz .viz-hit { fill: transparent; }
.viz .viz-guide { stroke: var(--rule-strong); stroke-width: 1; opacity: 0; }
.viz .viz-tip { visibility: hidden; pointer-events: none; }
.viz .viz-tip rect { fill: var(--ink); opacity: .94; }
.viz .viz-tip text { fill: var(--paper); font-size: 12px; font-variant-numeric: tabular-nums; }
.viz .viz-tip .viz-tip-head { font-weight: 600; }
.viz .viz-pt { outline: none; }
.viz .viz-pt:hover .viz-tip, .viz .viz-pt:focus .viz-tip, .viz .viz-pt.on .viz-tip { visibility: visible; }
.viz .viz-pt:hover .viz-guide, .viz .viz-pt:focus .viz-guide, .viz .viz-pt.on .viz-guide,
.viz .viz-pt:hover .viz-dot, .viz .viz-pt:focus .viz-dot, .viz .viz-pt.on .viz-dot { opacity: 1; }
.viz .viz-pt:hover .viz-slice, .viz .viz-pt:focus .viz-slice, .viz .viz-pt.on .viz-slice,
.viz .viz-pt:hover .viz-cell, .viz .viz-pt:focus .viz-cell, .viz .viz-pt.on .viz-cell { stroke: var(--ink); stroke-width: 1.5; }
@media (prefers-reduced-motion: reduce) { .viz .viz-dot { transition: none; } }
/* analytics screens */
.tabs { display: flex; gap: var(--s1); flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin: 0 0 var(--s5); }
.tabs a { padding: var(--s2) var(--s3); text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: var(--t-sm); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.range-form { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: end; }
.range-form label { display: grid; gap: 2px; font-size: var(--t-xs); color: var(--muted); }
.range-form input, .range-form select { min-width: 8rem; }
.figure .spark-wrap { margin-top: var(--s2); }
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.funnel li { display: grid; grid-template-columns: 11rem 1fr 7rem; gap: var(--s3); align-items: center; font-size: var(--t-sm); }
.funnel .bar-track { background: var(--sunk); border-radius: 3px; height: 1.4rem; overflow: hidden; }
.funnel .bar-fill { display: block; height: 100%; background: var(--accent); }
.funnel .w0 { width: 0; } .funnel .w5 { width: 5%; } .funnel .w10 { width: 10%; } .funnel .w15 { width: 15%; } .funnel .w20 { width: 20%; }
.funnel .w25 { width: 25%; } .funnel .w30 { width: 30%; } .funnel .w35 { width: 35%; } .funnel .w40 { width: 40%; } .funnel .w45 { width: 45%; }
.funnel .w50 { width: 50%; } .funnel .w55 { width: 55%; } .funnel .w60 { width: 60%; } .funnel .w65 { width: 65%; } .funnel .w70 { width: 70%; }
.funnel .w75 { width: 75%; } .funnel .w80 { width: 80%; } .funnel .w85 { width: 85%; } .funnel .w90 { width: 90%; } .funnel .w95 { width: 95%; } .funnel .w100 { width: 100%; }
.cohort td { text-align: right; font-variant-numeric: tabular-nums; }
.cohort td.c0 { background: transparent; } .cohort td.c1 { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cohort td.c2 { background: color-mix(in srgb, var(--accent) 24%, transparent); } .cohort td.c3 { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.cohort td.c4 { background: color-mix(in srgb, var(--accent) 52%, transparent); } .cohort td.c5 { background: color-mix(in srgb, var(--accent) 68%, transparent); color: var(--accent-ink); }
.rate-ok { color: var(--good); } .rate-warn { color: var(--warn); font-weight: 600; } .rate-alert { color: var(--bad); font-weight: 600; }
img.px { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.narrative p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.6; max-width: 62rem; color: var(--ink-2); }
.recs { list-style: none; margin: 0; padding: 0; }
.rec { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.rec p { margin: 0 0 var(--s2); }
.rec-head strong { margin-left: var(--s1); }
pre.fix { background: var(--sunk); padding: var(--s3); border-radius: var(--radius); font: .82rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--s2) 0 0; }

/* ---------- customer-facing pay pages ---------- */
body.pay { --accent: var(--tenant, #1f5f4a); }
:root[data-theme="dark"] body.pay { --accent: color-mix(in srgb, var(--tenant, #7cc3a3) 55%, #ffffff); }
.paybar { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s4) clamp(var(--s4), 5vw, var(--s7)); border-bottom: 1px solid var(--rule); background: var(--surface); }
.paybar-name { font: 600 1.25rem var(--serif); color: var(--ink); text-decoration: none; }
.paybar-nav { display: flex; gap: var(--s4); align-items: center; font-size: var(--t-sm); }
.paymain { max-width: 40rem; margin: 0 auto; padding: var(--s7) var(--s5) var(--s8); }
.pay-title { font-size: var(--t-3xl); margin-bottom: var(--s2); }
.pay-amount { font: 600 2.6rem/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums lining-nums; margin: 0 0 var(--s5); }
.pay-amount .cur { font-size: .5em; vertical-align: .55em; }
.pay-amount .per { font: 400 1rem var(--sans); color: var(--muted); margin-left: var(--s2); }
.pay-desc { color: var(--ink-2); margin-bottom: var(--s5); }
.payform { margin-top: var(--s5); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s3); }
.tile { position: relative; cursor: pointer; display: block; }
.tile input { position: absolute; opacity: 0; }
.tile span { display: block; padding: var(--s5) var(--s4); border: 1.5px solid var(--rule-strong); border-radius: 6px; background: var(--surface); transition: transform 150ms var(--ease), border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.tile strong { display: block; font: 600 1.15rem var(--serif); }
.tile small { color: var(--muted); }
.tile:hover span { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.tile input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.big { padding: .95rem 1.4rem; font-size: 1rem; }
.code-big { font: 600 clamp(1.5rem, 5vw, 2.2rem)/1.2 var(--mono); letter-spacing: .06em; padding: var(--s4) 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); margin: var(--s3) 0 var(--s4); }
.trust { max-width: 40rem; margin: 0 auto var(--s6); padding: var(--s4) var(--s5) 0; border-top: 1px solid var(--rule); font-size: var(--t-xs); color: var(--muted); }
.trust .lock { color: var(--good); }
.product-list, .access-list { list-style: none; margin: var(--s4) 0 0; padding: 0; border-top: 1px solid var(--ink); }
.product-list li a { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.product-list li a:hover strong { text-decoration: underline; }
.access-list li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.access-row { border-bottom: 1px solid var(--rule); padding: var(--s3) 0; }
.access-row summary { cursor: pointer; }
.access-form { margin-top: var(--s3); }
.receipt { background: var(--surface); border: 1px solid var(--rule); padding: var(--s6); box-shadow: var(--shadow); }
@media print { body.pay .paybar, body.pay .trust { display: none; } .receipt { box-shadow: none; border: 0; } }

/* Run 4a: refund policy checks, dispute evidence */
.policy-checks, .evidence { list-style: none; margin: 0; padding: 0; }
.policy-checks li, .evidence li { padding: var(--s2) 0; border-bottom: 1px solid var(--rule); }
.mb3 { margin-bottom: var(--s3); }

/* ---------- Run 4b: admin & platform screens ---------- */
.imp-banner { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); margin: 0 0 var(--s5); border: 1px solid var(--warn); background: var(--warn-soft); color: var(--ink); border-radius: var(--radius); font-size: var(--t-sm); }
body.pay > .imp-banner { margin: 0; border-radius: 0; border-width: 0 0 1px; }
.scope-form { display: grid; gap: var(--s1); min-width: 14rem; }
.scope-form label { display: flex; gap: var(--s2); align-items: center; }
.scope-form label.indent { padding-left: var(--s5); }
.scope-form .btn { justify-self: start; margin-top: var(--s2); }
.swatch-row { display: flex; gap: var(--s2); align-items: stretch; }
.swatch-row input[type="color"] { width: 3rem; padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: none; }
.logo-preview img { max-height: 64px; width: auto; height: auto; background: var(--sunk); padding: var(--s2); border-radius: var(--radius); }
.paybar-logo { display: block; height: 32px; width: auto; max-width: 14rem; object-fit: contain; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s5); margin: var(--s4) 0; font-size: var(--t-sm); }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; gap: var(--s3); align-items: center; justify-content: center; margin: var(--s5) 0; }
.audit-filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: end; max-width: none; margin-bottom: var(--s5); }
.audit-filters label { display: grid; gap: var(--s1); }
.audit-filters input[type="text"], .audit-filters input[type="search"] { width: 11rem; }
.ledger.diff tr.changed td:nth-child(3) { background: var(--accent-soft); }
.ledger.diff tr.changed td:nth-child(2) { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.act-as { gap: var(--s2); }
.act-as input { width: 9rem; font-size: var(--t-sm); }
.legal { max-width: 42rem; line-height: 1.65; }
.legal p { margin: 0 0 var(--s4); }
.trust a { color: inherit; }
[hidden] { display: none !important; }
.scope-form label { align-items: flex-start; }
.scope-form label > span { min-width: 0; overflow-wrap: anywhere; }
.scope-form input { flex: none; margin-top: .2em; }
.page-head h1.mono { font-size: 1.75rem; letter-spacing: -.01em; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.ledger td .scope-form, .ledger td .scope-form * { white-space: normal; }
.scope-form { min-width: 0; max-width: 17rem; }
.scope-form { min-width: 13rem; }
.scope-form label > span { overflow-wrap: break-word; }
.access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s4); }
.access-grid .scope-form { max-width: none; font-size: var(--t-sm); }
.scope-form.has-error { border-color: var(--bad); }

/* ---------- licensing (Run L1) ---------- */
.ledger td .sub { display: block; color: var(--muted); font-size: var(--t-xs); }
.ledger tr.dim td { color: var(--muted); }
.h-key { font-size: .62em; letter-spacing: .04em; vertical-align: middle; }
dl.kv.tight { margin: var(--s2) 0; gap: var(--s1) var(--s4); }
details.reveal > summary { cursor: pointer; list-style: none; display: inline-flex; gap: var(--s2); align-items: baseline; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal[open] > summary .linkish { display: none; }
details.reveal .copybox { margin-top: var(--s2); max-width: 34rem; }
.linkish { color: var(--accent); font-size: var(--t-sm); text-decoration: underline; text-underline-offset: .18em; }
.lic-cards { list-style: none; padding: 0; margin: var(--s5) 0 0; display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.lic-card { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--tenant, var(--accent)); border-radius: var(--radius); padding: var(--s4) var(--s4) var(--s3); box-shadow: var(--shadow); transition: transform 160ms var(--ease), box-shadow 160ms var(--ease); }
.lic-card:hover { transform: translateY(-2px); }
.lic-card header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin-bottom: var(--s2); }
.lic-name { font: 600 var(--t-lg)/1.2 var(--serif); color: var(--ink); text-decoration: none; display: block; }
.lic-name:hover { text-decoration: underline; }
.lic-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s3) 0; }
.runcmd { margin-top: var(--s2); }
.runcmd pre.fix { margin-bottom: var(--s2); }
.lic-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.lic-head h1 { margin: 0; }
.lic-key-block { margin: var(--s5) 0; padding: var(--s5) 0 var(--s4); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.lic-key-block details.big > summary .mono { font: 600 clamp(1.15rem, 3.4vw, 1.6rem)/1.2 var(--mono); letter-spacing: .05em; }
.lic-key-block details.big .copybox { max-width: 40rem; }
.lic-key-block details.big .copybox input { font-size: 1rem; letter-spacing: .03em; }
.lic-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--s6); align-items: start; }
.lic-side { border-left: 1px solid var(--rule); padding-left: var(--s5); }
.snippet { margin-top: var(--s4); }
.snippet pre.fix { border-left: 3px solid var(--accent); }
.trial-offer { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; border: 1px dashed var(--tenant, var(--accent)); background: color-mix(in srgb, var(--tenant, var(--accent)) 7%, var(--surface)); padding: var(--s4); border-radius: var(--radius); margin: 0 0 var(--s5); }
.trial-offer strong { display: block; font: 600 var(--t-lg)/1.2 var(--serif); }
.trial-offer .small { display: block; max-width: 36rem; }
.lic-strip { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); padding: var(--s3) 0; margin: 0 0 var(--s5); }
.lic-events li.ev-lease_denied .act, .lic-events li.ev-revoked .act, .lic-events li.ev-suspended .act { color: var(--bad); }
.lic-events li.ev-lease_recovered .act, .lic-events li.ev-resumed .act { color: var(--good); }
.lic-events li.ev-conflict .act { color: var(--warn); }
.lic-admin form + form { margin-top: var(--s3); }
@media (max-width: 860px) {
  .lic-grid { grid-template-columns: 1fr; }
  .lic-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: var(--s4); }
}
@media (prefers-reduced-motion: reduce) { .lic-card { transition: none; } .lic-card:hover { transform: none; } }
.lic-admin input[type="date"] { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: .55rem .7rem; }
details.runcmd > summary { cursor: pointer; color: var(--accent); font-size: var(--t-sm); text-decoration: underline; text-underline-offset: .18em; }
details.runcmd[open] > summary { margin-bottom: var(--s2); }
.lic-filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: end; max-width: none; }
.lic-filters .field { margin: 0; min-width: 11rem; }
.lic-filters .field.end { min-width: 0; }

/* Run 6 — API & webhooks, backups */
.page-head h1.h-url { font-size: 1.2rem; word-break: break-all; }
.api-docs .op { border-top: 1px solid var(--rule); padding: var(--s4) 0; }
.api-docs .op h3 { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; margin: 0 0 var(--s2); font-size: 1rem; }
.api-docs .verb { font: 700 .72rem/1 var(--mono); letter-spacing: .06em; padding: .3em .55em; border-radius: 4px; background: var(--accent-soft); }
.api-docs .verb.get { color: var(--good); } .api-docs .verb.post { color: var(--accent); } .api-docs .verb.patch, .api-docs .verb.delete { color: var(--warn); }
.api-docs .path { font-family: var(--mono); font-size: .95rem; }
.api-docs .try { margin-top: var(--s2); }
.api-docs .try textarea { font-family: var(--mono); font-size: .85rem; width: 100%; }
.api-docs .try pre { max-height: 22rem; overflow: auto; }
.api-docs .toc { columns: 2 14rem; font-size: .9rem; }
.api-docs .toc a { text-decoration: none; }
.h-wrap { word-break: break-all; }
.api-docs .try .btn { width: auto; }

/* ---------- Run 7: context help link ("?" on every screen) ---------- */
.help-link { display: inline-flex; align-items: center; gap: .4rem; font: 600 var(--t-xs)/1 var(--sans); color: var(--muted); text-decoration: none; letter-spacing: .04em; }
.help-link > span[aria-hidden] { display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%; border: 1px solid var(--rule-strong); font: 600 .82rem/1 var(--serif); color: var(--ink); background: var(--surface); transition: background-color 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease); }
.help-link:hover > span[aria-hidden], .help-link:focus-visible > span[aria-hidden] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.help-link:hover { color: var(--ink); }
.main { position: relative; }
.help-float { position: absolute; top: var(--s3); right: clamp(var(--s4), 4vw, var(--s8)); z-index: 2; }
.help-link.inline .help-link-text { display: none; }
.paybar-nav .help-link { margin-left: var(--s2); }

/* ---------- Run 7: help pages ---------- */
body.help { display: flex; flex-direction: column; min-height: 100vh; }
.helpbar { display: grid; grid-template-columns: auto minmax(12rem, 26rem) 1fr; gap: var(--s4) var(--s5); align-items: center; padding: var(--s4) clamp(var(--s4), 4vw, var(--s7)); border-bottom: 2px solid var(--ink); background: var(--surface); }
.helpbar .brand { margin: 0; }
.help-search { display: flex; gap: var(--s2); }
.help-search input { padding: .5rem .65rem; }
.helpbar-nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); justify-content: flex-end; font-size: var(--t-sm); }
.helpbar-nav a { color: var(--ink-2); text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.helpbar-nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.helpbar-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.helpmain { flex: 1; width: 100%; max-width: 82rem; margin: 0 auto; padding: var(--s6) clamp(var(--s4), 4vw, var(--s7)) var(--s8); }
.helpfoot { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s4) clamp(var(--s4), 4vw, var(--s7)); border-top: 1px solid var(--rule); font-size: var(--t-xs); color: var(--muted); }
.help-hero { max-width: 48rem; margin-bottom: var(--s6); }
.help-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -.02em; }
.help-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0; border-top: 1px solid var(--ink); }
.help-card { padding: var(--s5) var(--s5) var(--s5) 0; border-bottom: 1px solid var(--rule); }
.help-card h2 { font-size: var(--t-xl); margin-bottom: var(--s2); }
.help-card h2 a { color: var(--ink); text-decoration: none; }
.help-card h2 a:hover { text-decoration: underline; }
.help-card > p.muted { font-size: var(--t-sm); }
.help-list { list-style: none; margin: 0; padding: 0; font-size: var(--t-sm); }
.help-list li { padding: .3rem 0; border-top: 1px dotted var(--rule); }
.help-list li.more a { color: var(--muted); }
.crumbs { font-size: var(--t-xs); color: var(--muted); margin-bottom: var(--s3); letter-spacing: .03em; }
.crumbs a { color: var(--muted); }
.help-head { margin-bottom: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--rule); }
.help-head h1 { font-size: clamp(1.9rem, 4vw, var(--t-3xl)); margin-bottom: var(--s2); }
.help-toc-list { list-style: none; margin: 0; padding: 0; max-width: 52rem; }
.help-toc-list li { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.help-toc-list a { display: flex; gap: var(--s4); align-items: baseline; color: var(--ink); text-decoration: none; font-size: var(--t-lg); }
.help-toc-list a strong { font: 600 var(--t-lg)/1.25 var(--serif); }
.help-toc-list a:hover strong { text-decoration: underline; text-underline-offset: .18em; }
.help-toc-list .n { font: 400 var(--t-sm)/1 var(--mono); color: var(--muted); min-width: 2ch; }
.help-toc-list p { margin: var(--s1) 0 0 calc(2ch + var(--s4) + .4rem); color: var(--ink-2); font-size: var(--t-sm); }
.help-doc { display: grid; grid-template-columns: 14rem minmax(0, 1fr) 13rem; gap: var(--s6); align-items: start; }
.help-side, .help-toc { position: sticky; top: var(--s4); max-height: calc(100vh - 2rem); overflow-y: auto; font-size: var(--t-sm); }
.help-side .nav-head, .help-toc .nav-head { margin: 0 0 var(--s2); }
.help-side .nav-head a { color: var(--muted); text-decoration: none; }
.help-side-list, .help-toc ul { list-style: none; margin: 0; padding: 0; }
.help-side-list a { display: block; padding: .32rem .5rem; color: var(--ink-2); text-decoration: none; border-left: 2px solid var(--rule); }
.help-side-list a:hover { color: var(--ink); border-left-color: var(--rule-strong); background: var(--sunk); }
.help-side-list a[aria-current] { color: var(--ink); font-weight: 600; border-left-color: var(--accent); }
.help-toc li { padding: .18rem 0; }
.help-toc li.lvl3 { padding-left: var(--s3); font-size: var(--t-xs); }
.help-toc a { color: var(--ink-2); text-decoration: none; }
.help-toc a:hover { color: var(--accent); text-decoration: underline; }
.help-article { min-width: 0; max-width: 46rem; }
.pager-help { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-top: var(--s7); padding-top: var(--s4); border-top: 2px solid var(--ink); }
.pager-help a { display: grid; gap: .15rem; text-decoration: none; color: var(--ink); padding: var(--s3); border: 1px solid var(--rule); border-radius: var(--radius); transition: border-color 140ms var(--ease), transform 140ms var(--ease); }
.pager-help a:hover { border-color: var(--ink); transform: translateY(-1px); }
.pager-help a strong { font-family: var(--serif); font-size: var(--t-lg); }
.pager-help .next { text-align: right; grid-column: 2; }
.search-hits { list-style: none; margin: 0; padding: 0; max-width: 48rem; }
.search-hits li { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.search-hits a strong { font: 600 var(--t-lg)/1.3 var(--serif); }
.search-hits p { margin: var(--s1) 0 0; font-size: var(--t-sm); color: var(--ink-2); }
mark { background: color-mix(in srgb, var(--warn) 28%, transparent); color: inherit; padding: 0 .1em; border-radius: 2px; }

/* prose: rendered Markdown (help, previews) */
.prose { font-size: 1.02rem; line-height: 1.65; }
.prose h2 { font-size: var(--t-xl); margin: var(--s7) 0 var(--s3); padding-top: var(--s3); border-top: 1px solid var(--rule); scroll-margin-top: var(--s4); }
.prose h3 { font-size: var(--t-lg); margin: var(--s5) 0 var(--s2); scroll-margin-top: var(--s4); }
.prose h4 { font: 600 var(--t-md)/1.3 var(--sans); margin: var(--s4) 0 var(--s2); }
.prose > h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose .h-anchor { margin-left: .4rem; color: var(--rule-strong); text-decoration: none; font-family: var(--sans); font-size: .8em; opacity: 0; transition: opacity 140ms var(--ease); }
.prose h2:hover .h-anchor, .prose h3:hover .h-anchor, .prose .h-anchor:focus-visible { opacity: 1; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 var(--s4); }
.prose li { margin: .25rem 0; }
.prose li > ul, .prose li > ol { margin: .25rem 0 .4rem; }
.prose ol > li::marker { font-family: var(--mono); font-size: .88em; color: var(--muted); }
.prose code { font-size: .86em; }
.prose pre.code { background: var(--sunk); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s3) var(--s4); overflow-x: auto; font: .84rem/1.55 var(--mono); margin: 0 0 var(--s4); }
.prose pre.code code { background: none; padding: 0; font-size: inherit; }
.prose pre.code[data-lang]::before { content: attr(data-lang); display: block; font: 600 .66rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s2); }
.prose blockquote { margin: 0 0 var(--s4); padding: var(--s2) var(--s4); border-left: 3px solid var(--rule-strong); color: var(--ink-2); }
.prose .table-wrap { margin: 0 0 var(--s4); border-top: 1px solid var(--ink); }
table.doc-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.doc-table th { text-align: left; font-weight: 600; font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule-strong); vertical-align: bottom; }
.doc-table td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); vertical-align: top; }
.doc-table .t-right { text-align: right; } .doc-table .t-center { text-align: center; }
.callout { margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.callout.tip { border-color: var(--ink-2); background: var(--sunk); }
.callout > :last-child { margin-bottom: 0; }
.callout-label { font: 600 var(--t-xs)/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s1) !important; }
.broken-link { border-bottom: 1px dashed var(--bad); }
.included > h2:first-child { margin-top: var(--s5); }

/* diagrams: hand-authored SVG themed by the palette */
figure.diagram { margin: var(--s5) 0; padding: var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
figure.diagram svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
figure.diagram figcaption { margin-top: var(--s3); font-size: var(--t-xs); color: var(--muted); letter-spacing: .03em; }
.diagram-text summary { cursor: pointer; font-size: var(--t-xs); color: var(--muted); margin-top: var(--s2); }
.diagram-text p { font-size: var(--t-sm); margin: var(--s2) 0 0; }
.dg-box { fill: var(--surface); stroke: var(--rule-strong); stroke-width: 1.2; }
.dg-box.ink { fill: var(--ink); stroke: var(--ink); }
.dg-box.accent { fill: var(--accent-soft); stroke: var(--accent); }
.dg-box.good { fill: var(--good-soft); stroke: var(--good); }
.dg-box.warn { fill: var(--warn-soft); stroke: var(--warn); }
.dg-box.bad { fill: var(--bad-soft); stroke: var(--bad); }
.dg-box.dashed { stroke-dasharray: 5 4; fill: none; }
.dg-t { fill: var(--ink); font-size: 13px; font-weight: 600; }
.dg-t.inv { fill: var(--paper); }
.dg-s { fill: var(--muted); font-size: 11px; }
.dg-s.inv { fill: color-mix(in srgb, var(--paper) 70%, transparent); }
.dg-mono { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); }
.dg-line { stroke: var(--ink-2); stroke-width: 1.3; fill: none; }
.dg-line.soft { stroke: var(--rule-strong); stroke-dasharray: 4 4; }
.dg-line.accent { stroke: var(--accent); stroke-width: 1.8; }
.dg-line.bad { stroke: var(--bad); }
.dg-arrow { fill: var(--ink-2); }
.dg-arrow.accent { fill: var(--accent); }
.dg-arrow.bad { fill: var(--bad); }
.dg-zone { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 4; }
.dg-zone-label { fill: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

/* printable section */
.help-print { max-width: 46rem; margin: 0 auto; }
.print-toc { columns: 2; font-size: var(--t-sm); margin-bottom: var(--s6); }
.print-page { margin-top: var(--s7); padding-top: var(--s5); border-top: 2px solid var(--ink); }
.print-title { font-size: var(--t-2xl); }

/* help editor */
.editor-cols { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
textarea.md-editor { font: .86rem/1.55 var(--mono); min-height: 32rem; tab-size: 4; }
.preview-pane { border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s4); background: var(--surface); max-height: 44rem; overflow: auto; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s4); font-size: var(--t-sm); margin: 0 0 var(--s4); }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
label.check { display: flex; gap: var(--s2); align-items: baseline; font-size: var(--t-sm); margin-bottom: var(--s2); }

@media (max-width: 1180px) {
  .help-doc { grid-template-columns: 13rem minmax(0, 1fr); }
  .help-toc { display: none; }
}
@media (max-width: 820px) {
  .helpbar { grid-template-columns: 1fr; }
  .helpbar-nav { justify-content: flex-start; }
  .help-doc { grid-template-columns: 1fr; }
  .help-side { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: var(--s3); }
  .help-side-list { display: flex; flex-wrap: wrap; gap: var(--s1); }
  .help-side-list a { border: 1px solid var(--rule); border-radius: 99px; padding: .2rem .6rem; font-size: var(--t-xs); }
  .help-float { position: static; display: inline-flex; margin: 0 0 var(--s3); }
  .print-toc { columns: 1; }
  .pager-help { grid-template-columns: 1fr; }
  .pager-help .next { grid-column: 1; }
}
@media print {
  .helpbar, .helpfoot, .help-side, .help-toc, .pager-help, .crumbs, .noprint, .help-link, .h-anchor { display: none !important; }
  .helpmain { padding: 0; max-width: none; }
  .help-doc { display: block; }
  .prose { font-size: 10.5pt; }
  .prose a { color: #000; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #555; }
  figure.diagram, pre.code, table.doc-table, .callout { break-inside: avoid; }
  .print-page { break-before: page; border-top: 0; }
  details.diagram-text { display: block; }
  details.diagram-text > p { display: block; }
}
.help-toc a[aria-current] { color: var(--ink); font-weight: 600; }
.events-list { columns: 2; column-gap: var(--s5); list-style: none; padding: 0; font-size: var(--t-sm); } .events-list li { break-inside: avoid; padding: .1rem 0; } @media (max-width: 820px) { .events-list { columns: 1; } }

/* Run 10 — two-step sign-in */
.mfa-setup { display: flex; gap: var(--s5); align-items: flex-start; flex-wrap: wrap; margin: var(--s4) 0; }
.mfa-qr { background: #fff; padding: var(--s2); border-radius: 6px; border: 1px solid var(--rule); line-height: 0; flex: none; }
.mfa-qr svg { width: 196px; height: 196px; }
.mfa-steps { margin: 0; padding-left: 1.2rem; max-width: 34rem; font-size: var(--t-sm); }
.mfa-steps li { margin-bottom: var(--s3); }
.mfa-secret { display: block; margin: var(--s2) 0; padding: var(--s2) var(--s3); background: var(--sunk); border-radius: 4px; font-size: 1rem; letter-spacing: .06em; word-break: break-all; user-select: all; }
.code-input { font-size: 1.25rem; letter-spacing: .18em; max-width: 14rem; }
.recovery-codes { columns: 2; column-gap: var(--s6); padding-left: 1.6rem; font-size: 1.05rem; margin: var(--s4) 0; }
.recovery-codes li { margin-bottom: var(--s2); }
@media print { .recovery-codes { columns: 2; } }

/* Run 11 — payee forms */
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s2); margin-top: var(--s2); }
input.short { max-width: 8rem; }
fieldset.field input + input { margin-top: var(--s2); }
fieldset.field .row3 input + input { margin-top: 0; }
.inline-form input:not([type]), .inline-form input[type="password"] { width: auto; min-width: 12rem; padding: .4rem .6rem; }
.table-wrap + .section, table + .section { margin-top: var(--s6); }
@media (max-width: 560px) { .row3 { grid-template-columns: 1fr; } }
