/*
   WEALTH — PREMIUM DESIGN SYSTEM v4
   Inspired by Financial Times · Bloomberg · Google Workspace
   Warm light base · Ink typography · Restrained gold accent
   Pure CSS · Zero dependencies
═══════════════════════════════════════════════════════ */

/* ── GOOGLE FONTS (self-contained request, no CDN tracking) */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;1,400&family=Inter:wght@300;400;500;600&display=swap');

/* ── DESIGN TOKENS — COOL NEUTRAL BASE (no brown anywhere) ───────── */
:root {
  /* Surface — cool ice-paper, NOT warm beige */
  --surface-0:   #eef2f7;   /* page background (cool) */
  --surface-1:   #ffffff;   /* card / panel */
  --surface-2:   #f3f5f9;   /* subtle inset (cool grey) */
  --surface-3:   #e8ecf2;   /* hover / active bg */
  --surface-4:   #d6dbe4;   /* divider fill */

  /* Ink — cool slate, NOT warm brown-charcoal */
  --ink-1:       #0c0f14;   /* primary text */
  --ink-2:       #3e434b;   /* secondary text */
  --ink-3:       #7b818c;   /* tertiary / placeholder */
  --ink-4:       #b1b5be;   /* disabled / subtle */

  /* Borders — cool ink-tint */
  --border:      rgba(12,15,20,.085);
  --border-md:   rgba(12,15,20,.16);
  --border-hi:   rgba(12,15,20,.26);

  /* Accent — claret */
  --accent:      #990f3d;
  --accent-dim:  rgba(153,15,61,.08);
  --accent-glow: rgba(153,15,61,.2);

  /* Gold — reserved for primary actions only */
  --gold:        #b8860b;
  --gold-dim:    rgba(184,134,11,.1);
  --gold-light:  #d4a843;

  /* Semantic */
  --green:       #1a7f37;
  --green-dim:   rgba(26,127,55,.1);
  --red:         #c0392b;
  --red-dim:     rgba(192,57,43,.1);
  --blue:        #0969da;
  --blue-dim:    rgba(9,105,218,.1);

  /* Layout */
  --sidebar-w:   256px;
  --radius:      10px;
  --radius-sm:   6px;
  --radius-xs:   4px;
  --radius-pill: 100px;

  /* Typography */
  --font-serif:  'Playfair Display', 'Georgia', 'Times New Roman', serif;
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Motion */
  --ease:        cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --ease-out:    cubic-bezier(0,0,.2,1);

  /* Shadows — cool ink-tinted (not warm) */
  --shadow-sm:   0 1px 3px rgba(12,15,20,.08), 0 1px 2px rgba(12,15,20,.06);
  --shadow-md:   0 4px 12px rgba(12,15,20,.1),  0 2px 4px rgba(12,15,20,.06);
  --shadow-lg:   0 12px 32px rgba(12,15,20,.12), 0 4px 8px rgba(12,15,20,.06);
  --shadow-xl:   0 24px 56px rgba(12,15,20,.14), 0 8px 16px rgba(12,15,20,.06);
}

/* ── RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-sans);
  background: var(--surface-0);
  color: var(--ink-1);
  min-height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}
input, select, button, textarea { font-family: inherit; }

/* ── FOCUS INDICATORS ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}
/* Explicit focus rings for components whose own styles set outline:none
   without providing a replacement focus indicator. Uses a high-specificity
   box-shadow so it survives later cascades. */
.env-action-btn:focus-visible,
.sub-action-btn:focus-visible,
.transfer-opt-btn:focus-visible,
.ghost-btn:focus-visible,
.export-btn:focus-visible,
.vault-btn:focus-visible,
.vault-btn-outline:focus-visible,
.vault-link:focus-visible,
.cal-nav-btn:focus-visible,
.cal-today-btn:focus-visible,
.bottom-nav-item:focus-visible,
.sidebar-item:focus-visible,
.sidebar-group-toggle:focus-visible,
.utility-drawer-toggle:focus-visible,
.command-palette-item:focus-visible,
.field-select:focus-visible,
.case-note:focus-visible,
.pillar-input:focus-visible,
.pillar-slider:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(184, 134, 11, .22);
}
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

/* ── SCREENS ─────────────────────────────────────────── */
.screen { display: none; width: 100vw; height: 100vh; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════════════════════
   ONBOARDING — FT editorial landing
═══════════════════════════════════════════════════════ */
#screen-onboarding {
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--surface-0);
}

/* Editorial paper field — ruled lines + warm wash + tactile grain + corner vignette */
.ob-bg {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(12,15,20,.04) 39px,
      rgba(12,15,20,.04) 40px
    );
}
/* Tactile paper grain (inline SVG noise, ~600 bytes) */
.ob-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  opacity: .035;
  mix-blend-mode: multiply;
  pointer-events: none;
}
/* Warm cream + burgundy atmosphere — gilded parchment, warm umber vignette (no cold ink) */
.ob-bg::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -5%,   rgba(245,227,168,.32) 0%, transparent 72%),
    radial-gradient(ellipse 50% 45% at 95% 100%,  rgba(153,15,61,.12)   0%, transparent 65%),
    radial-gradient(ellipse 45% 40% at 5% 100%,   rgba(184,134,11,.12)  0%, transparent 65%),
    radial-gradient(ellipse 70% 55% at 50% 50%,   rgba(248,236,196,.18) 0%, transparent 70%),
    radial-gradient(ellipse 140% 100% at 50% 50%, transparent 50%, rgba(91,60,16,.16) 100%);
  pointer-events: none;
}

/* ── Editorial spread (left text column + gutter + form panel) ──── */
.ob-spread {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 0;
  animation: fadeUp .6s var(--ease) both;
}
.ob-spread > .ob-wrap { margin: 0; max-width: 640px; width: 100%; justify-self: center; }

/* Editorial column — hidden by default, appears on wide enough viewports */
.ob-editorial {
  display: none;
  padding: 2.5rem 3rem;
  color: var(--ink-1);
  align-self: center;
}
.ob-edit-kicker {
  margin: 0 0 1.5rem;
  font-family: var(--font-sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: rgba(12,15,20,.5);
}
.ob-edit-headline {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -.018em;
  color: var(--ink-1);
  font-weight: 500;
}
.ob-edit-headline em { font-style: italic; color: var(--gold); }
.ob-edit-rule {
  display: block;
  width: 56px;
  height: 2px;
  margin: 1.5rem 0 1.4rem;
  background: linear-gradient(90deg, var(--gold) 0%, rgba(184,134,11,.15) 100%);
}
.ob-edit-body {
  margin: 0 0 1.6rem;
  max-width: 34ch;
  font-family: var(--font-serif);
  font-size: 1.03rem;
  line-height: 1.62;
  color: rgba(12,15,20,.78);
}
.ob-edit-quote {
  position: relative;
  margin: 0 0 1.6rem;
  padding: .25rem 0 .35rem 1.25rem;
  border-left: 2px solid var(--gold);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.45;
  color: rgba(12,15,20,.88);
  max-width: 32ch;
}
.ob-edit-quote-mark {
  position: absolute;
  left: -.1rem;
  top: -1.1rem;
  font-family: var(--font-serif);
  font-size: 3.4rem;
  line-height: 1;
  color: rgba(184,134,11,.35);
  pointer-events: none;
}
.ob-edit-byline {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: .82rem;
  color: rgba(12,15,20,.55);
  letter-spacing: .01em;
}

/* Hairline gold gutter between the two columns */
.ob-spread-gutter {
  display: none;
  align-self: stretch;
  width: 1px;
  margin: 4rem 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(184,134,11,.4) 20%,
    rgba(184,134,11,.4) 80%,
    transparent 100%
  );
}

/* Activate the spread layout on wide enough screens */
@media (min-width: 1100px) {
  .ob-spread {
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
    gap: 3rem;
    margin: 2.5rem;
  }
  .ob-editorial,
  .ob-spread-gutter { display: block; }
  .ob-spread > .ob-wrap { justify-self: start; max-width: 540px; }
}

/* Mid screens 820-1099: form still centered, editorial hidden, no gutter */
@media (max-width: 1099px) {
  .ob-spread { display: flex; justify-content: center; }
}

/* Mobile: panel goes near full-bleed, atmosphere remains (grain + warm wash) */
@media (max-width: 767px) {
  .ob-spread { margin: .75rem; }
  .ob-wrap   { margin: 0; padding: 2.25rem 1.5rem 2rem; border-radius: 22px; }
}

/* Dark theme: editorial column on midnight canvas */
[data-theme="dark"] .ob-edit-kicker { color: rgba(255,255,255,.5); }
[data-theme="dark"] .ob-edit-headline { color: rgba(255,255,255,.96); }
[data-theme="dark"] .ob-edit-headline em { color: var(--gold); }
[data-theme="dark"] .ob-edit-body { color: rgba(255,255,255,.7); }
[data-theme="dark"] .ob-edit-quote { color: rgba(255,255,255,.88); }
[data-theme="dark"] .ob-edit-byline { color: rgba(255,255,255,.5); }
[data-theme="dark"] .ob-spread-gutter {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(245,227,168,.3) 20%,
    rgba(245,227,168,.3) 80%,
    transparent 100%
  );
}

.ob-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  padding: 3rem 3rem 2.75rem;
  margin: 1.5rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(250,247,239,.92)),
    radial-gradient(circle at 100% 0%, rgba(184,134,11,.18), transparent 18rem);
  border: 1px solid rgba(184,134,11,.34);
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.6) inset,
    0 30px 80px -28px rgba(12,15,20,.32),
    0 18px 40px -22px rgba(184,134,11,.28);
  animation: fadeUp .6s var(--ease) both;
}
.ob-wrap::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(212,168,67,.55), rgba(184,134,11,.05) 45%, rgba(153,15,61,.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: .9;
}
.ob-wrap::after {
  content: '';
  position: absolute;
  inset: auto -16% -28% auto;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(212,168,67,.18), transparent 65%);
  pointer-events: none;
  filter: blur(8px);
}
.ob-wrap > * { position: relative; z-index: 1; }

/* DARK theme: onboarding gets a luminous white card on midnight canvas */
[data-theme="dark"] .ob-wrap {
  max-width: 640px;
  padding: 3rem 2.75rem;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06),
    0 36px 100px -30px rgba(0,0,0,.7),
    0 18px 40px rgba(0,0,0,.4);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
}

/* FT-style masthead rule */
.ob-rule {
  width: 48px;
  height: 3px;
  background: var(--accent);
  margin-bottom: 2rem;
}

.ob-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2.5rem;
}

.brand-mark {
  width: 42px; height: 42px;
  background: var(--ink-1);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--surface-1);
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.brand-mark--sm { width: 30px; height: 30px; font-size: .95rem; border-radius: 6px; }

/* SAVENTRA gold brand mark — minimalist geometric monogram. */
.brand-mark--lw {
  background: linear-gradient(135deg, #f5e3a8 0%, #d4a843 55%, #6d5008 100%);
  color: transparent;
  position: relative;
  box-shadow: 0 2px 6px rgba(184,134,11,.28);
}
.brand-mark--lw::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 3px;
  border: 1.5px solid rgba(0,0,0,.55);
  mix-blend-mode: multiply;
}
.brand-mark--sm.brand-mark--lw::after { inset: 24%; border-width: 1.25px; }

.brand-name {
  font-family: var(--font-sans);
  font-size: .98rem;
  color: var(--ink-1);
  letter-spacing: .28em;
  font-weight: 700;
  text-transform: uppercase;
}
.brand-name--sm { font-size: .78rem; letter-spacing: .26em; }

.ob-eyebrow {
  font-family: var(--font-sans);
  font-size: .76rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 .9rem;
}

/* ── Launch profile ─────────────────────────────────────────── */
.ob-profile-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,242,228,.85)),
    radial-gradient(circle at 95% 0%, rgba(212,168,67,.22), transparent 14rem);
  border: 1px solid transparent;
  border-radius: 22px;
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow:
    0 18px 40px -18px rgba(184,134,11,.30),
    0 8px 24px -14px rgba(12,15,20,.18),
    inset 0 1px 0 rgba(255,255,255,.85);
}
.ob-profile-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.2px;
  background: linear-gradient(140deg, rgba(212,168,67,.85), rgba(184,134,11,.15) 50%, rgba(30,58,95,.55));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.ob-profile-card::after {
  content: '';
  position: absolute;
  inset: auto -10% -20% -10%;
  height: 56%;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,168,67,.18), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}
.ob-profile-card > * { position: relative; z-index: 1; }
.ob-profile-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem;
  align-items: start;
}
.ob-profile-status {
  display: inline-flex;
  margin-bottom: .25rem;
  color: var(--green);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ob-profile-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink-1);
}
.ob-profile-desc {
  margin-top: .38rem;
  color: var(--ink-2);
  font-size: .82rem;
  line-height: 1.55;
}
.ob-profile-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .85rem;
}
.ob-profile-pills span {
  padding: .32rem .55rem;
  border: 1px solid rgba(12,15,20,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  color: var(--ink-2);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.ob-template-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, #fff3c8 0%, #f5e3a8 35%, #d4a843 70%, #8a6408 100%);
  color: #0c0f14;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 6px 14px -8px rgba(184,134,11,.55);
}
.ob-template-icon svg { width: 22px; height: 22px; }

/* Persona selector (onboarding) */
.ob-help {
  margin: -.3rem 0 .7rem;
  font-size: .76rem;
  color: var(--ink-2);
}
.ob-help--soon {
  margin: .7rem 0 0;
  font-size: .72rem;
  font-style: italic;
  opacity: .8;
}
.ob-persona-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}
.ob-persona {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
  text-align: left;
  padding: .85rem .9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(12,15,20,.10);
  background: rgba(255,255,255,.66);
  cursor: pointer;
  font: inherit;
  color: var(--ink-1);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.ob-persona:hover {
  transform: translateY(-2px);
  border-color: rgba(184,134,11,.45);
  box-shadow: 0 14px 30px -18px rgba(184,134,11,.4);
}
.ob-persona.selected {
  border-color: rgba(184,134,11,.9);
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(248,242,228,.9));
  box-shadow: 0 16px 36px -18px rgba(184,134,11,.5), inset 0 1px 0 rgba(255,255,255,.85);
}
.ob-persona-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fff3c8 0%, #f5e3a8 35%, #d4a843 70%, #8a6408 100%);
  color: #0c0f14;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 14px -8px rgba(184,134,11,.55);
}
.ob-persona-icon svg { width: 19px; height: 19px; }
.ob-persona-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink-1);
}
.ob-persona-desc {
  font-size: .74rem;
  line-height: 1.4;
  color: var(--ink-2);
}
.ob-persona-check {
  position: absolute;
  top: .6rem; right: .6rem;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold, #b8860b);
  color: #fff;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .18s ease, transform .18s ease;
}
.ob-persona-check svg { width: 12px; height: 12px; }
.ob-persona.selected .ob-persona-check { opacity: 1; transform: scale(1); }

/* Live plan preview */
.ob-plan-preview {
  border: 1px solid rgba(12,15,20,.10);
  border-radius: 16px;
  padding: .85rem .95rem;
  background: rgba(255,255,255,.55);
}
.ob-plan-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: .6rem;
}
.ob-plan-title {
  font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2);
}
.ob-plan-count { font-size: .72rem; font-weight: 700; color: var(--gold, #b8860b); }
.ob-plan-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: rgba(12,15,20,.06);
}
.ob-plan-seg { display: block; min-width: 2px; }
.ob-plan-legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin-top: .6rem; }
.ob-plan-leg { display: inline-flex; align-items: center; gap: .35rem; font-size: .7rem; font-weight: 600; color: var(--ink-2); }
.ob-plan-dot { width: 9px; height: 9px; border-radius: 50%; }
.ob-plan-runway { margin-top: .7rem; font-size: .78rem; color: var(--ink-1); }
.ob-plan-runway strong { font-weight: 700; }

@media (max-width: 560px) {
  .ob-persona-grid { grid-template-columns: 1fr; }
}

/* Install / download chip */
.ob-install {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(184,134,11,.35);
}
.ob-install[hidden] { display: none; }
.ob-install-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(184,134,11,.4);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,242,228,.85));
  color: var(--ink-1);
  font: 700 .8rem/1 var(--font-sans);
  letter-spacing: .03em;
  cursor: pointer;
  transition: transform .15s var(--ease-out), border-color .15s, box-shadow .15s;
  box-shadow: 0 6px 18px -10px rgba(184,134,11,.4);
}
.ob-install-btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow: 0 10px 24px -10px rgba(184,134,11,.55);
}
.ob-install-btn svg { width: 14px; height: 14px; }
.ob-install-hint {
  font-size: .7rem;
  color: var(--ink-3);
  letter-spacing: .04em;
}

.ob-privacy-line {
  margin: .9rem 0 0;
  font-size: .78rem;
  color: var(--ink-3);
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
}
@media (max-width: 460px) {
  .ob-profile-head { grid-template-columns: 1fr; }
}

.ob-headline {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.18;
  color: var(--ink-1);
  margin-bottom: 1rem;
  letter-spacing: -.02em;
}
.ob-headline em { font-style: italic; color: var(--accent); }

.ob-body {
  font-size: .95rem;
  color: var(--ink-2);
  line-height: 1.8;
  margin-bottom: 2.5rem;
  border-left: 2px solid var(--border-md);
  padding-left: 1rem;
}

.ob-form { display: flex; flex-direction: column; }
.ob-field { margin-bottom: 1.25rem; }
.ob-label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .5rem;
}
.ob-opt { font-weight: 400; text-transform: none; letter-spacing: 0; }

.ob-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.ob-input-wrap:focus-within {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px rgba(12,15,20,.08);
}
.ob-sym {
  padding: 0 .75rem;
  color: var(--ink-3);
  font-size: .9rem;
  user-select: none;
  font-weight: 500;
}
.ob-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: .875rem .75rem .875rem 0;
  font-size: .95rem;
  color: var(--ink-1);
}
.ob-input--full {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .95rem;
  color: var(--ink-1);
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.ob-input--full:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px rgba(12,15,20,.08);
}
.ob-input::placeholder, .ob-input--full::placeholder { color: var(--ink-4); }

/* .ob-btn base — full styling lives in the primary button block below */
.ob-btn { margin-top: .5rem; }
.ob-btn--accent { /* legacy modifier — kept for compat, no override */ }

/* ═══════════════════════════════════════════════════════
   AUTH SCREENS (Signup / Login) — Phase A. Reuse the onboarding
   card + form primitives; add the logo-left / switch-right top bar.
═══════════════════════════════════════════════════════ */
/* Scroll fix: the onboarding & auth screens must scroll when taller than the
   viewport (the app shell #screen-app intentionally stays fixed). */
#screen-onboarding, .au-screen { overflow-y: auto; }
.au-screen.active { flex-direction: column; align-items: stretch; }

.au-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem 2.6rem; position: relative; z-index: 2; flex: none;
}
.au-top .ob-brand { margin-bottom: 0; }
.au-switch { display: flex; align-items: center; gap: .8rem; font-size: .85rem; color: var(--ink-3); }
.au-switch-btn {
  font-family: var(--font-sans); font-size: .82rem; font-weight: 600; color: var(--ink-1);
  background: var(--surface-1); border: 1px solid var(--border-md); border-radius: var(--radius-pill);
  padding: .5rem 1.15rem; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .2s var(--ease);
}
.au-switch-btn:hover { border-color: var(--gold); }

.au-center { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; padding: 1rem 1rem 3rem; }
.au-card { max-width: 432px; margin: 0; }
.au-input { padding-left: .95rem !important; }
.au-row { display: flex; justify-content: space-between; align-items: baseline; }
.au-forgot { font-size: .78rem; color: var(--accent); }
.au-forgot:hover { text-decoration: underline; }
.au-peek { background: none; border: none; cursor: pointer; color: var(--ink-4); padding: 0 .9rem 0 .3rem; display: inline-flex; }
.au-peek:hover { color: var(--ink-2); }
.au-peek svg { width: 18px; height: 18px; stroke-width: 1.7; }
.au-hint { margin: .45rem .2rem 0; font-size: .76rem; color: var(--ink-4); }
.au-error { margin: .2rem 0 .2rem; font-size: .82rem; color: var(--red); }
.au-code { letter-spacing: .3em; text-align: center; font-size: 1.05rem; font-weight: 600; }
.au-resend { margin: .9rem 0 0; font-size: .82rem; color: var(--ink-3); text-align: center; }
.au-spam-note {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: 0 0 1.1rem;
  padding: .7rem .85rem;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--gold-dim, rgba(184,134,11,.12));
  border: 1px solid rgba(184,134,11,.32);
  border-radius: 12px;
}
.au-spam-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: .12rem; color: var(--gold, #b8860b); }
.au-spam-note strong { color: var(--ink-1); font-weight: 600; }
.au-privacy {
  white-space: normal !important; text-align: left !important;
  display: flex; gap: .5rem; align-items: flex-start;
  margin-top: 1.4rem !important; padding-top: 1rem; border-top: 1px solid var(--border); line-height: 1.5;
}
.au-privacy svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--gold); stroke-width: 1.7; }

@media (max-width: 600px) { .au-top { padding: 1.1rem 1.4rem; } }

/* ═══════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════ */
#screen-app { flex-direction: row; overflow: hidden; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.sb-top {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 0;
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: .75rem .75rem;
}

.sb-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: .875rem .5rem .35rem;
  margin-top: .25rem;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .575rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 400;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
  position: relative;
  border: 1px solid transparent;
}
.sb-item:hover { background: var(--surface-2); color: var(--ink-1); }
.sb-item.active {
  background: var(--surface-2);
  color: var(--ink-1);
  font-weight: 500;
  border-color: var(--border);
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: -1px; top: 25%; bottom: 25%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.sb-icon {
  width: 15px; height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  opacity: .8;
}

.sb-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sb-income-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  margin-bottom: .75rem;
  position: relative;
  overflow: hidden;
}
.sb-income-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
}
.sb-income-label {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  margin-bottom: .3rem;
  font-weight: 600;
}
.sb-income-val {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--ink-1);
  font-weight: 500;
}

.sb-reset {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: .5rem;
  font-size: .75rem;
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  font-weight: 500;
  letter-spacing: .02em;
}
.sb-reset:hover { border-color: var(--red); color: var(--red); }

/* ── MAIN CONTENT ────────────────────────────────────── */
.main-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 0;
  background: var(--surface-0);
}

/* ── TOP BAR ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; flex-direction: column; gap: .1rem; }
.topbar-eyebrow {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--ink-1);
  letter-spacing: -.01em;
}
.topbar-right { display: flex; align-items: center; gap: .6rem; }

/* ── CONTENT AREA ────────────────────────────────────── */
.content-area { padding: 2rem 2.5rem 4rem; }

/* ── VIEWS ───────────────────────────────────────────── */
.view { display: none; animation: fadeUp .3s var(--ease) both; }
.view.active { display: block; }

.view-intro {
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.85;
  max-width: 680px;
  margin-bottom: 2rem;
  border-left: 2px solid var(--border-md);
  padding-left: 1rem;
}
.view-intro em { color: var(--ink-1); font-style: normal; font-weight: 500; }

/* ── KPI ROW ─────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 2rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi {
  background: var(--surface-1);
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  transition: background .15s;
}
.kpi:hover { background: var(--surface-2); }
.kpi-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  font-weight: 600;
}
.kpi-val {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--ink-1);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -.02em;
}
.kpi-sub { font-size: .73rem; color: var(--ink-3); margin-top: .1rem; }
.kpi--income .kpi-val { color: var(--ink-1); }
.kpi--alloc  .kpi-val { color: var(--blue); }
.kpi--spent  .kpi-val { color: var(--red); }
.kpi--free   .kpi-val { color: var(--green); }
.kpi--runway .kpi-val { color: var(--gold); }

/* ── SECTION HEADER ──────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink-1);
  letter-spacing: -.01em;
}
.section-meta { font-size: .78rem; color: var(--ink-3); }

/* ── CARD ────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card--pad { padding: 1.5rem; }
.card--accent { border-left: 3px solid var(--accent); }
.card--gold { border-left: 3px solid var(--gold); }
.card--green { border-left: 3px solid var(--green); }

/* ── DASHBOARD GRID ──────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tile-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1.25rem;
}

/* AI insight */
.ai-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.ai-pulse {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
}
.ai-text { font-size: .88rem; color: var(--ink-2); line-height: 1.8; }

