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

/* ── LIGHT THEME (default) ── */
:root {
  --bg: #F7F5F0; --bg2: #FFFFFF; --bg3: #F0EDE6;
  --border: #E4DFD6; --border-light: #C8C0B4;
  --pretax: #2D5016; --taxable: #1A3A5C; --taxfree: #5C3A1A;
  --realestate: #7A4A1A;
  --pretax-dim: #EBF2E3; --taxable-dim: #E3EBF5; --taxfree-dim: #F5EBE3;
  --equity-dim: #E8F5EA; --cash-dim: #F0F4F8;
  --text-primary: #1A1814; --text-secondary: #6B6560; --text-muted: #9E9890;
  --income: #2D7A3A; --expense: #C0392B; --transfer: #6B4A8A;
  --accent: #C4973A; --accent-light: #FBF3E3;
  --future: #C4973A; --future-dim: #FBF3E3;
  --single: #2D5016; --single-dim: #EBF2E3;
  --family: #8B5E3C; --family-dim: #F5EBE3;
  --crypto: #8B5E3C;
  --cash: #4A7A6A;
  --equity: #2D7A3A;
  --cf-housing: #C0392B; --cf-auto: #8B5E3C; --cf-food: #2D5016; --cf-utilities: #1A6B7A;
  --cf-personal: #C4973A; --cf-health: #6B4A8A; --cf-family: #A0552D; --cf-financial: #5C3A1A;
  --cf-taxes: #1A3A5C; --cf-business: #2D7A3A; --cf-other: #9E9890;
}

/* ── DARK THEME ── */
body.dark {
  --bg: #0d1117; --bg2: #13181f; --bg3: #1a2030;
  --border: rgba(255,255,255,0.07); --border-light: rgba(255,255,255,0.14);
  --pretax: #5b9cf6; --taxable: #a78bfa; --taxfree: #f0b429;
  --realestate: #34d399;
  --pretax-dim: rgba(91,156,246,0.12); --taxable-dim: rgba(167,139,250,0.12);
  --taxfree-dim: rgba(240,180,41,0.12); --equity-dim: rgba(52,211,153,0.10);
  --cash-dim: rgba(148,163,184,0.10);
  --text-primary: #f0f4ff; --text-secondary: #8892a4; --text-muted: #505870;
  --income: #34d399; --expense: #f87171; --transfer: #a78bfa;
  --accent: #f0b429; --accent-light: rgba(240,180,41,0.12);
  --future: #c084fc; --future-dim: rgba(192,132,252,0.12);
  --single: #5b9cf6; --single-dim: rgba(91,156,246,0.12);
  --family: #fb923c; --family-dim: rgba(251,146,60,0.12);
  --crypto: #fb923c; --cash: #94a3b8; --equity: #34d399;
  --cf-housing: #f87171; --cf-auto: #fb923c; --cf-food: #34d399; --cf-utilities: #38bdf8;
  --cf-personal: #fbbf24; --cf-health: #a78bfa; --cf-family: #f472b6; --cf-financial: #c084fc;
  --cf-taxes: #60a5fa; --cf-business: #2dd4bf; --cf-other: #94a3b8;
}

body {
  background: var(--bg); color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh; overflow-x: hidden;
  transition: background 0.4s, color 0.4s;
}

/* ── TOPBAR ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  transition: background 0.4s, border-color 0.4s;
}

.wordmark {
  font-family: 'DM Serif Display', serif; font-size: 22px;
  letter-spacing: -0.5px; cursor: pointer;
}
.wordmark .w-my  { color: var(--text-primary); transition: color 0.4s; }
.wordmark .w-eco { color: var(--accent); transition: color 0.4s; }

.topbar-center { display: flex; align-items: center; gap: 12px; }

.nav-tabs {
  display: flex; gap: 4px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 10px; padding: 4px;
  transition: all 0.4s;
}
body.in-future .nav-tabs { opacity: 0.3; pointer-events: none; }

.nav-tab {
  padding: 7px 18px; border-radius: 7px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  transition: all 0.18s; font-family: 'DM Sans', sans-serif;
}
.nav-tab:hover { color: var(--text-secondary); }
.nav-tab.active {
  background: var(--bg2); color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}

.nav-divider { width: 1px; height: 22px; background: var(--border); }

.future-tab-btn {
  font-family: 'DM Serif Display', serif; font-size: 17px;
  letter-spacing: -0.3px; color: var(--text-secondary);
  cursor: pointer; border: none; background: none;
  padding: 4px 2px; transition: opacity 0.2s; white-space: nowrap;
}
.future-tab-btn:hover { opacity: 0.75; }
.future-tab-btn .future-F { font-size: 21px; color: var(--accent); font-style: italic; line-height: 1; vertical-align: baseline; }
.future-tab-btn .future-word { color: var(--accent); font-style: italic; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.sync-badge { font-size: 12px; color: var(--text-muted); font-family: 'DM Mono', monospace; }

.theme-toggle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.2s; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--border-light); }

/* ── SHELL ── */
.shell {
  max-width: 980px; margin: 0 auto;
  padding: 0 32px 100px;
}

