:root {
  --bg: #ffffff;
  --ink: #1b2a24;
  --muted: #4f6159;
  --line: #d3e1d9;
  --soft: #eef6f1;
  --accent: #1d6b4f;
  --accent-ink: #ffffff;
  --mark: #f2b705;
  --warn-bg: #fff6dc;
  --warn: #7a5200;
  --bad-bg: #fdecea;
  --bad: #a3221b;
  --paper: #ffffff;
  --paper-ink: #1b2a24;
  --round: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10181a; --ink: #e4eee8; --muted: #a6b8af; --line: #2c3d38; --soft: #17241f;
    --accent: #5cc29a; --accent-ink: #0b1512; --mark: #e9b53a;
    --warn-bg: #3a2f12; --warn: #f3d27c; --bad-bg: #3d1b19; --bad: #ffb4ab;
    --paper: #f8faf8; --paper-ink: #1b2a24;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--bg); padding: 8px 12px; z-index: 50; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

/* header */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 19px var(--round); }
.brand svg { color: var(--accent); }
.top nav { display: flex; gap: 18px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 10px 0; }
.top nav a:hover { color: var(--ink); text-decoration: underline; }
.hero { padding-top: 26px; padding-bottom: 6px; }
h1 { font: 800 clamp(30px, 6vw, 44px)/1.1 var(--round); margin: 0 0 10px; letter-spacing: -0.01em; max-width: 22ch; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 14px; max-width: 62ch; }
h2 { font: 750 22px/1.25 var(--round); margin: 30px 0 10px; }
h3 { font: 700 18px/1.3 var(--round); margin: 0 0 8px; }

/* tabs */
.tool { padding-bottom: 30px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 6px 0 18px; overflow-x: auto; }
.tabs button { appearance: none; border: 0; background: none; color: var(--muted); font: 650 17px var(--round); padding: 12px 14px 10px; min-height: 48px; border-bottom: 4px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--mark); }
.tabs .count { color: var(--muted); font-weight: 500; }