/* Insight Engine 2.0 — deterministic, action-oriented insight cell */
.bento-card--insight {
  position: relative;
  overflow: hidden;
}
.bento-card--insight::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--green);
}
.bento-card--insight[data-insight-severity="watch"]::before {
  background: var(--gold);
}
.bento-card--insight[data-insight-severity="critical"]::before {
  background: var(--accent);
}
.bento-card--insight[data-insight-severity="critical"] .ai-pulse {
  background: var(--accent);
}
.bento-card--insight[data-insight-severity="watch"] .ai-pulse {
  background: var(--gold);
}
.bento-card--insight[data-insight-severity="calm"] .ai-pulse {
  background: var(--green);
}
.insight-cycle {
  margin-left: auto;
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s var(--ease-out);
}
.insight-cycle:hover { color: var(--ink-1); border-color: var(--border-md); transform: rotate(-30deg); }
.insight-cycle svg { width: 14px; height: 14px; }
.insight-headline {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.4;
  color: var(--ink-1);
  margin: 0 0 .55rem;
  letter-spacing: -.005em;
}
.insight-headline em {
  font-style: normal;
  font-weight: 600;
  background: linear-gradient(95deg, var(--gold) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.insight-action-wrap {
  margin-top: .9rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.insight-apply {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--border-md);
  background: var(--surface-1);
  color: var(--ink-1);
  font: 700 .76rem/1 var(--font-sans);
  letter-spacing: .03em;
  cursor: pointer;
  transition: transform .15s var(--ease-out), border-color .15s, box-shadow .15s;
}
.insight-apply:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow: 0 4px 14px -6px rgba(184,134,11,.4);
}
.insight-apply svg { width: 12px; height: 12px; }
.insight-snooze {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font: 700 .7rem/1 var(--font-sans);
  letter-spacing: .04em;
  cursor: pointer;
  padding: .45rem .2rem;
}
.insight-snooze:hover {
  color: var(--ink-1);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Monthly Review modal ───────────────────────────────────────── */
.review-card {
  background: var(--surface-1);
  border-radius: 22px;
  border: 1px solid var(--border-md);
  box-shadow: var(--shadow-xl);
  padding: 1.5rem 1.6rem 1.3rem;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: auto;
  position: relative;
  animation: modalFadeIn .25s var(--ease-out);
}
.review-kicker {
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
  margin-bottom: .4rem;
}
.review-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.55rem;
  color: var(--ink-1);
  margin: 0 0 1.2rem;
  letter-spacing: -.01em;
}
.review-stage { position: relative; min-height: 220px; }
.review-step { display: none; animation: revStepIn .35s var(--ease-out); }
.review-stage[data-step="0"] .review-step[data-step="0"],
.review-stage[data-step="1"] .review-step[data-step="1"],
.review-stage[data-step="2"] .review-step[data-step="2"] { display: block; }
@keyframes revStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.review-step-label {
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--gold);
  margin: 0 0 .9rem;
}
.review-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .8rem;
  margin-bottom: 1rem;
}
.review-stat {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .8rem .85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  min-width: 0;
}
.review-stat-label {
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
}
.review-stat-value {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.review-stat-delta {
  font-size: .74rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.review-stat-delta.up   { color: var(--green); }
.review-stat-delta.down { color: var(--red); }
.review-narrative {
  font-size: .92rem;
  color: var(--ink-2);
  line-height: 1.6;
  margin: .4rem 0 0;
}
.review-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.review-list li {
  padding: .75rem .85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: .9rem;
  color: var(--ink-1);
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  line-height: 1.5;
}
.review-list li::before {
  content: "";
  flex-shrink: 0;
  margin-top: .4rem;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--gold);
}
.review-list li.watch::before { background: var(--red); }
.review-list.empty li {
  background: transparent;
  border: 1px dashed var(--border-md);
  color: var(--ink-3);
  font-style: italic;
}
.review-list.empty li::before { background: var(--ink-3); }
.review-dots {
  margin: 1.2rem 0 .8rem;
  display: flex;
  gap: .4rem;
  justify-content: center;
}
.review-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--border-md);
  transition: background .2s, transform .2s;
}
.review-dot.active { background: var(--gold); transform: scale(1.2); }
.review-actions {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
}
@media (max-width: 480px) {
  .review-stat-grid { grid-template-columns: 1fr; }
}

/* Gold pill variant for export-bar (used by Monthly Review trigger) */
.export-btn--gold {
  background: #dfae4a !important;
  color: #2a1d05 !important;
  border-color: rgba(184,134,11,.45) !important;
  font-weight: 700;
  letter-spacing: .04em;
}
.export-btn--gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(184,134,11,.55);
}

/* Allocation bars */
.alloc-bars { display: flex; flex-direction: column; gap: .875rem; }
.alloc-bar-item { display: flex; flex-direction: column; gap: .3rem; }
.alloc-bar-meta { display: flex; justify-content: space-between; align-items: baseline; }
.alloc-bar-name { font-size: .82rem; color: var(--ink-2); }
.alloc-bar-pct { font-size: .73rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.alloc-bar-track {
  height: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.alloc-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width .6s var(--ease);
}

/* Envelope health */
.env-health-list { display: flex; flex-direction: column; }
.env-health-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.env-health-row:last-child { border-bottom: none; }
.env-health-name { flex: 1; font-size: .85rem; color: var(--ink-1); }
.env-health-track { flex: 2; height: 3px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.env-health-fill { height: 100%; border-radius: var(--radius-pill); transition: width .5s var(--ease); }
.env-health-pct { font-size: .73rem; color: var(--ink-3); min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.env-health-hint {
  font-size: .76rem;
  color: var(--ink-3);
  line-height: 1.5;
  padding: 0 0 .5rem;
  margin-bottom: .35rem;
  border-bottom: 1px solid var(--border);
}
.env-health-hint .link-btn,
.freedom-cta .link-btn,
.runway-mini-hint .link-btn {
  font: inherit;
  color: var(--gold);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.freedom-cta {
  font-size: .76rem;
  color: var(--ink-3);
  line-height: 1.5;
  margin: .1rem 0 .5rem;
}
.runway-mini-hint {
  font-size: .7rem;
  color: var(--ink-4);
  line-height: 1.45;
  margin-top: .3rem;
}

/* ── BUDGET / PILLARS ────────────────────────────────── */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.pillar-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: box-shadow .2s;
  box-shadow: var(--shadow-sm);
}
.pillar-card:hover { box-shadow: var(--shadow-md); }
.pillar-header { display: flex; align-items: center; gap: .7rem; margin-bottom: .35rem; }
.pillar-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pillar-name { font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.pillar-range { font-size: .73rem; color: var(--ink-3); margin-bottom: 1rem; }
.pillar-amount {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--ink-1);
  margin-bottom: 1rem;
  line-height: 1;
  letter-spacing: -.02em;
}
.pillar-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
  margin-bottom: .5rem;
}
.pillar-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink-1);
  cursor: pointer;
  transition: transform .15s var(--ease-spring);
  border: 2px solid var(--surface-1);
  box-shadow: var(--shadow-sm);
}
.pillar-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }
.pillar-pct { font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Zero-based bar */
.zbb-bar {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.zbb-item { display: flex; flex-direction: column; gap: .2rem; }
.zbb-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.zbb-val { font-family: var(--font-serif); font-size: 1.4rem; color: var(--ink-1); letter-spacing: -.01em; }
.zbb-val--accent { color: var(--accent); }
.zbb-val--green { color: var(--green); }
.zbb-op { font-size: 1.1rem; color: var(--ink-4); }

.btn-center { display: flex; justify-content: flex-start; }

/* ── ENVELOPES ───────────────────────────────────────── */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 1rem;
}
.env-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: box-shadow .2s, transform .2s var(--ease);
  cursor: default;
  box-shadow: var(--shadow-sm);
}
.env-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.env-card--empty { border-left: 3px solid var(--red); }
.env-card--warning { border-left: 3px solid var(--gold); }

.env-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.env-card-name { font-size: .92rem; font-weight: 600; color: var(--ink-1); }
.env-card-pillar {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .2rem .55rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 600;
  border: 1px solid var(--border);
}

.env-card-amounts { display: flex; justify-content: space-between; align-items: baseline; }
.env-card-remaining { font-family: var(--font-serif); font-size: 1.6rem; line-height: 1; letter-spacing: -.02em; }
.env-card-budget { font-size: .78rem; color: var(--ink-3); }

.env-card-track { height: 3px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.env-card-fill { height: 100%; border-radius: var(--radius-pill); transition: width .5s var(--ease); }

/* Non-color status badge — paired glyph + text for WCAG 1.4.1 */
.env-card-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  align-self: flex-start;
  padding: .22rem .55rem;
  border-radius: var(--radius-pill);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
}
.env-card-status-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: .7rem;
  line-height: 1;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--ink-2);
}
.env-card-status--ok .env-card-status-glyph       { background: var(--green); color: #fff; }
.env-card-status--warning .env-card-status-glyph  { background: var(--gold); color: #1a1a1a; }
.env-card-status--critical .env-card-status-glyph { background: var(--red); color: #fff; }
.env-card-status--ok       { border-color: rgba(46,160,67,.25); }
.env-card-status--warning  { border-color: rgba(184,134,11,.30); }
.env-card-status--critical { border-color: rgba(192,57,43,.30); }

.env-card-actions { display: flex; gap: .4rem; margin-top: .1rem; }
/* Card action buttons (UX spec): primary actions gold, the rest white */
.env-action-btn {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-xs);
  padding: .45rem .35rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-align: center;
  font-weight: 600;
  letter-spacing: .02em;
}
.env-action-btn:hover { background: var(--surface-2); color: var(--ink-1); border-color: var(--border-md); }
.env-action-btn--danger:hover { background: var(--red-dim); border-color: rgba(192,57,43,.25); color: var(--red); }
/* Gold primary card actions (Spend / Edit) */
.env-action-btn--gold {
  background: #dfae4a;
  border-color: rgba(184,134,11,.55);
  color: #2a1d05;
}
.env-action-btn--gold:hover {
  background: #e8ba58;
  border-color: rgba(184,134,11,.75);
  color: #1d1303;
}
/* Dark theme: rich chat-bubble gold — softer than the daylight capsule */
[data-theme="dark"] .env-action-btn--gold {
  background: #c79b30;
  border-color: rgba(212,175,55,.5);
  color: #1d1303;
}
[data-theme="dark"] .env-action-btn--gold:hover { background: #d4af37; border-color: rgba(212,175,55,.7); color: #140d02; }

/* ── NEXT $100 ───────────────────────────────────────── */
.n100-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
/* Three equal columns, action buttons aligned at the same level (UX spec) */
.n100-grid--three { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
.n100-tile-action { margin-top: auto; padding-top: .75rem; }
.income-add-row--stacked { flex-direction: column; align-items: stretch; }
.income-add-row--stacked .ob-input-wrap { width: 100%; }
@media (max-width: 1100px) {
  .n100-grid--three { grid-template-columns: 1fr; }
}
.n100-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  box-shadow: var(--shadow-sm);
}
.n100-desc { font-size: .87rem; color: var(--ink-2); line-height: 1.75; }

.n100-rec { display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.n100-rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  font-size: .87rem;
  border: 1px solid var(--border);
}
.n100-rec-name { color: var(--ink-2); }
.n100-rec-amt { font-weight: 600; color: var(--ink-1); font-variant-numeric: tabular-nums; }

.windfall-result { margin-top: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.windfall-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  border: 1px solid transparent;
}
.windfall-item--invest { background: var(--blue-dim); border-color: rgba(9,105,218,.15); }
.windfall-item--enjoy  { background: var(--green-dim); border-color: rgba(26,127,55,.15); }
.windfall-item-label { color: var(--ink-2); }
.windfall-item-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.windfall-item--invest .windfall-item-val { color: var(--blue); }
.windfall-item--enjoy  .windfall-item-val { color: var(--green); }

.income-add-row { display: flex; align-items: center; margin-bottom: 1rem; gap: .75rem; flex-wrap: wrap; }
.income-log { display: flex; flex-direction: column; gap: .4rem; }
.income-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .87rem;
  border: 1px solid var(--border);
}
.income-log-src { color: var(--ink-2); }
.income-log-amt { font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.income-log-date { font-size: .72rem; color: var(--ink-3); }

/* ── DEBT SNOWBALL ───────────────────────────────────── */
.snowball-setup { margin-bottom: 1.75rem; }

.snowball-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.snowball-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  transition: box-shadow .2s, transform .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.snowball-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.snowball-card--target {
  border-left: 3px solid var(--accent);
  background: rgba(153,15,61,.03);
}
.snowball-rank {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-3);
  flex-shrink: 0;
}
.snowball-card--target .snowball-rank {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.snowball-info { display: flex; flex-direction: column; gap: .35rem; }
.snowball-name { font-size: .92rem; font-weight: 600; color: var(--ink-1); }
.snowball-meta { font-size: .77rem; color: var(--ink-3); }
.snowball-track { height: 3px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; margin-top: .4rem; }
.snowball-fill { height: 100%; border-radius: var(--radius-pill); background: var(--accent); transition: width .5s var(--ease); }

.snowball-right { text-align: right; display: flex; flex-direction: column; gap: .3rem; }
.snowball-balance { font-family: var(--font-serif); font-size: 1.3rem; color: var(--ink-1); letter-spacing: -.01em; }
.snowball-payment { font-size: .78rem; color: var(--ink-3); }
.snowball-target-badge {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  font-weight: 700;
}

.snowball-summary {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.snowball-summary-title {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}
.snowball-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ss-item { display: flex; flex-direction: column; gap: .25rem; }
.ss-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; }
.ss-val { font-family: var(--font-serif); font-size: 1.3rem; color: var(--ink-1); letter-spacing: -.01em; }
.ss-val--accent { color: var(--accent); }
.ss-val--green { color: var(--green); }

/* ═══════════════════════════════════════════════════════
   MODULE 05 — SUBSCRIPTION KILLER
═══════════════════════════════════════════════════════ */
.sub-summary-bar {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--accent);
}
.sub-sum-item { display: flex; flex-direction: column; gap: .2rem; }
.sub-sum-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.sub-sum-val { font-family: var(--font-serif); font-size: 1.35rem; letter-spacing: -.01em; }
.sub-sum-val--red { color: var(--red); }
.sub-sum-val--green { color: var(--green); }
.sub-sum-val--gold { color: var(--gold); }

.sub-alacarte-box {
  background: rgba(153,15,61,.04);
  border: 1px solid rgba(153,15,61,.15);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.sub-alacarte-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}
.sub-alacarte-text { font-size: .88rem; color: var(--ink-2); line-height: 1.8; }
.sub-alacarte-text strong { color: var(--ink-1); }

.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.sub-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: box-shadow .2s;
  box-shadow: var(--shadow-sm);
}
.sub-card:hover { box-shadow: var(--shadow-md); }
.sub-card--active { border-left: 3px solid var(--red); }
.sub-card--cancelled { opacity: .55; }

.sub-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.sub-card-name { font-size: .92rem; font-weight: 600; color: var(--ink-1); }
.sub-card-status {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: .2rem .55rem;
  border-radius: var(--radius-pill);
  background: var(--red-dim);
  color: var(--red);
  font-weight: 700;
  border: 1px solid rgba(192,57,43,.2);
}
.sub-card-status--cancelled { background: var(--green-dim); color: var(--green); border-color: rgba(26,127,55,.2); }

.sub-card-cost { font-family: var(--font-serif); font-size: 1.5rem; color: var(--ink-1); line-height: 1; letter-spacing: -.01em; }
.sub-card-freq { font-size: .75rem; color: var(--ink-3); margin-top: .2rem; }
.sub-card-annual { font-size: .8rem; color: var(--red); font-weight: 600; }

.sub-card-actions { display: flex; gap: .4rem; }
.sub-action-btn {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: .45rem;
  font-size: .72rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-align: center;
  font-weight: 600;
}
.sub-action-btn:hover { background: var(--red-dim); border-color: rgba(192,57,43,.2); color: var(--red); }
.sub-action-btn--keep:hover { background: var(--green-dim); border-color: rgba(26,127,55,.2); color: var(--green); }

/* ═══════════════════════════════════════════════════════
   MODULE 06 — STATUS VS WEALTH
═══════════════════════════════════════════════════════ */
/* Left-aligned, flat (UX spec June 2026) */
.svw-coach-box {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.svw-coach-icon {
  width: 52px; height: 52px;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 0 1rem;
}
.svw-coach-icon svg { width: 24px; height: 24px; stroke: var(--ink-2); fill: none; stroke-width: 1.5; }
.svw-coach-title { font-family: var(--font-serif); font-size: 1.4rem; margin-bottom: .5rem; letter-spacing: -.01em; }
.svw-coach-text { font-size: .88rem; color: var(--ink-2); line-height: 1.8; max-width: 520px; margin: 0 0 1.5rem; }

.svw-question-box {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.svw-question { font-size: 1rem; color: var(--ink-1); line-height: 1.65; margin-bottom: 1.25rem; font-family: var(--font-serif); font-style: italic; }
.svw-answers { display: flex; gap: .75rem; flex-wrap: wrap; }
.svw-answer-btn {
  flex: 1;
  min-width: 160px;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: .87rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: left;
  line-height: 1.55;
  font-weight: 500;
}
.svw-answer-btn:hover { border-color: var(--border-hi); color: var(--ink-1); background: var(--surface-3); }
.svw-answer-btn--wealth:hover { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.svw-answer-btn--status:hover { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.svw-result {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  animation: fadeUp .3s var(--ease) both;
  box-shadow: var(--shadow-sm);
}
.svw-result-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .875rem;
  border-radius: var(--radius-pill);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .875rem;
  border: 1px solid transparent;
}
.svw-result-badge--wealth { background: var(--green-dim); color: var(--green); border-color: rgba(26,127,55,.2); }
.svw-result-badge--status { background: var(--accent-dim); color: var(--accent); border-color: rgba(153,15,61,.2); }
.svw-result-badge--neutral { background: var(--gold-dim); color: var(--gold); border-color: rgba(184,134,11,.2); }
.svw-result-text { font-size: .88rem; color: var(--ink-2); line-height: 1.8; }
.svw-result-text strong { color: var(--ink-1); }

.svw-history { display: flex; flex-direction: column; gap: .4rem; margin-top: 1rem; }
.svw-history-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .7rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .84rem;
}
.svw-history-verdict {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  border: 1px solid transparent;
}
.svw-history-verdict--wealth { background: var(--green-dim); color: var(--green); border-color: rgba(26,127,55,.2); }
.svw-history-verdict--status { background: var(--accent-dim); color: var(--accent); border-color: rgba(153,15,61,.2); }
.svw-history-desc { flex: 1; color: var(--ink-2); }
.svw-history-date { font-size: .7rem; color: var(--ink-3); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   MODULE 07 — RUNWAY DASHBOARD
═══════════════════════════════════════════════════════ */
.runway-hero {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  /* gold highlight line removed per UX spec (June 2026) */
  position: relative;
}
.runway-hero-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .875rem;
}
.runway-days {
  font-family: var(--font-serif);
  font-size: clamp(4rem, 9vw, 6.5rem);
  color: var(--ink-1);
  line-height: 1;
  margin-bottom: .5rem;
  font-weight: 400;
  letter-spacing: -.04em;
}
.runway-days-unit {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink-3);
  font-weight: 400;
  display: block;
  margin-top: .25rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.runway-status {
  font-size: .9rem;
  color: var(--ink-2);
  margin-top: 1rem;
  line-height: 1.7;
}
.runway-status strong { color: var(--ink-1); }
.runway-status--green strong { color: var(--green); }
.runway-status--red strong { color: var(--red); }

.runway-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 1.5rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.runway-tile {
  background: var(--surface-1);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  transition: background .15s;
}
.runway-tile:hover { background: var(--surface-2); }
.runway-tile-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.runway-tile-val { font-family: var(--font-serif); font-size: 1.5rem; color: var(--ink-1); letter-spacing: -.01em; }
.runway-tile-sub { font-size: .73rem; color: var(--ink-3); }

.runway-savings-input {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.runway-savings-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1rem;
}
.runway-savings-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.runway-savings-result {
  margin-top: 1rem;
  padding: .875rem 1.1rem;
  background: var(--green-dim);
  border: 1px solid rgba(26,127,55,.2);
  border-radius: var(--radius-sm);
  font-size: .87rem;
  color: var(--green);
  font-weight: 600;
  display: none;
}
.runway-savings-result.show { display: block; }

.runway-log { display: flex; flex-direction: column; gap: .4rem; }
.runway-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .84rem;
}
.runway-log-desc { color: var(--ink-2); }
.runway-log-days { font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.runway-log-date { font-size: .7rem; color: var(--ink-3); }

/* ── MODALS ──────────────────────────────────────────── */
.modal-bg {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20,28,46,.42);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  z-index: 100;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s var(--ease) both;
}
[data-theme="dark"] .modal-bg {
  background: rgba(6,8,14,.62);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}
.modal-bg.open { display: flex; }

.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  animation: scaleIn .22s var(--ease-spring) both;
  box-shadow: var(--shadow-xl);
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: .4rem;
  letter-spacing: -.01em;
}
.modal-sub { font-size: .87rem; color: var(--ink-2); line-height: 1.7; margin-bottom: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; }

.field-select {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  font-size: .9rem;
  color: var(--ink-1);
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
  box-shadow: var(--shadow-sm);
}
.field-select:focus { border-color: var(--ink-2); }

.transfer-opts { display: flex; flex-direction: column; gap: .5rem; }
.transfer-opt-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  text-align: left;
  font-size: .87rem;
  color: var(--ink-1);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.transfer-opt-btn:hover { background: var(--surface-3); border-color: var(--border-md); }
.transfer-opt-avail { color: var(--ink-3); font-size: .8rem; }

/* ── SECONDARY BUTTON — pill with light grey background (UX spec) ── */
.ghost-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .6rem 1.2rem;
  font-size: .83rem;
  color: var(--ink-1);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  font-weight: 600;
}
.ghost-btn:hover { border-color: var(--border-md); color: var(--ink-1); background: var(--surface-3); }
[data-theme="dark"] .ghost-btn {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .ghost-btn:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.22); }

/* ── AI TOAST ────────────────────────────────────────── */
.ai-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  max-width: 340px;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  z-index: 200;
  transform: translateY(120%);
  opacity: 0;
  transition: transform .4s var(--ease-spring), opacity .3s;
  box-shadow: var(--shadow-xl);
  border-left: 3px solid var(--accent);
}
.ai-toast.show { transform: translateY(0); opacity: 1; }
.ai-toast-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: .42rem;
  animation: pulse 2.5s ease-in-out infinite;
}
.ai-toast p { font-size: .87rem; color: var(--ink-2); line-height: 1.65; }

/* ── THEME TOGGLE ────────────────────────────────────── */
.theme-toggle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--surface-3); border-color: var(--border-hi); }
.theme-toggle svg { width: 16px; height: 16px; stroke: var(--ink-1); fill: none; stroke-width: 1.75; stroke-linecap: round; }
[data-theme="dark"] .theme-toggle {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
}
[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.28);
}
[data-theme="dark"] .theme-toggle svg { stroke: var(--ink-1); }

/* ── EXPORT TOOLBAR ──────────────────────────────────── */
.export-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
/* Tertiary button — pill with white background (UX spec) */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: 999px;
  padding: .5rem .95rem;
  font-size: .77rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  letter-spacing: .02em;
}
.export-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.export-btn:hover { background: var(--surface-3); border-color: var(--border-hi); color: var(--ink-1); }
.export-btn--accent:hover { background: var(--accent-dim); border-color: rgba(153,15,61,.25); color: var(--accent); }
.export-btn--green:hover { background: var(--green-dim); border-color: rgba(26,127,55,.25); color: var(--green); }

/* DARK theme: export-btn gets a luminous outline so it stays visible on obsidian topbar */
[data-theme="dark"] .export-btn {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.14);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .export-btn:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.22);
  color: #ffffff;
}

/* ── TRANSACTION HISTORY PANEL ───────────────────────── */
.history-panel {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  height: 100vh;
  background: var(--surface-1);
  border-left: 1px solid var(--border-md);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s var(--ease);
  box-shadow: var(--shadow-xl);
}
.history-panel.open { transform: translateX(0); }

.history-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-panel-title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 500; }
.history-panel-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.history-panel-close:hover { background: var(--red-dim); }
.history-panel-close svg { width: 12px; height: 12px; stroke: var(--ink-2); fill: none; stroke-width: 2; }

.history-panel-meta {
  padding: .75rem 1.5rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-panel-meta-row { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-3); }
.history-panel-meta-val { font-weight: 600; color: var(--ink-1); }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.history-empty { font-size: .87rem; color: var(--ink-3); padding: 1rem 0; }

.history-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.history-item:hover { border-color: var(--border-md); }
.history-item-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--red-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.history-item-icon svg { width: 12px; height: 12px; stroke: var(--red); fill: none; stroke-width: 2; }
.history-item-body { flex: 1; min-width: 0; }
.history-item-note { font-size: .87rem; color: var(--ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.history-item-date { font-size: .72rem; color: var(--ink-3); margin-top: .1rem; }
.history-item-amt { font-size: .92rem; font-weight: 600; color: var(--red); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ── PWA INSTALL BANNER ──────────────────────────────── */
.pwa-banner {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 300;
  box-shadow: var(--shadow-xl);
  transition: transform .4s var(--ease-spring);
  max-width: 360px;
  width: calc(100vw - 3rem);
}
.pwa-banner.show { transform: translateX(-50%) translateY(0); }
.pwa-banner-text { flex: 1; font-size: .84rem; color: var(--ink-2); line-height: 1.5; }
.pwa-banner-text strong { color: var(--ink-1); display: block; margin-bottom: .2rem; }
.pwa-banner-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ── ANIMATIONS ──────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.7); }
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ── DARK THEME ──────────────────────────────────────── */
[data-theme="dark"] {
  --surface-0:   #0d1117;
  --surface-1:   #161b22;
  --surface-2:   #1c2128;
  --surface-3:   #252d38;
  --surface-4:   #2d3748;

  --ink-1:       #e6edf3;
  --ink-2:       #8b949e;
  --ink-3:       #484f58;
  --ink-4:       #30363d;

  --border:      rgba(99,130,167,.12);
  --border-md:   rgba(99,130,167,.22);
  --border-hi:   rgba(99,130,167,.38);

  --accent:      #ff6b8a;
  --accent-dim:  rgba(255,107,138,.1);
  --accent-glow: rgba(255,107,138,.25);

  --gold:        #d4a843;
  --gold-dim:    rgba(212,168,67,.12);
  --gold-light:  #f0c96a;

  --green:       #3fb950;
  --green-dim:   rgba(63,185,80,.12);
  --red:         #f85149;
  --red-dim:     rgba(248,81,73,.12);
  --blue:        #58a6ff;
  --blue-dim:    rgba(88,166,255,.12);

  --shadow-sm:   0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.2);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.5), 0 4px 8px rgba(0,0,0,.2);
  --shadow-xl:   0 24px 56px rgba(0,0,0,.6), 0 8px 16px rgba(0,0,0,.2);
}

[data-theme="dark"] .ob-bg {
  background: repeating-linear-gradient(
    0deg, transparent, transparent 39px,
    rgba(99,130,167,.04) 39px, rgba(99,130,167,.04) 40px
  );
}
[data-theme="dark"] .ob-bg::after {
  background:
    radial-gradient(ellipse 55% 45% at 50% -5%,   rgba(245,227,168,.06) 0%, transparent 70%),
    radial-gradient(ellipse 45% 40% at 95% 100%,  rgba(255,107,138,.05) 0%, transparent 65%),
    radial-gradient(ellipse 40% 35% at 5% 100%,   rgba(212,168,67,.04)  0%, transparent 65%),
    radial-gradient(ellipse 140% 100% at 50% 50%, transparent 45%, rgba(0,0,0,.45) 100%);
}
/* dark-theme ob-btn / modal-bg overrides handled in v7 section below */

/* ── MOBILE BOTTOM NAV ───────────────────────────────── */
.bottom-nav { display: none; }