/* ── PANELS ── */
.panel { display: none; }
.panel.active { display: block; }

/* ── SHARED ── */
.slabel {
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px;
}

@keyframes fadeUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

/* ══════════════════════════════════════
   OVERVIEW
══════════════════════════════════════ */
#panel-overview { padding-top: 40px; }

.hero { margin-bottom: 8px; opacity: 0; animation: fadeUp 0.5s ease 0.1s forwards; }
.hero-label { font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.hero-row { display: flex; align-items: baseline; gap: 20px; margin-bottom: 4px; }
.hero-amount { font-family: 'DM Serif Display', serif; font-size: clamp(52px,7vw,76px); letter-spacing: -0.03em; line-height: 1; }
.hero-growth { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--income); background: var(--equity-dim); padding: 3px 10px; border-radius: 6px; }
.hero-invested { font-size: 14px; color: var(--income); font-weight: 500; margin-top: 6px; }

.ov-comp-section { margin: 28px 0 32px; opacity: 0; animation: fadeUp 0.5s ease 0.2s forwards; }
.ov-slabel { font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.ov-seg-label { font-size: 10px; font-weight: 600; overflow: hidden; white-space: nowrap; padding-right: 4px; }
.ov-comp-bar { height: 10px; border-radius: 999px; display: flex; gap: 2px; overflow: hidden; }
.ov-comp-seg { height: 100%; border-radius: 2px; transition: opacity 0.2s; }
.ov-comp-seg:hover { opacity: 0.75; }
.ov-seg-pct { font-size: 10px; color: var(--text-muted); font-family: 'DM Mono', monospace; overflow: hidden; padding-right: 4px; }

/* Bucket tiles */
.buckets { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 32px; opacity: 0; animation: fadeUp 0.5s ease 0.35s forwards; }
.bucket { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 22px 20px; position: relative; overflow: hidden; cursor: default; transition: border-color 0.2s, transform 0.2s; }
.bucket::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; border-radius:16px 16px 0 0; }
.bucket::after  { content:''; position:absolute; bottom:-28px; right:-28px; width:100px; height:100px; border-radius:50%; opacity:0.06; transition:opacity 0.3s; }
.bucket:hover { transform: translateY(-2px); border-color: var(--border-light); }
.bucket:hover::after { opacity: 0.12; }
.bucket.pretax::before  { background: var(--pretax); }
.bucket.taxable::before { background: var(--taxable); }
.bucket.taxfree::before { background: var(--taxfree); }
.bucket.pretax::after  { background: var(--pretax); }
.bucket.taxable::after { background: var(--taxable); }
.bucket.taxfree::after { background: var(--taxfree); }
.bucket-tag { display:inline-flex; align-items:center; gap:4px; font-size:10px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; padding:3px 10px; border-radius:100px; margin-bottom:14px; }
.pretax  .bucket-tag { background:var(--pretax-dim);  color:var(--pretax); }
.taxable .bucket-tag { background:var(--taxable-dim); color:var(--taxable); }
.taxfree .bucket-tag { background:var(--taxfree-dim); color:var(--taxfree); }
.bucket-amount { font-family:'DM Serif Display',serif; font-size:30px; letter-spacing:-0.025em; line-height:1; margin-bottom:14px; }
.bucket-accounts { display:flex; flex-direction:column; gap:6px; border-top:1px solid var(--border); padding-top:12px; position:relative; z-index:1; }
.acct-row { display:flex; justify-content:space-between; align-items:center; }
.acct-name { font-size:12px; color:var(--text-secondary); }
.acct-val  { font-family:'DM Mono',monospace; font-size:12px; }

