/* Self-hosted for font-src 'self'; latin variable fonts from Fontsource 5.3.0, licensed under the OFL (fonts/OFL-*.txt) */
@font-face { font-family: "DM Sans"; src: url("fonts/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f2f5fb; --text: #151f30; --muted: #58616f;
  --border: #d9dee7; --input-border: #6e7787; --accent: #1a5cdf; --accent-ink: #ffffff; --accent-soft: #e5efff;
  --dark-surface: #131d2d;
  --bad: #b42318; --bad-soft: #fdecea; --warn: #9a5b00; --warn-soft: #fff4e0;
  --info: #1d5fbf; --info-soft: #e8f0fc; --good: #1a7f37; --good-soft: #e7f5ea;
  --idle: #5b6673; --idle-soft: #eef0f3;
  --radius: 7px; --radius-sm: 6px; --radius-btn: 5px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --font-text: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Manrope", var(--font-text);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131d2d; --surface: #182334; --surface-2: #1d2e4d; --text: #f6f9fc; --muted: #adb5c1;
    --border: #2f3b4f; --input-border: #7a889c; --accent: #7ea8ff; --accent-ink: #0b1a36; --accent-soft: #1d2e4d;
    --dark-surface: #0e1623;
    --bad: #ff8a80; --bad-soft: #3a1d1b; --warn: #ffc266; --warn-soft: #3a2c12;
    --info: #8cb8ff; --info-soft: #1a2a44; --good: #6fd38a; --good-soft: #17301f;
    --idle: #9aa6b2; --idle-soft: #26303b; --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/26px var(--font-text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.5; margin: 0 0 .5rem; }
h1 { font-size: 2.25rem; line-height: 1.25; font-weight: 750; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
/* figures that line up use Manrope: DM Sans has no tabular digits */
.num { text-align: right; font-family: var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .inner { max-width: 1180px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1.25rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 750; color: var(--text); font-size: 1.05rem; }
.brand img { width: 28px; height: 28px; }
.dollar { color: var(--accent); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: .35rem .65rem; border-radius: var(--radius-sm); font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.icons { margin-left: auto; display: flex; gap: .25rem; }
.icon-btn { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center;
  border-radius: var(--radius-btn); color: var(--muted); }
.icon-btn:hover, .icon-btn.active { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }

main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* hero */
.hero { background: var(--dark-surface); color: #f6f9fc; border-radius: var(--radius);
  padding: 2rem; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: end; margin-bottom: 1.5rem; }
.hero .dollar { color: #7ea8ff; }
.hero p { margin: 0; opacity: .92; max-width: 620px; }
.hero .actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.hero label { color: rgba(255,255,255,.85); }
.hero select { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
.hero select option { color: #151f30; }
.hero .btn.secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }

/* cards, tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.tiles { grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
.two { grid-template-columns: 1fr 1fr; }
.tile .label { color: var(--muted); font-size: .85rem; }
.tile .value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.tile.accent { border-color: var(--bad); }
.tile.accent .value { color: var(--bad); }
.section { margin-top: 1rem; }

/* status */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.s-discrepancy { background: var(--bad-soft); color: var(--bad); }
.s-balance_outstanding { background: var(--warn-soft); color: var(--warn); }
.s-missing_documents { background: var(--info-soft); color: var(--info); }
.s-waiting { background: var(--idle-soft); color: var(--idle); }
.s-matched { background: var(--good-soft); color: var(--good); }
/* the nine REC-11 statuses; the label always says the status, colour only groups them */
.s-in_dispute { background: var(--info-soft); color: var(--info); border: 1px solid var(--info); }
.s-needs_review { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
.s-awaiting_eob, .s-awaiting_documents { background: var(--idle-soft); color: var(--idle); }
.s-resolved, .s-complete { background: var(--good-soft); color: var(--good); }
.s-na { background: transparent; color: var(--muted); border: 1px solid var(--border); }
/* dispute cases (ADR-042): the label says the status, colour only groups them */
.c-open, .c-contacted { background: var(--info-soft); color: var(--info); border: 1px solid var(--info); }
.c-waiting { background: var(--idle-soft); color: var(--idle); }
.c-resolved { background: var(--good-soft); color: var(--good); }
.chip.good { background: var(--good-soft); color: var(--good); }
.status-help { margin: -.25rem 0 1rem; color: var(--muted); }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 6px; font-size: .78rem; background: var(--warn-soft); color: var(--warn); margin: .15rem .25rem 0 0; }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.idle { background: var(--idle-soft); color: var(--idle); }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; justify-content: space-between; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.status-list li:last-child { border-bottom: 0; }
.kv { list-style: none; padding: 0; margin: 0; }
.kv li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.kv li:last-child { border-bottom: 0; }

/* progress */
.limit { margin: .6rem 0 1rem; }
.limit .row { display: flex; justify-content: space-between; gap: 1rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .35rem 0 .2rem; }
.bar span { display: block; height: 100%; background: var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr.dim td { color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* visit cards */
.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* checks */
.check { display: grid; grid-template-columns: 28px 1fr auto; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--border); align-items: start; }
.check:last-child { border-bottom: 0; }
.check .mark { font-weight: 700; text-align: center; }
.check.pass .mark { color: var(--good); } .check.fail .mark { color: var(--bad); } .check.na .mark { color: var(--muted); }
.check.closed .mark, .check.cleared .mark { color: var(--good); } .check.info .mark { color: var(--info); }
.check form { margin-top: .35rem; }
details.move { margin-top: .5rem; }
details.close-finding { margin-top: .35rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }

/* forms */
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--input-border); border-radius: var(--radius-btn); padding: .4rem .55rem; }
textarea { min-height: 2.4rem; }
input[type=checkbox] { width: auto; }
input, select, textarea { max-width: 100%; }
label { max-width: 100%; }
.check-label { flex-direction: row; align-items: center; gap: .35rem; color: var(--text); font-size: .9rem; }
.btn { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 600; border-radius: var(--radius-btn); padding: .45rem .9rem;
  border: 1px solid var(--input-border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: .2rem .55rem; font-size: .8rem; font-weight: 500; }
.btn.danger { color: var(--bad); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.alert { padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.good { background: var(--good-soft); color: var(--good); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }
.case-row { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.case-row:last-of-type { border-bottom: 0; }
.evidence { list-style: none; padding: 0; margin: 0; }
.evidence li { padding: .3rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.call-facts { margin-top: .2rem; }
input.short { width: 6rem; }
textarea.letter { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; line-height: 1.45; }
.callout { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.settings-row { display: grid; gap: .5rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 3rem 1rem; }
.toc { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
details summary { cursor: pointer; }

@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 1.4rem; }
  .hero .actions { justify-content: flex-start; }
  .topbar .inner { flex-wrap: wrap; gap: .5rem; }
}
@media (max-width: 480px) {
  /* Phones (UX-10): brand and icons on one row, the nav on one row below it; tiles two to a row. */
  .topbar .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .nav a { padding: .35rem .45rem; font-size: .95rem; white-space: nowrap; }
  .topbar .member-name { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }  /* the way to Account */
  .grid > * { min-width: 0; }  /* a wide table can't push a grid column past the screen */
  .card table td .badge { white-space: normal; }
  .tiles { gap: .6rem; }
  .tile { padding: .75rem .8rem; }
  .tile .label { font-size: .8rem; }
  .tile .value { font-size: 1.15rem; }
}
.note { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.note:first-child { padding-top: 0; }
.note.dim { opacity: .7; }
.note-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .3rem; }
.note-text { white-space: pre-wrap; }
label.grow { flex: 1 1 100%; }
label.grow textarea { width: 100%; }

/* utilities that replace inline styles, so pages work under the Content Security Policy */
.bad-ink { color: var(--bad); }
.warn-ink { color: var(--warn); }
.good-ink { color: var(--good); }
.flush { margin: 0; }
.grow-wide { flex: 1 1 320px; }
.w-6 { width: 6rem; }
.w-8 { width: 8rem; }
.w-16 { width: 16rem; }
/* Release 1 sign-in and uploads */
.auth { max-width: 420px; margin: 2rem auto; }
.auth h1 { font-size: 1.4rem; }
form.stack { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
form.stack .btn { align-self: flex-start; }
.enrol .qr-box { background: #fff; border-radius: var(--radius); padding: .5rem; margin: 1rem auto; max-width: 280px; }
.enrol .qr-box svg { display: block; width: 100%; height: auto; }
.enrol-key { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.topbar .icons form { margin: 0; }
.uploads form.inline { margin-bottom: 1rem; }
.review label.low input, .review label.low select { border-color: var(--warn); background: var(--warn-soft); }
.review .grid.two { gap: .8rem 1.2rem; }
.recovery-codes ul.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .4rem; }
.recovery-codes code { font-size: 1rem; letter-spacing: .05em; }
.doc-preview img { display: block; max-width: 100%; max-height: 60vh; object-fit: contain; height: auto; margin-top: .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.help-toc { line-height: 2; }
.status-list li .small { display: block; color: var(--muted); }
.topbar .icons { gap: .7rem; }

/* Phase 1.5 web experience (UX-01, UX-02, UX-06, UX-10; ADR-041) */
[id] { scroll-margin-top: 72px; }  /* jump links land below the sticky header */
.tabbar { display: none; }
.status-strip { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.status-strip a { display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .5rem .25rem .3rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); }
.status-strip a:hover { text-decoration: none; border-color: var(--accent); }
.status-strip li.zero { opacity: .55; }
.status-strip.compact { margin: .25rem 0 .75rem; }
.view-note { margin: 0 0 .75rem; }
.flush-head { margin-bottom: .6rem; align-items: baseline; }
.year-detail { margin-top: 2rem; }
.actions.center { justify-content: center; }
.rule { margin: -.25rem 0 .25rem; }
/* attention queue */
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { border-bottom: 1px solid var(--border); }
.queue li:last-child { border-bottom: 0; }
.queue a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem 1rem; padding: .7rem 0; color: var(--text); }
.queue a:hover { text-decoration: none; }
.queue a:hover .provider { color: var(--accent); }
.queue .q-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-weight: 600; }
.queue .q-meta, .queue .q-why { grid-column: 1; }
.queue .q-amount { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
/* visit cards: the left edge says the status group, the badge says the status */
.s-edge-in_dispute { border-left-color: var(--info); }
.s-edge-discrepancy { border-left-color: var(--bad); }
.s-edge-needs_review, .s-edge-balance_outstanding { border-left-color: var(--warn); }
.s-edge-resolved, .s-edge-complete { border-left-color: var(--good); }
/* visit detail */
.jump { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.jump a { display: inline-flex; align-items: center; padding: .25rem .75rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: .85rem; }
.line-compare tr.disagree td { background: var(--bad-soft); }
.line-compare td.diff { font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 7rem 1fr; gap: .1rem .75rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { grid-row: 1 / span 2; }
.timeline .detail { grid-column: 2; }
/* household */
.people tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: 0; }
.people tr.viewing td { background: var(--accent-soft); }
.view-switch { margin: 0; }

@media (max-width: 860px) {
  /* Phones and small tablets (UX-10): pages in a bottom bar within thumb reach, every control at least 44px tall. */
  .topbar .nav, .wide-only { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface);
    border-top: 1px solid var(--border); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .tabbar a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; font-size: .75rem; font-weight: 500; color: var(--muted); }
  .tabbar a.active { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.add { color: var(--accent); font-weight: 700; }
  .tabbar a.add svg { width: 30px; height: 30px; }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .btn, select, input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, .jump a, .status-strip a,
  .topbar .member-name, .check-label, .brand { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .topbar .member-name { display: inline-flex; align-items: center; }
  .topbar .icons { align-items: center; }
  .btn.small { padding: .45rem .8rem; font-size: .9rem; }
  summary { min-height: 44px; padding: .55rem 0; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  /* links standing on their own (not inside a sentence) are tap targets too */
  a.back, a.more, .page-head a, .toc a, td > a, .kv a, .person-card h2 a, .case-row > a, .note-head a {
    display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  input[type=file] { min-height: 44px; max-width: 100%; }
  main .queue li > a { display: grid; grid-template-columns: minmax(0, 1fr); }
  .queue .q-amount { grid-column: 1; grid-row: auto; text-align: left; white-space: normal; }
  .queue .q-why { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .topbar .inner { flex-wrap: nowrap; gap: .5rem; }
  .topbar .icons { gap: .25rem; }
  .status-strip li.zero { display: none; }  /* the phone shows the statuses that have visits; all nine on wider screens */
  /* the line comparison as one block per line: the bill's side, the EOB's side, then the difference */
  table.line-compare thead { display: none; }
  table.line-compare, table.line-compare tbody { display: block; }
  table.line-compare tr { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .75rem; padding: .55rem .4rem;
    border-bottom: 1px solid var(--border); }
  table.line-compare td { border: 0; padding: 0; text-align: left; }
  table.line-compare td::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted);
    text-transform: uppercase; letter-spacing: .03em; }
  table.line-compare td:nth-child(1), table.line-compare td:nth-child(4), table.line-compare td:nth-child(7),
  table.line-compare td:nth-child(8) { grid-column: 1 / -1; }
  table.line-compare td:nth-child(4) { margin-top: .3rem; }
  table.line-compare td:nth-child(7)::before { display: inline; margin-right: .5rem; }
  table.line-compare td.empty { display: none; }
  table.line-compare tr.disagree { background: var(--bad-soft); border-radius: var(--radius-sm); }
  table.line-compare tr.disagree td { background: transparent; }
  /* the document checklist: the document and its state on one row, the choice below */
  #checklist table, #checklist tbody { display: block; }
  #checklist tr { display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
  #checklist td { border: 0; padding: 0; }
  #checklist td:nth-child(3):empty { display: none; }
  #checklist td:nth-child(3) { grid-column: 1 / -1; }
  #checklist form.inline { flex-wrap: nowrap; }
  .timeline li { grid-template-columns: 1fr; }
  .timeline .when { grid-row: auto; }
  .timeline .detail { grid-column: 1; }
  /* household table as one card per person */
  table.people thead { display: none; }
  table.people, table.people tbody, table.people tfoot, table.people tr, table.people td { display: block; width: 100%; }
  table.people tr { padding: .5rem 0; border-bottom: 1px solid var(--border); }
  table.people td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .15rem 0; text-align: right; }
  table.people td::before { content: attr(data-label); color: var(--muted); font-weight: 400; text-align: left; }
  table.people td:first-child { font-size: 1.05rem; font-weight: 600; }
  table.people td:first-child::before { content: none; }
}
@media (max-width: 480px) {
  /* the brand is in the header and Add in the bottom bar: the hero keeps the year, the view and the flagged list */
  h1 { font-size: 1.75rem; }
  .hero { padding: .9rem; gap: .5rem; margin-bottom: 1rem; }
  .hero > div:first-child { display: none; }
  .hero .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero .actions > * { min-width: 0; }
  .hero .actions .btn { justify-content: center; text-align: center; }
  .hero .actions .btn.primary { display: none; }
  .hero .actions form, .hero .actions label, .hero select { width: 100%; }
  .hero .actions .btn.secondary { grid-column: 1 / -1; }
  .brand { font-size: .95rem; white-space: nowrap; }
}
/* the camera button on Uploads: only where there is a touch screen to take the photo with */
.uploads form.camera { display: none; margin-bottom: 1rem; }
.btn.big { min-height: 56px; width: 100%; justify-content: center; font-size: 1.05rem; }
.camera-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
@media (pointer: coarse) { .uploads form.camera { display: block; } }
@media (max-width: 860px) {
  .uploads input[type=file] { min-height: 44px; width: 100%; }
}

/* HSA and tax (ADR-043): the CMP-04 disclaimer under every block that suggests an action */
.disclaimer { color: var(--muted); border-left: 3px solid var(--border); padding-left: .6rem; margin: .75rem 0 0; }
.guidance { margin-top: .35rem; }

/* Visits as rows (ADR-046) */
.visit-rows { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.visit-row { display: grid; grid-template-columns: 7.5rem minmax(12rem, 1fr) 11rem 6rem 6rem 6rem 8rem; gap: .25rem .75rem; align-items: center; padding: .6rem .9rem; color: var(--text); border-bottom: 1px solid var(--border); border-left: 4px solid transparent; }
.visit-row:last-child { border-bottom: 0; }
a.visit-row:hover { text-decoration: none; background: var(--surface-2); }
.visit-head { font-weight: 600; background: var(--surface-2); }
.visit-row .provider { font-weight: 600; display: block; }
.vr-num { text-align: right; font-family: Manrope, sans-serif; font-variant-numeric: tabular-nums; }
.vr-label { display: none; }
.vr-note { grid-column: 2 / -1; color: var(--muted); }
@media (max-width: 860px) {
  .visit-row { grid-template-columns: 1fr 1fr 1fr; padding: .7rem .8rem; }
  .visit-head { display: none; }
  .vr-who { grid-column: 1 / -1; grid-row: 1; }
  .vr-date { grid-column: 1 / 3; grid-row: 2; }
  .vr-status { grid-column: 3; grid-row: 2; text-align: right; }
  .vr-num { text-align: left; }
  .vr-label { display: block; font-size: .75rem; color: var(--muted); font-family: "DM Sans", sans-serif; }
  .vr-docs, .vr-note { grid-column: 1 / -1; }
}

/* Charges over time (UX-11) */
.charges-chart { display: block; width: 100%; height: auto; }
.chart-card { overflow-x: auto; }
@media (max-width: 860px) { .charges-chart { min-width: 640px; } }  /* keeps each dot a 44px target */
.charges-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.charges-chart .year-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.charges-chart .axis { fill: var(--muted); font-size: 12px; }
.charges-chart .axis.year { font-weight: 600; }
.charges-chart .hit { fill: transparent; }
.charges-chart .mark { stroke: var(--surface); stroke-width: 1.5; }
.charges-chart .dot:hover .mark, .charges-chart .dot:focus .mark { stroke: var(--text); stroke-width: 2.5; }
.charges-chart .dot:focus { outline: none; }
.dot-detail { min-height: 2.6em; margin: .5rem 0; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; padding: 0; margin: .25rem 0; }
.swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; margin-right: .35rem; }
.mc-0 { fill: #1a5cdf; background: #1a5cdf; } .mc-1 { fill: #c2570c; background: #c2570c; }
.mc-2 { fill: #0f8a6d; background: #0f8a6d; } .mc-3 { fill: #8a3ffc; background: #8a3ffc; }
.mc-4 { fill: #b8860b; background: #b8860b; } .mc-5 { fill: #d0347f; background: #d0347f; }
.mc-6 { fill: #0e7fa8; background: #0e7fa8; } .mc-7 { fill: #5b6b2f; background: #5b6b2f; }
.mc-none { fill: #7a889c; background: #7a889c; }
.bill-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bill-summary { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) minmax(0, 11rem) 6rem; gap: .25rem .75rem; align-items: center; padding: .6rem .9rem; cursor: pointer; }
.bill-head { background: var(--surface-2); font-weight: 600; cursor: default; }
.bill { border-top: 1px solid var(--border); }
.bill-summary .num { text-align: right; }
.bill-lines { padding: 0 .9rem .8rem; overflow-x: auto; }
@media (max-width: 860px) { .bill-summary { grid-template-columns: 1fr 5.5rem; } .bill-head { display: none; } .bill-summary > span:nth-child(1) { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); } }

/* social sign-in (PRV-12) */
.social-signin { display: grid; gap: .5rem; }
.social-signin p { margin: 0; }
.social-signin .btn { justify-content: center; }
.social-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .5rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.value-line .big { font-size: 1.6rem; }

/* ---------- UX pass 2026-11: header on one line, account and More menus ---------- */
.topbar .inner { gap: 1rem; }
.brand { white-space: nowrap; flex: none; }
.nav { flex-wrap: nowrap; gap: .1rem; min-width: 0; }
.nav a { white-space: nowrap; padding: .4rem .6rem; }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.topbar .icons { align-items: center; gap: .35rem; flex: none; }
.icon-btn svg, .add-btn svg, .menu summary svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.add-btn { margin-right: .35rem; white-space: nowrap; }
.add-btn svg { width: 16px; height: 16px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.account-menu summary { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .65rem .2rem .2rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text); font-size: .85rem; font-weight: 600; background: var(--surface); }
.account-menu summary:hover, .account-menu[open] summary { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex;
  align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 750; font-size: .85rem; flex: none; }
.account-menu .who { display: none; }  /* the name is at the top of the menu; the header stays on one line */
.account-menu summary { padding: .2rem; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 10px 28px rgba(16, 24, 40, .14); padding: .35rem; z-index: 20; display: flex; flex-direction: column; }
.menu-panel a, .menu-panel .menu-item { display: flex; align-items: center; min-height: 40px; padding: .45rem .7rem; border-radius: var(--radius-btn);
  color: var(--text); text-align: left; background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer; width: 100%; }
.menu-panel a:hover, .menu-panel .menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-head { padding: .4rem .7rem .55rem; border-bottom: 1px solid var(--border); margin-bottom: .25rem; line-height: 1.4; }
.menu-panel form { margin: .25rem 0 0; border-top: 1px solid var(--border); padding-top: .25rem; }
.menu-panel .menu-item { color: var(--bad); }
@media (max-width: 1240px) {
  .nav a { padding: .4rem .42rem; font-size: .94rem; }
  .account-menu .who { display: none; }
  .account-menu summary { padding: .2rem; }
}
@media (max-width: 1100px) {
  .brand > span { display: none; }
  .topbar .add-btn { padding: .35rem; margin-right: 0; font-size: 0; gap: 0; }
  .add-btn svg { width: 20px; height: 20px; }
  .nav { overflow-x: auto; }
}
@media (max-width: 860px) {
  .brand > span { display: inline; }
  .tabbar details { flex: 1 1 0; min-width: 0; display: flex; }
  .tabbar details > summary { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; color: var(--muted); font-size: .72rem; font-weight: 600; }
  .tabbar details > summary.active, .tabbar details[open] > summary { color: var(--accent); }
  .tabbar details > summary svg { width: 24px; height: 24px; }
  .tabbar .menu-panel { position: fixed; top: auto; right: 8px; left: auto; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); min-width: 220px; }
  .tabbar .menu-panel a { flex: none; flex-direction: row; justify-content: flex-start; align-items: center; min-height: 44px;
    font-size: 1rem; font-weight: 500; color: var(--text); padding: .5rem .8rem; }
  .account-menu summary { min-height: 44px; min-width: 44px; justify-content: center; }
  .account-menu .menu-panel a, .account-menu .menu-panel .menu-item { min-height: 44px; }
}

/* getting started (UX-09) */
.onboarding { border-color: var(--accent); }
.onboarding-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.onboarding-bar { width: min(260px, 100%); margin: 0; }
.onboarding .steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.step { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .55rem .6rem;
  border-radius: var(--radius-sm); }
.step-mark { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: .85rem; border: 1.5px solid var(--border); color: var(--muted); }
.step.done .step-mark { background: var(--good-soft); border-color: var(--good-soft); color: var(--good); }
.step.done .step-title { color: var(--muted); }
.step.next { background: var(--accent-soft); }
.step.next .step-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step-title { font-weight: 600; line-height: 1.4; }
@media (max-width: 480px) { .step { grid-template-columns: 30px minmax(0, 1fr); } .step > .btn { grid-column: 2; justify-self: start; } }

/* claim codes (REC-09) */
dl.codes { margin: 0; }
.code-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.code-row:last-child { border-bottom: 0; }
.code-row dt { display: flex; flex-direction: column; gap: .1rem; }
.code-row code { font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.code-row dd { margin: 0; font-size: .92rem; line-height: 1.5; }
@media (max-width: 480px) { .code-row { grid-template-columns: 1fr; gap: .2rem; } .code-row dt { flex-direction: row; gap: .5rem; align-items: baseline; } }

/* forms laid out on a grid: labels line up, fields fill their column */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem 1rem; align-items: end; }
.form-grid > label > input:not([type=checkbox]):not([type=radio]), .form-grid > label > select, .form-grid > label > textarea { width: 100%; }
.form-grid > .check-label { align-self: center; justify-content: flex-start; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
label { color: var(--muted); font-weight: 500; }
.disclaimer { font-size: .8rem; line-height: 1.5; color: var(--muted); border-top: 1px solid var(--border); padding-top: .75rem; margin: 1rem 0 0; }
.cash-text { margin: 0; }

/* settings */
.settings-item { border-bottom: 1px solid var(--border); }
.settings-item:last-child { border-bottom: 0; }
.settings-item > summary { padding: .6rem 0; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.settings-item > form { padding: 0 0 .9rem; border-bottom: 0; }
.terms-confirm { background: var(--accent-soft); border-radius: var(--radius-sm); padding: .7rem .9rem; }
.terms-confirm .check-label { font-weight: 600; }
.terms-confirm .hint { margin: .25rem 0 0 1.85rem; }
.toc a { padding: .2rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.toc a:hover { text-decoration: none; border-color: var(--accent); }

/* one height for every text field and menu, so labels in a row line up */
@media (min-width: 861px) { input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select { min-height: 2.5rem; line-height: 1.4; } }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* home: the year in detail, three cards side by side when there is room */
.detail-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.bar.over span { background: var(--bad); }
.vr-needs { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; margin-top: .15rem; }
.queue .q-why { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.detail-grid .limit .row { flex-direction: column; gap: 0; }
.detail-grid .limit .row .num { text-align: left; color: var(--muted); font-size: .9rem; }
.detail-grid .limit .row > span:first-child { font-weight: 600; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; width: 100%; }
.title-row h1 { margin: 0; }

/* fixed-column form grids, aligned at the top of each field */
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
.form-grid .span-2 { grid-column: span 2; }
.hint { display: block; font-size: .8rem; line-height: 1.45; color: var(--muted); font-weight: 400; margin-top: .25rem; }
fieldset.checks { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
fieldset.checks legend { padding: 0; margin-bottom: .3rem; font-size: .8rem; color: var(--muted); font-weight: 500; }
@media (max-width: 860px) { .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); } .form-grid .span-2 { grid-column: auto; } }
/* settings rows (members, accounts, providers): fields aligned at the top; the button lines up with the first field */
form.inline.settings-row { align-items: flex-start; }
form.inline.settings-row > .btn { margin-top: calc(26px + .2rem); }
.step-why { font-size: .9rem; line-height: 1.5; color: var(--text); margin-top: .15rem; }
.step.next { align-items: start; padding: .8rem .8rem; }
.step.next > .btn { align-self: center; }
/* home hero: the year, the view and the button share one bottom line and one height */
.hero .actions { align-items: flex-end; gap: .75rem; }
.hero .actions form { margin: 0; }
@media (min-width: 861px) { .hero .actions select, .hero .actions .btn { height: 2.5rem; min-height: 2.5rem; } }
.hero .actions .btn { padding: 0 1rem; }
.hero h1 { margin-bottom: .35rem; }

/* a checkbox sits beside the first line of its text, and long text wraps under itself */
.check-label { align-items: flex-start; }
.check-label > input[type=checkbox], .check-label > input[type=radio] { flex: none; margin: 6px 0 0; }
@media (max-width: 860px) { .check-label > input[type=checkbox], .check-label > input[type=radio] { margin-top: 2px; } }

/* Coverage page: one card per plan */
.plan-summary { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.insurance-card { background: var(--dark-surface); color: #f6f9fc; border-radius: 12px; padding: 1.1rem 1.25rem 1.2rem; }
.insurance-card .ic-insurer { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; opacity: .8; font-weight: 600; }
.insurance-card .ic-plan { color: #fff; font-size: 1.35rem; margin: .1rem 0 .5rem; line-height: 1.3; }
.insurance-card .ic-chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .9rem; }
.ic-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0; }
.ic-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.ic-facts dd { margin: 0; font-size: .9rem; line-height: 1.4; }
.ic-facts div:nth-child(2) { grid-column: span 2; }
.ic-facts div:nth-child(3) { grid-column: 1 / -1; }
.plan-terms h3 { margin-top: 0; }
.terms-list { margin: 0 0 .75rem; }
.terms-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.terms-list dt { color: var(--muted); }
.terms-list dd { margin: 0; font-weight: 600; }
.terms-prompt { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin: 0; }
.limit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .25rem 1.5rem; }
.limit-grid .limit .row { flex-direction: column; gap: 0; }
.limit-grid .limit .row > span:first-child { font-weight: 600; }
.limit-grid .limit .row .num { text-align: left; color: var(--muted); font-size: .9rem; }
.plan-claims > summary, .plan-edit > summary { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--border); }
@media (max-width: 860px) { .plan-summary { grid-template-columns: minmax(0, 1fr); } }
.insurance-card .badge.s-na { color: #dfe6f1; border-color: rgba(255, 255, 255, .45); }
.plan-claims > summary::before, .plan-edit > summary::before, .settings-item > summary::before { content: "▸"; color: var(--muted); width: 1em; }
.plan-claims[open] > summary::before, .plan-edit[open] > summary::before, .settings-item[open] > summary::before { content: "▾"; }
/* page headings: a button beside a labelled menu sits on the menu's bottom line, at the menu's height */
.page-head .actions { align-items: flex-end; gap: .6rem; }
.page-head .actions form { margin: 0; }
@media (min-width: 861px) { .page-head .actions .btn { min-height: 2.5rem; padding-top: 0; padding-bottom: 0; font-size: .9rem; } }

/* upload review: label and "Check" on one line, one quiet note under the input, the type menu and its button level */
.review .review-head { font-size: 1rem; margin: 0 0 .6rem; }
.review .review-head.section { margin-top: 1.6rem; }
.review .review-grid { gap: 1rem 1.4rem; align-items: start; }
.review label.field { gap: .3rem; }
.review .field-label { display: flex; align-items: center; gap: .5rem; min-height: 1.4rem; }
.review .field-label .badge { font-size: .7rem; padding: .05rem .5rem; }
.review .field-note { font-size: .75rem; color: var(--muted); }
.review label.low .field-note { color: var(--warn); }
form.inline.type-row { align-items: flex-end; gap: .6rem; }
@media (min-width: 861px) { form.inline.type-row .btn { min-height: 2.5rem; padding-top: 0; padding-bottom: 0; } }
