*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }

:root {
  --bg: #f3f4f8;
  --panel: #ffffff;
  --panel-2: #f5f6fa;
  --panel-3: #eceef4;
  --line: #e4e6ee;
  --line-2: #d6d9e3;
  --text: #11131f;
  --muted: #646a80;
  --faint: #9ba0b3;
  --accent: #5f5cf6;
  --accent-2: #8b5cf6;
  --good: #14a865;
  --warn: #d98a06;
  --bad: #e5484d;
  --tip: #15171f;
  --tip-text: #f2f3f8;
  --shadow: 0 1px 2px rgba(17, 19, 31, .05), 0 6px 24px -10px rgba(17, 19, 31, .14);
  --shadow-lg: 0 30px 80px -24px rgba(26, 24, 80, .35), 0 2px 6px rgba(17, 19, 31, .06);
  --glow-a: rgba(95, 92, 246, .16);
  --glow-b: rgba(255, 111, 145, .12);
  --glow-c: rgba(47, 207, 143, .12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0b10;
  --panel: #12141b;
  --panel-2: #181a23;
  --panel-3: #20232e;
  --line: #232633;
  --line-2: #2e3242;
  --text: #eceef6;
  --muted: #9298ad;
  --faint: #5e6479;
  --accent: #7c7aff;
  --accent-2: #a78bfa;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --tip: #f4f5fa;
  --tip-text: #12141b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 40px 100px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .03);
  --glow-a: rgba(124, 122, 255, .16);
  --glow-b: rgba(255, 111, 145, .09);
  --glow-c: rgba(47, 207, 143, .08);
  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s;
}
.modal body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
b, strong { font-weight: 650; }
input:focus-visible, button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ═══ Ambient glow ═══ */
.glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.glow i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(60px); animation: float 26s ease-in-out infinite alternate; }
.glow i:nth-child(1) { background: radial-gradient(circle, var(--glow-a), transparent 65%); left: -15vmax; top: -25vmax; }
.glow i:nth-child(2) { background: radial-gradient(circle, var(--glow-b), transparent 65%); right: -20vmax; top: 10vh; animation-delay: -9s; }
.glow i:nth-child(3) { background: radial-gradient(circle, var(--glow-c), transparent 65%); left: 20vw; bottom: -35vmax; animation-delay: -17s; }
@keyframes float { to { transform: translate(6vmax, 4vmax) scale(1.08); } }

/* ═══ Shared controls ═══ */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  min-width: 0;
}
.ch { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ch h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.ch p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.ibtn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted);
  transition: background .2s, color .2s, transform .2s;
}
.ibtn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.ibtn:active { transform: scale(.94); }
.ibtn.sm { width: 26px; height: 26px; border-radius: 8px; }
.ibtn.sm .ico { width: 15px; height: 15px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 11px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap;
  box-shadow: 0 6px 16px -8px var(--accent);
  transition: transform .2s var(--ease), filter .2s, background .2s;
}
.btn .ico { width: 16px; height: 16px; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.armed { background: var(--bad); color: #fff; border-color: transparent; }

.link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 4px 2px; color: var(--accent); font-weight: 600; font-size: 12.5px; }
.link .ico { width: 15px; height: 15px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--bad); }

.seg {
  position: relative; display: inline-flex; padding: 3px; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; isolation: isolate;
}
.seg button {
  position: relative; z-index: 1; border: 0; background: none; padding: 6px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 550; font-size: 13px; white-space: nowrap; transition: color .25s;
}
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); }
.seg-ind {
  position: absolute; z-index: 0; left: 0; top: 3px; bottom: 3px; border-radius: 9px;
  background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 1px var(--line);
  transition: transform .38s var(--ease), width .38s var(--ease), opacity .2s;
}
:root[data-theme="dark"] .seg-ind { background: var(--panel-3); }
.seg.small button { padding: 4px 10px; font-size: 12.5px; }
.seg.tiny { padding: 2px; border-radius: 9px; }
.seg.tiny button { padding: 2px 9px; font-size: 12px; border-radius: 7px; }
.seg.tiny .seg-ind { top: 2px; bottom: 2px; border-radius: 7px; }

.money-in {
  display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.money-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); background: var(--panel); }
.money-in > span { color: var(--faint); font-weight: 500; }
.money-in input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.money-in.sm { height: 30px; padding: 0 8px; border-radius: 9px; }
.money-in.sm input { text-align: right; font-size: 13px; }
.money-in em { font-style: normal; color: var(--muted); white-space: nowrap; }

input[type="range"] { accent-color: var(--accent); width: 100%; margin: 6px 0 2px; cursor: pointer; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 550; transition: all .2s; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.muted { color: var(--muted); }
.hatch { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .45) 0 3px, transparent 3px 7px) !important; }

