/* Box12TT — design tokens follow DESIGN.md */
:root {
  --paper: #f7f8f6;
  --sheet: #ffffff;
  --ink: #1c1e21;
  --ink-2: #4d5560;
  --form-red: #c4122f;
  --form-red-soft: #f6dfe3;
  --greenbar: #e7f1e4;
  --rule: #d5d9d3;
  --ok: #1f6f43;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --focus: #1d4ed8;
  --radius-s: 2px;
  --radius-m: 6px;
  --measure: 68ch;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums lining-nums;
}
a { color: var(--ink); text-decoration-color: var(--form-red); text-underline-offset: 3px; }
a:hover { color: var(--form-red); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img, svg { max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* header */
.site-head { border-bottom: 1px solid var(--rule); background: var(--sheet); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 20px; font-size: 0.95rem; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--form-red); }

/* type scale (1.25) */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: var(--measure); }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 54ch; }
.small { font-size: 0.875rem; color: var(--ink-2); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px;
  border-radius: var(--radius-m); border: 2px solid var(--ink); background: var(--ink); color: #fff; font: inherit;
  font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: #000; color: #fff; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: var(--sheet); color: var(--ink); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* hero */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 40px; } .hero { padding-top: 48px; } }

/* the W-2 fragment: red form boxes */
.w2 { background: var(--sheet); border: 1.5px solid var(--form-red); color: var(--form-red); font-size: 0.8rem; line-height: 1.3; box-shadow: 0 1px 0 var(--rule); }
.w2-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--form-red); }
.w2-row:last-child { border-bottom: 0; }
.w2-cell { padding: 6px 10px 10px; border-right: 1px solid var(--form-red); min-height: 64px; }
.w2-cell:last-child { border-right: 0; }
.w2-cell .lbl { display: block; }
.w2-cell .val { display: block; margin-top: 8px; color: var(--ink); font-size: 1.05rem; font-weight: 600; }
.box12 { display: grid; grid-template-columns: 40px 56px 1fr; align-items: stretch; border-top: 1px solid var(--form-red); }
.box12 > span { padding: 8px 10px; border-right: 1px solid var(--form-red); }
.box12 > span:last-child { border-right: 0; }
.box12 .code { color: var(--ink); font-weight: 800; font-size: 1.15rem; }
.box12 .amt { color: var(--ink); font-weight: 800; font-size: 1.6rem; text-align: right; letter-spacing: -0.01em; }
.w2-caption { margin-top: 10px; }
.calc-chain { margin: 18px 0 0; padding: 0; list-style: none; font-size: 0.92rem; }
.calc-chain li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.calc-chain li:last-child { border-bottom: 0; font-weight: 700; }
.calc-chain b { font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
  .box12 .amt { animation: fill 1.2s steps(14, end) 0.3s both; }
  @keyframes fill { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
}

/* sections */
section { padding: 56px 0; }
.band { background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; gap: 24px; } }

.mismatch { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.mismatch li { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: baseline; }
.mismatch .ex { color: var(--ink-2); font-size: 0.92rem; text-align: right; white-space: nowrap; }
@media (max-width: 600px) { .mismatch li { grid-template-columns: 1fr; gap: 2px; } .mismatch .ex { text-align: left; white-space: normal; } }

.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.steps li { counter-increment: step; border-top: 3px solid var(--ink); padding-top: 14px; }
.steps li::before { content: "Step " counter(step); display: block; font-weight: 800; color: var(--form-red); margin-bottom: 6px; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; gap: 20px; } }

.price { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); background: var(--sheet); border-radius: var(--radius-s); }
.price > div { padding: 28px; }
.price > div + div { border-left: 1.5px solid var(--ink); }
.price .amount { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; margin: 8px 0 4px; }
.price ul { padding-left: 1.1em; margin: 16px 0 0; }
.price li { margin: 4px 0; }
@media (max-width: 700px) { .price { grid-template-columns: 1fr; } .price > div + div { border-left: 0; border-top: 1.5px solid var(--ink); } }

.faq details { border-bottom: 1px solid var(--rule); padding: 14px 0; max-width: 80ch; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 0; }

