:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #142033;
  --muted: #5b6b80;
  --line: #d9e0ea;
  --brand: #1a4480;
  --brand-ink: #ffffff;
  --accent: #00a398;
  --accent-soft: #d9f3f1;
  --warn: #b25c00;
  --bar-1: #1a4480;
  --bar-2: #00a398;
  --bar-3: #e5a000;
  --bar-4: #8a4fff;
  --verified: #0b7a3e; --verified-bg: #dcf3e5;
  --approx: #8a5a00; --approx-bg: #fdf0d2;
  --simulated: #7b2fbf; --simulated-bg: #efe2fb;
  --projected: #1d5fbf; --projected-bg: #dfeafb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 6px 24px rgba(20, 32, 51, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1520; --surface: #151f2e; --surface-2: #1c2839; --ink: #e8eef6; --muted: #9aabc0;
    --line: #2a3a50; --brand: #6ea8fe; --brand-ink: #0e1520; --accent: #35d0c4; --accent-soft: #123b3a;
    --bar-1: #6ea8fe; --bar-2: #35d0c4; --bar-3: #f2c14e; --bar-4: #b18cff;
    --verified: #6fdc9d; --verified-bg: #10331f; --approx: #f2c14e; --approx-bg: #3a2c0b;
    --simulated: #cfa6ff; --simulated-bg: #2d1a47; --projected: #8fbaff; --projected-bg: #13294a;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 "IBM Plex Sans", system-ui, sans-serif; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.global-controls { display: flex; gap: 14px; flex-wrap: wrap; }
.ctl { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 500; }
select, input[type=number], input[type=date] {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; min-width: 0; max-width: 100%;
}
#locSelect { width: 300px; max-width: 80vw; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--ink); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button[aria-checked=true] { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; color: var(--brand); }

