:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1d232b;
  --muted: #5b6470;
  --line: #dfe2e6;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --soft: #eef4f8;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --bad: #9b1c1c;
  --bad-bg: #fdecec;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1c2026;
    --ink: #e8ebef;
    --muted: #a3acb8;
    --line: #333a43;
    --accent: #6fb1e0;
    --accent-ink: #0d1b26;
    --soft: #1f2a33;
    --warn: #f0c36a;
    --warn-bg: #2e2614;
    --bad: #f39b9b;
    --bad-bg: #351c1c;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.top nav a { margin-left: 16px; text-decoration: none; font-size: 15px; }
.hero { padding: 48px 16px 24px; }
.eyebrow { color: var(--accent); font-weight: 600; margin: 0 0 8px; }
h1 { font-size: clamp(28px, 4.2vw, 42px); line-height: 1.15; margin: 0 0 16px; max-width: 22ch; }
h2 { font-size: 26px; margin: 48px 0 12px; }
h3 { font-size: 19px; margin: 24px 0 8px; }
h4 { margin: 20px 0 6px; }
.lede { font-size: 18px; max-width: 62ch; }
.checks { padding-left: 20px; max-width: 64ch; }
.checks li { margin: 4px 0; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 10px 18px; border-radius: 6px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn:focus-visible, .link:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 4px; }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 20px 24px; margin-top: 24px; }
.tool h2 { margin-top: 16px; }
.step { border-top: 1px solid var(--line); padding: 8px 0 16px; }
.step:first-of-type { border-top: 0; }
.n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--soft); color: var(--accent); font-size: 14px; margin-right: 6px; }
fieldset.modes { border: 0; padding: 0; margin: 0 0 12px; }
fieldset.modes legend { font-weight: 600; margin-bottom: 6px; }
fieldset.modes label { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.filepick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filepick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hint { color: var(--muted); font-size: 14px; max-width: 75ch; }
.error { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 6px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.grid-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
select, input[type=text] { font: inherit; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); max-width: 100%; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.strong { font-weight: 700; }
td.notes { min-width: 220px; }
#results td:first-child { white-space: nowrap; }
tr.locked td { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 2px 6px; margin: 0 4px 4px 0; }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.preview summary { cursor: pointer; margin: 12px 0 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.card { background: var(--soft); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; }
.card .k { font-size: 13px; color: var(--muted); }
.card .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.warnings { color: var(--warn); font-size: 14px; }
.unlock { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; border: 2px solid var(--accent); border-radius: 10px; padding: 16px 20px; margin: 20px 0; background: var(--soft); }
.unlock h4 { margin-top: 0; }
.notice { border-left: 4px solid var(--warn); background: var(--warn-bg); padding: 8px 12px; margin: 8px 0; border-radius: 4px; font-size: 14px; }
.notice p, .notice ul { margin: 4px 0; }
.unlock-actions { text-align: center; }
.exports { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 20px 0; }
.exports label { display: flex; flex-direction: column; gap: 4px; }
.prose { max-width: 760px; }
.formula { font-weight: 700; background: var(--soft); padding: 10px 14px; border-radius: 6px; }
.price { border: 1px solid var(--line); border-radius: 10px; padding: 8px 20px; background: var(--surface); }
.price .amount { font-size: 36px; font-weight: 800; margin: 8px 0; }
.price .amount span { font-size: 16px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.strong-text { font-weight: 600; }
.small { font-size: 13px; }
.foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 16px 0 32px; }
body[data-mode=payroll] .ts-only, body[data-mode=wide] .ts-only, body[data-mode=wide] .items-only { display: none; }
body[data-mode=timesheet] .pr-only { display: none; }
.print-only { display: none; }
@media (max-width: 640px) {
  .unlock { grid-template-columns: 1fr; }
  .top nav a { margin: 0 12px 0 0; }
  .tool { padding: 8px 14px 20px; }
}
@media print {
  body > *:not(#print-sheet) { display: none !important; }
  .print-only { display: block !important; color: #000; background: #fff; font-size: 11pt; }
  .print-only h1 { font-size: 15pt; max-width: none; }
  .print-only table { font-size: 10pt; }
  .print-only th { background: #eee; }
  .print-only tr.total td { font-weight: 700; border-top: 2px solid #000; }
}