@media (max-width: 600px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  #screen-app { flex-direction: column; }
  .main-content { height: 100vh; overflow-y: auto; }
  .content-area { padding: 1.25rem 1rem 5.5rem; }
  .topbar { padding: .875rem 1rem; }

  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    z-index: 90;
    padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 12px rgba(12,15,20,.06);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    padding: .4rem .2rem;
    font-size: .58rem;
    color: var(--ink-3);
    cursor: pointer;
    transition: color .15s;
    border: none;
    background: transparent;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
  }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; }

  .kpi-row { grid-template-columns: 1fr 1fr; gap: 1px; }
  .kpi { padding: 1rem 1.1rem; }
  .kpi-val { font-size: 1.4rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .n100-grid { grid-template-columns: 1fr; }
  .pillars-grid { grid-template-columns: 1fr; }
  .snowball-card { grid-template-columns: auto 1fr; }
  .snowball-right { grid-column: 2; }
  .history-panel { width: 100vw; }
  .zbb-bar { flex-wrap: wrap; gap: .75rem; }
  .runway-grid { grid-template-columns: 1fr 1fr; }
  .svw-answers { flex-direction: column; }
  .sub-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .n100-grid { grid-template-columns: 1fr; }
  .pillars-grid { grid-template-columns: 1fr; }
  .runway-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 200px; }
  .content-area { padding: 1.5rem 1.25rem 3rem; }
  .topbar { padding: 1rem 1.25rem; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .snowball-summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ── CURRENCY SELECTOR ─────────────────────────────────────────── */
.currency-selector {
  display: flex;
  align-items: center;
  gap: .2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: .2rem .3rem;
}
.currency-btn {
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--ink-3);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  padding: .28rem .58rem;
  transition: background .15s, color .15s;
  line-height: 1;
}
.currency-btn:hover {
  background: var(--surface-3);
  color: var(--ink-1);
}
.currency-btn.active {
  background: var(--ink-1);
  color: var(--surface-1);
}
[data-theme="dark"] .currency-btn.active {
  background: var(--gold);
  color: #0d1117;
}

/* ── SETTINGS MODULE ─────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.settings-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.settings-card-label {
  font-family: var(--font-sans);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-1);
  margin-bottom: .5rem;
}
.settings-card-desc {
  font-size: .83rem;
  color: var(--ink-3);
  line-height: 1.55;
  margin-bottom: .85rem;
}
.settings-card .ghost-btn {
  width: 100%;
  text-align: center;
}

/* ═══════════════════════════════════════════════════
   PAYSLIP MODULE
═══════════════════════════════════════════════════ */
.payslip-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background: var(--surface);
  transition: border-color .2s, background .2s;
  position: relative;
  margin-bottom: 1.5rem;
}
.payslip-upload-zone:hover,
.payslip-drop-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.payslip-upload-inner { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.payslip-upload-icon { width: 52px; height: 52px; color: var(--ink-3); }
.payslip-upload-title { font-family: var(--font-serif); font-size: 1.2rem; color: var(--ink-1); margin: 0; }
.payslip-upload-sub { font-size: .82rem; color: var(--ink-3); margin: 0; }
.payslip-browse-btn { cursor: pointer; }
.payslip-privacy-badge {
  display: flex; align-items: center; gap: .4rem; justify-content: center;
  font-size: .72rem; color: var(--ink-3); margin-top: 1rem;
}

/* Parsing spinner */
.payslip-parsing {
  display: flex; align-items: center; gap: 1rem;
  padding: 2rem; background: var(--surface);
  border-radius: var(--radius-lg); margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}
.payslip-parsing-spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Result card */
.payslip-result {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.payslip-result-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.5rem;
}
.payslip-result-title { font-family: var(--font-serif); font-size: 1.15rem; color: var(--ink-1); margin: 0 0 .2rem; }
.payslip-result-file { font-size: .78rem; color: var(--ink-3); margin: 0; }

/* Confidence badge */
.payslip-confidence {
  font-size: .72rem; font-weight: 600; padding: .25rem .65rem;
  border-radius: 999px; font-family: var(--font-sans);
  text-transform: uppercase; letter-spacing: .05em;
}
.confidence--high   { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.confidence--medium { background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold); }
.confidence--low    { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }

/* Amounts grid */
.payslip-amounts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem; margin-bottom: 1.25rem;
}
.payslip-amount-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.payslip-amount-card--primary {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
}
.payslip-amount-card--warn { border-color: var(--gold); }
.payslip-amount-label { display: block; font-size: .72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.payslip-amount-value { display: block; font-family: var(--font-serif); font-size: 1.4rem; color: var(--ink-1); }
.payslip-amount-sub { display: block; font-size: .72rem; color: var(--ink-3); margin-top: .3rem; }
.payslip-deduction { color: var(--red) !important; }

/* Meta row */
.payslip-meta-row {
  display: flex; flex-wrap: wrap; gap: 1rem;
  padding: .75rem 0; border-top: 1px solid var(--border);
  margin-bottom: 1.25rem; font-size: .82rem; color: var(--ink-2);
}
.payslip-meta-item strong { color: var(--ink-1); }

/* Manual entry */
.payslip-manual-entry { margin-bottom: 1.25rem; }
.payslip-manual-row { display: flex; gap: .75rem; margin-top: .5rem; }
.payslip-manual-row .form-input { flex: 1; }

/* Editable review card (frequency-aware, mismatch-proof) */
.payslip-review-hint { font-size: .82rem; color: var(--ink-2); margin: 0 0 1rem; }
.payslip-warn-row {
  font-size: .82rem; color: var(--ink-1);
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
  border: 1px solid var(--gold); border-radius: 10px;
  padding: .6rem .8rem; margin-bottom: 1rem;
}
.payslip-warn-row strong { color: var(--ink-1); }
.payslip-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.payslip-edit-field { display: flex; flex-direction: column; gap: .4rem; }
.payslip-monthly-hero { margin-bottom: 1.25rem; }
/* Native <select> option list defaults to white-on-white in dark mode — force the
   popup to use the theme surface/ink so the options are readable in both themes. */
.payslip-edit-field select.form-input { color: var(--ink-1); }
.payslip-edit-field select.form-input option,
#ps-freq option { background: var(--surface-1); color: var(--ink-1); }
@media (max-width: 560px) { .payslip-edit-grid { grid-template-columns: 1fr; } }

/* Actions */
.payslip-actions { display: flex; flex-wrap: wrap; gap: .75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.btn--lg { padding: .7rem 1.5rem; font-size: .9rem; }

/* Success / Error states */
.payslip-success, .payslip-error {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.5rem; border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.payslip-success { background: color-mix(in srgb, var(--green) 8%, var(--surface)); border: 1px solid var(--green); color: var(--green); }
.payslip-error   { background: color-mix(in srgb, var(--red) 8%, var(--surface)); border: 1px solid var(--red); color: var(--red); }
.payslip-success strong, .payslip-error strong { display: block; margin-bottom: .3rem; }
.payslip-success p, .payslip-error p { margin: 0; font-size: .85rem; opacity: .85; }

/* History */
.payslip-history-section { margin-top: 2rem; }
.payslip-history-list { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
.payslip-history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
}
.payslip-history-meta { flex: 1; min-width: 160px; }
.payslip-history-file { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-1); }
.payslip-history-date { display: block; font-size: .75rem; color: var(--ink-3); margin-top: .15rem; }
.payslip-history-amounts { display: flex; gap: .5rem; flex-wrap: wrap; }
.payslip-net-badge {
  font-size: .75rem; font-weight: 600; padding: .2rem .6rem;
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green); border-radius: 999px;
}
.payslip-gross-badge {
  font-size: .75rem; padding: .2rem .6rem;
  background: var(--bg); color: var(--ink-3); border-radius: 999px;
  border: 1px solid var(--border);
}
.payslip-history-actions { display: flex; gap: .5rem; }
.btn--danger { color: var(--red) !important; }

/* ═══════════════════════════════════════════════════════════════════
   UX POLISH v5 — Transitions, Hover States, Focus Rings, Micro-interactions
═══════════════════════════════════════════════════════════════════ */

/* ── Smooth view transitions ── */
.view.active { animation: viewFadeIn .18s ease; }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sidebar nav item hover ── */
.sb-item {
  transition: background .14s ease, color .14s ease, padding-left .14s ease;
}
.sb-item:hover:not(.active) {
  background: var(--surface-2);
  color: var(--ink-1);
  padding-left: 1.1rem;
}

/* ── Bottom nav active indicator ── */
.bottom-nav-item {
  transition: color .14s ease, transform .12s ease;
  position: relative;
}
.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.bottom-nav-item:active { transform: scale(.93); }

/* ── Button press feedback ── */
.ob-btn:active { transform: scale(.97) !important; }
.ghost-btn:active { transform: scale(.97); }
.ghost-btn {
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .1s ease;
}

/* ── Envelope card hover ── */
.env-card {
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.env-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ── KPI card hover ── */
.kpi {
  transition: background .15s ease;
}

/* ── Card hover ── */
.card {
  transition: box-shadow .18s ease;
}
.card:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

/* ── Form input focus ring ── */
.ob-input:focus, .vault-input:focus, .field-select:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent) !important;
}

/* ── Subscription card hover ── */
.sub-card {
  transition: box-shadow .18s ease, transform .18s ease;
}
.sub-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  transform: translateY(-1px);
}

/* ── Goal card hover ── */
.goal-card {
  transition: box-shadow .18s ease, transform .18s ease;
}
.goal-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  transform: translateY(-1px);
}

/* ── Runway tile hover ── */
.runway-tile {
  transition: box-shadow .18s ease, transform .18s ease;
}
.runway-tile:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  transform: translateY(-1px);
}

/* ── Pillar input focus ── */
.pillar-input:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent) !important;
}

/* ── Currency button active state ── */
.currency-btn {
  transition: background .12s ease, color .12s ease, transform .1s ease;
}
.currency-btn:active { transform: scale(.93); }

/* ── Settings card hover ── */
.settings-card {
  transition: box-shadow .18s ease, border-color .18s ease;
}
.settings-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  border-color: var(--accent);
}

/* ── Payslip history item hover ── */
.payslip-history-item {
  transition: box-shadow .18s ease, border-color .18s ease;
}
.payslip-history-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  border-color: var(--accent);
}

/* ── Export button hover ── */
.export-btn {
  transition: background .14s ease, color .14s ease, transform .1s ease;
}
.export-btn:active { transform: scale(.95); }

/* ── Debt card hover ── */
.debt-card {
  transition: box-shadow .18s ease, transform .18s ease;
}
.debt-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  transform: translateY(-1px);
}

/* ── Mobile: larger tap targets ── */
@media (max-width: 768px) {
  .ghost-btn { min-height: 44px; }
  .ob-btn    { min-height: 48px; }
  .bottom-nav-item { min-height: 52px; }
  .env-card-btn { min-height: 40px; min-width: 44px; }
}

/* ── Scrollbar polish ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ── Modal entrance animation ── */
.modal { animation: modalSlideUp .2s cubic-bezier(.34,1.56,.64,1); }
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── CURRENCY DROPDOWN ─────────────────────────────────────────── */
.currency-selector { position: relative; }
.currency-dropdown-btn {
  display: flex; align-items: center; gap: .35rem;
  padding: .35rem .65rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; font-size: .8rem; font-family: var(--font-sans);
  font-weight: 600; color: var(--ink-1); cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap;
}
.currency-dropdown-btn:hover { background: var(--surface-3); border-color: var(--ink-3); }
.currency-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: .4rem; z-index: 9999; display: none; flex-direction: column; gap: 2px;
}
.currency-dropdown.open { display: flex; animation: dropdownIn .15s ease; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.currency-opt {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; border-radius: 8px; border: none;
  background: transparent; font-size: .82rem; font-family: var(--font-sans);
  color: var(--ink-2); cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.currency-opt span { font-weight: 700; color: var(--ink-1); min-width: 1.8rem; }
.currency-opt:hover { background: var(--surface-2); color: var(--ink-1); }
.currency-opt.active { background: var(--surface-2); color: var(--ink-1); font-weight: 600; }
.currency-opt.active::after { content: ''; width: .45rem; height: .45rem; margin-left: auto; border-radius: 999px; background: var(--green); }

/* ══════════════════════════════════════════════════════════════════
   APPLE ENTERPRISE REFIT v7 — DUAL THEME
   LIGHT (default) · cool ice-blue aurora canvas · white panels · gold actions
   DARK (opt-in)   · deep midnight canvas · frosted glass · same gold actions
══════════════════════════════════════════════════════════════════ */
:root {
  /* Stage — cool ice-blue paper, NOT brown, NOT navy */
  --surface-0:   #eef2f7;   /* page canvas (cool light grey) */
  --surface-1:   #ffffff;   /* primary card */
  --surface-2:   #f3f5f9;   /* inset / subtle wash */
  --surface-3:   #e8ecf2;   /* hover surface */
  --surface-4:   #d6dbe4;   /* divider */

  /* Chrome — frosted white glass for sidebar/topbar */
  --chrome:        rgba(255,255,255,.74);
  --chrome-strong: rgba(255,255,255,.90);
  --panel-solid:   #ffffff;
  --panel-tint:    #f5f7fb;

  /* Ink — cool charcoal for text on light surfaces */
  --ink-1: #0c0f14;
  --ink-2: #3e434b;
  --ink-3: #7b818c;
  --ink-4: #b1b5be;

  /* Ink-on-dark — only used inside DARK chrome elements (frosted dark zones) */
  --ink-onDark-1: #f3f5fa;
  --ink-onDark-2: #b6bccb;
  --ink-onDark-3: #7a8197;
  --ink-onDark-4: #4f5668;

  /* Borders */
  --border:           rgba(12,15,20,.085);
  --border-md:        rgba(12,15,20,.16);
  --border-hi:        rgba(12,15,20,.26);
  --border-onDark:    rgba(255,255,255,.08);
  --border-onDark-md: rgba(255,255,255,.14);

  /* Accent — claret */
  --accent: #8f0f3a;
  --accent-dim: rgba(143,15,58,.09);
  --accent-glow: rgba(143,15,58,.18);

  /* Gold — reserved for primary actions (Add / Sign In / Log) */
  --gold:        #b8860b;
  --gold-dim:    rgba(184,134,11,.1);
  --gold-light:  #d4a843;
  --gold-deep:   #8a6308;

  /* Semantic */
  --green:     #1a7f37;
  --green-dim: rgba(26,127,55,.1);
  --red:       #c0392b;
  --red-dim:   rgba(192,57,43,.1);
  --blue:      #0969da;
  --blue-dim:  rgba(9,105,218,.1);

  --radius:    18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --blur-chrome: blur(28px) saturate(170%);
  --blur-modal:  blur(24px) saturate(160%);

  /* Shadows — cool ink-tinted, soft */
  --shadow-sm: 0 0 0 1px rgba(12,15,20,.05), 0 1px 2px rgba(12,15,20,.04);
  --shadow-md: 0 0 0 1px rgba(12,15,20,.06), 0 8px 22px -10px rgba(12,15,20,.18), 0 2px 6px rgba(12,15,20,.06);
  --shadow-lg: 0 0 0 1px rgba(12,15,20,.07), 0 22px 50px -22px rgba(12,15,20,.28), 0 8px 16px rgba(12,15,20,.08);
  --shadow-xl: 0 0 0 1px rgba(12,15,20,.08), 0 36px 80px -28px rgba(12,15,20,.34), 0 14px 28px rgba(12,15,20,.1);
}

/* ── DARK THEME — OBSIDIAN (Apple Vision Pro / Linear / Vercel grade) ──
   Stage:       deep midnight  #0a0d14
   Card L1:     obsidian solid #14171f  (KPI hero, data cards, env-cards)
   Card L2:     graphite       #1a1e28  (insets, secondary panels)
   Chrome:      frosted dark glass (sidebar / topbar)
   Ink-on-dark: cool blueish silver, NEVER warm
─────────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --surface-0:   #0a0d14;             /* page canvas — midnight */
  --surface-1:   #14171f;             /* PRIMARY card — obsidian (was white) */
  --surface-2:   #1a1e28;             /* inset / secondary panel — graphite */
  --surface-3:   #232834;             /* hover surface */
  --surface-4:   #2d3340;             /* divider / mute */
  --panel-solid: #14171f;
  --panel-tint:  #1a1e28;

  --chrome:        rgba(18,22,30,.62);   /* dark frosted glass for sidebar/topbar */
  --chrome-strong: rgba(20,24,34,.82);

  /* ink — INSIDE dark cards now uses light text (cards are dark surfaces!) */
  --ink-1: #f3f5fa;                   /* primary text on obsidian */
  --ink-2: #b6bccb;                   /* secondary text */
  --ink-3: #7a8197;                   /* tertiary / placeholder */
  --ink-4: #4f5668;                   /* disabled / subtle */

  /* ink-on-dark — same as ink-1/2/3 now, kept for compatibility */
  --ink-onDark-1: #f3f5fa;
  --ink-onDark-2: #b6bccb;
  --ink-onDark-3: #7a8197;
  --ink-onDark-4: #4f5668;

  /* borders — light strokes on dark surfaces */
  --border:           rgba(255,255,255,.07);
  --border-md:        rgba(255,255,255,.13);
  --border-hi:        rgba(255,255,255,.22);
  --border-onDark:    rgba(255,255,255,.08);
  --border-onDark-md: rgba(255,255,255,.14);

  /* accent / semantic — brighter on midnight for legibility */
  --accent:      #ff4d75;
  --accent-dim:  rgba(255,77,117,.14);
  --accent-glow: rgba(255,77,117,.28);
  --green:       #34d27a;
  --green-dim:   rgba(52,210,122,.16);
  --red:         #ff6b6b;
  --red-dim:    rgba(255,107,107,.16);
  --blue:        #5aa5ff;
  --blue-dim:    rgba(90,165,255,.16);

  /* shadows — soft glow with top-edge highlight (luminous look) */
  --shadow-sm: inset 0 1px 0 rgba(255,255,255,.04), 0 2px 8px rgba(0,0,0,.45);
  --shadow-md: inset 0 1px 0 rgba(255,255,255,.05), 0 14px 36px -16px rgba(0,0,0,.65), 0 4px 12px rgba(0,0,0,.35);
  --shadow-lg: inset 0 1px 0 rgba(255,255,255,.06), 0 28px 60px -24px rgba(0,0,0,.75), 0 10px 22px rgba(0,0,0,.4);
  --shadow-xl: inset 0 1px 0 rgba(255,255,255,.07), 0 44px 96px -32px rgba(0,0,0,.85), 0 18px 36px rgba(0,0,0,.5);
}

/* ── DARK theme: card-specific tuning ──────────────────────────────── */
/* Hero / frosted-glass panels: keep see-through to show aurora */
[data-theme="dark"] .kpi-row--bento .kpi--hero,
[data-theme="dark"] .today-hero,
[data-theme="dark"] .svw-coach-box,
[data-theme="dark"] .runway-hero {
  background: rgba(20,24,34,.78) !important;
  border: 1px solid rgba(255,255,255,.08);
}

/* Form inputs on dark — dark with light text */
[data-theme="dark"] .ob-input-wrap,
[data-theme="dark"] .ob-input--full,
[data-theme="dark"] .field-select,
[data-theme="dark"] .form-input,
[data-theme="dark"] .vault-input {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.12);
  color: var(--ink-1);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.4);
}
[data-theme="dark"] .ob-input-wrap:focus-within,
[data-theme="dark"] .ob-input--full:focus,
[data-theme="dark"] .field-select:focus,
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .vault-input:focus {
  border-color: rgba(255,77,117,.6);
  box-shadow:
    0 0 0 4px rgba(255,77,117,.15),
    inset 0 1px 2px rgba(0,0,0,.4);
}
[data-theme="dark"] .ob-input,
[data-theme="dark"] .ob-input::placeholder,
[data-theme="dark"] .ob-input--full::placeholder { color: var(--ink-3); }
[data-theme="dark"] .ob-input { color: var(--ink-1); }

/* Pillars / chips / inset rows on dark — graphite */
[data-theme="dark"] .env-card-pillar,
[data-theme="dark"] .sub-card-status,
[data-theme="dark"] .env-action-btn,
[data-theme="dark"] .sub-action-btn,
[data-theme="dark"] .transfer-opt-btn,
[data-theme="dark"] .runway-log-item {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  color: var(--ink-2);
}
[data-theme="dark"] .transfer-opt-btn:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.14);
}

/* Ghost / outline buttons on dark */
[data-theme="dark"] .ghost-btn {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.12);
  color: var(--ink-2);
}
[data-theme="dark"] .ghost-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.18);
  color: var(--ink-1);
}

/* Section dividers on dark */
[data-theme="dark"] .section-header { border-bottom-color: rgba(255,255,255,.08); }

/* Onboarding wrap on dark — obsidian card, not white */
[data-theme="dark"] .ob-wrap {
  background: rgba(20,24,34,.78);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 36px 100px -30px rgba(0,0,0,.8),
    0 18px 40px rgba(0,0,0,.5);
}
[data-theme="dark"] .ob-headline,
[data-theme="dark"] .ob-body,
[data-theme="dark"] .ob-label,
[data-theme="dark"] .brand-name { color: var(--ink-1); }
[data-theme="dark"] .ob-body { color: var(--ink-2); }
[data-theme="dark"] .ob-label { color: var(--ink-3); }

/* Override hardcoded white overlays (rgba(255,255,255,*)) on dark surfaces */
[data-theme="dark"] .svw-coach-icon { background: rgba(255,255,255,.06); }
[data-theme="dark"] .runway-tile,
[data-theme="dark"] .runway-savings-input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
[data-theme="dark"] .command-palette-input {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.12);
  color: var(--ink-1);
}
[data-theme="dark"] .command-palette-shortcut {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
  color: var(--ink-2);
}
[data-theme="dark"] .command-item { color: var(--ink-1); }
[data-theme="dark"] .command-item:hover {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
}
[data-theme="dark"] .command-item-detail,
[data-theme="dark"] .command-empty,
[data-theme="dark"] .command-palette-label,
[data-theme="dark"] .command-palette-shortcut { color: var(--ink-3); }
[data-theme="dark"] .command-palette-card,
[data-theme="dark"] .history-panel,
[data-theme="dark"] .currency-dropdown {
  background: var(--chrome-strong);
  border-color: rgba(255,255,255,.10);
}

/* Sidebar income card (rgba(255,255,255,.65) hardcoded) → graphite on dark */
[data-theme="dark"] .sb-income-card { background: rgba(255,255,255,.05); }

/* Onboarding wrap rgba(255,255,255,.96) hardcoded → obsidian (already set above) */
[data-theme="dark"] .ob-wrap { background: rgba(20,24,34,.78); }

/* KPI tiles / cards specific overrides — they use var(--surface-1) which is now obsidian.
   Add a subtle top-edge highlight for the luminous obsidian look. */
[data-theme="dark"] .card,
[data-theme="dark"] .pillar-card,
[data-theme="dark"] .env-card,
[data-theme="dark"] .n100-tile,
[data-theme="dark"] .snowball-summary,
[data-theme="dark"] .sub-summary-bar,
[data-theme="dark"] .sub-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .modal,
[data-theme="dark"] .vault-card,
[data-theme="dark"] .security-card,
[data-theme="dark"] .kpi-row--bento .kpi {
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 30%),
    var(--surface-1);
  border-color: rgba(255,255,255,.07);
}

/* Card sub-elements that used --surface-2 (light-grey inset) — keep as graphite */
[data-theme="dark"] .env-card-pillar,
[data-theme="dark"] .sub-card-status { background: rgba(255,255,255,.06); }

body {
  background: var(--surface-0);
  color: var(--ink-1);
  position: relative;
  overflow-x: hidden;
}
/* LIGHT aurora — soft ice-blue + lavender shimmer on cool paper */
body::before {
  content: '';
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(36vw 36vw at 14% 16%, rgba(110, 140, 200, .26), transparent 65%),
    radial-gradient(40vw 40vw at 86% 22%, rgba(170, 150, 220, .22), transparent 65%),
    radial-gradient(50vw 50vw at 78% 88%, rgba(120, 175, 220, .22), transparent 70%),
    radial-gradient(46vw 46vw at 12% 92%, rgba(190, 200, 220, .25), transparent 70%);
  filter: blur(30px) saturate(115%);
  animation: auroraDrift 28s var(--ease) infinite alternate;
}

/* DARK aurora — deep midnight + indigo/violet shimmer + vignette */
[data-theme="dark"] body { color: var(--ink-onDark-1); }
[data-theme="dark"] body::before {
  background:
    radial-gradient(38vw 38vw at 12% 14%, rgba(74, 110, 200, .42), transparent 65%),
    radial-gradient(42vw 42vw at 88% 18%, rgba(150, 90, 210, .34), transparent 65%),
    radial-gradient(52vw 52vw at 82% 88%, rgba(40, 130, 200, .32), transparent 70%),
    radial-gradient(48vw 48vw at 10% 94%, rgba(90, 60, 180, .30), transparent 70%);
  filter: blur(40px) saturate(135%);
}
[data-theme="dark"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120vw 80vh at 50% -20%, rgba(255,255,255,.04), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.35) 100%);
}
@keyframes auroraDrift {
  0%   { transform: translate3d(0, 0, 0)        scale(1); }
  50%  { transform: translate3d(2%, -2%, 0)    scale(1.04); }
  100% { transform: translate3d(-2%, 2%, 0)    scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body, .kpi-val, .pillar-amount, .env-card-remaining, .runway-days, .ss-val, .sub-card-cost {
  font-variant-numeric: tabular-nums;
}

#screen-app { gap: 0; padding: 16px; }

/* ── LIGHT THEME: sidebar + topbar = white frosted glass ─────────── */
.sidebar {
  position: fixed;
  inset: 16px auto 16px 16px;
  height: auto;
  width: 268px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--chrome);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  box-shadow: var(--shadow-md);
  overflow: hidden auto;
  color: var(--ink-1);
}
.sb-top, .sb-footer {
  border-color: var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.36), transparent);
}
.sb-nav { padding: .9rem; gap: .12rem; }
.sb-section-label {
  color: var(--ink-3);
  padding: 1rem .75rem .38rem;
  letter-spacing: .13em;
}
.sb-item {
  border-radius: 16px;
  padding: .72rem .82rem;
  color: var(--ink-2);
  transition: transform .18s var(--ease-out), background .18s, box-shadow .18s, color .18s;
}
.sb-item:hover {
  background: rgba(12,15,20,.05);
  color: var(--ink-1);
  transform: translateX(2px);
}
.sb-item.active {
  background: rgba(12,15,20,.07);
  border-color: var(--border-md);
  color: var(--ink-1);
}
.sb-item.active::before {
  left: 7px;
  top: 30%;
  bottom: 30%;
  width: 3px;
  border-radius: 99px;
  background: var(--accent);
}
.sb-income-card {
  border-radius: 18px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--border);
}
.sb-reset { border-radius: 14px; }

