/* Finance OS — interface
   Vanilla CSS, one file, no build step. Dark is the base: money apps get used
   at night, in bed, on the last day of the month. Light is the override.

   Every number in this UI is tabular. Columns of figures that shift sideways
   while you read them are the fastest way to look untrustworthy. */

/* ------------------------------------------------------------ tokens */

:root {
  --bg: #12100e;
  --bg-2: #17140f;
  --surface: #1b1815;
  --surface-2: #221e19;
  --surface-3: #2a251e;
  --text: #f4efe6;
  --text-2: #b6ada0;
  --text-3: #857c6e;
  --border: rgba(255, 255, 255, .07);
  --border-2: rgba(255, 255, 255, .13);

  --accent: #b3893f;
  --accent-2: #d4a95a;
  --accent-ink: #17130c;

  --pos: #5aa87a;
  --pos-soft: rgba(90, 168, 122, .14);
  --neg: #cf6a58;
  --neg-soft: rgba(207, 106, 88, .14);
  --warn: #d1a03c;
  --warn-soft: rgba(209, 160, 60, .14);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 70px -40px rgba(0, 0, 0, .95);

  --sidebar-w: 246px;
  --dur: 180ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html.theme-light {
  --bg: #faf8f4;
  --bg-2: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --surface-3: #f1ede4;
  --text: #17140f;
  --text-2: #5d564b;
  --text-3: #8b8375;
  --border: rgba(23, 20, 15, .1);
  --border-2: rgba(23, 20, 15, .18);
  --accent: #8a6420;
  --accent-2: #a97c2a;
  --accent-ink: #fffdf7;
  --pos: #2f7a4f;
  --pos-soft: rgba(47, 122, 79, .1);
  --neg: #a84532;
  --neg-soft: rgba(168, 69, 50, .1);
  --warn: #8a6415;
  --warn-soft: rgba(138, 100, 21, .1);
  --shadow: 0 10px 30px -22px rgba(40, 30, 10, .35);
  --shadow-lg: 0 30px 70px -40px rgba(40, 30, 10, .4);
}

/* ------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
svg { display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; z-index: 999; font-weight: 600;
}
.skip:focus { left: 12px; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* Inline icons have no intrinsic size. Without this, a bare <svg> in a flex
   row stretches to the container and wrecks the layout. */
.ico { width: 16px; height: 16px; flex: 0 0 auto; }
.pill .ico { width: 12px; height: 12px; }
.hero-label .ico { width: 13px; height: 13px; }
.modal svg.ico { width: 16px; height: 16px; }

/* ------------------------------------------------------------ numerals */

/* Any figure that can change in place gets this class. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  letter-spacing: -.01em;
}
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------ shell */

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.brand-sub {
  font-size: 9.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .12em; font-weight: 600;
}

/* Brass tile, ledger notch. Deliberately not the Second Brain mark. */
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  flex: 0 0 auto; display: grid; place-items: center;
  background: linear-gradient(160deg, #d8b169 0%, #b3893f 46%, #7d5a20 100%);
  color: #17130c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 16px -10px rgba(0, 0, 0, .9);
}
.brand-mark svg { width: 17px; height: 17px; }

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-3); font-weight: 650;
  padding: 16px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 500; text-align: left;
  width: 100%;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item[aria-current="page"] {
  background: var(--surface); color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 650;
  color: var(--text-3); font-variant-numeric: tabular-nums;
}
.nav-item[aria-current="page"] .count { color: var(--accent-2); }