.hero { padding: 32px 0 18px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); }
.hero p { color: var(--muted); max-width: 720px; margin: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.calc { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }

/* profile form */
.sys-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.sys-tabs button { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 4px; cursor: pointer; font-size: 13px; line-height: 1.2; }
.sys-tabs button small { display: block; color: var(--muted); font-size: 11px; }
.sys-tabs button[aria-pressed=true] { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.sys-tabs button[aria-pressed=true] small { color: inherit; opacity: .8; }
@media (max-width: 480px) { .sys-tabs { grid-template-columns: repeat(3, 1fr); } }
.field { margin-bottom: 14px; }
.field > label, .field > .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field select { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: inherit; font-size: 13px; min-width: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 5px 8px; cursor: pointer; }
.chips button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row output { font-family: "IBM Plex Mono", monospace; min-width: 70px; text-align: right; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* result */
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.result-title { font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.big { font-size: clamp(40px, 7vw, 64px); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.big small { font-size: .35em; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.subline { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.stackbar { display: flex; height: 18px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 10px 0 16px; }
.stackbar span { height: 100%; transition: width .4s ease; }
.rows { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rows td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.rows td:last-child { text-align: right; font-weight: 600; }
.rows tr.total td { border-bottom: 0; font-weight: 700; font-size: 17px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }
.notes { margin: 14px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; font-size: 13px; color: var(--muted); }
.notes p { margin: 0 0 4px; }
.notes p:last-child { margin: 0; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; letter-spacing: .02em; white-space: nowrap; }
.badge.verified { color: var(--verified); background: var(--verified-bg); }
.badge.approx { color: var(--approx); background: var(--approx-bg); }
.badge.simulated { color: var(--simulated); background: var(--simulated-bg); }
.badge.projected { color: var(--projected); background: var(--projected-bg); }

/* tabs */
.tabs { display: flex; gap: 4px; margin: 28px 0 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; border: 0; background: transparent; color: var(--muted); padding: 10px 14px; cursor: pointer; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }
.tabpanel { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; margin-bottom: 32px; }
.tab-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
table.grid th, table.grid td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th:first-child, table.grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); font-weight: 600; }
table.grid thead th { background: var(--surface-2); position: sticky; top: 0; font-size: 12px; color: var(--muted); }
table.grid thead th:first-child { background: var(--surface-2); z-index: 1; }
table.grid td.hit { background: var(--accent); color: #fff; font-weight: 700; border-radius: 4px; }
table.grid td.na { color: var(--line); }
table.grid tbody tr:hover td { background: var(--surface-2); }
table.grid tbody tr:hover td.hit { background: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mini { background: var(--surface-2); border-radius: 12px; padding: 14px; }
.mini .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin: 10px 0 18px; }
@media (max-width: 640px) { .months { grid-template-columns: repeat(6, 1fr); } }
.month { border-radius: 8px; padding: 8px 4px; text-align: center; font-size: 12px; background: var(--surface-2); }
.month b { display: block; font-size: 14px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .compare { grid-template-columns: 1fr; } }
.compare .col { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.delta { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--accent-soft); font-weight: 600; }

.guide-steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; padding: 0; list-style: none; margin: 0; }
.guide-steps li { background: var(--surface-2); border-radius: 12px; padding: 16px; }
.guide-steps li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; margin-bottom: 8px; }
.foot { padding: 8px 16px 40px; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .topbar { position: static; } #locSelect { width: 100%; max-width: 100%; } .global-controls, .global-controls .ctl:last-child { width: 100%; } }

/* ===== Paybook v2: "my pay" first ===== */
.ctl-inline { flex-direction: row; align-items: center; gap: 10px; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); border-radius: 10px; padding: 10px 18px; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.small { font-size: 13px; }

/* stepper: [−][select][+] */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper select { border: 0; border-radius: 0; font-weight: 600; text-align: center; min-width: 96px; padding: 8px 6px; background: var(--surface); }
.st-btn { font: inherit; font-size: 20px; line-height: 1; width: 44px; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.st-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.st-btn:disabled { color: var(--line); cursor: default; }
.ifield { display: flex; flex-direction: column; gap: 4px; }
.ifield .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.ifield select { min-width: 0; }

/* setup */
.setup { max-width: 760px; margin: 32px auto 40px; }
.setup-head h1 { font-size: clamp(28px, 5vw, 42px); }
.qs { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.q h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q.q-off { opacity: .5; }
.qn { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 14px; flex: none; }
.q-body { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.q-body .field { margin-bottom: 6px; }
.q .field select { max-width: 420px; }
.sys-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.sys-card { font: inherit; text-align: left; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.sys-card .ico { font-size: 24px; grid-row: span 2; }
.sys-card small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.sys-card[aria-pressed=true] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.setup-peek { font-size: 18px; }
.setup-actions { display: flex; gap: 8px; }

/* my pay */
.me { margin-top: 24px; }
.me-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.me-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; gap: 8px; align-items: center; }
.me-controls { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 14px 0 18px; padding: 14px; background: var(--surface-2); border-radius: 12px; }
.me-controls #meLoc { max-width: 260px; }
.me-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; }
@media (max-width: 760px) { .me-hero { grid-template-columns: 1fr; } }
.me-who { font-weight: 600; }
.yoy { font-size: 14px; font-weight: 600; }
.yoy.up { color: var(--verified); } .yoy.down { color: var(--warn); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 8px; }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.tile span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.tile small { font-size: 11px; color: var(--muted); }
details.notes summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.notes[open] summary { margin-bottom: 6px; }

.preview-banner { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; background: var(--projected-bg); color: var(--ink); border: 1px solid var(--projected); }
.banner-actions { display: flex; gap: 8px; }

/* next level */
.next { margin-top: 28px; }
.section-head h2 { font-size: 24px; margin: 0; }
.section-head p { margin: 4px 0 12px; }
.next-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.next-card { font: inherit; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.next-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.next-card.done { cursor: default; }
.kind { align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.kind-grade, .kind-promo { background: var(--projected-bg); color: var(--projected); }
.kind-role { background: var(--simulated-bg); color: var(--simulated); }
.nc-title { font-size: 18px; font-weight: 700; margin-top: 4px; }
.nc-delta { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.nc-delta.up { color: var(--verified); } .nc-delta.down { color: var(--warn); }
.nc-delta small { font-size: 14px; color: var(--muted); font-weight: 500; }
.nc-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nc-when { font-size: 13px; }
.nc-cta { margin-top: auto; padding-top: 6px; font-size: 13px; font-weight: 600; color: var(--brand); }
table.grid td[data-pick] { cursor: pointer; }

/* compare v2 */
.cmp-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; padding: 14px; background: var(--surface-2); border-radius: 12px; }
.cmp-grade { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.cmp-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.cmp-nums > div { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; }
.cmp-nums b { font-size: 28px; font-variant-numeric: tabular-nums; }
.tabs { margin-top: 36px; }

[hidden] { display: none !important; }
.setup-foot { z-index: 2; }