.main-content {
  margin-left: 284px;
  border-radius: var(--radius-xl);
  background: transparent;
}
.topbar {
  margin: 0 0 18px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--chrome);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  box-shadow: var(--shadow-sm);
  color: var(--ink-1);
}

/* ── DARK THEME overrides for sidebar + topbar ───────────────────── */
[data-theme="dark"] .sidebar {
  border-color: var(--border-onDark);
  box-shadow: var(--shadow-lg);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .sidebar .sb-brand,
[data-theme="dark"] .sidebar .sb-brand-name,
[data-theme="dark"] .sidebar .sb-income-label,
[data-theme="dark"] .sidebar .sb-income-val { color: var(--ink-onDark-1); }
[data-theme="dark"] .sidebar .sb-brand-tag,
[data-theme="dark"] .sb-section-label { color: var(--ink-onDark-3); }
[data-theme="dark"] .sb-top,
[data-theme="dark"] .sb-footer {
  border-color: var(--border-onDark);
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent);
}
[data-theme="dark"] .sb-item { color: var(--ink-onDark-2); }
[data-theme="dark"] .sb-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .sb-item.active {
  background: rgba(255,255,255,.09);
  border-color: var(--border-onDark-md);
  color: #ffffff;
}
[data-theme="dark"] .sb-income-card {
  background: rgba(255,255,255,.05);
  border-color: var(--border-onDark);
}
[data-theme="dark"] .sb-reset {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-onDark);
  color: var(--ink-onDark-2);
}
[data-theme="dark"] .sb-reset:hover {
  background: rgba(255,255,255,.08);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .topbar {
  border-color: var(--border-onDark);
  box-shadow: var(--shadow-md);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .topbar .topbar-title { color: var(--ink-onDark-1); }
[data-theme="dark"] .topbar .topbar-sub,
[data-theme="dark"] .topbar .topbar-meta,
[data-theme="dark"] .topbar .lang-current,
[data-theme="dark"] .topbar .lang-flag,
[data-theme="dark"] .topbar .topbar-date { color: var(--ink-onDark-2); }
[data-theme="dark"] .topbar .lang-btn,
[data-theme="dark"] .topbar .topbar-action {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-onDark);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .topbar .lang-btn:hover,
[data-theme="dark"] .topbar .topbar-action:hover {
  background: rgba(255,255,255,.10);
  border-color: var(--border-onDark-md);
}
.topbar-title { font-size: 1.55rem; }
.content-area { padding: .25rem .5rem 4rem; }
.view { animation: premiumViewIn .36s var(--ease-out) both; }
@keyframes premiumViewIn {
  from { opacity: 0; transform: translateY(8px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.view-intro {
  max-width: 760px;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel-tint);
  color: var(--ink-2);
}
.view-intro em { color: var(--ink-1); font-style: normal; font-weight: 500; }

/* DARK theme: text on the dark canvas (between cards) goes light */
[data-theme="dark"] .view-intro {
  border-color: var(--border-onDark);
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: var(--ink-onDark-2);
}
[data-theme="dark"] .view-intro em { color: var(--ink-onDark-1); }
[data-theme="dark"] .section-header {
  color: var(--ink-onDark-1);
  border-bottom-color: var(--border-onDark);
}
[data-theme="dark"] .section-title { color: var(--ink-onDark-1); }
[data-theme="dark"] .section-sub,
[data-theme="dark"] .meta-row,
[data-theme="dark"] .meta-row * { color: var(--ink-onDark-2); }

.card, .pillar-card, .env-card, .n100-tile, .snowball-summary, .sub-summary-bar,
.sub-card, .svw-coach-box, .runway-savings-input, .runway-tile, .settings-card,
.modal, .history-panel, .vault-card, .security-card {
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card--pad { padding: 1.6rem; }
.card--accent, .card--gold, .card--green, .env-card--empty, .env-card--warning,
.sub-card--active {
  border-left: 1px solid var(--border);
}
.card--accent {
  background:
    linear-gradient(135deg, rgba(143,15,58,.12), transparent 42%),
    var(--surface-1);
}

.kpi-row--bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 1.2rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.kpi-row--bento .kpi {
  min-height: 172px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  padding: 1.7rem;
}
.kpi-row--bento .kpi:hover,
.card:hover, .env-card:hover, .pillar-card:hover, .n100-tile:hover, .sub-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-row--bento .kpi--hero {
  grid-column: span 3;
  min-height: 238px;
  justify-content: flex-end;
  background:
    linear-gradient(135deg, rgba(110,140,200,.10), rgba(170,150,220,.06) 60%, transparent),
    var(--surface-1);
}
.kpi-row--bento .kpi:not(.kpi--hero) { grid-column: span 1; }
.kpi-row--bento .kpi--hero .kpi-val {
  font-size: clamp(3rem, 6.6vw, 5rem);
  letter-spacing: -.055em;
}
.kpi-val { font-size: 2.35rem; letter-spacing: -.04em; }

.dash-grid, .n100-grid, .pillars-grid, .runway-grid {
  gap: 14px;
}
.dash-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.section-header {
  border-bottom-color: rgba(12,15,20,.06);
  padding-bottom: .85rem;
}
.section-title { font-size: 1.22rem; }
.tile-label, .kpi-label, .ob-label, .zbb-label, .ss-label, .sub-sum-label {
  letter-spacing: .11em;
}

.ob-btn, .ghost-btn, .gold-btn, .export-btn, .env-action-btn, .sub-action-btn, .vault-btn,
.vault-btn-outline, .currency-dropdown-btn, .theme-toggle {
  border-radius: 999px;
  transition: transform .18s var(--ease-out), box-shadow .18s, background .18s, border-color .18s, color .18s;
}

/* ══════════════════════════════════════════════════════════════════
   BUTTON HIERARCHY (UX spec, June 2026)
   Primary   — solid gold capsule, NO gradient (.gold-btn, .ob-btn)
               flat #dfae4a + dark ink = 7.4:1 contrast (WCAG AAA)
   Secondary — pill with light grey background (.ghost-btn, .ob-btn--ghost)
   Tertiary  — pill with white background (.export-btn)
══════════════════════════════════════════════════════════════════ */
.gold-btn,
.ob-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .78rem 1.6rem;
  font-family: var(--font-sans);
  font-size: .86rem;
  font-weight: 650;
  letter-spacing: .03em;
  text-transform: none;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  color: #2a1d05;
  background: #dfae4a;
  border: 1px solid rgba(184, 134, 11, .55);
  border-radius: 999px;
  box-shadow:
    0 2px 4px rgba(120, 85, 10, .14),
    0 10px 26px -12px rgba(184, 134, 11, .45);
  transition:
    transform .18s var(--ease-out),
    box-shadow .18s var(--ease-out),
    border-color .18s var(--ease-out),
    background .25s var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
}
.gold-btn:hover,
.ob-btn:hover {
  color: #1d1303;
  background: #e8ba58;
  border-color: rgba(184, 134, 11, .75);
  box-shadow:
    0 4px 8px rgba(120, 85, 10, .18),
    0 16px 34px -12px rgba(228, 179, 80, .55);
  transform: translateY(-1px);
}
.gold-btn:active,
.ob-btn:active {
  transform: translateY(0) scale(.985);
  box-shadow: 0 1px 2px rgba(120, 85, 10, .18);
}
.gold-btn:focus-visible,
.ob-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(228, 179, 80, .35),
    0 10px 26px -10px rgba(184, 134, 11, .55);
}
.gold-btn svg,
.ob-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.4; }

/* Size variants — same on every theme */
.gold-btn--lg,
.ob-btn--lg { padding: .95rem 1.9rem; font-size: .94rem; }
.gold-btn--sm,
.ob-btn--sm { padding: .58rem 1.2rem; font-size: .8rem; gap: .4rem; }

/* Accent variant kept for backward-compat but uses same capsule (already set) */
.ob-btn--accent { /* no override — keep gold capsule */ }

/* DARK theme: same flat gold capsule (designed for dark contrast too) */
[data-theme="dark"] .gold-btn,
[data-theme="dark"] .ob-btn {
  background: #dfae4a;
  border-color: rgba(255, 220, 140, .55);
  box-shadow:
    0 2px 4px rgba(0,0,0,.4),
    0 14px 32px -12px rgba(228, 179, 80, .45);
}
[data-theme="dark"] .gold-btn:hover,
[data-theme="dark"] .ob-btn:hover {
  background: #e8ba58;
  border-color: rgba(255, 230, 160, .8);
  box-shadow:
    0 4px 8px rgba(0,0,0,.45),
    0 20px 40px -12px rgba(228, 179, 80, .6);
}
/* .vault-btn keeps the dark slate primary look — separate from .ob-btn capsule */
.vault-btn {
  background: #141a28;
  color: #f3f5fa;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), var(--shadow-md);
}
.ghost-btn:hover, .export-btn:hover, .env-action-btn:hover,
.sub-action-btn:hover, .currency-dropdown-btn:hover, .theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.ob-input-wrap, .ob-input--full, .field-select, .form-input, .vault-input {
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  box-shadow: inset 0 1px 2px rgba(12,15,20,.04);
}
.ob-input-wrap:focus-within, .ob-input--full:focus, .field-select:focus,
.form-input:focus, .vault-input:focus {
  border-color: rgba(143,15,58,.5);
  box-shadow: 0 0 0 4px rgba(143,15,58,.12), inset 0 1px 2px rgba(12,15,20,.04);
}

.env-grid, .sub-grid {
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 14px;
}
.env-card, .sub-card {
  position: relative;
  overflow: hidden;
  min-height: 188px;
  background: var(--surface-1);
}
/* Let the kebab dropdown escape the card's clipping while it's open */
.env-card:has(.card-menu[open]),
.sub-card:has(.card-menu[open]),
.flex-fund-card:has(.card-menu[open]) {
  overflow: visible;
  z-index: 5;
}
/* Top highlight line removed per UX spec (June 2026) */

/* ── CARD KEBAB MENU (three-dot actions dropdown, UX spec) ───────── */
.card-menu { position: relative; display: inline-block; margin-left: auto; }
.card-menu-trigger {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s;
}
.card-menu-trigger::-webkit-details-marker { display: none; }
.card-menu-trigger:hover { background: var(--surface-2); border-color: var(--border-md); color: var(--ink-1); }
.card-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: var(--surface-1);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.card-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: .5rem .7rem;
  font: 600 .8rem/1.2 var(--font-sans);
  color: var(--ink-1);
  cursor: pointer;
  transition: background .12s;
}
.card-menu-item:hover { background: var(--surface-2); }
.card-menu-item--danger { color: var(--red); }
.card-menu-item--danger:hover { background: var(--red-dim); }
[data-theme="dark"] .card-menu-trigger { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--ink-onDark-1); }
[data-theme="dark"] .card-menu-pop { background: var(--surface-2); border-color: rgba(255,255,255,.14); }
[data-theme="dark"] .card-menu-item { color: var(--ink-onDark-1); }
[data-theme="dark"] .card-menu-item:hover { background: rgba(255,255,255,.08); }
/* Goals card action row (primary action + kebab) */
.env-actions { display: flex; gap: .4rem; align-items: center; margin-top: .25rem; }
.env-actions .env-action-btn { flex: 1; }

/* ── PREMIUM FEATURE HIGHLIGHT (UX spec) ─────────────────────────── */
.premium-tag {
  display: inline-flex;
  align-items: center;
  margin-left: .45rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: rgba(42,29,5,.85);
  color: #f5dfa6;
}
.btn--premium { box-shadow: 0 0 0 2px rgba(184,134,11,.25), 0 2px 4px rgba(120,85,10,.14); }

/* Premium feature spotlight slot (e.g. empty states reserved for upsell) */
.premium-spotlight {
  max-width: 460px;
  margin: 0 auto;
  padding: 1.15rem 1.3rem;
  border: 1px solid rgba(184,134,11,.35);
  border-radius: var(--radius);
  background: var(--gold-dim);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-items: center;
}
.premium-spotlight-kicker {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--gold-deep, #8a6308);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.premium-spotlight-kicker .premium-tag { margin-left: 0; }
.premium-spotlight-text { font-size: .83rem; color: var(--ink-2); line-height: 1.6; }
[data-theme="dark"] .premium-spotlight { background: rgba(212,168,67,.08); border-color: rgba(212,168,67,.3); }
[data-theme="dark"] .premium-spotlight-kicker { color: var(--gold-light); }

/* ── TIER LOCKS (UI-only gating) ─────────────────────────────────── */
.tier-locked { position: relative; }
.tier-locked > *:not(.tier-lock) {
  filter: blur(3px) saturate(.85);
  pointer-events: none;
  user-select: none;
}
.tier-lock {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(2rem, 12vh, 7rem);
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.65));
  border-radius: inherit;
}
[data-theme="dark"] .tier-lock { background: linear-gradient(180deg, rgba(10,13,20,.45), rgba(10,13,20,.7)); }
.tier-lock-card {
  max-width: 420px;
  margin: 0 1rem;
  padding: 1.6rem 1.8rem;
  background: var(--surface-1);
  border: 1px solid rgba(184,134,11,.4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
.tier-lock-title { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 500; color: var(--ink-1); }
.tier-lock-text { font-size: .85rem; color: var(--ink-2); line-height: 1.6; }
[data-theme="dark"] .tier-lock-card { background: var(--surface-2); }
[data-theme="dark"] .tier-lock-title { color: var(--ink-onDark-1); }
[data-theme="dark"] .tier-lock-text { color: var(--ink-onDark-2); }

/* ── UPGRADE MODAL — plan cards ─────────────────────────────────── */
.modal--upgrade { max-width: 760px; width: min(760px, 94vw); }
.tier-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem;
  margin: 1.1rem 0;
}
.tier-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  background: var(--surface-1);
}
.tier-card--featured {
  border-color: rgba(184,134,11,.6);
  box-shadow: 0 0 0 2px rgba(184,134,11,.18), var(--shadow-md);
  background: var(--gold-dim, rgba(184,134,11,.06));
}
.tier-card-flag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: #dfae4a;
  color: #2a1d05;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tier-card-flag--soon { background: var(--surface-3); color: var(--ink-2); }
.tier-card-name { font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.tier-card-price { font-family: var(--font-serif); font-size: 1.5rem; color: var(--ink-1); }
.tier-card-price small { font-size: .75rem; color: var(--ink-3); }
.tier-card-list { list-style: none; margin: .25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.tier-card-list li { font-size: .76rem; color: var(--ink-2); line-height: 1.45; padding-left: 1rem; position: relative; }
.tier-card-list li::before { content: '✓'; position: absolute; left: 0; color: var(--gold-deep, #8a6308); font-weight: 700; }
.tier-card-cta { margin-top: auto; align-self: stretch; }
.tier-waitlist { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; }
.tier-waitlist .ob-input--full { flex: 1; min-width: 200px; }
.tier-modal-note { font-size: .74rem; color: var(--ink-3); margin-top: .6rem; line-height: 1.5; }
@media (max-width: 720px) { .tier-cards { grid-template-columns: 1fr; } }
[data-theme="dark"] .tier-card { background: var(--surface-2); border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .tier-card--featured { background: rgba(212,168,67,.08); border-color: rgba(212,168,67,.4); }

/* ── LAUNCH TRIAL BANNER ────────────────────────────────────────── */
.trial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: .7rem 1.1rem;
  border: 1px solid rgba(184,134,11,.4);
  border-radius: var(--radius);
  background: var(--gold-dim, rgba(184,134,11,.08));
}
.trial-banner-text { font-size: .84rem; color: var(--ink-1); line-height: 1.5; }
.trial-banner-actions { display: inline-flex; align-items: center; gap: .5rem; }
.trial-banner-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: .2rem .4rem;
}
.trial-banner-close:hover { color: var(--ink-1); }
[data-theme="dark"] .trial-banner { background: rgba(212,168,67,.08); border-color: rgba(212,168,67,.35); }
[data-theme="dark"] .trial-banner-text { color: var(--ink-onDark-1); }
.env-card > *, .sub-card > * { position: relative; }
.env-card-pillar, .sub-card-status {
  border-radius: 999px;
  background: var(--surface-2);
}
.env-card-actions, .sub-card-actions { gap: .5rem; }
.env-action-btn, .sub-action-btn {
  background: var(--surface-1);
  border-color: var(--border-md);
}
.env-action-btn--gold { background: #dfae4a; border-color: rgba(184,134,11,.55); color: #2a1d05; }

.snowball-list {
  gap: 0;
  padding: .75rem 0 1.5rem;
}
.snowball-card {
  border-radius: var(--radius-lg);
  margin-bottom: -8px;
  transform: rotate(var(--tilt, 0deg));
  background: var(--surface-1);
}
.snowball-card:nth-child(odd) { --tilt: -.35deg; }
.snowball-card:nth-child(even) { --tilt: .35deg; }
.snowball-card--target {
  --tilt: 0deg;
  position: relative;
  z-index: 2;
  background:
    linear-gradient(135deg, rgba(143,15,58,.12), transparent 44%),
    var(--surface-1);
  box-shadow: var(--shadow-lg);
}
.snowball-rank {
  border-radius: 16px;
}

/* Background gradients removed per UX spec (June 2026) — flat surface */
.svw-coach-box, .runway-hero {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
}
.svw-coach-icon {
  border-radius: 18px;
  background: var(--surface-2);
}
.runway-hero {
  padding: clamp(2rem, 6vw, 4rem);
  overflow: hidden;
}
.runway-days {
  font-size: clamp(4.5rem, 14vw, 8rem);
  line-height: .86;
  letter-spacing: -.07em;
}
/* Grey box treatment removed per UX spec (June 2026) — flat white tiles */
.runway-tile, .runway-savings-input {
  background: var(--surface-1);
}

.modal-bg {
  background: rgba(18,15,12,.26);
  backdrop-filter: var(--blur-modal);
  -webkit-backdrop-filter: var(--blur-modal);
}
.modal {
  border-radius: var(--radius-xl);
  animation: modalSlideUp .26s var(--ease-spring);
}
.history-panel {
  margin: 16px;
  height: calc(100vh - 32px);
  border-radius: var(--radius-xl);
  background: var(--chrome-strong);
  backdrop-filter: var(--blur-chrome);
}
.currency-dropdown {
  background: var(--chrome-strong);
  backdrop-filter: var(--blur-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  border-radius: 18px;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(12vh, 96px);
  background: rgba(18,15,12,.24);
  backdrop-filter: var(--blur-modal);
  -webkit-backdrop-filter: var(--blur-modal);
}
.command-palette.open { display: flex; }
.command-palette-card {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--chrome-strong);
  box-shadow: var(--shadow-xl);
  padding: .85rem;
}
.command-palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .25rem .45rem .7rem;
}
.command-palette-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  font-weight: 700;
}
.command-palette-shortcut {
  font-size: .72rem;
  color: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .18rem .55rem;
  background: rgba(255,255,255,.45);
}
.command-palette-input {
  width: 100%;
  border: 1px solid var(--border-md);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: rgba(255,255,255,.72);
  color: var(--ink-1);
  outline: none;
  font-size: 1rem;
}
.command-palette-results {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-top: .65rem;
}
.command-item {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--ink-1);
  padding: .78rem .9rem;
  text-align: left;
  cursor: pointer;
}
.command-item:hover {
  background: rgba(255,255,255,.58);
  border-color: var(--border);
}
.command-item-title { font-weight: 650; }
.command-item-detail { font-size: .8rem; color: var(--ink-3); }
.command-empty { padding: 1rem; color: var(--ink-3); font-size: .9rem; }

/* ── WORKSPACE CONTAINMENT (Apple-style centered column) ─────────── */
:root {
  --workspace-max: 1280px;
  --workspace-gutter: clamp(20px, 4vw, 56px);
}
.main-content {
  margin-left: 0;
  padding-left: calc(284px + var(--workspace-gutter));
  padding-right: var(--workspace-gutter);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.topbar, .content-area {
  width: 100%;
  max-width: var(--workspace-max);
}
.topbar { margin: 0 auto 14px; }
.content-area { padding: .25rem 0 2rem; }

/* ── TODAY focal anchor ─────────────────────────────────────────── */
.today-hero {
  position: relative;
  margin-bottom: 14px;
  padding: clamp(1.1rem, 2.2vw, 1.7rem) clamp(1.4rem, 2.6vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  isolation: isolate;
}
.today-hero-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(135deg, rgba(110,140,200,.10), rgba(170,150,220,.06) 60%, transparent),
    linear-gradient(180deg, transparent 60%, rgba(12,15,20,.025));
}
.today-hero-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.today-hero-meta {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink-3);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
}
.today-hero-eyebrow { color: var(--ink-2); }
.today-hero-dot {
  width: 4px; height: 4px;
  border-radius: 999px;
  background: var(--ink-4);
}
.today-hero-month { color: var(--ink-3); }
.today-hero-greeting {
  font-family: var(--font-sans);
  font-size: .92rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-top: .1rem;
}
.today-hero-figure {
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 6.4vw, 5.4rem);
  line-height: .94;
  letter-spacing: -.055em;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
  margin: .2rem 0 .4rem;
}
.today-hero-context {
  font-size: .92rem;
  color: var(--ink-2);
  max-width: 56ch;
  line-height: 1.55;
}

