:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --text: #1c2321;
  --muted: #5d6762;
  --line: #dde2dd;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --good-bg: #e3f3ec; --good: #17603f;
  --act-bg: #e6eef9;  --act: #1b4c8a;
  --warn-bg: #fdf0dc; --warn: #8a4b00;
  --neutral-bg: #eef0ee; --neutral: #3d4541;
  --focus: #f2b705;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --card: #1b201e; --text: #e6ebe8; --muted: #9aa5a0; --line: #2e3532;
    --accent: #4fbf9f; --accent-ink: #0d1412;
    --good-bg: #173326; --good: #8ee0b8;
    --act-bg: #182a42;  --act: #a8c8f2;
    --warn-bg: #3a2a12; --warn: #f3c27a;
    --neutral-bg: #252b28; --neutral: #c9d1cd;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.site-header { padding: 48px 0 24px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--accent); }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.15; margin: .3em 0 .4em; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin: 0 0 20px;
}
h2 { font-size: 1.2rem; margin: 0 0 .4em; }
h2 + .hint { margin-top: 0; }
.card h2:not(:first-child) { margin-top: 1.6em; }
h3 { font-size: 1.02rem; margin: 1.6em 0 .6em; }
.hint { color: var(--muted); font-size: .95rem; }

/* income table */
.income-table .row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.income-table .row.head { border-top: 0; font-size: .82rem; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.year { font-weight: 600; }
.year small { display: block; font-weight: 400; color: var(--muted); }
.m-label { display: none; }
.money { position: relative; display: block; }
.money::before { content: "£"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
input[inputmode] {
  width: 100%;
  font: inherit;
  padding: 10px 12px 10px 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus-visible, button:focus-visible, summary:focus-visible, .check input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 560px) {
  .income-table .row { grid-template-columns: 1fr 1fr; }
  .income-table .row.head { display: none; }
  .year { grid-column: 1 / -1; }
  .m-label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
}

.whatcounts { margin-top: 12px; font-size: .95rem; }
.whatcounts summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.whatcounts ul { padding-left: 1.2em; }

.ex-wrap { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.ex-wrap summary { cursor: pointer; list-style: none; }
.ex-wrap summary::-webkit-details-marker { display: none; }
.ex-wrap summary .h2 { display: block; font-size: 1.2rem; font-weight: 700; }
.ex-wrap summary .h2::after { content: " ▸"; color: var(--accent); }
.ex-wrap[open] summary .h2::after { content: " ▾"; }
.ex-wrap summary .hint { display: block; margin-top: 2px; }
.exemptions { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: .95rem; }
.check:hover { background: var(--bg); }
.check input { margin-top: .3em; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* result */
.result { border-width: 2px; border-color: var(--accent); }
.result.idle { border-color: var(--line); border-style: dashed; }
.verdict { font-size: 1.25rem; font-weight: 700; padding: 14px 16px; border-radius: 10px; margin: 0 0 12px; }
.verdict.good { background: var(--good-bg); color: var(--good); }
.verdict.act { background: var(--act-bg); color: var(--act); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.verdict.neutral { background: var(--neutral-bg); color: var(--neutral); }

.years { list-style: none; padding: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; }
.years li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .95rem; }
.years li:first-child { border-top: 0; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-left: 6px; white-space: nowrap; }
.tag.over { background: var(--act-bg); color: var(--act); }
.tag.under { background: var(--neutral-bg); color: var(--neutral); }
.notes { padding-left: 1.2em; color: var(--muted); font-size: .92rem; }
.notes li + li { margin-top: 4px; }

.deadlines { list-style: none; padding: 0; margin: 0; }
.deadlines li { display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.deadlines li:first-child { border-top: 0; }
.deadlines time { font-weight: 700; font-variant-numeric: tabular-nums; }
.deadlines small { display: block; color: var(--muted); font-size: .85rem; }
.deadlines li.final time, .deadlines li.sa time { color: var(--accent); }
.deadlines li.passed { opacity: .55; }
.deadlines li.passed time { text-decoration: line-through; }
@media (max-width: 480px) { .deadlines li { grid-template-columns: 1fr; gap: 2px; } }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
button.primary {
  font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 12px 18px; cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }
.steps { padding-left: 1.3em; }
.steps li + li { margin-top: 6px; }

.plain { padding-left: 1.2em; }
.plain li + li { margin-top: 6px; }
.phases { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: .95rem; }
.phases th, .phases td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.phases th { font-size: .82rem; color: var(--muted); }

.site-footer { padding: 8px 16px 48px; font-size: .85rem; color: var(--muted); }

/* nav */
.topnav { display: flex; gap: 18px; padding-top: 16px; font-size: .92rem; font-weight: 600; }
.topnav a { text-decoration: none; }
.topnav a[aria-current] { color: var(--text); }

/* software chooser */
.opts { display: grid; gap: 4px; margin-bottom: 8px; }
.opts.cols { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.check small { display: block; color: var(--muted); font-size: .85rem; }
.check input[type=radio] { margin-top: .3em; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.sw-list { list-style: none; padding: 0; margin: 0 0 16px; }
.sw { border-top: 1px solid var(--line); padding: 14px 0; }
.sw:first-child { border-top: 0; }
.sw-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sw h3 { margin: 0; }
.sw .star { color: var(--warn); font-size: .9em; }
.sw-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.sw-tags span { font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--neutral-bg); color: var(--neutral); }
.sw .small { margin: 4px 0 0; }
a.btn { flex: none; font-weight: 600; font-size: .9rem; text-decoration: none; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
a.btn:hover { filter: brightness(1.08); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 10px; background: var(--act-bg); color: var(--act); margin-top: 16px; }
.cta p { margin: 0; flex: 1 1 260px; }
.prose h2 { margin-top: 1.4em; }