.sidebar-foot { margin-top: auto; padding-top: 16px; }
.money-mini {
  padding: 10px 11px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.money-mini-l { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 650; }
.money-mini-v { font-size: 15px; font-weight: 650; margin-top: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  display: none;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  place-items: center;
}
.topbar-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar-title b { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.topbar-sub { font-size: 11.5px; color: var(--text-3); }
.topbar-spacer { flex: 1 1 auto; }

.content {
  padding: 26px 24px 80px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ------------------------------------------------------------ typography */

.page-title {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.05;
  letter-spacing: -.035em;
  font-weight: 650;
}
.page-sub { color: var(--text-2); margin-top: 6px; font-size: 13px; }

.section { margin-top: 30px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-3); font-weight: 700; white-space: nowrap;
}
.section-line { flex: 1 1 auto; height: 1px; background: var(--border); }
.section-act { font-size: 12px; color: var(--text-2); }

/* ------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 16px; }

/* Hero: the one number the product exists to answer. */
.hero {
  position: relative;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-2);
  background:
    radial-gradient(120% 130% at 88% -10%, rgba(179, 137, 63, .16), transparent 62%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  overflow: hidden;
}
.hero-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-3); font-weight: 700;
}
.hero-amt {
  font-size: clamp(38px, 6.4vw, 64px);
  line-height: 1;
  letter-spacing: -.045em;
  font-weight: 650;
  margin: 10px 0 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.hero-amt.neg { color: var(--neg); }
.hero-formula {
  margin-top: 10px; font-size: 12px; color: var(--text-2);
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
}
.hero-formula .sep { color: var(--text-3); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-top: 12px;
}
.stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.stat-l {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); font-weight: 700;
}
.stat-v {
  font-size: 20px; font-weight: 650; letter-spacing: -.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-d { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------------------------------------ rows */

.list { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row-btn {
  text-align: left; width: 100%; border: 0; background: none;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
  color: inherit;
}
.row-btn:hover { background: var(--surface-2); }
.row-btn:last-child { border-bottom: 0; }

.row-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.row-ico svg { width: 15px; height: 15px; }
.row-main { min-width: 0; }
.row-t {
  font-size: 13.5px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-s {
  font-size: 11.5px; color: var(--text-3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-amt {
  font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 16px 14px 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); font-weight: 700;
}
.day-head .day-sum { margin-left: auto; font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; font-weight: 600; }

/* ------------------------------------------------------------ bars */

.bar {
  height: 6px; border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width 320ms var(--ease-out);
}
.bar.pos > i { background: var(--pos); }
.bar.neg > i { background: var(--neg); }
.bar.warn > i { background: var(--warn); }

.budget-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.budget-row:last-child { border-bottom: 0; }
.budget-top { display: flex; align-items: baseline; gap: 8px; }
.budget-name { font-size: 13.5px; font-weight: 550; }
.budget-nums { margin-left: auto; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.budget-nums b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------ pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill-accent { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-neg { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.pill-pos { background: var(--pos-soft); color: var(--pos); border-color: transparent; }

/* ------------------------------------------------------------ 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(--border-2);
  background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 550;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); font-weight: 650;
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--neg-soft); border-color: transparent; color: var(--neg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 36px; padding: 0; }

/* ------------------------------------------------------------ forms */

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-3); font-weight: 650;
}
.input, .select, .textarea {
  height: 38px; padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  width: 100%;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 74px; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input.grouped { text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help { font-size: 11.5px; color: var(--text-3); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span {
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  position: relative; transition: background var(--dur) var(--ease);
}
.switch span::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-2); transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }

/* ------------------------------------------------------------ empty */

.empty {
  padding: 40px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-ico {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
}
.empty-ico svg { width: 20px; height: 20px; }
.empty-t { font-weight: 600; font-size: 14px; }
.empty-d { color: var(--text-3); font-size: 12.5px; max-width: 42ch; }

/* ------------------------------------------------------------ modal */

.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(10, 8, 6, .58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 140ms var(--ease) both;
}
.modal {
  width: 100%; max-width: 520px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms var(--ease-out) both;
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.modal-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text-3);
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 18px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
}
.modal-foot .grow { flex: 1 1 auto; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.99); }
}

/* ------------------------------------------------------------ toast */

#toast-root {
  position: fixed; left: 50%; bottom: 22px; z-index: 200;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 14px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--text); font-size: 12.5px; font-weight: 550;
  box-shadow: var(--shadow);
  animation: toast-in 220ms var(--ease-out) both;
  max-width: min(92vw, 520px);
}
.toast.ok { border-color: color-mix(in srgb, var(--pos) 40%, transparent); }
.toast.err { border-color: color-mix(in srgb, var(--neg) 45%, transparent); }
.toast.out { animation: toast-out 180ms var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------ charts */

.spark { width: 100%; height: 60px; display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: url(#sparkFill); opacity: .18; }

.chart-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-3);
}

/* ------------------------------------------------------------ pro */

.nav-pro {
  margin-left: auto;
  font-size: 8.5px; font-weight: 750; letter-spacing: .09em;
  padding: 2px 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
}
.nav-item[aria-current="page"] .nav-pro { background: var(--accent-2); }

.pro-lock {
  max-width: 640px; margin: 26px auto 0;
  padding: 34px 28px; text-align: center;
}
.pro-lock-ico {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--accent-2);
}
.pro-lock-ico svg { width: 24px; height: 24px; }
.pro-lock-t { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.pro-lock-list {
  display: flex; flex-direction: column; gap: 8px;
  max-width: 400px; margin: 20px auto 22px; text-align: left;
}
.pro-lock-item { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.pro-lock-item svg { width: 15px; height: 15px; color: var(--pos); flex: 0 0 auto; margin-top: 1px; }
.pro-lock-foot { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.pro-chart { width: 100%; height: 190px; display: block; overflow: visible; }
.fc-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 6; }
.fc-label { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.fc-floor { stroke: var(--neg); stroke-width: 1.2; stroke-dasharray: 5 5; opacity: .85; }
.fc-line { fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.fc-low { fill: var(--neg); stroke: var(--bg); stroke-width: 2; }
.pro-chart + .chart-legend span { display: inline-flex; align-items: center; }
.legend-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 2px;
  margin-right: 5px; background: var(--accent-2);
}
.legend-dot.floor { background: var(--neg); }

.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px;
}
.seg-btn {
  border: 0; background: transparent; color: var(--text-2);
  padding: 8px 10px; border-radius: 6px;
  display: flex; flex-direction: column; gap: 2px; text-align: left;
}
.seg-btn b { font-size: 13px; color: var(--text); }
.seg-btn span { font-size: 10.5px; color: var(--text-3); }
.seg-btn.on { background: var(--surface); box-shadow: var(--shadow-sm); }
.seg-btn.on b { color: var(--accent-2); }

.cmp-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.cmp-row:last-of-type { border-bottom: 0; }
.cmp-row b { color: var(--text); }

.rank {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--accent-2);
}

/* ------------------------------------------------------------ grids */

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split-7-5 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }

/* ------------------------------------------------------------ onboarding */

.onb {
  position: fixed; inset: 0; z-index: 140;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.onb-panel {
  width: 100%; max-width: 820px;
  margin: auto;
  display: flex; flex-direction: column;
  min-height: min(660px, calc(100dvh - 48px));
}
.onb-top { display: flex; align-items: center; gap: 10px; margin-bottom: clamp(26px, 6vh, 56px); }
.onb-brand { display: flex; align-items: center; gap: 10px; }
.onb-mark { width: 32px; height: 32px; border-radius: 9px; }
.onb-mark svg { width: 18px; height: 18px; }

.onb-body {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
  overflow-x: hidden;
}
.onb-eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 14px;
}
.onb-huge {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.02;
  letter-spacing: -.045em;
  font-weight: 650;
  max-width: 20ch;
  text-wrap: balance;
}
.onb-huge em { font-style: normal; color: var(--accent-2); }
.onb-lede {
  margin-top: 16px;
  font-size: clamp(13.5px, 1.4vw, 15.5px);
  color: var(--text-2);
  max-width: 56ch;
  line-height: 1.6;
}

.onb-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; max-width: 720px; }
.onb-choice {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.onb-choice:hover { background: var(--surface-2); }
.onb-choice[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--surface-2);
}
.onb-choice-t { font-size: 14px; font-weight: 600; }
.onb-choice-d { font-size: 12px; color: var(--text-2); line-height: 1.55; }

.onb-foot {
  display: flex; align-items: center; gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 28px;
}
.onb-rail { display: flex; gap: 6px; align-items: center; }
.onb-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--surface-3);
  transition: width var(--dur) var(--ease), background var(--dur) var(--ease);
}
.onb-dot.on { width: 20px; background: var(--accent); }
.onb-foot > div:last-child { margin-left: auto; }