/* ── Executive hero: top row (greeting + date) + 3 metrics row ─────── */
.today-hero--exec .today-hero-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}
.today-hero--exec .today-hero-greeting {
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 3.2vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.08;
  color: var(--ink-1);
  margin: 0;
}
.today-hero--exec .today-hero-date {
  margin: 0;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.today-hero--exec .today-hero-context {
  margin: 0;
  font-size: .9rem;
  color: var(--ink-2);
  max-width: 64ch;
}
.today-hero-metrics {
  margin-top: clamp(1rem, 2vw, 1.4rem);
  padding-top: clamp(.9rem, 1.6vw, 1.15rem);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: clamp(.7rem, 1.5vw, 1.4rem);
}
.thm {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
  opacity: 0;
  transform: translateY(6px);
  animation: thmIn .6s var(--ease-out) both;
}
.thm:nth-child(1) { animation-delay: .05s; }
.thm:nth-child(3) { animation-delay: .15s; }
.thm:nth-child(5) { animation-delay: .25s; }
@keyframes thmIn {
  to { opacity: 1; transform: translateY(0); }
}
.thm-label {
  font-size: .85rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
}
.thm-value {
  font-family: var(--font-serif);
  font-size: 3rem;
  line-height: 1.05;
  letter-spacing: -.025em;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Accent the "Available" cell with a subtle gold gradient — the page's hero number */
.thm--accent .thm-value {
  background: linear-gradient(95deg, var(--gold) 0%, var(--gold-light) 60%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.thm--accent .thm-label { color: var(--gold); }
.thm-sep {
  width: 1px;
  height: clamp(34px, 5vw, 48px);
  background: var(--border);
  border-radius: 1px;
}

/* Stack metrics on narrow screens */
@media (max-width: 720px) {
  .today-hero-metrics {
    grid-template-columns: 1fr;
    gap: .75rem;
  }
  .thm-sep { display: none; }
  .thm { padding: .3rem 0; }
  .today-hero--exec .today-hero-date { font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .thm { animation: none; opacity: 1; transform: none; }
}
[data-theme="dark"] .today-hero-wash {
  background:
    radial-gradient(circle at 12% 14%, rgba(143,15,58,.36), transparent 38%),
    radial-gradient(circle at 88% 0%, rgba(184,134,11,.22), transparent 42%);
}

/* ── Quieter supporting KPI bento (compact mode) ─────────────────── */
.kpi-row--compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}
.kpi-row--compact .kpi {
  min-height: 116px;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
}
.kpi-row--compact .kpi-val { font-size: 1.55rem; }
.kpi-row--compact .kpi:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ── BENTO COMPOSITION (dashboard) ───────────────────────────────── */
.bento {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.bento-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.bento-card { box-shadow: var(--shadow-md); }
.bento-card--allocation { flex: 0 0 auto; }
.bento-card--health {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 260px;
}
.bento-card--health .env-health-list {
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
  margin: 0 -1.6rem -1.6rem;
  padding: 0 1.6rem 1rem;
}
.env-health-list--inset .env-health-row {
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.env-health-list--inset .env-health-row:last-child { border-bottom: none; }

/* Right supporting column — KPI stack (inset grouped list pattern) */
.kpi-stack {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.kpi-row-mini {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.3rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.kpi-row-mini:last-child { border-bottom: none; }
.kpi-row-mini:hover { background: var(--surface-2); }
.kpi-row-mini .kpi-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 700;
  color: var(--ink-3);
}
.kpi-row-mini .kpi-val {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  letter-spacing: -.02em;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.kpi-row-mini.kpi--alloc .kpi-val { color: var(--blue); }
.kpi-row-mini.kpi--spent .kpi-val { color: var(--red); }
.kpi-row-mini.kpi--free  .kpi-val { color: var(--green); }

.bento-card--insight {
  flex: 1 1 auto;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (max-width: 1100px) {
  #screen-app { padding: 0; }
  .sidebar { display: none; }
  .main-content {
    margin-left: 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 12px;
  }
  .topbar { border-radius: 24px; }
  .kpi-row--bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row--bento .kpi, .kpi-row--bento .kpi--hero { grid-column: span 1; }
  .kpi-row--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento { grid-template-columns: 1fr; }
  .bento-col--side .kpi-stack { display: grid; grid-template-columns: repeat(2, 1fr); }
  .bento-col--side .kpi-row-mini { border-bottom: none; border-right: 1px solid var(--border); }
  .bento-col--side .kpi-row-mini:nth-child(2n) { border-right: none; }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .topbar { align-items: flex-start; gap: .9rem; flex-direction: column; }
  .topbar-right { width: 100%; overflow-x: auto; padding-bottom: .2rem; }
  .content-area { padding: 0 0 5.5rem; }
  .kpi-row--bento, .dash-grid, .n100-grid, .pillars-grid, .runway-grid {
    grid-template-columns: 1fr;
  }
  .kpi-row--bento .kpi--hero { min-height: 190px; }
  .kpi-row--compact { grid-template-columns: 1fr; }
  .today-hero { padding: 1.2rem 1.3rem; }
  .today-hero-figure { font-size: clamp(2.2rem, 9vw, 3.2rem); }
  .bento-col--side .kpi-stack { grid-template-columns: 1fr; }
  .bento-col--side .kpi-row-mini { border-right: none; border-bottom: 1px solid var(--border); }
  .bento-col--side .kpi-row-mini:last-child { border-bottom: none; }
}

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR ACCORDION + UTILITY DRAWER
   Premium grouped navigation · quiet topbar tools
══════════════════════════════════════════════════════════════════ */
.sb-group {
  list-style: none;
  margin: .25rem 0 .4rem;
}
.sb-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .75rem;
  border-radius: 12px;
  font: 700 .68rem/1 var(--font-sans);
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .16s var(--ease-out), color .16s var(--ease-out);
}
.sb-group-toggle:hover {
  background: var(--surface-2);
  color: var(--ink-1);
}
.sb-group-chevron {
  font-size: .85rem;
  opacity: .65;
  transform: rotate(-90deg);
  transition: transform .18s var(--ease-out), opacity .18s;
}
.sb-group--open .sb-group-chevron {
  transform: rotate(0deg);
  opacity: 1;
}
.sb-group-items {
  list-style: none;
  margin: .2rem 0 0;
  padding: 0;
  display: none;
}
.sb-group--open .sb-group-items {
  display: block;
}
.sb-group .sb-item {
  margin: .18rem 0;
}

.topbar-right {
  position: relative;
}
.utility-trigger {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--ink-1);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .16s var(--ease-out), box-shadow .16s, background .16s;
}
.utility-trigger:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.utility-trigger span {
  width: 15px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
}
.utility-drawer {
  position: absolute;
  top: calc(100% + .75rem);
  right: 0;
  width: min(380px, calc(100vw - 2rem));
  max-height: min(76vh, 720px);
  overflow: auto;
  z-index: 50;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  box-shadow: var(--shadow-xl);
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(.98);
  transform-origin: top right;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}
.utility-drawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.utility-drawer--exports {
  width: auto;
  min-width: 300px;
  max-width: calc(100vw - 2rem);
}
.export-bar--drawer {
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.export-bar--drawer .export-btn {
  white-space: nowrap;
}
.utility-drawer-head {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .35rem .35rem .8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .75rem;
}
.utility-kicker,
.utility-label {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.utility-drawer-head strong {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink-1);
}
.utility-section {
  padding: .75rem .35rem;
  border-bottom: 1px solid var(--border);
}
.utility-section:last-child {
  border-bottom: 0;
}
.utility-section--row,
.utility-actions,
.utility-grid {
  display: grid;
  gap: .45rem;
}
.utility-section--row,
.utility-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.utility-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: .55rem;
}
.utility-action,
.utility-drawer .currency-opt {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--ink-2);
  min-height: 38px;
  padding: .55rem .75rem;
  font: 700 .78rem/1.1 var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.utility-action:hover,
.utility-drawer .currency-opt:hover,
.utility-drawer .currency-opt.active {
  background: var(--surface-2);
  border-color: var(--border-md);
  color: var(--ink-1);
  transform: translateY(-1px);
}
.utility-drawer .theme-toggle {
  display: none;
}
[data-theme="dark"] .utility-drawer {
  background: rgba(12,15,22,.88);
  border-color: rgba(255,255,255,.10);
}
[data-theme="dark"] .utility-trigger,
[data-theme="dark"] .utility-action,
[data-theme="dark"] .utility-drawer .currency-opt {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
}
[data-theme="dark"] .utility-action:hover,
[data-theme="dark"] .utility-drawer .currency-opt:hover,
[data-theme="dark"] .utility-drawer .currency-opt.active {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
}

.case-modal-bg {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(8,10,15,.46);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}
.case-modal-bg.open {
  display: flex;
  animation: modalFadeIn .18s var(--ease-out);
}
.calendar-case-card {
  width: min(560px, 100%);
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), transparent 32%),
    var(--surface-1);
  box-shadow: var(--shadow-xl);
  padding: 1.55rem;
  position: relative;
  animation: premiumViewIn .28s var(--ease-out);
}
.case-close {
  position: absolute;
  top: .85rem;
  right: .85rem;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border-md);
  background: var(--surface-2);
  color: var(--ink-1);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.case-close:hover {
  background: var(--surface-3);
  border-color: var(--border-hi);
}
.case-kicker {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-right: 2.4rem;
}
.case-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 500;
  line-height: 1.05;
  color: var(--ink-1);
  margin: .45rem 2rem .4rem 0;
}
.case-meta {
  color: var(--ink-2);
  font-size: .9rem;
  line-height: 1.5;
}
.case-amount {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  color: var(--gold, #b8860b);
  font-variant-numeric: tabular-nums;
  margin: .9rem 0 .85rem;
}
.case-note-label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .45rem;
}
.case-note {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--ink-1);
  padding: .9rem 1rem;
  font: 500 .92rem/1.55 var(--font-sans);
  outline: none;
}
.case-note:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.case-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
[data-theme="dark"] .calendar-case-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), transparent 34%),
    var(--surface-1);
  border-color: rgba(255,255,255,.10);
}
[data-theme="dark"] .case-note {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.10);
  color: var(--ink-1);
}
[data-theme="dark"] .case-close {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
  color: var(--ink-1);
  z-index: 2;
}
[data-theme="dark"] .case-close:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.30);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════════
   LIVE CLOCK WIDGET — top-right of topbar
   Compact · monochrome · tabular-nums · frosted glass
══════════════════════════════════════════════════════════════════ */
.live-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 140px;
  padding: .42rem .85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--chrome-strong, rgba(255,255,255,.6));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  font-variant-numeric: tabular-nums;
  user-select: none;
  transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.topbar-right .live-clock {
  flex: 0 0 auto;
  margin-right: .15rem;
}
.live-clock:hover { border-color: var(--border-md); }
.live-clock-date {
  font-family: var(--font-sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-3);
  text-transform: none;
  line-height: 1.1;
  white-space: nowrap;
}
.live-clock-time {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-1);
  line-height: 1.15;
  white-space: nowrap;
}
.live-clock--cycle-end {
  border-color: rgba(184,134,11,.45);
  box-shadow: 0 0 0 3px rgba(184,134,11,.08);
}
.live-clock--cycle-end .live-clock-time { color: var(--gold, #b8860b); }

[data-theme="dark"] .live-clock {
  background: var(--chrome-strong);
  border-color: var(--border-md);
  box-shadow: 0 1px 6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
}
[data-theme="dark"] .live-clock:hover {
  background: rgba(32,38,52,.95);
  border-color: var(--border-hi);
}
[data-theme="dark"] .live-clock-date { color: var(--ink-2); }
[data-theme="dark"] .live-clock-time { color: var(--ink-1); }
[data-theme="dark"] .live-clock--cycle-end {
  border-color: rgba(212,168,67,.55);
  box-shadow: 0 0 0 3px rgba(212,168,67,.12);
}
[data-theme="dark"] .live-clock--cycle-end .live-clock-time { color: var(--gold-light); }

/* Debt panels should read as clean professional cards, not tilted notes. */
.snowball-list {
  gap: .9rem;
  padding: .75rem 0 1.5rem;
}
.snowball-card,
.snowball-card:nth-child(odd),
.snowball-card:nth-child(even),
.snowball-card--target {
  transform: none;
  margin-bottom: 0;
}
.snowball-card {
  grid-template-columns: auto minmax(0, 1fr) minmax(190px, auto);
  align-items: flex-start;
}
.snowball-info,
.snowball-right {
  min-width: 0;
}
.snowball-meta,
.snowball-payment {
  line-height: 1.45;
}

@media (max-width: 720px) {
  .live-clock { min-width: 0; padding: .35rem .65rem; }
  .live-clock-date { font-size: .6rem; }
  .live-clock-time { font-size: .88rem; }
}

/* ══════════════════════════════════════════════════════════════════
   CALENDAR MODULE
   Month grid · color event dots · today highlight · detail panel
══════════════════════════════════════════════════════════════════ */
.calendar-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 1.2rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
}
.cal-toolbar-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.cal-nav-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-md);
  color: var(--ink-1);
}
.cal-nav-btn:active { transform: scale(.94); }
.cal-today-btn {
  padding: 0 .9rem;
  width: auto;
  height: 36px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
}
.cal-month-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink-1);
  text-align: left;
  margin: 0;
}
.cal-jump {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.cal-jump-control {
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--ink-1);
  padding: 0 .75rem;
  font: 700 .78rem/1 var(--font-sans);
  outline: none;
  box-shadow: var(--shadow-sm);
}
.cal-jump-year {
  width: 82px;
  font-variant-numeric: tabular-nums;
}
.cal-view-switcher {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 3px;
  gap: 2px;
}
.cal-view-switcher button {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  padding: .42rem .9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cal-view-switcher button:hover { color: var(--ink-1); }
.cal-view-switcher button.active {
  background: var(--surface-1);
  color: var(--ink-1);
  box-shadow: var(--shadow-sm);
}
.cal-legend {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-size: .72rem;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: .02em;
}
.cal-legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.cal-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ink-3);
  flex-shrink: 0;
}
.cal-dot--bill  { background: var(--accent); }
.cal-dot--debt  { background: var(--red); }
.cal-dot--goal  { background: var(--green); }
.cal-dot--cycle { background: var(--gold, #b8860b); }
.cal-dot--income{ background: var(--blue); }

.calendar-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cal-weekday {
  padding: .65rem .8rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
  color: var(--ink-3);
  text-align: left;
}
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(128px, 1fr);
}
.cal-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: .75rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-height: 128px;
  background: var(--surface-1);
  cursor: pointer;
  transition: background .15s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.cal-day--out {
  background: var(--surface-2);
  opacity: .55;
}
.cal-day.cal-day--out:hover { opacity: .85; background: var(--surface-3); }
.cal-day-num {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cal-day--today .cal-day-num {
  background: var(--gold, #b8860b);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  box-shadow: 0 4px 10px -4px rgba(184,134,11,.55);
}
.cal-day--selected {
  background: linear-gradient(180deg, var(--accent-dim), transparent 70%), var(--surface-1);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── PAYMENT DAY GLOW ─────────────────────────────────────────── */
.cal-day--payday {
  background: linear-gradient(180deg, rgba(184,134,11,.10), transparent 75%), var(--surface-1);
}
.cal-day--payday::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold, #b8860b);
  opacity: .8;
}
.cal-day { position: relative; }
.cal-pay-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--gold, #b8860b);
  background: rgba(184,134,11,.14);
  border-radius: 999px;
  vertical-align: middle;
}
.cal-day--payday-today {
  animation: calPaydayPulse 2.4s ease-in-out infinite;
}
.cal-day--payday-today .cal-pay-badge {
  color: #fff;
  background: var(--gold, #b8860b);
}
@keyframes calPaydayPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(184,134,11,.35), 0 0 0 0 rgba(184,134,11,.0); }
  50%      { box-shadow: inset 0 0 0 1px rgba(184,134,11,.6), 0 0 16px -2px rgba(184,134,11,.5); }
}

/* AI focus highlight — when the companion scrolls to & spotlights an item */
.ai-focus-pulse {
  animation: aiFocusPulse 2.4s ease-in-out;
  border-radius: 14px;
  position: relative;
  z-index: 2;
}
@keyframes aiFocusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(184,134,11,.0), inset 0 0 0 0 rgba(184,134,11,0); }
  18%  { box-shadow: 0 0 0 4px rgba(184,134,11,.30), inset 0 0 0 2px rgba(184,134,11,.55); }
  60%  { box-shadow: 0 0 22px -2px rgba(184,134,11,.55), inset 0 0 0 2px rgba(184,134,11,.55); }
  100% { box-shadow: 0 0 0 0 rgba(184,134,11,.0), inset 0 0 0 0 rgba(184,134,11,0); }
}
.cal-week-day--payday {
  background: linear-gradient(180deg, rgba(184,134,11,.10), transparent 80%), var(--surface-1);
}
.cal-week-day--payday-today {
  animation: calPaydayPulse 2.4s ease-in-out infinite;
}
[data-theme="dark"] .cal-day--payday,
[data-theme="dark"] .cal-week-day--payday {
  background: linear-gradient(180deg, rgba(184,134,11,.18), transparent 75%), var(--surface-1);
}
.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.cal-event-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--ink-2);
  padding: .28rem .55rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.cal-event-chip strong {
  font-weight: 600;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.cal-event-chip--bill  { border-left: 3px solid var(--accent); }
.cal-event-chip--debt  { border-left: 3px solid var(--red); }
.cal-event-chip--goal  { border-left: 3px solid var(--green); }
.cal-event-chip--cycle { border-left: 3px solid var(--gold, #b8860b); }
.cal-event-chip--income{ border-left: 3px solid var(--blue); }
.cal-day-more {
  font-size: .65rem;
  color: var(--ink-3);
  font-weight: 600;
  padding: 0 .3rem;
}

/* Week view */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-week-day {
  border-right: 1px solid var(--border);
  padding: 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-height: 420px;
  background: var(--surface-1);
}
.cal-week-day:last-child { border-right: none; }
.cal-week-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border);
}
.cal-week-day-name {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
  color: var(--ink-3);
}
.cal-week-day-num {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.cal-week-day--today .cal-week-day-num { color: var(--gold, #b8860b); }
.cal-week-day-events { display: flex; flex-direction: column; gap: .4rem; }

/* Agenda view */
.cal-agenda {
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.cal-agenda-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.cal-agenda-date {
  padding: .8rem 1.1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink-1);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.cal-agenda-weekday {
  font-family: var(--font-sans);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
  color: var(--ink-3);
}
.cal-agenda-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.cal-agenda-row:hover { background: var(--surface-2); }
.cal-agenda-row:last-child { border-bottom: none; }
.cal-agenda-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-agenda-row-icon .cal-dot { width: 9px; height: 9px; }
.cal-agenda-row-title {
  font-size: .92rem;
  color: var(--ink-1);
  font-weight: 500;
}
.cal-agenda-row-sub {
  font-size: .76rem;
  color: var(--ink-3);
  margin-top: .15rem;
}
.cal-agenda-row-amt {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}

/* Detail panel */
.calendar-detail {
  margin-top: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  padding: 1.2rem 1.4rem;
  display: none;
}
.calendar-detail.open { display: block; animation: fadeUp .25s var(--ease-out); }
.calendar-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .9rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--border);
}
.calendar-detail-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  letter-spacing: -.01em;
  color: var(--ink-1);
}
.calendar-detail-sub {
  font-size: .78rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
}
.calendar-detail-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.calendar-detail-empty {
  padding: 1.4rem 0;
  text-align: center;
  font-size: .9rem;
  color: var(--ink-3);
  font-style: italic;
}

/* Day-detail panel close — distinct from month nav buttons */
.calendar-detail-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  margin-left: .75rem;
  border-radius: 999px;
  border: 1px solid var(--border-md);
  background: var(--surface-2);
  color: var(--ink-1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.calendar-detail-close:hover {
  background: var(--surface-3);
  border-color: var(--border-hi);
  color: var(--ink-1);
}
.calendar-detail-close:active { transform: scale(.94); }
.calendar-detail-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Dark theme overrides */
[data-theme="dark"] .calendar-toolbar,
[data-theme="dark"] .calendar-grid,
[data-theme="dark"] .calendar-detail,
[data-theme="dark"] .cal-week-day,
[data-theme="dark"] .cal-day,
[data-theme="dark"] .cal-agenda-group {
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 30%),
    var(--surface-1);
}
[data-theme="dark"] .cal-weekday-row,
[data-theme="dark"] .cal-agenda-date {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.06);
}
[data-theme="dark"] .cal-day.cal-day--out { background: rgba(255,255,255,.015); opacity: .5; }
[data-theme="dark"] .cal-event-chip {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
}
[data-theme="dark"] .cal-view-switcher { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .cal-view-switcher button.active { background: rgba(255,255,255,.10); color: var(--ink-1); }
[data-theme="dark"] .cal-jump {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
}
[data-theme="dark"] .cal-jump-control {
  background: rgba(255,255,255,.08);
  color: var(--ink-1);
}
[data-theme="dark"] .cal-nav-btn {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.10);
  color: var(--ink-2);
}
[data-theme="dark"] .cal-nav-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
  color: var(--ink-1);
}
[data-theme="dark"] .calendar-detail-close {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
  color: var(--ink-1);
}
[data-theme="dark"] .calendar-detail-close:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.30);
  color: #fff;
}
[data-theme="dark"] .calendar-detail-title,
[data-theme="dark"] .calendar-detail-sub {
  color: var(--ink-1);
}
[data-theme="dark"] .calendar-detail-sub { color: var(--ink-2); }
[data-theme="dark"] .calendar-detail-empty { color: var(--ink-2); }

/* Responsive */
@media (max-width: 1100px) {
  .calendar-toolbar {
    grid-template-columns: 1fr;
    gap: .6rem;
  }
  .cal-toolbar-nav { justify-content: space-between; }
  .cal-month-grid { grid-auto-rows: minmax(96px, auto); }
  .cal-day { min-height: 96px; }
  .cal-event-chip { font-size: .68rem; }
  .cal-day-events { max-height: 72px; }
}
@media (max-width: 720px) {
  .cal-month-grid { grid-auto-rows: minmax(64px, auto); }
  .cal-day { min-height: 64px; }
  .cal-day { padding: .35rem .4rem; }
  .cal-day-num { font-size: .8rem; }
  .cal-day--today .cal-day-num { width: 22px; height: 22px; font-size: .72rem; }
  .cal-day-events { display: none; }
  .cal-day-mobile-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
  }
  .cal-week-grid { grid-template-columns: 1fr; }
  .cal-week-day { border-right: none; border-bottom: 1px solid var(--border); min-height: 0; }
}
@media (min-width: 721px) {
  .cal-day-mobile-dots { display: none; }
}

/* ═══════════════════════════════════════════════════════
   WORKBOOK — Apple Numbers-grade spreadsheet view
═══════════════════════════════════════════════════════ */
.workbook {
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 12px 36px -22px rgba(12,15,20,.18);
  min-height: max(680px, calc(100vh - 13rem));
}

/* Toolbar */
.wb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border-bottom: 1px solid var(--border);
}
.wb-toolbar-left, .wb-toolbar-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.wb-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
}
.wb-search-icon {
  position: absolute;
  left: .65rem;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2;
  pointer-events: none;
}
.wb-search-input {
  width: 100%;
  padding: .5rem .75rem .5rem 2rem;
  border: 1px solid var(--border-md);
  border-radius: 8px;
  background: var(--surface-1);
  font: 500 .85rem var(--font-sans);
  color: var(--ink-1);
  transition: border-color .15s, box-shadow .15s;
}
.wb-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53,122,189,.18);
}
.wb-mode-toggle, .wb-export-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .8rem;
  border: 1px solid var(--border-md);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--ink-1);
  font: 600 .8rem var(--font-sans);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.wb-mode-toggle svg, .wb-export-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wb-mode-toggle:hover, .wb-export-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-hi);
}
.wb-mode-toggle:active, .wb-export-btn:active {
  transform: translateY(1px);
}
.wb-mode-toggle.is-editing {
  background: #dfae4a;
  border-color: #d9a543;
  color: #2a1d05;
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 6px 14px -8px rgba(184,134,11,.6);
}

/* Frame & table wrap */
.wb-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-1);
}
.wb-table-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Story header — insight strip above a sheet (lead with the takeaway) */
.wb-story {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.1rem 1.4rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-md);
  flex-wrap: wrap;
}
.wb-story--empty { justify-content: flex-start; }
.wb-story-main {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  min-width: 0;
  flex-wrap: wrap;
}
.wb-story-kpi { display: flex; align-items: baseline; gap: .5rem; }
.wb-story-kpi-val {
  font: 600 1.9rem var(--font-serif);
  color: var(--ink-1);
  line-height: 1;
  letter-spacing: -.01em;
}
.wb-story-kpi-cap { font: 500 .8rem var(--font-sans); color: var(--ink-3); }
.wb-story-verdict { font: 500 .9rem var(--font-sans); color: var(--ink-2); }
.wb-story-verdict--ok { color: var(--green); }
.wb-story-verdict--warn { color: var(--gold); }
.wb-story-verdict--bad { color: var(--red); }

.wb-story-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .7rem 1.1rem;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
}
.wb-story-bar-top {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font: 500 .68rem var(--font-sans);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .3rem;
  white-space: nowrap;
}
.wb-story-track {
  display: block;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.wb-story-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .4s var(--ease-out);
}
.wb-story-fill.is-over { background: var(--red); }

@media (max-width: 760px) {
  .wb-story { gap: 1rem; }
  .wb-story-kpi-val { font-size: 1.5rem; }
  .wb-story-bars { max-width: none; }
}

/* Charts (trend visuals — line / columns) */
.wb-chart-block {
  padding: 1rem 1.4rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.wb-chart-cap {
  display: block;
  font: 600 .7rem var(--font-sans);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .7rem;
}
.wb-chart { width: 100%; }
.wb-chart-svg {
  width: 100%;
  height: 110px;
  display: block;
  overflow: visible;
}
.wb-chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.wb-chart-area { fill: var(--accent-dim); stroke: none; }
.wb-chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: .4rem;
  font: 500 .72rem var(--font-sans);
  color: var(--ink-3);
}

/* Column chart */
.wb-cols {
  display: flex;
  align-items: flex-end;
  gap: .35rem;
  height: 120px;
}
.wb-col-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}
.wb-col-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.wb-col {
  display: block;
  width: 70%;
  max-width: 26px;
  border-radius: 3px 3px 0 0;
  transition: height .4s var(--ease-out);
}
.wb-col--pos { background: var(--green); }
.wb-col--neg { background: var(--red); }
.wb-col-label {
  margin-top: .4rem;
  font: 500 .68rem var(--font-sans);
  color: var(--ink-3);
  white-space: nowrap;
}

/* Table */
.wb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font: 500 .95rem var(--font-sans);
  color: var(--ink-1);
}
.wb-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-md);
  padding: .85rem 1.15rem;
  text-align: left;
  font: 600 .78rem var(--font-sans);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.wb-table thead th:hover {
  background: var(--surface-3);
  color: var(--ink-1);
}
.wb-table thead th .wb-sort-indicator {
  display: inline-block;
  margin-left: .35rem;
  opacity: 0;
  transition: opacity .15s;
}
.wb-table thead th:hover .wb-sort-indicator { opacity: .5; }
.wb-table thead th.is-sorted .wb-sort-indicator {
  opacity: 1;
  color: var(--accent);
}
.wb-table thead th[data-align="right"] { text-align: right; }
.wb-table thead th[data-align="center"] { text-align: center; }