/* FI section */
.ov-fi-section { background:var(--bg2); border:1px solid var(--border); border-radius:16px; padding:24px; margin-bottom:24px; opacity:0; animation:fadeUp 0.5s ease 0.5s forwards; }
.ov-fi-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; }
.ov-fi-label { font-size:10px; font-weight:600; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-muted); margin-bottom:6px; }
.ov-fi-story { font-family:'DM Serif Display',serif; font-size:18px; color:var(--text-primary); line-height:1.35; }
.ov-fi-story em { color:var(--accent); font-style:normal; }
.ov-fi-right { text-align:right; flex-shrink:0; }
.ov-fi-pct { font-family:'DM Serif Display',serif; font-size:32px; color:var(--accent); line-height:1; }
.ov-fi-pct-label { font-size:11px; color:var(--text-muted); margin-top:2px; }
.ov-fi-bar-wrap { position:relative; margin-bottom:22px; }
.ov-fi-bar-bg { height:8px; background:var(--bg3); border-radius:999px; overflow:hidden; }
.ov-fi-bar-fill { height:100%; background:linear-gradient(90deg,var(--accent) 0%,#E8B84B 100%); border-radius:999px; width:0%; transition:width 1s cubic-bezier(0.4,0,0.2,1) 0.8s; }
.ov-fi-marker { position:absolute; top:12px; left:0%; transform:translateX(-100%); transition:left 1s cubic-bezier(0.4,0,0.2,1) 0.8s, opacity 0.3s; text-align:right; }
.ov-fi-marker-label { font-size:10px; color:var(--accent); font-weight:600; font-family:'DM Mono',monospace; white-space:nowrap; }
.ov-fi-milestones { display:flex; justify-content:space-between; }
.ov-fi-milestone { font-size:10px; color:var(--text-muted); font-family:'DM Mono',monospace; }

/* Detail toggle */
.ov-detail-toggle { display:flex; align-items:center; gap:10px; margin-bottom:16px; opacity:0; animation:fadeUp 0.5s ease 0.6s forwards; }
.ov-toggle-btn { display:flex; align-items:center; gap:8px; background:none; border:1px solid var(--border); border-radius:8px; padding:8px 14px; font-size:12px; font-weight:500; color:var(--text-secondary); cursor:pointer; font-family:'DM Sans',sans-serif; transition:all 0.2s; }
.ov-toggle-btn:hover { border-color:var(--border-light); color:var(--text-primary); }
.ov-toggle-icon { transition:transform 0.3s; font-size:10px; }
.ov-toggle-btn.open .ov-toggle-icon { transform:rotate(180deg); }
.ov-detail-panel { overflow:hidden; max-height:0; transition:max-height 0.5s cubic-bezier(0.4,0,0.2,1); }
.ov-detail-panel.open { max-height:900px; }

/* Detail cards */
.ov-insight { background:var(--accent-light); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:10px; padding:14px 18px; font-size:13px; color:var(--text-secondary); line-height:1.6; margin-bottom:14px; }
.ov-insight strong { color:var(--text-primary); font-weight:500; }
.ov-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.ov-detail-card { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:16px 18px; }
.ov-detail-title { font-size:10px; font-weight:600; letter-spacing:0.12em; text-transform:uppercase; color:var(--text-muted); margin-bottom:12px; }
.ov-detail-row { display:flex; justify-content:space-between; align-items:center; padding:6px 0; border-bottom:1px solid var(--border); font-size:12px; }
.ov-detail-row:last-child { border-bottom:none; }
.ov-dr-label { color:var(--text-secondary); }
.ov-dr-val { font-family:'DM Mono',monospace; font-size:12px; font-weight:500; color:var(--text-primary); }

/* Skeleton loading — applied to the real elements themselves (shimmer style
   swapped in via body.loading), not a separate hand-built skeleton layout,
   so a future redesign of the hero/bucket/FI markup is inherited for free
   instead of needing a parallel skeleton to keep in sync. body starts with
   class="loading" in index.html; app.js's renderDashboard() removes it once
   real data has been written into these same elements. */
@keyframes skel-shimmer { 0% { background-position:200% 0; } 100% { background-position:-200% 0; } }
body.loading .hero-amount,
body.loading .hero-invested,
body.loading .bucket-amount,
body.loading .acct-val,
body.loading .ov-fi-story,
body.loading .ov-fi-pct,
body.loading #nwTrendSection,
body.loading #ov-comp-bar-section {
  color:transparent; border-radius:6px;
  background:linear-gradient(90deg, var(--bg3) 40%, var(--border-light) 50%, var(--bg3) 60%);
  background-size:300% 100%;
  animation:skel-shimmer 1.6s ease-in-out infinite;
}
body.loading .hero-amount { min-width:220px; display:inline-block; }
body.loading .hero-invested { min-width:280px; display:inline-block; }
body.loading .ov-fi-story { min-width:220px; display:inline-block; }
body.loading .ov-fi-pct { min-width:40px; display:inline-block; }
body.loading #nwTrendSection { min-height:180px; display:block; }
body.loading #ov-comp-bar-section { min-height:24px; display:block; }
body.loading .hero-growth,
body.loading .ov-fi-marker { opacity:0; }

/* ══════════════════════════════════════
   ACCOUNTS
══════════════════════════════════════ */
#panel-accounts { padding-top: 32px; }
.accounts-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.group-toggle { display:flex; gap:4px; background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:3px; }
.toggle-btn { padding:6px 14px; border-radius:8px; font-size:12px; font-weight:500; color:var(--text-muted); cursor:pointer; border:none; background:none; transition:all 0.15s; font-family:'DM Sans',sans-serif; }
.toggle-btn:hover { color:var(--text-secondary); }
.toggle-btn.active { background:var(--bg3); color:var(--text-primary); border:1px solid var(--border); }
.acct-group { margin-bottom:28px; }
.acct-group-label { font-size:10px; font-weight:600; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-muted); margin-bottom:10px; display:flex; align-items:center; gap:8px; }
.acct-group-total { font-family:'DM Mono',monospace; font-size:11px; color:var(--text-secondary); margin-left:auto; }
.acct-list { display:flex; flex-direction:column; gap:8px; }
.acct-item-wrap { background:var(--bg2); border:1px solid var(--border); border-radius:12px; transition:border-color 0.2s; overflow:hidden; }
.acct-item-wrap:hover { border-color:var(--border-light); }
.acct-item { padding:14px 18px; display:flex; align-items:center; gap:14px; cursor:pointer; }
.acct-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:15px; flex-shrink:0; }
.acct-info { flex:1; min-width:0; }
.acct-item-name { font-size:13px; font-weight:500; color:var(--text-primary); margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.acct-item-meta { font-size:11px; color:var(--text-muted); }
.acct-item-right { text-align:right; flex-shrink:0; }
.acct-item-bal { font-family:'DM Serif Display',serif; font-size:18px; letter-spacing:-0.02em; margin-bottom:2px; }
.acct-item-bal.negative { color:var(--expense); }
.sync-badge { font-size:10px; font-family:'DM Mono',monospace; padding:2px 7px; border-radius:4px; }
.sync-ok     { background:var(--equity-dim); color:var(--income); }
.sync-manual { background:var(--taxfree-dim); color:var(--accent); }
.nw-toggle   { font-size:10px; font-family:'DM Mono',monospace; padding:2px 7px; border-radius:4px; cursor:pointer; user-select:none; }
.nw-on       { background:rgba(52,211,153,0.1); color:var(--income); }
.nw-off      { background:rgba(158,152,144,0.12); color:var(--text-muted); }
.nw-excluded .acct-item-bal { opacity:0.4; }
.acct-item-right { display:flex; align-items:center; gap:6px; flex-shrink:0; }

/* ── Trend charts (net worth over time, per-account balance history) ── */
.nw-trend-section { margin: 0 0 28px; opacity: 0; animation: fadeUp 0.5s ease 0.15s forwards; }
.trend-section-label { font-size:10px; font-weight:600; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-muted); margin-bottom:10px; }