/* forms */
label { display: block; font-weight: 600; font-size: 15px; color: var(--ink); }
input, select, textarea { font: 16px/1.3 var(--sans); color: var(--ink); background: var(--bg); border: 1.5px solid #9fb5aa; border-radius: 8px; padding: 10px 11px; width: 100%; min-height: 46px; margin-top: 4px; }
@media (prefers-color-scheme: dark) { input, select, textarea { border-color: #4b6158; } }
textarea { min-height: 0; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--accent); flex: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.grid .wide { grid-column: 1 / -1; }
.add { border-left: 4px solid var(--accent); padding: 2px 0 6px 16px; }
.h-form { margin-top: 0; }
.more { margin: 12px 0 4px; }
.more summary, .paste summary, .deleted summary { cursor: pointer; font-weight: 650; color: var(--accent); padding: 10px 0; min-height: 44px; }
.more .grid { margin-top: 6px; }
.hint { color: var(--muted); font-size: 15px; margin: 8px 0; }
.err { color: var(--bad); font-weight: 600; margin: 10px 0 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 16px; border-radius: 8px; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font: 650 16px var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; margin: 0; }
.link { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; padding: 4px 2px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: 40px; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.inline { max-width: 100%; }
.inline select { width: auto; margin: 0; max-width: calc(100vw - 100px); text-overflow: ellipsis; }

.note, .banner { background: var(--warn-bg); color: var(--warn); border-radius: var(--r); padding: 10px 14px; margin: 0 0 12px; }
.banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--soft); color: var(--ink); border-left: 4px solid var(--mark); border-radius: 0; }

/* paste */
.paste { margin: 18px 0 0; border-top: 1px solid var(--line); }
.paste-opts { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: end; margin: 12px 0; }
.paste-opts label:not(.check) select { width: auto; }
.scroll-x { overflow-x: auto; max-width: 100%; position: relative; }
.ptable { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.ptable th, .ptable td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
.ptable select { font-size: 14px; min-height: 36px; padding: 4px 6px; width: auto; }
.ptable .ph { display: block; font-weight: 500; color: var(--muted); }
.ptable td.pm { white-space: normal; min-width: 200px; color: var(--muted); }
.ptable tr.bad td { background: var(--bad-bg); color: var(--bad); }
.ptable tr.warn td.pm { color: var(--warn); font-weight: 600; }
.paste-sum { font-weight: 600; }
.names { display: grid; gap: 10px; }
.nm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.nm-found { grid-column: 1 / -1; margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.nm-found span { color: var(--muted); font-weight: 400; }
@media (max-width: 520px) { .nm { grid-template-columns: 1fr; } }

/* log */
.log-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 6px 16px; margin-top: 26px; }
.log-head h2 { margin: 0; }
.log-sum { color: var(--muted); margin: 8px 0; min-height: 1.5em; }
.log-sum.flash { color: var(--accent); font-weight: 650; }
.add-ok { color: var(--accent); font-weight: 650; margin: 10px 0 0; }
.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row { border-bottom: 1px solid var(--line); padding: 10px 2px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.row.bad { background: var(--bad-bg); }
.row.warn { box-shadow: inset 4px 0 0 var(--mark); padding-left: 12px; }
.r-main { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; grid-column: 1; }
.r-fam { font-weight: 700; }
.r-kids { color: var(--muted); }
.r-amt { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.r-amt.neg { color: var(--bad); }
.r-sub { grid-column: 1; color: var(--muted); font-size: 15px; }
.r-iss { grid-column: 1; color: var(--warn); font-size: 15px; font-weight: 600; }
.row.bad .r-iss { color: var(--bad); }
.r-btns { grid-column: 2; grid-row: 1 / span 3; display: flex; gap: 6px; align-items: center; }
.log.small .row { font-size: 15px; }
.empty { color: var(--muted); }
.deleted { margin-top: 16px; }
.keep { margin-top: 30px; border-top: 1px solid var(--line); }
.ask { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; border-radius: var(--r); margin-top: 14px; }
.ask p { margin: 0; font-weight: 600; }
.undo { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 10px 8px 16px; border-radius: var(--r); display: flex; gap: 12px; align-items: center; z-index: 30; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
.undo .btn { color: var(--bg); border-color: var(--bg); }
.undo[hidden] { display: none; }

/* statements panel */
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.checks { border: 0; padding: 0; margin: 8px 0 12px; }
.checks legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.fixes { margin: 14px 0; }
.fixes p { margin: 0 0 6px; padding: 8px 12px; border-left: 4px solid var(--mark); background: var(--warn-bg); color: var(--warn); }
.fixes p.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.fixes p.info { border-color: var(--line); background: var(--soft); color: var(--muted); }
.empty-panel { padding: 18px 0; color: var(--muted); }
.print-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.blank-row { margin-top: 26px; }
table.sum { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.sum th, .sum td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sum thead th { font-size: 14px; color: var(--muted); }
.sum tfoot th, .sum tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.num { text-align: right !important; white-space: nowrap; }
.fam { margin: 0 0 24px; }
.fam-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: end; margin-bottom: 14px; max-width: 560px; }
.fam-pick .btn { padding: 6px 10px; }
.fam-pick .btn { min-height: 46px; }
.fam-edit { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px 14px; align-items: end; margin-bottom: 12px; }
.fam-edit h3 { grid-column: 1 / -1; margin: 0; font-size: 20px; }
.sheet-wrap { display: grid; gap: 16px; min-width: 0; }
.sheet { min-width: 0; }
.sh-prov, .sh-to dd, .sh-title { overflow-wrap: anywhere; }

/* the statement itself (screen preview) */
.sheet { background: var(--paper); color: var(--paper-ink); border: 1px solid #c9d6cf; border-radius: 4px; box-shadow: 0 2px 10px rgb(20 40 30 / .08); padding: 28px 30px; max-width: 760px; font-size: 15px; line-height: 1.45; }
.sheet a { color: inherit; }
.sh-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; border-bottom: 3px solid var(--paper-ink); padding-bottom: 12px; }
.sh-prov { display: flex; flex-direction: column; }
.sh-prov strong { font: 750 18px/1.3 var(--round); }
.sh-tin { margin-top: 2px; font-variant-numeric: tabular-nums; }
.sh-title { text-align: right; }
.sh-title h3 { font: 800 22px/1.2 var(--round); margin: 0; }
.sh-title p { margin: 2px 0 0; }
.sh-copy { font-weight: 700; color: #1d6b4f; }
.sh-to { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 14px 0; }
.sh-to dt { font-weight: 700; }
.sh-to dd { margin: 0; }
.sh-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; background: #eef6f1; border-left: 5px solid #1d6b4f; padding: 10px 14px; margin: 0 0 12px; font-weight: 650; }
.sh-total strong { font: 800 24px var(--round); font-variant-numeric: tabular-nums; }
.sh-ref { font-weight: 500; }
.sh-kids, .sh-years, .sh-other { margin: 10px 0; }
.sh-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.sh-table th, .sh-table td { text-align: left; padding: 3px 8px; border-bottom: 1px solid #d5ddd8; }
.sh-table thead th { border-bottom: 2px solid #1b2a24; font-size: 13.5px; }
.sh-table tbody th { font-weight: 500; }
.sh-table tr.tot th, .sh-table tr.tot td, .sh-table tfoot th, .sh-table tfoot td { font-weight: 750; border-top: 2px solid #1b2a24; border-bottom: 0; }
.sh-table tr.cap th { border: 0; font-weight: 700; font-size: 13px; color: #4f6159; padding-left: 0; }
.sh-table.pay td:nth-child(1), .sh-table.pay td:nth-child(2), .sh-table.pay td:nth-child(4) { white-space: nowrap; }
.sh-table tr.after td { border: 0; padding: 0; font-size: 15px; white-space: normal !important; }
.sub { display: block; font-weight: 400; font-size: 13px; color: #4f6159; }
.sh-end { margin-top: 14px; }
.sh-basis, .sh-cert { font-size: 13px; color: #4f6159; margin: 8px 0; }
.sh-cert { font-size: 14px; color: var(--paper-ink); }
.sh-sign { display: grid; grid-template-columns: 2fr 1fr; gap: 26px 28px; margin-top: 30px; }
.sig { display: flex; flex-direction: column; font-size: 13px; color: #4f6159; }
.sig .line { border-bottom: 1.5px solid #1b2a24; height: 30px; }
.blank, .blank-line { display: inline-block; border-bottom: 1.5px solid #1b2a24; height: 1.1em; vertical-align: bottom; }
.blank-line { color: #8a9a92; font-weight: 400; border-bottom-style: dotted; height: auto; font-size: 13px; }
.w4 { width: 4em; } .w8 { width: 8em; } .w10 { width: 10em; } .w12 { width: 12em; } .w16 { width: 18em; max-width: 100%; }
.tin-p { display: none; }
#print-root { display: none; }

/* sub-pages: breadcrumb, receipt lines */
.crumbs { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
.h-lines { margin: 18px 0 6px; }
.rlines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 8px 12px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rline.bad { box-shadow: inset 4px 0 0 var(--bad); padding-left: 10px; }
.rline .r-iss { grid-column: 1 / -1; margin: 0; color: var(--bad); }
.rline .r-iss.warn { color: var(--warn); }
@media (max-width: 640px) { .rline { grid-template-columns: 1fr 1fr; } .rline [data-rm] { grid-column: 1 / -1; justify-self: start; } }
.rline input { min-width: 0; }
@media (max-width: 400px) { .rline { grid-template-columns: 1fr; } }

/* details panel */
.me { border-left: 4px solid var(--accent); padding-left: 16px; }
.seg { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.seg legend { font-weight: 700; margin-bottom: 4px; padding: 0; }
.seg label { display: flex; gap: 8px; align-items: center; font-weight: 500; min-height: 44px; }
.tin-box label { margin-bottom: 0; }
.tin-masked { appearance: none; width: 100%; text-align: left; margin-top: 4px; min-height: 46px; border: 1.5px dashed #9fb5aa; border-radius: 8px; background: var(--soft); color: var(--ink); font: 16px var(--sans); padding: 10px 11px; cursor: pointer; font-variant-numeric: tabular-nums; }
.tin-note { background: var(--soft); border-left: 4px solid var(--mark); padding: 10px 14px; margin: 16px 0 0; max-width: 70ch; }

/* explainer */
.prose > * { max-width: 760px; }
.prose p { margin: 0 0 14px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 0; min-height: 44px; }
.faq details p { margin: 0 0 14px; }

/* footer */
.foot { margin-top: 40px; border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: 15px; }
.sb-footer p { margin: 0 0 10px; }
.sb-more a { color: var(--muted); }
.sb-credit a, .sb-privacy { color: var(--ink); }

@media (max-width: 640px) {
  .fam-edit { grid-template-columns: 1fr; }
  .sheet { padding: 18px 16px; font-size: 14px; }
  .sh-title { text-align: left; }
  .sh-sign { grid-template-columns: 1fr; gap: 18px; }
  .row { grid-template-columns: 1fr; }
  .r-btns { grid-column: 1; grid-row: auto; margin-top: 4px; }
  .sh-table th, .sh-table td { padding: 3px 4px; }
  .sh-table.pay { font-size: 12.5px; }
  .sh-table.mon { font-size: 12.5px; }
  /* a family with three or four children has a wide month table: it scrolls inside the sheet, never the page */
  .sheet { overflow-x: auto; }
}
@media (max-width: 520px) {
  table.sum thead { display: none; }
  table.sum, .sum tbody, .sum tfoot, .sum tr, .sum th, .sum td { display: block; width: 100%; }
  .sum tr { border-bottom: 1px solid var(--line); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 0 14px; }
  .sum th, .sum td { border: 0; padding: 2px 0; text-align: left !important; width: auto; }
  .sum tbody th, .sum tfoot th { width: 100%; }
  .sum td[data-l="Children"] { width: 100%; }
  .sum td:empty { display: none; }
  .sum td[data-l]:not([data-l=""])::before { content: attr(data-l) ": "; color: var(--muted); }
  .sum tfoot th, .sum tfoot td { border: 0; }
  .sum tfoot tr { border-top: 2px solid var(--ink); }
}
@media (max-width: 420px) {
  .tabs button { font-size: 15.5px; padding: 12px 8px 10px; }
  .tabs .count { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* print: only the sheets in #print-root */
@media print {
  @page { margin: 0.5in 0.55in; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .sheet { border: 0; box-shadow: none; border-radius: 0; padding: 0; max-width: none; font-size: 10.5pt; color: #000; background: #fff; break-after: page; }
  .sheet:last-child { break-after: auto; }
  .sh-head { flex-wrap: nowrap; }
  .sh-title { text-align: right; }
  .sh-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sh-sign { grid-template-columns: 2fr 1fr; }
  .tin-s { display: none; }
  .sheet:not(.copy) .prov-only { display: none; }
  .tin-p { display: inline; }
  .sh-table thead { display: table-header-group; }
  .sh-table tfoot { display: table-row-group; }
  .sh-table tr { break-inside: avoid; }
  .sh-table th, .sh-table td { padding: 2.5pt 6pt; }
  .sh-end { break-inside: avoid; }
  .sh-table tbody.tail { break-inside: avoid; }
  .sh-table.pay { font-size: 9.5pt; }
  .sh-table tr.after td { font-size: 10.5pt; padding: 0; }
  .sh-table.pay th, .sh-table.pay td { padding: 1.6pt 5pt; }
  .sh-table tfoot, .sh-years, .sh-other { break-inside: avoid; }
  /* a statement fits one page: compact month rows, and the notes travel with the signature */
  .sh-table.mon th, .sh-table.mon td, .sh-table.oth th, .sh-table.oth td { padding: 1.4pt 6pt; line-height: 1.2; }
  .sh-to { margin: 9pt 0; }
  .sh-after { break-inside: avoid; }
  .sh-sign { margin-top: 16pt; gap: 12pt 20pt; }
  .sig .line { height: 20pt; }
  .sh-end { margin-top: 8pt; }
  .sh-basis, .sh-cert { margin: 5pt 0; }
  .sh-other .sub { font-size: 9pt; }
  .summary-sheet .sh-table { font-size: 10pt; }
  .blank-sheet .sh-table td, .blank-sheet .sh-table th { padding: 7pt 6pt; }
  .blank-sheet .sh-table tbody td, .blank-sheet .sh-table tbody th { border-bottom: 0; }
}