.wb-table tbody tr {
  transition: background .12s;
}
.wb-table tbody tr:hover {
  background: rgba(53,122,189,.06);
}
.wb-table tbody td {
  padding: .9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

/* Conditional-format chip (e.g. budget %) */
.wb-heat {
  display: inline-block;
  min-width: 3em;
  padding: .12rem .5rem;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.wb-heat--ok { background: rgba(26,127,55,.10); color: var(--green); }
.wb-heat--warn { background: rgba(184,134,11,.16); color: #946700; }
.wb-heat--bad { background: rgba(192,57,43,.12); color: var(--red); }
[data-theme="dark"] .wb-heat--warn { color: var(--gold-light); }
.wb-table tbody td[data-align="right"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: .92rem;
  font-weight: 500;
}
.wb-table tbody td[data-align="center"] { text-align: center; }

/* Cell badges */
.wb-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  font: 600 .7rem var(--font-sans);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.wb-badge--good {
  background: rgba(46,156,90,.12);
  color: #1e7a48;
}
.wb-badge--warn {
  background: rgba(217,165,67,.18);
  color: #8a5a14;
}
.wb-badge--bad {
  background: rgba(209,80,80,.14);
  color: #a82a2a;
}
.wb-badge--neutral {
  background: var(--surface-3);
  color: var(--ink-2);
}

/* Progress mini-bar */
.wb-progress {
  display: inline-block;
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  vertical-align: middle;
  margin-right: .5rem;
}
.wb-progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #efc36a, #d9a543);
  border-radius: 999px;
  transition: width .25s ease;
}
.wb-progress-fill--over {
  background: linear-gradient(90deg, #d15050, #a82a2a);
}

/* Editable cells */
.wb-table tbody td.wb-editable {
  cursor: cell;
  position: relative;
}
.wb-table.is-edit-mode tbody td.wb-editable:hover {
  background: rgba(217,165,67,.08);
  box-shadow: inset 0 0 0 1px rgba(217,165,67,.4);
}
.wb-table tbody td .wb-cell-input {
  width: 100%;
  padding: .4rem .55rem;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  background: var(--surface-1);
  font: inherit;
  color: inherit;
  text-align: inherit;
  outline: none;
  box-shadow: 0 0 0 3px rgba(53,122,189,.18);
}

/* Footer totals row */
.wb-table tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--surface-2);
  border-top: 2px solid var(--border-md);
  padding: .65rem .85rem;
  font: 700 .8rem var(--font-sans);
  color: var(--ink-1);
  letter-spacing: .02em;
}
.wb-table tfoot td[data-align="right"] {
  text-align: right;
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
}
.wb-table tfoot td .wb-total-label {
  display: block;
  font-size: .65rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .1rem;
}

/* Empty state */
.wb-empty {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--ink-3);
}
.wb-empty-title {
  font: 600 1rem var(--font-sans);
  color: var(--ink-2);
  margin-bottom: .35rem;
}
/* ── Balance Sheet ────────────────────────────────────────── */
.bs-section {
  margin-bottom: .25rem;
  border-radius: var(--radius);
}
.bs-section--assets {
  border-left: 3px solid var(--green);
}
.bs-section--liabilities {
  border-left: 3px solid var(--red);
}
.bs-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: .5rem .6rem .35rem;
  border-bottom: 2px solid var(--border-md);
}
.bs-section-title {
  font: 600 .78rem var(--font-sans);
  color: var(--ink-1);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.bs-section-total {
  font: 600 .85rem var(--font-sans);
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.bs-networth {
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.bs-nw-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.bs-nw-label {
  font: 600 1rem var(--font-sans);
  color: var(--ink-1);
  letter-spacing: .03em;
}
.bs-nw-value {
  font: 600 1.4rem var(--font-sans);
  font-variant-numeric: tabular-nums;
}
.bs-nw-formula {
  font-size: .72rem;
  color: var(--ink-3);
  margin-top: .35rem;
  font-variant-numeric: tabular-nums;
}
.wb-empty-cell {
  padding: 1.5rem .85rem;
  color: var(--ink-3);
  font-size: .82rem;
  text-align: center;
}

/* ── Emergency Fund (Balance Sheet) ───────────────────────── */
.bs-emergency {
  margin-top: 1.5rem;
  padding: .9rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.ef-calc {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .5rem;
}
.ef-row {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  padding: .25rem 0;
}
.ef-row--gap {
  border-top: 1px solid var(--border);
  padding-top: .45rem;
  margin-top: .15rem;
}
.ef-row--ok {
  border-top: 1px solid var(--border);
  padding-top: .45rem;
  margin-top: .15rem;
}
.ef-label {
  color: var(--ink-2);
}
.ef-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ef-months {
  display: flex;
  gap: .4rem;
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}
.ef-month-btn {
  flex: 1;
  text-align: center;
  font-size: .65rem;
  padding: .35rem .2rem;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink-3);
  line-height: 1.35;
}
.ef-month--ok {
  background: var(--green-dim);
  color: var(--green);
  font-weight: 600;
}

/* ── Monthly Flow ─────────────────────────────────────────── */
.wb-month-label {
  font-weight: 600;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.mf-sparkline {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.mf-spark-label {
  font-size: .7rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.mf-spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  height: 42px;
}
.mf-bar {
  flex: 1;
  min-width: 3px;
  border-radius: 1px 1px 0 0;
  transition: height .3s ease;
}

.wb-empty-sub {
  font: 400 .85rem var(--font-sans);
}

/* Sheet tabs (Excel-style at the bottom) */
.wb-tabs {
  display: flex;
  gap: 2px;
  padding: .35rem .75rem 0;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-3));
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}
.wb-tab {
  padding: .55rem 1.1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--ink-2);
  font: 600 .8rem var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, transform .1s;
  position: relative;
  top: 1px;
}
.wb-tab:hover {
  background: var(--surface-1);
  color: var(--ink-1);
}
.wb-tab.active {
  background: var(--surface-1);
  color: var(--ink-1);
  border-color: var(--border-md);
  box-shadow: 0 -2px 0 var(--accent) inset;
  top: 0;
}

/* Dark theme overrides */
[data-theme="dark"] .workbook {
  background: var(--surface-1);
  border-color: var(--border);
}
[data-theme="dark"] .wb-toolbar {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
}
[data-theme="dark"] .wb-table thead th {
  background: var(--surface-2);
  color: var(--ink-2);
}
[data-theme="dark"] .wb-table thead th:hover {
  background: var(--surface-3);
}
[data-theme="dark"] .wb-table tbody tr:hover {
  background: rgba(120,170,230,.08);
}
[data-theme="dark"] .wb-table tfoot td {
  background: var(--surface-2);
}
[data-theme="dark"] .wb-badge--good {
  background: rgba(46,196,120,.16);
  color: #6fd49a;
}
[data-theme="dark"] .wb-badge--warn {
  background: rgba(232,180,80,.18);
  color: #f0c878;
}
[data-theme="dark"] .wb-badge--bad {
  background: rgba(232,100,100,.16);
  color: #ff9090;
}
[data-theme="dark"] .wb-tabs {
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
}
[data-theme="dark"] .wb-tab:hover {
  background: var(--surface-2);
}
[data-theme="dark"] .wb-tab.active {
  background: var(--surface-1);
}

/* Mobile */
@media (max-width: 720px) {
  .workbook { min-height: 480px; border-radius: 12px; }
  .wb-toolbar { flex-direction: column; align-items: stretch; gap: .55rem; padding: .65rem; }
  .wb-toolbar-left, .wb-toolbar-right { width: 100%; }
  .wb-search { min-width: 0; flex: 1; }
  .wb-export-btn span { display: none; }
  .wb-mode-toggle .wb-mode-label { display: none; }
  .wb-table { font-size: .8rem; }
  .wb-table thead th, .wb-table tbody td, .wb-table tfoot td {
    padding: .5rem .55rem;
  }
  .wb-tab { padding: .5rem .8rem; font-size: .75rem; }
  .wb-progress { width: 50px; }
}

/* ══════════════════════════════════════════════════════════════════
   CALENDAR & WORKBOOK — spacious layout (full workspace width)
══════════════════════════════════════════════════════════════════ */
.content-area:has(#view-calendar.active),
.content-area:has(#view-workbook.active) {
  max-width: min(100%, 1560px);
  padding-bottom: 2.5rem;
}
/* Keep topbar title aligned with the widened content (UX spec: "Align") */
.main-content:has(#view-calendar.active) .topbar,
.main-content:has(#view-workbook.active) .topbar {
  max-width: min(100%, 1560px);
}

#view-calendar.view.active,
#view-workbook.view.active {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: calc(100vh - 10.5rem);
}

#view-calendar .view-intro,
#view-workbook .view-intro {
  margin-bottom: 0;
  max-width: 52rem;
  line-height: 1.65;
}

#view-calendar .calendar-toolbar {
  margin: 0;
  padding: 1rem 1.25rem;
  gap: 1.15rem;
}

#view-calendar .cal-month-title {
  font-size: 1.65rem;
}

#view-calendar .calendar-grid {
  flex: 1;
  min-height: min(72vh, 820px);
  display: flex;
  flex-direction: column;
}

#view-calendar .cal-month-grid {
  flex: 1;
  grid-auto-rows: minmax(140px, 1fr);
}

#view-calendar .cal-day {
  min-height: 140px;
}

#view-calendar .cal-weekday {
  padding: .85rem 1rem;
  font-size: .72rem;
}

#view-calendar .cal-day-events {
  flex: 1;
  min-height: 2.5rem;
}

#view-calendar .cal-event-chip {
  font-size: .8rem;
  padding: .32rem .6rem;
}

#view-calendar .cal-week-day {
  min-height: min(68vh, 520px);
}

#view-calendar .cal-agenda-row {
  padding: 1.05rem 1.35rem;
  gap: 1.15rem;
}

#view-calendar .cal-agenda-row-title {
  font-size: 1rem;
}

#view-calendar .calendar-detail {
  margin-top: 0;
  padding: 1.5rem 1.75rem;
}

#view-calendar .calendar-detail-title {
  font-size: 1.45rem;
}

#view-workbook .workbook {
  flex: 1;
  min-height: max(720px, calc(100vh - 12rem));
}

#view-workbook .wb-toolbar {
  padding: 1rem 1.35rem;
}

#view-workbook .wb-search {
  min-width: 280px;
}

#view-workbook .wb-search-input {
  padding: .65rem .85rem .65rem 2.15rem;
  font-size: .92rem;
}

#view-workbook .wb-mode-toggle,
#view-workbook .wb-export-btn {
  padding: .6rem 1rem;
  font-size: .85rem;
}

#view-workbook .wb-table-wrap {
  min-height: 420px;
}

#view-workbook .wb-table tfoot td {
  padding: .85rem 1.15rem;
  font-size: .9rem;
}

#view-workbook .wb-tabs {
  padding: .65rem 1rem;
}

#view-workbook .wb-tab {
  padding: .65rem 1.15rem;
  font-size: .85rem;
}

@media (max-width: 1100px) {
  .content-area:has(#view-calendar.active),
  .content-area:has(#view-workbook.active) {
    max-width: 100%;
  }
  #view-calendar .cal-month-grid {
    grid-auto-rows: minmax(108px, auto);
  }
  #view-calendar .cal-day {
    min-height: 108px;
  }
  #view-workbook .workbook {
    min-height: max(560px, calc(100vh - 11rem));
  }
}

/* ══════════════════════════════════════════════════════════════════
   WEALTH STATUS — Freedom Score · Wealth Efficiency · Future Fund · Optionality Reserve
══════════════════════════════════════════════════════════════════ */

/* ── Wealth Status Card ──────────────────────────────────────── */
.bento-card--wealth {
  /* gold highlight line removed per UX spec (June 2026) */
  margin-bottom: 1rem;
}
.wealth-status-empty {
  font-size: .82rem;
  color: var(--ink-3);
  line-height: 1.5;
  padding: .5rem 0;
}
.wealth-status-empty .link-btn {
  all: unset;
  cursor: pointer;
  color: var(--gold);
  font-weight: 600;
}
.wealth-status-empty .link-btn:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

/* ── Freedom Score Bars ──────────────────────────────────────── */
.freedom-section {
  margin-top: .3rem;
}
.freedom-title {
  font: 500 .78rem var(--font-sans);
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .65rem;
}
.freedom-bars {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.freedom-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.freedom-label {
  font-size: .72rem;
  font-weight: 500;
  color: var(--ink-2);
  min-width: 60px;
}
.freedom-track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.freedom-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .6s var(--ease);
}
.freedom-fill--lean {
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}
.freedom-fill--fat {
  background: linear-gradient(90deg, var(--ink-3), var(--ink-2));
}
.freedom-pct {
  font: 600 .72rem var(--font-sans);
  color: var(--ink-2);
  min-width: 32px;
  text-align: right;
}
.freedom-detail {
  font-size: .65rem;
  color: var(--ink-4);
  margin-top: .15rem;
  margin-bottom: .5rem;
  padding-left: 66px;
}
.freedom-footnote {
  font-size: .7rem;
  color: var(--ink-3);
  font-style: italic;
  margin-top: .5rem;
  line-height: 1.4;
}
.freedom-footnote em {
  font-weight: 600;
  color: var(--gold);
}
.freedom-citation {
  font-size: .65rem;
  color: var(--ink-4);
  margin-top: .35rem;
  font-style: italic;
}