.site-foot { border-top: 1px solid var(--rule); padding: 32px 0 48px; font-size: 0.9rem; color: var(--ink-2); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-foot p { max-width: 72ch; }

/* article pages */
.article { padding: 48px 0 72px; }
.article h1 { font-size: clamp(2rem, 4vw, 2.8rem); max-width: 24ch; }
.article h2 { font-size: 1.5rem; margin-top: 1.8em; }
.article p, .article li { max-width: var(--measure); }
.article table { border-collapse: collapse; margin: 16px 0 24px; font-size: 0.95rem; }
.article th, .article td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; }
.article td.n, .article th.n { text-align: right; }
.callout { border-left: 4px solid var(--form-red); background: var(--sheet); padding: 14px 18px; margin: 20px 0; max-width: var(--measure); }

/* tool */
.tool { padding: 32px 0 72px; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 24px; margin-bottom: 24px; }
.panel h2 { font-size: 1.3rem; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .upload-grid { grid-template-columns: 1fr; } }
.drop { border: 2px dashed var(--rule); border-radius: var(--radius-m); padding: 20px; background: var(--paper); }
.drop.over { border-color: var(--focus); background: #eef3ff; }
.drop label { font-weight: 700; display: block; margin-bottom: 6px; }
.drop input[type=file] { width: 100%; font: inherit; }
.file-name { font-size: 0.9rem; color: var(--ok); margin-top: 6px; min-height: 1.4em; }
.settings { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.settings label { display: inline-flex; gap: 8px; align-items: center; }
select, input[type=text] { font: inherit; padding: 8px 10px; border: 1px solid #9aa1a9; border-radius: var(--radius-s); background: #fff; color: var(--ink); }

.msg { border-radius: var(--radius-m); padding: 12px 16px; margin: 0 0 16px; }
.msg.error { background: var(--form-red-soft); color: #7a0b1d; }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg ul { margin: 6px 0 0; padding-left: 1.2em; }

.totals { display: grid; grid-template-columns: repeat(4, 1fr); border: 1.5px solid var(--form-red); background: var(--sheet); margin-bottom: 20px; }
.totals > div { padding: 10px 14px; border-right: 1px solid var(--form-red); }
.totals > div:last-child { border-right: 0; }
.totals .lbl { color: var(--form-red); font-size: 0.8rem; }
.totals .val { font-size: 1.5rem; font-weight: 800; }
@media (max-width: 700px) { .totals { grid-template-columns: 1fr 1fr; } .totals > div:nth-child(2) { border-right: 0; } .totals > div:nth-child(-n+2) { border-bottom: 1px solid var(--form-red); } }

.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--sheet); }
table.ledger { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.ledger th { text-align: left; font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; background: var(--sheet); }
table.ledger td { padding: 7px 10px; border-bottom: 1px solid #edf0ec; white-space: nowrap; }
table.ledger td.n, table.ledger th.n { text-align: right; }
table.ledger tbody tr:nth-child(4n+1), table.ledger tbody tr:nth-child(4n+2) { background: var(--greenbar); }
table.ledger.detail tbody tr:nth-child(4n+1), table.ledger.detail tbody tr:nth-child(4n+2) { background: transparent; }
table.ledger.detail tbody tr:nth-child(odd) { background: var(--greenbar); }
table.ledger tr.locked td.n.tt { filter: blur(5px); user-select: none; }
.row-toggle { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--form-red); text-underline-offset: 3px; cursor: pointer; text-align: left; }
tr.detail-row > td { background: var(--paper) !important; padding: 12px; white-space: normal; }
.flag { display: inline-block; font-size: 0.78rem; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); margin: 1px 2px; white-space: nowrap; }
.flag.err { background: var(--form-red-soft); color: #7a0b1d; }
.legend dt { font-weight: 700; margin-top: 8px; }
.legend dd { margin: 2px 0 0; max-width: var(--measure); }
.unlock { border: 1.5px solid var(--ink); border-radius: var(--radius-m); padding: 18px 20px; background: var(--sheet); margin: 20px 0; display: grid; gap: 12px; }
.unlock form { display: flex; gap: 10px; flex-wrap: wrap; }
.unlock input { flex: 1 1 260px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* print: audit trail */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 10pt; }
  .site-head, .site-foot, .no-print, .panel.upload, .unlock { display: none !important; }
  .print-only { display: block; }
  .table-scroll { overflow: visible; border: 0; }
  table.ledger { font-size: 8.5pt; }
  tr.detail-row { display: table-row !important; }
  tr.detail-row[hidden] { display: table-row !important; }
  table.ledger tbody tr { break-inside: avoid; }
}
