/* The hub's components. Every value comes from tokens.css. Phone first; wider screens add columns. */
* { box-sizing: border-box; }
/* The hidden attribute wins over every display rule, so a hidden form (the two-factor step) never shows early. */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: var(--t-md)/1.5 var(--font-body); }
/* The app UI standard (docs/APP-UI-STANDARD.md): every number in tabular figures; headings wrap balanced. */
html, body { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: var(--t-xl); line-height: 1.25; margin: 0 0 var(--s-2); }
h2 { font-size: var(--t-md); margin: var(--s-5) 0 var(--s-2); }
h3 { font-size: var(--t-sm); margin: 0 0 var(--s-2); color: var(--muted); font-weight: 600; }
a { color: var(--accent); }
p { margin: 0 0 var(--s-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: var(--s-2); background: var(--card); padding: var(--s-2) var(--s-3); border-radius: var(--r-control); }
.skip:focus { left: var(--s-2); z-index: 10; }
.muted { color: var(--muted); }
.warn { background: var(--warn-bg); color: var(--warn-ink); padding: var(--s-2) var(--s-3); border-radius: var(--r-control); }

/* The top bar. */
.top { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; color: var(--ink); text-decoration: none; min-height: var(--tap); }
.mark { fill: var(--accent); }
.top nav { display: flex; gap: var(--s-1); flex-wrap: wrap; }
.nav { background: transparent; border: 1px solid transparent; color: var(--ink); padding: var(--s-2) var(--s-3); border-radius: var(--r-control); cursor: pointer; font: inherit; text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; gap: var(--s-1); }
.nav[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.who { margin-left: auto; color: var(--muted); font-size: var(--t-sm); }
.icon-btn { min-width: var(--tap); min-height: var(--tap); padding: 0; display: grid; place-items: center; background: transparent; border: 1px solid transparent; color: var(--ink); border-radius: var(--r-button); cursor: pointer; }
.icon-btn:hover { border-color: var(--line); }

main { max-width: var(--max); margin: 0 auto; padding: var(--s-4); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s-5); margin-bottom: var(--s-4); box-shadow: var(--shadow); }
.narrow { max-width: var(--max-narrow); margin-left: auto; margin-right: auto; }
.stack { display: grid; gap: var(--s-3); }
.row { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; margin: var(--s-3) 0 0; }
.back { display: inline-block; margin-bottom: var(--s-2); }

/* Forms, as in Capture's web client. */
label { display: grid; gap: var(--s-1); font-size: var(--t-sm); color: var(--muted); }
label.check { grid-template-columns: auto 1fr; align-items: center; }
input, select, textarea { font: inherit; font-size: var(--t-md); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-control); padding: 10px; width: 100%; min-height: var(--tap); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; }
button, .button { font: inherit; border-radius: var(--r-button); padding: 10px var(--s-4); border: 1px solid var(--line); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); background: var(--card); color: var(--ink); min-height: var(--tap); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.secondary { background: var(--card); color: var(--ink); }
.danger { background: var(--danger); color: var(--accent-ink); border-color: var(--danger); font-weight: 600; }
.linkish { background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; justify-self: start; min-height: var(--tap); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 1px; bottom: 1px; width: var(--tap); height: calc(var(--tap) - 2px); min-height: 0; padding: 0; border: 0; border-radius: 0 7px 7px 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); }
.pw-toggle:focus-visible { outline-offset: -3px; }
.qr img { width: 200px; height: 200px; background: #fff; padding: var(--s-2); border-radius: var(--r-control); }
code { font-family: var(--font-mono); font-size: var(--t-sm); overflow-wrap: anywhere; }

/* Home: one tile per module. */
.tiles { list-style: none; padding: 0; margin: var(--s-4) 0 0; display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
.tile { display: grid; gap: var(--s-1); padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); color: var(--ink); text-decoration: none; min-height: 132px; box-shadow: var(--shadow); position: relative; }
a.tile:hover { border-color: var(--accent); }
.tile strong { font-size: var(--t-lg); }
.tile .badge { justify-self: start; margin-top: auto; }
.tile[data-state="upgrade"], .tile[data-state="off"], .tile[data-state="inactive"], .tile[data-state="unavailable"], .tile[data-state="coming"] { background: var(--tile-off); }
.tile[data-state="upgrade"] strong, .tile[data-state="off"] strong, .tile[data-state="coming"] strong { color: var(--muted); }
.tile[data-state="coming"] { box-shadow: none; border-style: dashed; min-height: 96px; }
.badge { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--t-xs); font-weight: 600; padding: 2px var(--s-2); border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); background: var(--card); }
.badge.on { color: var(--up); border-color: currentColor; }
.badge.sample { color: var(--warn-ink); background: var(--warn-bg); border-color: transparent; }
.badge.live { color: var(--up); border-color: currentColor; }

