/* GoFinFi operator workspace, the Lego theme (P0.6): the GoFinFi header (gofinfi and the program's name), one row of
   menu links under it or a slim rail on the left (the person's choice), and bricks: clear cards with one primary action
   each, solid accents in GoFinFi blue #4C63FF, rounded, compact. Light is the default; dark follows the system or the
   person's choice. Text and control pairs meet WCAG AA in both themes (test_operator.TestTheme and test_shell check
   each pair). Font: Inter, variable, self-hosted (static/inter-latin.woff2, SIL Open Font License: static/inter-OFL.txt).
   The Ledger theme's chrome (sidebar, search palette, account menus) is in static/ledger.css, not loaded here.

   Component classes (shared with every page; names unchanged from P0.5):
     layout     .page-head .page-actions .sub .section-head .grid .grid-2 .grid-3 .grid-4 .grid-side .stack-lg
     cards      .card .card-head .card-title .card-link .card.flush .card-foot .card.is-link .cards
     bricks     .bricks > .brick (.hero) .brick-label .brick-figure .brick-sub .brick-action; .steps > .step
     tables     .rows (thead, tbody, td.num, td.actions, tr.link-row + a.row-link), .table-foot, .pager
     tabs       .tabs > .tab[aria-current]
     filters    .toolbar .chips .chip-filter (details) .chip-filter.is-set .menu-pop .menu-item .search-inline
     badges     .badge (.ok .warn .bad .neutral .info .test); .pill is the same thing
     buttons    .btn .btn-secondary .btn-quiet .btn-sm .btn.danger .icon-btn .link-btn
     forms      .field .field-row .input select textarea .help .error .errors .check .stack .stack.narrow .seg-form
     steppers   .stepper > li.done | li.current | li.todo (.step-dot .step-label .step-sub)
     checklist  .checklist > li[data-state=done|todo|waiting]
     empty      .empty-state (.empty-icon .big p .actions-row)
     detail     .detail-head (.crumb .detail-title .detail-amount .detail-meta), .kv-list (dl > div > dt + dd)
     timeline   .timeline > li.done | li.todo (.tl-dot .tl-title .tl-sub)
     metrics    .metric .metric-sub .delta.up | .delta.down | .delta.flat
     charts     .chart (svg) .chart-line .chart-prev .chart-area .chart-grid .chart-axis .chart-dot .chart-bar
     help       .help-sections > .help-section; .help-dialog (the overlay)
     notes      .note .strip .flash .notice                                                                    */