.trend-plot { position:relative; }
.trend-svg { width:100%; height:180px; display:block; }

.trend-crosshair {
  position:absolute; top:0; bottom:0; width:1px; background:var(--border-light);
  opacity:0; pointer-events:none; transition:opacity 0.1s;
}
.trend-dot {
  position:absolute; width:8px; height:8px; border-radius:50%;
  transform:translate(-50%,-50%); border:2px solid var(--bg2);
  opacity:0; pointer-events:none; transition:opacity 0.1s; box-shadow:0 1px 4px rgba(0,0,0,0.15);
}
.trend-tooltip {
  position:absolute; transform:translate(-50%,-100%);
  background:var(--bg2); border:1px solid var(--border); border-radius:8px;
  padding:6px 10px; font-size:12px; white-space:nowrap; pointer-events:none;
  opacity:0; transition:opacity 0.1s; box-shadow:0 4px 12px rgba(0,0,0,0.1); z-index:6;
}
.trend-tooltip.tt-flip { transform:translate(-90%,-100%); }
.trend-chart-wrap.hovering .trend-crosshair,
.trend-chart-wrap.hovering .trend-dot,
.trend-chart-wrap.hovering .trend-tooltip { opacity:1; }
.tt-date { font-size:10px; color:var(--text-muted); margin-bottom:2px; }
.tt-val  { font-family:'DM Mono',monospace; font-weight:500; color:var(--text-primary); }

/* Year-end "signs" — always-visible direct labels, like a little post + plaque.
   The stem stays centered exactly on the data point; only the plaque shifts
   sideways near the chart edges so its text doesn't clip off-canvas. */
.trend-sign { position:absolute; transform:translate(-50%,-100%); pointer-events:none; display:flex; flex-direction:column; align-items:center; }
.trend-sign-plaque {
  background:var(--bg2); border:1px solid var(--border); border-radius:6px;
  padding:3px 7px; font-family:'DM Mono',monospace; font-size:11px; font-weight:500;
  color:var(--text-primary); white-space:nowrap; box-shadow:0 2px 6px rgba(0,0,0,0.08); margin-bottom:3px;
}
.trend-sign-plaque.edge-right { transform:translateX(-42%); }
.trend-sign-plaque.edge-left  { transform:translateX(42%); }
.trend-sign-stem { width:1px; height:14px; background:var(--border-light); }
.trend-sign-dot { position:absolute; width:6px; height:6px; border-radius:50%; transform:translate(-50%,-50%); border:1.5px solid var(--bg2); }

