/* styles.css — lightweight, dependency-free, mobile-first. */
:root {
  --ink: #1a2233;
  --muted: #5a6478;
  --line: #e2e6ee;
  --bg: #f6f8fc;
  --card: #ffffff;
  --brand: #1f6feb;
  --brand-dark: #1550b8;
  --ok: #0f7b4f;
  --ok-bg: #e7f6ee;
  --warn: #9a5b00;
  --warn-bg: #fdf3e2;
  --info: #14607a;
  --info-bg: #e4f2f7;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
main, .site-header, .disclaimer { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.site-header { padding-top: 34px; text-align: center; }
h1 { font-size: 1.85rem; line-height: 1.2; margin: 0 0 .4em; }
.tagline { color: var(--muted); font-size: 1.05rem; margin: 0 auto; max-width: 620px; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }

.disclaimer {
  margin: 22px auto; background: var(--warn-bg); border: 1px solid #f0dcb8;
  color: #4a3a1a; border-radius: var(--radius); padding: 12px 16px; font-size: .93rem;
}
.disclaimer a { color: var(--brand-dark); }

.calc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: 0 1px 3px rgba(20,30,60,.05);
}
/* Tax-year segmented toggle */
.taxyear { border: 0; padding: 0; margin: 0 0 10px; }
.taxyear legend { font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: 6px; }
.seg { display: inline-flex; border: 1px solid #c9d1e0; border-radius: 10px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.seg-opt { position: relative; margin: 0; font-weight: 600; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span {
  display: block; padding: 10px 16px; cursor: pointer; color: var(--muted);
  border-right: 1px solid #c9d1e0; font-size: .95rem; white-space: nowrap;
}
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--brand); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brand-dark); outline-offset: -2px; }

/* Per-figure "rates used / verified" summary */
.rate-summary {
  background: #f2f6fe; border: 1px solid #d6e0f5; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 16px; font-size: .88rem;
}
.rate-summary .rs-head { margin: 0 0 8px; color: var(--ink); }
.rate-summary .rs-verified { color: var(--muted); }
.rate-summary a { color: var(--brand-dark); }
.rs-list { list-style: none; margin: 0; padding: 0; }
.rs-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-top: 1px solid #e2e8f5; }
.rs-list li span:first-child { color: var(--muted); }
.rs-list .rs-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.row { margin-bottom: 15px; }
.row label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .95rem; }
.row.check label { font-weight: 500; }
input[type="number"], select {
  width: 100%; padding: 11px 12px; font-size: 1rem; color: var(--ink);
  border: 1px solid #c9d1e0; border-radius: 9px; background: #fff;
}
input[type="checkbox"] { transform: translateY(1px); margin-right: 6px; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.cta, .exports button {
  cursor: pointer; border: 0; border-radius: 9px; font-size: 1rem; font-weight: 600;
}
.cta {
  width: 100%; margin-top: 8px; padding: 13px; color: #fff; background: var(--brand);
}
.cta:hover { background: var(--brand-dark); }

.results {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-top: 22px;
}
.results .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 620px) { .results .grid { grid-template-columns: 1fr; } }
.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl caption { text-align: left; font-weight: 700; padding-bottom: 6px; }
.tbl caption .cap-verified { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.tbl td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.sub td { font-weight: 600; border-top: 2px solid var(--line); }
.tbl tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.takehome { font-size: 1.1rem; margin: 16px 0 4px; }
.note { font-size: .9rem; color: var(--muted); }
.fineprint { font-size: .8rem; color: var(--muted); }

.results p.ok { background: var(--ok-bg); color: var(--ok); padding: 10px 14px; border-radius: 9px; }
.results p.warn { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 9px; }
.results p.info { background: var(--info-bg); color: var(--info); padding: 10px 14px; border-radius: 9px; }

.exports { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.exports button { padding: 11px 16px; background: #eef2fb; color: var(--brand-dark); }
.exports button:hover { background: #e0e8f9; }

.affiliate {
  max-width: 760px; margin: 22px auto; padding: 14px 18px; background: #eef2fb;
  border: 1px solid #d6e0f5; border-radius: var(--radius); font-size: .95rem;
}
.affiliate a { color: var(--brand-dark); font-weight: 600; }
.fineprint { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }

.explainer, .sources { margin-top: 8px; }
.explainer p { color: #2b3446; }
.sources ul { padding-left: 18px; color: var(--muted); font-size: .92rem; }
.sources a { color: var(--brand-dark); }

.site-footer {
  max-width: 760px; margin: 30px auto 50px; padding: 18px 20px 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .85rem; text-align: center;
}
.site-footer nav { margin-top: 8px; }
.site-footer nav a { color: var(--brand-dark); margin: 0 8px; }

/* Legal pages (privacy, terms) */
.legal { max-width: 760px; margin: 0 auto; padding: 0 20px 40px; }
.legal h1 { text-align: left; font-size: 1.6rem; }
.legal h2 { font-size: 1.15rem; }
.legal p, .legal li { color: #2b3446; }
.legal ul { padding-left: 20px; }
.legal .updated { color: var(--muted); font-size: .9rem; margin-top: -6px; }
.legal a { color: var(--brand-dark); }
.backlink { display: inline-block; margin: 22px auto 0; max-width: 760px; padding: 0 20px; }

/* Print = the HMRC-ready record view. */
@media print {
  body { background: #fff; }
  .calc-card form, .cta, .affiliate, .explainer, .sources, .exports, .site-header .tagline, .disclaimer { display: none; }
  .results { border: 0; box-shadow: none; padding: 0; }
  .site-header { text-align: left; padding-top: 0; }
}
