/* Layout: fixed sidebar + single working column on desktop; bottom tab bar on phones.
   Identity: pine green (trust, the Canadian forest) on a cool birch neutral, amber reserved for "demo" signals. */
:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #e8eeeb;
  --fg: #12251f;
  --muted: #4f625c;
  --line: #d2dcd8;
  --brand: #0d5a4d;
  --brand-strong: #08443a;
  --brand-fg: #ffffff;
  --brand-soft: #dbece7;
  --accent: #c58a16;
  --accent-soft: #fbf0d8;
  --accent-ink: #694600;
  --in: #0f6d4c;
  --in-soft: #dcf1e7;
  --danger: #b0281f;
  --danger-soft: #fbe8e6;
  --focus: #1f6fd1;
  --shadow: 0 1px 2px rgba(18, 37, 31, .06), 0 8px 24px -12px rgba(18, 37, 31, .18);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --sidebar: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1412;
    --surface: #131f1c;
    --surface-2: #1a2925;
    --fg: #e5eeeb;
    --muted: #9cb0a9;
    --line: #2a3c37;
    --brand: #5cc4ae;
    --brand-strong: #7fd6c3;
    --brand-fg: #052019;
    --brand-soft: #173a33;
    --accent: #e6b04c;
    --accent-soft: #382b10;
    --accent-ink: #f4cd7e;
    --in: #6fd6a8;
    --in-soft: #143528;
    --danger: #ff8c82;
    --danger-soft: #3a1714;
    --focus: #7db4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1412;
  --surface: #131f1c;
  --surface-2: #1a2925;
  --fg: #e5eeeb;
  --muted: #9cb0a9;
  --line: #2a3c37;
  --brand: #5cc4ae;
  --brand-strong: #7fd6c3;
  --brand-fg: #052019;
  --brand-soft: #173a33;
  --accent: #e6b04c;
  --accent-soft: #382b10;
  --accent-ink: #f4cd7e;
  --in: #6fd6a8;
  --in-soft: #143528;
  --danger: #ff8c82;
  --danger-soft: #3a1714;
  --focus: #7db4ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem); font-weight: 750; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: .02em; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.noscript { padding: 24px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  background: var(--brand); color: var(--brand-fg); padding: 10px 14px; border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Demo banner ---------- */
.demo-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; text-align: center;
  background: var(--accent-soft); color: var(--accent-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  font-size: .9rem;
}
.demo-banner strong { font-weight: 700; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 750; font-size: 1.25rem; letter-spacing: -.02em; line-height: 1; }
.brand-sub { display: block; font-family: var(--font-body); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.logo-bg { fill: var(--brand); }
.logo-fg { fill: var(--brand-fg); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - 40px); }
.sidebar {
  position: sticky; top: env(safe-area-inset-top, 0px); align-self: start;
  height: calc(100vh - 40px);
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 12px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--muted); font-weight: 600; text-align: left; cursor: pointer;
}
.nav-btn:hover { background: var(--surface-2); color: var(--fg); }
.nav-btn[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; font-size: .85rem; }
.sidebar-note { padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); }