.trend-axis { position:relative; height:22px; }
.trend-axis-year { position:absolute; transform:translateX(-50%); font-size:10px; color:var(--text-muted); font-family:'DM Mono',monospace; top:4px; }

.acct-item-wrap .trend-chart-wrap { padding:0 18px 14px; }

.acct-chart-panel { max-height:0; overflow:hidden; opacity:0; border-top:1px solid transparent; transition:max-height 0.25s ease, opacity 0.2s ease, border-color 0.2s ease; }
.acct-chart-panel.open { max-height:320px; opacity:1; border-top-color:var(--border); }
.acct-chart-label { font-size:10px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-muted); padding:16px 18px 10px; }
.chart-loading, .chart-empty { padding:16px 18px; font-size:12px; color:var(--text-muted); }
.chart-empty[onclick] { cursor:pointer; text-decoration:underline; text-decoration-style:dotted; text-underline-offset:2px; }

/* ══════════════════════════════════════
   TRANSACTIONS
══════════════════════════════════════ */
#panel-transactions { padding-top: 32px; }
.tx-summary { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:24px; }
.tx-stat { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:14px 16px; }
.tx-stat-label { font-size:10px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-muted); margin-bottom:6px; }
.tx-stat-val { font-family:'DM Serif Display',serif; font-size:22px; letter-spacing:-0.02em; }
.tx-stat-sub { font-size:10px; color:var(--text-muted); font-family:'DM Mono',monospace; margin-top:3px; line-height:1.4; }
.tx-flag { font-size:10px; color:var(--accent); background:var(--accent-light); padding:2px 7px; border-radius:4px; font-family:'DM Mono',monospace; margin-top:4px; display:inline-block; }
.tx-controls { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:12px; flex-wrap:wrap; }
.tx-list { display:flex; flex-direction:column; gap:6px; }
.tx-item { background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:12px 16px; display:flex; align-items:center; gap:12px; transition:border-color 0.15s; }
.tx-item:hover { border-color:var(--border-light); }
.tx-cat-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.tx-info { flex:1; min-width:0; }
.tx-merchant { font-size:13px; font-weight:500; color:var(--text-primary); margin-bottom:2px; }
.tx-meta { font-size:11px; color:var(--text-muted); display:flex; gap:8px; align-items:center; }
.tx-account { flex-shrink:0; }
.tx-account.in { color:var(--income); }
.tx-date { cursor:pointer; border-radius:4px; padding:1px 3px; margin:-1px -3px; }
.tx-date:hover { background:var(--bg3); }
.tx-date-edit { font-size:11px; padding:0px 2px; border-radius:4px; background:var(--bg3); color:var(--text-primary); border:1px solid var(--border-light); font-family:'DM Mono',monospace; }
.tx-notes { font-size:11px; color:var(--text-muted); font-style:italic; margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tx-statement { font-size:10px; color:var(--text-muted); font-family:'DM Mono',monospace; margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; opacity:0.75; }
.tx-cat-pill { font-size:10px; padding:1px 7px; border-radius:4px; background:var(--bg3); color:var(--text-muted); cursor:pointer; }
.tx-cat-pill:hover { background:var(--border); }
.tx-cat-pill.needs-review { background:var(--accent-light); color:var(--accent); font-weight:500; }
.tx-cat-edit { font-size:10px; padding:1px 4px; border-radius:4px; background:var(--bg3); color:var(--text-primary); border:1px solid var(--border-light); font-family:'DM Sans',sans-serif; }
.tx-confirm-btn { font-size:10px; width:16px; height:16px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; background:var(--equity-dim); color:var(--income); cursor:pointer; font-weight:700; }
.tx-confirm-btn:hover { background:var(--income); color:var(--bg2); }
.tx-amount { font-family:'DM Mono',monospace; font-size:14px; font-weight:500; flex-shrink:0; }
.tx-amount.positive { color:var(--income); }
.tx-amount.negative { color:var(--text-secondary); }
.tx-cat-group { margin-bottom:24px; }
.tx-cat-group:last-child { margin-bottom:0; }
.tx-cat-group-header { font-size:14px; font-weight:600; color:var(--text-primary); padding-bottom:10px; display:flex; align-items:center; gap:6px; justify-content:space-between; cursor:pointer; user-select:none; }
.tx-cat-group-header:hover .tx-cat-group-name { color:var(--text-secondary); }
.tx-cat-group-name { display:flex; align-items:center; gap:6px; }
.tx-cat-group-chevron { font-size:10px; color:var(--text-muted); transition:transform 0.2s; display:inline-block; }
.tx-cat-group.collapsed .tx-cat-group-chevron { transform:rotate(-90deg); }
.tx-cat-group-total { font-family:'DM Mono',monospace; font-size:13px; color:var(--text-secondary); }
.tx-cat-group-rail { border-left:2px solid var(--border); margin-left:3px; padding-left:14px; display:flex; flex-direction:column; gap:6px; overflow:hidden; }
.tx-cat-group.collapsed .tx-cat-group-rail { display:none; }

/* Transfers group only: matched pairs shown as a connected outflow/inflow
   pair ("money left from here, went to there"), unmatched rows get a
   distinct marker instead. See tools/categorize_lib.js matchTransfers for
   the matching heuristic this mirrors client-side (findTransferPairs). */
.pair { display:flex; flex-direction:column; gap:1px; }
.pair .tx-item.leg-out { border-radius:10px 10px 0 0; }
.pair .leg-in-wrap { display:flex; padding-left:22px; }
.pair .connector { width:18px; flex-shrink:0; position:relative; }
.pair .connector::before {
  content:""; position:absolute; box-sizing:border-box;
  left:0; top:-2px; bottom:50%; width:18px;
  border-left:2px solid var(--border-light); border-bottom:2px solid var(--border-light);
  border-radius:0 0 0 8px;
}
.pair .tx-item.leg-in { border-radius:0 0 10px 10px; flex:1; background:var(--bg3); }
.pair .tx-item.leg-in .tx-cat-dot { background:var(--income); }
.tx-item.unmatched { border-left:3px solid var(--accent); }
.unmatched-tag { font-size:9.5px; font-family:'DM Sans',sans-serif; color:var(--accent); font-weight:600; letter-spacing:0.02em; text-transform:uppercase; flex-shrink:0; white-space:nowrap; }
.cat-filter  { background:var(--bg2); border:1px solid var(--border); border-radius:8px; color:var(--text-secondary); font-size:12px; font-family:'DM Sans',sans-serif; padding:7px 12px; cursor:pointer; outline:none; }
.month-picker { background:var(--bg2); border:1px solid var(--border); border-radius:8px; color:var(--text-secondary); font-size:12px; font-family:'DM Mono',monospace; padding:7px 12px; cursor:pointer; outline:none; }

/* ══════════════════════════════════════
   CASH FLOW
══════════════════════════════════════ */
#panel-cashflow { padding-top: 32px; }
.cf-header { display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:14px; margin-bottom:20px; }
.cf-title { font-family:'DM Serif Display',serif; font-size:26px; letter-spacing:-0.02em; }
.cf-controls { display:flex; align-items:center; gap:10px; }
.cf-period { display:flex; align-items:center; gap:8px; background:var(--bg2); border:1px solid var(--border); border-radius:9px; padding:5px 6px; }
.cf-period button { border:none; background:none; color:var(--text-secondary); cursor:pointer; font-size:14px; padding:3px 7px; border-radius:5px; font-family:'DM Sans',sans-serif; }
.cf-period button:hover { background:var(--bg3); color:var(--text-primary); }
.cf-period span { font-family:'DM Mono',monospace; font-size:12.5px; min-width:96px; text-align:center; display:inline-block; }

.cf-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:20px; }
.cf-stat { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:14px 16px; }
.cf-stat-label { font-size:10px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-muted); margin-bottom:6px; }
.cf-stat-val { font-family:'DM Serif Display',serif; font-size:22px; letter-spacing:-0.02em; }
.cf-stat-sub { font-size:10px; color:var(--text-muted); font-family:'DM Mono',monospace; margin-top:3px; line-height:1.4; }