@font-face {
  font-family: "Inter";
  src: url("/static/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F3F5FA;  /* page (the baseplate the bricks sit on) */
  --surface: #FFFFFF;  /* cards, tables, inputs */
  --raised: #F6F8FB;
  --subtle: #EDF0F6;
  --side-bg: #FFFFFF;  /* the side rail */
  --ink: #1A1F36;
  --muted: #596075;
  --line: #E3E7EF;
  --line-strong: #D3D9E4;
  --control: #8A93A6;  /* input and button edges (3:1) */
  --brick-edge: #DCE1EA;  /* a brick's solid bottom edge */
  --primary: #4C63FF;
  --primary-hover: #3A50EC;
  --primary-edge: #2C3FC4;  /* a blue brick's or button's bottom edge */
  --primary-text: #3448E0;
  --on-primary: #FFFFFF;
  --primary-tint: #EEF0FF;
  --disabled-bg: #E4E7EF;
  --disabled-ink: #5F687A;
  --focus: #4C63FF;
  --ok: #0A7A47;
  --ok-tint: #E3F5EC;
  --warn: #8A4B00;
  --warn-tint: #FDF1DC;
  --danger: #C0262D;
  --danger-tint: #FDECEC;
  --on-danger: #FFFFFF;
  --info: #3448E0;
  --info-tint: #EEF0FF;
  --neutral: #4A5468;
  --neutral-tint: #EEF1F5;
  --test: #B54708;  /* the Test data band */
  --on-test: #FFFFFF;
  --test-tint: #FFF1E6;
  --test-ink: #9A3A00;
  --chart-1: #4C63FF;
  --chart-prev: #B3BBCB;
  --chart-grid: #EDF0F4;
  --bar-bg: #0F1631;  /* the GoFinFi header */
  --bar-ink: #FFFFFF;
  --bar-muted: #B4BCD6;
  --bar-line: #2B3558;
  --bar-hover: #1C2547;
  --nav-ink: #DCE1F0;  /* menu links on the header */
  --track: #59628A;  /* the Test data switch's track */
  --trust: #15803D;
  --shadow: 0 1px 2px rgba(26, 31, 54, .05);
  --shadow-pop: 0 12px 32px rgba(26, 31, 54, .14), 0 2px 6px rgba(26, 31, 54, .08);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --rail-w: 212px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B0E1A;  /* page (the baseplate the bricks sit on) */
  --surface: #121729;  /* cards, tables, inputs */
  --raised: #171D33;
  --subtle: #1C2238;
  --side-bg: #0F1323;  /* the side rail */
  --ink: #E7E9F2;
  --muted: #A0A8BC;
  --line: #232A42;
  --line-strong: #2E3653;
  --control: #646E90;  /* input and button edges (3:1) */
  --brick-edge: #05070F;  /* a brick's solid bottom edge */
  --primary: #7D8CFF;
  --primary-hover: #97A3FF;
  --primary-edge: #4553C9;  /* a blue brick's or button's bottom edge */
  --primary-text: #9AA6FF;
  --on-primary: #0B0E1A;
  --primary-tint: #1B2150;
  --disabled-bg: #1A2038;
  --disabled-ink: #8E98B5;
  --focus: #9AA6FF;
  --ok: #5FD49B;
  --ok-tint: #0F2A22;
  --warn: #F6C25B;
  --warn-tint: #2E2410;
  --danger: #FF8F8A;
  --danger-tint: #36151E;
  --on-danger: #0B0E1A;
  --info: #9AA6FF;
  --info-tint: #1B2150;
  --neutral: #B4BDD2;
  --neutral-tint: #1C2238;
  --test: #C2570C;  /* the Test data band */
  --on-test: #FFFFFF;
  --test-tint: #2A1A0E;
  --test-ink: #FFB27A;
  --chart-1: #8D9BFF;
  --chart-prev: #4A5374;
  --chart-grid: #1E2439;
  --bar-bg: #141A33;  /* the GoFinFi header */
  --bar-ink: #E7E9F2;
  --bar-muted: #A0A8BC;
  --bar-line: #2E3653;
  --bar-hover: #1F2747;
  --nav-ink: #CDD3E6;  /* menu links on the header */
  --track: #646E90;  /* the Test data switch's track */
  --trust: #4ADE80;
  --shadow: none;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5), 0 0 0 1px #2E3653;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E1A;
    --surface: #121729;
    --raised: #171D33;
    --subtle: #1C2238;
    --side-bg: #0F1323;
    --ink: #E7E9F2;
    --muted: #A0A8BC;
    --line: #232A42;
    --line-strong: #2E3653;
    --control: #646E90;
    --brick-edge: #05070F;
    --primary: #7D8CFF;
    --primary-hover: #97A3FF;
    --primary-edge: #4553C9;
    --primary-text: #9AA6FF;
    --on-primary: #0B0E1A;
    --primary-tint: #1B2150;
    --disabled-bg: #1A2038;
    --disabled-ink: #8E98B5;
    --focus: #9AA6FF;
    --ok: #5FD49B;
    --ok-tint: #0F2A22;
    --warn: #F6C25B;
    --warn-tint: #2E2410;
    --danger: #FF8F8A;
    --danger-tint: #36151E;
    --on-danger: #0B0E1A;
    --info: #9AA6FF;
    --info-tint: #1B2150;
    --neutral: #B4BDD2;
    --neutral-tint: #1C2238;
    --test: #C2570C;
    --on-test: #FFFFFF;
    --test-tint: #2A1A0E;
    --test-ink: #FFB27A;
    --chart-1: #8D9BFF;
    --chart-prev: #4A5374;
    --chart-grid: #1E2439;
    --bar-bg: #141A33;
    --bar-ink: #E7E9F2;
    --bar-muted: #A0A8BC;
    --bar-line: #2E3653;
    --bar-hover: #1F2747;
    --nav-ink: #CDD3E6;
    --track: #646E90;
    --trust: #4ADE80;
    --shadow: none;
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5), 0 0 0 1px #2E3653;
    color-scheme: dark;
  }
}

/* --- base --------------------------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font-sans);
  font-feature-settings: "calt" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font: 12.5px/1.4 var(--font-mono); color: var(--muted); }
h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.015em; font-weight: 700; }
h2 { font-size: 16px; line-height: 1.35; margin: 0; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: 14px; margin: 0; font-weight: 650; }
p { margin: 0 0 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only, .offscreen {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 8px; top: -40px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.strong { font-weight: 650; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.wordmark { display: block; height: auto; }
kbd { font: 600 11px/1 var(--font-sans); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 5px; background: var(--surface); }
.inline { display: inline; margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* --- the shell: the GoFinFi header, the menu (a row or a rail), the Test data band ---------------------------------- */
.test-band {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  min-height: 28px; padding: 4px 16px; background: var(--test); color: var(--on-test);
  font-size: 12.5px; font-weight: 600; text-align: center;
}
.test-band .test-band-label { text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; }

