:root {
  /* Candor brand palette (from the landing page) */
  --ink: #2f3b24;        /* dark olive — headings, body text, logo */
  --accent: #5f7a45;     /* deep green — primary buttons, badges, focus; dark enough for white text */
  --brand: #86a06a;      /* sage hero green — decorative fills */
  --brand-pale: #c9ddb8; /* pale green — soft section backgrounds */
  --gold: #d9ad5f;       /* warm ochre — secondary accent */
  --border: #d2d8c8;     /* greenish-neutral border */
  --divider: #e4e8da;    /* lighter divider */
  --subtle: #f6f8f1;     /* off-white with a green tint — page background */
  --white: #ffffff;
  --muted: #6b7360;      /* muted olive-gray — secondary text */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--subtle);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

a { color: var(--accent); }

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

/* Crumb buttons (back link, household list rows) are plain text/link-style, not
   native buttons — strip the browser's default chrome so they don't look boxed. */
.crumb {
  appearance: none;
  background: none;
  border: none;
  padding: 6px 8px;
  margin: 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--accent);
  font: inherit;
}
.crumb:hover { background: var(--subtle); }

/* ---------- Layout ---------- */
#app { min-height: 100vh; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* The household report needs more horizontal room than the default column so
   its multi-column value tables and side-by-side bracket schedules aren't
   clipped into a horizontal scroll. Applied only on the household screen. */
