:root {
  /* Layout idea: a bound ledger. Ruled statements on paper, purple ink for totals,
     a brass wash on every cell you can type in, accounting rules (single above a total, double under the net). */
  color-scheme: light;
  --paper: #f5f2f8;
  --surface: #fdfcfe;
  --ink: #1c1626;
  --ink-2: #554b63;
  --muted: #7f758d;
  --line: #e0dae8;
  --line-strong: #c9c1d4;
  --accent: #5b2e91;
  --accent-soft: #e9e0f5;
  --series: #6f42b5;
  --on-accent: #ffffff;
  --input: #fbf2d4;
  --input-line: #e3cf8f;
  --good: #18652a;
  --good-fill: #0ca30c;
  --good-soft: #dff1df;
  --warn: #7a5200;
  --warn-fill: #fab219;
  --warn-soft: #fdf0cf;
  --bad: #b3261e;
  --bad-fill: #d03b3b;
  --bad-soft: #f8dedc;
  --font-display: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15111b;
    --surface: #1e1827;
    --ink: #f0ebf6;
    --ink-2: #c5bcd1;
    --muted: #9087a0;
    --line: #332b3f;
    --line-strong: #4a4058;
    --accent: #b18be6;
    --accent-soft: #34274a;
    --series: #9a76d8;
    --on-accent: #1a1026;
    --input: #3a3114;
    --input-line: #6b5a1f;
    --good: #5fcf6c;
    --good-fill: #0ca30c;
    --good-soft: #1b3320;
    --warn: #fab219;
    --warn-fill: #fab219;
    --warn-soft: #3b2f10;
    --bad: #f07b72;
    --bad-fill: #d03b3b;
    --bad-soft: #3d1c1a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15111b;
  --surface: #1e1827;
  --ink: #f0ebf6;
  --ink-2: #c5bcd1;
  --muted: #9087a0;
  --line: #332b3f;
  --line-strong: #4a4058;
  --accent: #b18be6;
  --accent-soft: #34274a;
    --series: #9a76d8;
  --on-accent: #1a1026;
  --input: #3a3114;
  --input-line: #6b5a1f;
  --good: #5fcf6c;
  --good-fill: #0ca30c;
  --good-soft: #1b3320;
  --warn: #fab219;
  --warn-fill: #fab219;
  --warn-soft: #3b2f10;
  --bad: #f07b72;
  --bad-fill: #d03b3b;
  --bad-soft: #3d1c1a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.shell { max-width: 1120px; margin: 0 auto; padding: 28px 20px 56px; display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* masthead */
.mast { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-end; padding-bottom: 14px; border-bottom: 3px double var(--line-strong); }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.mast h1 { font-size: clamp(28px, 4.6vw, 42px); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; margin-top: 4px; }
.mast h1 span { color: var(--accent); font-weight: 500; }
.mast-sub { color: var(--ink-2); margin-top: 6px; }
.mast-status { font-size: 13px; font-weight: 500; padding: 5px 10px 5px 26px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); position: relative; white-space: nowrap; }
.mast-status::before { content: ""; position: absolute; left: 10px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--muted); }
.mast-status.live::before { background: var(--good-fill); }
.mast-status.ro::before { background: var(--warn-fill); }
.mast-status.off::before { background: var(--bad-fill); }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line-strong); }
.tabs a { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--ink-2); text-decoration: none; padding: 8px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.notice { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); }
.notice[hidden] { display: none; }
.notice.warn { background: var(--warn-soft); border-color: var(--warn-fill); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad-fill); }
.notice.good { background: var(--good-soft); border-color: var(--good-fill); }

main { display: flex; flex-direction: column; gap: 20px; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sheet-head { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: baseline; }
.sheet h2 { font-size: 21px; font-weight: 600; }
.sheet h3 { font-size: 17px; font-weight: 600; }
.hint { color: var(--ink-2); font-size: 13.5px; max-width: 70ch; }
.label { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.nil { color: var(--muted); }

/* hero */
.hero { display: grid; grid-template-columns: minmax(260px, 1.1fr) 2fr; gap: 20px; }
.hero-main { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 6px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.hero-figure { font-size: clamp(44px, 6vw, 58px); font-weight: 600; line-height: 1.05; letter-spacing: -.02em; }
.hero-figure.neg { color: var(--bad); }
.hero-sub { color: var(--ink-2); }
.hero-actual { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile-value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.tile-sub { color: var(--ink-2); font-size: 13px; }

/* meters */
.meter { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--series); min-width: 0; }
.meter.s-warn { background: var(--warn-soft); } .meter.s-warn .meter-fill { background: var(--warn-fill); }
.meter.s-bad { background: var(--bad-soft); } .meter.s-bad .meter-fill { background: var(--bad-fill); }
.meter.s-good { background: var(--good-soft); } .meter.s-good .meter-fill { background: var(--good-fill); }
.meter-list { display: grid; grid-template-columns: minmax(120px, 190px) minmax(80px, 1fr) auto; gap: 10px 16px; align-items: center; }
.meter-list .fig { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.pill.bad { background: var(--bad-soft); border-color: var(--bad-fill); color: var(--bad); }
.pill.good { background: var(--good-soft); border-color: var(--good-fill); color: var(--good); }
.pill.warn { background: var(--warn-soft); border-color: var(--warn-fill); color: var(--warn); }

/* seat rail */
.rail { position: relative; padding: 30px 0 30px; }
.rail-track { position: relative; height: 12px; border-radius: 999px; background: var(--accent-soft); }
.rail-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--series); }
.rail-mark { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); }
.rail-mark span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12.5px; font-weight: 500; color: var(--ink); }
.rail-mark.up span { bottom: calc(100% + 4px); }
.rail-mark.down span { top: calc(100% + 4px); }
.rail-mark.edge-l span { left: 0; transform: none; }
.rail-mark.edge-r span { left: auto; right: 0; transform: none; }
.rail-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; }