.masthead { background: var(--bar-bg); color: var(--bar-ink); }
.mast-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 24px; }
.brand { display: inline-flex; align-items: center; color: var(--bar-ink); border-radius: var(--radius-sm); padding: 4px 0; flex: none; }
.brand:hover { text-decoration: none; }
.brand .wordmark { color: var(--bar-ink); }
.brand-name {
  min-width: 0; padding-left: 12px; border-left: 1px solid var(--bar-line); line-height: 22px;
  font-size: 15.5px; font-weight: 650; letter-spacing: -.005em; color: var(--bar-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mast-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.mast-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none; padding: 0;
  border: 1px solid var(--bar-line); border-radius: var(--radius-md); background: none; color: var(--bar-ink);
  font: 700 15px/1 var(--font-sans); cursor: pointer; text-decoration: none;
}
.mast-btn:hover { background: var(--bar-hover); text-decoration: none; }
.help-btn[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.mast-link { font: inherit; font-size: 13.5px; font-weight: 600; color: var(--bar-ink); background: none; border: 0; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.mast-link:hover { background: var(--bar-hover); }
.no-js .theme-btn { display: none; }
.test-toggle { display: inline-flex; margin: 0; }
.switch {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--bar-ink);
  background: none; border: 1px solid var(--bar-line); border-radius: 999px; padding: 5px 11px 5px 7px; cursor: pointer; white-space: nowrap;
}
.switch:hover { background: var(--bar-hover); }
.switch .track { position: relative; width: 26px; height: 16px; border-radius: 999px; background: var(--track); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--bar-ink); transition: left .15s; }
.switch[aria-checked="true"] { border-color: var(--test); background: var(--test); color: var(--on-test); }
.switch[aria-checked="true"] .track { background: var(--test-ink); }
.switch[aria-checked="true"] .track::after { left: 12px; background: var(--on-test); }

/* the menu: one markup; a row under the header ("top", the default) or a rail on the left ("side") */
.nav { background: var(--bar-bg); }
.nav-in { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 20px 10px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 13px; border-radius: var(--radius-md);
  color: var(--nav-ink); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.nav-link:hover { background: var(--bar-hover); color: var(--bar-ink); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 0 var(--primary-edge); }
.nav-link .nav-i { flex: none; }
.layout-top .nav-link .nav-i, .layout-top .nav-group-head .nav-i { display: none; }
.nav-group { display: inline-flex; align-items: center; gap: 2px; }
.nav-group-head { display: inline-flex; align-items: center; gap: 9px; padding: 7px 4px 7px 13px; color: var(--bar-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.layout-top .nav-settings { margin-left: auto; }
@media (min-width: 761px) {
  body.layout-side {   /* the rail's colour runs the full height of a long page */
    display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); align-items: start;
    background: linear-gradient(to right, var(--side-bg) calc(var(--rail-w) - 1px), var(--line) calc(var(--rail-w) - 1px),
                var(--line) var(--rail-w), var(--bg) var(--rail-w));
  }
  body.layout-side > .test-band, body.layout-side > .masthead { grid-column: 1 / -1; }
  body.layout-side > .nav {
    grid-column: 1; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--side-bg); border-right: 1px solid var(--line);
  }
  body.layout-side.is-test > .nav { top: 28px; height: calc(100vh - 28px); }
  body.layout-side > .frame { grid-column: 2; min-width: 0; }
  .layout-side .nav-in { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; padding: 14px 10px 24px; }
  .layout-side .nav-link { color: var(--ink); padding: 8px 11px; }
  .layout-side .nav-link .nav-i { color: var(--muted); }
  .layout-side .nav-link:hover { background: var(--subtle); color: var(--ink); }
  .layout-side .nav-link[aria-current="page"], .layout-side .nav-link[aria-current="page"] .nav-i { background: var(--primary); color: var(--on-primary); }
  .layout-side .nav-group { flex-direction: column; align-items: stretch; }
  .layout-side .nav-group-head { color: var(--muted); padding: 12px 11px 4px; }
  .layout-side .nav-group-head .nav-i { display: none; }
  .layout-side .nav-link.sub { padding-left: 36px; }
  .layout-side .nav-settings { margin-top: 10px; position: relative; }
  .layout-side .nav-settings::before { content: ""; position: absolute; left: 11px; right: 11px; top: -6px; border-top: 1px solid var(--line); }
}

.frame { min-width: 0; }
.main-col { min-width: 0; display: flex; flex-direction: column; min-height: 70vh; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 20px 24px 48px; flex: 1; }
.content.wide { max-width: 1320px; }
.layout-side .content { max-width: 1180px; }
.site-foot { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px 28px; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 12.5px; }
.site-foot p { margin: 0; }
.site-foot .wordmark { color: var(--muted); }
.setup-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 9px 24px; background: var(--test-tint); color: var(--ink); border-bottom: 1px solid var(--line);
}
.setup-banner strong { font-weight: 650; }

/* --- the help overlay (the ? in the header; /help is the same content as a page) ----------------------------------- */
.help-dialog {
  width: min(820px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink); box-shadow: var(--shadow-pop);
}
.help-dialog[open] { display: flex; flex-direction: column; }
.help-dialog::backdrop { background: rgba(11, 14, 26, .5); }
.help-dialog-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; background: var(--bar-bg); color: var(--bar-ink); flex: none; }
.help-dialog-head h2 { font-size: 16px; margin: 0; }
.help-dialog-page { margin-left: auto; color: var(--bar-ink); font-size: 13px; font-weight: 600; text-decoration: underline; }
.help-dialog-body { padding: 16px; overflow-y: auto; }
.help-dialog-body .page-head { display: none; }