.container.container-wide {
  max-width: 1400px;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.header .wordmark-logo {
  height: 24px;
  width: auto;
  display: block;
}
.login-logo {
  height: auto;
  width: 440px;
  max-width: 90%;
  display: block;
  margin: 0 auto 24px;
}
.header .wordmark {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  color: var(--ink);
}
.header .crumb {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font: inherit;
}
.header .crumb:hover { color: var(--ink); background: var(--subtle); }
.header .spacer { flex: 1; }
.header .user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.header .user-btn:hover { border-color: var(--border); background: var(--subtle); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  object-fit: cover;
  overflow: hidden;
  flex: none;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

/* ---------- Cards & rows ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

/* Profile page: one flat card, sections split by whitespace + a hairline, no nested boxes. */
.profile-page { max-width: 640px; margin-left: auto; margin-right: auto; padding: 32px 36px; }
.profile-page > h2 { font-size: 28px; margin: 0 0 8px; }
.pf-section { padding: 28px 0; }
.pf-section + .pf-section { border-top: 1px solid var(--border); }
.pf-section:last-child { padding-bottom: 0; }
.pf-section h3 { margin: 0 0 18px; font-size: 20px; font-weight: 600; }
.profile-page .field { margin-bottom: 16px; }
.profile-page .field > input { border-color: transparent; background: #f4f3ee; padding: 10px 12px; }
.profile-page .field > input:focus-visible { border-color: var(--accent); background: var(--white); }

/* Household card header: name left, live "Find a value" search box right. */
.card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.card-head .grow { flex: 1; min-width: 0; }
/* The search box anchors its results dropdown. */
.card-search { flex: none; position: relative; }
.card-search > input {
  width: 280px;
  max-width: 46vw;
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}
.card-search > input::placeholder { color: var(--muted); }
.card-search > input:focus-visible { border-color: var(--accent); }
/* Live results dropdown under the input. */
.find-value-results {
  display: none;
}
.find-value-results.open {
  display: block;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 420px;
  max-width: 80vw;
  max-height: 360px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }

/* Household list row: name/count on top, member roster beneath. */
.hh-row { display: block; }
.hh-head { font-weight: 500; color: var(--ink); }
.hh-members {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
}
.hh-member { color: var(--ink); white-space: nowrap; }

/* "Find a value" line-search result rows (reuse .row spacing/border). */
button.line-result {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--divider);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 10px 14px;
}
.line-result:last-child { border-bottom: none; }
.line-result:hover { background: var(--subtle); }
.line-result .line-desc { display: block; }
.line-amount { color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; }

/* ---------- Buttons ---------- */
button { font: inherit; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 7px;
  padding: 7px 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink);
}
.btn:hover { background: var(--subtle); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}
.btn.primary:hover { filter: brightness(0.95); }
.btn.danger {
  background: var(--white);
  border-color: #c0392b;
  color: #c0392b;
}
.btn.danger:hover { background: #fcefed; }

/* ---------- Form fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.field > label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.field > input,
.field > select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
}
.field > input:focus-visible,
.field > select:focus-visible {
  border-color: var(--accent);
}

.form-error {
  color: #c0392b;
  font-size: 12px;
  margin: 4px 0 8px;
}

.form-notice {
  color: var(--ink);
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  margin: 4px 0 12px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
}

.search-results {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.search-results .crumb {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font: inherit;
}
.search-results .crumb:hover { background: var(--subtle); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* ---------- Login ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
/* Login/signup view: full-height column so the card centers and the legal
   footer bar sits at the bottom of the viewport. */
.login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.login-card {
  width: 100%;
  max-width: 520px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.login-card h1 { margin: 0 0 16px; font-size: 20px; font-weight: 600; }

/* Terms-agreement checkbox on the signup form. Checkbox and wrapping text sit on
   one row, top-aligned so multi-line text lines up with the box. */
.agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.agree input[type="checkbox"] {
  margin-top: 2px;
  flex: none;
  cursor: pointer;
}
.agree a { color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 25, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-panel {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  border: 1px solid var(--border);
}
.modal-panel h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.modal-panel p { margin: 0 0 16px; color: var(--muted); }
.modal-panel-wide {
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.section-divider {
  border-top: 1px solid var(--divider);
  margin: 16px 0 12px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--ink);
  color: var(--white);
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  max-width: 420px;
}
.toast.error { background: #c0392b; }
.toast.success { background: #2b7a4b; }
.toast button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.8;
}
.toast button:hover { opacity: 1; }

/* ---------- Household report (Overview tab) ---------- */
.report {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Toolbar */
.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}
.report-tool-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.report-tool-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-toolbar select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
}

/* Member-chip scope picker */
.report-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.report-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  opacity: 0.55;
}
.report-chip:hover { background: var(--subtle); }
.report-chip.selected { opacity: 1; border-color: var(--ink); }
.report-chip-ini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex: none;
}
.report-chip-name { font-size: 13px; font-weight: 500; white-space: nowrap; }

/* Segmented toggles */
.report-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.report-seg-btn {
  background: var(--white);
  border: none;
  border-left: 1px solid var(--border);
  padding: 7px 12px;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
}
.report-seg-btn:first-child { border-left: none; }
.report-seg-btn:hover { background: var(--subtle); }
.report-seg-btn.selected { background: var(--accent); color: var(--white); font-weight: 500; }
.report-seg-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Header */
.report-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 18px;
  border-bottom: 1.5px solid var(--ink);
}
.report-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.report-colnote { font-size: 12px; }

/* Sections */
.report-sec {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.report-sec-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 10px;
}
.report-sec-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}
.report-sec-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.report-sec-note { margin-left: auto; font-size: 12px; }

