/* Layout: single centered column (~70ch) with a wide tool band; feels like official correspondence.
   Palette: letter paper, typewriter ink, certified-mail green, return-stamp red. */
:root {
  --bg: #f6f5f1;
  --paper: #ffffff;
  --ink: #1b1d21;
  --muted: #5b6068;
  --line: #dcdad3;
  --accent: #1d6b45;      /* certified mail green */
  --accent-soft: #e4efe8;
  --stamp: #b4361f;       /* return-to-sender red */
  --stamp-soft: #f7e6e1;
  --warn: #9a6408;
  --font-display: "Zilla Slab", Rockwell, Georgia, serif;
  --font-body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 8px;
  --wide: 1080px;
  --read: 70ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --paper: #1d2024; --ink: #ecebe6; --muted: #a5a9ae; --line: #33373c;
    --accent: #6fcf9a; --accent-soft: #1d3127; --stamp: #f08a73; --stamp-soft: #3a221d; --warn: #e2ad4f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --paper: #1d2024; --ink: #ecebe6; --muted: #a5a9ae; --line: #33373c;
  --accent: #6fcf9a; --accent-soft: #1d3127; --stamp: #f08a73; --stamp-soft: #3a221d; --warn: #e2ad4f; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--wide); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.read { max-width: var(--read); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.2rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
.eyebrow { font-family: var(--font-data); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.lede { font-size: 1.25rem; color: var(--muted); }
.fine { font-size: .875rem; color: var(--muted); }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
.prose { display: flex; flex-direction: column; gap: 14px; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose li + li { margin-top: 6px; }
.prose h2 { margin-top: 18px; }

.site-head { border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center; padding-block: 14px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--stamp); }
.nav { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }

.hero { padding-block: 48px 32px; }
.section { padding-block: 48px; }
.section + .section { border-top: 1px solid var(--line); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: 6px; background: var(--accent); color: var(--paper); font: inherit; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.states { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.state-link { display: flex; flex-direction: column; gap: 2px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.state-link:hover { border-color: var(--accent); }
.state-link b { font-family: var(--font-display); font-size: 1.2rem; }
.state-link span { font-size: .85rem; color: var(--muted); }

/* Tool */
.tool { display: grid; gap: 28px; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .tool { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .875rem; font-weight: 700; }
.row2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.row2 > * { min-width: 0; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
input, select, textarea { min-width: 0; max-width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: auto; margin-top: 5px; }

.result { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.verdict { border-left: 6px solid var(--line); padding: 4px 0 4px 16px; display: flex; flex-direction: column; gap: 6px; }
.verdict.owed { border-color: var(--stamp); }
.verdict.ok { border-color: var(--accent); }
.verdict.wait { border-color: var(--warn); }
.verdict b.big { font-family: var(--font-data); font-size: clamp(2rem, 6vw, 2.8rem); font-variant-numeric: tabular-nums; line-height: 1.05; font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.facts div { border-top: 2px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.facts b { font-family: var(--font-data); font-weight: 600; font-size: 1.1rem; }

/* Letter preview */
.letter { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 28px; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.55; white-space: pre-wrap; overflow: hidden; }
.letter.locked .rest { filter: blur(5px); user-select: none; pointer-events: none; }
.letter .stamp { position: absolute; right: 18px; top: 18px; transform: rotate(8deg); color: var(--stamp); border: 3px solid var(--stamp); padding: 4px 10px; font-family: var(--font-data); font-weight: 700; letter-spacing: .08em; font-size: .8rem; opacity: .85; }
.buybox { background: var(--accent-soft); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.buybox ul { margin: 0; padding-left: 1.2em; }
.unlock-row { display: flex; gap: 10px; flex-wrap: wrap; }
.unlock-row input { flex: 1 1 220px; }
.msg { font-size: .9rem; font-weight: 700; }
.msg.err { color: var(--stamp); }
.msg.good { color: var(--accent); }
.kit { display: flex; flex-direction: column; gap: 14px; }

table.law { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.law th, table.law td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.law th { width: 34%; font-weight: 700; }
.table-scroll { overflow-x: auto; }
.disclaimer { background: var(--stamp-soft); border-radius: var(--radius); padding: 14px 18px; font-size: .9rem; }
details { border-bottom: 1px solid var(--line); padding-block: 12px; }
summary { cursor: pointer; font-weight: 700; }
details p { margin: 8px 0 0; }

.site-foot { border-top: 1px solid var(--line); margin-top: 40px; }
.site-foot .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 30px; font-size: .875rem; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-foot a { color: var(--muted); }

@media print {
  body { background: #fff; color: #000; }
  .site-head, .site-foot, .no-print { display: none !important; }
  .letter { border: 0; padding: 0; }
  .print-break { page-break-before: always; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
