@font-face { font-family: "Commissioner"; src: url("fonts/commissioner-var.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --bg: #f2f4f1;
  --paper: #ffffff;
  --ink: #15221f;
  --muted: #4b5a56;
  --line: #d3dcd8;
  --line-strong: #8fa19b;
  --soft: #e8eeea;
  --band: #123f3a;          /* deep treasury green */
  --band-ink: #eef4f1;
  --band-muted: #b9cdc6;
  --accent: #96561a;        /* bronze, like a medallion */
  --accent-ink: #ffffff;
  --accent-soft: #f5e9dc;
  --in: #0c6a56;
  --out: #a03a23;
  --head: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
  --r-sm: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1917; --paper: #16231f; --ink: #e5eeea; --muted: #a7b8b2; --line: #2b3c37; --line-strong: #5d716a;
    --soft: #1c2c28; --band: #0b201d; --band-ink: #e5eeea; --band-muted: #9fb6ae;
    --accent: #d9a05c; --accent-ink: #1b1209; --accent-soft: #33261a; --in: #62c9a9; --out: #f08c74;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); font-variant-numeric: tabular-nums; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 18px; }
a { color: inherit; text-underline-offset: 2px; }
.content a, .sources a, .example a { color: var(--in); }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; margin: 0; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--paper); color: var(--ink); padding: 8px 12px; z-index: 10; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* band: brand, H1 and lede on the treasury green */
.band { background: var(--band); color: var(--band-ink); padding-bottom: 44px; }
.band-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 700 1.05rem var(--head); }
.band nav { display: flex; gap: 16px; font-size: .95rem; }
.band nav a { color: var(--band-muted); text-decoration: none; }
.band nav a:hover { color: var(--band-ink); text-decoration: underline; }
.hero { padding-top: 10px; }
.hero h1 { font-size: clamp(1.6rem, 5.2vw, 2.4rem); font-weight: 700; letter-spacing: -.01em; max-width: 22ch; }
.lede { margin: 10px 0 0; color: var(--band-muted); max-width: 64ch; font-size: 1rem; }

main { display: block; }
main:focus { outline: none; }
.nojs, .banner, .note { margin: 14px 0 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--accent-soft); }
.banner { position: relative; z-index: 1; }
.note.warn { border-left: 4px solid var(--out); }

/* the balance: the one card on the page, lifted half onto the band */
.balance { position: relative; margin-top: -30px; background: var(--paper); border-radius: var(--r); padding: 16px 18px; box-shadow: 0 6px 22px rgb(10 30 26 / .14); border: 1px solid var(--line); }
/* a visible banner or note sits above the card, so the card must not lift over it */
.banner:not([hidden]) ~ .tool > .balance, .note:not([hidden]) ~ .tool > .balance { margin-top: 12px; }
.bal-main { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; }
.bal-label { font-size: .95rem; color: var(--muted); }
.bal-num { font: 700 clamp(2rem, 8vw, 2.7rem)/1.1 var(--head); letter-spacing: -.01em; }
.bal-num.neg { color: var(--out); }
.bal-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.bal-facts div { min-width: 0; }
.bal-facts dt { font-size: .85rem; color: var(--muted); }
.bal-facts dd { margin: 0; font: 600 1.15rem var(--head); }
#bal-free { color: var(--in); }
#bal-free.short { color: var(--out); }
.startup { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.startup label { display: block; font-weight: 600; margin-bottom: 4px; }
.startup .row { display: flex; gap: 8px; }
.startup input { flex: 1; min-width: 0; }

/* two columns on wide screens: entry and settings on the left, the month on the right */
@media (min-width: 1000px) {
  .tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); column-gap: 44px; align-items: start; }
  .tool > .balance { grid-column: 1 / -1; }
  .tool > #month { grid-column: 2; grid-row: 2 / span 4; }
  .tool > :not(.balance):not(#month) { grid-column: 1; }
  .f-amt { grid-column: span 2; }
}

