:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-raised: color-mix(in oklch, #ffffff 92%, #9333EA 8%);
  --fg: #09090B;
  --muted: color-mix(in oklch, #09090B 58%, #ffffff 42%);
  --subtle: color-mix(in oklch, #09090B 36%, #ffffff 64%);
  --border: color-mix(in oklch, #09090B 10%, #ffffff 90%);
  --accent: #9333EA;
  --accent-2: #A855F7;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --blue: #3B82F6;
  --accent-soft: color-mix(in oklch, var(--accent) 10%, #ffffff 90%);
  --success-soft: color-mix(in oklch, var(--success) 13%, #ffffff 87%);
  --warning-soft: color-mix(in oklch, var(--warning) 16%, #ffffff 84%);
  --danger-soft: color-mix(in oklch, var(--danger) 12%, #ffffff 88%);
  --font-display: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --font-body: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 70% 0%, color-mix(in oklch, var(--accent) 10%, transparent), transparent 34%), var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:disabled { cursor: default; opacity: .58; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid color-mix(in oklch, var(--accent) 32%, transparent);
  outline-offset: 2px;
}
.app-screen { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px 18px 18px; }
.scroll.with-tabs { padding-bottom: 94px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.topbar { padding: 10px 0 9px; }
.kicker { margin: 0 0 3px; color: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; }
h1,h2,h3,p { margin: 0; }
h1 { font-family: var(--font-display); font-size: 25px; font-weight: 650; letter-spacing: -.02em; line-height: 1.08; text-wrap: pretty; }
h2 { font-family: var(--font-display); font-size: 19px; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
h3 { font-size: 15px; font-weight: 650; line-height: 1.25; }
.meta { color: var(--muted); font-size: 13px; line-height: 1.35; }
.tiny { color: var(--subtle); font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; line-height: 1.35; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--fg); display: grid; place-items: center; flex: 0 0 auto; }
.icon-btn.has-alert { position: relative; }
.icon-btn.has-alert::after { content:""; position:absolute; top:8px; right:8px; width:8px; height:8px; border:2px solid #fff; border-radius:50%; background:var(--danger); }
.icon-btn svg,.action svg,.tab svg,.mini-icon svg,.send svg,.round-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 15px; box-shadow: 0 16px 42px -32px color-mix(in oklch, #09090B 36%, transparent); }
.card.tight { padding: 12px; border-radius: 16px; }
.hero-card { color: #fff; background: radial-gradient(circle at 78% 16%, rgba(255,255,255,.24), transparent 30%), linear-gradient(145deg,#9333EA 0%,#5B21B6 100%); border-color: transparent; min-height: 192px; position: relative; overflow: hidden; }
.hero-card::after { content:""; position:absolute; inset:auto -28px -52px auto; width:148px; height:148px; border:1px solid rgba(255,255,255,.22); border-radius:50%; }
.hero-card .meta,.hero-card .tiny { color: rgba(255,255,255,.72); }
.hero-card .status { background:rgba(255,255,255,.16); color:#fff; }
.hero-number { margin-top: 10px; font-family: var(--font-mono); font-size: 31px; font-weight: 650; letter-spacing: -.035em; line-height: 1.04; }
.divider { height: 1px; background: rgba(255,255,255,.22); margin: 13px 0 11px; }
.plan-insight { display:flex; align-items:flex-start; gap:9px; position:relative; z-index:1; }
.plan-insight-icon { width:25px; height:25px; display:grid; place-items:center; flex:0 0 auto; border-radius:9px; background:rgba(255,255,255,.16); font-size:14px; }
.plan-insight p:last-child { margin-top:2px; color:#fff; font-size:13px; font-weight:550; line-height:1.35; }
.pill,.status { display:inline-flex; align-items:center; gap:5px; min-height:24px; padding:4px 9px; border-radius:999px; font-family:var(--font-mono); font-size:10px; letter-spacing:.06em; text-transform:uppercase; white-space:nowrap; }
.pill { color:var(--accent); background:var(--accent-soft); }
.pill[href],.pill-button { min-height:44px; }
.pill-button { border:0; cursor:pointer; }
.status.success { color:color-mix(in oklch,var(--success) 74%,#09090B 26%); background:var(--success-soft); }
.status.warning { color:color-mix(in oklch,var(--warning) 74%,#09090B 26%); background:var(--warning-soft); }
.status.danger { color:color-mix(in oklch,var(--danger) 76%,#09090B 24%); background:var(--danger-soft); }
.status.purple { color:var(--accent); background:var(--accent-soft); }
.action { min-height:72px; width:100%; padding:8px; border:1px solid var(--border); border-radius:18px; background:var(--surface); color:var(--fg); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; font-size:11px; font-weight:600; letter-spacing:.01em; text-decoration:none; }
.action.active { border-color: color-mix(in oklch,var(--accent) 22%,#fff 78%); background:var(--accent-soft); color:var(--accent); }
.mini-icon,.round-icon { width:34px; height:34px; border-radius:12px; background:color-mix(in oklch,#09090B 5%,#fff 95%); color:var(--fg); display:grid; place-items:center; flex:0 0 auto; }
.round-icon { border-radius: 50%; }
.list { display:flex; flex-direction:column; }
.list-row { display:grid; grid-template-columns:36px minmax(0,1fr) auto; align-items:center; gap:11px; min-height:58px; border-top:1px solid var(--border); padding:10px 0; }
.list-row:first-child { border-top:0; }
.merchant { width:36px; height:36px; border-radius:13px; background:color-mix(in oklch,#09090B 6%,#fff 94%); color:var(--fg); display:grid; place-items:center; font-size:12px; font-weight:700; }
.merchant.purple { color: var(--accent); background:var(--accent-soft); }
.row-title { min-width:0; font-size:14px; font-weight:600; line-height:1.25; }
.row-sub { margin-top:2px; color:var(--muted); font-size:13px; line-height:1.3; }
.amount { font-size:13px; font-weight:650; text-align:right; }
.section-head { margin:2px 0 0; }
.recommendation { border-left:3px solid var(--accent); padding-left:12px; }
.recommendation.neutral { border-left-color:var(--border); }
.recommendation.success { border-left-color:var(--success); }
.recommendation.warning { border-left-color:var(--warning); }
.recommendation.danger { border-left-color:var(--danger); }
.confidence,.track { height:6px; overflow:hidden; border-radius:999px; background:color-mix(in oklch,#09090B 7%,#fff 93%); }
.confidence span,.track span { display:block; height:100%; width:var(--value); border-radius:inherit; background:var(--accent); }
.track span.success { background:var(--success); }
.track span.warning { background:var(--warning); }
.signal-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.signal { min-height:66px; border-radius:16px; background:color-mix(in oklch,#09090B 4%,#fff 96%); padding:10px; }
.signal.accent { background: var(--accent-soft); }
.chat { display:flex; flex-direction:column; gap:10px; }
.bubble { max-width:88%; border-radius:19px; padding:11px 13px; font-size:14px; line-height:1.4; }
.bubble.ai { align-self:flex-start; background:color-mix(in oklch,#09090B 5%,#fff 95%); border:1px solid var(--border); border-top-left-radius:8px; }
.bubble.user { align-self:flex-end; background:var(--fg); color:#fff; border-top-right-radius:8px; }
.action-card { align-self:flex-start; width:94%; border-radius:20px; border:1px solid var(--border); padding:13px; background:var(--surface); }
.cta-row { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:12px; }
.btn { min-height:44px; border-radius:14px; border:1px solid var(--border); background:var(--surface); color:var(--fg); font-size:13px; font-weight:650; padding:0 13px; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.ghost-purple { color:var(--accent); background:var(--accent-soft); border-color:transparent; }
.composer { position:sticky; bottom:72px; margin:10px -18px -18px; padding:10px 18px 14px; background:color-mix(in oklch,var(--surface) 92%,transparent); border-top:1px solid var(--border); backdrop-filter:blur(18px); }
.input-row { min-height:48px; display:grid; grid-template-columns:1fr 42px; gap:8px; }
.fake-input,.chat-input { min-width:0; width:100%; border:1px solid var(--border); border-radius:16px; padding:13px 14px; color:var(--fg); background:var(--surface); font-size:14px; }
.chat-input::placeholder { color:var(--muted); }
.send { border:0; border-radius:16px; background:var(--accent); color:#fff; display:grid; place-items:center; }
.bar-chart { height:136px; display:grid; grid-template-columns:repeat(7,1fr); align-items:end; gap:7px; padding-top:8px; }
.bar { min-height:18px; border-radius:999px 999px 6px 6px; background:color-mix(in oklch,#09090B 10%,#fff 90%); height:var(--h); }
.bar.hot { background:var(--warning); }
.category { display:grid; grid-template-columns:1fr auto; gap:7px 12px; align-items:center; }
.category .track { grid-column:1/-1; }
.tabbar { position:fixed; left:0; right:0; bottom:0; display:grid; grid-template-columns:repeat(5,1fr); padding:7px 8px 8px; border-top:1px solid var(--border); background:color-mix(in oklch,var(--surface) 90%,transparent); backdrop-filter:blur(18px); }
.tab { min-height:54px; color:var(--muted); text-decoration:none; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font-size:10px; font-weight:600; letter-spacing:.01em; }
.tab.active { color:var(--accent); }
.tab span { white-space:nowrap; }

/* Forecast-specific components */
.prompt-strip { display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; }
.prompt-strip::-webkit-scrollbar { display:none; }
.prompt { flex:0 0 auto; min-height:44px; text-decoration:none; border:1px solid var(--border); background:var(--surface); border-radius:999px; padding:8px 11px; color:var(--muted); font-size:12px; white-space:nowrap; }
.prompt.emphasis { color:var(--accent); background:var(--accent-soft); border-color:transparent; }
.milestone-row { display:flex; gap:9px; overflow-x:auto; padding:2px 0 3px; scrollbar-width:none; }
.milestone-row::-webkit-scrollbar { display:none; }
.milestone { flex:0 0 93px; min-height:98px; padding:11px; border:1px solid var(--border); border-radius:18px; background:var(--surface); }
.milestone.add { font:inherit; text-align:left; border-style:dashed; color:var(--accent); background:var(--accent-soft); display:flex; flex-direction:column; justify-content:space-between; }
.milestone .year { color:var(--subtle); font-family:var(--font-mono); font-size:10px; }
.milestone .emoji { font-size:18px; line-height:1; margin:10px 0 8px; }
.milestone .name { font-size:12px; font-weight:650; line-height:1.2; }
.forecast-chart { margin-top:12px; height:164px; position:relative; border-radius:16px; background:linear-gradient(180deg,color-mix(in oklch,var(--accent) 4%,#fff 96%),#fff); overflow:hidden; }
.forecast-chart svg { width:100%; height:100%; display:block; }
.legend { display:flex; align-items:center; gap:14px; margin-top:9px; color:var(--muted); font-size:11px; }
.legend span { display:inline-flex; align-items:center; gap:6px; }
.legend i { width:14px; height:2px; border-radius:99px; background:var(--fg); display:inline-block; }
.legend i.plan { background:var(--accent); }
.segmented { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; padding:4px; background:color-mix(in oklch,#09090B 5%,#fff 95%); border-radius:14px; }
.segmented button { border:0; border-radius:11px; background:transparent; color:var(--muted); min-height:44px; font-size:11px; font-weight:650; }
.segmented button.active { background:#fff; color:var(--accent); box-shadow:0 5px 14px -12px #000; }
.timeline { position:relative; padding-left:20px; }
.timeline::before { content:""; position:absolute; left:6px; top:8px; bottom:9px; width:1px; background:var(--border); }
.timeline-item { position:relative; display:grid; grid-template-columns:1fr auto; gap:10px; padding:0 0 15px; }
.timeline-item:last-child { padding-bottom:0; }
.timeline-item::before { content:""; position:absolute; left:-18px; top:5px; width:9px; height:9px; border-radius:50%; background:var(--accent); border:2px solid #fff; box-shadow:0 0 0 1px color-mix(in oklch,var(--accent) 35%,#fff 65%); }
.timeline-item.future::before { background:#fff; border-color:var(--border); box-shadow:none; }
.impact-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:12px; }
.impact { border-radius:14px; padding:10px; background:color-mix(in oklch,#09090B 4%,#fff 96%); }
.impact strong { display:block; font-family:var(--font-mono); font-size:14px; margin-top:3px; }
.agent-row { display:flex; gap:8px; overflow-x:auto; scrollbar-width:none; }
.agent-row::-webkit-scrollbar { display:none; }
.agent { flex:0 0 108px; border:1px solid var(--border); border-radius:16px; padding:10px; background:var(--surface); }
.agent .dot { width:7px; height:7px; border-radius:50%; background:var(--success); display:inline-block; margin-right:5px; }
.agent .dot.purple { background:var(--accent); }
.agent .dot.muted { background:var(--border); }
.agent h3 { font-size:12px; margin-top:7px; }
.agent p { font-size:10px; color:var(--muted); margin-top:2px; }
.goal-card { border:1px solid var(--border); border-radius:18px; padding:13px; background:var(--surface); }
.goal-card.compact { padding:11px 13px; }
.goal-top { display:grid; grid-template-columns:40px minmax(0,1fr) auto; align-items:center; gap:10px; }
.goal-icon { width:40px; height:40px; display:grid; place-items:center; border-radius:14px; background:var(--accent-soft); font-size:18px; }
.goal-card .track { margin-top:11px; }
.inline-note { margin-top:10px; padding:10px 11px; border-radius:14px; background:color-mix(in oklch,var(--accent) 6%,#fff 94%); color:var(--muted); font-size:12px; line-height:1.35; }
.goal-insight { display:flex; align-items:flex-start; gap:9px; margin-top:13px; padding:10px 11px; border:1px solid color-mix(in oklch,var(--accent) 16%,#fff 84%); border-radius:15px; background:var(--accent-soft); color:var(--muted); font-size:12px; line-height:1.4; }
.goal-insight strong { color:var(--fg); }
.goal-insight-icon { width:22px; height:22px; display:grid; place-items:center; flex:0 0 auto; border-radius:8px; background:#fff; color:var(--accent); font-size:13px; }
.disclaimer { color:var(--subtle); font-size:10px; line-height:1.4; text-align:center; padding:2px 8px 0; }

/* Shared prototype interaction layer */
.prototype-overlay {
  position:fixed; inset:0; z-index:50; display:flex; align-items:flex-end; justify-content:center;
  padding:12px; background:rgba(9,9,11,.38); opacity:0; pointer-events:none;
  backdrop-filter:blur(3px); transition:opacity .18s ease;
}
.prototype-overlay.open { opacity:1; pointer-events:auto; }
.prototype-sheet {
  width:min(100%, 420px); max-height:calc(100vh - 18px); overflow:auto; border:1px solid var(--border);
  border-radius:26px 26px 20px 20px; padding:8px 16px 16px; background:var(--surface);
  box-shadow:0 28px 70px -30px rgba(9,9,11,.55); transform:translateY(22px); transition:transform .18s ease;
}
.prototype-overlay.open .prototype-sheet { transform:translateY(0); }
.sheet-handle { width:40px; height:4px; margin:0 auto 10px; border-radius:99px; background:var(--border); }
.sheet-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.sheet-subtitle { margin-top:5px; }
.sheet-close { width:44px; height:44px; flex:0 0 auto; border:0; border-radius:14px; background:color-mix(in oklch,#09090B 5%,#fff 95%); color:var(--muted); font-size:25px; line-height:1; }
.sheet-content { margin-top:14px; }
.sheet-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:9px; margin-top:16px; }
.sheet-form { display:flex; flex-direction:column; gap:12px; }
.sheet-form label,.amount-field { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:12px; font-weight:600; }
.sheet-form input,.sheet-form select,.amount-field input {
  width:100%; min-height:46px; border:1px solid var(--border); border-radius:14px; padding:10px 12px;
  background:var(--surface); color:var(--fg); font-size:14px;
}
.sheet-list,.choice-list { display:flex; flex-direction:column; gap:8px; }
.sheet-list-item { display:grid; grid-template-columns:10px 1fr; gap:10px; align-items:start; padding:11px; border-radius:15px; background:color-mix(in oklch,#09090B 4%,#fff 96%); }
.sheet-list-item strong { display:block; font-size:13px; }
.sheet-list-item .meta { margin-top:3px; }
.notification-dot { width:8px; height:8px; margin-top:5px; border-radius:50%; background:var(--accent); }
.notification-dot.read { background:var(--border); }
.choice-row { min-height:52px; display:flex; align-items:center; gap:11px; padding:10px 11px; border:1px solid var(--border); border-radius:15px; cursor:pointer; }
.choice-row:has(input:checked) { border-color:color-mix(in oklch,var(--accent) 42%,#fff 58%); background:var(--accent-soft); }
.choice-row input { width:20px; height:20px; accent-color:var(--accent); }
.choice-row span { display:flex; flex-direction:column; gap:2px; font-size:14px; }
.choice-row small { color:var(--muted); font-size:12px; }
.transaction-summary { display:flex; align-items:center; gap:12px; margin-bottom:13px; padding:12px; border-radius:16px; background:var(--accent-soft); }
.transaction-icon { width:42px; height:42px; display:grid; place-items:center; flex:0 0 auto; border-radius:14px; background:#fff; color:var(--accent); font-size:22px; }
.amount-field { margin-top:4px; }
.approval-amount { margin:10px 0 2px; font-family:var(--font-mono); font-size:34px; font-weight:700; letter-spacing:-.04em; text-align:center; }
.center { text-align:center; }
.sheet-metrics { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.sheet-metrics > div { padding:12px; border-radius:15px; background:color-mix(in oklch,#09090B 4%,#fff 96%); }
.sheet-metrics strong { display:block; margin-top:4px; font-family:var(--font-mono); font-size:18px; }
.prototype-toast {
  position:fixed; left:50%; bottom:86px; z-index:70; width:max-content; max-width:calc(100% - 32px);
  padding:11px 14px; border-radius:14px; background:var(--fg); color:#fff; font-size:12px; font-weight:600;
  text-align:center; opacity:0; pointer-events:none; transform:translate(-50%,10px); transition:opacity .18s ease,transform .18s ease;
  box-shadow:0 14px 38px -20px rgba(9,9,11,.65);
}
.prototype-toast.show { opacity:1; transform:translate(-50%,0); }
.bubble.loading { color:var(--muted); font-style:italic; }

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

@media (max-width:340px){ .scroll{padding-inline:14px}.grid-4{grid-template-columns:repeat(2,minmax(0,1fr))} }
