:root {
  --bg: #f5f7fa; --surface: #ffffff; --ink: #14212e; --muted: #5a6876; --line: #dbe2ea;
  --accent: #1d5fbf; --accent-ink: #ffffff; --warn-bg: #fff3d1; --warn-ink: #6b4200; --ok-bg: #e5f0fd; --danger: #b42318;
  --advice-bg: #fff8e6; --advice-line: #e6a700; --radius: 14px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f151c; --surface: #18212b; --ink: #e8eef5; --muted: #a5b2c0; --line: #2c3a48;
    --accent: #7cb2ff; --accent-ink: #0b1626; --warn-bg: #3d2f0e; --warn-ink: #ffdf9a; --ok-bg: #16283f; --danger: #ff8a7d;
    --advice-bg: #2e2610; --advice-line: #d4a017; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a, .linkish { color: var(--accent); text-underline-offset: 3px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.18; margin: 1.1em 0 0.45em; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 5.5vw, 46px); font-weight: 820; margin-top: 0.3em; letter-spacing: -0.025em; }
h2 { font-size: clamp(21px, 3.4vw, 25px); font-weight: 780; }
h3 { font-size: 18px; }
p { margin: 0 0 0.85em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 9; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); font-weight: 400; }
.print-only { display: none; }

.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 58px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 820; font-size: 19px; color: var(--ink); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 15.5px; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 0; }
.nav a[aria-current="page"], .nav a:hover { color: var(--accent); text-decoration: underline; }
.site-foot { margin-top: 56px; border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 14.5px; }
.site-foot nav { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-bottom: 12px; }

.hero { padding: 20px 0 4px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; font-size: 13px; font-weight: 800; color: var(--accent); margin: 0; }
.lede { font-size: clamp(17px, 2.4vw, 20px); color: var(--muted); max-width: 48em; }
.advice { background: var(--advice-bg); border-left: 5px solid var(--advice-line); border-radius: 10px; padding: 10px 14px; font-size: 15px; }
.msg { background: var(--ok-bg); border-left: 5px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-weight: 600; margin-top: 12px; }
.msg.warn { background: var(--warn-bg); color: var(--warn-ink); border-left-color: var(--warn-ink); }
.note { font-size: 14.5px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: 16px 18px; margin-top: 16px; min-width: 0; }
.panel > h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols > div > .panel:first-child { margin-top: 16px; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 18px; border-radius: 10px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { filter: brightness(1.07); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.btn.tiny { min-height: 34px; padding: 3px 10px; font-size: 14px; border-radius: 8px; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 600; }
.btn.quiet:hover { border-color: var(--accent); }
.btn.danger:not(.quiet) { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.btn.quiet.danger { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.btn-row.tight { margin: 0; gap: 6px; }

.ledger-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 16px; }
.ledger-bar select { min-width: 220px; max-width: 100%; }
.ledger-name { margin: 18px 0 0; }
.fields { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 6px 0; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 15px; min-width: 0; }
.fields label.wide { flex: 1 1 260px; }
.fields label input:not([type=checkbox]), .fields label select { width: 100%; }
label.inline { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
input[type="text"], input[type="date"], input:not([type]), select { font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; max-width: 100%; }
input[inputmode] { width: 9em; font-variant-numeric: tabular-nums; }
input.link { width: 100%; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

.split-bar { display: block; width: 100%; height: 44px; margin: 6px 0 12px; }
.split-bar .empty { fill: var(--line); }
.bar-label { fill: #ffffff; font: 700 15px system-ui, sans-serif; }
.dot { width: 12px; height: 12px; vertical-align: -1px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-table tbody th { font-weight: 650; }
.split-table tfoot th, .split-table tfoot td { font-weight: 750; border-bottom: 0; }
.entries td:first-child, .entries td:nth-child(2) { white-space: nowrap; }
.entries td:last-child .btn-row { flex-wrap: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14.5px; margin: 0 0 4px; }
.history { display: block; width: 100%; height: auto; }
.history .grid { stroke: var(--line); }
.history .tick { fill: var(--muted); font: 11.5px system-ui, sans-serif; }
.team { list-style: none; margin: 0 0 10px; padding: 0; }
.team li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.team li .btn-row { margin-left: auto; }
.checkpoint { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-top: 12px; }
.checkpoint h3 { margin: 0 0 6px; }
.checkpoint ul { list-style: none; margin: 0 0 8px; padding: 0; }
.share-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.share-grid h3 { margin-top: 0; }
@media (max-width: 900px) { .share-grid { grid-template-columns: minmax(0, 1fr); } }
.sponsor { border: 2px dashed var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 14px 0 0; }
.welcome h2 { margin-top: 0; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
dialog::backdrop { background: rgba(12, 20, 30, 0.6); }
#dlg-body { padding: 22px; }
#dlg-body h2 { margin-top: 0; }
#dlg-body label { display: block; margin: 12px 0 6px; font-weight: 600; }
#dlg-body input:not([type=checkbox]), #dlg-body select { width: 100%; }

.prose h2 { margin-top: 1.6em; }
.prose li { margin: 0.3em 0; }
.formula { font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.faq dt { font-weight: 750; margin-top: 1.1em; }
.faq dd { margin: 0.25em 0 0; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0; padding: 0; list-style: none; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.steps b { display: block; font-size: 18px; }
@media (max-width: 760px) { .steps { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { body { font-size: 16px; } .panel { padding: 14px; } .entries th:nth-child(5), .entries td:nth-child(5) { display: none; } }

@media print {
  body { background: #ffffff; color: #000000; font-size: 12pt; }
  body > :not(#print) { display: none !important; }
  #print { display: block; padding: 0; }
  #print table { font-size: 11pt; }
  #print th, #print td { border: 1px solid #999999; }
  #print td.sign { width: 34%; height: 2.4em; }
  #print .advice { border: 1px solid #999999; background: none; }
}