/* The dashboard. */
.dash-head { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; justify-content: space-between; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-button); overflow: hidden; background: var(--card); }
.segmented button { border: 0; border-radius: 0; min-height: 40px; padding: var(--s-2) var(--s-3); font-size: var(--t-sm); background: transparent; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tabs { display: flex; gap: var(--s-1); margin: var(--s-4) 0; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tabs a { padding: var(--s-2) var(--s-3); color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; min-height: var(--tap); display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.grid { display: grid; gap: var(--s-3); grid-template-columns: 1fr; margin-bottom: var(--s-3); }
.kpis { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s-3); }
.kpi { padding: var(--s-4); margin: 0; }
.kpi .label { font-size: var(--t-sm); color: var(--muted); display: flex; gap: var(--s-1); align-items: center; }
.kpi .value { font-size: var(--t-num); line-height: 1.1; margin: var(--s-1) 0; font-weight: 600; }
.change { font-size: var(--t-sm); color: var(--muted); }
.change.up { color: var(--up); }
.change.down { color: var(--down); }
.card-head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; margin-bottom: var(--s-2); }
.card-head h2 { margin: 0; }
.updated { font-size: var(--t-xs); color: var(--muted); }
.score { display: flex; gap: var(--s-5); align-items: center; flex-wrap: wrap; }
.score .big { font-family: var(--font-display); font-size: var(--t-score); font-weight: 400; line-height: 1; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); flex: 1 1 240px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-2); font-size: var(--t-sm); }
.bars .track { grid-column: 1 / -1; height: 8px; border-radius: var(--r-pill); background: var(--chart-grid); overflow: hidden; }
.bars .fill { display: block; height: 100%; background: var(--chart); border-radius: var(--r-pill); }
.insights { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.insights li { display: flex; gap: var(--s-2); align-items: baseline; }
.insights .dot { flex: 0 0 auto; font-weight: 700; }
.insights .up .dot { color: var(--up); }
.insights .down .dot { color: var(--down); }
/* The filter row above the charts: the range chips and the comparison (charts.js; Tony, 2026-10-30). */
.filters { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; margin: 0 0 var(--s-4); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { min-height: var(--tap); padding: 6px var(--s-3); border-radius: var(--r-pill); font-size: var(--t-sm); background: var(--card); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip[aria-pressed="true"]::before { content: "\2713"; margin-right: 2px; }
#range-words { font-size: var(--t-sm); }
/* The overview's tiles: each a button that charts its figure, with its trend line. */
.kpis.pickable .pick { display: grid; align-content: start; text-align: left; justify-content: stretch; gap: 2px; width: 100%; min-height: 0; }
/* The chosen tile: a soft tint and a thin accent border all round. */
.kpis.pickable .pick[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.kpis.pickable .pick .value { margin: 2px 0 0; }
.spark { display: block; height: 36px; margin-top: var(--s-2); overflow: hidden; }
/* The metric cards: each switches its line on and off; the coloured bar and tick say which line is its own. */
.metrics { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s-3); }
.metric { --c: var(--series-1); display: grid; align-content: start; justify-content: stretch; text-align: left; gap: 2px; width: 100%; padding: var(--s-3) var(--s-4); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.metric.s2 { --c: var(--series-2); }
.metric.s3 { --c: var(--series-3); }
.metric.s4 { --c: var(--series-4); }
/* A card whose line is on: its tick filled in the line's colour, a soft tint, and a thin border in that colour all round. */
.metric[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--c); }
.metric-top { display: flex; gap: var(--s-2); align-items: center; font-size: var(--t-sm); color: var(--muted); }
.metric .tick { width: 16px; height: 16px; flex: 0 0 auto; border: 2px solid var(--muted); border-radius: 4px; display: grid; place-items: center; }
.metric[aria-pressed="true"] .tick { border-color: var(--c); background: var(--c); }
.metric[aria-pressed="true"] .tick::after { content: ""; width: 4px; height: 8px; border: solid var(--card); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.metric .value { font-size: var(--t-xl); font-weight: 600; line-height: 1.2; }
/* The charts: one strip per metric, the readout beside the pointer, recessive axes and grid. */
.viz { position: relative; border-radius: var(--r-control); }
.viz:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.viz-panel + .viz-panel { margin-top: var(--s-2); }
.viz-panel-head { display: flex; gap: var(--s-2); align-items: center; font-size: var(--t-sm); color: var(--muted); margin: 0 0 2px; }
.viz-line { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--chart); flex: 0 0 auto; }
.viz-line.dashed { border-top-style: dashed; }
.viz-tip { position: absolute; top: 4px; z-index: 3; pointer-events: none; min-width: 168px; max-width: 280px; padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--card); color: var(--ink); box-shadow: 0 4px 16px rgba(16, 24, 40, 0.12); font-size: var(--t-sm); }
.viz-tip-date { font-weight: 600; margin-bottom: 2px; }
.viz-tip-date.muted { font-weight: 400; color: var(--muted); font-size: var(--t-xs); }
.viz-tip-row { display: grid; grid-template-columns: 16px auto 1fr; gap: var(--s-2); align-items: center; padding-top: 2px; }
.viz-tip-row strong { font-variant-numeric: tabular-nums; }
.viz-tip-row span:last-child { color: var(--muted); }
.viz .uplot { font-family: var(--font-body); }
.viz .u-over, .viz .u-under { border-radius: 2px; }
.viz .u-cursor-x { border-right: 1px solid var(--muted); opacity: 0.6; }
/* Tabbed tables that sort. */
.tt-tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; margin-bottom: var(--s-2); }
.tt-tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: var(--s-2) var(--s-3); white-space: nowrap; font-size: var(--t-sm); }
.tt-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tt-table th { padding: 0; }
.tt-sort { width: 100%; justify-content: flex-start; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: var(--t-sm); padding: var(--s-2); min-height: var(--tap); }
.tt-table th.num .tt-sort { justify-content: flex-end; }
.tt-table th[aria-sort] .tt-sort { color: var(--ink); }
.tt-table td { overflow-wrap: break-word; }
/* On a narrow screen the table keeps readable columns and scrolls sideways in its own region. */
.tt-table th:first-child, .tt-table td:first-child { min-width: 10rem; }
.tt-table td.num { font-variant-numeric: tabular-nums; }
.tt-pager { display: flex; gap: var(--s-2); align-items: center; justify-content: flex-end; margin-top: var(--s-2); font-size: var(--t-sm); }
.tt-pager button { min-height: var(--tap); padding: 6px var(--s-3); }
details.table-view { margin-top: var(--s-2); }
details.table-view summary { cursor: pointer; color: var(--accent); font-size: var(--t-sm); min-height: var(--tap); display: inline-flex; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { text-align: left; padding: var(--s-2); border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.yes { color: var(--up); font-weight: 600; }
.no { color: var(--muted); }
.credit { font-size: var(--t-xs); color: var(--muted); margin-top: var(--s-6); }
.empty { padding: var(--s-4); text-align: center; color: var(--muted); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.list li { border: 1px solid var(--line); border-radius: var(--r-button); padding: var(--s-3); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.list li .grow { flex: 1 1 200px; }

/* Dialogs, the toast and the command menu, as in Capture. */
dialog { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s-5); background: var(--card); color: var(--ink); max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
#mfa-dialog-error:empty { display: none; }
#toast { position: fixed; left: var(--s-4); right: var(--s-4); bottom: var(--s-4); background: var(--ink); color: var(--bg); padding: var(--s-3) var(--s-4); border-radius: var(--r-button); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; max-width: 600px; margin: 0 auto; display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; z-index: 20; }
#toast.show { opacity: 1; transform: none; }
#toast.show #toast-action { pointer-events: auto; }
#toast button { padding: 6px var(--s-3); background: var(--bg); color: var(--ink); border-color: var(--bg); font-weight: 600; }
kbd { font: var(--t-xs)/1 var(--font-mono); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; color: var(--muted); background: var(--bg); white-space: nowrap; }
.cmd { max-width: 560px; padding: var(--s-3); }
.cmd input { margin-bottom: var(--s-2); }
.cmd ul { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.cmd li { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-2) 10px; border-radius: var(--r-control); cursor: pointer; min-height: var(--tap); }
.cmd li .grow { flex: 1 1 auto; }
.cmd li[aria-selected="true"] { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.cmd-foot { font-size: 13px; margin: var(--s-2) 0 0; }

/* Views and dialogs animate on entry; every animation is interruptible, and reduced motion turns them off. */
.view:not([hidden]) { animation: view-in 180ms ease-out; }
@keyframes view-in { from { opacity: 0; translate: 0 4px; } }
dialog[open] { animation: view-in 140ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
/* Skeleton loaders shaped like the content they stand in for. */
.skeleton { pointer-events: none; }
.sk-line { display: block; height: 12px; border-radius: 6px; margin: 6px 0; background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%); background-size: 200% 100%; animation: sk-shimmer 1.2s linear infinite; }
.sk-num { height: 28px; width: 60%; }
.sk-chart { height: 160px; border-radius: var(--r-control); }
.sk-w40 { width: 40%; } .sk-w60 { width: 60%; } .sk-w90 { width: 90%; }
@keyframes sk-shimmer { to { background-position: -200% 0; } }
[data-stale="true"] { opacity: 0.85; }

@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}
@media (min-width: 960px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  /* Two rows on a phone: the mark and the theme button, then the sections in one line that scrolls sideways. The firm's name is on every page itself. */
  .top { display: grid; grid-template-columns: auto auto 1fr auto; padding: var(--s-1) var(--s-3); gap: 0 var(--s-2); }
  .top nav { grid-row: 2; grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .appswitch { grid-row: 1; grid-column: 2; }
  #theme-btn { grid-row: 1; grid-column: 4; }
  .who { display: none; }
  .score .big { font-size: 44px; }
  main { padding: var(--s-3); }
}

/* Layout variants used by the dashboard's cards (the page policy refuses style attributes, so every variant is a class). */
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.auto { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card.off { background: var(--tile-off); }
h3.spaced { margin-top: var(--s-4); }
.row.flush { margin: 0 0 var(--s-3); }
.note { margin-top: var(--s-2); }
.grow-text { flex: 1 1 240px; }
/* The sign-in's six code boxes, the setup steps and the recovery codes (capture/web/signin-kit.js). */
.code-label { font-weight: 600; }
.code-row { display: flex; gap: var(--s-2); }
.code-box { width: 3rem; min-width: 0; flex: 0 1 3rem; text-align: center; font-family: var(--font-mono); font-size: var(--t-lg); padding: var(--s-2) 0; font-variant-numeric: tabular-nums; }
.code-boxes { display: grid; gap: var(--s-2); }
.setup-step { font-weight: 600; }
.recovery-list { font-family: var(--font-mono); font-size: var(--t-md); columns: 2; column-gap: var(--s-6); padding-left: var(--s-6); margin: 0; }
.recovery-list li { padding: 2px 0; break-inside: avoid; }
#recovery-done:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 420px) { .recovery-list { columns: 1; } }
/* Members and the Draft Assistant page. */
.member-services { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.member-services legend { font-weight: 600; padding: 0; margin-bottom: var(--s-2); }
.member-row { display: grid; gap: var(--s-2); width: 100%; }
.member-row .row { margin: 0; }
.member-gets { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
