:root {
  --accent: #1F3A5F;
  --accent-text: #1F3A5F;
  --on-accent: #ffffff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5a6572;
  --border: #c9d1da;
  --soft: #e8eef6;
  --bad: #b3261e;
  --good: #1d6b3a;
  --focus: #2a78d6;
  --link: #2a78d6;
  --sel: #1F3A5F;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #3d6aa5;
    --accent-text: #9dbfeb;
    --bg: #12161b;
    --surface: #1b2128;
    --text: #e8ecf0;
    --muted: #a0aab5;
    --border: #3a4553;
    --soft: #243142;
    --bad: #ff8a80;
    --good: #7ed199;
    --focus: #6aa6ec;
    --link: #7db4f2;
    --sel: #8fb6e8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--accent); color: var(--on-accent); padding: 20px 0 16px; }
.site-header h1 { margin: 0; font-size: 1.6rem; line-height: 1.2; }
.subtitle { margin: 4px 0 0; opacity: .92; }
main.wrap { padding-top: 20px; padding-bottom: 32px; min-height: 60vh; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 16px 0; }
.site-footer p { margin: 0; }
a { color: var(--link); }
h2 { font-size: 1.35rem; margin: 0 0 8px; color: var(--accent-text); }
h2:focus { outline: none; }
h3 { margin: 24px 0 8px; }
.lead { margin: 0 0 16px; color: var(--muted); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* toolbar and status */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.status { min-height: 1.5em; margin: 0 0 8px; font-weight: 600; overflow-wrap: anywhere; }
.status.bad { color: var(--bad); }
.status.good { color: var(--good); }

/* progress */
.progress { margin-bottom: 16px; }
.progress-text { margin: 0 0 6px; font-weight: 600; }
.bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
@media (prefers-color-scheme: dark) { .bar span { background: var(--accent-text); } }

/* buttons */
.btn {
  font: inherit; min-height: 44px; min-width: 44px; padding: 8px 18px; border-radius: 8px;
  border: 2px solid var(--accent); cursor: pointer; background: var(--surface); color: var(--accent-text);
}
.btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.secondary:hover { background: var(--soft); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.small { padding: 6px 12px; font-size: .92rem; }
.btn.link { border-color: transparent; background: none; text-decoration: underline; padding-left: 4px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.nav .btn { flex: 1 1 0; max-width: 200px; }
.nav .btn.primary { margin-left: auto; }

/* layout */
.step-body { min-width: 0; }
.grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px 16px; margin: 0 0 16px;
}
.card legend { font-weight: 700; padding: 0 6px; color: var(--accent-text); }

/* fields */
.field { margin: 0 0 14px; min-width: 0; }
.lbl { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.lbl label { font-weight: 600; flex: 0 1 auto; }
.opt { font-weight: 400; color: var(--muted); font-size: .88rem; }
.tip {
  flex: none; width: 28px; height: 28px; min-width: 28px; border-radius: 50%; padding: 0;
  border: 2px solid var(--accent-text); background: var(--surface); color: var(--accent-text);
  font: 700 .9rem/1 inherit; cursor: pointer; position: relative; margin-top: -2px;
}
.tip::after { content: ""; position: absolute; inset: -8px; } /* 44px touch target */
.tip[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tiptext { margin: 0 0 6px; padding: 8px 12px; background: var(--soft); border-left: 4px solid var(--accent-text); border-radius: 4px; font-size: .92rem; }
.tipnote { color: var(--muted); font-size: .9rem; padding-top: 3px; }
.hint { margin: 0 0 4px; font-size: .88rem; color: var(--muted); }
input[type=text], input[type=month], input[type=number], select {
  font: inherit; width: 100%; min-height: 44px; padding: 8px 10px; border: 2px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0;
}
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad); }
.inp { display: flex; align-items: stretch; }
.inp input { border-radius: 0; flex: 1 1 auto; }
.inp .aff { display: flex; align-items: center; padding: 0 10px; background: var(--soft); border: 2px solid var(--border); color: var(--muted); }
.inp.money .aff { border-right: 0; border-radius: 8px 0 0 8px; }
.inp.money input { border-radius: 0 8px 8px 0; }
.inp.pct .aff { border-left: 0; border-radius: 0 8px 8px 0; }
.inp.pct input { border-radius: 8px 0 0 8px; }
.err { margin: 4px 0 0; color: var(--bad); font-size: .9rem; font-weight: 600; }
.err:empty { display: none; }
.field.check { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.checkrow { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.checkrow input, .radio input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.field.check .tiptext, .field.check .err { flex: 1 1 100%; }
.radiogroup legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.opts { display: grid; gap: 8px; }
.radio {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 8px; background: var(--surface);
}
.radio:has(input:checked) { border-color: var(--accent-text); background: var(--soft); }

/* review */
.review { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 16px; }
.review dt { font-weight: 700; margin-top: 8px; }
.review dd { margin: 0 0 4px; overflow-wrap: anywhere; }
.review .ok { color: var(--good); font-weight: 600; }
.review .warn { color: var(--bad); font-weight: 600; }

/* ---------- icons ---------- */
.ico { width: 24px; height: 24px; flex: none; vertical-align: middle; }
.ico.big { width: 36px; height: 36px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wide { display: none; }
@media (min-width: 700px) { .wide { display: inline; } }
h2 { display: flex; align-items: center; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tb { padding: 6px 12px; }
.btn.icon { padding: 6px; width: 44px; padding: 0; }
.btn.rm { position: absolute; top: 4px; right: 6px; border-color: transparent; color: var(--bad); }
.btn.rm:hover { background: var(--soft); }
.card:has(> .btn.rm) { padding-top: 48px; } /* room for the delete button above the first row of fields */
.card { position: relative; }
.btn.add { margin-bottom: 8px; }
.nav .btn.primary { flex: 1 1 auto; max-width: none; }
.nav .btn.secondary { flex: 0 0 auto; min-width: 48px; max-width: none; }
@media (min-width: 700px) { .nav .btn.primary { flex: 0 0 auto; min-width: 180px; } }

/* step bar */
.stepbar { display: flex; list-style: none; margin: 14px 0 20px; padding: 0; }
.stepbar li { flex: 1 1 0; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); text-align: center; }
.stepbar li + li::before { content: ""; position: absolute; top: 19px; right: 50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.stepbar li.done::before, .stepbar li.current::before { background: var(--sel); }
.stepbar .dot { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border); }
.stepbar .dot .ico { width: 20px; height: 20px; }
.stepbar .dot em { position: absolute; top: -6px; right: -6px; font: 700 .7rem/16px system-ui, sans-serif; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); color: var(--surface); font-style: normal; }
.stepbar li.done .dot { border-color: var(--sel); color: var(--sel); }
.stepbar li.current .dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 3px var(--soft); }
.stepbar li.current .dot em, .stepbar li.done .dot em { background: var(--sel); color: var(--surface); }
.stepbar .sname { font-size: .78rem; line-height: 1.2; }
.stepbar .stepbtn { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 2px 0; border-radius: 8px; color: inherit; font: inherit; text-align: center; -webkit-tap-highlight-color: transparent; }
.stepbar .stepbtn:hover .dot { border-color: var(--sel); box-shadow: 0 0 0 4px var(--soft); }
.stepbar .stepbtn:hover .sname { color: var(--text); text-decoration: underline; }
.stepbar .stepbtn:focus-visible { outline: 3px solid var(--sel); outline-offset: 2px; }
.stepbar .stepbtn:active .dot { transform: scale(.94); }
.stepbar li.current .stepbtn:hover .dot { box-shadow: 0 0 0 3px var(--soft); }
.stepbar li.current .sname { color: var(--text); font-weight: 700; }

/* selects with icons */
.selrow { display: flex; align-items: center; gap: 10px; }
.selrow .rowicon { color: var(--sel); display: grid; place-items: center; width: 44px; height: 44px; flex: none; background: var(--soft); border-radius: 8px; }
.selrow select { flex: 1 1 auto; }
.toolbar .tb { min-width: 44px; }

/* tooltip toggle */
.tip { border: 0; background: none; color: var(--link); width: 28px; height: 28px; min-width: 28px; }
.tip .ico { width: 24px; height: 24px; }
.tip[aria-expanded="true"] { background: var(--soft); color: var(--link); border-radius: 50%; }
.tiptext { border-left-color: var(--link); }

/* selectable cards */
.cards { display: grid; gap: 10px; grid-template-columns: 1fr; }
.cards.c2 { grid-template-columns: 1fr 1fr; }
@media (min-width: 600px) { .cards.c3 { grid-template-columns: repeat(3, 1fr); } }
.choice { display: block; cursor: pointer; position: relative; min-width: 0; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.card-face {
  display: flex; flex-direction: row; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px;
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
.card-face b { display: block; }
.card-face small { display: block; color: var(--muted); font-size: .85rem; }
.card-face > .ico { color: var(--muted); }
.card-face > b, .card-face > small { flex: 0 1 auto; }
@media (min-width: 600px) { .cards.c3 .card-face { flex-direction: column; text-align: center; padding: 18px 10px; } }
.cards.c2 .card-face { flex-direction: column; text-align: center; padding: 16px 8px; }
.choice input:checked + .card-face { border-color: var(--sel); background: var(--soft); box-shadow: inset 0 0 0 1px var(--sel); }
.choice input:checked + .card-face > .ico { color: var(--sel); }
.choice input:focus-visible + .card-face { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input[aria-invalid=true] + .card-face { border-color: var(--bad); }

/* review cards */
.rgrid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 500px) { .rgrid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .rgrid { grid-template-columns: repeat(3, 1fr); } }
.rcard { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.rcard .ico { color: var(--sel); margin-top: 2px; }
.rcard > div { min-width: 0; }
.rcard h4 { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rcard .big { margin: 0; font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.rcard .small { margin: 0; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 12px 0 0; }
.verdict.ok { color: var(--good); }
.verdict.warn { color: var(--bad); }
.sliderrow { display: flex; align-items: center; gap: 6px; }
.sliderrow input[type=range] { flex: 1; min-width: 0; min-height: 44px; accent-color: var(--accent); padding: 0; }
.lbl output { margin-left: auto; flex: 0 0 auto; text-align: right; font-weight: 600; color: var(--accent-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.typedwrap { margin-left: auto; flex: 0 0 auto; font-weight: 600; color: var(--accent-text); white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
.typedwrap input.typed { width: 6ch; text-align: right; font: inherit; font-variant-numeric: tabular-nums; padding: 2px 4px; min-height: 0; box-sizing: content-box; }
.typedwrap input.typed.money { width: 8ch; }
.typedwrap input.typed::placeholder { font-weight: 400; color: var(--muted); }
.lbl output.unset { color: var(--muted); font-weight: 400; }
.sliderrow .nudge { flex: 0 0 auto; width: 34px; height: 34px; min-height: 0; padding: 0; }
.sliderrow .btn { flex: 0 0 auto; }

/* tax check page */
:root { --warn: #9a4a00; --warn-bg: #fff1e0; --good-bg: #e6f4ea; }
@media (prefers-color-scheme: dark) { :root { --warn: #f2a65a; --warn-bg: #3a2a18; --good-bg: #1c3326; } }
input[type=date] { font: inherit; width: 100%; min-height: 44px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0; }
.sub { margin: 12px 0 8px; font-size: 1rem; color: var(--muted); }
.count { flex: 1; text-align: center; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile { display: flex; align-items: center; gap: 14px; padding: 16px; margin: 8px 0 12px; border-radius: 12px; border: 2px solid var(--border); background: var(--soft); }
.tile.refund { border-color: var(--good); background: var(--good-bg); }
.tile.owed { border-color: var(--warn); background: var(--warn-bg); }
.tile h3 { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile-big { margin: 0; font-size: 2rem; font-weight: 800; line-height: 1.2; }
.tile.refund .tile-big, .tile.refund .tile-ico { color: var(--good); }
.tile.owed .tile-big, .tile.owed .tile-ico { color: var(--warn); }
.tile-ico .ico { width: 40px; height: 40px; }
.advice { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; }
.advice .ico { color: var(--sel); margin-top: 2px; }
.btn[hidden] { display: none; }
a.btn { text-decoration: none; }