/* Numeric cells */
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* KPI tiles */
.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  background: var(--divider);
  border: 1px solid var(--divider);
  border-radius: 6px;
  overflow: hidden;
}
.report-kpi {
  background: var(--white);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-kpi-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-kpi-value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.report-kpi-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* "What changed" cards */
.report-changes-wrap { display: flex; flex-direction: column; gap: 8px; }
.report-changes-title { font-size: 13px; font-weight: 600; }
.report-changes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}
.report-change {
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.report-change-main { display: flex; flex-direction: column; min-width: 0; }
.report-change-nums { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.report-change-delta { font-size: 13px; font-weight: 600; }

/* Value tables */
.report-table-wrap { overflow-x: auto; }

/* Grid-based "tables" (div.report-table): still used by the tax-bracket and benefit
   clawback schedules, where each .report-row is its own grid sized by inline
   grid-template-columns. The value/figure tables are now real <table> elements below. */
div.report-table { display: flex; flex-direction: column; font-size: 13px; min-width: 0; }
.report-row {
  display: grid;
  gap: 20px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}
.report-row.strong { font-weight: 600; background: var(--subtle); }
.report-thead {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--ink);
}

/* Real-table value/figure tables (table.report-table): all rows share one column
   model via <colgroup>, so headers sit directly above their columns and numbers form
   clean right-aligned columns — the alignment the per-row grids could not guarantee. */
table.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}
table.report-table th,
table.report-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
  vertical-align: baseline;
  text-align: left;
}
table.report-table th:not(:first-child),
table.report-table td:not(:first-child) { padding-left: 20px; }
table.report-table th.num,
table.report-table td.num { text-align: right; }
table.report-table thead th {
  padding-top: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
table.report-table tbody tr.strong { font-weight: 600; background: var(--subtle); }
/* Column model: label column flexes, value columns share one consistent width. */
.report-col-line { width: 56px; }
.report-col-label { width: auto; }
.report-col-val { width: 120px; }

.report-th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.report-label { overflow: hidden; text-overflow: ellipsis; }
.report-delta { color: var(--muted); }

/* Per-member bracket table: the single current bracket row is emphasized with a
   bold, accent-tinted row — matching the PDF's bold accent-green current row
   (Req 11.2). */
table.report-table tbody tr.report-bracket-current {
  font-weight: 600;
  color: var(--accent);
  background: var(--subtle);
}
/* Footnote beneath a bracket table (BPA clawback / provincial-unavailable). */
.report-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.4; }

/* Deductions + Credits pages (Phase 3, Req 5/6/19). Grouped line tables with a
   title + subtotal header, then a GREEN-accented totals block — reusing the
   shared table.report-table styling, matching the PDF's grouped layout. */
.report-credit-group { margin: 0 0 14px; }
.report-credit-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-weight: 600;
  font-size: 13px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink);
}
.report-credit-group-title { color: var(--accent); }
.report-credit-group-subtotal { font-variant-numeric: tabular-nums; }
/* Tighter rows for the dense grouped credit/deduction lines. */
table.report-credit-table td { padding: 5px 0; }
/* Eligibility icon cell: a small ✓ (green) / ✗ (warm) glyph. The icon is a
   render-time decision on the pre-computed `eligible`; width keeps the labels
   aligned whether or not a row carries one. */
table.report-credit-table td.report-elig,
table.report-clawback-table td.report-elig { width: 20px; padding-right: 8px; text-align: center; }
.report-icon-yes { color: var(--accent); font-weight: 700; }
.report-icon-no { color: #c29d62; font-weight: 700; }
/* Partial clawback: a muted dash, reusing the yes/no icon sizing/weight. */
.report-icon-partial { color: var(--muted); font-weight: 700; }

/* Clawback analysis (Req 7/15): per-page sub-headings, and the per-row progress
   bar sitting in its own full-width cell beneath the figure row. The bar reuses
   the trusted-SVG .report-chart box (same embed path as the donuts). */
.report-clawback-page-head {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, inherit);
}
.report-clawback-page-head:first-of-type { margin-top: 6px; }
.report-clawback-phaseout { white-space: nowrap; }
tr.report-clawback-bar-row td { padding: 4px 0 12px; border: none; }
tr.report-clawback-bar-row .report-chart { max-width: 420px; }
/* Totals block: a GREEN left-rule panel with the jurisdiction totals; the
   accent row (Tax Reduction / Total Deductions) reads in the accent color. */
.report-credit-totals {
  margin-top: 10px;
  padding: 6px 0 6px 12px;
  border-left: 3px solid var(--accent);
}
.report-credit-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-size: 13px;
  padding: 3px 0;
}
.report-credit-total-row .num { font-variant-numeric: tabular-nums; }
.report-credit-total-accent { color: var(--accent); font-size: 14px; }

