:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --good-ink: #006300;
  --warn: #fab219;
  --critical: #d03b3b;
  --track: #ebeae5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good-ink: #0ca30c;
    --track: #2c2c2a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --good-ink: #0ca30c;
  --track: #2c2c2a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.top-row { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; margin-right: auto; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
}
nav.tabs button:hover { background: var(--surface-2); }
nav.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
nav.tabs a.nav-link { padding: 8px 14px; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
nav.tabs a.nav-link:hover { background: var(--surface-2); }

main { padding: 24px 0 64px; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--ink-2); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

.bar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.bar-row .spacer { flex: 1; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px; }
.kpi .label { font-size: 13px; color: var(--ink-2); }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi.hero { border-color: var(--accent); }

/* Progress meters */
.meter { margin-bottom: 14px; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.meter-head .v { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.track { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.fill { height: 100%; border-radius: 5px; background: var(--series-1); transition: width .4s ease; }
.fill.oop { background: var(--series-2); }
.met { color: var(--good-ink); font-weight: 600; font-size: 12px; margin-left: 6px; }
.tier-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 10px; }
.tier-title:first-child { margin-top: 0; }
.member-block { padding: 12px 0; border-top: 1px solid var(--border); }
.member-block .name { font-weight: 600; margin-bottom: 6px; }

/* Forms */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
label.f .help { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input:disabled, select:disabled { opacity: .5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 600px) { .row4 { grid-template-columns: 1fr 1fr; } }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label {
  flex: 1; min-width: 120px; border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 14px;
}
.seg input { margin-right: 6px; }
.seg label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; font-size: 14px; }
.check input { margin-top: 4px; }
.callout {
  border-left: 3px solid var(--accent); background: var(--surface-2); padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px;
}
.callout.warn { border-left-color: var(--warn); }
.step-n {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; margin-right: 6px;
}

.btn {
  border: 1px solid var(--axis); background: var(--surface); padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; }

/* Preview breakdown */
.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; }
.breakdown td { padding: 5px 0; border-bottom: 1px solid var(--border); }
.breakdown td.n { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown tr.total td { font-weight: 700; border-bottom: 0; padding-top: 8px; }
.notes { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.notes li { margin-bottom: 4px; }
.delta { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; margin-top: 14px; }
.delta .n { font-variant-numeric: tabular-nums; text-align: right; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
table.data td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data td:nth-child(3) { min-width: 260px; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.best td { background: color-mix(in srgb, var(--good) 10%, transparent); }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--axis); color: var(--ink-2); white-space: nowrap; }
.pill.out { border-color: var(--series-2); }
details.why summary { cursor: pointer; color: var(--accent); font-size: 12px; }
details.why ul { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--ink-2); max-width: 420px; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ref { stroke: var(--critical); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .ref-label { fill: var(--ink-2); font-size: 11px; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--series-1); opacity: .08; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .seg-1 { fill: var(--series-1); }
.chart .seg-2 { fill: var(--series-2); }
.chart .bar-label { fill: var(--ink); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .cat-label { fill: var(--ink-2); font-size: 12px; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 160px;
  opacity: 0; transition: opacity .1s; z-index: 5;
}
.tooltip.show { opacity: 1; }
.tooltip b { display: block; margin-bottom: 2px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* EOB */
fieldset.eob { border: 1px solid var(--axis); border-radius: 8px; padding: 12px 14px 4px; margin: 0 0 14px; }
fieldset.eob legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.eob-toggle { padding: 10px 12px; border: 1px dashed var(--axis); border-radius: 8px; }
details.ytd { margin-bottom: 12px; }
details.ytd summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
.status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.status.ok { color: var(--good-ink); }
.status.issue { color: var(--critical); }
.status.est { color: var(--muted); font-weight: 400; }
.verdict { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.verdict.ok { border-color: var(--good); color: var(--good-ink); background: color-mix(in srgb, var(--good) 8%, transparent); }
.verdict.issue { border-color: var(--critical); color: var(--critical); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.verdict strong { color: inherit; }
ul.flags { list-style: none; padding: 0; margin: 12px 0 0; }
.flag { display: flex; gap: 8px; font-size: 13px; padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; background: var(--surface-2); color: var(--ink); }
.flag.issue { border-left: 3px solid var(--critical); }
.flag.warn { border-left: 3px solid var(--warn); }
.flag.info { border-left: 3px solid var(--accent); }
details.why ul.flags { max-width: 460px; padding: 0; }
ul.codes { margin: 0 0 12px; padding-left: 18px; font-size: 12px; color: var(--ink-2); }
ul.codes li { margin-bottom: 6px; }
ul.codes .muted, ul.codes em { display: block; }
.eob-card { margin-bottom: 16px; }
.issue-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); }
.issue-row .small { color: var(--ink-2); margin-top: 2px; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
footer.foot { color: var(--muted); font-size: 12px; padding: 24px 0; border-top: 1px solid var(--border); }
.svc-table td { padding: 4px 6px 4px 0; }
.svc-table select, .svc-table input { padding: 5px 8px; }
.plan-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.plan-list button { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); font-weight: 600; }
.plan-list button:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.plan-list button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.add-plan { border-style: dashed; color: var(--ink-2); }
.winner { font-size: 15px; }

/* Home / landing */
.brand-link { color: inherit; text-decoration: none; }
.home-hero { max-width: 760px; margin: 8px 0 28px; }
.home-hero h1 { font-size: 32px; line-height: 1.2; margin: 0 0 12px; }
.home-hero .lede { font-size: 17px; color: var(--ink-2); margin: 0 0 20px; }
.home-ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.home-uses { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 32px; }
.home-uses p, .step p { margin: 0 0 12px; color: var(--ink-2); }
.home-uses p:last-child { margin-bottom: 0; }
.home-uses .btn, .step .btn { text-decoration: none; display: inline-block; }
.home-h { margin: 0 0 14px; }
ol.steps { list-style: none; padding: 0; margin: 0 0 32px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { display: flex; flex-direction: column; align-items: flex-start; }
.step p { flex: 1; }
.step-n {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; margin-bottom: 10px;
}
@media (max-width: 600px) { .home-hero h1 { font-size: 26px; } }
