:root {
  --bg: #eef2f1;
  --paper: #ffffff;
  --ink: #172321;
  --muted: #4c5b58;
  --line: #cdd8d5;
  --rule: #9fb3ae;
  --accent: #0d5257;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe8;
  --tag: #e6eeec;
  --pos: #17633a;
  --neg: #a33a12;
  --bad: #a3271b;
  --info-bg: #fff4d6;
  --info-line: #d9a514;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1516; --paper: #122022; --ink: #e3ecea; --muted: #a5b8b4; --line: #2a3d3f; --rule: #4a6663;
    --accent: #7cc9c4; --accent-ink: #062022; --accent-soft: #173a3b; --tag: #1b2f31;
    --pos: #8fd6a8; --neg: #f3a07a; --bad: #ff9c8f; --info-bg: #2e2812; --info-line: #b98d14;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--font); font-variant-numeric: tabular-nums; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.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: 30; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* header */
.top { background: var(--accent); color: var(--accent-ink); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 700; }
.top nav { display: flex; gap: 14px; }
.top nav a { color: inherit; font-size: 15px; padding: 12px 0; }

.hero { padding: 22px 16px 6px; }
.hero h1 { font-size: clamp(27px, 5.4vw, 40px); font-weight: 750; }
.lede { margin: 8px 0 0; max-width: 64ch; color: var(--muted); font-size: 17px; }

/* tool shell */
.tool { padding-top: 14px; padding-bottom: 28px; }
.banner, .note { background: var(--info-bg); border-left: 4px solid var(--info-line); padding: 10px 12px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.formpick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.formpick legend { font-weight: 650; margin-bottom: 6px; padding: 0; }
.pick { display: flex; gap: 10px; align-items: flex-start; background: var(--paper); border: 2px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; min-height: 44px; }
.pick input { margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.pick b { display: block; font-size: 16px; }
.pick small { display: block; color: var(--muted); font-size: 14px; }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.form-check { margin: 10px 0 0; padding: 8px 12px; border-left: 4px solid var(--rule); background: var(--paper); font-size: 15px; }
.form-check.info { border-left-color: var(--info-line); background: var(--info-bg); }
.form-check .btn { margin-left: 6px; }

.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 14px 0 0; background: var(--paper); border-top: 3px solid var(--accent); }
.strip > div { padding: 10px 12px; border-right: 1px solid var(--line); }
.strip > div:last-child { border-right: 0; }
.strip dt { font-size: 14px; color: var(--muted); }
.strip .lno { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.strip dd { margin: 2px 0 0; font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.strip dd.zero { color: var(--muted); font-weight: 500; font-size: 17px; }
.strip dd.pos { color: var(--pos); }
.strip dd.neg { color: var(--neg); }

.tabs { display: flex; gap: 2px; margin-top: 16px; border-bottom: 2px solid var(--accent); overflow-x: auto; }
.tabs button { font: inherit; font-size: 16px; background: transparent; color: var(--ink); border: 0; padding: 10px 14px; min-height: 44px; cursor: pointer; border-radius: var(--r) var(--r) 0 0; white-space: nowrap; }
.tabs button[aria-selected=true] { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.panel { background: var(--paper); padding: 14px 14px 18px; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 10px; max-width: 70ch; }
.sec { font-size: 20px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--rule); }
.panel > .sec:first-child, .panel > .hint + .sec, .ly + .sec { margin-top: 6px; }
.subh { font-size: 17px; margin: 20px 0 6px; color: var(--accent); }

/* one form line */
.lines { display: block; }
.ln { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ln-h { display: grid; grid-template-columns: 3.1rem 1fr auto; gap: 8px; align-items: baseline; }
.ln-h .lbl { font-size: 16px; min-width: 0; overflow-wrap: break-word; }
.ln-h .lbl small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.no { font-family: var(--mono); font-size: 14px; font-weight: 700; background: var(--tag); border-radius: 3px; padding: 1px 5px; justify-self: start; }
.no.nonum { visibility: hidden; }
.aside { color: var(--muted); font-size: 14px; }
.mo { font-weight: 700; text-align: right; min-width: 6.5em; }
.mo.zero { color: var(--muted); font-weight: 500; }
.subl .ln-h { padding-left: 1.2rem; }
.ents { padding-left: 3.1rem; margin-left: 8px; }
.ent { margin-top: 8px; }
.amtrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cur { color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px; min-height: 44px; }
input[aria-invalid=true] { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.amt { width: 9.5em; text-align: right; }
.frq { max-width: 11.5em; }
.per { width: 4.5em; text-align: right; }
.perw { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.desc { width: 100%; max-width: 32em; margin: 4px 0 6px; }
.item-h { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; color: var(--muted); }
.item-mo { font-weight: 650; color: var(--ink); }
.item + .item { border-top: 1px dashed var(--line); padding-top: 8px; }
.grp-hint { margin: 2px 0 0 calc(3.1rem + 8px); font-size: 14px; color: var(--muted); }
.work { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.work:empty { display: none; }
.work.err { color: var(--bad); font-weight: 600; }
.opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 6px; }
.note-l { display: flex; align-items: center; gap: 6px; flex: 1 1 18em; font-size: 15px; }
.note-l .note-in { flex: 1; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.tot { border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); background: var(--accent-soft); padding: 10px 8px; margin: 2px -8px 0; }
.tot .lbl { font-weight: 650; }
.tot .mo { font-size: 18px; }
.sumline .lbl { font-weight: 600; }
.fnote { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.txt input { margin: 6px 0 0 calc(3.1rem + 8px); width: min(20em, calc(100% - 3.1rem - 8px)); }
.count { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; margin: 0 0 4px; }
.count input, .num { width: 5em; }
.ly-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ly-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }

/* buttons */
.btn { font: inherit; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 36px; padding: 4px 10px; font-size: 15px; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.link { font: inherit; font-size: 15px; background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 10px 0; min-height: 44px; }
.add { margin-left: calc(3.1rem + 8px); }
.more { font: inherit; font-size: 14px; background: var(--tag); color: var(--ink); border: 0; border-radius: 4px; min-height: 44px; padding: 4px 10px; cursor: pointer; }
.rm { color: var(--bad); }
.next { margin-top: 18px; display: flex; justify-content: flex-end; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Section III */
.case { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.seg { border: 0; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 0 14px; }
.seg legend { font-weight: 650; font-size: 15px; padding: 0; margin-bottom: 2px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.seg input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.seg.cs { flex-direction: column; }
.acat { padding: 8px 0; border-bottom: 1px solid var(--line); }
.acat-h { display: flex; justify-content: space-between; gap: 10px; }
.acat-h .lbl { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.aitem { margin: 6px 0 4px 12px; padding: 8px 10px; border-left: 3px solid var(--accent-soft); }
.af-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13em, 1fr)); gap: 8px 12px; align-items: end; }
.af { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.af input, .af select { color: var(--ink); width: 100%; }
.arm { color: var(--bad); padding: 6px 0; }
.atot, .nw { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 10px 8px; margin-top: 6px; background: var(--accent-soft); border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
.atot span, .nw span { font-weight: 600; }
.atot .split { grid-column: 1 / -1; font-weight: 400; font-size: 15px; color: var(--muted); }
.nw .hint { grid-column: 1 / -1; margin: 0; }

/* answer sheet */
.out-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 12px; }
.warn { color: var(--bad); font-weight: 600; }
.sheet { font-size: 15px; }
.sh-head h2 { font-size: 20px; margin: 2px 0 6px; }
.sh-head p { margin: 0 0 6px; max-width: 80ch; }
.sh-kicker { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sh-oath { font-weight: 600; }
.sh-sec { margin-top: 18px; }
.sh-sec h3 { font-size: 17px; margin-bottom: 6px; color: var(--accent); }
.sh-sec h4 { font-size: 16px; margin: 10px 0 4px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 5px 6px; border-bottom: 1px solid var(--line); }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--rule); }
.c-no { width: 3.6em; font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.c-am { text-align: right; white-space: nowrap; width: 8.5em; }
.lines-t .c-lb { width: 42%; }
.c-wk { color: var(--muted); font-size: 14px; }
.hrow th { background: var(--tag); color: var(--ink); font-size: 14px; }
.hrow .cnt { font-weight: 400; }
.trow td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
.trow .c-wk { font-weight: 400; }
.srow .c-lb, .srow td:first-child + td { padding-left: 1.4em; }
.est { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--neg); }
.lb { color: var(--muted); font-style: italic; font-weight: 400; }
.bad { color: var(--bad); font-weight: 600; }
.fn { color: var(--muted); font-size: 14px; }
.cat { display: block; font-size: 13px; color: var(--muted); }
.split { font-weight: 400; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.s3-t.c, .s3-t.b { table-layout: fixed; }
.s3-t.c th:nth-child(1) { width: 29%; } .s3-t.c th:nth-child(2) { width: 15%; }
.s3-t.c th:nth-child(3), .s3-t.c th:nth-child(4), .s3-t.c th:nth-child(5) { width: 15%; } .s3-t.c th:nth-child(6) { width: 11%; }
.s3-t.b th:nth-child(1) { width: 50%; } .s3-t.b th:nth-child(2) { width: 20%; } .s3-t.b th:nth-child(3), .s3-t.b th:nth-child(4) { width: 15%; }
.s3-t td { overflow-wrap: anywhere; }
.s3-t .c-am { width: auto; }
.s3-t .split { display: block; white-space: normal; }
.todo { margin: 0; padding-left: 1.2em; }
.todo li { margin-bottom: 4px; overflow-wrap: anywhere; }

/* keep safe */
.keep { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--rule); }
.keep h2 { font-size: 18px; margin-bottom: 4px; }
.hint.warn { color: var(--bad); }
.ask { margin-top: 10px; padding: 12px; background: var(--info-bg); border-left: 4px solid var(--info-line); }
.ask p { margin: 0 0 8px; }
.kept { margin-top: 10px; }
.kept summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.klist { margin: 0; padding-left: 1.2em; }
.klist li { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.undo { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 10px 8px 14px; border-radius: var(--r); display: flex; gap: 12px; align-items: center; max-width: calc(100% - 24px); z-index: 20; font-size: 15px; }

/* page text */
.prose { padding-top: 10px; padding-bottom: 10px; }
.prose h2 { font-size: 22px; margin: 22px 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); max-width: 75ch; }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 650; min-height: 44px; }
.faq details p { margin-top: 0; }

/* footer */
.foot { margin-top: 30px; padding: 20px 0 30px; background: var(--paper); border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.sb-more { line-height: 1.9; }
.sb-more a, .sb-credit a { color: var(--accent); }
.sb-privacy { font-weight: 600; color: var(--ink); }

@media (max-width: 640px) {
  .formpick { gap: 6px; }
  .pick { padding: 8px; gap: 6px; }
  .pick b { font-size: 15px; }
  .pick small { font-size: 13px; }
  .hero { padding-top: 16px; }
  .lede { font-size: 16px; }
  .strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .strip > div:nth-child(2) { border-right: 0; }
  .strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .panel { padding: 12px 10px 16px; margin: 0 -6px; }
  .ln-h { grid-template-columns: 2.7rem minmax(0, 1fr); }
  .tot { margin: 2px 0 0; }
  .ln-h .mo { grid-column: 2; text-align: left; min-width: 0; }
  .ln-h .mo:empty { display: none; }
  .ln-h .nonum { display: none; }
  .ln-h:has(.nonum) { grid-template-columns: minmax(0, 1fr); }
  .ln-h:has(.nonum) .mo { grid-column: 1; }
  .ents, .grp-hint { padding-left: 0; margin-left: 0; }
  .add { margin-left: 0; }
  .txt input { margin-left: 0; width: 100%; }
  .amt { width: 8.2em; }
  .ly-grid { grid-template-columns: 1fr; }
  .tabs button { padding: 10px 10px; font-size: 15px; }
  .note-l { flex-basis: 100%; min-width: 0; }
  /* stacked answer sheet rows */
  .lines-t, .lines-t tbody { display: block; width: 100%; }
  .lines-t td, .lines-t th { min-width: 0; width: auto !important; overflow-wrap: anywhere; }
  .lines-t .c-am { white-space: normal; overflow-wrap: normal; text-align: right; }
  .lines-t thead { display: none; }
  .lines-t tr { display: grid; grid-template-columns: 2.8em minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
  .lines-t td { border: 0; }
  .lines-t .c-lb { width: auto; }
  .lines-t .c-wk { grid-column: 2 / -1; padding-top: 0; }
  .lines-t .c-wk:empty { display: none; }
  .lines-t .hrow { display: block; }
  .lines-t .hrow th { display: block; }
  .lines-t .trow { border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
  .lines-t .trow td { border: 0; }
  .s3-t.b, .s3-t.b tbody { display: block; width: 100%; }
  .s3-t.b thead { display: none; }
  .s3-t.b tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
  .s3-t.b td { border: 0; min-width: 0; }
  .s3-t.b td:nth-child(3)::before { content: "Nonmarital: "; color: var(--muted); font-size: 13px; }
  .s3-t.b td:nth-child(4)::before { content: "Checked: "; color: var(--muted); font-size: 13px; }
  .s3-t.b td:empty { display: none; }
  .s3-t.c, .s3-t.c tbody { display: block; width: 100%; }
  .s3-t.c thead { display: none; }
  .s3-t.c tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
  .s3-t.c td { border: 0; min-width: 0; width: auto !important; }
  .s3-t.c td:first-child { grid-column: 1 / -1; }
  .s3-t.c td:nth-child(3)::before { content: "B. Marital "; color: var(--muted); font-size: 13px; }
  .s3-t.c td:nth-child(4)::before { content: "C. Petitioner "; color: var(--muted); font-size: 13px; }
  .s3-t.c td:nth-child(5)::before { content: "C. Respondent "; color: var(--muted); font-size: 13px; }
  .s3-t.c td:empty { display: none; }
  .s3-t.c .c-am { text-align: left; width: auto; white-space: normal; }
  .s3-t.c td[colspan] { grid-column: 1 / -1; }
  .s3-t.c td[colspan]::before { content: "C. Nonmarital total "; }
  .s3-t.c td:nth-child(6):not(:empty)::before { content: "Checked: "; color: var(--muted); font-size: 13px; }
  .nw-t td { overflow-wrap: anywhere; }
}
@media (max-width: 440px) {
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; border-bottom-width: 2px; }
  .tabs button { border-radius: var(--r) var(--r) 0 0; background: var(--tag); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* print: only the answer sheet */
@media print {
  @page { size: auto; margin: 14mm 13mm; }
  :root { --ink: #000; --muted: #333; --line: #bbb; --rule: #777; --accent: #000; --accent-soft: transparent; --tag: transparent; --bad: #000; --neg: #000; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .top, .hero, .skip, .foot, #how, #faq, .undo, .banner, .note, .formpick, .form-check, .strip, .tabs, .keep, #p-inc, #p-exp, #p-ast, .out-bar, #out-err { display: none !important; }
  .tool, .wrap { padding: 0; max-width: none; }
  #p-out { display: block !important; padding: 0; background: none; }
  .sheet { font-size: 10pt; }
  .sh-head h2 { font-size: 14pt; }
  .sh-sec { margin-top: 10pt; }
  .sh-sec h3 { font-size: 12pt; break-after: avoid; page-break-after: avoid; }
  .sh-sec h4 { break-after: avoid; page-break-after: avoid; }
  .sh-keep, .nw-t, .top-t, .sh-end { break-inside: avoid; }
  .sh-end { break-before: avoid; }
  th, td { padding: 3pt 4pt; }
  .c-wk { font-size: 9pt; color: #222; }
  .s3-t { font-size: 9pt; }
  tr, tbody { break-inside: avoid; page-break-inside: avoid; }
  thead { display: table-header-group; }
  .lines-t tbody, .s3-t tbody { break-inside: auto; }
  .s3-t tbody.tots { break-inside: avoid; page-break-inside: avoid; }
  .s3-t tbody.tots { break-before: avoid; page-break-before: avoid; }
  .lines-t tbody.grp { break-inside: avoid; page-break-inside: avoid; }
  .lines-t tbody tr { break-inside: avoid; }
  .hrow th { border-top: 1px solid #000; }
  a { color: #000; text-decoration: none; }
}
.s3-t th.c-am { white-space: normal; }