.cf-card { background:var(--bg2); border:1px solid var(--border); border-radius:14px; padding:18px 20px 16px; margin-bottom:16px; }
.cf-card-label { font-size:11px; font-weight:600; letter-spacing:0.09em; text-transform:uppercase; color:var(--text-muted); margin-bottom:14px; }

.cf-chart-wrap { position:relative; }
.cf-tooltip {
  position:absolute; pointer-events:none; opacity:0; transition:opacity 0.12s;
  background:var(--bg3); border:1px solid var(--border-light); border-radius:8px;
  padding:8px 11px; font-size:11.5px; white-space:nowrap; transform:translate(-50%,-110%);
  box-shadow:0 4px 14px rgba(0,0,0,0.14); z-index:5;
}
.cf-tooltip .tt-period { color:var(--text-muted); font-size:10px; text-transform:uppercase; letter-spacing:0.06em; margin-bottom:4px; }
.cf-tooltip .tt-row { display:flex; justify-content:space-between; gap:14px; font-family:'DM Mono',monospace; }
.cf-bar-in  { fill:var(--income); opacity:0.85; cursor:pointer; transition:opacity 0.12s; }
.cf-bar-out { fill:var(--expense); opacity:0.85; cursor:pointer; transition:opacity 0.12s; }
.cf-bar-in:hover, .cf-bar-out:hover { opacity:1; }
.cf-bar-selected { opacity:1; stroke:var(--text-primary); stroke-width:1.5; }
.cf-period-label { font-size:9.5px; fill:var(--text-muted); font-family:'DM Mono',monospace; }
.cf-net-dot  { fill:var(--accent); }
.cf-net-line { stroke:var(--accent); stroke-width:1.5; fill:none; opacity:0.55; }