.main { min-width: 0; padding: 32px clamp(16px, 4vw, 48px) 64px; }
.page { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.tabbar { display: none; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow); min-width: 0; }
.section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .6; }
.btn-primary { background: var(--brand); color: var(--brand-fg); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--brand); padding-inline: 10px; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-danger:hover { filter: brightness(.92); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges & pills ---------- */
.badge-demo {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.badge-demo .ic { width: 15px; height: 15px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
}
.pill .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.st-completed { background: var(--in-soft); color: var(--in); border-color: transparent; }
.pill.st-pending { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.pill.st-scheduled { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.alert .ic { margin-top: 2px; }
.alert-info { background: var(--brand-soft); border-color: transparent; color: var(--fg); }
.alert-info .ic { color: var(--brand-strong); }
.alert-demo { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--fg); }
.alert-error .ic { color: var(--danger); }
.alert h2, .alert h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert a { color: inherit; font-weight: 600; }

/* ---------- Entry ---------- */
.entry { min-height: calc(100vh - 40px); display: grid; place-items: center; padding: 40px 16px; }
.entry-grid { width: 100%; max-width: 1040px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.entry-copy { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.entry-copy h1 { font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.5rem); line-height: 1.04; }
.entry-copy .lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.entry-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.entry-points li { display: flex; gap: 12px; align-items: flex-start; }
.entry-points .ic { color: var(--brand); margin-top: 2px; }
.profile-card { display: flex; flex-direction: column; gap: 20px; }
.profile-top { display: flex; gap: 16px; align-items: center; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-fg);
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
}
.avatar.sm { width: 40px; height: 40px; font-size: .95rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv.left dd { text-align: left; }

/* ---------- Home ---------- */
.hero-balance {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
  background: var(--brand); color: var(--brand-fg); border: 0;
}
.hero-balance .eyebrow { color: inherit; opacity: .8; }
.big-amount { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.2rem, 1.6rem + 2.5vw, 3.2rem); line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-balance .sub { opacity: .85; font-size: .95rem; }
.quick { display: flex; flex-wrap: wrap; gap: 10px; }
.quick .btn { background: var(--brand-fg); color: var(--brand); }
.quick .btn:hover { filter: brightness(.95); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.home-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }

.acct-tile {
  display: flex; flex-direction: column; gap: 14px; text-align: left;
  width: 100%; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .15s ease;
}
.acct-tile:hover { border-color: var(--brand); }
.acct-tile-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.acct-name { font-weight: 700; }
.acct-num { color: var(--muted); font-size: .88rem; }
.acct-bal { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: -.01em; }
.acct-label { font-size: .8rem; color: var(--muted); }

.spend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.spend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: .92rem; }
.spend-bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.spend-bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.spend-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; font-weight: 700; }

/* ---------- Transactions ---------- */
.txn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.txn-list li + li { border-top: 1px solid var(--line); }
.txn {
  width: 100%; display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 118px 118px 120px;
  align-items: center; gap: 14px;
  padding: 14px 8px; border: 0; background: transparent; text-align: left; cursor: pointer;
  border-radius: var(--r-sm);
}
.txn:hover { background: var(--surface-2); }
.txn.compact { grid-template-columns: 40px minmax(0, 1fr) 120px; }
.txn.compact .txn-date, .txn.compact .txn-status { display: none; }
.txn.compact .meta-date { display: inline; }
.txn-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.txn-ic.in { background: var(--in-soft); color: var(--in); }
.txn-main { display: flex; flex-direction: column; min-width: 0; }
.txn-desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-meta { font-size: .84rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.meta-date { display: none; }
.meta-status { display: none; }
.txn-date { font-size: .9rem; color: var(--muted); }
.txn-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txn-amt.in { color: var(--in); }
.txn.is-new { animation: flash 2.4s ease-out 1; }
@keyframes flash { 0%, 30% { background: var(--brand-soft); } 100% { background: transparent; } }
.list-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) 118px 118px 120px; gap: 14px; padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.list-head span:last-child { text-align: right; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.seg input:checked + label { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.filters .field { min-width: 0; }
.search { position: relative; flex: 1 1 220px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px; }
.result-count { font-size: .9rem; color: var(--muted); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 16px; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; color: var(--brand); }
.empty h3 { color: var(--fg); }

/* ---------- Accounts ---------- */
.acct-card { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden; }
.acct-card > div { padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.acct-card .acct-bal-panel { background: var(--surface-2); border-left: 1px solid var(--line); justify-content: space-between; }
.acct-card .big-amount { font-size: clamp(1.9rem, 1.5rem + 1.5vw, 2.5rem); }

/* ---------- Forms ---------- */
.flow-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; font-size: .85rem; }
.flow-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.flow-steps li + li::before { content: ""; width: 20px; height: 1.5px; background: var(--line); }
.flow-steps .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--line); }
.flow-steps [aria-current="step"] { color: var(--fg); }
.flow-steps [aria-current="step"] .dot { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }
.flow-steps .done .dot { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }

.form { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .legend { font-weight: 600; }
.hint { font-size: .88rem; color: var(--muted); }
.err { display: flex; gap: 6px; align-items: flex-start; font-size: .9rem; font-weight: 600; color: var(--danger); }
.err .ic { width: 17px; height: 17px; margin-top: 2px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--fg);
}
textarea.input { min-height: 88px; resize: vertical; }
.input:hover { border-color: var(--muted); }
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); border-radius: var(--r-sm); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.money-input { position: relative; max-width: 280px; }
.money-input > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--muted); pointer-events: none; }
.money-input .input { padding-left: 30px; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.date-input { max-width: 240px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice label {
  display: flex; align-items: center; gap: 12px; height: 100%;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
}
.chips .choice label { padding: 10px 18px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums; }
.choice label:hover { border-color: var(--muted); }
.choice input:checked + label { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice .check { margin-left: auto; color: var(--brand); visibility: hidden; }
.choice input:checked + label .check { visibility: visible; }
.choice-text { display: flex; flex-direction: column; min-width: 0; }
.choice-text strong { font-weight: 600; }
.choice-text span { font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.choice-grid[aria-invalid="true"] .choice label, .chips[aria-invalid="true"] .choice label { border-color: var(--danger); }
.biller-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); flex: none; }

.avail { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); font-size: .92rem; }
.avail strong { font-variant-numeric: tabular-nums; }

/* Review */
.review { display: flex; flex-direction: column; }
.review-amount { padding-bottom: 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.review dl { margin: 0; display: flex; flex-direction: column; }
.review dl > div { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.review dt { color: var(--muted); }
.review dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.review dd small { display: block; font-weight: 400; color: var(--muted); }

/* Success */
.success { text-align: center; align-items: center; display: flex; flex-direction: column; gap: 14px; padding-block: 36px; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--in-soft); color: var(--in); }
.success-mark .ic { width: 32px; height: 32px; stroke-width: 2.4; }
.success-mark.fail { background: var(--danger-soft); color: var(--danger); }
.success .kv { width: 100%; max-width: 440px; text-align: left; margin-top: 8px; }
.success .btn-row { justify-content: center; margin-top: 8px; }
.ref-box { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px dashed var(--line); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--fg); }
@media (prefers-reduced-motion: no-preference) {
  .success-mark { animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
  .view-enter { animation: rise .28s ease-out both; }
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(6px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- Settings ---------- */
.switch-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.prose { display: flex; flex-direction: column; gap: 10px; max-width: 62ch; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* ---------- Dialog ---------- */
dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--fg); box-shadow: 0 24px 64px -20px rgba(0,0,0,.45);
}
dialog::backdrop { background: rgba(8, 20, 17, .55); }
.dlg { display: flex; flex-direction: column; gap: 18px; padding: 24px; }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: rise .2s ease-out; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  display: flex; gap: 10px; align-items: center;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--fg); color: var(--bg); font-weight: 600; box-shadow: var(--shadow);
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .home-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .entry-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .txn, .list-head { grid-template-columns: 40px minmax(0, 1fr) 110px 120px; }
  .txn-date, .list-head .h-date { display: none; }
  .txn .meta-date { display: inline; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .mobile-top { display: flex !important; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar .nav-btn { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: .75rem; text-align: center; justify-content: center; }
  .card { padding: 18px; border-radius: var(--r-md); }
  .hero-balance { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .acct-card { grid-template-columns: minmax(0, 1fr); }
  .acct-card .acct-bal-panel { border-left: 0; border-top: 1px solid var(--line); }
  .acct-card > div { padding: 18px; }
  .txn, .txn.compact, .list-head { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding-inline: 4px; }
  .txn-status, .list-head .h-status { display: none; }
  .txn .meta-status { display: inline-flex; }
  .list-head { display: none; }
  .review dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .btn-row.stack-sm { flex-direction: column-reverse; align-items: stretch; }
  .btn-row.stack-sm .btn { width: 100%; }
  .seg { width: 100%; }
  .seg label { flex: 1; text-align: center; padding-inline: 8px; }
  .filters .field { flex: 1 1 140px; }
  .demo-banner { font-size: .82rem; }
  .kv dd { text-align: left; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd + dt { margin-top: 8px; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spinner { animation: spin 1.6s linear infinite !important; }
}
@media (forced-colors: active) {
  .pill, .badge-demo, .btn { border: 1px solid CanvasText; }
}