@media (max-width: 640px) {
  .onb { padding: 18px 16px; }
  .onb-panel { min-height: calc(100dvh - 36px); }
  .onb-choices { grid-template-columns: 1fr; }
  .onb-huge { font-size: clamp(28px, 9vw, 40px); }
  .pro-lock { padding: 26px 18px; margin-top: 12px; }
  .pro-lock-t { font-size: 19px; }
  .pro-chart { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ mobile */

.bottom-nav { display: none; }


@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-7-5 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 60;
    width: min(280px, 84vw);
    transform: translateX(-102%);
    transition: transform 260ms var(--ease-out);
    box-shadow: var(--shadow-lg);
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  #app[data-sidebar="open"] .sidebar { transform: translateX(0); }
  #app[data-sidebar="open"]::after {
    content: ''; position: fixed; inset: 0; z-index: 55;
    background: rgba(8, 6, 4, .5);
    backdrop-filter: blur(2px);
  }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .content { padding: 20px 14px calc(96px + env(safe-area-inset-bottom)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg-2) 94%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 8px;
    border: 0; background: none; color: var(--text-3);
    font-size: 10px; font-weight: 600;
  }
  .bn-item svg { width: 19px; height: 19px; }
  .bn-item[aria-current="page"] { color: var(--accent-2); }
  .hero-amt { font-size: clamp(34px, 10vw, 46px); }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .budget-row { grid-template-columns: minmax(0, 1fr); }
  .hero-formula { font-size: 11.5px; }
  .stat-v { font-size: 17px; }
  .content { padding-left: 12px; padding-right: 12px; }
}

@media (hover: none) {
  .row-btn:hover { background: none; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .btn { display: none !important; }
  #app { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}
