/* GEA Dashboard: "school register" direction.
   Ink-navy spine, cool paper, school green for money in, ochre for spending
   and part payments, red pen for overdue. Young Serif for titles and figures,
   Hanken Grotesk for everything else. */

:root {
  color-scheme: light;
  --paper: #f6f7f4;
  --sheet: #ffffff;
  --ink: #16233b;
  --ink-2: #44506a;
  --ink-3: #6b7588;
  --rule: #dde2dc;
  --rule-strong: #c4ccc5;
  --spine: #16233b;
  --spine-ink: #e8ecf3;
  --spine-dim: #9aa6bd;

  --green: #00845f;      --green-wash: #e2f2ea;  --green-ink: #005c42;
  --ochre: #c27c0e;      --ochre-wash: #fbefd6;  --ochre-ink: #7a4c00;
  --amber: #d9692b;      --amber-wash: #fbe6da;  --amber-ink: #8f3a0d;
  --redpen: #c2372b;     --redpen-wash: #f8e1de; --redpen-ink: #94231a;
  --empty: #eceee9;

  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #10151c; --sheet: #141b22;
    --ink: #e9edf2; --ink-2: #b7c0cc; --ink-3: #8691a1;
    --rule: #26303b; --rule-strong: #35414e;
    --spine: #0b1016; --spine-ink: #e9edf2; --spine-dim: #7d899b;
    --green: #21a47a; --green-wash: #11322a; --green-ink: #6fd3ad;
    --ochre: #c27c0e; --ochre-wash: #3a2a0e; --ochre-ink: #f0bd61;
    --amber: #e07d45; --amber-wash: #3b2116; --amber-ink: #f3a57a;
    --redpen: #e0574b; --redpen-wash: #3d1a18; --redpen-ink: #f59a91;
    --empty: #1f2731;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10151c; --sheet: #141b22;
  --ink: #e9edf2; --ink-2: #b7c0cc; --ink-3: #8691a1;
  --rule: #26303b; --rule-strong: #35414e;
  --spine: #0b1016; --spine-ink: #e9edf2; --spine-dim: #7d899b;
  --green: #21a47a; --green-wash: #11322a; --green-ink: #6fd3ad;
  --ochre: #c27c0e; --ochre-wash: #3a2a0e; --ochre-ink: #f0bd61;
  --amber: #e07d45; --amber-wash: #3b2116; --amber-ink: #f3a57a;
  --redpen: #e0574b; --redpen-wash: #3d1a18; --redpen-ink: #f59a91;
  --empty: #1f2731;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
button, select, input { font: inherit; color: inherit; }
a { color: var(--green-ink); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.num, .fig-value, td.r { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-3); font-size: 13px; font-weight: 400; }
code { background: var(--empty); padding: 1px 5px; border-radius: var(--r-sm); }

/* ---------- spine (sidebar) ---------- */
.spine { position: sticky; top: 0; height: 100vh; background: var(--spine); color: var(--spine-ink); display: flex; flex-direction: column; padding: 28px 18px 20px; gap: 28px; }
.crest { display: grid; gap: 10px; padding: 0 8px; }
.crest-mark { font-family: var(--serif); font-size: 34px; line-height: 1; letter-spacing: 1px; }
.crest-mark span { color: #f0bd61; }
.crest-name { font-size: 13px; color: var(--spine-dim); line-height: 1.35; }
.month-pick { display: grid; gap: 6px; padding: 0 8px; font-size: 13px; color: var(--spine-dim); }
.month-pick select { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: var(--r-md); color: var(--spine-ink); padding: 9px 10px; font-weight: 600; font-size: 15px; }
.month-pick select option { color: #16233b; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: var(--r-md); color: var(--spine-dim); text-decoration: none; font-weight: 500; }
.nav-item:hover { color: var(--spine-ink); background: rgba(255,255,255,.05); }
.nav-item[aria-current="page"] { color: var(--spine-ink); background: rgba(255,255,255,.09); box-shadow: inset 3px 0 0 #f0bd61; }
.nav-count { font-size: 12px; color: var(--spine-dim); font-variant-numeric: tabular-nums; }
.spine-foot { margin-top: auto; display: grid; gap: 6px; padding: 0 8px; font-size: 12px; color: var(--spine-dim); }
.btn-quiet { justify-self: start; background: none; border: 0; padding: 0; color: #f0bd61; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-quiet:hover { text-decoration: underline; }

/* ---------- main ---------- */
.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: flex-end; align-items: center; padding: 14px 44px 0; max-width: 1280px; width: 100%; margin-inline: auto; }
.topbar { gap: 14px; }
.signout { background: none; border: 0; color: var(--ink-3); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 4px; }
.signout:hover { color: var(--ink); text-decoration: underline; }
.theme-toggle { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 99px; background: var(--sheet); padding: 2px; }
.theme-toggle button { border: 0; background: none; padding: 5px 13px; border-radius: 99px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; min-height: 28px; }
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }
main { padding: 22px 44px 80px; max-width: 1280px; width: 100%; margin-inline: auto; display: grid; gap: 40px; align-content: start; outline: none; }
.loading, .empty { color: var(--ink-3); padding: 24px 0; }
.page-head { display: grid; gap: 2px; }
.page-title { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.15; margin: 0; letter-spacing: -.3px; }
.page-head + .block, .page-head + .figures { margin-top: -16px; }
.banner { background: var(--ochre-wash); color: var(--ochre-ink); border-left: 3px solid var(--ochre); padding: 12px 16px; border-radius: 0 var(--r-md) var(--r-md) 0; font-size: 14px; max-width: 80ch; }

/* hero: this month's register */
.hero { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 30px 32px; display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; gap: 40px; align-items: start; }
.hero-title { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -.6px; margin: 0 0 14px; }
.hero-sub { color: var(--ink-2); margin: 0 0 22px; max-width: 46ch; }
.meter { height: 10px; background: var(--empty); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.meter-scale { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.register { display: grid; gap: 7px; }
.reg-class { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; }
.reg-label { background: none; border: 0; padding: 1px 0 0; text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.reg-label:hover { color: var(--ink); text-decoration: underline; }
.reg-cells { display: flex; flex-wrap: wrap; gap: 4px; }
.reg-cell { width: 18px; height: 18px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; background: var(--empty); display: inline-block; flex: none; }
.reg-cell.full { background: var(--green); }
.reg-cell.part { background: var(--ochre); }
.reg-cell.none { background: var(--empty); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.reg-cell.late { background: var(--sheet); box-shadow: inset 0 0 0 2px var(--redpen); }
button.reg-cell:hover { transform: scale(1.18); }
.reg-key { list-style: none; margin: 10px 0 0 62px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--ink-3); }
.reg-key li { display: flex; align-items: center; gap: 6px; }
.reg-key .reg-cell { width: 12px; height: 12px; border-radius: 3px; cursor: default; }

/* figures: a ruled strip rather than a row of cards */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.fig { display: grid; gap: 4px; padding: 16px 20px 18px 0; align-content: start; }
.fig + .fig { padding-left: 20px; border-left: 1px solid var(--rule); }
.fig-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.fig-value { font-family: var(--serif); font-size: 30px; line-height: 1.1; white-space: nowrap; }
.fig-value small { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-3); margin-right: 5px; }
.fig-sub { font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.fig.bad .fig-value { color: var(--redpen-ink); }
.fig.warn .fig-value { color: var(--ochre-ink); }

/* blocks */
.block { display: grid; gap: 14px; min-width: 0; }
.block.split { grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 48px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.block-head h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0; }
.block-head p { margin: 0; font-size: 14px; flex: 1 1 260px; }
.push { margin-left: auto; }
.note { font-size: 13px; color: var(--ink-3); margin: 0; max-width: 80ch; }
.link { background: none; border: 0; padding: 0; color: var(--green-ink); font-weight: 600; cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }

/* chart */
.chart svg { display: block; width: 100%; }
.chart .gridline { stroke: var(--rule); }
.chart .baseline { stroke: var(--rule-strong); stroke-width: 1.5; }
.chart .axis { fill: var(--ink-3); font: 12px var(--sans); font-variant-numeric: tabular-nums; }
.chart .axis-now { fill: var(--ink); font-weight: 700; }
.chart .bar-in { fill: var(--green); }
.chart .bar-out { fill: var(--ochre); }
.chart .bar-label { fill: var(--ink-2); font: 600 12px var(--sans); }
.chart .hit:hover rect { fill: var(--empty); fill-opacity: .6; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; font-size: 13px; color: var(--ink-2); }
.chart-legend li { display: flex; align-items: center; gap: 7px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; }
.swatch.in { background: var(--green); } .swatch.out { background: var(--ochre); }

/* status */
.status-list { display: grid; gap: 2px; }
.status-row { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: 12px; padding: 9px 6px; background: none; border: 0; border-bottom: 1px solid var(--rule); cursor: pointer; text-align: left; }
.status-row:hover { background: var(--sheet); }
.status-row b { text-align: right; font-variant-numeric: tabular-nums; font-size: 16px; }
.status-bar { height: 8px; background: var(--empty); border-radius: 99px; overflow: hidden; }
.status-bar span { display: block; height: 100%; border-radius: 99px; }
.seg-paid { background: var(--green); } .seg-due { background: var(--ochre); } .seg-overdue { background: var(--amber); } .seg-critical { background: var(--redpen); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill-icon { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 99px; font-size: 11px; font-weight: 800; color: #fff; }
.pill-paid { background: var(--green-wash); color: var(--green-ink); } .pill-paid .pill-icon { background: var(--green); }
.pill-due { background: var(--ochre-wash); color: var(--ochre-ink); } .pill-due .pill-icon { background: var(--ochre); }
.pill-overdue { background: var(--amber-wash); color: var(--amber-ink); } .pill-overdue .pill-icon { background: var(--amber); }
.pill-critical { background: var(--redpen-wash); color: var(--redpen-ink); } .pill-critical .pill-icon { background: var(--redpen); }
.tag-missing { color: var(--ochre-ink); background: var(--ochre-wash); padding: 1px 7px; border-radius: var(--r-sm); font-size: 13px; }

/* controls */
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 14px; }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field.grow { flex: 1 1 260px; }
.field input, .field select { background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--r-md); padding: 9px 11px; font-weight: 400; font-size: 15px; min-height: 42px; }
.field input:focus, .field select:focus { border-color: var(--green); outline: 2px solid color-mix(in srgb, var(--green) 25%, transparent); outline-offset: 0; }
.btn { background: var(--ink); color: var(--paper); border: 0; border-radius: var(--r-md); padding: 0 16px; min-height: 42px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--ink-2); }
.result-count { margin: 0; font-size: 13px; color: var(--ink-3); }
.seg-toggle { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r-md); overflow: hidden; min-height: 42px; }
.seg-toggle button { background: var(--sheet); border: 0; padding: 0 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.seg-toggle button + button { border-left: 1px solid var(--rule-strong); }
.seg-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }
.key { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); align-self: center; }
.key li { display: flex; align-items: center; gap: 6px; }
.k { width: 18px; height: 14px; border-radius: 3px; border: 1px solid var(--rule); }
.k.full { background: var(--green-wash); } .k.part { background: var(--ochre-wash); } .k.miss { background: var(--redpen-wash); } .k.na { background: var(--sheet); }

/* tables: ruled ledger */
.table-wrap { overflow: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-md); max-height: 72vh; }
.table-wrap.tall { max-height: 76vh; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 2; background: var(--sheet); text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-3); padding: 11px 12px 9px; white-space: nowrap; border-bottom: 2px solid var(--ink); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table td.name { font-weight: 600; }
.nowrap { white-space: nowrap; }
.clickable { cursor: pointer; }
.clickable:hover td, .clickable:focus-visible td { background: color-mix(in srgb, var(--green) 6%, var(--sheet)); }
.clickable:focus-visible { outline: none; }
.table tfoot td { position: sticky; bottom: 0; background: var(--sheet); font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.table tfoot tr + tr td { position: static; font-weight: 600; border-top: 1px solid var(--rule); }
.grid td.cell { font-size: 13px; padding: 9px 8px; }
.grid .sticky-col { position: sticky; left: 0; background: var(--sheet); z-index: 1; min-width: 180px; }
.grid th.sticky-col { z-index: 3; }
.grid tfoot td.sticky-col { z-index: 3; }
.grid th.now { color: var(--ink); }
.grid th.now, .grid td.now { box-shadow: inset 2px 0 0 var(--ink), inset -2px 0 0 var(--ink); }
.cell.full { background: var(--green-wash); color: var(--green-ink); }
.cell.part { background: var(--ochre-wash); color: var(--ochre-ink); }
.cell.miss { background: var(--redpen-wash); color: var(--redpen-ink); }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(16, 24, 40, .38); display: flex; justify-content: flex-end; }
.drawer-backdrop[hidden] { display: none; }
.drawer { width: min(520px, 100%); height: 100%; overflow: auto; background: var(--sheet); padding: 32px 30px; position: relative; border-left: 1px solid var(--rule); animation: slide-in .22s cubic-bezier(.2,.7,.2,1); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--sheet); cursor: pointer; }
.drawer-title { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.15; margin: 0 40px 4px 0; }
.drawer p { margin: 4px 0; }
.drawer h3 { font-family: var(--serif); font-weight: 400; font-size: 18px; margin: 26px 0 10px; }
.drawer-figs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); margin-top: 18px; }
.drawer-figs div { display: grid; gap: 2px; padding: 12px 10px 12px 0; }
.drawer-figs div + div { padding-left: 12px; border-left: 1px solid var(--rule); }
.drawer-figs b { font-family: var(--serif); font-weight: 400; font-size: 19px; }
.drawer-figs span { font-size: 12px; color: var(--ink-3); }
.strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.strip-cell { border-radius: var(--r-sm); padding: 7px 4px; text-align: center; display: grid; gap: 1px; font-size: 12px; background: var(--empty); color: var(--ink-3); }
.strip-cell b { font-size: 13px; font-variant-numeric: tabular-nums; }
.strip-cell.full { background: var(--green-wash); color: var(--green-ink); }
.strip-cell.part { background: var(--ochre-wash); color: var(--ochre-ink); }
.strip-cell.miss { background: var(--redpen-wash); color: var(--redpen-ink); }
.details { display: grid; grid-template-columns: 128px 1fr; gap: 8px 14px; margin: 0; }
.details dt { color: var(--ink-3); }
.details dd { margin: 0; }

