/* Finance portal - design tokens, layout and components.
   Chart colours follow the validated data-viz palette (slot 1 blue, slot 2 orange),
   checked against these exact card surfaces in light and dark mode. */

:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f3f3f0;
  --surface-3: #eaeae6;
  --line: #e8e7e2;
  --line-strong: #d7d6d0;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, 0.12);
  --focus: rgba(42, 120, 214, 0.35);
  --primary: #111110;
  --primary-ink: #ffffff;
  --primary-hover: #2b2b29;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #ecebe6;
  --axis: #c3c2b7;
  --good: #006300;
  --good-soft: #e7f3e7;
  --bad: #b42318;
  --bad-soft: #fbeceb;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --info-soft: #eaf2fc;
  --shadow-xs: 0 1px 2px rgba(17, 17, 16, 0.04);
  --shadow-sm: 0 1px 3px rgba(17, 17, 16, 0.06), 0 1px 2px rgba(17, 17, 16, 0.03);
  --shadow-lg: 0 24px 64px rgba(17, 17, 16, 0.18), 0 2px 8px rgba(17, 17, 16, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0c0c0c;
    --surface: #161615;
    --surface-2: #1d1d1b;
    --surface-3: #262624;
    --line: #262624;
    --line-strong: #353532;
    --ink: #f7f7f5;
    --ink-2: #c3c2b7;
    --ink-3: #8f8d86;
    --accent: #3987e5;
    --accent-soft: rgba(57, 135, 229, 0.16);
    --focus: rgba(57, 135, 229, 0.45);
    --primary: #f7f7f5;
    --primary-ink: #0b0b0b;
    --primary-hover: #d9d9d4;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #262624;
    --axis: #383835;
    --good: #0ca30c;
    --good-soft: rgba(12, 163, 12, 0.14);
    --bad: #e66767;
    --bad-soft: rgba(230, 103, 103, 0.14);
    --warn: #f0c36a;
    --warn-soft: rgba(250, 178, 25, 0.12);
    --info-soft: rgba(57, 135, 229, 0.12);
    --shadow-xs: none;
    --shadow-sm: none;
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0c0c0c;
  --surface: #161615;
  --surface-2: #1d1d1b;
  --surface-3: #262624;
  --line: #262624;
  --line-strong: #353532;
  --ink: #f7f7f5;
  --ink-2: #c3c2b7;
  --ink-3: #8f8d86;
  --accent: #3987e5;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --focus: rgba(57, 135, 229, 0.45);
  --primary: #f7f7f5;
  --primary-ink: #0b0b0b;
  --primary-hover: #d9d9d4;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #262624;
  --axis: #383835;
  --good: #0ca30c;
  --good-soft: rgba(12, 163, 12, 0.14);
  --bad: #e66767;
  --bad-soft: rgba(230, 103, 103, 0.14);
  --warn: #f0c36a;
  --warn-soft: rgba(250, 178, 25, 0.12);
  --info-soft: rgba(57, 135, 229, 0.12);
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
a.link, .link-accent { color: var(--accent); }
a.link:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--ink-2); font-weight: 500; letter-spacing: 0; }
p { margin: 0; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px 14px; border-right: 1px solid var(--line); background: var(--page); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #2a78d6 0%, #4a3aa7 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  font-weight: 700; font-size: 15px; letter-spacing: -0.03em;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--ink-3); }
.search-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-3);
  font: inherit; cursor: pointer; box-shadow: var(--shadow-xs);
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--ink-2); }
.search-trigger .kbd { margin-left: auto; }
.kbd { font-family: var(--font); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 17px; background: var(--surface); }
.nav-group { padding: 10px 0 2px; }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--ink-3); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--ink-2);
  font-weight: 500; transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.nav a.active svg.i { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user-card .who { min-width: 0; flex: 1; }
.user-card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .role { font-size: 12px; color: var(--ink-3); }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.theme-row { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 10px; color: var(--ink-3); font-size: 12.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.content { width: 100%; max-width: 1260px; margin: 0 auto; padding: 28px 36px 64px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; height: 42px; }
button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; }
button.linklike:hover { color: var(--ink); text-decoration: underline; }
button.linklike.danger { color: var(--bad); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card, .grid + .card, .card + .grid, .kpis + .card, .kpis + .grid, .grid + .grid, .notice + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head .meta { color: var(--ink-3); font-size: 12.5px; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 8px 0 4px; }
.grid { display: grid; gap: 18px; }
.grid > .card, .kpis > .card, .brand-grid > .card { margin-top: 0; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .theme-icon-dark { display: inline; }
  :root:where(:not([data-theme="light"])) .theme-icon-light { display: none; }
}
.grid.cols-3-1 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Hero & KPIs ---------- */
.hero-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 500; }
.hero-value { font-size: 52px; line-height: 1.05; font-weight: 650; letter-spacing: -0.035em; margin-top: 8px; }
.hero-value .cents { font-size: 0.5em; color: var(--ink-3); letter-spacing: -0.01em; font-weight: 600; }
.hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; color: var(--ink-3); font-size: 13px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 6px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--ink-2); }
.delta.good { background: var(--good-soft); color: var(--good); }
.delta.bad { background: var(--bad-soft); color: var(--bad); }
.delta svg.i { width: 13px; height: 13px; stroke-width: 2.25; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.kpi { padding: 16px 18px 15px; }
.kpi .label { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi .label svg.i { color: var(--ink-3); }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -0.025em; margin-top: 8px; line-height: 1.15; }
.kpi .foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; color: var(--ink-3); font-size: 12.5px; }

