:root {
  --ink: #1d2327;
  --muted: #5b6770;
  --line: #d9dee2;
  --bg: #f6f7f8;
  --card: #ffffff;
  --accent: #0f5c4c;
  --accent-soft: #e5f1ee;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --bad: #a3261c;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); }
header.site { background: var(--card); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.75rem; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding-inline: 1rem; }
main { padding-block: 1.5rem 4rem; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 46rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.85rem; font-weight: 700; margin-right: 0.5rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.3rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
input, select { font: inherit; width: 100%; padding: 0.55rem 0.65rem; border: 1px solid #b8c1c7; border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--bad); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.3rem; }
.choice { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; margin-bottom: 0.4rem; }
.choice input { width: auto; margin-top: 0.3rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td input { min-width: 6rem; padding: 0.4rem 0.5rem; }
tfoot td { font-weight: 700; border-bottom: 0; }
.total { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 0.6rem 1rem; border-radius: 6px; cursor: pointer; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.note { border-radius: 8px; padding: 0.7rem 0.9rem; margin: 0.75rem 0 0; font-size: 0.9rem; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.info { background: var(--accent-soft); color: var(--accent); }
.note.bad { background: #fde8e6; color: var(--bad); }
.working { font-size: 0.9rem; color: var(--muted); }
.working li { margin-bottom: 0.3rem; }
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; padding-block: 1.5rem; }
.doors { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.door { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.door:hover { border-color: var(--accent); }
.door strong { display: block; margin-bottom: 0.3rem; }
.door .soon { font-size: 0.8rem; color: var(--muted); }
.door[aria-disabled="true"] { opacity: 0.65; pointer-events: none; }

/* Printable statement */
.statement { display: none; }
.statement.show { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
@media print {
  body { background: #fff; }
  header.site, footer.site, .no-print, main > :not(.statement) { display: none !important; }
  .statement { display: block; font-size: 10.5pt; color: #000; }
  .statement h1 { font-size: 15pt; }
  .statement table { font-size: 9.5pt; }
  .statement th, .statement td { padding: 0.25rem 0.35rem; }
  @page { margin: 15mm; }
}
.statement .meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem 1.5rem; margin: 0.75rem 0 1rem; }
.statement .meta div span { display: block; font-size: 0.8em; color: #555; }
.statement .small { font-size: 0.85em; color: #444; }

.total-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; font-weight: 600; margin: 0 0 1rem; }
#periods td:nth-child(-n+2), #results td:first-child { white-space: nowrap; }

#subs select { min-width: 9rem; padding: 0.4rem 0.5rem; }
#subs select[data-f="unit"] { min-width: 5.5rem; }
#subs input[data-f="name"], #clients input[data-f="name"] { min-width: 11rem; }

/* Long-form pages */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
.prose h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
.prose p, .prose li { margin: 0 0 0.6rem; }
.prose table { margin: 0.5rem 0 1rem; }
.prose .draft { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 0.6rem 0.9rem; font-size: 0.9rem; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-bottom: 0.75rem; }