/* sections: flat, with a bronze left rule on the heading */
.panel { margin-top: 30px; }
.panel > h2, .panel > .head-row h2, .fold > summary h2 { font-size: 1.3rem; padding-left: 12px; border-left: 4px solid var(--accent); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.entries-h { font-size: 1.05rem; margin: 22px 0 6px; }
.hint { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }
.opt { color: var(--muted); font-weight: 400; font-size: .88rem; }

/* form controls */
label { font-size: .95rem; }
input, select { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 10px; min-height: 44px; width: 100%; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); margin: 0; flex: none; }
input[type=date] { min-width: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.fields .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f-date, .f-note, .f-to, .f-incat, .f-cat { grid-column: span 2; }
.f-amt { grid-column: span 2; }
.fields.two .f.check { justify-content: flex-end; }
.f.check label { display: flex; gap: 10px; align-items: flex-start; }
@media (min-width: 720px) and (max-width: 999px) {
  .fields { grid-template-columns: repeat(4, 1fr); }
  .f-date, .f-incat, .f-cat, .f-cash, .f-dig, .f-amt { grid-column: span 1; }
  .f-to { grid-column: span 2; }
  .f-note { grid-column: span 4; }
  .fields.two { grid-template-columns: 1fr 1fr; }
}
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0; margin: 14px 0 0; overflow: hidden; background: var(--paper); }
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 4px 2px; font: 600 .95rem var(--head); text-align: center; border-left: 1px solid var(--line); }
.seg label:first-of-type span { border-left: 0; }
.seg input:checked + span { background: var(--band); color: var(--band-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -3px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); font: 600 .98rem var(--head); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-style: dashed; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.link { background: none; border: 0; padding: 6px 2px; min-height: 36px; font: inherit; color: var(--in); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link.danger { color: var(--out); }
.err { color: var(--out); font-weight: 600; margin: 10px 0 0; }
.err.info { color: var(--muted); font-weight: 400; }

/* monthly report */
.inline select { width: auto; min-width: 11em; }
.report { margin-top: 12px; }
table { border-collapse: collapse; width: 100%; }
.num { text-align: right; white-space: nowrap; }
.sum th, .sum td { padding: 5px 0; border-bottom: 1px solid var(--line); font-weight: 400; text-align: left; vertical-align: top; }
.sum td.num { text-align: right; padding-left: 12px; }
.sum tr.grp th { font: 600 .82rem var(--head); color: var(--muted); padding-top: 12px; border-bottom: 0; }
.sum tr.sub th { padding-left: 14px; color: var(--muted); }
.sum tr.subtotal th, .sum tr.subtotal td { font-weight: 600; }
.sum tr.total th, .sum tr.total td { font: 700 1.05rem var(--head); border-bottom: 2px solid var(--ink); padding-top: 8px; }
.sum tr.free td { color: var(--in); font-weight: 700; }
.sum tr.short td, .sum tr.short th { color: var(--out); font-weight: 700; }
.basis { display: block; font-size: .85rem; color: var(--muted); }
.entries { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.entries li { display: grid; grid-template-columns: 4.2em 1fr auto; gap: 2px 10px; border-bottom: 1px solid var(--line); align-items: baseline; }
.entries li.none { display: block; color: var(--muted); padding: 8px 0; }
.entries .d { color: var(--muted); font-size: .92rem; }
.entries .w { min-width: 0; overflow-wrap: anywhere; text-align: left; background: none; border: 0; padding: 9px 0; min-height: 44px; font: inherit; color: inherit; cursor: pointer; }
.entries .w:hover { text-decoration: underline; text-underline-offset: 2px; }
.entries .w small { display: block; color: var(--muted); font-size: .86rem; }
.entries .a { font-weight: 600; text-align: right; white-space: nowrap; }
.entries li.in .a { color: var(--in); }
#e-del { margin-left: auto; }

/* split */
.split-lead { margin: 10px 0 0; }
.plan-top { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; max-width: 420px; }
.plan { margin-top: 12px; table-layout: fixed; }
.plan th { font: 600 .85rem var(--head); color: var(--muted); text-align: left; padding: 4px 0; border-bottom: 1px solid var(--line); }
.plan th.num { text-align: right; }
.plan th:nth-child(2) { width: 6.2em; }
.plan th:nth-child(3) { width: 6.6em; }
.plan th:nth-child(4) { width: 2.6em; }
.plan td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.plan td + td { padding-left: 6px; }
.plan .pct { display: inline-flex; align-items: center; gap: 3px; }
.plan .pp { width: 4.3em; text-align: right; padding: 9px 6px; }
.plan td.out { font-weight: 700; }
.plan tfoot td { border-bottom: 0; font-weight: 600; }
.x { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; border-radius: var(--r-sm); }
.x:hover { color: var(--out); background: var(--soft); }
/* phones: each place gets its own full-width name line, with share and amount under it */
#split { container-type: inline-size; }
@container (max-width: 560px) {
  .plan thead { display: none; }
  .plan, .plan tbody, .plan tfoot { display: block; }
  .plan tr { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .plan td { border: 0; padding: 0 !important; }
  .plan tbody td:first-child { grid-column: 1 / -1; }
  .plan tfoot tr { grid-template-columns: 1fr auto auto; border-bottom: 0; }
  .plan tfoot td:last-child { display: none; }
  .plan td.out { text-align: left; }
}
.more { margin-top: 14px; }
.more summary, .fold summary { cursor: pointer; }
.more summary { color: var(--in); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
#wheres { display: grid; gap: 10px; margin-top: 12px; }
#wheres .f { display: flex; flex-direction: column; gap: 4px; }

/* folded sections */
.fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "Show"; font: 600 .9rem var(--body); color: var(--in); text-decoration: underline; }
.fold[open] > summary::after { content: "Hide"; }
.reserve { border: 0; padding: 0; margin: 18px 0 0; }
.reserve legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.radio { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.radio input.short { width: 4.2em; }
.radio input.mid { width: 8em; }
.file-btn { cursor: pointer; }
.confirm { margin-top: 12px; padding: 12px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: var(--r-sm); }
.confirm p { margin: 0; }
.danger-row { margin: 16px 0 0; }

/* content */
.content { margin-top: 44px; padding-top: 10px; border-top: 1px solid var(--line); max-width: 70ch; }
.content h2 { font-size: 1.3rem; margin: 26px 0 8px; }
.content p { margin: 0 0 12px; }
.example { padding: 12px 14px; background: var(--soft); border-radius: var(--r-sm); }
#faq details { border-bottom: 1px solid var(--line); }
#faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
#faq details p { margin: 0 0 14px; }
.sources { font-size: .92rem; color: var(--muted); margin-top: 22px; }

.toast { position: fixed; left: 50%; bottom: 14px; transform: translate(-50%, 140%); width: min(560px, calc(100% - 24px)); background: var(--band); color: var(--band-ink); border-radius: var(--r-sm); padding: 10px 14px; box-shadow: 0 6px 20px rgb(0 0 0 / .25); transition: transform .2s; z-index: 20; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.toast.on { transform: translate(-50%, 0); }
.toast:empty { visibility: hidden; }
.toast .link { color: var(--accent-soft); flex: none; font-weight: 700; }
@media (prefers-color-scheme: dark) { .toast { background: #26413b; } .toast .link { color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

footer { margin-top: 56px; padding: 26px 0 70px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
footer a { color: inherit; }
.sb-footer p { margin: 0 0 8px; }

.print-root { display: none; }

/* ---------- paper ---------- */
@page { size: auto; margin: 13mm 12mm; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; }
  body { background: #fff; color: #000; font: 10.5pt/1.35 var(--body); }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block; }
  .p-sheet h1 { font: 700 17pt var(--head); margin: 0; }
  .p-sheet h2 { font: 700 11.5pt var(--head); margin: 14px 0 5px; break-after: avoid; }
  .p-head { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
  .p-group { font: 600 12pt var(--head); margin: 4px 0 0; }
  .svc { font-weight: 400; margin-left: 12px; white-space: nowrap; }
  .p-meta { margin: 2px 0 0; color: #333; }
  .p-small { font-size: 8.5pt; color: #333; }
  .p-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
  .p-sum th, .p-sum td { padding: 3px 0; border-bottom: .6pt solid #999; text-align: left; font-weight: 400; vertical-align: bottom; }
  .p-sum td.num { text-align: right; min-width: 7em; padding-left: 10px; }
  .p-sum tr.grp th { font-weight: 700; padding-top: 8px; border-bottom: 0; }
  .p-sum tr.sub th { padding-left: 12px; }
  .p-sum tr.subtotal th, .p-sum tr.subtotal td { font-weight: 700; }
  .p-sum tr.total th, .p-sum tr.total td { font-weight: 700; border-bottom: 1.4pt solid #000; padding-top: 6px; }
  .p-sum tr.free td, .p-sum tr.short td { font-weight: 700; }
  .p-sum .basis { display: block; font-size: 8.5pt; color: #333; }
  .p-split th, .p-split td, .p-plan th, .p-plan td { padding: 3px 4px 3px 0; border-bottom: .6pt solid #999; text-align: left; }
  .p-split .num, .p-plan .num { text-align: right; }
  .p-split thead th, .p-plan thead th { font-size: 9pt; border-bottom: 1pt solid #000; }
  .p-split tfoot th, .p-split tfoot td { font-weight: 700; border-bottom: 0; }
  .p-note { margin: 4px 0 0; font-size: 9pt; }
  .p-sign { margin-top: 18px; }
  .p-sign p { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 16px; }
  .p-sign .line { flex: 1; border-bottom: .8pt solid #000; height: 1.2em; }
  .p-sign .line.short { flex: 0 0 40%; }
  .p-sign p.p-small { display: block; margin: 0; }
  .p-ledger { margin-top: 2px; }
  .p-newpage { break-before: page; }
  .p-ledger thead tr.run th { font: 700 11.5pt var(--head); border-bottom: 0; padding: 14px 0 4px; }
  .p-ledger thead tr.run .p-small { font: 400 8.5pt var(--body); margin-left: 8px; }
  .p-fill { display: flex; align-items: flex-end; gap: 8px; }
  .p-fill .line { flex: 1; border-bottom: .8pt solid #000; height: 1.2em; }
  .p-fill .line.short { flex: 0 0 30%; }
  .p-meta.p-fill { max-width: 50%; margin-top: 6px; }
  .p-ledger th, .p-ledger td { padding: 3px 6px 3px 0; border-bottom: .6pt solid #aaa; text-align: left; vertical-align: top; }
  .p-ledger .num { text-align: right; }
  .p-ledger thead th { border-bottom: 1.2pt solid #000; font-size: 9pt; }
  .p-ledger th.c-date { width: 4.6em; }
  .p-ledger thead th.num { width: 6.4em; }
  .p-ledger tr { break-inside: avoid; }
  .p-ledger tr.blank td { height: 2.1em; }
  .p-ledger tr.blank td + td { border-left: .6pt solid #aaa; }
  .p-month { break-inside: avoid; }
  .p-plan th.c-to { width: 34%; }
  .p-plan th.c-pct { width: 4.5em; padding-right: 14px; }
  .p-plan td.num { padding-right: 14px; }
  .book-top p { margin: 8px 0 12px; }
  .p-month tr.mh th { font: 700 10.5pt var(--head); padding-top: 10px; border-bottom: 1pt solid #000; }
  .p-month tr.mt td { font-size: 9pt; font-weight: 600; border-bottom: 0; padding-bottom: 6px; }
  .p-month tr.mh { break-after: avoid; }
  .book-top { margin-bottom: 8px; }
  .slips-head { margin: 0 0 6px; font-size: 9pt; }
  .slip-grid { display: block; }
  .slip { border-top: 1.2pt dashed #000; padding: 7px 0 8px; break-inside: avoid; }
  .slip > .p-small { margin: 4px 0 0; }
  .slip:last-child { border-bottom: 1.2pt dashed #000; }
  .slip-top { display: flex; justify-content: space-between; align-items: baseline; font: 700 12pt var(--head); }
  .slip dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px 18px; margin: 6px 0 4px; }
  .slip dl div { border-bottom: .8pt solid #000; min-height: 2.3em; }
  .slip dl div.wide { grid-column: span 3; }
  .slip dl div.two { grid-column: span 2; }
  .slip dt { font-size: 8pt; color: #333; }
  .slip dd { margin: 0; font-size: 10.5pt; line-height: 1.25; }
  .slip dd.amt { font-weight: 700; }
}