/* ── Wealth Efficiency Badge ─────────────────────────────────── */
.paw-badge {
  font-size: .68rem;
  font-weight: 600;
  padding: .18rem .55rem;
  border-radius: var(--radius-pill);
  letter-spacing: .03em;
  white-space: nowrap;
  cursor: default;
}
.paw-badge--gold {
  background: linear-gradient(135deg, #b8860b, #daa520);
  color: #fff;
  box-shadow: 0 0 8px rgba(184,134,11,.25);
}
.paw-badge--silver {
  background: linear-gradient(135deg, #7b818c, #a8b0bb);
  color: #fff;
}
.paw-badge--bronze {
  background: linear-gradient(135deg, #8b5e3c, #c47f3c);
  color: #fff;
}
.paw-badge--none {
  background: var(--surface-3);
  color: var(--ink-3);
}

/* ── Future Fund Badge ───────────────────────────────────────── */
.ffund-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: .5rem;
  padding: .12rem .45rem;
  border-radius: var(--radius-pill);
  background: rgba(184,134,11,.12);
  color: var(--gold);
  font-size: .63rem;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: default;
}

/* ── Runway Mini (Wealth Status card) ───────────────────────── */
.runway-mini {
  margin-top: .8rem;
  padding-top: .65rem;
  border-top: 1px solid var(--border);
}
.runway-mini-title {
  font: 500 .74rem var(--font-sans);
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .5rem;
}
.runway-mini-grid {
  display: flex;
  gap: .5rem;
}
.runway-mini-item {
  flex: 1;
  text-align: center;
  padding: .6rem .3rem .55rem;
  background: linear-gradient(160deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: transform .15s var(--ease), border-color .15s;
}
.runway-mini-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-md);
}
.runway-mini-label {
  display: block;
  font-size: .58rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .3rem;
  line-height: 1.25;
}
.runway-mini-val {
  display: block;
  font: 700 1.05rem var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.runway-mini-val [data-i18n="runway_days_short"] {
  font-size: .6rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 2px;
}
.runway-mini-burn {
  margin-top: .45rem;
  font-size: .63rem;
  color: var(--ink-4);
  text-align: center;
}

/* ── Share Card ─────────────────────────────────────────────── */
.wealth-status-footer {
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.share-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--ink-2);
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.share-trigger-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.share-trigger-btn svg {
  width: 14px;
  height: 14px;
}
.share-buttons {
  display: flex;
  gap: .6rem;
  justify-content: center;
  margin-top: .5rem;
}
.share-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border-md);
  background: var(--surface-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, border-color .15s;
}
.share-btn:hover {
  transform: translateY(-2px);
}
.share-btn svg {
  width: 22px;
  height: 22px;
}
.share-btn--tg { color: #24a1de; }
.share-btn--tg:hover { border-color: #24a1de; background: rgba(36,161,222,.06); }
.share-btn--x  { color: #0c0f14; }
.share-btn--x:hover  { border-color: #0c0f14; background: rgba(12,15,20,.04); }
.share-btn--li { color: #0a66c2; }
.share-btn--li:hover { border-color: #0a66c2; background: rgba(10,102,194,.06); }
.share-btn--fb { color: #1877f2; }
.share-btn--fb:hover { border-color: #1877f2; background: rgba(24,119,242,.06); }
.share-btn--ig { color: #e1306c; }
.share-btn--ig:hover { border-color: #e1306c; background: rgba(225,48,108,.06); }
.share-btn--img { color: var(--ink-1); }
.share-btn--img:hover { border-color: var(--ink-1); background: rgba(255,255,255,.04); }
.share-btn--dl { color: var(--gold); }
.share-btn--dl:hover { border-color: var(--gold); background: var(--gold-dim); }

/* ── Wealth Status: clickable card + info affordance ─────────── */
.wealth-status-card--clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.wealth-status-card--clickable:hover { border-color: var(--border-md); }
.wealth-status-card--clickable:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--gold-dim);
  border-color: var(--gold);
}
.wealth-title-group { display: inline-flex; align-items: center; gap: .45rem; }
.wealth-info-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .15s, transform .15s;
}
.wealth-info-btn:hover { color: var(--gold); transform: scale(1.12); }
.wealth-info-btn svg { width: 16px; height: 16px; }

/* ── "Set up here" CTA (replaces the old Share button) ───────── */
.setup-here-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  font-family: var(--font-sans);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .02em;
  color: #2a1d05;
  background: #dfae4a;
  border: 1px solid rgba(184, 134, 11, .55);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(120, 85, 10, .14), 0 8px 20px -12px rgba(184, 134, 11, .45);
  transition: transform .15s var(--ease-out), background .2s, box-shadow .18s;
}
.setup-here-btn:hover {
  background: #e8ba58;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(120, 85, 10, .18), 0 14px 30px -12px rgba(228, 179, 80, .55);
}
.setup-here-btn:active { transform: translateY(0) scale(.985); }
.setup-here-btn svg { width: 14px; height: 14px; }

/* ── Wealth Status explainer modal ───────────────────────────── */
.wealth-info-modal {
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
}
.wealth-info-item {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.wealth-info-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-top: .38rem;
  border-radius: 50%;
}
.wealth-info-dot--lean   { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.wealth-info-dot--fat    { background: linear-gradient(90deg, var(--ink-3), var(--ink-2)); }
.wealth-info-dot--score  { background: var(--gold); }
.wealth-info-dot--runway { background: var(--green); }
.wealth-info-term {
  font: 650 .9rem var(--font-sans);
  color: var(--ink-1);
  margin: 0 0 .2rem;
}
.wealth-info-desc {
  font-size: .82rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}
.wealth-info-desc strong { color: var(--ink-1); font-weight: 650; }
.wealth-info-foot {
  font-size: .74rem;
  font-style: italic;
  color: var(--ink-3);
  line-height: 1.5;
  margin: .25rem 0 1.25rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.wealth-info-foot em { font-style: normal; font-weight: 600; color: var(--gold); }

/* ── Optionality Reserve Card ────────────────────────────────── */
.flex-fund-card {
  border-left: 3px solid var(--gold) !important;
  background: linear-gradient(135deg, var(--surface-1) 0%, rgba(184,134,11,.02) 100%);
  grid-column: 1 / -1;
}

/* ── Form inputs in settings ─────────────────────────────────── */
.form-input {
  padding: .45rem .65rem;
  border: 1px solid var(--border-md);
  border-radius: 6px;
  font-size: .82rem;
  background: var(--surface-1);
  color: var(--ink-1);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

/* ── Template chips (New Category modal) ──────────────────────── */
.env-template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.env-chip {
  all: unset;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 500;
  padding: .28rem .6rem;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.env-chip:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold);
}

/* ═════════════════════════════════════════════════════════════════
   MONTHLY OVERVIEW (app-monitoring.js)
   Palette: deep-blue #1e3a5f | slate #6b7c93 | bronze #c4956a
   Card bg #f7f5f2 | Page bg #fcfaf7 | Text #1a1a1a / #5c5c5c
   Border #e8e4df
   ═══════════════════════════════════════════════════════════════ */

/* ── view-intro override ────────────────────────────────── */
#view-overview .view-intro {
  margin-bottom: .5rem;
  font-size: .78rem;
  line-height: 1.4;
  max-width: 100%;
  color: #5c5c5c;
  border-left-color: #e8e4df;
}

/* ── Overview wrapper ───────────────────────────────────── */
#overview-content {
  background: #fcfaf7;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  animation: ovFadeIn .4s ease both;
}
@keyframes ovFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Hero ───────────────────────────────────────────────── */
.ov-hero {
  text-align: center;
  padding: .75rem 1rem .5rem;
  margin-bottom: .75rem;
}
.ov-hero-number {
  font-family: var(--font-serif);
  font-size: 5rem;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.03em;
  color: #1e3a5f;
}
.ov-hero-label {
  font-size: .95rem;
  font-weight: 400;
  color: #5c5c5c;
  margin-top: .15rem;
}
.ov-hero-sub {
  font-size: .7rem;
  color: #6b7c93;
  margin-top: .3rem;
}

/* ── KPI Row ────────────────────────────────────────────── */
.ov-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #e8e4df;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .75rem;
}
.ov-kpi {
  background: #f7f5f2;
  padding: .65rem .5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .05rem;
}
.ov-kpi-val {
  font-family: 'Inter', 'Inter Variable', sans-serif;
  font-size: 1.6rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #1a1a1a;
}
.ov-kpi-label {
  font-size: .68rem;
  font-weight: 400;
  font-style: italic;
  color: #5c5c5c;
}

/* ── Grid ───────────────────────────────────────────────── */
.ov-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: .75rem;
}

/* ── Card ───────────────────────────────────────────────── */
.ov-card {
  background: #f7f5f2;
  border: 1px solid #e8e4df;
  border-radius: 8px;
  padding: .85rem 1rem;
}
.ov-card--accent {
  margin-bottom: .5rem;
}
.ov-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .6rem;
  flex-wrap: wrap;
  gap: .2rem;
}
.ov-card-title {
  font-family: 'Inter', 'Inter Variable', sans-serif;
  font-size: .87rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #1a1a1a;
}
.ov-card-source {
  font-family: 'Inter', 'Inter Variable', sans-serif;
  font-size: .68rem;
  font-weight: 400;
  font-style: italic;
  color: #5c5c5c;
}
.ov-card-msg {
  font-size: .82rem;
  color: #5c5c5c;
  padding: .4rem 0;
  line-height: 1.5;
}

/* ── Bullet Graph (PAW/UAW) ─────────────────────────────── */
.ov-bullet-wrap {
  padding: .25rem 0 .35rem;
}
.ov-bullet-chart {
  position: relative;
  height: 24px;
  margin-bottom: .35rem;
}
.ov-bullet-bands {
  position: absolute;
  inset: 0;
  display: flex;
  border-radius: 3px;
  overflow: hidden;
}
.ov-bullet-band {
  height: 100%;
}
.ov-bullet-band--low  { background: #ede9e4; }
.ov-bullet-band--mid  { background: #dcd6cf; }
.ov-bullet-band--high { background: #c9c2b9; }
.ov-bullet-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: #6b7c93;
  z-index: 2;
  border-radius: 1px;
}
.ov-bullet-bar {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  background: #1e3a5f;
  border-radius: 2px;
  z-index: 1;
  transition: width .6s cubic-bezier(0,0,.2,1);
}
.ov-bullet-context {
  font-size: .66rem;
  font-style: italic;
  color: #5c5c5c;
}
.ov-bullet-scale {
  display: flex;
  justify-content: space-between;
  font-size: .6rem;
  color: #6b7c93;
  margin-top: .15rem;
}

/* ── Ego Tax Bar ────────────────────────────────────────── */
.ov-ego-bar {
  display: flex;
  height: 1.6rem;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: .45rem;
}
.ov-ego-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.ov-ego-seg-label {
  font-size: .64rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.ov-ego-labels {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.ov-ego-label-item {
  font-size: .66rem;
  color: #5c5c5c;
}

/* ── Monk vs Minister Static Indicator ──────────────────── */
.ov-monk-wrap {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.ov-monk-mm-track-wrap {
  padding: .15rem 0;
}
.ov-monk-mm-track {
  position: relative;
  height: 5px;
  background: #e8e4df;
  border-radius: 3px;
}
.ov-monk-mm-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #1e3a5f;
  border-radius: 3px;
}
.ov-monk-mm-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 13px;
  background: #1e3a5f;
  border-radius: 2px;
  transform: translateX(-50%);
}
.ov-monk-mm-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .3rem;
}
.ov-monk-mm-left,
.ov-monk-mm-right {
  font-size: .7rem;
  color: #1a1a1a;
}
.ov-monk-mm-pct {
  font-weight: 600;
  color: #1e3a5f;
}
.ov-monk-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: .78rem;
  color: #5c5c5c;
  text-align: center;
  padding: .4rem .6rem;
  background: #fcfaf7;
  border-radius: 4px;
}

/* ── Fan Chart (Ruin Me) ────────────────────────────────── */
.ov-fan-wrap {
  padding: .15rem 0;
}
.ov-fan-svg {
  display: block;
  width: 100%;
  height: auto;
  animation: ovFadeIn .8s ease both;
}
.ov-fan-context {
  font-size: .66rem;
  font-style: italic;
  color: #5c5c5c;
  text-align: center;
  margin-top: .25rem;
}

/* ── Observations ────────────────────────────────────────── */
.ov-obs-item {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  padding: .35rem 0;
  border-bottom: 1px solid #e8e4df;
}
.ov-obs-item:last-child {
  border-bottom: none;
}
.ov-obs-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: .35rem;
  flex-shrink: 0;
}
.ov-obs-dot--good { background: #1e3a5f; }
.ov-obs-dot--warn { background: #c4956a; }
.ov-obs-dot--info { background: #6b7c93; }

/* AI reflection block under Observations */
.ov-ai-reflect {
  margin-top: .85rem;
  padding: .8rem .85rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(184,134,11,.10), rgba(184,134,11,.03));
  border: 1px solid rgba(184,134,11,.22);
}
.ov-ai-reflect-kicker {
  display: block;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold, #b8860b);
  margin-bottom: .3rem;
}
.ov-ai-reflect-q {
  margin: 0 0 .6rem;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--ink-1, #1c2430);
}
.ov-ai-reflect-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.ov-ai-btn {
  appearance: none;
  border: 1px solid rgba(184,134,11,.55);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 650;
  padding: .42rem .8rem;
  border-radius: 999px;
  color: #2a1d05;
  background: #dfae4a;
  box-shadow: 0 4px 12px -6px rgba(184,134,11,.5);
  transition: transform .12s ease, box-shadow .12s ease;
}
.ov-ai-btn:hover { transform: translateY(-1px); box-shadow: 0 7px 16px -7px rgba(184,134,11,.6); }
.ov-ai-btn--ghost {
  background: var(--surface-2, #f0eee9);
  color: var(--ink-1);
  border: 1px solid var(--border, rgba(12,15,20,.085));
  box-shadow: none;
}
[data-theme="dark"] .ov-ai-reflect-q { color: var(--ink-1, #e8eef6); }

/* Freemium feature badge (Free / Pro markers) */
.feat-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: .4rem;
  padding: 1px 7px;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  font-family: var(--font-sans, sans-serif);
}
.feat-badge--pro {
  color: #2a1d05;
  background: #dfae4a;
  box-shadow: 0 2px 6px -2px rgba(184,134,11,.6);
}
.feat-badge--free {
  color: var(--ink-3, #6b7c93);
  background: rgba(120,130,150,.16);
}

/* ── CELEBRATION (milestones) ─────────────────────────────────── */
.celebrate-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 20000;
  opacity: 0;
  transition: opacity .35s ease, transform .35s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.celebrate-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.celebrate-card {
  background: rgba(20,26,38,.92);
  color: #fff;
  border: 1px solid rgba(184,134,11,.5);
  border-radius: 18px;
  padding: 1.1rem 1.6rem;
  text-align: center;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 240px;
}
.celebrate-mark {
  width: 44px; height: 44px;
  margin: 0 auto .55rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #b8860b, #d4a017);
  color: #fff; font-size: 1.4rem; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(184,134,11,.8);
}
.celebrate-title {
  font-family: var(--font-serif, serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.celebrate-sub {
  margin-top: .25rem;
  font-size: .82rem;
  color: rgba(255,255,255,.75);
}
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 19999;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -16px;
  border-radius: 2px;
  opacity: .95;
  animation-name: confettiFall;
  animation-timing-function: cubic-bezier(.25,.6,.4,1);
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(102vh) rotate(540deg); opacity: .85; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti-piece { display: none; }
}

/* ── FORECAST / MODEL SHEET ───────────────────────────────────── */
.fc-assumptions {
  background: var(--surface-1);
  border: 1px solid var(--line, rgba(120,130,150,.18));
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.fc-assumptions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.fc-kicker {
  display: block;
  font-family: var(--font-sans, sans-serif);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold, #b8860b);
}
.fc-sub {
  display: block;
  margin-top: .2rem;
  font-size: .76rem;
  color: var(--ink-3, #6b7c93);
}
.fc-build-btn {
  flex-shrink: 0;
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans, sans-serif);
  font-size: .78rem;
  font-weight: 600;
  padding: .5rem .95rem;
  border-radius: 999px;
  color: #2a1d05;
  background: #dfae4a;
  box-shadow: 0 5px 14px -6px rgba(184,134,11,.6);
  transition: transform .12s ease, box-shadow .12s ease;
}
.fc-build-btn:hover { transform: translateY(-1px); background: #e7b956; box-shadow: 0 8px 18px -7px rgba(184,134,11,.7); }
.fc-scenario-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .9rem;
}
.fc-scenario-caption {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ink-3, #6b7c93);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fc-scenario-toggle {
  display: inline-flex;
  background: var(--surface-2, rgba(120,130,150,.1));
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.fc-scenario-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans, sans-serif);
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2, #44506a);
  transition: background .15s ease, color .15s ease;
}
.fc-scenario-btn.active {
  background: var(--surface-0, #fff);
  color: var(--gold, #b8860b);
  box-shadow: 0 2px 6px -3px rgba(0,0,0,.25);
}
.fc-assumption-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .7rem;
}
.fc-assumption {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.fc-assumption-label {
  font-size: .72rem;
  color: var(--ink-3, #6b7c93);
  font-weight: 600;
}
.fc-assumption-field {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface-0, #fff);
  border: 1px solid var(--line, rgba(120,130,150,.25));
  border-radius: 10px;
  padding: .35rem .55rem;
}
.fc-assumption-field input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-sans, sans-serif);
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-1, #1c2430);
  outline: none;
}
.fc-assumption-suffix {
  font-size: .72rem;
  color: var(--ink-3, #6b7c93);
  white-space: nowrap;
}
.fc-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}
.fc-summary-card {
  background: var(--surface-1);
  border: 1px solid var(--line, rgba(120,130,150,.18));
  border-radius: 14px;
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.fc-summary-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3, #6b7c93);
  font-weight: 700;
}
.fc-summary-val {
  font-family: var(--font-serif, serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-1, #1c2430);
}
.fc-table-wrap { overflow-x: auto; }
[data-theme="dark"] .fc-scenario-btn.active {
  background: var(--surface-3, rgba(255,255,255,.08));
}
.ov-obs-text {
  font-size: .78rem;
  color: #1a1a1a;
  line-height: 1.45;
}
.ov-obs-text strong {
  font-weight: 600;
  color: #1a1a1a;
}

/* ── Sparkline ──────────────────────────────────────────── */
.ov-sparkline {
  display: inline-block;
  vertical-align: middle;
  margin: 0 .15rem;
}
.ov-sparkline svg {
  display: block;
}

/* ── Unpredictability Fund ──────────────────────────────── */
.ov-unpredict {
  text-align: center;
  padding: .4rem 0;
}
.ov-unpredict-val {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: #1a1a1a;
}
.ov-unpredict-label {
  display: block;
  font-size: .66rem;
  font-style: italic;
  color: #5c5c5c;
  margin-top: .15rem;
}

/* ── Empty State ────────────────────────────────────────── */
.ov-empty {
  text-align: center;
  padding: 4rem 2rem;
}
.ov-empty-msg {
  font-size: .9rem;
  color: #5c5c5c;
  line-height: 1.5;
  max-width: 340px;
  margin: 0 auto 1rem;
}
.ov-empty-btn {
  display: inline-block;
  padding: .5rem 1.4rem;
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  background: #1e3a5f;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
}
.ov-empty-btn:hover {
  background: #162d4a;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #view-overview .view-intro { margin-bottom: .5rem; }
  #overview-content { padding: .75rem; }
  .ov-hero-number { font-size: 3.2rem; }
  .ov-kpi-row { grid-template-columns: 1fr 1fr; }
  .ov-grid { grid-template-columns: 1fr; }
  .ov-hero { padding: .5rem; }
}
@media (max-width: 480px) {
  .ov-hero-number { font-size: 2.6rem; }
  .ov-kpi-row { grid-template-columns: 1fr; }
  .ov-card-header { flex-direction: column; }
}

/* ── Board Brief Production Pass: atmosphere + data visualization ── */
.main-content {
  background:
    radial-gradient(circle at 18% 4%, rgba(9,105,218,.09), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(184,134,11,.10), transparent 28rem),
    linear-gradient(180deg, var(--surface-0) 0%, #f7f9fc 48%, var(--surface-0) 100%);
}

#view-overview .view-intro {
  max-width: 820px;
  color: var(--ink-2);
  border-left-color: rgba(184,134,11,.45);
}

/* Grey additional box removed per UX spec (June 2026) — cards sit directly on the page */
#overview-content {
  position: relative;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Hero on white background per UX spec (June 2026) */
.ov-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  text-align: left;
  gap: 1.25rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--surface-1);
  color: var(--ink-1);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}
.ov-hero-kicker {
  display: inline-flex;
  margin-bottom: .25rem;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-deep, #8a6308);
}
.ov-hero-number {
  color: var(--ink-1);
}
.ov-hero-label {
  color: var(--ink-2);
}
.ov-hero-sub {
  color: var(--ink-3);
}
.ov-hero-sub strong {
  color: var(--ink-1);
}
.ov-hero-visual {
  width: 136px;
  min-width: 136px;
}
.ov-freedom-ring {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}
.ov-ring-track,
.ov-ring-fill {
  fill: none;
  stroke-width: 9;
}
.ov-ring-track {
  stroke: rgba(12,15,20,.1);
}
.ov-ring-fill {
  stroke: #d4a843;
  stroke-linecap: round;
  filter: drop-shadow(0 0 12px rgba(212,168,67,.32));
}
.ov-ring-label,
.ov-ring-caption {
  transform: rotate(90deg);
  transform-origin: 60px 60px;
  font-family: var(--font-sans);
  fill: var(--ink-1, #1a1a1a);
}
.ov-ring-label {
  font-size: 1.05rem;
  font-weight: 700;
}
.ov-ring-caption {
  font-size: .55rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  fill: var(--ink-3, #6b7280);
}

.ov-kpi-row {
  gap: .75rem;
  background: transparent;
  overflow: visible;
}
.ov-kpi {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  padding: .9rem .95rem;
  text-align: left;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(12,15,20,.08);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(12,15,20,.07);
}
/* KPI bottom highlight lines removed per UX spec (June 2026) */
.ov-kpi-val {
  font-size: clamp(1.25rem, 2vw, 1.85rem);
  color: var(--ink-1);
}
.ov-kpi-label {
  color: var(--ink-3);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ov-kpi-spark {
  position: absolute;
  right: .5rem;
  bottom: .35rem;
  width: 42%;
  opacity: .72;
}
.ov-kpi-spark-area {
  fill: rgba(9,105,218,.08);
}
.ov-kpi-spark-line {
  fill: none;
  stroke: #0969da;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-grid {
  gap: 1rem;
}
.ov-card {
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(12,15,20,.08);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 14px 36px rgba(12,15,20,.08);
  backdrop-filter: blur(18px);
}
.ov-card--accent {
  border-left: 0;
}
.ov-card-title {
  color: var(--ink-1);
  letter-spacing: .10em;
}
.ov-card-source,
.ov-card-msg,
.ov-bullet-context,
.ov-fan-context,
.ov-unpredict-label {
  color: var(--ink-3);
}

.ov-bullet-chart {
  height: 34px;
  margin: .45rem 0 .3rem;
}
.ov-bullet-bands {
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(12,15,20,.08);
}
.ov-bullet-band--low  { background: rgba(153,15,61,.12); }
.ov-bullet-band--mid  { background: rgba(184,134,11,.16); }
.ov-bullet-band--high { background: rgba(26,127,55,.15); }
.ov-bullet-marker {
  top: -5px;
  bottom: -5px;
  background: var(--ink-1);
  box-shadow: 0 0 0 3px rgba(255,255,255,.75);
}
.ov-bullet-bar {
  top: 8px;
  bottom: 8px;
  background: linear-gradient(90deg, #0f2744, #1d6f8f);
  border-radius: 999px;
  box-shadow: 0 5px 16px rgba(9,105,218,.22);
}
.ov-bullet-scale {
  display: flex;
  justify-content: space-between;
  gap: .4rem;
  color: var(--ink-3);
}
.ov-bullet-scale--top {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ov-ego-bar {
  height: 2rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.42);
}
.ov-ego-labels {
  margin-bottom: .75rem;
}
.ov-ego-label-item {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  color: var(--ink-2);
}
.ov-ego-dot {
  width: .46rem;
  height: .46rem;
  border-radius: 50%;
}
.ov-ego-list {
  display: grid;
  gap: .5rem;
}
.ov-ego-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
}
.ov-ego-row-label,
.ov-ego-row-val {
  font-size: .72rem;
  color: var(--ink-2);
}
.ov-ego-row-val {
  font-variant-numeric: tabular-nums;
  color: var(--ink-1);
}
.ov-ego-row-track {
  height: .42rem;
  overflow: hidden;
  background: rgba(12,15,20,.07);
  border-radius: 999px;
}
.ov-ego-row-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.ov-monk-mm-track {
  height: 8px;
  background: rgba(12,15,20,.08);
}
.ov-monk-mm-fill,
.ov-monk-mm-marker {
  background: linear-gradient(90deg, #1a7f37, #d4a843);
}
.ov-monk-quote {
  background: linear-gradient(135deg, rgba(12,15,20,.04), rgba(184,134,11,.08));
  border: 1px solid rgba(12,15,20,.06);
  color: var(--ink-2);
}

.ov-fan-wrap {
  overflow: hidden;
}
.ov-fan-svg {
  min-height: 240px;
}
.ov-fan-grid,
.ov-fan-axis,
.ov-fan-tick {
  stroke: rgba(12,15,20,.10);
  stroke-width: 1;
}
.ov-fan-zero {
  stroke: #b8860b;
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}
.ov-fan-band {
  stroke: none;
}
.ov-fan-band--90 {
  fill: rgba(29,111,143,.10);
}
.ov-fan-band--50 {
  fill: rgba(29,111,143,.20);
}
.ov-fan-history {
  fill: none;
  stroke: #0f2744;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ov-fan-projection {
  fill: none;
  stroke: #0f2744;
  stroke-width: 2;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .72;
}
.ov-fan-now {
  stroke: rgba(12,15,20,.34);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.ov-fan-endpoint,
.ov-fan-risk-dot {
  fill: #d4a843;
  stroke: #fff;
  stroke-width: 2;
}
.ov-fan-ylabel,
.ov-fan-xlabel,
.ov-fan-top-label,
.ov-fan-zero-label,
.ov-fan-endlabel,
.ov-fan-risk-label,
.ov-fan-legend text {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--ink-3);
}
.ov-fan-top-label {
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ov-fan-endlabel,
.ov-fan-risk-label,
.ov-fan-zero-label {
  fill: #8a6408;
  font-weight: 700;
}
.ov-fan-context strong {
  color: var(--ink-1);
}

.ov-obs-item {
  border-bottom-color: rgba(12,15,20,.08);
}
.ov-obs-text,
.ov-unpredict-val {
  color: var(--ink-1);
}

[data-theme="dark"] .main-content {
  background:
    radial-gradient(circle at 18% 4%, rgba(9,105,218,.14), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(184,134,11,.13), transparent 28rem),
    linear-gradient(180deg, #070a10 0%, #0a0d14 100%);
}
[data-theme="dark"] #overview-content {
  background: transparent;
  border: none;
  box-shadow: none;
}
[data-theme="dark"] .ov-hero {
  background: var(--surface-1);
  border-color: rgba(255,255,255,.09);
  color: var(--ink-onDark-1);
}
[data-theme="dark"] .ov-hero-number { color: var(--ink-onDark-1); }
[data-theme="dark"] .ov-hero-label  { color: var(--ink-onDark-2); }
[data-theme="dark"] .ov-hero-sub    { color: var(--ink-onDark-3); }
[data-theme="dark"] .ov-hero-sub strong { color: var(--ink-onDark-1); }
[data-theme="dark"] .ov-hero-kicker { color: var(--gold-light); }
[data-theme="dark"] .ov-ring-track  { stroke: rgba(255,255,255,.14); }
[data-theme="dark"] .ov-ring-label  { fill: var(--ink-onDark-1); }
[data-theme="dark"] .ov-ring-caption { fill: var(--ink-onDark-3); }
[data-theme="dark"] .ov-card,
[data-theme="dark"] .ov-kpi {
  background: rgba(26,30,40,.78);
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 18px 44px rgba(0,0,0,.26);
}
[data-theme="dark"] .ov-fan-grid,
[data-theme="dark"] .ov-fan-axis,
[data-theme="dark"] .ov-fan-tick {
  stroke: rgba(255,255,255,.10);
}
[data-theme="dark"] .ov-fan-now {
  stroke: rgba(255,255,255,.34);
}
[data-theme="dark"] .ov-fan-ylabel,
[data-theme="dark"] .ov-fan-xlabel,
[data-theme="dark"] .ov-fan-top-label,
[data-theme="dark"] .ov-fan-legend text {
  fill: rgba(255,255,255,.54);
}
[data-theme="dark"] .ov-monk-quote {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.08);
}

@media (max-width: 768px) {
  #overview-content { padding: .85rem; border-radius: 18px; }
  .ov-hero {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
  .ov-hero-visual {
    width: 112px;
    min-width: 112px;
  }
  .ov-kpi-row { gap: .65rem; }
  .ov-ego-row { grid-template-columns: 1fr; gap: .25rem; }
}
@media (max-width: 480px) {
  .ov-hero { padding: 1rem; }
  .ov-card { padding: .85rem; }
  .ov-kpi { min-height: 96px; }
  .ov-kpi-spark { display: none; }
  .ov-fan-svg { min-height: 190px; }
  .ov-fan-ylabel,
  .ov-fan-top-label,
  .ov-fan-legend {
    display: none;
  }
  .ov-fan-xlabel,
  .ov-fan-zero-label,
  .ov-fan-endlabel,
  .ov-fan-risk-label {
    font-size: 12px;
  }
}

/* ═════════════════════════════════════════════════════════════════
   SUBSCRIPTION BURDEN
   ═══════════════════════════════════════════════════════════════ */

.sub-burden-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.sub-burden-item {
  background: var(--surface-2);
  padding: 1rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sub-burden-val {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-1);
}
.sub-burden-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.sub-burden-sub {
  font-size: 0.7rem;
  color: var(--ink-3);
}

/* Overview subscription card */
.ov-sub-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ov-sub-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.ov-sub-metric-row:last-child {
  border-bottom: none;
}
.ov-sub-metric-label {
  font-size: 0.78rem;
  color: var(--ink-2);
}
.ov-sub-metric-val {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}

/* Extra income log summary */
.income-log-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.income-log-total {
  font-size: 0.82rem;
  color: var(--ink-1);
}
.income-log-total strong {
  color: #1e3a5f;
  font-weight: 600;
}
.income-log-cov {
  font-size: 0.78rem;
  color: #6b7c93;
}
.income-log-cov strong {
  color: #1e3a5f;
  font-weight: 600;
}

@media (max-width: 768px) {
  .sub-burden-banner {
    grid-template-columns: 1fr;
  }
}

/* Editorial onboarding reset — warm, proportional launch page */
#screen-onboarding {
  min-height: 100vh;
  background: #f6efdf;
  color: #17130f;
}
#screen-onboarding .ob-bg {
  background:
    linear-gradient(90deg, rgba(126,79,22,.12) 0 1px, transparent 1px) 50% 0 / 1px 100% no-repeat,
    repeating-linear-gradient(0deg, rgba(90,55,20,.025) 0 1px, transparent 1px 40px),
    radial-gradient(ellipse at 20% 10%, rgba(255,250,235,.9), transparent 48%),
    radial-gradient(ellipse at 95% 85%, rgba(143,15,58,.08), transparent 45%),
    #f6efdf;
}
#screen-onboarding .ob-bg::before {
  opacity: .045;
}
#screen-onboarding .ob-bg::after {
  background:
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(117,82,31,.16) 100%);
}
#screen-onboarding .ob-spread {
  width: min(100% - 48px, 1180px);
  min-height: min(720px, calc(100vh - 64px));
  margin: 0;
  grid-template-columns: minmax(0, 1fr) 1px minmax(440px, 560px);
  gap: 56px;
  align-items: center;
}
#screen-onboarding .ob-editorial {
  display: block;
  padding: 0 18px 0 0;
  color: #17130f;
}
#screen-onboarding .ob-spread-gutter {
  display: block;
}
#screen-onboarding .ob-edit-kicker {
  margin-bottom: 1.35rem;
  color: rgba(23,19,15,.58);
}
#screen-onboarding .ob-edit-headline {
  max-width: 11ch;
  font-size: clamp(2.8rem, 5.2vw, 4.8rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.022em;
  color: #17130f;
}
#screen-onboarding .ob-edit-headline em {
  font-style: italic;
  font-weight: 500;
  color: #b8860b;
}
#screen-onboarding .ob-edit-rule {
  width: 130px;
  height: 2px;
  margin: 1.75rem 0 1.55rem;
  background: #b8860b;
}
#screen-onboarding .ob-edit-body {
  max-width: 44ch;
  margin: 0;
  column-count: 2;
  column-gap: 2rem;
  column-rule: 1px solid rgba(23,19,15,.06);
  font-size: .95rem;
  line-height: 1.68;
  color: rgba(23,19,15,.78);
}
#screen-onboarding .ob-spread-gutter {
  display: block;
  width: 1px;
  align-self: stretch;
  margin: 0;
  background: rgba(126,79,22,.24);
}
#screen-onboarding .ob-spread > .ob-wrap,
[data-theme="dark"] #screen-onboarding .ob-spread > .ob-wrap {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 540px;
  margin: 0 12px 0 0;
  padding: 2.9rem 2.9rem 2.6rem;
  background:
    linear-gradient(180deg, #fffdf6 0%, #fffaf0 100%);
  border: 0;
  border-radius: 28px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.95) inset,
    0 0 0 1px rgba(23,19,15,.03),
    0 36px 72px -40px rgba(23,19,15,.38),
    0 18px 38px -26px rgba(143,15,58,.22),
    0 6px 14px -10px rgba(184,134,11,.18);
  color: #17130f;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s cubic-bezier(.2,.7,.2,1);
}
#screen-onboarding .ob-spread > .ob-wrap:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.95) inset,
    0 0 0 1px rgba(23,19,15,.04),
    0 44px 84px -40px rgba(23,19,15,.44),
    0 22px 44px -26px rgba(143,15,58,.26),
    0 8px 18px -10px rgba(184,134,11,.22);
}
#screen-onboarding .ob-spread > .ob-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(
    135deg,
    #d4a843 0%,
    #b8860b 28%,
    rgba(143,15,58,.55) 62%,
    #8f0f3a 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 1;
}
#screen-onboarding .ob-wrap::after,
#screen-onboarding .ob-rule,
#screen-onboarding .ob-brand,
#screen-onboarding .ob-eyebrow,
#screen-onboarding .ob-headline,
#screen-onboarding .ob-body,
#screen-onboarding .ob-profile-status,
#screen-onboarding .ob-profile-desc,
#screen-onboarding .ob-privacy-line {
  display: none;
}
#screen-onboarding .ob-form {
  gap: 1.15rem;
}
#screen-onboarding .ob-field {
  margin: 0;
}
#screen-onboarding .ob-label {
  margin-bottom: .65rem;
  font-family: var(--font-sans);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(23,19,15,.62);
}
#screen-onboarding .ob-label .ob-opt {
  margin-left: .35rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: .04em;
  text-transform: none;
  color: rgba(23,19,15,.4);
}
#screen-onboarding .ob-field:first-child .ob-label {
  text-align: center;
  padding-bottom: .9rem;
  margin: 0 0 1rem;
  font-size: .76rem;
  letter-spacing: .26em;
  color: #b8860b;
  border-bottom: 1px solid rgba(23,19,15,.08);
}
#screen-onboarding .ob-profile-card {
  overflow: visible;
  padding: 0 0 1.25rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#screen-onboarding .ob-profile-card::before,
#screen-onboarding .ob-profile-card::after {
  display: none;
}
#screen-onboarding .ob-profile-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.1rem;
}
#screen-onboarding .ob-template-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: #fffaf0;
  background: linear-gradient(135deg, #e5bc59 0%, #b8860b 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.38),
    0 10px 20px -14px rgba(23,19,15,.5);
}
#screen-onboarding .ob-template-icon svg {
  width: 32px;
  height: 32px;
}
/* The onboarding "book" paper is always cream (even in dark theme), so persona
   text must use the paper ink — not the theme --ink vars, which flip to light in
   dark mode and vanish on the cream card. */
#screen-onboarding .ob-persona-title { color: #17130f; }
#screen-onboarding .ob-persona-desc  { color: rgba(23,19,15,.66); }
#screen-onboarding .ob-profile-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -.015em;
  color: #17130f;
}
#screen-onboarding .ob-profile-pills {
  margin-top: .65rem;
  padding-left: 88px;
  gap: .35rem .45rem;
}
#screen-onboarding .ob-profile-pills span {
  padding: .32rem .65rem;
  background: linear-gradient(180deg, #fdf8ea 0%, #f8efd4 100%);
  border: 1px solid rgba(184,134,11,.32);
  border-radius: 999px;
  color: rgba(23,19,15,.82);
  font-family: var(--font-sans);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
#screen-onboarding .ob-profile-pills span:hover {
  transform: translateY(-1px);
  border-color: rgba(184,134,11,.55);
  box-shadow:
    0 1px 0 rgba(255,255,255,.7) inset,
    0 4px 10px -6px rgba(184,134,11,.35);
}
#screen-onboarding .ob-input-wrap,
#screen-onboarding .ob-input--full,
[data-theme="dark"] #screen-onboarding .ob-input-wrap,
[data-theme="dark"] #screen-onboarding .ob-input--full {
  min-height: 50px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(23,19,15,.14);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(23,19,15,.045);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
#screen-onboarding .ob-input-wrap:hover,
#screen-onboarding .ob-input--full:hover {
  border-color: rgba(184,134,11,.42);
  background: #fffefa;
}
#screen-onboarding .ob-input-wrap:focus-within,
#screen-onboarding .ob-input--full:focus,
[data-theme="dark"] #screen-onboarding .ob-input-wrap:focus-within,
[data-theme="dark"] #screen-onboarding .ob-input--full:focus {
  border-color: rgba(184,134,11,.7) !important;
  background: #fffefa;
  box-shadow:
    0 0 0 4px rgba(212,168,67,.18),
    inset 0 1px 2px rgba(23,19,15,.04) !important;
}
#screen-onboarding .ob-input,
#screen-onboarding .ob-input--full,
#screen-onboarding .ob-sym,
[data-theme="dark"] #screen-onboarding .ob-input,
[data-theme="dark"] #screen-onboarding .ob-input--full,
[data-theme="dark"] #screen-onboarding .ob-sym {
  color: #17130f;
}
#screen-onboarding .ob-input::placeholder,
#screen-onboarding .ob-input--full::placeholder {
  color: rgba(23,19,15,.36);
  font-weight: 400;
  font-style: italic;
}
#screen-onboarding .ob-input {
  padding: .85rem .75rem .85rem 0;
  font-size: 1rem;
}
#screen-onboarding .ob-input--full {
  padding: .85rem 1rem;
  font-size: 1rem;
}
#screen-onboarding .ob-sym {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(184,134,11,.85);
  padding: 0 .85rem 0 1rem;
}
#screen-onboarding .ob-btn,
[data-theme="dark"] #screen-onboarding .ob-btn {
  width: 100%;
  min-height: 56px;
  margin-top: .8rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 10px;
  color: #2a1d05;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -.005em;
  background: #dfae4a;
  box-shadow:
    0 1px 0 rgba(255,255,255,.25) inset,
    0 0 0 1px rgba(184,134,11,.45),
    0 12px 28px -14px rgba(184,134,11,.45);
  transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s ease, background .18s ease;
}
#screen-onboarding .ob-btn:hover,
[data-theme="dark"] #screen-onboarding .ob-btn:hover {
  color: #1d1303;
  background: #e7b956;
  box-shadow:
    0 1px 0 rgba(255,255,255,.3) inset,
    0 0 0 1px rgba(212,168,67,.55),
    0 18px 36px -16px rgba(184,134,11,.5);
  transform: translateY(-1px);
}
#screen-onboarding .ob-btn:active,
[data-theme="dark"] #screen-onboarding .ob-btn:active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(255,255,255,.06) inset,
    0 0 0 1px rgba(184,134,11,.18),
    0 6px 14px -8px rgba(23,19,15,.55);
}
#screen-onboarding .ob-btn svg {
  width: 18px;
  height: 18px;
  stroke: #2a1d05;
  stroke-width: 2;
  margin-left: .4rem;
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
#screen-onboarding .ob-btn:hover svg {
  transform: translateX(3px);
}
#screen-onboarding .ob-install {
  margin-top: .8rem;
  padding-top: 0;
  border-top: 0;
}
#screen-onboarding .ob-install-btn {
  width: 100%;
  min-height: 46px;
  border-radius: 8px;
  border: 1.5px dashed rgba(184,134,11,.55);
  background: transparent;
  color: rgba(23,19,15,.78);
  font-family: var(--font-sans);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: none;
}
#screen-onboarding .ob-install-btn:hover {
  background: rgba(184,134,11,.06);
  border-color: rgba(184,134,11,.75);
  color: #17130f;
  transform: none;
  box-shadow: none;
}
#screen-onboarding .ob-install-btn svg {
  width: 16px;
  height: 16px;
  stroke: #b8860b;
}
#screen-onboarding .ob-install-hint {
  display: none;
}

@media (max-width: 1099px) {
  #screen-onboarding .ob-spread {
    display: flex;
    width: min(100% - 32px, 580px);
    min-height: auto;
    justify-content: center;
  }
  #screen-onboarding .ob-spread > .ob-wrap,
  [data-theme="dark"] #screen-onboarding .ob-spread > .ob-wrap {
    justify-self: center;
    margin: 0;
  }
  #screen-onboarding .ob-editorial,
  #screen-onboarding .ob-spread-gutter {
    display: none;
  }
}

@media (max-width: 520px) {
  #screen-onboarding {
    align-items: flex-start;
    overflow-y: auto;
    padding: 18px 0;
  }
  #screen-onboarding .ob-spread {
    width: calc(100% - 24px);
  }
  #screen-onboarding .ob-spread > .ob-wrap {
    padding: 1.75rem 1.25rem 1.75rem;
    margin: 0;
  }
  #screen-onboarding .ob-spread > .ob-wrap:hover {
    transform: none;
  }
  #screen-onboarding .ob-profile-head {
    grid-template-columns: auto 1fr;
  }
  #screen-onboarding .ob-profile-pills {
    padding-left: 0;
  }
}

/* ══════════════════════════════════════════════════════════════════
   SAVENTRA AI COMPANION  (floating, dockable chat) → app-ai.js
═══════════════════════════════════════════════════════════════════ */
/* Quiet outline — gold is reserved for the page's main CTA (one gold per block) */
.ai-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--ink-1);
  font: 600 .78rem/1 var(--font-sans);
  cursor: pointer;
  transition: border-color .15s, transform .12s, background .15s;
}
.ai-topbar-btn svg { width: 14px; height: 14px; fill: var(--gold); }
.ai-topbar-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
[data-theme="dark"] .ai-topbar-btn {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.14);
  color: var(--ink-onDark-1);
}
.ai-topbar-btn[data-mode="local"]::after {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 2px rgba(34,160,107,.25);
}
.ai-topbar-btn[data-mode="cloud"]::after {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
}