.tooltip { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; background: var(--ink); color: var(--paper); padding: 8px 11px; border-radius: var(--r-md); font-size: 13px; line-height: 1.45; max-width: 260px; }

/* ---------- actions & forms ---------- */
.spine-actions { display: grid; gap: 8px; padding: 0 8px; }
.btn-spine { border-radius: var(--r-md); padding: 10px 12px; font-weight: 600; cursor: pointer; text-align: left; border: 1px solid rgba(255,255,255,.18); background: transparent; color: var(--spine-ink); }
.btn-spine:hover { background: rgba(255,255,255,.07); }
.btn-spine.primary { background: #f0bd61; border-color: #f0bd61; color: #1b2335; }
.btn-spine.primary:hover { background: #f5cc80; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-ink); }
.btn.danger, .btn.primary.danger { background: var(--redpen); color: #fff; }
.btn.danger:hover { background: var(--redpen-ink); }
.btn:not(.primary):not(.danger) { background: var(--sheet); color: var(--ink); border: 1px solid var(--rule-strong); }
.btn:not(.primary):not(.danger):hover { background: var(--empty); }
.btn.quiet-danger { background: none !important; border: 0 !important; color: var(--redpen-ink) !important; padding: 0 6px; }
.btn.quiet-danger:hover { text-decoration: underline; }
.btn:disabled { opacity: .6; cursor: progress; }
.page-head.with-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 20px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--ink-3); margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.drawer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }
.strip-cell { border: 0; font: inherit; cursor: pointer; position: relative; }
.strip-cell[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.has-note { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: .7; }
.grid td.cell { position: relative; cursor: pointer; }
.grid td.cell.noted::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent currentColor transparent transparent; opacity: .55; }
.receipt { margin-top: 12px; border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; background: var(--paper); }
.receipt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.receipt-head h4 { font-family: var(--serif); font-weight: 400; font-size: 18px; margin: 0; }
.receipt-head b { font-variant-numeric: tabular-nums; }
.receipt-grid { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 12px 0 0; font-size: 14px; }
.receipt-grid dt { color: var(--ink-3); }
.receipt-grid dd { margin: 0; font-weight: 600; }
.receipt-label { font-size: 12px; color: var(--ink-3); margin: 14px 0 4px; font-weight: 600; }
.receipt p { margin: 10px 0 0; }
.note-text { white-space: pre-wrap; font-size: 13px; line-height: 1.5; color: var(--ink-2); background: var(--sheet); border-left: 3px solid var(--rule-strong); padding: 8px 10px; margin: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; display: block; }

.form { display: grid; gap: 14px; }
.form .drawer-title { margin-bottom: 2px; }
.form .field input, .form .field select, .form .field textarea { background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--r-md); padding: 9px 11px; font-weight: 400; font-size: 15px; min-height: 42px; width: 100%; color: var(--ink); font-family: inherit; }
.form .field textarea { min-height: 64px; resize: vertical; }
.form .field input:focus, .form .field select:focus, .form .field textarea:focus { border-color: var(--green); outline: 2px solid color-mix(in srgb, var(--green) 25%, transparent); outline-offset: 0; }
.form .field input:disabled { background: var(--empty); color: var(--ink-3); }
.form fieldset.field { border: 0; padding: 0; margin: 0; }
.form fieldset.field legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row[hidden], .field[hidden] { display: none; }
.form .seg-toggle label { display: flex; }
.form .seg-toggle label + label { border-left: 1px solid var(--rule-strong); }
.form .seg-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.form .seg-toggle span { display: grid; place-items: center; padding: 0 16px; min-height: 40px; cursor: pointer; color: var(--ink-2); font-weight: 500; background: var(--sheet); }
.form .seg-toggle input:checked + span { background: var(--ink); color: var(--paper); font-weight: 600; }
.form .seg-toggle input:focus-visible + span { outline: 2px solid var(--green); outline-offset: -3px; }
.pay-block { display: grid; gap: 10px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 12px 0; }
.pay-who { margin: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--ink-3); }
.chips span { margin-right: 2px; }
.chip { border: 1px solid var(--rule-strong); background: var(--sheet); border-radius: 99px; padding: 3px 11px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.sibs { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 14px; }
.sibs > span { font-size: 13px; color: var(--ink-3); width: 100%; }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--green); }
.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 0 6px 4px 0; }
.lines th.r { text-align: right; }
.lines td { padding: 4px 6px 4px 0; vertical-align: top; }
.lines select, .lines input { border: 1px solid var(--rule-strong); border-radius: var(--r-md); padding: 7px 9px; font-size: 14px; background: var(--sheet); color: var(--ink); min-height: 38px; }
.lines input { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.line-warn { font-size: 12px; color: var(--ochre-ink); margin-top: 3px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--sheet); cursor: pointer; color: var(--ink-3); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.pay-total { margin: 0; font-size: 15px; }
.pay-total b { font-family: var(--serif); font-weight: 400; font-size: 22px; }
.field-warn { margin: -6px 0 0; font-size: 13px; color: var(--ochre-ink); background: var(--ochre-wash); padding: 8px 10px; border-radius: var(--r-md); }
.form-error { margin: 0; font-size: 14px; color: var(--redpen-ink); background: var(--redpen-wash); padding: 10px 12px; border-radius: var(--r-md); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; position: sticky; bottom: -32px; background: var(--sheet); padding-bottom: 12px; }
.form-actions .push { margin-left: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: var(--r-md); font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }

a.seg-toggle, .seg-toggle a { text-decoration: none; }
.page-head .seg-toggle a { display: grid; place-items: center; padding: 0 16px; min-height: 40px; color: var(--ink-2); font-weight: 500; background: var(--sheet); }
.page-head .seg-toggle a + a { border-left: 1px solid var(--rule-strong); }
.page-head .seg-toggle a[aria-current="page"] { background: var(--ink); color: var(--paper); font-weight: 600; }
.inv-flag { margin-left: 8px; font-weight: 600; font-size: 12px; }
.toolbar .check { align-self: center; font-size: 14px; }
td.empty { padding: 28px 12px; text-align: center; }

/* ---------- small screens ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .block.split { grid-template-columns: 1fr; gap: 36px; }
}
@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .spine { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; }
  .crest { display: flex; align-items: baseline; gap: 10px; padding: 0; }
  .crest-mark { font-size: 24px; }
  .crest-name, .spine-foot span { display: none; }
  .month-pick { padding: 0; margin-left: auto; }
  .month-pick > span { display: none; }
  .month-pick select { padding: 7px 8px; font-size: 14px; }
  .spine-foot { margin: 0; padding: 0; }
  .spine-actions { order: 6; display: flex; padding: 0; width: 100%; }
  .btn-spine { flex: 1; text-align: center; padding: 8px 10px; }
  .field-row { grid-template-columns: 1fr; }
  .nav { order: 5; width: 100%; display: flex; overflow-x: auto; gap: 4px; }
  .nav-item { white-space: nowrap; padding: 7px 10px; gap: 6px; }
  .nav-item[aria-current="page"] { box-shadow: inset 0 -2px 0 #f0bd61; }
  .topbar { padding: 12px 16px 0; }
  main { padding: 16px 16px 64px; gap: 32px; }
  .hero { padding: 22px 18px; }
  .reg-key { margin-left: 0; }
  .figures { grid-template-columns: 1fr 1fr; }
  .fig, .fig + .fig { padding: 14px 12px 14px 0; border-left: 0; }
  .fig:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--rule); }
  .fig-value { font-size: 25px; }
  .status-row { grid-template-columns: 140px 1fr 32px; }
  .drawer { padding: 26px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer { animation: none; }
  button.reg-cell:hover { transform: none; }
}
@media print { .spine, .topbar { display: none; } body { display: block; } .table-wrap { max-height: none; overflow: visible; } }