/* --- page structure ----------------------------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sub { color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.section-head h2 { font-size: 17px; }
.section-head .sub { margin: 0; font-size: 13px; }
h2.section, .content > h2 { margin: 24px 0 10px; font-size: 17px; }
.grid { display: grid; gap: 12px; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.stack-lg { display: flex; flex-direction: column; gap: 12px; }
.foot { color: var(--muted); font-size: 12.5px; margin-top: 16px; }
.gap-top { margin-top: 16px; }

/* --- cards -------------------------------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: 0 3px 0 var(--brick-edge); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 14px 18px 4px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title { font-size: 14px; font-weight: 650; color: var(--ink); margin: 0; }
.card-title .muted { font-weight: 500; }
.card-link { font-size: 13px; font-weight: 550; white-space: nowrap; }
.card-foot { border-top: 1px solid var(--line); margin: 14px -18px -16px; padding: 10px 18px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.card.flush .card-foot { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card.is-link { position: relative; transition: border-color .12s, box-shadow .12s; }
.card.is-link:hover { border-color: var(--primary); box-shadow: 0 3px 0 var(--primary-edge); }
.card.is-link .card-cover { position: absolute; inset: 0; border-radius: inherit; }
.card.is-link .card-cover:focus-visible { outline-offset: -2px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 8px; }
.tiles.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: 0 3px 0 var(--brick-edge); }
.tile h2 { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }

/* --- metrics and charts ------------------------------------------------------------------------------------------- */
.metric { font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -.015em; margin: 0 0 2px; font-variant-numeric: tabular-nums; }
.metric.small { font-size: 20px; }
.metric.big { font-size: 32px; }
.metric-sub { color: var(--muted); font-size: 13px; margin: 0; }
.muted-metric { color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); background: var(--ok-tint); }
.delta.down { color: var(--danger); background: var(--danger-tint); }
.delta.flat { color: var(--neutral); background: var(--neutral-tint); }
.metric-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chart { display: block; width: 100%; height: auto; overflow: visible; margin-top: 10px; }
.chart-line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-prev { fill: none; stroke: var(--chart-prev); stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart-area { fill: var(--chart-1); fill-opacity: .08; stroke: none; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-base { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-bar { fill: var(--chart-1); }
.chart-dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.chart-legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-top: 8px; flex-wrap: wrap; }
.chart-legend .key { display: inline-block; width: 14px; height: 2px; background: var(--chart-1); vertical-align: middle; margin-right: 6px; }
.chart-legend .key.prev { background: var(--chart-prev); }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); }
.chart-tip strong { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-cursor { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* --- bricks (Home's brief) ------------------------------------------------------------------------------------------ */
.bricks { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); margin: 0 0 14px; }
.bricks.even { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }   /* a surface switched off */
.brick {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 15px 18px 14px; box-shadow: 0 3px 0 var(--brick-edge);
}
.brick-label { margin: 0; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.brick-figure { margin: 2px 0 0; font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.brick-figure.quiet { color: var(--muted); font-size: 22px; }
.brick-sub { margin: 0; color: var(--muted); font-size: 13px; }
.brick-action { margin-top: auto; padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.brick-action a { font-size: 13.5px; font-weight: 650; }
.brick .chart { margin-top: 8px; height: 46px; }
.brick.hero { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 3px 0 var(--primary-edge); }
.brick.hero .brick-label, .brick.hero .brick-sub { color: var(--on-primary); }
.brick.hero .brick-figure { font-size: 34px; }
.brick.hero .badge { background: var(--on-primary); color: var(--primary-text); }
.brick.hero .brick-sub strong { font-weight: 650; }
.brick-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: var(--radius-md);
  background: var(--on-primary); color: var(--primary-text); font-size: 13.5px; font-weight: 650; text-decoration: none;
  box-shadow: 0 2px 0 var(--primary-edge);
}
.brick-btn:hover { text-decoration: none; filter: brightness(.97); }
.brick.hero .brick-more { color: var(--on-primary); text-decoration: underline; text-underline-offset: 2px; }
.setup { margin: 0 0 14px; border-color: var(--test); box-shadow: 0 3px 0 var(--brick-edge); }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.setup-head h2 { font-size: 16px; }
.setup-head p { margin: 2px 0 0; color: var(--muted); }
.setup .progress { margin: 12px 0 2px; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.step > a, .step > span {
  display: flex; align-items: center; gap: 9px; height: 100%; padding: 9px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-weight: 600; text-decoration: none;
}
.step > a:hover { border-color: var(--primary); background: var(--primary-tint); text-decoration: none; }
.step .step-state { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.step .ck { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.step[data-state="done"] .ck { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.step[data-state="done"] > a, .step[data-state="done"] > span { color: var(--muted); }
.step[data-state="waiting"] .ck { border-color: var(--warn); border-style: dashed; }
.notice-row { margin: 0 0 14px; }

/* --- Settings: preferences ------------------------------------------------------------------------------------------ */
.prefs { margin: 0 0 16px; }
.prefs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.prefs-row:first-of-type { border-top: 0; padding-top: 4px; }
.prefs-row .help { margin-top: 2px; }
.prefs-row form { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prefs-row select { width: auto; max-width: 100%; }
.seg-form { margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; }
.seg-btn { font: inherit; font-size: 13.5px; font-weight: 600; padding: 7px 12px; border: 0; border-radius: 9px; background: none; color: var(--ink); cursor: pointer; }
.seg-btn:hover { background: var(--subtle); }
.seg-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 0 var(--primary-edge); }

/* --- Help ------------------------------------------------------------------------------------------------------------- */
.help-sections { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.help-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: 0 3px 0 var(--brick-edge); min-width: 0; }
.help-section.wide { grid-column: 1 / -1; }
.help-section h2 { font-size: 16px; margin: 0 0 8px; }
.help-section p { margin: 0 0 8px; }
.help-section p:last-child, .help-section ul:last-child { margin-bottom: 0; }
.help-section ul { margin: 0 0 8px; padding-left: 18px; }
.help-section li { margin: 3px 0; }
.sections { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.sections > div { padding: 7px 0; border-top: 1px solid var(--line); min-width: 0; }
.sections > div:nth-child(-n+2) { border-top: 0; }
.sections dt { font-weight: 650; }
.sections dd { margin: 0; color: var(--muted); }

/* --- tables ------------------------------------------------------------------------------------------------------- */
.rows { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 3px 0 var(--brick-edge); font-variant-numeric: tabular-nums; }
.card.flush > .rows, .card > .rows { border: 0; border-radius: 0; box-shadow: none; }
.rows th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: transparent; }
.rows td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.rows tbody tr:first-child td { border-top: 0; }
.rows th.num, .rows td.num { text-align: right; }
.rows tbody tr:hover td { background: var(--raised); }
.rows tr.link-row { position: relative; transform: scale(1); cursor: pointer; }   /* the row is the link's box */
.rows a.row-link { color: inherit; text-decoration: none; }
.rows a.row-link::after { content: ""; position: absolute; inset: 0; }
.rows a.row-link:focus-visible { outline: none; }
.rows tr.link-row:focus-within td { background: var(--primary-tint); }
.rows tr.link-row .above { position: relative; z-index: 1; }
.rows td.actions { text-align: right; white-space: nowrap; }
.rows td.actions > * { margin-left: 6px; }
.rows .amount { font-weight: 600; }
.rows .cust { font-weight: 550; }
.rows td .muted { font-size: 13px; }
.rows tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.rows tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; padding: 10px 2px; flex-wrap: wrap; }
.pager { display: flex; gap: 8px; }
.empty { color: var(--muted); padding: 24px 0; }

/* --- tabs, toolbar, filter chips ---------------------------------------------------------------------------------- */
.tabs { display: flex; gap: 20px; margin: 0 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab[aria-current="page"] { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: 650; }
.tab .count { color: var(--muted); font-weight: 500; margin-left: 4px; font-size: 12.5px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip-filter { position: relative; }
.chip-filter > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px dashed var(--line-strong); border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--muted); background: var(--surface); white-space: nowrap;
}
.chip-filter > summary::-webkit-details-marker { display: none; }
.chip-filter > summary:hover { color: var(--ink); border-color: var(--control); }
.chip-filter.is-set > summary { border-style: solid; color: var(--primary-text); border-color: var(--primary); background: var(--primary-tint); }
.chip-filter .menu-pop { left: 0; right: auto; min-width: 200px; }
.chip-filter .chip-value { font-weight: 650; }
.chip-clear { font-size: 13px; }
.search-inline { display: flex; gap: 6px; align-items: center; margin: 0; }
.search-inline input { height: 32px; min-height: 32px; width: 220px; padding: 0 10px; font-size: 13.5px; }

/* --- badges ------------------------------------------------------------------------------------------------------- */
.badge, .pill, .chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 18px;
  background: var(--neutral-tint); color: var(--neutral);
}
.badge.ok, .pill.ok, .badge.open, .badge.active { background: var(--ok-tint); color: var(--ok); }
.badge.warn, .pill.warn, .badge.pending { background: var(--warn-tint); color: var(--warn); }
.badge.bad, .pill.bad { background: var(--danger-tint); color: var(--danger); }
.badge.info, .pill.info { background: var(--info-tint); color: var(--info); }
.badge.neutral, .pill.neutral, .badge.used, .badge.cancelled { background: var(--neutral-tint); color: var(--neutral); }
.badge.test, .pill.test, .chip.test { background: var(--test-tint); color: var(--test-ink); }

/* --- buttons ------------------------------------------------------------------------------------------------------ */
.btn, .btn-secondary, .btn-quiet, .link-btn, .icon-btn {
  font: inherit; cursor: pointer; border-radius: var(--radius-md); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn { background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); padding: 7px 15px; font-weight: 650; font-size: 14px; box-shadow: 0 2px 0 var(--primary-edge); }
.btn:active, .btn-secondary:active, .btn-quiet:active, .brick-btn:active { transform: translateY(1px); box-shadow: none; }
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
.btn-secondary, .btn-quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); padding: 6px 12px; font-size: 13.5px; font-weight: 600; box-shadow: 0 2px 0 var(--brick-edge); }
.btn-secondary:hover, .btn-quiet:hover { background: var(--raised); border-color: var(--control); text-decoration: none; }
.btn-sm { padding: 3px 9px; font-size: 12.5px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-quiet.danger, .btn-secondary.danger { color: var(--danger); }
.link-btn { background: none; border: 0; color: var(--muted); padding: 6px 4px; }
.link-btn:hover { color: var(--ink); }
.icon-btn { background: none; border: 1px solid transparent; color: var(--ink); width: 34px; height: 34px; padding: 0; }
.icon-btn:hover { background: var(--raised); border-color: var(--line); text-decoration: none; }
button:disabled, .btn:disabled, .btn-quiet:disabled, .btn-secondary:disabled {
  background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-ink); cursor: default; box-shadow: none; transform: none;
}
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: inline; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: inline; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --- forms -------------------------------------------------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack.narrow { max-width: 460px; }
.stack label { font-weight: 600; margin-top: 8px; font-size: 13.5px; }
.stack .btn { margin-top: 14px; align-self: flex-start; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.field > label, .field > .label { font-weight: 600; font-size: 13.5px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.input, input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="tel"],
input[type="date"], input[type="search"], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 7px 10px; min-height: 36px; width: 100%;
  box-shadow: var(--shadow);
}
textarea { min-height: 88px; resize: vertical; }
.input:hover, input:hover, select:hover, textarea:hover { border-color: var(--control); }
.input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stack .check { margin-top: 14px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.filters select { width: auto; min-width: 160px; }
.help, .hint { color: var(--muted); font-size: 13px; margin: 0; }
.errors, .error { background: var(--danger-tint); color: var(--danger); border-radius: var(--radius-md); padding: 10px 12px; margin: 0 0 14px; }
.errors { padding-left: 28px; }
.field .error { padding: 0; background: none; margin: 0; font-size: 13px; }
.flash { background: var(--ok-tint); color: var(--ok); border-radius: var(--radius-md); padding: 10px 12px; margin: 0 0 14px; }
.note { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--radius-md); padding: 10px 12px; margin: 0 0 14px; }
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--info-tint); color: var(--ink); border-radius: var(--radius-lg); padding: 12px 14px; margin: 0 0 16px; }
.notice.warn { background: var(--warn-tint); }
.notice.test { background: var(--test-tint); }
.strip { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: var(--radius-md); padding: 10px 14px; margin: 0 0 16px; }
.strip.warn { border-left-color: var(--warn); }

/* --- steppers and checklists -------------------------------------------------------------------------------------- */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.stepper li { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 0 0 18px; counter-increment: step; }
.stepper li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.stepper li:last-child::before { display: none; }
.stepper li.done::before { background: var(--primary); }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--line-strong); color: var(--muted); background: var(--surface); }
.stepper li.done .step-dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.stepper li.current .step-dot { border-color: var(--primary); color: var(--primary-text); }
.step-label { font-weight: 600; display: block; }
.stepper li.current .step-label { color: var(--primary-text); }
.step-sub { color: var(--muted); font-size: 13px; }
.stepper a { color: inherit; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist .ck { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--on-primary); }
.checklist li[data-state="done"] .ck { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.checklist li[data-state="waiting"] .ck { border-color: var(--warn); border-style: dashed; }
.checklist .ck-label { flex: 1; font-weight: 550; }
.checklist li[data-state="done"] .ck-label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.checklist .ck-state { color: var(--muted); font-size: 13px; }
.progress { height: 6px; border-radius: 999px; background: var(--subtle); overflow: hidden; margin: 8px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.progress.p0 > span { width: 0; } .progress.p1 > span { width: 10%; } .progress.p2 > span { width: 20%; }
.progress.p3 > span { width: 30%; } .progress.p4 > span { width: 40%; } .progress.p5 > span { width: 50%; }
.progress.p6 > span { width: 60%; } .progress.p7 > span { width: 70%; } .progress.p8 > span { width: 80%; }
.progress.p9 > span { width: 90%; } .progress.p10 > span { width: 100%; }

/* --- empty states ------------------------------------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty-state .empty-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--subtle); color: var(--muted); display: grid; place-items: center; margin-bottom: 10px; }
.empty-state .big { font-size: 16px; font-weight: 650; margin: 0; }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0; }
.empty-state .actions-row { margin-top: 14px; justify-content: center; }
.rows + .empty-state, .card > .empty-state { padding: 36px 20px; }

/* --- detail pages ------------------------------------------------------------------------------------------------- */
.crumb { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.crumb a { color: var(--muted); font-weight: 550; }
.crumb a:hover { color: var(--primary-text); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h1 { font-size: 28px; }
.detail-amount { font-variant-numeric: tabular-nums; }
.detail-amount .cur { color: var(--muted); font-size: 18px; font-weight: 500; margin-left: 4px; }
.detail-meta { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 14px; }
.detail-meta div { min-width: 0; }
.detail-meta dt, .detail-meta .k { color: var(--muted); font-size: 12.5px; margin: 0 0 2px; }
.detail-meta dd, .detail-meta .v { margin: 0; font-weight: 550; }
.detail-meta dl { margin: 0; }
.kv-list { margin: 0; }
.kv-list > div { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.kv-list > div:first-child { border-top: 0; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv-list dd.num { text-align: right; }
.kv-list > div.total { border-top: 1px solid var(--line-strong); font-weight: 650; }
.kv-list > div.total dt { color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding: 0 0 18px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); margin-top: 1px; }
.timeline li.done .tl-dot { border-color: var(--ok); background: var(--ok); box-shadow: inset 0 0 0 3px var(--surface); }
.timeline li.bad .tl-dot { border-color: var(--danger); background: var(--danger); box-shadow: inset 0 0 0 3px var(--surface); }
.timeline li.next .tl-dot { border-color: var(--primary); }
.tl-title { font-weight: 600; display: block; }
.tl-sub { color: var(--muted); font-size: 13px; }

/* legacy key/value tables (Settings, statements) */
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 500; padding: 8px 0; border-top: 1px solid var(--line); color: var(--muted); }
.kv td { text-align: right; padding: 8px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 550; }
.kv tr:first-child th, .kv tr:first-child td { border-top: 0; }
.kv tr.key th { font-weight: 700; color: var(--ink); }
.kv tr.key td { color: var(--primary-text); font-size: 18px; }
.kv.settings th { width: 220px; vertical-align: top; }
.kv.settings td { font-size: 14px; font-weight: 500; text-align: left; padding-left: 12px; }
.kv.settings td .hint { font-weight: 400; margin-top: 4px; }
.kv.settings td.actions { text-align: right; white-space: nowrap; padding-left: 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.list { list-style: none; padding: 0; margin: 4px 0 0; }
.list li { padding: 9px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list li:first-child { border-top: 0; }

/* --- FinFi Trust shield (canon A1: a badge of FinFi Trust Co; the GoFinFi mark leads) ----------------------------- */
.shield { flex: none; display: block; }
.shield-line { stroke: var(--trust); opacity: .55; }
.shield-finfi { font: 700 11px var(--font-sans); fill: var(--ink); }
.shield-trust { font: 700 6.5px var(--font-sans); letter-spacing: .18em; fill: var(--trust); }

/* --- statements --------------------------------------------------------------------------------------------------- */
.statement { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow); max-width: 780px; }
.statement-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 8px; }
.statement-head .wordmark { color: var(--ink); }
.statement-meta { text-align: right; }
.statement-meta h1 { font-size: 20px; margin-bottom: 4px; }
.statement-meta p { margin: 0 0 4px; }
.statement-lines { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.statement-lines td, .statement-lines th { padding: 9px 0; border-top: 1px solid var(--line); text-align: left; font-weight: 400; }
.statement-lines td.num { text-align: right; }
.statement-lines tfoot th, .statement-lines tfoot td { border-top: 2px solid var(--ink); font-weight: 700; font-size: 16px; }
.statement-lines tr.sub-row td { color: var(--muted); font-size: 13.5px; }
.statement-status { font-weight: 600; }
.statement-foot { color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.statement-foot p { margin: 0 0 2px; }
.statement + .actions-row { margin-top: 16px; }
.statement-test { margin: -28px -28px 20px; padding: 8px 28px; background: var(--test); color: var(--on-test); font-weight: 650; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
@media print { .statement-test { margin: 0 0 16px; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* --- sign-in and standalone pages --------------------------------------------------------------------------------- */
body.centered { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--raised); }
.panel { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; margin: 0; box-shadow: var(--shadow-pop); }
.panel h1 { margin-bottom: 6px; }
.brand-title { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.panel-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.panel .legal { color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.panel .panel-title { font-size: 18px; margin: 16px 0 6px; }
.panel .hint { margin-top: 12px; }
.panel .icon-btn { border-color: var(--line); }

/* --- tablets and phones: both layouts share the phone header (the rail is a row of links there) -------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
  .bricks, .bricks.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 18px 20px 44px; }
  .mast-row { padding: 0 16px; }
  .nav-in { padding: 0 12px 10px; }
  .help-sections, .sections { grid-template-columns: minmax(0, 1fr); }
  .sections > div:nth-child(2) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .nav-in { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 0 12px; }
  .nav-in::-webkit-scrollbar { display: none; }
  .nav-link { padding: 7px 12px; }
  .layout-side .nav-link .nav-i, .layout-side .nav-group-head .nav-i { display: none; }
  .nav-settings { margin-left: 0 !important; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .bricks, .bricks.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .bricks .hero { grid-column: 1 / -1; }
  .bricks .hero ~ .brick:last-child:nth-child(even) { grid-column: 1 / -1; }   /* no brick left alone on a row */
  .bricks.even:not(:has(.hero)) .brick:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .brick { padding: 13px 14px 12px; }
  .brick-figure { font-size: 22px; }
  .brick.hero .brick-figure { font-size: 30px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 14px 16px 36px; }
  .setup-banner { padding: 9px 16px; }
  .site-foot { padding: 0 16px 24px; align-items: flex-start; }
  .mast-row { flex-wrap: wrap; row-gap: 0; padding: 8px 16px 2px; }
  .brand-name { order: 3; flex: 1 1 100%; padding: 0 0 6px; border-left: 0; font-size: 15px; }
  h1 { font-size: 22px; }
  .detail-title h1 { font-size: 24px; }
  .metric { font-size: 22px; }
  .metric.big { font-size: 26px; }
  .page-head { align-items: flex-start; }
  .rows, .rows tbody, .rows tr, .rows td { display: block; width: 100%; }
  .rows { border: 0; background: none; box-shadow: none; }
  .rows thead { display: none; }
  .rows tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 8px; padding: 6px 0; box-shadow: 0 2px 0 var(--brick-edge); }
  .card > .rows tr, .card.flush > .rows tr { border-width: 1px 0 0; border-radius: 0; margin: 0; box-shadow: none; }
  .card > .rows tr:first-child, .card.flush > .rows tr:first-child { border-top: 0; }
  .rows tbody tr:hover td { background: none; }
  .rows td { border: 0; padding: 3px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .rows td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .rows td.num { text-align: right; }
  .rows td.actions { justify-content: flex-end; padding-top: 8px; }
  .rows tbody tr:first-child td { border-top: 0; }
  .kv.settings th { width: auto; }
  .kv.settings tr { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
  .kv.settings th, .kv.settings td { border-top: 0; padding: 4px 0; }
  .kv-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv-list dd.num { text-align: left; }
  .statement { padding: 16px; }
  .statement-test { margin: -16px -16px 16px; padding: 8px 16px; }
  .statement-meta { text-align: left; }
  .search-inline input { width: 100%; }
  .search-inline { flex: 1 1 100%; }
  .detail-meta { gap: 16px 24px; }
  .help-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
}
@media (max-width: 380px) {
  .switch .switch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .switch { padding: 5px 7px; }
}

@media print {
  :root, :root[data-theme="dark"] {
    --bg: #FFFFFF; --surface: #FFFFFF; --ink: #000000; --muted: #333333; --line: #BBBBBB; --trust: #15803D;
    --primary-text: #000000; --shadow: none; --brick-edge: #FFFFFF; color-scheme: light;
  }
  body { background: #FFFFFF; font-size: 12pt; display: block !important; }
  .masthead, .nav, .test-band, .site-foot, .setup-banner, .help-dialog, .no-print, .actions-row { display: none !important; }
  .frame { display: block; box-shadow: none !important; }
  .content { max-width: none; padding: 0; }
  .statement { border: 0; padding: 0; max-width: none; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