/* ledger tables */
.scroll { overflow-x: auto; }
table.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { padding: 7px 10px; text-align: left; vertical-align: middle; }
.ledger thead th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ledger tbody tr + tr td, .ledger tbody tr + tr th { border-top: 1px solid var(--line); }
.ledger th[scope="row"] { font-weight: 400; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger tr.sec th { font-family: var(--font-display); font-size: 16px; font-weight: 600; padding-top: 16px; border-top: none; color: var(--ink); text-transform: none; letter-spacing: 0; }
.ledger tr.sec + tr td, .ledger tr.sec + tr th { border-top: 1px solid var(--line-strong); }
.ledger tr.total th, .ledger tr.total td { font-weight: 600; border-top: 1px solid var(--ink); }
.ledger tr.net th, .ledger tr.net td { font-weight: 600; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); background: var(--accent-soft); }
.ledger tr.sub th, .ledger tr.sub td { color: var(--ink-2); }
.ledger tr.dim th, .ledger tr.dim td { color: var(--muted); }
.ledger .note { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; max-width: 46ch; white-space: normal; }
.ledger .neg { color: var(--bad); }
.ledger .pos { color: var(--good); }
.ledger td.act { white-space: nowrap; text-align: right; }
.ledger tr.editor td { background: var(--paper); }

/* inputs */
input, select, button, textarea { font: inherit; color: inherit; }
.cell { width: 100%; min-width: 76px; text-align: right; background: var(--input); border: 1px solid var(--input-line); border-radius: 4px; padding: 5px 7px; font-variant-numeric: tabular-nums; }
.cell.txt { text-align: left; }
.cell.narrow { min-width: 56px; max-width: 84px; }
select.cell { text-align: left; padding-right: 4px; }
.cell:disabled { background: transparent; border-color: transparent; color: inherit; opacity: 1; -webkit-text-fill-color: currentColor; }
.entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; align-items: end; }
.entry .wide { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field input, .field select { width: 100%; background: var(--input); border: 1px solid var(--input-line); border-radius: 4px; padding: 8px 9px; min-height: 38px; }
.form-foot { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.form-error { color: var(--bad); font-size: 13.5px; font-weight: 500; }
.btn { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: 4px; padding: 8px 16px; font-weight: 600; cursor: pointer; min-height: 38px; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; color: var(--ink-2); border-color: var(--line-strong); font-weight: 500; }
.btn.danger { background: var(--bad-fill); border-color: var(--bad-fill); color: #ffffff; }
.btn.sm { padding: 3px 10px; min-height: 28px; font-size: 13px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--accent); width: fit-content; }
details.more[open] > summary { margin-bottom: 12px; }
.who { color: var(--muted); font-size: 12.5px; }

/* figures list (break-even) */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px 32px; }
.figs h3 { padding-bottom: 6px; border-bottom: 1px solid var(--line-strong); }
.figs dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 0; font-variant-numeric: tabular-nums; }
.figs dt, .figs dd { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
.figs dt small { display: block; color: var(--muted); font-size: 12.5px; }
.figs dd { text-align: right; font-weight: 500; padding-left: 16px; white-space: nowrap; }
.figs dl .key { font-weight: 600; }
.figs dd.key { font-size: 17px; }
.assume { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }

/* chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .zero { stroke: var(--ink-2); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--ink-2); font-size: 12.5px; font-family: var(--font-body); }
.chart .series { stroke: var(--series); stroke-width: 2; fill: none; stroke-linecap: round; }
.chart .wash-profit { fill: var(--series); opacity: .1; }
.chart .wash-loss { fill: var(--bad-fill); opacity: .1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.be { fill: var(--ink); }
.chart .dot.bud { fill: var(--series); }
.chart .dot.sold { fill: var(--good-fill); }
.chart .dlabel { fill: var(--ink); font-size: 12.5px; font-weight: 500; font-family: var(--font-body); }
.chart .zone { fill: var(--muted); font-size: 12px; font-family: var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; visibility: hidden; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .14); min-width: 190px; visibility: hidden; font-variant-numeric: tabular-nums; }
.tip strong { display: block; font-size: 16px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tip div span:last-child { color: var(--ink); }

footer { color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line-strong); padding-top: 12px; }
.state { padding: 36px 20px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 12px; align-items: center; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .shell { padding: 18px 16px 40px; }
  .tiles { grid-template-columns: 1fr; }
  .meter-list { grid-template-columns: 1fr auto; }
  .meter-list .meter { grid-column: 1 / -1; grid-row: auto; }
  .entry .wide { grid-column: auto; }
  .sheet { padding: 14px 14px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .meter-fill, .rail-fill { transition: width .35s ease; }
}

/* sign-in gate, account box, people */
.userbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.userbox .who-am { font-size: 13px; color: var(--ink-2); }
.gate { max-width: 520px; margin: 24px auto; text-align: center; }
.gate h2 { font-size: 24px; }
.gate .btn { min-width: 220px; }
.gate code { font-family: inherit; font-weight: 600; overflow-wrap: anywhere; }
.tabs a[hidden] { display: none; }
.field input[type="file"] { padding: 6px; }