/* Income stacked bar */
.report-bars { display: flex; flex-direction: column; gap: 12px; }
.report-bar-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  gap: 14px;
  align-items: center;
}
.report-bar-label { font-size: 13px; font-weight: 500; }
.report-bar {
  display: flex;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--divider);
}
.report-bar-seg { height: 100%; }
.report-bar-total { font-size: 13px; }
.report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
}
.report-legend-item { display: flex; align-items: center; gap: 6px; }
.report-legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* Backend-generated SVG charts (donuts, bracket bars). The container never forces
   overflow and the SVG scales to its box so the wide layout gets no horizontal scroll. */
.report-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}
/* Collapse to one chart per row on narrow viewports so the SVGs never get cramped. */
@media (max-width: 720px) {
  .report-charts { grid-template-columns: 1fr; }
}
/* Two per row: let each chart fill its grid track so the SVG scales up to the
   wider column (the viewBox keeps the aspect ratio); no fixed max-width cap. */
.report-chart { min-width: 0; }
.report-chart svg { width: 100%; max-width: 100%; height: auto; display: block; }

/* Card chrome around each chart (handoff .card look): white panel, thin border,
   rounded corners, padding, and a subtle lift — gives each chart its own visual
   container instead of sitting bare on the page. Matches the handoff --paper/
   --line/--radius; aligns the grid items to the top so uneven-height charts
   don't stretch. */
.report-charts { align-items: start; }
.report-charts > .report-block {
  background: #fff;
  border: 1px solid #e7e5e1;
  border-radius: 8px;
  padding: 24px 26px 26px;
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.04);
  min-width: 0;
}
.report-charts > .report-block > .report-block-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
}

/* Visual report (phase 1): header member/firm lines and the Part 1 document
   checklist grid. Additive — no existing rule is altered. The grid uses
   minmax(0, …) tracks so it reflows at narrow widths with no horizontal scroll. */
.report-header-members { font-size: 13px; }
.report-header-firm { font-size: 12px; }

/* Member chips (Req 8.4, 8.6). Laid out in a shared grid so each member sits in
   its own equal-width column — names/roles no longer run together into an
   unreadable comma list (the user's "placement makes them impossible to read"
   complaint). `minmax(0, 1fr)` columns keep the row flush with the figure
   tables beneath and reflow with no horizontal scroll at narrow widths. */
.report-header-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.report-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.report-chip-ini {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent, #0B6E4F);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
}
.report-chip-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.report-chip-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-chip-role {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}

/* Headline figures — Jay's HOUSEHOLD page (Req 1.1, 17.1): the four summary
   figures as large accent values over small captions, mirroring the PDF's
   stat callouts. `minmax(0, 1fr)` columns reflow with no horizontal scroll. */
.report-headline-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--divider);
  border: 1px solid var(--divider);
  border-radius: 6px;
  overflow: hidden;
}
.report-headline-fig {
  background: var(--white);
  padding: 18px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-headline-val {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.report-headline-cap {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Document checklist — restyled to the designer handoff `documentGrid` card
   chrome and doc-cell status palette (handoff/charts.css). Kept a flat DOM grid
   (one row per document); the full person×slip-type matrix is OUT OF SCOPE
   because model.documents is a flat {who,name,file,status} list, not a matrixed
   payload. Handoff tokens are inlined as hex here (this app's :root is the
   olive brand palette, not the handoff `:root`). */
.report-doc-checklist { margin-top: 14px; min-width: 0; }
.report-doc-grid {
  display: flex; flex-direction: column;
  background: #fff;                 /* handoff --paper */
  border: 1px solid #e7e5e1;        /* handoff --line */
  border-radius: 8px;               /* handoff --radius */
  overflow: hidden;
}
.report-doc-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 12px;
  align-items: center;
  border-top: 1px solid #f0eeea;    /* handoff --line-soft */
  min-width: 0;
}
.report-doc-row:first-child { border-top: none; }
.report-doc-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Mono uppercase header matching the handoff `.docgrid__head`. */
.report-doc-head {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; color: #6f6c66; /* handoff --ink-3 */
  text-transform: uppercase; letter-spacing: 0.06em;
  background: #fafaf8;              /* handoff --paper-2 */
}
/* Status chips: tinted cells in the handoff doc-cell palette. Text uses the
   deep variant on the light tint so it stays legible. */
.report-doc-status {
  font-size: 12px; font-weight: 600; justify-self: end;
  padding: 2px 9px; border-radius: 4px;
  border: 1px solid transparent;
}
.report-doc-status.ok {          /* Analyzed → received */
  background: #56653f; color: #fff; border-color: #56653f;
}
.report-doc-status.warn {        /* Needs info → info */
  background: #f6efe4; color: #8a5216; border-color: #d9b98f;
}
.report-doc-status.pending {     /* Processing → copper/sand */
  background: #f1dcc4; color: #8a5216; border-color: #d9b98f;
}
.report-doc-status.unknown {     /* Unknown → neutral */
  background: #fafaf8; color: #6f6c66; border-color: #efede9;
}

/* Deductions list */
.report-ded-list { display: flex; flex-direction: column; }
.report-ded-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 96px;
  gap: 16px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--divider);
}
.report-ded-row:last-child { border-bottom: none; }
.report-ded-main { display: flex; flex-direction: column; min-width: 0; }
.report-ded-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-ded-amt { font-size: 13.5px; }