.ai-orb {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 15000;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--gold) 0%, #d8a72a 45%, var(--accent) 130%);
  box-shadow: 0 10px 26px rgba(184,134,11,.4), 0 4px 10px rgba(12,15,20,.25);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.ai-orb:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 34px rgba(184,134,11,.5); }
.ai-orb:active { transform: scale(.97); }
.ai-orb svg { width: 26px; height: 26px; fill: currentColor; }

/* The AI companion belongs to the app — hide it on the auth/onboarding screens
   (it mounts on load, so gate it to when #screen-app is the active screen). */
body:not(:has(#screen-app.active)) #ai-orb,
body:not(:has(#screen-app.active)) #ai-panel,
body:not(:has(#screen-app.active)) #ai-backdrop {
  display: none !important;
}
.ai-orb.hidden { opacity: 0; pointer-events: none; transform: scale(.6); }

/* Premium full-screen blur backdrop — click to dismiss */
.ai-backdrop {
  position: fixed;
  inset: 0;
  z-index: 15000;
  background: radial-gradient(130% 130% at 82% 50%, rgba(12,15,20,.32), rgba(8,11,16,.62));
  backdrop-filter: blur(16px) saturate(116%);
  -webkit-backdrop-filter: blur(16px) saturate(116%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .36s ease;
}
.ai-backdrop.show { opacity: 1; pointer-events: auto; }

.ai-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 15002;
  width: min(680px, 94vw);
  max-width: 94vw;
  height: min(880px, 88vh);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(184,134,11,.06), transparent 160px),
    var(--surface-1);
  border: 1px solid rgba(184,134,11,.26);
  border-radius: 24px;
  box-shadow:
    0 60px 160px rgba(8,11,16,.60),
    0 24px 70px rgba(8,11,16,.45),
    inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 18px)) scale(.97);
  transition: opacity .34s cubic-bezier(.22,.85,.3,1), transform .34s cubic-bezier(.22,.85,.3,1);
  font-family: var(--font-sans);
}
.ai-panel.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
/* When closed, fully remove from hit-testing so it never blocks the page */
.ai-panel[hidden] { display: none !important; }
.ai-backdrop[hidden] { display: none !important; }

.ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(184,134,11,.07), transparent);
}
.ai-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--ink-1);
  flex: 1;
  min-width: 0;
}
.ai-head-pill {
  font-size: .62rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 100px; flex-shrink: 0;
}
.ai-head-pill--local { color: #1d7a4c; background: rgba(34,160,107,.12); }
.ai-head-pill--cloud { color: var(--gold); background: var(--gold-dim, rgba(184,134,11,.12)); }
.ai-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 3px rgba(34,160,107,.2);
  flex-shrink: 0;
}
.ai-dot--cloud { background: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,11,.18); }
.ai-head-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ai-icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: none; background: transparent; border-radius: 8px; cursor: pointer;
  color: var(--ink-3); transition: background .15s, color .15s;
}
.ai-icon-btn:hover { background: var(--surface-2); color: var(--ink-1); }
.ai-icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ai-body {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
.ai-settings-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.ai-settings-overlay.show,
.ai-settings-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}
.ai-settings-inner {
  padding: 18px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-settings-title { margin: 0; font-size: 1.05rem; color: var(--ink-1); }
.ai-settings-lede { margin: 0; font-size: .8rem; color: var(--ink-3); line-height: 1.45; }
.ai-managed-note {
  margin: 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--ink-2);
  background: linear-gradient(180deg, rgba(184,134,11,.10), rgba(184,134,11,.04));
  border: 1px solid rgba(184,134,11,.28);
  border-radius: 12px;
  padding: .7rem .85rem;
}
.ai-managed-note[hidden] { display: none; }
.ai-settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ai-ghost-btn {
  border: 1px solid var(--border); background: transparent; cursor: pointer;
  font: 600 .82rem/1 var(--font-sans); color: var(--ink-2);
  padding: 8px 14px; border-radius: 8px;
}
.ai-ghost-btn:hover { border-color: var(--ink-3); color: var(--ink-1); }
.ai-field { display: flex; flex-direction: column; gap: 4px; font-size: .76rem; color: var(--ink-3); }
.ai-field select, .ai-field input {
  font-family: var(--font-sans); font-size: .86rem; color: var(--ink-1);
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-1); outline: none;
}
.ai-field select:focus, .ai-field input:focus { border-color: var(--gold); }
.ai-save-btn {
  align-self: flex-start; border: none; cursor: pointer;
  background: var(--ink-1); color: var(--surface-1);
  font-weight: 600; font-size: .82rem; padding: 8px 16px; border-radius: 8px;
}
.ai-note { font-size: .68rem; color: var(--ink-3); margin: 0; line-height: 1.4; }

.ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-1);
}
.ai-msg { max-width: 92%; font-size: .9rem; line-height: 1.55; }
.ai-muted { font-size: .78rem; color: var(--ink-3); }
.ai-msg p { margin: 0; }
.ai-msg--user {
  align-self: flex-end;
  background: var(--ink-1); color: var(--surface-1);
  padding: 9px 13px; border-radius: 14px 14px 4px 14px;
}
.ai-msg--assistant {
  align-self: flex-start;
  background: var(--surface-2); color: var(--ink-1);
  padding: 9px 13px; border-radius: 14px 14px 14px 4px;
}
.ai-msg--sys { align-self: stretch; max-width: 100%; color: var(--ink-2); }
.ai-msg--sys p { margin: 0 0 8px; }
.ai-mode { font-size: .78rem; margin: 0 0 10px; line-height: 1.45; }
.ai-mode--local { color: var(--ink-2); }
.ai-mode--cloud { color: #1d7a4c; }
.ai-examples { font-size: .76rem; color: var(--ink-3); }
.ai-orb[data-mode="local"]::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #22a06b;
  border: 2px solid var(--surface-1);
}
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip {
  border: 1px solid var(--border); background: var(--surface-1); cursor: pointer;
  font-size: .78rem; color: var(--ink-1); padding: 6px 11px; border-radius: 100px;
  transition: border-color .15s, color .15s;
}
.ai-chip:hover { border-color: var(--gold); color: var(--gold); }

.ai-action {
  font-size: .78rem; font-weight: 600; padding: 7px 11px; border-radius: 8px;
  display: inline-block;
}
.ai-action--ok  { background: rgba(34,139,87,.12); color: #1d7a4c; }
.ai-action--err { background: rgba(153,15,61,.1); color: var(--accent); }
.ai-err { color: var(--accent); }

.ai-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.ai-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3);
  animation: aiBlink 1.2s infinite ease-in-out;
}
.ai-typing i:nth-child(2) { animation-delay: .2s; }
.ai-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ai-composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-1);
}
.ai-composer textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font-family: var(--font-sans); font-size: .88rem; color: var(--ink-1);
  background: var(--surface-2); outline: none; max-height: 120px; line-height: 1.4;
}
.ai-composer textarea:focus { border-color: var(--gold); }
.ai-send {
  width: 38px; height: 38px; flex: none; border: none; cursor: pointer; border-radius: 50%;
  display: grid; place-items: center; color: #2a1d05;
  background: #dfae4a;
}
.ai-send:disabled { opacity: .5; cursor: default; }
.ai-send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Voice input mic */
.ai-mic {
  width: 38px; height: 38px; flex: none; cursor: pointer; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: color .15s, background .15s, border-color .15s, transform .12s;
}
.ai-mic:hover { color: var(--ink-1); border-color: var(--border-md); transform: translateY(-1px); }
.ai-mic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-mic.recording {
  color: #fff; border-color: transparent;
  background: linear-gradient(145deg, var(--red, #c0392b), #e05a4b);
  animation: aiMicPulse 1.3s ease-in-out infinite;
}
@keyframes aiMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,.45); }
  50%      { box-shadow: 0 0 0 7px rgba(192,57,43,0); }
}
.ai-mic.busy { opacity: .6; cursor: default; }
.ai-mic.busy svg { animation: aiMicSpin 1s linear infinite; }
@keyframes aiMicSpin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .ai-panel {
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    border-radius: 0; border: none;
    transform: translate(0, 22px) scale(1);
  }
  .ai-panel.show { transform: translate(0, 0) scale(1); }
  .ai-orb { right: 16px; bottom: 80px; }
}

/* ── AI orb proactive badge (coach pending) ──────────────────────── */
.ai-orb--badge::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #c0392b;
  border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 0 rgba(192,57,43,.55);
  animation: coachBadgePulse 1.8s ease-out infinite;
  z-index: 2;
}
@keyframes coachBadgePulse {
  0%   { box-shadow: 0 0 0 0 rgba(192,57,43,.55); }
  70%  { box-shadow: 0 0 0 9px rgba(192,57,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); }
}

/* ── COACH PAGE ──────────────────────────────────────────────────── */
.ob-btn--ghost {
  background: var(--surface-2);
  color: var(--ink-1);
  border: 1px solid var(--border);
  box-shadow: none;
}
.ob-btn--ghost:hover { background: var(--surface-3); color: var(--ink-1); }
[data-theme="dark"] .ob-btn--ghost {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
  color: var(--ink-onDark-1);
}

#view-coach { max-width: 920px; }
/* Spacing matches the rest of the workspace (UX spec June 2026) */
.coach-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.6rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
/* Section heads match the workspace-wide title treatment (UX spec) */
.coach-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem; padding-bottom: .75rem; gap: .75rem;
  border-bottom: 1px solid var(--border);
}
.coach-kicker {
  font-family: var(--font-serif);
  font-size: 1.05rem; font-weight: 500;
  letter-spacing: -.01em; text-transform: none;
  color: var(--ink-1);
}
[data-theme="dark"] .coach-kicker { color: var(--ink-onDark-1); }
[data-theme="dark"] .coach-card-head { border-bottom-color: rgba(255,255,255,.08); }
.coach-src, .coach-msg-src { font-size: .72rem; color: var(--ink-3); }
.coach-line { font-size: .95rem; color: var(--ink-1); margin: 0 0 .9rem; line-height: 1.5; }
.coach-muted { color: var(--ink-3); }
.coach-note { font-size: .8rem; color: var(--ink-3); margin: .5rem 0 0; line-height: 1.45; }
.coach-note code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .74rem; }

/* distribution */
.coach-dist { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1rem; }
.coach-dist-row { display: grid; grid-template-columns: 9rem 1fr auto; align-items: center; gap: .7rem; }
.coach-dist-name { font-size: .85rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-dist-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.coach-dist-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #d4af37, #b8860b); }
.coach-dist-amt { font-size: .85rem; font-weight: 700; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.coach-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.coach-inline-btn {
  background: none; border: none; color: var(--accent, #b8860b);
  font-weight: 600; font-size: .82rem; cursor: pointer; padding: .25rem 0; margin-top: .4rem;
}
.coach-inline-btn:hover { text-decoration: underline; }

/* leaks */
.coach-leaks { display: flex; flex-direction: column; gap: .75rem; }
.coach-leak {
  border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: 12px; padding: .8rem .95rem; background: var(--surface-2);
}
.coach-leak--warn { border-left-color: #d98e04; }
.coach-leak--info { border-left-color: #2f7ed8; }
.coach-leak-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.coach-leak-title { font-size: .9rem; font-weight: 700; color: var(--ink-1); }
.coach-leak-save { font-size: .78rem; font-weight: 700; color: #1d7a4c; white-space: nowrap; }
.coach-leak-detail { font-size: .83rem; color: var(--ink-2); margin: .35rem 0 0; line-height: 1.45; }

/* weekly */
.coach-week { display: flex; flex-direction: column; gap: .5rem; }
.coach-week-row { display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: baseline; font-size: .85rem; }
.coach-week-row strong { color: var(--ink-1); font-variant-numeric: tabular-nums; }
.coach-week-row em { color: var(--ink-3); font-style: normal; font-size: .76rem; }

/* deep chat */
.coach-rag-pill {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .2rem .55rem; border-radius: 99px; background: var(--surface-2); color: var(--ink-3);
}
.coach-rag-pill.on { background: rgba(29,122,76,.12); color: #1d7a4c; }
/* chat header: kicker + mode toggle on the left, status pill on the right */
.coach-chat-head { flex-wrap: wrap; }
.coach-chat-head-left { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
/* General / Companion segmented toggle — solid-gold active per UX button hierarchy */
.coach-mode-toggle {
  display: inline-flex; gap: .15rem; padding: .15rem;
  background: var(--surface-3); border-radius: 8px;
}
.coach-mode-btn {
  border: none; cursor: pointer; padding: .25rem .65rem; border-radius: 6px;
  font-size: .8125rem; font-weight: 600; line-height: 1.2; /* 13px — accessibility (designer request) */
  background: transparent; color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.coach-mode-btn:hover { color: var(--ink-1); }
.coach-mode-btn.is-active { background: #dfae4a; color: #2a1d05; }
[data-theme="dark"] .coach-mode-btn.is-active { background: #dfae4a; color: #2a1d05; }
/* companion quiz card */
.coach-quiz-form { margin-top: .5rem; }
.coach-quiz-form .ob-field:last-of-type { margin-bottom: 1rem; }
.coach-quiz-result { text-align: center; padding: 1.5rem 0; }
.coach-quiz-result strong { color: var(--gold); }
/* Coach view header — description paragraph + "Open Coach" launcher button */
.coach-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.coach-view-head .view-intro { flex: 1; min-width: 260px; margin-bottom: 0; }
.coach-open-btn { flex-shrink: 0; }

/* Deep Coaching overlay — centered panel + blurred backdrop (mirrors .ai-panel/.ai-backdrop) */
.coach-chat-backdrop {
  position: fixed; inset: 0; z-index: 15000;
  background: radial-gradient(130% 130% at 82% 50%, rgba(12,15,20,.32), rgba(8,11,16,.62));
  backdrop-filter: blur(16px) saturate(116%);
  -webkit-backdrop-filter: blur(16px) saturate(116%);
  opacity: 0; pointer-events: none; transition: opacity .36s ease;
}
.coach-chat-backdrop.show { opacity: 1; pointer-events: auto; }
.coach-chat-backdrop[hidden] { display: none !important; }

.coach-chat-modal {
  position: fixed; top: 50%; left: 50%; z-index: 15002;
  width: min(680px, 94vw); max-width: 94vw;
  height: min(760px, 86vh); max-height: 92vh;
  display: flex; flex-direction: column;
  padding: 1.25rem;
  background:
    linear-gradient(180deg, rgba(184,134,11,.06), transparent 160px),
    var(--surface-1);
  border: 1px solid rgba(184,134,11,.26);
  border-radius: 24px;
  box-shadow:
    0 60px 160px rgba(8,11,16,.60),
    0 24px 70px rgba(8,11,16,.45),
    inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 18px)) scale(.97);
  transition: opacity .34s cubic-bezier(.22,.85,.3,1), transform .34s cubic-bezier(.22,.85,.3,1);
}
.coach-chat-modal.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.coach-chat-modal[hidden] { display: none !important; }

/* Larger displays get a proportionally larger coaching panel — the 680×760
   base is sized for laptops and looks like a small box on big monitors
   (Artur's external display). Laptop layouts (<1440px) are untouched. */
@media (min-width: 1440px) {
  .coach-chat-modal {
    width: min(860px, 72vw);
    height: min(850px, 86vh);
  }
}
@media (min-width: 1920px) {
  .coach-chat-modal {
    width: min(1020px, 62vw);
    height: min(940px, 84vh);
  }
}

#coach-chat-modal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* The chat card fills the overlay (the panel already provides the surface). */
#coach-chat-modal-body .coach-chat-card {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  margin: 0; padding: 0; background: transparent; border: none; box-shadow: none;
}
#coach-chat-modal-body .coach-chat-head { padding-right: 2.2rem; }
#coach-chat-modal-body .coach-messages { flex: 1; max-height: none; }

.coach-chat-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.coach-chat-close:hover { background: var(--surface-3); color: var(--ink-1); border-color: var(--ink-3); }
.coach-chat-close svg { width: 18px; height: 18px; }

.coach-messages {
  display: flex; flex-direction: column; gap: .65rem;
  max-height: 360px; overflow-y: auto; padding: .25rem 0 .75rem;
}
.coach-msg { max-width: 88%; padding: .65rem .85rem; border-radius: 14px; font-size: .88rem; line-height: 1.5; }
.coach-msg p { margin: 0; }
.coach-msg--user { align-self: flex-end; background: linear-gradient(135deg, #d4af37, #b8860b); color: #1a1303; border-bottom-right-radius: 4px; }
.coach-msg--ai { align-self: flex-start; background: var(--surface-2); color: var(--ink-1); border-bottom-left-radius: 4px; }
.coach-msg-src { display: block; margin-top: .35rem; opacity: .7; }
.coach-composer { display: flex; gap: .55rem; align-items: flex-end; border-top: 1px solid var(--line); padding-top: .8rem; }
.coach-composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px;
  padding: .6rem .75rem; font: inherit; font-size: .88rem; background: var(--surface-1); color: var(--ink-1);
  max-height: 120px;
}
.coach-composer textarea:focus { outline: none; border-color: var(--accent, #b8860b); }

/* engineer console */
.coach-console { padding: 0; }
/* Own-page variant — gold treatment, first element on the page (UX spec) */
.coach-console--page {
  padding: 1.25rem 1.35rem;
  border: 1px solid rgba(184,134,11,.45);
  background: var(--gold-dim, rgba(184,134,11,.1));
}
[data-theme="dark"] .coach-console--page {
  border-color: rgba(212,168,67,.35);
  background: rgba(212,168,67,.08);
}
.coach-console > summary {
  list-style: none; cursor: pointer; padding: 1.1rem 1.35rem;
  display: flex; align-items: center; gap: .5rem;
}
.coach-console > summary::-webkit-details-marker { display: none; }
.coach-console > summary::after { content: '⌄'; margin-left: auto; color: var(--ink-3); transition: transform .2s; }
.coach-console[open] > summary::after { transform: rotate(180deg); }
.coach-console > *:not(summary) { padding-left: 1.35rem; padding-right: 1.35rem; }
.coach-console > *:last-child { padding-bottom: 1.25rem; }
.coach-field { display: flex; flex-direction: column; gap: .3rem; margin: .7rem 0; }
.coach-field span { font-size: .76rem; font-weight: 600; color: var(--ink-2); }
.coach-field input {
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem;
  font: inherit; font-size: .85rem; background: var(--surface-1); color: var(--ink-1);
}
.coach-field input:focus { outline: none; border-color: var(--accent, #b8860b); }
.coach-rag-status { font-size: .78rem; color: var(--ink-3); margin: .5rem 0 0; }
.coach-citations { margin-top: .9rem; display: flex; flex-direction: column; gap: .5rem; }
.coach-cite-title, .coach-chart-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: .3rem; }
.coach-cite { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; background: var(--surface-2); }
.coach-cite-src { display: block; font-size: .78rem; font-weight: 700; color: var(--ink-1); }
.coach-cite-snip { display: block; font-size: .78rem; color: var(--ink-3); margin-top: .25rem; line-height: 1.4; }

/* leak chart */
.coach-chart { margin-top: 1rem; }
.coach-chart-row { display: grid; grid-template-columns: 10rem 1fr auto; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.coach-chart-label { font-size: .78rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-chart-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.coach-chart-track > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1d7a4c, #22a06b); }
.coach-chart-val { font-size: .8rem; font-weight: 700; color: #1d7a4c; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .coach-dist-row { grid-template-columns: 7rem 1fr auto; }
  .coach-chart-row { grid-template-columns: 7rem 1fr auto; }
  .coach-msg { max-width: 94%; }
}

/* ── SMART BUY ADVISOR ───────────────────────────────────────────── */
.sb-box {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.35rem 1.45rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.sb-box-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sb-box-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.3rem; margin: 0; color: var(--ink-1); }
.sb-box-sub { font-size: .8rem; color: var(--ink-3); }
.sb-box-text { font-size: .9rem; color: var(--ink-2); margin: .5rem 0 1rem; line-height: 1.5; }
.sb-privacy {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .2rem .55rem; border-radius: 99px; background: rgba(29,122,76,.12); color: #1d7a4c; white-space: nowrap; cursor: help;
}
.sb-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.sb-form .ob-input { flex: 1; min-width: 200px; padding: .7rem .85rem; }
.sb-form .sb-max { flex: 0 0 130px; min-width: 100px; }

/* results */
.sb-loading { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ink-3); padding: 1rem 0; }
.sb-empty { padding: 1rem 0 .25rem; font-size: .88rem; color: var(--ink-2); }
.sb-empty-note { font-size: .8rem; color: var(--ink-3); margin-top: .35rem; }
.sb-summary { margin-top: 1.1rem; }
.sb-summary-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
/* Regular text per UX spec (was uppercase accent — messaging unclear) */
.sb-kicker { font-size: .85rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.sb-fit { font-size: .85rem; border-radius: 10px; padding: .55rem .75rem; margin: .25rem 0 .5rem; }
.sb-fit--ok { background: rgba(29,122,76,.1); color: #1d7a4c; }
.sb-fit--warn { background: rgba(192,57,43,.1); color: #b3402f; }
.sb-verdict-box { font-size: .88rem; color: var(--ink-1); line-height: 1.5; background: var(--surface-2); border-radius: 12px; padding: .7rem .85rem; margin-top: .4rem; }

/* comparison cards */
.sb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .85rem; margin-top: 1rem; }
.sb-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-1); transition: box-shadow .15s, transform .15s; }
.sb-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.08); transform: translateY(-2px); }
.sb-card--best { border-color: var(--accent, #b8860b); box-shadow: 0 0 0 1px var(--accent, #b8860b) inset; }
.sb-card-img { height: 120px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.sb-card-img img { max-height: 100%; max-width: 100%; object-fit: contain; }
.sb-card-body { display: flex; flex-direction: column; gap: .4rem; padding: .7rem .8rem .8rem; flex: 1; }
.sb-card-top { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sb-best-badge { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--accent, #b8860b); color: #1a1303; padding: .15rem .45rem; border-radius: 99px; }
.sb-retailer { font-size: .74rem; color: var(--ink-3); }
.sb-oos { font-size: .68rem; color: #b3402f; font-weight: 600; }
.sb-card-title { font-size: .86rem; font-weight: 600; color: var(--ink-1); line-height: 1.35; flex: 1; }
.sb-card-foot { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: auto; }
.sb-price { font-size: 1.05rem; font-weight: 700; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.sb-save { font-size: .72rem; font-weight: 700; color: #1d7a4c; }
.sb-go { font-size: .8rem; font-weight: 600; color: var(--accent, #b8860b); text-decoration: none; margin-left: auto; }
.sb-go:hover { text-decoration: underline; }

/* grounded note + citations */
.sb-ground { margin-top: .75rem; }
.sb-ground-box { font-size: .84rem; color: var(--ink-2); line-height: 1.5; background: var(--surface-2); border-radius: 10px; padding: .6rem .75rem; }
.sb-cites { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.sb-cite { font-size: .72rem; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: .2rem .55rem; text-decoration: none; }
.sb-cite:hover { color: var(--accent, #b8860b); }

/* engineer console */
.sb-console { margin-top: 1.1rem; border-top: 1px solid var(--line); }
.sb-console > summary { list-style: none; cursor: pointer; padding: .85rem 0 .25rem; display: flex; align-items: center; gap: .5rem; }
.sb-console > summary::-webkit-details-marker { display: none; }
.sb-console > summary::after { content: '⌄'; margin-left: auto; color: var(--ink-3); transition: transform .2s; }
.sb-console[open] > summary::after { transform: rotate(180deg); }
.sb-note { font-size: .8rem; color: var(--ink-3); margin: .4rem 0 .6rem; line-height: 1.45; }
.sb-note code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .74rem; }
.sb-field { display: flex; flex-direction: column; gap: .3rem; margin: .6rem 0; }
.sb-field span { font-size: .76rem; font-weight: 600; color: var(--ink-2); }
.sb-field input { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; font: inherit; font-size: .85rem; background: var(--surface-1); color: var(--ink-1); }
.sb-field input:focus { outline: none; border-color: var(--accent, #b8860b); }
.sb-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.sb-status { font-size: .78rem; color: var(--ink-3); margin: .5rem 0 0; }

@media (max-width: 560px) {
  .sb-cards { grid-template-columns: 1fr 1fr; }
  .sb-form .sb-max { flex-basis: 100%; }
}

/* ═══════════════════════════════════════════════════════
   HELP & FEEDBACK — getting-started video + message form
   Uses theme variables only, so it adapts to dark mode.
═══════════════════════════════════════════════════════ */
.help-wrap, .fb-wrap { max-width: 720px; }

/* Help — video card / placeholder */
.help-video-card {
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.help-video-card iframe,
.help-video-card video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.help-video-ph {
  aspect-ratio: 16 / 9;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .65rem; text-align: center; padding: 1.5rem;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--accent-dim), transparent 70%),
    var(--surface-2);
}
.help-play {
  width: 58px; height: 58px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); box-shadow: 0 6px 18px var(--accent-glow);
}
.help-play svg { width: 24px; height: 24px; fill: #fff; transform: translateX(2px); }
.help-ph-title { font-size: .98rem; font-weight: 600; color: var(--ink-1); }
.help-ph-note { font-size: .82rem; color: var(--ink-3); }

/* Feedback — form card */
.fb-card {
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.fb-field { display: flex; flex-direction: column; gap: .35rem; position: relative; }
.fb-field > span { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.fb-field input,
.fb-field textarea {
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  font: inherit; font-size: .88rem;
  background: var(--surface-2);
  color: var(--ink-1);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.fb-field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.fb-field input::placeholder,
.fb-field textarea::placeholder { color: var(--ink-4); }
.fb-field input:focus,
.fb-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.fb-counter { align-self: flex-end; font-size: .72rem; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* Honeypot — visually removed, kept in the a11y/keyboard-free flow for bots */
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.fb-actions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.fb-status { font-size: .8rem; color: var(--ink-3); }
.fb-status--ok { color: var(--green); }
.fb-status--warn { color: var(--red); }

@media (max-width: 560px) {
  .fb-card { padding: 1rem; }
}

