:root {
  --bg: #eff0ee;
  --paper: #ffffff;
  --ink: #1c1f24;
  --muted: #545a63;
  --line: #d3d6d9;
  --band: #30343b;
  --band-ink: #f4f1ea;
  --accent: #8a5800;
  --accent-ink: #ffffff;
  --accent-soft: #f6ead2;
  --tile: #fff8e8;
  --bad: #a3231a;
  --bad-soft: #fbe9e7;
  --ok: #24613a;
  --focus: #1f6fd1;
  --r: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --paper: #1d2025;
    --ink: #ebe8e2;
    --muted: #a9adb4;
    --line: #363a41;
    --band: #0d0f12;
    --band-ink: #ebe8e2;
    --accent: #e3ad4f;
    --accent-ink: #1a1405;
    --accent-soft: #3a2f1a;
    --tile: #2a2418;
    --bad: #ff8a7a;
    --bad-soft: #3a1d1a;
    --ok: #7fcf98;
    --focus: #7db3ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 18px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* header band */
.top { background: var(--band); color: var(--band-ink); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.brand svg { color: #e3ad4f; }
.top nav { display: flex; gap: 16px; font-size: 15px; }
.top nav a { text-decoration: none; padding: 10px 0; }
.top nav a:hover { color: #e3ad4f; }

.hero { padding-top: 22px; }
h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.12; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { margin: 0 0 18px; max-width: 68ch; color: var(--muted); }

/* totals strip */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 14px; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--r); }
.strip div { padding: 10px 14px; border-left: 1px solid var(--line); min-width: 0; }
.strip div:first-child { border-left: 0; }
.strip dt { font-size: 14px; color: var(--muted); }
.strip dd { margin: 2px 0 0; font: 700 21px/1.25 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.strip dd.zero { color: var(--muted); font: 600 16px/1.6 system-ui, sans-serif; }
.ref { display: inline-block; font: 600 12px/1 var(--mono); color: var(--accent); border: 1px solid currentColor; border-radius: 3px; padding: 2px 4px; vertical-align: 1px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--band); margin-top: 6px; }
.tabs [role=tab] { font: inherit; font-weight: 600; background: transparent; color: var(--ink); border: 1px solid transparent; border-bottom: 0; border-radius: var(--r) var(--r) 0 0; padding: 10px 14px; min-height: 46px; cursor: pointer; }
.tabs [role=tab][aria-selected=true] { background: var(--band); color: var(--band-ink); }
.panel { padding: 14px 0 6px; }
.hint { color: var(--muted); font-size: 15.5px; margin: 6px 0 12px; max-width: 70ch; }

/* sections: ledger rows */
.part { font-size: 19px; margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.panel > #fill > .part:first-child, #p-docs .part:first-child { margin-top: 6px; }
details.sec { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 6px; }
details.sec[open] { border-color: var(--muted); }
details.sec > summary { list-style: none; display: grid; grid-template-columns: 3.4em 1fr auto; align-items: center; gap: 8px; padding: 10px 12px; min-height: 52px; cursor: pointer; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: ""; grid-column: 3; display: none; }
.sno { font: 700 15px/1 var(--mono); color: var(--accent); }
.stitle { font-weight: 600; }
.sbox { display: inline-flex; align-items: center; gap: 8px; justify-self: end; font: 600 15.5px/1.2 var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.sbox output.zero, .sub output.zero { color: var(--muted); font-weight: 400; }
.box { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 5px; border: 2px solid var(--accent); background: var(--tile); color: var(--ink); border-radius: 3px; font: 700 14px/1 var(--mono); }
.trow { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 0 14px; padding: 8px 12px; border-top: 3px double var(--line); font-weight: 600; }
.sbody { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.subh { font-size: 16.5px; margin: 16px 0 6px; }

/* items */
.items { display: grid; gap: 10px; margin-top: 10px; }
.item { border-left: 3px solid var(--line); padding: 4px 0 6px 12px; }
.item:focus-within { border-left-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.fld { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; min-width: 0; }
.fld.flist { justify-content: flex-start; }
.fld.wide { grid-column: 1 / -1; }
.lab { font-size: 14.5px; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--muted); border-radius: 4px; padding: 9px 10px; min-height: 44px; width: 100%; min-width: 0; }
textarea { min-height: 70px; resize: vertical; }
input[type=date] { min-height: 46px; }
.inp, .lrow { display: flex; align-items: center; gap: 6px; }
.lrow + .lrow { margin-top: 6px; }
.addj { align-self: flex-start; }
.cur { font: 600 16px var(--mono); color: var(--muted); width: 1ch; }
input.money, input.share, input.costs { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input[aria-invalid=true], select[aria-invalid=true] { border: 2px solid var(--bad); background: var(--bad-soft); }
.calc { font-size: 15px; color: var(--muted); }
.calc p { margin: 6px 0 0; }
.calc .head { color: var(--ink); font-size: 16px; }
.calc b { font-family: var(--mono); }
.errs { color: var(--bad); font-size: 15px; margin: 6px 0 0; }
.sub { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.sub output { font: 600 16px var(--mono); text-align: right; }
.sub.tot { border-top: 3px double var(--line); font-weight: 700; }
.cmp { color: var(--muted); font-size: 15px; }
fieldset.seg { border: 0; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
fieldset.seg legend { width: 100%; padding: 0; margin-bottom: 6px; font-weight: 600; }
.seg label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--muted); border-radius: 4px; min-height: 44px; cursor: pointer; background: var(--paper); }
.seg label:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); }
.seg input { width: auto; min-height: 0; accent-color: var(--accent); margin: 0; }
.seg.mini { display: flex; flex-wrap: wrap; gap: 6px; }
.seg.mini label { padding: 6px 10px; font-size: 15px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--muted); border-radius: 4px; padding: 9px 14px; min-height: 44px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 40px; padding: 6px 10px; font-size: 15px; }
.btn.add { margin-top: 10px; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.link { font: inherit; font-size: 15px; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; cursor: pointer; }
.link.rm { color: var(--muted); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.next { margin: 18px 0 4px; }
.out-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* notes and banners */
.banner, .note { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 10px 12px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.warn { color: var(--bad); font-weight: 600; margin: 0 0 10px; }
.keep { margin: 26px 0 10px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.keep h2 { font-size: 18px; margin: 0 0 4px; }
.keep .hint.warn { color: var(--bad); }
.ask { margin-top: 12px; padding: 12px; border: 2px solid var(--bad); border-radius: var(--r); }
.ask p { margin: 0 0 10px; }
.kept { margin-top: 12px; }
.kept summary { cursor: pointer; padding: 8px 0; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.klist { padding-left: 20px; margin: 4px 0; }
.klist li { margin: 6px 0; }
.undo { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; background: var(--band); color: var(--band-ink); padding: 8px 10px 8px 14px; border-radius: var(--r); display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 24px); box-shadow: 0 4px 18px rgba(0,0,0,.25); }

/* documents tab */
.appt { max-width: 360px; }
.due { font-size: 17px; min-height: 1.5em; }
.due.bad { color: var(--bad); }
.docs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.doc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.doc p { margin: 0 0 8px; }
.doc .flag { color: var(--accent); font-weight: 600; font-size: 15px; }

/* answer sheet */
.sheet { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.sh-head h2 { font-size: 22px; margin: 2px 0 8px; }
.kick { margin: 0; font: 700 13px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.sh-head p { margin: 0 0 8px; max-width: 75ch; }
.oath { border-left: 4px solid var(--accent); padding-left: 10px; }
.ss { margin: 18px 0 0; }
.ss h3 { font-size: 17px; margin: 0 0 6px; padding-top: 8px; border-top: 2px solid var(--ink); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.ss.cont { margin-top: 0; }
.ss h4 { font-size: 15.5px; margin: 12px 0 4px; }
.ss .pg { font-size: 13px; font-weight: 400; color: var(--muted); }
.ss .txt, .ss .none, .ss .period { margin: 4px 0; font-size: 15.5px; }
.ss .none { color: var(--muted); }
.st { width: 100%; border-collapse: collapse; font-size: 15px; margin: 4px 0; }
.st th, .st td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.st thead th { font-size: 13.5px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); }
.st .am { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st tr.tot td, .st tr.tot th { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.st tr.strong th, .st tr.strong td { font-weight: 700; }
.st thead tr.cap th { font-size: 15.5px; color: var(--ink); font-weight: 700; border-bottom: 0; padding: 12px 6px 2px 0; }
.st tr.wk td { font-size: 13.5px; color: var(--muted); border-bottom-style: dotted; padding-top: 0; }
.st.kv th { font-weight: 400; width: 70%; }
.st.kv td { width: 30%; }
.wkp { font-size: 13.5px; color: var(--muted); margin: 2px 0 6px; }
.st th.am { font-family: inherit; white-space: normal; }
.st .plain { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; white-space: normal; }
.st.kv td.am { white-space: normal; }
.docs-t .c-par { width: 6.5em; white-space: nowrap; }
.docs-t .c-tick { width: 7.5em; }
.na { color: var(--muted); font-family: var(--mono); }
.muted { color: var(--muted); }
.bad { color: var(--bad); font-weight: 600; }

/* text below the tool */
.prose { margin-top: 34px; max-width: 920px; }
.prose h2 { font-size: 23px; margin: 26px 0 8px; }
.prose p { max-width: 70ch; }
.careful { border-left: 4px solid var(--accent); padding-left: 12px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; min-height: 44px; }
.faq details p { margin: 0 0 14px; }

/* footer */
.foot { margin-top: 40px; padding: 22px 0 70px; background: var(--band); color: var(--band-ink); font-size: 14.5px; }
.sb-footer p { margin: 0 0 10px; }
.sb-more a { color: inherit; }
.sb-privacy { opacity: .9; }

@media (max-width: 380px) {
  .strip div { flex-wrap: wrap; }
  .strip dd { margin-left: auto; }
}
@media (max-width: 620px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 14px; }
  .strip { grid-template-columns: 1fr; }
  .strip div { border-left: 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 12px; }
  .strip div:first-child { border-top: 0; }
  .strip dd { font-size: 18px; text-align: right; overflow-wrap: normal; }
  .strip dt { flex: 1 1 auto; min-width: 0; }
  details.sec > summary { grid-template-columns: 3em 1fr; }
  details.sec > summary .sbox { grid-column: 2; justify-self: start; }
  .grid { grid-template-columns: 1fr 1fr; gap: 8px 10px; }
  .lab { font-size: 14px; }
  .tabs [role=tab] { padding: 10px 10px; flex: 1; }
  .top nav { gap: 12px; }
  .sheet { padding: 10px; }
  .st { font-size: 14px; }
  .st.kv th { width: 62%; }
  .st th, .st td { padding: 5px 3px; }
  .st .am { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* print: only the answer sheet */
@page { size: auto; margin: 14mm 13mm 15mm; }
@media print {
  :root { --ink: #000; --muted: #444; --line: #999; --paper: #fff; --bg: #fff; --accent: #6b4400; --bad: #a3231a; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.35; }
  .top, .hero, .skip, .strip, .tabs, #p-fill, #p-docs, .keep, .prose, .foot, .undo, .out-bar, .banner, .note, #st-err, .warn, .hint { display: none !important; }
  #p-sheet, #p-sheet[hidden] { display: block !important; padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .sheet { border: 0; padding: 0; background: none; }
  .sh-head h2 { font-size: 15pt; }
  .kick { font-size: 8.5pt; }
  .ss { margin-top: 10pt; break-inside: avoid; page-break-inside: avoid; }
  .ss h3 { font-size: 11.5pt; break-after: avoid; page-break-after: avoid; }
  .ss h4 { break-after: avoid; page-break-after: avoid; }
  .st tbody.it, .ss.nobreak, .st tr, .st.kv { break-inside: avoid; page-break-inside: avoid; }
  .st { font-size: 9.5pt; }
  .st thead th { font-size: 8.5pt; }
  .st thead tr.cap th { font-size: 10pt; }
  .st tr.wk td, .wkp { font-size: 8.5pt; }
  .st thead { display: table-header-group; }
  .ss .txt, .ss .none, .ss .period, .sh-head p { font-size: 10pt; }
  .ss h3, .ss .period, .ss .txt, .ss h4 { break-after: avoid; page-break-after: avoid; }
  a { text-decoration: none; }
}