/* Tax brackets: two schedules side by side, stacked on narrow widths */
.report-brackets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 640px) {
  .report-brackets { grid-template-columns: 1fr; }
}
.report-bracket-col { display: flex; flex-direction: column; gap: 8px; }
.report-bracket-title { font-size: 13px; font-weight: 600; }
/* The bracket tables reuse .report-table / .report-row / .report-th / .num.
   Drop the shared 420px min-width so two fit side by side. */
.report-brackets .report-table { min-width: 0; }

/* Clawbacks status cell: eligibility icon + text label on one line. */
.report-clawback-status { display: flex; align-items: center; gap: 6px; }

/* Deferred-sections stub */
.report-stub {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--subtle);
  padding: 16px;
}
.report-stub h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.report-stub p { margin: 0; }

/* Registered accounts: per-member cards */
.report-reg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.report-reg-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.report-reg-name { font-size: 13.5px; font-weight: 600; }
.report-reg-rrsp { display: flex; flex-direction: column; gap: 6px; }
.report-reg-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.report-reg-line .num,
.report-reg-unused .num { font-variant-numeric: tabular-nums; }
.report-reg-bar {
  display: flex;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--divider);
}
.report-reg-bar-fill { height: 100%; background: var(--accent); }
.report-reg-unused { font-size: 12px; }
.report-reg-sub {
  border-top: 1px solid var(--divider);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

/* Documents: in-report received summary */
.report-received { display: flex; flex-direction: column; gap: 10px; }
.report-received-group { display: flex; flex-direction: column; gap: 2px; }
.report-received-who { font-size: 11.5px; color: var(--muted); }
.report-received-items { font-size: 13px; line-height: 1.5; }

/* ===== Legal pages (#/terms, #/privacy) + footer ===== */

/* Constrained prose column with comfortable reading rhythm. */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.6;
}
.legal-page h1 {
  margin: 0 0 12px;
}
.legal-page h2 {
  margin: 28px 0 8px;
  font-size: 15px;
}
.legal-page .legal-section:first-of-type h2 {
  margin-top: 20px;
}
.legal-page p {
  margin: 0 0 12px;
}
.legal-page ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.legal-page li {
  margin: 4px 0;
}

/* Soft callout for the placeholder/disclaimer at the top of each legal page. */
.legal-disclaimer {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--muted);
}