.cf-legend { display:flex; gap:18px; margin-top:8px; padding-left:2px; }
.cf-legend-item { display:flex; align-items:center; gap:6px; font-size:10.5px; color:var(--text-muted); font-family:'DM Mono',monospace; }
.cf-legend-dot  { width:8px; height:8px; border-radius:2px; }
.cf-legend-dot.round { border-radius:50%; }

.cf-breakdown-total { font-size:11.5px; color:var(--text-muted); margin-bottom:12px; font-family:'DM Mono',monospace; }
.cf-group { border-bottom:1px solid var(--border); }
.cf-group:last-child { border-bottom:none; }
.cf-group-row { display:flex; align-items:center; gap:12px; padding:11px 2px; cursor:pointer; user-select:none; }
.cf-group-swatch { width:9px; height:9px; border-radius:2px; flex-shrink:0; }
.cf-group-name { flex-shrink:0; width:160px; font-size:13px; color:var(--text-primary); }
.cf-group-bar-track { flex:1; height:7px; background:var(--bg3); border-radius:4px; overflow:hidden; }
.cf-group-bar-fill { height:100%; border-radius:4px; }
.cf-group-pct { width:40px; text-align:right; font-size:11px; color:var(--text-muted); font-family:'DM Mono',monospace; flex-shrink:0; }
.cf-group-amt { width:88px; text-align:right; font-family:'DM Mono',monospace; font-size:13px; flex-shrink:0; color:var(--text-primary); }
.cf-group-chevron { font-size:10px; color:var(--text-muted); transition:transform 0.2s; display:inline-block; width:14px; text-align:center; flex-shrink:0; }
.cf-group.open .cf-group-chevron { transform:rotate(90deg); }

.cf-cats { max-height:0; overflow:hidden; transition:max-height 0.2s ease; padding-left:21px; }
.cf-group.open .cf-cats { max-height:280px; }
.cf-cat-row { display:flex; justify-content:space-between; padding:7px 2px; font-size:12.5px; color:var(--text-secondary); border-top:1px solid var(--border); }
.cf-cat-amt { font-family:'DM Mono',monospace; }

@media (max-width:640px) {
  .cf-stats { grid-template-columns:1fr; }
  .cf-group-name { width:112px; }
}

