/* Brand colors (Benyamin Soliman brand guide, same as the client portal):
   Navy #103B70 headlines and primary elements, Blue #1769AA supporting elements,
   Orange #F58220 calls to action, Light Gray #F3F6FA backgrounds, White.
   Layout: inputs on the left grouped like the 1040 and its schedules, a sticky
   result ledger on the right; stacks on phones with a pinned result bar. */
:root {
  --brand: #103B70;
  --brand-strong: #0B2A52;
  --brand-soft: #E4EDF7;
  --blue: #1769AA;
  --accent: #F58220;
  --accent-hover: #E2710F;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --field: #FAFBFD;
  --line: #DCE3EC;
  --ink: #14243A;
  --muted: #536173;
  --good: #2B7354;
  --good-soft: #E4F2EA;
  --bad: #B3412F;
  --bad-soft: #F8E5E1;
  --warn: #8A5A0B;
  --warn-soft: #FEF0E3;
  --radius: 12px;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; color: var(--brand); }
h1 { font-weight: 700; font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.wrap {
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main.wrap { padding-block: 28px 48px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; flex-wrap: wrap; }
.logo { height: 40px; width: auto; display: block; }

.intro { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.lede { color: var(--muted); max-width: 62ch; }
.privacy { font-size: 13.5px; color: var(--good); font-weight: 500; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 8px 16px; font-weight: 600; cursor: pointer; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg input:checked + label { background: var(--brand); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -3px; }

.banner { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 20px; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: 500 14px/1 var(--sans); border-radius: 10px; height: 38px; padding: 0 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--brand); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.cta { background: var(--accent); border-color: var(--accent); color: var(--brand-strong); font-weight: 600; white-space: normal; height: auto; min-height: 40px; padding: 8px 16px; text-align: center; }
.btn.cta:hover { background: var(--accent-hover); }
.btn:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.copy-msg { font-size: 13px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 28px; align-items: start; }
@media (max-width: 920px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sec > summary { list-style: none; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; flex-wrap: wrap; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary h2 { font-size: 18px; display: flex; gap: 10px; align-items: baseline; flex: 1 1 auto; }
.sec > summary h2::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue); transform: rotate(-45deg); display: inline-block; transition: transform .15s; position: relative; top: -2px; }
.sec[open] > summary h2::before { transform: rotate(45deg); }
.form-ref { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip { font-family: var(--mono); font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.sec-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.sec-note { font-size: 13px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f .l { font-size: 13.5px; font-weight: 600; }
.f .h { font-size: 12px; color: var(--muted); line-height: 1.35; }
.inp { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--field); padding: 0 10px; margin-top: auto; }
.inp:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--brand-soft); }
.inp i { font-style: normal; color: var(--muted); font-family: var(--mono); font-size: 14px; }
.inp input, .inp select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 15px; padding: 8px 6px; outline: none; font-variant-numeric: tabular-nums; text-align: right; }
.inp select { text-align: left; font-family: var(--sans); padding-left: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ck { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.ck input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.ck.off { opacity: .45; }

/* Summary */
.sum { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.result .k { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.big { font-family: var(--mono); font-weight: 600; font-size: clamp(34px, 5vw, 44px); line-height: 1; font-variant-numeric: tabular-nums; }
.refund-c { color: var(--good); } .owe-c { color: var(--bad); }
.pill { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.pill.refund { background: var(--good-soft); color: var(--good); } .pill.owe { background: var(--bad-soft); color: var(--bad); }
.meter { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; }
.bar .tax { background: var(--brand); } .bar .pay { background: var(--accent); }
.mrow { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.mrow b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.rates div { display: flex; flex-direction: column; gap: 2px; }
.rates b { font-family: var(--mono); font-size: 19px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.rates span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }

.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; overflow-x: auto; }
.ledger table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ledger td { padding: 6px 16px; vertical-align: baseline; }
.ledger td:last-child { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .ref { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ledger tr.sub td { color: var(--muted); font-size: 12.5px; padding-top: 0; padding-left: 28px; }
.ledger tr.tot td { font-weight: 600; border-top: 1px solid var(--line); padding-top: 9px; }
.ledger tr.final td { font-size: 15px; }
.ledger tr.grp td { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); padding-top: 14px; }
.ledger tr.grp:not(:first-child) td { border-top: 2px solid var(--line); padding-top: 16px; }

.split { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--muted); }
.split b { font-family: var(--mono); font-weight: 600; }

.stub { background: var(--brand-soft); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.stub-toggle > span { display: flex; flex-direction: column; gap: 2px; }
.stub-toggle b { color: var(--brand); font-weight: 600; }
.stub .h { font-size: 12px; color: var(--muted); line-height: 1.35; }
.stub .inp { background: var(--surface); }
.stub .inp input[type="date"] { text-align: left; font-family: var(--sans); }
.f.projected .inp { background: var(--brand-soft); border-style: dashed; }
.f.projected .inp input { color: var(--brand); }
.f.projected .h::after { content: " · projected from your pay stub"; color: var(--blue); font-weight: 600; }

.wh-card { border-top: 3px solid var(--accent); }
.wh-body { display: flex; flex-direction: column; gap: 10px; }
.wh-row { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.wh-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wh-row p { font-size: 13.5px; line-height: 1.45; }

.ideas-card { border-top: 3px solid var(--blue); }
.ideas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ideas li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.ideas li:first-child { border-top: 0; padding-top: 2px; }
.ideas li p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.ideas li.empty { color: var(--muted); }
.idea-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.idea-top b { font-weight: 600; color: var(--ink); }
.save { flex: none; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--good-soft); color: var(--good); white-space: nowrap; font-variant-numeric: tabular-nums; }
.save.tag { background: var(--warn-soft); color: var(--warn); }
.card h4 { margin: 4px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); }
.ca-sh { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.card h3 { font-size: 16px; }
.card.contact { border-top: 3px solid var(--accent); }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notes li { padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; background: var(--warn-soft); border-left: 3px solid var(--accent); }
.notes li.info { background: var(--brand-soft); border-left-color: var(--blue); }
.qtrs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.qtrs div { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; min-width: 0; }
.qtrs span { font-size: 11px; color: var(--muted); } .qtrs b { font-family: var(--mono); font-size: 13px; font-weight: 500; }
@media (max-width: 420px) { .qtrs { grid-template-columns: repeat(2, 1fr); } }

.site-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); max-width: 90ch; display: flex; flex-direction: column; gap: 8px; }

.mbar { display: none; }
@media (max-width: 920px) {
  .sum { position: static; }
  .mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); box-shadow: 0 -4px 16px rgb(16 24 40 / .06); }
  .mbar b { font-family: var(--mono); font-size: 20px; }
  .mbar a { font-weight: 600; font-size: 14px; }
  .mb-label { font-size: 12px; }
  body { padding-bottom: 70px; }
}
@media (prefers-reduced-motion: reduce) { *, html { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .mbar, .banner, .btnrow, .seg, .contact .btn { display: none !important; }
  body { background: #fff; padding-bottom: 0; }
  .grid { grid-template-columns: 1fr; }
  .sum { position: static; }
  .sec:not([open]) { display: none; }
}