.live { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #0ca30c; box-shadow: 0 0 0 3px rgba(12,163,12,.18); }
.live.stale .live-dot { background: #fab219; box-shadow: 0 0 0 3px rgba(250,178,25,.2); }
@media (prefers-reduced-motion: no-preference) {
  .live:not(.stale) .live-dot { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(12,163,12,.18); } 50% { box-shadow: 0 0 0 6px rgba(12,163,12,.04); } }
}

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; height: 236px; margin-top: 14px; touch-action: pan-y; }
.chart.short { height: 260px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart:focus-visible { outline-offset: 4px; }
.chart .tick { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-empty { display: grid; place-items: center; height: 100%; text-align: center; color: var(--ink-3); font-size: 13px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 20px; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 168px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  font-size: 12.5px; opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s;
}
.chart-tip.on { opacity: 1; transform: none; }
.chart-tip .tip-title { color: var(--ink-3); margin-bottom: 6px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .tip-row + .tip-row { margin-top: 3px; }
.chart-tip .tip-key { display: inline-block; width: 12px; height: 2px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-tip .tip-val { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-tip .tip-name { color: var(--ink-2); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; color: var(--ink-3); font-size: 12.5px; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary:hover { color: var(--ink); }
.table-view[open] summary { margin-bottom: 8px; }

/* Share bars (where the money is / expenses by category) */
.shares { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.share .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.share .label { color: var(--ink); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share .value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.share .value .pct { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.track { height: 8px; margin-top: 7px; border-radius: 0 4px 4px 0; background: var(--surface-2); overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 10px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.table th.num { text-align: right; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); border-bottom: 0; padding-top: 12px; }
.table .group td { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding-top: 8px; padding-bottom: 8px; }
.table .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.table .row-actions { white-space: nowrap; text-align: right; }
.table .row-actions form { display: inline; }
.table .row-actions > * + * { margin-left: 4px; }
.table.compact td { padding-top: 9px; padding-bottom: 9px; }
.cell-title { font-weight: 550; }
.amount-out { color: var(--ink); }
.amount-in { color: var(--good); }

/* ---------- Pills, chips, avatars ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px;
  font-weight: 550; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; border: 1px solid var(--line); }
.pill svg.i { width: 13px; height: 13px; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--accent); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 7px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 11.5px; font-weight: 650; letter-spacing: .02em; color: var(--ink-2); background: var(--surface-3); }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.provider { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.provider.bank { background: var(--info-soft); color: var(--accent); border-color: transparent; }
.provider-logo { width: 32px; height: 32px; border-radius: 8px; flex: none; display: block; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06); }
.provider-logo.sm, .provider.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 9.5px; }
.provider-logo.lg { width: 40px; height: 40px; border-radius: 10px; }
.provider.sm svg.i { width: 13px; height: 13px; }

/* Gateway brands: each one's own colour, taken from its official logo files.
   Colour is never the only identity - it always sits next to the logo and the name. */
.brand-nowpayments { --brand: #64acff; }
.brand-stripe { --brand: #533afd; }
.brand-xoala { --brand: #cbbd70; }
.brand-bank { --brand: var(--accent); }
.brand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.brand-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.brand-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand); }
.brand-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 11%, var(--surface)), var(--surface)); }
.brand-head .brand-title { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand-head .brand-meta { color: var(--ink-3); font-size: 12.5px; }
.brand-head > div { min-width: 0; }
.brand-figures { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 0 18px 14px; }
.brand-figures .pill { margin-bottom: 3px; }
.brand-figures .big { font-size: 24px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.2; }
.brand-figures .small { color: var(--ink-3); margin-top: 2px; }
.brand-rows { border-top: 1px solid var(--line); }
.brand-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 11px 18px; border-top: 1px solid var(--line); }
.brand-row:first-child { border-top: 0; }
.brand-row .portal { font-weight: 550; display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-row .portal .dot { width: 8px; height: 8px; border-radius: 3px; background: var(--brand); flex: none; }
.brand-row .portal span:last-child { overflow-wrap: anywhere; }
.brand-row .amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.brand-row .meta { color: var(--ink-3); font-size: 12.5px; padding-left: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-row .meta-right { color: var(--ink-3); font-size: 12.5px; text-align: right; white-space: nowrap; }
.brand-row .err { color: var(--bad); }
.brand-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-3); font-size: 12.5px; }
.brand-foot .btn { margin-left: auto; }
.brand-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 4px; border-radius: 99px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 32%, transparent);
  font-weight: 550; white-space: nowrap; }
.brand-chip .provider-logo, .brand-chip .provider { width: 20px; height: 20px; border-radius: 99px; }
td.brand-accent { box-shadow: inset 3px 0 0 var(--brand); }
@media (max-width: 1100px) { .brand-grid { grid-template-columns: minmax(0, 1fr); } }
.entity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.entity .t { font-weight: 550; }
.entity .s { color: var(--ink-3); font-size: 12.5px; }

/* ---------- Notices & toasts ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13.5px; background: var(--info-soft); color: var(--ink); margin-bottom: 14px; }
.notice svg.i { margin-top: 1px; }
.notice.warn { background: var(--warn-soft); }
.notice.warn svg.i { color: var(--warn); }
.notice.bad { background: var(--bad-soft); }
.notice.bad svg.i { color: var(--bad); }
.toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toast-in .18s ease-out; }
.toast .t-icon { margin-top: 1px; }
.toast.success .t-icon { color: var(--good); }
.toast.warning .t-icon { color: var(--warn); }
.toast.error .t-icon { color: var(--bad); }
.toast .t-text { flex: 1; }
.toast .icon-btn { width: 24px; height: 24px; margin: -2px -2px 0 0; }
.toast.hide { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Forms ---------- */
.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 6px; }
.field label .opt { color: var(--ink-3); font-weight: 400; }
.field .help { color: var(--ink-3); font-size: 12.5px; margin-top: 5px; }
.field .errors, .form-errors { color: var(--bad); font-size: 12.5px; margin-top: 5px; }
.form-errors { display: flex; gap: 8px; align-items: flex-start; background: var(--bad-soft); padding: 10px 12px; border-radius: var(--radius-sm); margin: 0 0 16px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 90px; padding: 10px 12px; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input[type=file] { font: inherit; color: var(--ink-2); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 550; margin-right: 12px; height: 34px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line);
  background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.input-money { position: relative; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select { width: auto; min-width: 180px; height: 36px; }

/* ---------- Month switcher / segmented ---------- */
.segmented { display: inline-flex; align-items: center; padding: 3px; gap: 2px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line); }
.segmented a, .segmented span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 8px; color: var(--ink-2); font-weight: 550; }
.segmented a:hover { background: var(--surface); color: var(--ink); }
.segmented .current { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); min-width: 128px; justify-content: center; }

/* ---------- Summary strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.strip > div { padding: 16px 20px; border-left: 1px solid var(--line); }
.strip > div:first-child { border-left: 0; }
.strip .label { color: var(--ink-3); font-size: 12.5px; }
.strip .value { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; }

/* ---------- Lists, timelines ---------- */
.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item .main-col { min-width: 0; flex: 1; }
.list-item .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.list-item .amt .when { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }
.kind-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.kind-icon.expense { background: var(--bad-soft); color: var(--bad); }
.kind-icon.withdrawal { background: var(--info-soft); color: var(--accent); }
.kind-icon.adjustment, .kind-icon.balance { background: var(--good-soft); color: var(--good); }

.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .e-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); margin-bottom: 4px; }
.empty .e-title { color: var(--ink); font-weight: 600; font-size: 14.5px; }

dl.ledger { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; }
dl.ledger dt { color: var(--ink-2); }
dl.ledger dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
dl.ledger .total { border-top: 1px solid var(--line-strong); padding-top: 12px; color: var(--ink); font-weight: 650; font-size: 15px; }

.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: 12.5px; }
.key { font-family: var(--mono); font-size: 13.5px; letter-spacing: .06em; background: var(--surface-2);
  padding: 10px 12px; border-radius: var(--radius-sm); word-break: break-all; border: 1px solid var(--line); }
