:root {
  --bg: #f2f3fb;
  --surface: #ffffff;
  --ink: #1b1a4b;
  --muted: #6b6f8f;
  --line: #e6e8f5;
  --soft: #f3f4fc;
  --brand: #4a44c6;
  --brand-2: #8b8ff0;
  --navy: #1e1b4b;
  --accent: #ffd84d;
  --warn: #f5b800;
  --bad: #e5484d;
  --good: #1fa971;
  --radius: 24px;
  --shadow: 0 1px 2px rgba(30, 27, 75, .04), 0 8px 28px rgba(30, 27, 75, .05);
  --mix: #ffffff;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.dim { opacity: .55; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); padding: 28px 20px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 24px; letter-spacing: -.02em; padding: 0 10px 22px; }
.logo img { width: 36px; height: 36px; border-radius: 10px; }
.nav-label { font-size: 11px; letter-spacing: .12em; font-weight: 600; color: var(--muted); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 16px; color: var(--muted); font-weight: 500; }
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.active { background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(30, 27, 75, .25); }

.main { padding: 28px 32px 48px; min-width: 0; max-width: 1280px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { font-size: 28px; letter-spacing: -.02em; }
.topbar p { color: var(--muted); margin-top: 2px; }
.tools { display: flex; align-items: center; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; height: 48px; width: 300px; color: var(--muted); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
.search svg, .icon-btn svg { width: 20px; height: 20px; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; position: relative; }
.icon-btn .dot { position: absolute; top: 11px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.profile { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 16px 5px 5px; height: 48px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-weight: 700; }
.profile b { display: block; font-size: 14px; line-height: 1.1; }
.profile small { color: var(--muted); font-size: 12px; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 500; letter-spacing: .04em; color: var(--ink); }
.pill-select, .pill-btn { background: var(--soft); border: 0; border-radius: 999px; height: 40px; padding: 0 16px; font-weight: 500; }
.pill-select { appearance: none; padding-right: 14px; }
.big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border-radius: 999px; padding: 8px 16px; font-weight: 600; white-space: nowrap; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eceafd; color: var(--brand); }
.badge.ai { background: #fff3c4; color: #8a6500; }
.badge.ok { background: #e3f6ee; color: var(--good); }
.badge.warning { background: #fff3c4; color: #8a6500; }
.badge.exceeded { background: #fde6e7; color: var(--bad); }

/* hero */
.hero { background: linear-gradient(135deg, #3b35b5 0%, #5a55d6 55%, #8c90f2 100%); color: #fff; display: flex; flex-direction: column; gap: 10px; overflow: hidden; position: relative; }
.hero .label { display: flex; align-items: center; gap: 10px; letter-spacing: .06em; opacity: .95; }
.hero .label span { background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.hero { container-type: inline-size; }
.hero .amount { font-size: min(48px, calc(100cqw / (var(--len, 10) * .6))); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; white-space: nowrap; }
.hero .amount .dim { opacity: .6; }
.hero .delta { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hero .delta b { background: var(--accent); color: #1e1b4b; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.spark { width: 100%; height: 110px; display: block; }
.hero-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ghost { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); color: #fff; border-radius: 999px; height: 48px; padding: 0 24px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.ghost:hover { background: rgba(255, 255, 255, .26); }
.btn { background: var(--navy); color: #fff; border: 0; border-radius: 999px; height: 42px; padding: 0 20px; font-weight: 600; white-space: nowrap; }
.btn:hover { background: #2c2874; }
.btn.secondary { background: var(--soft); color: var(--ink); }
.btn.danger { background: #fde6e7; color: var(--bad); }
.btn.lg { height: 48px; }

/* charts */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.tip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; border-radius: 12px; padding: 6px 12px; font-size: 12px; font-weight: 600; transform: translate(-50%, -110%); white-space: nowrap; opacity: 0; transition: opacity .12s; }
.legend-row { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend-row i, .key i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.donut { position: relative; max-width: 460px; margin: 0 auto; container-type: inline-size; }
/* the free space inside the inner dot ring is ~46% of the width, so the total scales to fit it */
.donut .center { position: absolute; left: 27%; right: 27%; bottom: 3%; text-align: center; }
.donut .center p { color: var(--muted); font-size: clamp(11px, 3.4cqw, 15px); }
.donut .center b { display: block; white-space: nowrap; letter-spacing: -.02em; font-size: min(34px, calc(46cqw / (var(--len, 8) * .6))); line-height: 1.15; }
.cat-legend { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.cat-legend div { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.tile { --c: #94a3b8; width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--c) 18%, var(--mix)); display: inline-grid; place-items: center; font-size: 17px; flex: none; }
.tile.sm { width: 28px; height: 28px; font-size: 14px; border-radius: 9px; }


/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 12px; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--soft); }
.row .title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .sub { color: var(--muted); font-size: 13px; }
.row .amt { font-weight: 700; text-align: right; }
.amt.income { color: var(--good); }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select, .field input, .field select, .field textarea { background: var(--soft); border: 1px solid transparent; border-radius: 14px; height: 44px; padding: 0 14px; outline: 0; }
.filters input { flex: 1; min-width: 180px; }
.filters input:focus, .field input:focus, .field select:focus { border-color: var(--brand-2); background: #fff; }

/* budgets page */
.card .badge { align-self: center; }
.bar { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.bar i.warning { background: var(--warn); }
.bar i.exceeded { background: var(--bad); }
.brow { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.brow:last-child { border-bottom: 0; }
.brow .meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-weight: 600; flex-wrap: wrap; }
.brow .meta span:last-child { color: var(--muted); font-weight: 500; }

/* wallets / settings */
.stack { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.form-row:last-child { border-bottom: 0; }
.form-row small { display: block; color: var(--muted); }
.switch { position: relative; width: 48px; height: 28px; }
.switch input { appearance: none; width: 100%; height: 100%; margin: 0; background: #cfd2ec; border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch input:checked { background: var(--brand); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .15s; pointer-events: none; }
.switch:has(input:checked)::after { transform: translateX(20px); }

/* ---------- dialog / forms ---------- */
dialog { border: 0; border-radius: 28px; padding: 0; width: min(480px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(30, 27, 75, .35); color: var(--ink); }
dialog::backdrop { background: rgba(30, 27, 75, .45); backdrop-filter: blur(3px); }
.dlg { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.dlg h2 { font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { color: var(--ink); width: 100%; font-size: 15px; }
.field textarea { height: 72px; padding: 10px 14px; resize: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 999px; padding: 4px; }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg label { text-align: center; padding: 10px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--navy); color: #fff; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.hint { font-size: 12px; color: var(--muted); background: #fff8dc; border-radius: 12px; padding: 8px 12px; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* onboarding */
.onboard { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #a4a8f3, #d8daf8 55%, #f2f3fb); }
.onboard .card { width: min(440px, 100%); padding: 34px; display: flex; flex-direction: column; gap: 18px; }
.onboard .logo { padding: 0; }

.legend-btn { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--muted); padding: 4px 8px 4px 4px; border-radius: 12px; }
.legend-btn:hover { background: var(--soft); color: var(--ink); }
.brow.indent { padding-left: 34px; }
.brow.indent .tile { margin-left: 0; }

/* spending breakdown dialog */
.bk { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.bk-item { background: var(--soft); border-radius: 16px; padding: 12px 14px; }
.bk-item .bar { background: #fff; height: 8px; margin-top: 8px; }
.bk-sum { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.bk-sum::-webkit-details-marker { display: none; }
.bk-sum.nochev { cursor: default; }
details.bk-item > summary::before { content: "›"; font-size: 20px; color: var(--muted); transition: transform .15s; margin-right: -2px; }
details.bk-item[open] > summary::before { transform: rotate(90deg); }
.bk-name { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.bk-subs { margin-top: 10px; padding-left: 12px; display: flex; flex-direction: column; gap: 4px; border-left: 2px solid var(--line); }
.bk-sub { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bk-subs .bar { height: 6px; margin: 0 0 6px; }

/* portfolio */
.tile.sym { font-size: 10px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); width: 44px; height: 44px; border-radius: 14px; }
.ghost.on { background: #fff; color: var(--navy); }
.alloc { display: flex; gap: 4px; height: 20px; margin: 6px 0 16px; }
.alloc i { border-radius: 8px; min-width: 6px; }
.alloc-legend { display: flex; flex-direction: column; gap: 10px; }
.alloc-legend div { display: grid; grid-template-columns: 1fr auto 44px; gap: 12px; align-items: center; }
.alloc-legend .muted { text-align: right; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
.tbl th:not(:first-child), .tbl td:not(:first-child) { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .up { color: var(--good); font-weight: 600; }
.tbl .down { color: var(--bad); font-weight: 600; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 0; background: var(--soft); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pill.on { background: var(--navy); color: #fff; }
.results { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.results[hidden], .picked[hidden], .price-fallback[hidden], #picker[hidden] { display: none; }
.res { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; color: var(--ink); }
.res:hover, .res:focus-visible { background: var(--soft); }
.res span:nth-child(2) { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-note { padding: 14px; color: var(--muted); font-size: 13px; }
.picked { background: var(--soft); border-radius: 14px; padding: 10px 14px; color: var(--ink); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.tab { border: 0; background: none; border-radius: 999px; padding: 10px 22px; font-weight: 600; color: var(--muted); }
.tab.on { background: var(--navy); color: #fff; }
.loan-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 13px; }
.pay-row { display: grid; grid-template-columns: 1fr auto 28px; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.pay-row:last-child { border-bottom: 0; }
.icon-x { border: 0; background: none; color: var(--muted); font-size: 18px; border-radius: 8px; width: 28px; height: 28px; }
.icon-x:hover { background: var(--soft); color: var(--bad); }
.holding-now { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--soft); border-radius: 16px; padding: 14px 16px; }
.holding-now small { display: block; }
.holding-now b { font-size: 20px; }
.custom-fields { display: flex; flex-direction: column; gap: 12px; }
.custom-fields[hidden] { display: none; }

.fab { display: none; }
.bottom-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px 16px 110px; }
  .search { display: none; }
  .topbar h1 { font-size: 24px; }
  .profile { display: none; }   /* the name pill is desktop-only; on phones it left an empty bar */
  .hero .amount { font-size: 38px; }
  .big { font-size: 28px; }
    .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 20; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 6px 0; border-radius: 12px; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--brand); font-weight: 700; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(82px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; box-shadow: 0 10px 24px rgba(30, 27, 75, .35); z-index: 21; }
  .fab svg { width: 26px; height: 26px; }
  .card { padding: 20px; border-radius: 22px; }
}

/* auth */
.auth-err { font-size: 13px; color: #b42318; background: #fee4e2; border-radius: 12px; padding: 8px 12px; }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--soft); }

/* collapsible categories */
.chev { display: inline-block; font-size: 18px; line-height: 1; transition: transform .15s; }
[aria-expanded="true"] > .chev, [aria-expanded="true"] .chev { transform: rotate(90deg); }
.card-toggle { padding: 0; gap: 8px; color: inherit; }
.card-toggle h2 { margin: 0; }

/* rows with several buttons: on phones the buttons move under the text instead of overflowing */
@media (max-width: 560px) {
  .brow.wrap { grid-template-columns: 44px 1fr; }
  .brow.wrap > .tools { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }
}

.empty.sm { padding: 18px 8px; }
.tbl-wrap { overflow-x: auto; }
.card-head .tools { flex-wrap: wrap; }
@media (max-width: 560px) {
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 9px 4px; white-space: nowrap; }
}

/* the balance trend takes any spare height of the card (it is stretched to match its neighbour), so no blank space opens up below the buttons */
.hero .spark { flex: 1 1 0; min-height: 110px; height: auto; }
.hero .spark { overflow: visible; }

.quick-cat { display: flex; flex-direction: column; gap: 12px; background: var(--soft); border-radius: 16px; padding: 14px; }
.quick-cat[hidden] { display: none; }
.quick-cat .field input, .quick-cat .field select { background: var(--surface); }
.legend-btn[data-act="quick-cat"] { color: var(--brand); font-weight: 600; }

/* preferred-currency dropdown on the net worth card */
.hero-cur { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; opacity: .95; }
.hero-cur select { appearance: none; -webkit-appearance: none; background: rgba(255, 255, 255, .2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center; color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; height: 44px; padding: 0 40px 0 18px; font: inherit; font-weight: 600; font-size: 15px; min-width: 120px; cursor: pointer; }
.hero-cur select option { color: var(--ink); background: #fff; }

/* special occasions on the Overview budgets card */
.ov-h { margin-top: 22px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ov-occ { margin-top: 12px; }
.ov-occ .meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-weight: 600; flex-wrap: wrap; }
.ov-occ .meta span:last-child { color: var(--muted); font-weight: 500; }

.seg.seg4 { grid-template-columns: repeat(4, 1fr); }
.seg.seg4 label { padding: 10px 4px; font-size: 14px; }

/* demo-mode banner */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #FFF4CC; color: #5A4300; border: 1px solid #F5D774; border-radius: 16px; padding: 10px 14px; margin-bottom: 18px; font-size: 14px; }
.demo-bar .btn { height: 36px; padding: 0 16px; }

.onboard { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.legal-links { margin-top: 18px; font-size: 12px; text-align: center; color: var(--muted); }
.legal-links a { color: inherit; }

/* ---------- landing page ---------- */
.logo-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.land { min-height: 100vh; background: var(--bg); color: var(--ink); overflow-x: hidden; }
.land-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1100px; margin: 0 auto; padding: 18px 20px; }
.land-nav .logo { padding: 0; color: var(--ink); text-decoration: none; }
.land-nav-r { display: flex; align-items: center; gap: 10px; }
.lang-select { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; height: 44px; padding: 0 14px; color: var(--ink); font: inherit; font-size: 14px; }
.land-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 40px 20px 70px; }
.land-copy h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.05; letter-spacing: -.03em; margin: 0; }
.land-sub { font-size: 18px; line-height: 1.6; color: var(--muted); margin: 18px 0 0; max-width: 520px; }
.land-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.land-note { font-size: 13px; color: var(--muted); margin-top: 14px; }
.land-mock { display: flex; flex-direction: column; gap: 14px; }
.mock-card { background: linear-gradient(135deg, #3b35b5 0%, #5a55d6 55%, #8c90f2 100%); color: #fff; border-radius: 28px; padding: 26px; box-shadow: 0 24px 50px rgba(59, 53, 181, .28); }
.mock-label { opacity: .85; letter-spacing: .06em; font-size: 14px; }
.mock-amt { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -.03em; margin: 6px 0; white-space: nowrap; }
.mock-delta { font-size: 14px; } .mock-delta b { background: var(--accent); color: var(--navy); border-radius: 999px; padding: 2px 9px; font-size: 12px; margin-right: 6px; }
.mock-spark { width: 100%; height: 70px; margin-top: 14px; display: block; }
.mock-bud { background: var(--surface); border-radius: 24px; padding: 18px 20px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.mock-row { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; margin-top: 4px; } .mock-row span:last-child { color: var(--muted); }
.land-sec { max-width: 1100px; margin: 0 auto; padding: 30px 20px 50px; }
.land-sec h2, .land-final h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.02em; margin: 0 0 24px; text-align: center; }
.feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat { background: var(--surface); border-radius: 24px; padding: 24px; box-shadow: var(--shadow); }
.feat-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--soft); font-size: 22px; }
.feat h3 { margin: 14px 0 6px; font-size: 18px; } .feat p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 15px; }
.steps { list-style: none; margin: 0 auto; padding: 0; max-width: 620px; display: grid; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 20px; padding: 16px 20px; box-shadow: var(--shadow); font-weight: 600; }
.step-n { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.land-final { text-align: center; padding: 30px 20px 70px; }
.land-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; padding: 24px 20px 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.land-foot a { color: inherit; }
@media (max-width: 860px) {
  .land-hero { grid-template-columns: 1fr; padding-top: 20px; }
  .feats { grid-template-columns: 1fr; }
  .land-nav-r .btn.secondary { display: none; }
}

/* compact wallet cards with a ⋯ menu */
.wallets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.wallet { background: var(--soft); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wtop { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.wtitle { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wallet .wname { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }
.wallet .kind { color: var(--muted); font-size: 12px; }
.wallet .bal { font-size: 20px; letter-spacing: -.02em; margin-top: 8px; }
.wallet small { font-size: 12px; }
.menu-wrap { position: relative; flex: none; margin: -4px -6px 0 0; }
.dots { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; display: grid; place-items: center; padding: 0 0 4px; }
.dots:hover, .dots[aria-expanded="true"] { background: var(--surface); color: var(--ink); }
.menu { position: absolute; right: 0; top: 34px; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 30px rgba(30, 27, 75, .18); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.menu button { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 10px; font-weight: 600; color: var(--ink); }
.menu button:hover { background: var(--soft); }
.menu button.warn { color: var(--bad); }

/* landing demo video */
.land-demo { padding-top: 10px; }
.land-demo-sub { text-align: center; color: var(--muted); margin: -10px auto 22px; max-width: 560px; font-size: 16px; line-height: 1.55; }
.demo-frame { max-width: 960px; margin: 0 auto; border-radius: 24px; overflow: hidden; background: #0f0e24; box-shadow: 0 24px 60px rgba(59, 53, 181, .22); border: 1px solid var(--line); }
.demo-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #0f0e24; }

/* the four hero buttons share one row; they shrink to fit, and drop their icons / go 2x2 only when the card is very narrow */
.hero-actions .ghost { justify-content: center; height: 44px; padding: 0 8px; font-size: 14px; white-space: nowrap; min-width: 0; gap: 6px; }
.hero-actions .ghost svg { width: 16px; height: 16px; flex: none; }
@container (max-width: 520px) { .hero-actions .ghost svg { display: none; } .hero-actions .ghost { font-size: 13px; } }
@container (max-width: 340px) { .hero-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ov-buds { margin-top: 14px; }

dialog { background: var(--surface); }

/* ---------- dark theme ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0d22; --surface: #1a1840; --ink: #ecebff; --muted: #a3a7cf; --line: #2b2961; --soft: #232158;
  --brand: #8a85ff; --brand-2: #a9a6ff; --navy: #5b55e0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .35);
  --mix: #1a1840;
}
:root[data-theme="dark"] .btn:hover { background: #6d68ee; }
:root[data-theme="dark"] .nav a.active { box-shadow: 0 8px 18px rgba(0, 0, 0, .4); }
:root[data-theme="dark"] .badge { background: rgba(138, 133, 255, .2); color: #b9b6ff; }
:root[data-theme="dark"] .badge.ai, :root[data-theme="dark"] .badge.warning { background: rgba(255, 216, 77, .16); color: #ffd84d; }
:root[data-theme="dark"] .badge.ok { background: rgba(31, 169, 113, .2); color: #4fd9a0; }
:root[data-theme="dark"] .badge.exceeded { background: rgba(229, 72, 77, .2); color: #ff8a8f; }
:root[data-theme="dark"] .btn.danger { background: rgba(229, 72, 77, .18); color: #ff8a8f; }
:root[data-theme="dark"] .menu button.warn { color: #ff8a8f; }
:root[data-theme="dark"] .filters input:focus, :root[data-theme="dark"] .field input:focus, :root[data-theme="dark"] .field select:focus { background: var(--surface); }
:root[data-theme="dark"] .results, :root[data-theme="dark"] .bk-item .bar { background: var(--surface); }
:root[data-theme="dark"] .hint { background: rgba(255, 216, 77, .12); color: #f0dd9a; }
:root[data-theme="dark"] .auth-err { color: #ffb4ae; background: rgba(229, 72, 77, .18); }
:root[data-theme="dark"] .switch input { background: #3b3979; }
:root[data-theme="dark"] .switch input:checked { background: var(--navy); }
:root[data-theme="dark"] .onboard { background: linear-gradient(160deg, #1f1c5c, #14133a 60%, #0e0d22); }
:root[data-theme="dark"] .demo-bar { background: rgba(255, 216, 77, .12); color: #f0dd9a; border-color: rgba(255, 216, 77, .3); }
:root[data-theme="dark"] .bar i { background: var(--brand); }
:root[data-theme="dark"] .bar i.warning { background: var(--warn); }
:root[data-theme="dark"] .bar i.exceeded { background: var(--bad); }
:root[data-theme="dark"] .tbl .up { color: #4fd9a0; }
:root[data-theme="dark"] .amt.income { color: #4fd9a0; }
:root[data-theme="dark"] .legal-links a, :root[data-theme="dark"] .land-foot a { color: inherit; }
:root[data-theme="dark"] .land-hero .btn.secondary, :root[data-theme="dark"] .land-nav .btn.secondary { background: var(--soft); color: var(--ink); }
:root[data-theme="dark"] .demo-frame { border-color: var(--line); }
.theme-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; display: grid; place-items: center; padding: 0; }