/* ═══ Intro ═══ */
.intro {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 24px 16px; overflow-y: auto;
}
.intro::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--bg); opacity: .0; }
.intro-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; animation: rise .8s var(--ease) both; }
.intro-note { margin: 0; color: var(--faint); font-size: 12.5px; animation: rise .8s var(--ease) .3s both; }
.intro.leaving .intro-brand, .intro.leaving .intro-note { transition: opacity .3s, transform .3s; opacity: 0; transform: translateY(-8px); }
.intro.leaving { pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.logo { display: inline-flex; align-items: flex-end; gap: 2px; width: 26px; height: 26px; padding: 5px 5px 6px; border-radius: 8px; background: var(--text); }
.logo i { flex: 1; border-radius: 2px; }
.logo i:nth-child(1) { height: 90%; background: #5b74ff; }
.logo i:nth-child(2) { height: 60%; background: #ff6f91; }
.logo i:nth-child(3) { height: 40%; background: #2fcf8f; }

/* Income card — intro face */
.income.mode-intro {
  width: min(560px, 100%); padding: 34px 34px 28px; border-radius: 28px; box-shadow: var(--shadow-lg);
  animation: pop .9s var(--ease) .1s both;
}
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.income .ic-face { display: flex; flex-direction: column; height: 100%; transition: opacity .34s ease-out, transform .34s ease-out; }
.income.fading .ic-face { opacity: 0; transform: translateY(6px); transition-duration: .17s; }
.ic-q { margin: 0 0 22px; font-size: clamp(28px, 6vw, 38px); line-height: 1.08; letter-spacing: -.035em; font-weight: 750; }
.ic-q span { white-space: nowrap; background: linear-gradient(100deg, var(--accent), #ff6f91 60%, #ffb547); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mode-intro .ic-ch, .mode-intro .ic-dash { display: none; }
.mode-dash .ic-q, .mode-dash .go { display: none; }

.sources { display: flex; flex-direction: column; gap: 14px; }
.src { position: relative; }
.mode-intro .src + .src { padding-top: 16px; border-top: 1px dashed var(--line-2); }
.src-top { display: flex; align-items: center; gap: 10px; }
.src-name { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font-weight: 600; padding: 2px 0; }
.src-name::placeholder { color: var(--faint); }
.mode-intro .sources:not(.multi) .src-name { display: none; }
.mode-intro .src-name { font-size: 15px; }
.mode-intro .src-top { margin-bottom: 14px; }
.src-main { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 14px; }

.mode-intro .money-in.big {
  flex: 1 1 260px; height: auto; padding: 0 0 4px; background: none; border: 0; border-bottom: 2px solid var(--line-2); border-radius: 0; box-shadow: none;
}
.mode-intro .money-in.big:focus-within { border-bottom-color: var(--accent); }
.mode-intro .money-in.big > span { font-size: 40px; font-weight: 600; color: var(--faint); }
.mode-intro .money-in.big input { font-size: 46px; font-weight: 750; letter-spacing: -.03em; padding: 0 6px; }
.mode-intro .money-in.big input::placeholder { color: var(--line-2); }
.mode-intro .money-in.big em { font-size: 15px; padding-bottom: 10px; }
.hrs { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.hrs .x { color: var(--faint); }
.hrs input { width: 46px; height: 34px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; text-align: center; font-weight: 600; outline: 0; }
.hrs input:focus { border-color: var(--accent); }
.hrs em { font-style: normal; font-size: 13px; }
.mode-intro .hrs { padding-bottom: 10px; }
.mode-intro .hrs.salaried { display: none; }
.src.capped .src-preview { color: var(--warn); }
.src-preview { min-height: 20px; margin-top: 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.add-src { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 0; padding: 6px 2px; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; }
.add-src .ico { width: 16px; height: 16px; }
.add-src:hover span { text-decoration: underline; text-underline-offset: 3px; }

.go {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 24px; height: 54px; border: 0; border-radius: 16px;
  background: linear-gradient(100deg, var(--accent), var(--accent-2)); color: #fff; font-size: 16px; font-weight: 650;
  box-shadow: 0 14px 30px -14px var(--accent); transition: transform .25s var(--ease), opacity .25s, filter .2s;
}
.go .arrow { transition: transform .25s var(--ease); }
.go:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.go:hover:not(:disabled) .arrow { transform: translateX(4px); }
.go:disabled { opacity: .4; cursor: not-allowed; }

/* Income card — dashboard face */
.income.mode-dash { height: 100%; display: flex; flex-direction: column; }
.mode-dash .ic-ch { margin-bottom: 10px; }
.mode-dash .sources { gap: 10px; }
.mode-dash .src { padding: 10px 12px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.mode-dash .src-top { margin-bottom: 8px; }
.mode-dash .src-name { font-size: 13px; color: var(--muted); }
.mode-dash .src-name:focus { color: var(--text); }
.mode-dash .src .seg.tiny { background: var(--panel); }
.mode-dash .money-in.big { flex: 1 1 140px; height: 38px; background: var(--panel); }
.mode-dash .money-in.big input { font-size: 18px; font-weight: 700; }
.mode-dash .money-in.big em { font-size: 12px; }
.mode-dash .hrs input { background: var(--panel); height: 38px; }
.mode-dash .hrs em { font-size: 12px; }
.mode-dash .src-preview { margin-top: 6px; font-size: 12px; min-height: 0; }
.mode-dash .add-src { margin-top: 8px; font-size: 12.5px; }
.ic-dash { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.raise { padding: 12px 14px; border-radius: 14px; background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--good) 10%, transparent)); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.raise-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 600; }
.raise-head output { color: var(--accent); font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums; }
.raise input { margin: 6px 0 4px; }
.raise-line { margin: 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ic-total { display: flex; align-items: baseline; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); }
.ic-total span { color: var(--muted); font-size: 12.5px; }
.ic-total b { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ic-rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ic-rates div { padding: 8px 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.ic-rates span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ic-rates b { font-variant-numeric: tabular-nums; font-size: 14px; }
.dollar-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.dollar-head b { color: var(--text); font-weight: 650; }
.dollar-bar { display: flex; gap: 2px; height: 14px; border-radius: 6px; overflow: hidden; }
.dollar-bar i { flex: 0 0 0; min-width: 0; transition: opacity .2s; cursor: default; }
.dollar-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.dollar-key span { display: inline-flex; align-items: center; gap: 5px; transition: opacity .2s; }
.dollar-key i { width: 8px; height: 8px; border-radius: 3px; }
.dollar-key b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ═══ App shell ═══ */
.app { position: relative; display: none; }
.dash .app { display: block; }
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 12px max(20px, calc((100vw - 1440px) / 2 + 20px));
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  opacity: 0; transform: translateY(-10px); transition: opacity .6s var(--ease) .25s, transform .6s var(--ease) .25s;
}
.revealed .top { opacity: 1; transform: none; }
.back { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); border: 1px solid var(--line); }
.back:hover { color: var(--text); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 17px; letter-spacing: -.02em; margin-right: auto; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.period { order: 0; }

.grid {
  display: grid; gap: 16px; max-width: 1440px; margin: 0 auto; padding: 18px 20px 12px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "inc inc inc inc kpi kpi kpi kpi kpi kpi kpi kpi"
    "inc inc inc inc flow flow flow flow flow flow flow flow"
    "mix mix mix mix rule rule rule rule day day day day"
    "cats cats cats cats cats cats cats cats tax tax tax tax"
    "cats cats cats cats cats cats cats cats chk chk chk chk"
    "proj proj proj proj proj proj proj proj goal goal goal goal";
}
#incomeSlot { grid-area: inc; min-width: 0; }
#kpis { grid-area: kpi; }
#flowCard { grid-area: flow; }
#mixCard { grid-area: mix; }
#ruleCard { grid-area: rule; }
#dayCard { grid-area: day; }
#catsCard { grid-area: cats; }
#taxCard { grid-area: tax; }
#checkCard { grid-area: chk; }
#projCard { grid-area: proj; }
#goalCard { grid-area: goal; }

.enter { opacity: 0; transform: translateY(22px) scale(.985); }
.revealed .enter { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i) * 70ms); }

.foot { max-width: 1440px; margin: 0 auto; padding: 8px 20px 40px; color: var(--faint); font-size: 12px; text-align: center; }

/* ═══ KPI tiles ═══ */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  transition: transform .25s var(--ease), border-color .25s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.t-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.t-val { font-size: clamp(20px, 2vw, 28px); font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-meter { position: relative; height: 4px; margin-top: 8px; border-radius: 4px; background: var(--panel-3); }
.t-meter i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: #8a93a8; }
.t-meter b { position: absolute; top: -3px; width: 2px; height: 10px; border-radius: 2px; background: var(--text); }
.tile::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; opacity: .14; }
.tile:nth-child(1)::after { background: #6c6cff; }
.tile:nth-child(2)::after { background: #8a93a8; }
.tile:nth-child(3)::after { background: #8f8cff; }
.tile.left { cursor: pointer; }
.tile.left::after { background: var(--good); }
.tile.left[data-state="left"] .t-val { color: var(--warn); }
.tile.left[data-state="left"]::after { background: var(--warn); }
.tile.left[data-state="over"] .t-val { color: var(--bad); }
.tile.left[data-state="over"]::after { background: var(--bad); opacity: .2; }
.tile.left[data-state="zero"] .t-val { color: var(--good); }

/* ═══ Charts ═══ */
.chart { position: relative; }
.sankey-wrap { height: 400px; clip-path: inset(-4px calc((1 - var(--rv, 1)) * 100%) -4px -4px); }
.sankey { width: 100%; height: 100%; display: block; overflow: visible; }
.ribbon { opacity: .28; transition: opacity .2s; cursor: pointer; }
.ribbon:hover, .ribbon.on { opacity: .62; }
.ribbon.dim { opacity: .07; }
.ribbon.hatch { opacity: .14; }
.node { transition: opacity .2s; cursor: pointer; }
.node.dim { opacity: .3; }
.node.hatch { fill-opacity: .55; }
.slabel { font-size: 12px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; transition: opacity .2s; }
.slabel.val { font-weight: 500; fill: var(--muted); font-variant-numeric: tabular-nums; }
.slabel.dim { opacity: .3; }

.donut-wrap { position: relative; width: min(100%, 290px); aspect-ratio: 1; margin: 0 auto 6px; }
.donut { width: 100%; height: 100%; display: block; overflow: visible; }
.slice { transition: opacity .2s; cursor: pointer; stroke: var(--panel); stroke-width: 0; }
.slice.dim { opacity: .22; }
.slice.unassigned { fill-opacity: .35; }
.donut-center { position: absolute; inset: 30%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.dc-label { font-size: 12px; color: var(--muted); font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.dc-val { font-size: clamp(18px, 2vw, 24px); font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dc-sub { font-size: 11.5px; color: var(--faint); }
.legend { display: grid; gap: 4px; }
.lg { display: grid; grid-template-columns: 10px 1fr auto 76px; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; font-size: 13px; cursor: default; transition: background .2s, opacity .2s; }
.lg:hover, .lg.lit { background: var(--panel-2); }
.lg i { width: 10px; height: 10px; border-radius: 3px; }
.lg b { font-variant-numeric: tabular-nums; }
.lg em { font-style: normal; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.growth-wrap { height: 250px; }
.growth { width: 100%; height: 100%; display: block; overflow: visible; }
.gridline { stroke: var(--line); stroke-width: 1; }
.axis { font-size: 11px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.garea.contrib { fill: var(--muted); fill-opacity: .1; }
.gline { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.gline.contrib { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.mdot { fill: var(--panel); stroke-width: 2.5; }
.mlabel { font-size: 11px; font-weight: 700; fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; }
.hline { stroke: var(--muted); stroke-dasharray: 3 3; }
.hdot { stroke: var(--panel); stroke-width: 2.5; }
.hdot.contrib { fill: var(--muted); }

/* ═══ Rule card ═══ */
.rule-rows { display: flex; flex-direction: column; gap: 14px; margin: 16px 0 16px; }
.rrow { padding: 2px 0; transition: opacity .2s; cursor: default; }
.rr-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 7px; }
.rr-top .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--c); align-self: center; }
.rr-act { margin-left: auto; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.rr-tgt { color: var(--faint); font-size: 12px; }
.rr-diff { min-width: 74px; text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.rrow[data-state="bad"] .rr-diff { color: var(--bad); }
.rrow[data-state="good"] .rr-diff, .rrow[data-state="ok"] .rr-diff { color: var(--good); }
.rr-bar { position: relative; height: 10px; border-radius: 6px; background: var(--panel-3); }
.rr-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--c); }
.rr-bar .mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--panel); }
.rule-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.srate { display: flex; flex-direction: column; }
.sr-label { font-size: 12px; color: var(--muted); }
.sr-val { font-size: 20px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--good); }
.note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

/* ═══ Workday ═══ */
.day-bar { position: relative; display: flex; gap: 1.5px; height: 40px; margin-top: 6px; border-radius: 10px; overflow: hidden; }
.day-bar i { flex: 0 0 0; min-width: 0; transition: opacity .2s, filter .2s; cursor: default; }
.day-bar i:hover { filter: brightness(1.12); }
.day-bar .ot { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); box-shadow: 0 0 0 2px var(--panel); transition: opacity .3s; }
.day-ticks { position: relative; height: 22px; margin: 4px 0 10px; }
.day-ticks span { position: absolute; top: 2px; transform: translateX(-50%); font-size: 11px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.day-ticks span:first-child { transform: none; }
.day-ticks span.end { transform: translateX(-100%); color: var(--muted); font-weight: 600; }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.day-list li { display: grid; grid-template-columns: 10px 1fr auto 62px; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; font-size: 13px; transition: background .2s, opacity .2s; }
.day-list li:hover, .day-list li.lit { background: var(--panel-2); }
.day-list i { width: 10px; height: 10px; border-radius: 3px; }
.day-list b { font-weight: 600; font-variant-numeric: tabular-nums; }
.day-list em { font-style: normal; color: var(--muted); text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.day-cats { columns: 2; column-gap: 24px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.dc { display: grid; grid-template-columns: 9px 1fr auto auto; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 8px; font-size: 12.5px; break-inside: avoid; transition: background .2s, opacity .2s; }
.dc:hover, .dc.lit { background: var(--panel-2); }
.dc i { width: 9px; height: 9px; border-radius: 3px; }
.dc b { font-weight: 600; font-variant-numeric: tabular-nums; }
.dc em { font-style: normal; color: var(--faint); font-size: 11.5px; min-width: 76px; text-align: right; }

/* ═══ Categories ═══ */
.cats-card { display: flex; flex-direction: column; min-height: 560px; }
.cats-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cats-actions { display: flex; align-items: center; gap: 8px; }
.left-pill { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); transition: background .3s, color .3s; }
.left-pill[data-state="left"] { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.left-pill[data-state="over"] { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

.cat-head, .cat-row { display: grid; grid-template-columns: 36px minmax(120px, 1.15fr) minmax(90px, 2fr) 116px 54px 28px; align-items: center; gap: 12px; }
.cat-head { padding: 0 10px 6px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; border-bottom: 1px solid var(--line); }
.cat-head .r { text-align: right; }
.cat-list { flex: 1 1 0; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 4px 8px 4px; scrollbar-width: thin; }
.cat { border-radius: 14px; transition: background .25s, box-shadow .25s; }
.cat + .cat { margin-top: 2px; }
.cat.lit, .cat:hover { background: color-mix(in srgb, var(--c) 7%, transparent); }
.cat.open { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); margin: 6px 0; }
.cat-row { padding: 8px 10px; cursor: pointer; }
.cat-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.cat-name { min-width: 0; display: flex; flex-direction: column; }
.cat-name b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-name small { display: flex; align-items: center; gap: 5px; color: var(--faint); font-size: 11.5px; }
.gdot { width: 6px; height: 6px; border-radius: 50%; }
.cat-bar { position: relative; height: 30px; }
.cat-bar::before, .cat-bar .band, .cat-bar .fill { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 6px; }
.cat-bar::before { content: ''; left: 0; right: 0; background: var(--panel-3); }
.cat-bar .band { background: color-mix(in srgb, var(--good) 22%, transparent); box-shadow: inset 2px 0 0 color-mix(in srgb, var(--good) 55%, transparent), inset -2px 0 0 color-mix(in srgb, var(--good) 55%, transparent); border-radius: 2px; }
.cat-bar .fill { left: 0; background: var(--c); transition: background .3s; }
.cat[data-state="over"] .fill { background: linear-gradient(90deg, var(--c) 55%, var(--warn)); }
.cat-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; -webkit-appearance: none; appearance: none; background: none; cursor: ew-resize; }
.cat-range::-webkit-slider-runnable-track { height: 100%; background: none; }
.cat-range::-moz-range-track { background: none; }
.cat-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: 6px; border-radius: 50%; background: #fff; border: 3px solid var(--c); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s; }
.cat-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--c); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .2s; }
.cat-row:hover .cat-range::-webkit-slider-thumb, .cat-range:focus::-webkit-slider-thumb, .cat-range:active::-webkit-slider-thumb { opacity: 1; transform: none; }
.cat-row:hover .cat-range::-moz-range-thumb, .cat-range:focus::-moz-range-thumb { opacity: 1; }
.cat-pct { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat[data-state="over"] .cat-pct { color: var(--warn); }
.cat[data-state="under"] .cat-pct { color: var(--accent); }
.cat[data-state="great"] .cat-pct { color: var(--good); }
.cat-tog .ico { transition: transform .3s var(--ease); }
.cat.open .cat-tog .ico { transform: rotate(90deg); }
.cat-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.cat.open .cat-more { grid-template-rows: 1fr; }
.cm { min-height: 0; overflow: hidden; padding: 0 12px 0 58px; }
.cat.open .cm { padding-bottom: 14px; }
.cm-tip { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; max-width: 64ch; }
.cm-range { font-size: 12px; color: var(--faint); margin-bottom: 10px; }
.cm-range b { color: var(--good); }
.subs { display: grid; gap: 4px; }
.sub { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(60px, 1.2fr) 116px 26px; align-items: center; gap: 12px; }
.sub-name { min-width: 0; border: 1px solid transparent; background: none; border-radius: 8px; padding: 5px 8px; margin-left: -8px; font-size: 13px; outline: 0; }
.sub-name:hover { border-color: var(--line); }
.sub-name:focus { border-color: var(--accent); background: var(--panel); }
.sub-bar { height: 5px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.sub-bar i { width: 0; display: block; height: 100%; background: var(--c); opacity: .7; border-radius: 4px; }
.sub .money-in { background: var(--panel); }
.cm-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.cm-actions .grow { flex: 1; }
.mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.mini input, .mini select { height: 28px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 8px; font-size: 12.5px; outline: 0; }
.mini input { width: 140px; }
.mini input:focus, .mini select:focus { border-color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ═══ Taxes ═══ */
.field { margin-bottom: 14px; }
.field label, .lbl { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 550; margin-bottom: 6px; }
.field output { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field.two label { flex-direction: column; align-items: flex-start; gap: 0; margin-bottom: 0; }
.brackets { margin: 4px 0 12px; }
.br-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.br-head span:last-child { color: var(--text); font-weight: 600; }
.br-bar { display: flex; gap: 2px; height: 30px; border-radius: 9px; overflow: hidden; }
.br { position: relative; flex: 0 0 0; min-width: 0; display: grid; place-items: center; transition: flex-grow .5s var(--ease), filter .2s; cursor: default; }
.br:hover { filter: brightness(1.1); }
.br span { font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); pointer-events: none; }
.br.pre { background: #18a96b; }
.br.std { background: var(--line-2); }
.br.b0 { background: #b9c1ff; } .br.b1 { background: #9ea6ff; } .br.b2 { background: #8487fb; } .br.b3 { background: #6c69f0; }
.br.b4 { background: #5a50dc; } .br.b5 { background: #4a3bc2; } .br.b6 { background: #3b2aa0; }
.br.top { box-shadow: inset 0 -3px 0 rgba(255, 255, 255, .7); }
.tax-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.tax-lines li { display: grid; grid-template-columns: 9px 1fr auto 52px; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px; font-size: 13px; transition: background .2s, opacity .2s; cursor: default; }
.tax-lines li:hover, .tax-lines li.lit { background: var(--panel-2); }
.tax-lines li i { width: 9px; height: 9px; border-radius: 3px; }
.tax-lines li b { font-variant-numeric: tabular-nums; }
.tax-lines li em { font-style: normal; color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.tax-lines li small { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-left: 4px; }
.tax-lines li.payroll { color: var(--muted); }

/* ═══ Rules of thumb ═══ */
.score-ring { position: relative; width: 44px; height: 44px; flex: none; }
.score-ring svg { width: 100%; height: 100%; }
.score-ring circle { fill: none; stroke-width: 5; }
.score-ring .track { stroke: var(--panel-3); }
.score-ring .val { stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.score-ring .val[data-f="hi"] { stroke: var(--good); } .score-ring .val[data-f="mid"] { stroke: var(--warn); } .score-ring .val[data-f="lo"] { stroke: var(--bad); }
.score-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chk { border-radius: 11px; transition: background .2s; }
.chk:hover, .chk.open { background: var(--panel-2); }
.chk-row { width: 100%; display: grid; grid-template-columns: 24px 1fr auto 16px; align-items: center; gap: 9px; padding: 8px 8px; border: 0; background: none; text-align: left; font-size: 13px; border-radius: 11px; }
.chk-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; }
.chk-ico .ico { width: 15px; height: 15px; stroke-width: 2.4; }
.chk[data-state="ok"] .chk-ico { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.chk[data-state="warn"] .chk-ico { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chk[data-state="bad"] .chk-ico { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.chk-v { font-variant-numeric: tabular-nums; font-size: 12.5px; }
.chk[data-state="warn"] .chk-v { color: var(--warn); } .chk[data-state="bad"] .chk-v { color: var(--bad); } .chk[data-state="ok"] .chk-v { color: var(--good); }
.chk .chev { width: 14px; height: 14px; color: var(--faint); transition: transform .3s var(--ease); }
.chk.open .chev { transform: rotate(90deg); }
.chk-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.chk.open .chk-more { grid-template-rows: 1fr; }
.chk-more p { min-height: 0; overflow: hidden; margin: 0; padding: 0 10px 0 41px; color: var(--muted); font-size: 12.5px; }
.chk.open .chk-more p { padding-bottom: 10px; }

/* ═══ Future you ═══ */
.proj-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.proj-big span { display: block; font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; background: linear-gradient(100deg, var(--good), #9be15d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.proj-big small { color: var(--muted); font-size: 12.5px; }
.proj-ctl { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.inline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.inline output { min-width: 34px; color: var(--text); font-weight: 650; }
.inline input { width: 110px; margin: 0; }
.proj-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.proj-legend span { display: inline-flex; align-items: center; gap: 6px; }
.proj-legend .muted { margin-left: auto; color: var(--faint); }
.sw { width: 14px; height: 4px; border-radius: 2px; }
.sw.total { background: var(--good); }
.sw.contrib { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }

/* ═══ Emergency fund + cost ═══ */
.ef { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.ef-ring { position: relative; width: 120px; height: 120px; }
.ef-ring svg { width: 100%; height: 100%; }
.ef-ring circle { fill: none; stroke-width: 11; }
.ef-ring .track { stroke: var(--panel-3); }
.ef-ring .val { stroke: var(--good); stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ef-ring div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ef-ring b { font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ef-ring span { font-size: 11px; color: var(--muted); }
.ef-side { display: flex; flex-direction: column; gap: 4px; }
.ef-side .money-in { margin-bottom: 8px; }
.ef-line { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.cost { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.money-in.big { height: 40px; }
.cost .money-in input { font-size: 17px; }
.cost-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.cost-list li { display: grid; grid-template-columns: 30px auto 1fr; align-items: center; gap: 10px; font-size: 13px; }
.cost-list .ico { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--panel-2); color: var(--accent); }
.cost-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-list span { color: var(--muted); font-size: 12.5px; }

/* ═══ Linked highlight ═══ */
.hl-on :is(#mixLegend, #dayList, #taxLines, #dollarKey, #ruleRows, #dayCats, #mixTable) > .hlable:not(.lit),
.hl-on :is(#dollarBar, #dayBar) > i.hlable:not(.lit) { opacity: .35; }

/* ═══ Expanded cards ═══ */
.x-only { display: none; }
.card.expanded { display: flex; flex-direction: column; overflow-y: auto; box-shadow: var(--shadow-lg); border-radius: 24px; padding: 24px 28px 28px; }
.card.expanded .x-only { display: block; }
.card.expanded .chart { flex: 1 1 auto; min-height: 300px; }
.card.expanded .ch h2 { font-size: 19px; }
#mixCard.expanded .donut-wrap { width: min(100%, 360px); }
#mixCard.expanded .legend { max-width: 520px; width: 100%; margin: 0 auto; }
.mix-table { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); columns: 2; column-gap: 28px; }
.mt { display: grid; grid-template-columns: 130px 1fr 80px; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; font-size: 13px; break-inside: avoid; transition: background .2s, opacity .2s; }
.mt:hover, .mt.lit { background: var(--panel-2); }
.mt-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-bar { height: 6px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.mt-bar i { display: block; height: 100%; background: var(--c); border-radius: 4px; }
.mt-v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.card.expanded .cat-list { flex: 1 1 0; }
.ph { border-radius: 20px; border: 1px dashed var(--line-2); }

.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(6, 7, 12, .5); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); opacity: 0; pointer-events: none; transition: opacity .35s; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* ═══ Tooltip + toast ═══ */
.tip {
  position: fixed; left: 0; top: 0; z-index: 100; min-width: 170px; max-width: 280px; padding: 10px 12px;
  background: var(--tip); color: var(--tip-text); border-radius: 12px; box-shadow: 0 12px 34px -8px rgba(0, 0, 0, .45);
  font-size: 12.5px; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.tip.on { opacity: 1; }
.tt-h { display: flex; align-items: center; gap: 7px; font-weight: 600; opacity: .85; }
.tt-h i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.tt-v { font-size: 19px; font-weight: 750; letter-spacing: -.02em; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.tt-v small { font-size: 12px; font-weight: 500; opacity: .6; }
.tt-r { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; opacity: .85; }
.tt-r b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tt-n { margin-top: 6px; padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--tip-text) 15%, transparent); opacity: .65; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 110; display: flex; align-items: center; gap: 14px;
  padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--tip); color: var(--tip-text); font-size: 13px; font-weight: 550;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .5);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: transform .4s var(--ease), opacity .3s;
}
.toast.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast .link { color: var(--accent); }
:root[data-theme="dark"] .toast .link { color: #5f5cf6; }

/* ═══ Views ═══ */
[hidden] { display: none !important; }
.view-simple [data-view="adv"], .view-adv [data-view="simple"] { display: none !important; }
.view-simple .grid {
  grid-template-areas:
    "inc inc inc inc hero hero hero hero hero hero hero hero"
    "inc inc inc inc plan plan plan plan plan plan plan plan"
    "aff aff aff aff aff aff aff aff bills bills bills bills"
    "ask ask ask ask ask ask ask cta cta cta cta cta";
}
#sHero { grid-area: hero; }
#sPlan { grid-area: plan; }
#sAfford { grid-area: aff; }
#sBills { grid-area: bills; }
#sAsk { grid-area: ask; }
#sCta { grid-area: cta; }
.view-seg button { padding: 6px 14px; }

/* ═══ State picker ═══ */
.sel {
  width: 100%; height: 38px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a5' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  -webkit-appearance: none; appearance: none; font-weight: 550; font-size: 13.5px; cursor: pointer; outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
.sel:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.ic-where { margin-top: 14px; }
.ic-where label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.mode-intro .ic-where { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.mode-intro .ic-where label { font-size: 14px; color: var(--text); }
.mode-intro .ic-where .sel { height: 44px; font-size: 15px; border-radius: 13px; }
.mode-dash .ic-where { margin-top: 10px; }
.mode-dash .ic-where .hint { font-size: 11.5px; }
#localField { margin-top: 12px; }
#customState { margin-top: 8px; }

/* ═══ Simple: take-home hero ═══ */
.s-hero { display: flex; flex-direction: column; justify-content: center; padding: 22px 26px; overflow: hidden; }
.s-hero::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%), radial-gradient(90% 120% at 0% 100%, color-mix(in srgb, var(--good) 10%, transparent), transparent 60%); }
.s-hero > * { position: relative; }
.sh-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.sh-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sh-big span { font-size: clamp(38px, 5vw, 60px); font-weight: 800; letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.sh-big small { font-size: 18px; color: var(--muted); font-weight: 600; }
.sh-sub { margin: 4px 0 18px; color: var(--muted); font-size: 13.5px; }
.sh-flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.sf { flex: 1 1 110px; display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: 13px; background: var(--panel-2); border: 1px solid var(--line); cursor: default; transition: transform .2s var(--ease), border-color .2s; }
.sf:hover { transform: translateY(-2px); border-color: var(--line-2); }
.sf span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.sf b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sf em { font-style: normal; font-size: 11.5px; color: var(--faint); }
.sf.keep { background: color-mix(in srgb, var(--good) 12%, var(--panel)); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.sf.keep b { color: var(--good); }
.sf-op { align-self: center; font-style: normal; color: var(--faint); font-weight: 700; }

/* ═══ Simple: plan ═══ */
.sp-note { margin: -4px 0 12px; padding: 9px 12px; border-radius: 11px; font-size: 12.5px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); }
.sp-bar { display: flex; gap: 3px; height: 14px; border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.sp-bar i { flex: 0 0 0; min-width: 0; transition: opacity .2s; }
.sp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.sp-col { padding: 14px 14px 10px; border-radius: 15px; background: color-mix(in srgb, var(--c) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 22%, var(--line)); transition: border-color .2s, transform .25s var(--ease), opacity .2s; }
.sp-col:hover, .sp-col.lit { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.sp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sp-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.sp-ico .ico { width: 16px; height: 16px; }
.sp-name { font-weight: 650; }
.sp-pct { margin-left: auto; font-weight: 750; color: var(--c); font-variant-numeric: tabular-nums; }
.sp-amt { display: block; font-size: clamp(22px, 2.2vw, 28px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sp-per { font-size: 12px; color: var(--muted); }
.sp-ex { margin: 8px 0 6px; font-size: 12.5px; color: var(--muted); min-height: 2.9em; }
.sp-more { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 4px 0; color: var(--c); font-weight: 650; font-size: 12.5px; filter: saturate(1.2); }
.sp-more .ico { width: 14px; height: 14px; transition: transform .3s var(--ease); }
.sp-col.open .sp-more .ico { transform: rotate(90deg); }
.sp-list { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.sp-col.open .sp-list { grid-template-rows: 1fr; }
.sp-list ul { min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0; }
.sp-col.open .sp-list ul { padding: 4px 0 4px; }
.sp-list li { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 12.5px; border-top: 1px solid color-mix(in srgb, var(--c) 14%, transparent); }
.sp-list li i { width: 8px; height: 8px; border-radius: 3px; }
.sp-list li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-list li b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ═══ Simple: afford ═══ */
.af-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.af {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 15px; border-radius: 15px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line); cursor: default; transition: transform .25s var(--ease), border-color .2s, box-shadow .25s;
}
.af::after { content: ''; position: absolute; right: -24px; bottom: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--c); opacity: .1; transition: transform .4s var(--ease), opacity .3s; }
.af:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 50%, transparent); box-shadow: 0 12px 26px -16px var(--c); }
.af:hover::after { transform: scale(1.5); opacity: .16; }
.af-ico { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 6px; border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.af-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.af-val { font-size: clamp(19px, 1.8vw, 24px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.af-sub { font-size: 12px; color: var(--faint); }

/* ═══ Simple: bills ═══ */
.bills { display: flex; flex-direction: column; gap: 14px; }
.bl-top { display: grid; grid-template-columns: 30px 1fr 112px auto; align-items: center; gap: 10px; }
.bl-top > label { font-weight: 600; font-size: 13px; }
.bl-top em { font-style: normal; font-size: 12px; color: var(--muted); }
.bl-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.bl-ico .ico { width: 16px; height: 16px; }
.bl .money-in input::placeholder { color: var(--faint); font-weight: 500; }
.bl-gauge { position: relative; height: 8px; margin: 9px 0 5px 40px; border-radius: 5px; background: var(--panel-3); overflow: hidden; }
.bl-gauge .zone { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--good) 22%, transparent); box-shadow: inset -2px 0 0 color-mix(in srgb, var(--good) 60%, transparent); }
.bl-gauge .fill { position: absolute; inset: 1.5px auto 1.5px 0; border-radius: 4px; background: var(--c); transition: background .3s; }
.bl[data-state="plan"] .bl-gauge .fill { opacity: .45; }
.bl[data-state="warn"] .bl-gauge .fill { background: var(--warn); }
.bl[data-state="bad"] .bl-gauge .fill { background: var(--bad); }
.bl-note { margin: 0 0 0 40px; font-size: 12px; color: var(--muted); }
.bl[data-state="warn"] .bl-note { color: var(--warn); }
.bl[data-state="bad"] .bl-note { color: var(--bad); }
.bl-sum { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.bl-sum[data-state="bad"] { color: var(--bad); }

/* ═══ Simple: can I afford it ═══ */
.ask-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ask-row .money-in.big { flex: 1 1 180px; height: 48px; border-radius: 13px; }
.ask-row .money-in.big input { font-size: 22px; font-weight: 750; }
.ask-row .money-in.big > span { font-size: 18px; }
.verdict { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 14px; border-radius: 15px; background: var(--panel-2); border: 1px solid var(--line); transition: background .3s, border-color .3s; }
.v-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 11px; background: var(--panel-3); color: var(--muted); }
.v-ico .ico { stroke-width: 2.4; }
.verdict b { font-size: 16px; }
.verdict p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.verdict[data-state="yes"] { background: color-mix(in srgb, var(--good) 10%, var(--panel)); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.verdict[data-state="yes"] .v-ico { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.verdict[data-state="maybe"] { background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.verdict[data-state="maybe"] .v-ico { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.verdict[data-state="no"] { background: color-mix(in srgb, var(--bad) 9%, var(--panel)); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.verdict[data-state="no"] .v-ico { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.ask-facts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; }
.ask-facts li { display: grid; grid-template-columns: 30px auto 1fr; gap: 10px; align-items: center; font-size: 13px; }
.af-i .ico { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--panel-2); color: var(--accent); }
.ask-facts b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ask-facts .fx { color: var(--muted); font-size: 12.5px; }

/* ═══ Simple: call to action ═══ */
.s-cta { display: flex; flex-direction: column; justify-content: center; gap: 14px; overflow: hidden; background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 16%, var(--panel)), var(--panel) 70%); }
.s-cta h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.02em; }
.s-cta p { margin: 0; color: var(--muted); font-size: 13px; max-width: 46ch; }
.s-cta .btn { align-self: flex-start; height: 40px; padding: 0 18px; }
.cta-art { display: flex; align-items: flex-end; gap: 5px; height: 46px; }
.cta-art i { width: 12px; border-radius: 4px; animation: bars 2.8s ease-in-out infinite; }
.cta-art i:nth-child(1) { height: 60%; background: #5b74ff; }
.cta-art i:nth-child(2) { height: 95%; background: #8f8cff; animation-delay: -.5s; }
.cta-art i:nth-child(3) { height: 45%; background: #ff6f91; animation-delay: -1s; }
.cta-art i:nth-child(4) { height: 75%; background: #ffb547; animation-delay: -1.5s; }
.cta-art i:nth-child(5) { height: 35%; background: #2fcf8f; animation-delay: -2s; }
@keyframes bars { 50% { transform: scaleY(.6); } }
.cta-art i { transform-origin: bottom; }

/* ═══ Responsive ═══ */
@media (max-width: 1180px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "inc kpi" "flow flow" "mix rule" "day day" "cats cats" "tax chk" "proj proj" "goal goal";
  }
  .view-simple .grid { grid-template-areas: "inc hero" "plan plan" "aff aff" "bills ask" "cta cta"; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-list { flex: none; max-height: none; overflow: visible; }
  .cats-card { min-height: 0; }
  #goalCard { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
  #goalCard .ch { grid-column: 1 / -1; }
  #goalCard .cost { margin-top: 0; padding-top: 0; border-top: 0; grid-column: 2; grid-row: 2 / span 2; }
}
@media (max-width: 760px) {
  body { font-size: 13.5px; }
  .grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "inc" "kpi" "flow" "mix" "rule" "day" "cats" "tax" "chk" "proj" "goal"; padding: 12px 12px 8px; gap: 12px; }
  .view-simple .grid { grid-template-areas: "inc" "hero" "plan" "aff" "bills" "ask" "cta"; }
  .sp-cols { grid-template-columns: minmax(0, 1fr); }
  .sp-ex { min-height: 0; }
  .af-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sf { flex-basis: 40%; }
  .sf-op { display: none; }
  .view-seg button { padding: 5px 10px; }
  .s-hero { padding: 18px; }
  .top { position: relative; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .brand { font-size: 0; gap: 0; }
  .top-actions { margin-left: 0; gap: 6px; }
  .period { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .period button { flex: 1; padding: 5px 8px; }
  #resetBtn span { display: none; }
  .card { padding: 16px; border-radius: 18px; }
  .tiles { gap: 12px; }
  .tile { padding: 14px; }
  .t-sub { white-space: normal; }
  .sankey-wrap { height: 380px; }
  .cat-head { display: none; }
  .cat-row { grid-template-columns: 34px minmax(0, 1fr) 100px 28px; gap: 10px; row-gap: 2px; }
  .cat-bar { grid-column: 1 / -1; grid-row: 2; height: 26px; }
  .cat-pct { display: none; }
  .cm { padding: 0 10px; }
  .sub { grid-template-columns: minmax(0, 1fr) 104px 26px; }
  .sub-bar { display: none; }
  .mini input { width: 110px; }
  #goalCard { display: block; }
  #goalCard .cost { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
  .field.two { grid-template-columns: 1fr; }
  .day-cats, .mix-table { columns: 1; }
  .proj-legend .muted { margin-left: 0; }
  .income.mode-intro { padding: 26px 20px 22px; border-radius: 24px; }
  .mode-intro .money-in.big input { font-size: 38px; }
}

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