.qr { background: #fff; display: inline-block; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
.qr svg { display: block; }

/* ---------- Command palette ---------- */
.cmdk { position: fixed; inset: 0; z-index: 80; display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px; background: rgba(10, 10, 9, 0.38); backdrop-filter: blur(3px); }
.cmdk.open { display: flex; }
.cmdk-panel { width: min(600px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: toast-in .14s ease-out; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.cmdk-input input { border: 0; box-shadow: none; height: 52px; padding: 0; font-size: 15px; background: transparent; }
.cmdk-input input:focus { box-shadow: none; }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 11.5px; color: var(--ink-3); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); cursor: pointer; }
.cmdk-item.active { background: var(--surface-2); color: var(--ink); }
.cmdk-item .hint { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; background: var(--surface-2); }
.cmdk-empty { padding: 26px; text-align: center; color: var(--ink-3); }

/* ---------- Sign-in ---------- */
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-aside { position: relative; overflow: hidden; color: #f2f2ef; padding: 40px 48px; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(57,135,229,.45), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(74,58,167,.55), transparent 60%), #0b0d12; }
.auth-aside::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.auth-aside > * { position: relative; }
.auth-aside .brand-name { color: #fff; }
.auth-aside .brand-sub { color: rgba(255,255,255,.6); }
.auth-pitch { margin-top: auto; max-width: 460px; }
.auth-pitch h2 { font-size: 34px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 650; color: #fff; }
.auth-pitch p { margin-top: 14px; color: rgba(255,255,255,.7); font-size: 15px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; color: rgba(255,255,255,.82); }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points svg.i { color: #86b6ef; }
.auth-gateways { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 30px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.12); }
.auth-gateways > span { font-size: 12.5px; color: rgba(255,255,255,.5); }
.auth-gateways img { display: block; height: 20px; width: auto; opacity: .92; }
.auth-gateways img.stripe { height: 30px; margin: -5px 0; }
.auth-gateways .xoala { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.auth-gateways .xoala img { height: 22px; border-radius: 5px; }
.auth-foot { margin-top: 40px; font-size: 12.5px; color: rgba(255,255,255,.45); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--page); }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 26px; }
.auth-card .lead { color: var(--ink-2); margin: 8px 0 26px; }
.auth-card .alt { margin-top: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }
.steps { display: grid; gap: 18px; margin: 4px 0 22px; counter-reset: s; }
.steps > div { display: grid; grid-template-columns: 26px 1fr; gap: 12px; }
.steps > div::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-3); font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.code-input { font-size: 22px !important; letter-spacing: .35em; text-align: center; height: 52px !important; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 70; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%);
    transition: transform .2s ease; background: var(--surface); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 65; background: rgba(10,10,9,.38); }
  .mobilebar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; padding: 10px 16px;
    background: var(--page); border-bottom: 1px solid var(--line); }
  .mobilebar .brand { padding: 0; }
  .mobilebar .spacer { flex: 1; }
  .content { padding: 20px 16px 48px; }
  .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
}
@media (max-width: 560px) {
  .hero-value { font-size: 40px; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
}
@media print {
  .sidebar, .mobilebar, .actions, .toasts, .cmdk { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Businesses (portals) ----------
   Colours sampled from each business's own logo; always shown next to its logo and name. */
.portal-fpfxglobal { --pcolor: #c9973a; --pgrad: linear-gradient(90deg, #a07030, #e0b868); }
.portal-fundedprofx { --pcolor: #f2b230; --pgrad: linear-gradient(90deg, #f0a020, #f0d060); }
.portal-axion { --pcolor: #a23cff; --pgrad: linear-gradient(90deg, #8060e0, #e04beb); }
.portal-shared { --pcolor: #dda43a; --pgrad: linear-gradient(90deg, #c9973a 0 50%, #f2b230 50% 100%); }
.portal-company { --pcolor: var(--ink-3); --pgrad: var(--line-strong); }
.portal-tag { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; font-weight: 550; vertical-align: middle; }
.portal-icons { display: inline-flex; flex: none; }
.portal-icon { width: 24px; height: 24px; border-radius: 7px; display: block; flex: none; object-fit: cover; background: #0a0a0a;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }
.portal-icons .portal-icon + .portal-icon { margin-left: -7px; box-shadow: 0 0 0 2px var(--surface); }
.portal-icon.company { display: inline-grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }
.portal-tag.sm .portal-icon { width: 20px; height: 20px; border-radius: 6px; }
.portal-tag.xs .portal-icon { width: 16px; height: 16px; border-radius: 5px; }
.portal-tag.xs .portal-icons .portal-icon + .portal-icon { margin-left: -5px; }
.portal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-tag.chip { padding: 3px 10px 3px 3px; border-radius: 99px; background: color-mix(in srgb, var(--pcolor) 13%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pcolor) 32%, transparent); font-size: 13px; }
.share .label.with-icon { display: flex; align-items: center; gap: 8px; }

.biz-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.biz-grid > .card { margin-top: 0; }
.biz-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.biz-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--pgrad); }
.biz-head { display: flex; align-items: center; gap: 12px; padding: 20px 18px 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pcolor) 12%, var(--surface)), var(--surface)); }
.biz-head img { width: 44px; height: 44px; border-radius: 12px; display: block; background: #0a0a0a; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.biz-name { font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em; }
.biz-site { color: var(--ink-3); font-size: 12.5px; }
.biz-figures { padding: 2px 18px 14px; }
.biz-figures .big { font-size: 24px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.2; }
.biz-figures .small { color: var(--ink-3); margin-top: 2px; }
.biz-stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); margin-top: auto; }
.biz-stats > div { padding: 12px 18px; min-width: 0; }
.biz-stats > div + div { border-left: 1px solid var(--line); }
.biz-stats .label { color: var(--ink-3); font-size: 12px; }
.biz-stats .value { font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.biz-foot { display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink-3); font-size: 12.5px; }
.biz-foot .gw { display: inline-flex; gap: 4px; margin-right: 4px; }
.biz-foot a { margin-left: auto; color: var(--ink-2); font-weight: 550; }
.biz-foot a:hover { color: var(--ink); }
.biz-section, .brands-section { margin-top: 22px; }
.sidebar-biz { display: flex; align-items: center; gap: 7px; }
@media (max-width: 1100px) { .biz-grid { grid-template-columns: minmax(0, 1fr); } }
.auth-aside .portal-icons .portal-icon + .portal-icon { box-shadow: 0 0 0 2px #0b0d12; }
.share .label.with-icon { flex: 1; min-width: 0; }