/* ══════════════════════════════════════
   MY FUTURE
══════════════════════════════════════ */
#panel-future { padding-top: 32px; }
.return-present { display:inline-flex; align-items:center; gap:8px; font-size:12px; color:var(--text-muted); font-family:'DM Mono',monospace; letter-spacing:0.06em; cursor:pointer; margin-bottom:40px; transition:color 0.2s; text-transform:uppercase; }
.return-present:hover { color:var(--accent); }
.return-present::before { content:'←'; font-size:14px; }
.future-hero-section { margin-bottom:48px; }
.future-big-word { font-family:'DM Serif Display',serif; font-size:clamp(48px,8vw,80px); letter-spacing:-0.03em; line-height:1; margin-bottom:12px; }
.future-big-word .fbw-my     { color:var(--text-secondary); }
.future-big-word .fbw-future { color:var(--accent); }
.future-tagline { font-size:15px; color:var(--text-muted); line-height:1.7; max-width:580px; }
.future-tagline strong { color:var(--text-secondary); font-weight:500; }
.scenario-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.scenario-toggle { display:flex; gap:4px; background:var(--bg3); border:1px solid var(--border); border-radius:12px; padding:4px; }
.sc-btn { padding:8px 18px; border-radius:9px; font-size:13px; font-weight:500; color:var(--text-muted); cursor:pointer; border:none; background:none; font-family:'DM Sans',sans-serif; transition:all 0.2s; }
.sc-btn[data-sc="single"].active { background:var(--single-dim); color:var(--single); border:1px solid rgba(45,80,22,0.25); }
.sc-btn[data-sc="both"].active   { background:var(--accent-light); color:var(--accent); border:1px solid rgba(196,151,58,0.25); }
.sc-btn[data-sc="family"].active { background:var(--family-dim); color:var(--family); border:1px solid rgba(139,94,60,0.25); }
.fi-cards { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:32px; }
.fi-card { background:var(--bg2); border:1px solid var(--border); border-radius:14px; padding:20px; position:relative; overflow:hidden; }
.fi-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; border-radius:14px 14px 0 0; }
.fi-card.single::before { background:var(--single); }
.fi-card.family::before { background:var(--family); }
.fi-card-label { font-size:10px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; margin-bottom:12px; display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:100px; }
.fi-card.single .fi-card-label { background:var(--single-dim); color:var(--single); }
.fi-card.family .fi-card-label { background:var(--family-dim); color:var(--family); }
.fi-card-name { font-size:12px; color:var(--text-muted); margin-bottom:4px; }
.fi-card-val  { font-family:'DM Serif Display',serif; font-size:28px; letter-spacing:-0.025em; margin-bottom:3px; }
.fi-card-sub  { font-size:11px; color:var(--text-muted); font-family:'DM Mono',monospace; line-height:1.5; }
.timeline-section { background:var(--bg2); border:1px solid var(--border); border-radius:16px; padding:28px 28px 24px; margin-bottom:28px; }
.sliders-section { background:var(--bg2); border:1px solid var(--border); border-radius:16px; padding:24px 28px; margin-bottom:28px; }
.sliders-title { font-size:13px; color:var(--text-muted); margin-bottom:20px; }
.slider-row { display:grid; grid-template-columns:210px 1fr 90px; align-items:center; gap:16px; margin-bottom:14px; }
.sl-label { font-size:12px; color:var(--text-secondary); }
.sl-input { width:100%; accent-color:var(--accent); cursor:pointer; }
.sl-val { font-family:'DM Mono',monospace; font-size:12px; color:var(--accent); text-align:right; }
.goals-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-bottom:28px; }
.goal-card { background:var(--bg2); border:1px solid var(--border); border-radius:14px; padding:20px; position:relative; overflow:hidden; }
.goal-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; border-radius:14px 14px 0 0; }
.goal-near::before { background:var(--income); }
.goal-life::before { background:var(--accent); }
.goal-tag { font-size:10px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; padding:3px 10px; border-radius:100px; margin-bottom:12px; display:inline-block; }
.goal-near .goal-tag { background:var(--equity-dim); color:var(--income); }
.goal-life .goal-tag { background:var(--accent-light); color:var(--accent); }
.goal-name   { font-size:14px; font-weight:500; color:var(--text-primary); margin-bottom:4px; }
.goal-amount { font-family:'DM Serif Display',serif; font-size:26px; letter-spacing:-0.02em; margin-bottom:6px; }
.goal-meta   { font-size:12px; color:var(--text-muted); line-height:1.6; }
.goal-note   { font-size:10px; color:var(--accent); background:var(--accent-light); padding:2px 8px; border-radius:4px; font-family:'DM Mono',monospace; margin-top:6px; display:inline-block; }
.dream-section { background:var(--bg2); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:14px; padding:24px 28px; }
.dream-title { font-size:13px; font-weight:500; color:var(--text-secondary); margin-bottom:14px; display:flex; align-items:center; gap:8px; }
.api-row { display:flex; gap:8px; margin-bottom:14px; }
.api-mini-input { flex:1; background:var(--bg3); border:1px solid var(--border); border-radius:8px; color:var(--text-secondary); font-family:'DM Mono',monospace; font-size:11px; padding:8px 12px; outline:none; transition:border-color 0.2s; }
.api-mini-input::placeholder { color:var(--text-muted); }
.api-mini-input:focus { border-color:var(--border-light); }
.api-mini-btn { background:var(--accent-light); border:1px solid var(--border); border-radius:8px; color:var(--accent); font-size:11px; padding:8px 14px; cursor:pointer; font-family:'DM Mono',monospace; white-space:nowrap; transition:all 0.2s; }
.dream-row { display:flex; gap:10px; margin-bottom:12px; }
.dream-input { flex:1; background:var(--bg3); border:1px solid var(--border); border-radius:10px; color:var(--text-primary); font-family:'DM Sans',sans-serif; font-size:13px; padding:10px 14px; outline:none; transition:border-color 0.2s; }
.dream-input:focus { border-color:var(--border-light); }
.dream-input::placeholder { color:var(--text-muted); }
.dream-input:disabled { opacity:0.4; }
.dream-btn { background:var(--accent-light); border:1px solid var(--border); border-radius:10px; color:var(--accent); font-size:13px; padding:10px 18px; cursor:pointer; font-family:'DM Sans',sans-serif; transition:all 0.2s; }
.dream-btn:disabled { opacity:0.4; cursor:not-allowed; }
.dream-result { font-size:13px; color:var(--text-secondary); line-height:1.7; background:var(--bg3); border-radius:10px; padding:14px 16px; display:none; }
.dream-result.visible { display:block; }
.dream-result strong { color:var(--text-primary); font-weight:500; }

@media(max-width:700px){
  .topbar{padding:16px 20px;}
  .shell{padding:0 16px 80px;}
  .buckets{grid-template-columns:1fr;}
  .tx-summary{grid-template-columns:1fr 1fr;}
  .fi-cards{grid-template-columns:1fr;}
  .goals-grid{grid-template-columns:1fr;}
  .slider-row{grid-template-columns:1fr;gap:6px;}
  .nav-tab{padding:8px 10px;font-size:12px;}
}