/* Site footer rendered after each screen. */
.app-footer {
  max-width: 960px;
  margin: 32px auto 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.app-footer a {
  color: var(--accent);
}
.app-footer-sep {
  color: var(--border);
}
.app-footer-copy {
  color: var(--muted);
}

/* Legal links in the top bar once logged in. Sit between the spacer and the
   user button; understated so they don't compete with the primary nav. */
.header-legal {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.header-legal:hover { color: var(--ink); background: var(--subtle); }

/* Two-factor setup / verify */
.mfa-qr { display: block; margin: 8px auto 12px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fff; }
.mfa-secret { word-break: break-all; user-select: all; }
.mfa-codes {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  margin: 8px 0;
  user-select: all;
}
.mfa-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Plans & billing */
.usage-bar { height: 8px; background: var(--subtle); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 6px 0 18px; }
.usage-fill { height: 100%; background: var(--accent); }
.usage-fill.full { background: #c0392b; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 8px 0 18px; }
.plan { border: 1px solid var(--border); border-radius: 10px; padding: 16px; background: var(--white); display: flex; flex-direction: column; gap: 6px; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan h3 { margin: 0; font-size: 16px; font-weight: 600; }
.plan-price { font-size: 22px; font-weight: 600; }
.plan .btn { margin-top: auto; }
.plan-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* First-run guide */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.onboard { border-color: var(--accent); }
.ob-steps { list-style: none; margin: 4px 0 8px; padding: 0; }
.ob-step { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.ob-step:first-child { border-top: none; }
.ob-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); background: var(--white); }
.ob-step.done .ob-mark { background: var(--accent); border-color: var(--accent); color: var(--white); }
.ob-step.current .ob-mark { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ob-title { font-weight: 500; }
.ob-step.done .ob-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border); }
.ob-body p { margin: 4px 0 10px; }
.ob-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.welcome-list { margin: 8px 0 12px 18px; padding: 0; }
.welcome-list li { margin: 4px 0; }

/* ---------- Ledger tab (renderLedger / renderLedgerTable) ----------
   Modelled on the report-1g mock; mock tints stay local to these rules. */
.ledger-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.ledger-card {
  background: var(--white);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 16px 18px;
}
.ledger-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ledger-card-line { font-family: 'IBM Plex Mono', monospace; letter-spacing: 0; }
.ledger-card-vals {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ledger-card-vals > div + div { border-left: 1px solid var(--divider); padding-left: 12px; }
.ledger-card-who { font-size: 12px; color: var(--muted); }
.ledger-card-amt {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.ledger-wrap {
  background: var(--white);
  border: 1px solid var(--divider);
  border-radius: 10px;
  overflow-x: auto;
}
table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ledger th,
table.ledger td { padding: 12px 8px; text-align: left; border-top: 1px solid var(--divider); }
table.ledger th:first-child,
table.ledger td:first-child { padding-left: 18px; }
table.ledger th:last-child,
table.ledger td:last-child { padding-right: 18px; }
table.ledger thead th {
  border-top: 0;
  padding-top: 10px;
  padding-bottom: 10px;
  background: #eef0e3;          /* mock --brand-tint */
  color: #3f4b22;               /* mock --brand-ink */
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
table.ledger thead th.num { font-weight: 500; color: var(--muted); letter-spacing: 0; text-transform: none; }
table.ledger tbody tr:hover { background: #eef0e3; }
table.ledger td.form { color: var(--muted); white-space: nowrap; }
table.ledger td.lineno { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--muted); }
table.ledger td.num,
table.ledger th.num { text-align: right; min-width: 120px; }
table.ledger td.num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  letter-spacing: -0.01em;
  border-left: 1px solid var(--divider);   /* hairline between person columns */
}
table.ledger th.num + th.num { border-left: 0; }
/* Total rows are bold (not color-only) on a light tint. */
table.ledger tbody tr.total { background: var(--subtle); font-weight: 600; }

@media (max-width: 700px) {
  .ledger-cards { grid-template-columns: 1fr; }
  table.ledger { min-width: 620px; }  /* .ledger-wrap scrolls horizontally */
}

/* Report tab: one ledger table per section. */
.ledger-groups { display: flex; flex-direction: column; gap: 18px; }
table.ledger.grouped { min-width: 0; }
table.ledger .lineno-inline { margin-left: 10px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); }
@media (max-width: 700px) { table.ledger.grouped { min-width: 520px; } }

/* Values heading row: big title left, filter box right. */
.ledger-values-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 28px 0 14px; }
.ledger-values-title { margin: 0; font-size: 64px; line-height: 1.05; font-weight: 600; letter-spacing: -0.02em; }
