:root {
  --bg-main: #f9fafb;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  --border-color: #f1f5f9;
  --accent-slate: #1e293b;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-blue: #3b82f6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-main); color: var(--text-main); overflow-x: hidden; line-height: 1.5; }
.hidden { display: none !important; }

/* ── AUTH SCREEN ─────────────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  padding: 2rem;
}
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05);
  padding: 2.5rem;
  border-radius: 1.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.auth-logo-emoji { font-size: 2rem; }
.auth-logo-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; color: var(--accent-slate); }
.auth-sub { display: inline-block; font-size: 0.8rem; font-weight: 600; background: var(--primary-light); color: var(--primary-hover); padding: 0.125rem 0.5rem; border-radius: 0.375rem; margin-bottom: 1.5rem; }
.auth-tagline { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-tabs { display: flex; gap: 0; border: 1px solid var(--border-color); border-radius: 0.75rem; overflow: hidden; margin-bottom: 1.5rem; }
.auth-tab { flex: 1; padding: 0.625rem; font-size: 0.875rem; font-weight: 600; border: none; background: transparent; cursor: pointer; color: var(--text-muted); transition: all 0.2s; font-family: inherit; }
.auth-tab.active { background: var(--accent-slate); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 0.75rem; text-align: left; }
.auth-input-group { display: flex; flex-direction: column; gap: 0.25rem; }
.auth-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.auth-input { border: 1px solid #cbd5e1; border-radius: 0.75rem; padding: 0.75rem 1rem; font-family: inherit; font-size: 0.937rem; outline: none; width: 100%; transition: border-color 0.2s; }
.auth-input:focus { border-color: var(--primary); }
.auth-submit-btn { width: 100%; background: var(--accent-slate); color: white; border: none; padding: 0.875rem 1.25rem; font-size: 0.937rem; font-weight: 600; border-radius: 0.875rem; cursor: pointer; transition: all 0.2s; font-family: inherit; margin-top: 0.25rem; }
.auth-submit-btn:hover:not(:disabled) { background: #000; transform: translateY(-1px); }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-divider { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.auth-divider span { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.google-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.75rem; background: #fff; border: 1.5px solid #dadce0; border-radius: 0.875rem; padding: 0.875rem 1.25rem; font-size: 0.937rem; font-weight: 600; color: #3c4043; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.google-btn:hover { background: #f8f9fa; border-color: #bdc1c6; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.google-btn svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.auth-alt { font-size: 0.8rem; color: var(--text-muted); margin-top: 1.25rem; }
.auth-alt a { color: var(--primary-hover); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.auth-footer { font-size: 0.75rem; color: var(--text-muted); margin-top: 1.25rem; line-height: 1.6; }
.auth-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--accent-red); border-radius: 0.75rem; padding: 0.75rem 1rem; font-size: 0.875rem; margin-top: 0.75rem; display: none; text-align: left; }

/* ── SPLASH ──────────────────────────────────────────────────────── */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%); padding: 2rem; text-align: center; position: relative; }
.splash-content { max-width: 500px; width: 100%; background: var(--bg-surface); border: 1px solid var(--border-color); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05); padding: 2.5rem; border-radius: 1.5rem; }
.logo-row { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.logo-emoji { font-size: 2rem; }
.logo-title { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.03em; color: var(--accent-slate); }
.logo-sub { display: inline-block; font-size: 0.875rem; font-weight: 600; background: var(--primary-light); color: var(--primary-hover); padding: 0.125rem 0.5rem; border-radius: 0.375rem; margin-bottom: 1.5rem; }
.tagline { font-size: 1.125rem; color: var(--text-muted); margin-bottom: 2rem; }
.badges { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 2rem; flex-wrap: wrap; }
.badge { font-size: 0.75rem; font-weight: 600; background: var(--bg-main); color: var(--text-muted); padding: 0.375rem 0.75rem; border-radius: 2rem; border: 1px solid var(--border-color); }
.player-card { border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.user-welcome { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.user-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary-light); }
.user-avatar-placeholder { width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.user-name { font-size: 1rem; font-weight: 700; color: var(--accent-slate); }
.ready-text { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--accent-slate); }
.press-start-btn { width: 100%; background: var(--accent-slate); color: white; border: none; padding: 1rem; border-radius: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; font-size: 1rem; }
.press-start-btn:hover { background: #000; transform: translateY(-1px); }
.bottom-tagline { position: absolute; bottom: 2rem; font-size: 0.875rem; color: var(--text-muted); font-style: italic; }

/* ── LAYOUT ──────────────────────────────────────────────────────── */
#main-app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────────────── */
.sidebar { width: 260px; background: var(--accent-slate); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 2rem 1.5rem; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; transition: transform 0.3s ease; }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.nav-links { list-style: none; margin-top: 2rem; flex-grow: 1; }
.nav-links li { margin-bottom: 0.5rem; }
.nav-link { display: flex; align-items: center; gap: 0.875rem; color: #94a3b8; text-decoration: none; padding: 0.75rem 1rem; border-radius: 0.75rem; font-size: 0.937rem; font-weight: 500; transition: all 0.2s ease; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { border-left: 3px solid var(--primary); background: rgba(16,185,129,0.1); }
.nav-icon { font-size: 1.1rem; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 1.5rem; }
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.sidebar-user-avatar { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.812rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 0.7rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign-out-btn { width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: #94a3b8; padding: 0.5rem; border-radius: 0.5rem; font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.sign-out-btn:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.sidebar-version { font-size: 0.7rem; color: #475569; margin-top: 0.5rem; }

/* ── TOPBAR ──────────────────────────────────────────────────────── */
.main-content { flex-grow: 1; margin-left: 260px; padding: 6.5rem 2.5rem 3rem 2.5rem; width: calc(100% - 260px); }
.topbar { position: fixed; top: 0; right: 0; left: 260px; height: 4.5rem; background: rgba(255,255,255,0.8); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 2.5rem; z-index: 90; }
.hamburger { display: none; margin-right: 1rem; font-size: 1.5rem; background: none; border: none; cursor: pointer; }
@media (max-width: 768px) { .hamburger { display: block; } }
.topbar-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.level-badge { font-size: 0.75rem; font-weight: 700; background: var(--primary-light); color: var(--primary-hover); padding: 0.375rem 0.75rem; border-radius: 0.5rem; }
.add-btn { background: var(--primary); color: white; border: none; padding: 0.5rem 1.25rem; border-radius: 0.625rem; font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: background 0.2s; }
.add-btn:hover { background: var(--primary-hover); }

/* ── PAGES ───────────────────────────────────────────────────────── */
.page { animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-header { margin-bottom: 2rem; }
.page-h2 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.page-desc { color: var(--text-muted); font-size: 0.95rem; }

/* ── ONBOARDING ──────────────────────────────────────────────────── */
.onboarding-banner { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border: 1px solid #a7f3d0; border-radius: 1.25rem; padding: 2rem; margin-bottom: 2rem; display: flex; align-items: center; gap: 1.5rem; }
.onboarding-icon { font-size: 2.5rem; flex-shrink: 0; }
.onboarding-text h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; color: var(--accent-slate); }
.onboarding-text p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
.onboarding-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.ob-btn { padding: 0.5rem 1rem; border-radius: 0.625rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.ob-btn.primary { background: var(--primary); color: white; }
.ob-btn.primary:hover { background: var(--primary-hover); }
.ob-btn.secondary { background: white; color: var(--accent-slate); border: 1px solid var(--border-color); }
.ob-btn.secondary:hover { border-color: var(--primary); }

/* ── STATS ───────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 1.5rem; border-radius: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.stat-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); }
.stat-card.yellow { border-top: 4px solid var(--accent-yellow); }
.stat-card.green { border-top: 4px solid var(--primary); }
.stat-card.red { border-top: 4px solid var(--accent-red); }
.stat-card.blue { border-top: 4px solid var(--accent-blue); }

/* ── CHARTS ──────────────────────────────────────────────────────── */
.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.chart-card, .recent-card, .salary-form-card, .score-circle-card, .health-breakdown, .ai-tips-card { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 1.75rem; border-radius: 1.25rem; }
.chart-title, .tips-title, .result-title { font-size: 0.95rem; font-weight: 700; color: var(--accent-slate); margin-bottom: 1.25rem; letter-spacing: -0.01em; }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 180px; color: var(--text-muted); text-align: center; gap: 0.5rem; }
.chart-empty .empty-icon { font-size: 2rem; }
.chart-empty p { font-size: 0.875rem; }

/* ── RECEIPT SCANNER ─────────────────────────────────────────────── */
.scanner-area { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; }
.upload-zone { width: 100%; max-width: 600px; border: 2px dashed #cbd5e1; background: var(--bg-surface); border-radius: 1.25rem; padding: 4rem 2rem; text-align: center; cursor: pointer; transition: all 0.2s ease; }
.upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.upload-text { font-weight: 600; font-size: 1rem; color: var(--accent-slate); }
.upload-sub { font-size: 0.812rem; color: var(--text-muted); margin-top: 0.25rem; }
.scanner-preview { text-align: center; max-width: 400px; width: 100%; }
.receipt-img { max-width: 100%; max-height: 300px; object-fit: contain; border-radius: 0.75rem; margin-bottom: 1rem; border: 1px solid var(--border-color); }
.scan-btn, .save-btn { width: 100%; background: var(--primary); color: white; border: none; padding: 0.875rem; border-radius: 0.75rem; font-weight: 600; cursor: pointer; transition: background 0.2s; font-size: 0.937rem; }
.scan-btn:hover, .save-btn:hover { background: var(--primary-hover); }
.scan-result { margin-top: 2rem; width: 100%; max-width: 600px; margin-left: auto; margin-right: auto; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; background: var(--bg-main); padding: 1.25rem; border-radius: 0.75rem; margin-bottom: 1.25rem; border: 1px solid var(--border-color); }

/* ── CHAT ────────────────────────────────────────────────────────── */
.coach-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.chat-container { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 1.25rem; height: 500px; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex-grow: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.chat-msg { display: flex; gap: 0.75rem; max-width: 80%; }
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar { font-size: 1.25rem; }
.chat-bubble { padding: 0.875rem 1.125rem; border-radius: 1rem; font-size: 0.937rem; }
.chat-msg.bot .chat-bubble { background: var(--bg-main); color: var(--text-main); border-top-left-radius: 0.25rem; }
.chat-msg.user .chat-bubble { background: var(--accent-slate); color: white; border-top-right-radius: 0.25rem; }
.chat-input-row { display: flex; padding: 1rem; border-top: 1px solid var(--border-color); gap: 0.75rem; }
.chat-input { flex-grow: 1; border: 1px solid #cbd5e1; border-radius: 0.75rem; padding: 0.75rem 1rem; font-family: inherit; outline: none; font-size: 0.937rem; }
.chat-input:focus { border-color: var(--primary); }
.chat-send { background: var(--accent-slate); color: white; border: none; width: 3rem; border-radius: 0.75rem; cursor: pointer; font-size: 1rem; }
.quick-tips { display: flex; flex-direction: column; gap: 0.5rem; }
.tips-title { font-size: 0.95rem; font-weight: 700; color: var(--accent-slate); margin-bottom: 0.75rem; }
.tip-btn { background: var(--bg-surface); border: 1px solid var(--border-color); text-align: left; padding: 0.875rem 1.25rem; border-radius: 0.875rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.tip-btn:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-hover); }

/* ── HEALTH ──────────────────────────────────────────────────────── */
.health-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.score-circle-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.score-ring { position: relative; width: 160px; height: 160px; margin-bottom: 1rem; }
.score-svg { width: 100%; height: 100%; }
.score-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.score-number { font-size: 2.25rem; font-weight: 800; color: var(--accent-slate); }
.score-label { font-size: 0.875rem; color: var(--text-muted); display: block; }
.score-grade { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; letter-spacing: 0.05em; color: var(--primary-hover); }
.health-no-data { background: var(--bg-main); border-radius: 0.75rem; padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.health-bars { display: flex; flex-direction: column; gap: 1.25rem; }
.hb-label { display: flex; justify-content: space-between; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.375rem; }
.hb-track { background: var(--bg-main); height: 0.5rem; border-radius: 1rem; overflow: hidden; }
.hb-fill { height: 100%; border-radius: 1rem; transition: width 1s ease-out; }
.hb-fill.yellow { background: var(--accent-yellow); }
.hb-fill.green { background: var(--primary); }
.hb-fill.blue { background: var(--accent-blue); }
.hb-fill.red { background: var(--accent-red); }

/* ── SALARY ──────────────────────────────────────────────────────── */
.salary-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; align-items: flex-end; }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1.25rem; text-align: left; }
.form-group label { font-size: 0.812rem; font-weight: 600; color: var(--text-muted); }
.form-input { border: 1px solid #cbd5e1; border-radius: 0.75rem; padding: 0.75rem 1rem; font-family: inherit; font-size: 0.937rem; outline: none; background-color: #fff; }
.form-input:focus { border-color: var(--primary); }

/* Savings results grid — now 5 stats, smaller min-width to fit */
.salary-results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.salary-stat { background: var(--bg-main); border-radius: 0.875rem; padding: 1rem; text-align: center; border: 1px solid var(--border-color); }
.salary-stat .s-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.375rem; }
.salary-stat .s-value { font-size: 1.25rem; font-weight: 800; color: var(--accent-slate); }

/* Highlight the savings stat tile with a blue accent */
.salary-stat.savings-highlight { border-top: 3px solid var(--accent-blue); }

.salary-charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.salary-tips-list { display: flex; flex-direction: column; gap: 0.75rem; }

/* ── SALARY AUTO-SAVE HINT ───────────────────────────────────────── */
.salary-autosave-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: -0.75rem; margin-bottom: 0.5rem; font-style: italic; }

/* ── OVERSPEND ALERT on Saved Balance stat ───────────────────────── */
.stat-value.overspend { color: var(--accent-red) !important; }

/* ── SAVINGS PAGE ────────────────────────────────────────────────── */
.opening-balance-prompt { background: linear-gradient(135deg, #eff6ff, #dbeafe); border: 1px solid #93c5fd; border-radius: 1.25rem; padding: 1.75rem; margin-bottom: 1.5rem; display: flex; align-items: flex-start; gap: 1.25rem; }
.opening-balance-prompt-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
.opening-balance-prompt-row .form-input { flex: 1; min-width: 180px; }
.opening-balance-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-top: 4px solid var(--accent-blue); padding: 1.75rem; border-radius: 1.25rem; margin-bottom: 1.5rem; }
.opening-balance-row { display: grid; grid-template-columns: 1fr auto; gap: 1.25rem; align-items: end; }
.opening-balance-display { text-align: right; padding: 0.75rem 1rem; background: var(--bg-main); border-radius: 0.875rem; border: 1px solid var(--border-color); min-width: 160px; }
.opening-balance-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.25rem; }
.opening-balance-value { font-size: 1.375rem; font-weight: 800; color: var(--primary); }
.savings-field-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; line-height: 1.4; }
.savings-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.savings-history-table { margin-top: 0; }
.goal-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; padding: 0.2rem 0.5rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 700; }
.goal-badge.met { background: #ecfdf5; color: var(--primary-hover); }
.goal-badge.miss { background: #fef2f2; color: var(--accent-red); }

/* ── SAVINGS PAGE (legacy setup card) ────────────────────────────── */
.savings-setup-card { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 1.75rem; border-radius: 1.25rem; margin-bottom: 1.5rem; }
.savings-setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }

/* ── TABLES ──────────────────────────────────────────────────────── */
.table-wrap { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 1.25rem; overflow: hidden; margin-top: 1.5rem; }
.expense-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.937rem; }
.expense-table th { background: var(--bg-main); padding: 1rem 1.5rem; font-weight: 600; color: var(--text-muted); font-size: 0.812rem; letter-spacing: 0.05em; }
.expense-table td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.delete-btn { background: none; border: none; color: var(--accent-red); cursor: pointer; font-weight: 500; font-size: 0.875rem; }
.delete-btn:hover { text-decoration: underline; }
.empty-state { padding: 3rem; text-align: center; color: var(--text-muted); font-size: 0.937rem; }
.empty-state .empty-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.empty-state p { margin-bottom: 1rem; }

/* ── MODAL ───────────────────────────────────────────────────────── */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.4); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-box { background: var(--bg-surface); border-radius: 1.5rem; width: 100%; max-width: 460px; padding: 2rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.125rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.125rem; cursor: pointer; color: var(--text-muted); }

/* ── ONBOARDING MODAL ────────────────────────────────────────────── */
.onboard-modal-box { background: var(--bg-surface); border-radius: 1.5rem; width: 100%; max-width: 480px; padding: 2.5rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15); }
.onboard-emoji { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.onboard-title { font-size: 1.375rem; font-weight: 800; color: var(--accent-slate); margin-bottom: 0.5rem; }
.onboard-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.75rem; }
.onboard-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--accent-red); border-radius: 0.75rem; padding: 0.625rem 0.875rem; font-size: 0.812rem; margin-top: 0.5rem; display: none; }
.onboard-skip { background: none; border: none; color: var(--text-muted); font-size: 0.8rem; cursor: pointer; margin-top: 1rem; text-decoration: underline; font-family: inherit; }
.onboard-skip:hover { color: var(--accent-slate); }

/* ── TOAST ───────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 2rem; right: 2rem; background: var(--accent-slate); color: white; padding: 0.875rem 1.5rem; border-radius: 0.75rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); z-index: 300; font-size: 0.875rem; font-weight: 500; animation: slideIn 0.2s ease; }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── LOADING ─────────────────────────────────────────────────────── */
.loading-overlay { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.loading-spinner { width: 2rem; height: 2rem; border: 3px solid var(--primary-light); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 0.812rem; font-weight: 600; color: var(--primary-hover); }

/* ── SIDEBAR OVERLAY ─────────────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
.sidebar-overlay.active { display: block; }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; padding: 6rem 1.25rem 2rem 1.25rem; }
  .topbar { left: 0; padding: 0 1.25rem; }
  .charts-row { grid-template-columns: 1fr; }
  .coach-layout { grid-template-columns: 1fr; }
  .health-layout { grid-template-columns: 1fr; }
  .salary-charts-row { grid-template-columns: 1fr; }
  .onboarding-banner { flex-direction: column; text-align: center; }
  .salary-results-grid { grid-template-columns: repeat(2, 1fr); }
  .opening-balance-row { grid-template-columns: 1fr; }
  .opening-balance-display { text-align: left; }
}