/* ========== RESET & VARIABLES ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0d0f14; --surface: #161920; --surface2: #1e2128; --surface3: #252830;
  --border: rgba(255,255,255,0.07); --border2: rgba(255,255,255,0.13);
  --text: #f0f2f7; --text2: #9ba3b8; --text3: #7a8294;
  --c-income: #6ee7b7; --c-expense: #f87171; --c-invest: #a78bfa;
  --c-bills: #f0a860; --c-grocery: #6ee7b7; --c-dining: #fbbf24;
  --c-entertainment: #818cf8; --c-subs: #67e8f9; --c-other: #94a3b8;
  --c-transport: #38bdf8; --c-health: #fb7185; --c-shopping: #c084fc; --c-education: #6366f1;
  --c-gifts: #f472b6; --c-pets: #d97706; --c-travel: #2dd4bf; --c-savings: #22c55e;
  --accent: #d4a843; --gold: #d4a843; --danger: #f87171;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --gap-section: 28px; --gap-card: 16px;
  --lv1: #94a3b8; --lv2: #6ee7b7; --lv3: #fbbf24; --lv4: #f0a860; --lv5: #f87171; --lv6: #a78bfa;
}
html { scroll-behavior: smooth; }
body { font-family:'Inter',system-ui,sans-serif; font-size:15px; line-height:1.6; color:var(--text); background:var(--bg); -webkit-font-smoothing:antialiased; overflow-x:hidden; }
h1,h2,h3,h4,h5,h6 { font-family:'Syne',sans-serif; font-weight:700; line-height:1.2; }
a { color:var(--gold); text-decoration:none; }
button { cursor:pointer; font-family:inherit; }
input,select,textarea { font-family:inherit; font-size:14px; }

/* ========== UTILITY CLASSES ========== */
.text-muted { color:var(--text3); }
.text-xs { font-size:11px; }
.text-sm { font-size:12px; }
.btn-icon-sm { width:28px; height:28px; font-size:12px; }
.btn-icon-xs { width:22px; height:22px; font-size:10px; }
.truncate { max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes modalIn { from { opacity:0; transform:translate(-50%,-50%) scale(0.96); } to { opacity:1; transform:translate(-50%,-50%) scale(1); } }
@keyframes overlayIn { from { opacity:0; } to { opacity:1; } }

/* ========== LOGIN SCREEN ========== */
#login-screen { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); position:relative; }
#login-screen::before { content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:500px; height:500px; background:radial-gradient(circle,rgba(212,168,67,0.06) 0%,transparent 70%); pointer-events:none; }
.login-card { background:var(--surface); border:1px solid var(--border2); border-radius:16px; padding:48px 40px; text-align:center; max-width:400px; width:100%; position:relative; z-index:1; }
.login-logo { font-family:'Syne',sans-serif; font-weight:800; font-size:28px; margin-bottom:8px; display:flex; align-items:center; justify-content:center; gap:10px; }
.login-logo .li, .app-logo .li, .roast-brand .li { width:36px; height:36px; border-radius:10px; object-fit:contain; }
.app-logo .li { width:26px; height:26px; border-radius:7px; }
.roast-brand .li { width:18px; height:18px; border-radius:5px; }
.login-sub { color:var(--text2); font-size:15px; margin-bottom:32px; }
.login-btn { display:flex; align-items:center; justify-content:center; gap:10px; width:100%; background:white; color:#333; border:none; padding:14px 24px; border-radius:10px; font-size:15px; font-weight:600; transition:all 0.15s; }
.login-btn:hover { background:#f0f0f0; transform:translateY(-1px); }
.login-btn svg { width:20px; height:20px; }
.login-footer { margin-top:24px; font-size:12px; color:var(--text3); }
.login-footer a { color:var(--text2); }

/* ========== APP HEADER ========== */
#app-shell { display:none; }
.app-header { position:fixed; top:0; left:0; right:0; z-index:100; background:rgba(13,15,20,0.9); backdrop-filter:blur(16px); border-bottom:1px solid var(--border); height:60px; padding:0 24px; }
.app-header-inner { max-width:1200px; margin:0 auto; display:flex; align-items:center; justify-content:space-between; height:100%; }
.app-logo { font-family:'Syne',sans-serif; font-weight:800; font-size:18px; display:flex; align-items:center; gap:8px; color:var(--text); text-decoration:none; }
.header-right { display:flex; align-items:center; gap:12px; }
.sync-dot { width:8px; height:8px; border-radius:50%; background:var(--c-income); transition:background 0.3s; }
.sync-dot.syncing { background:var(--gold); animation:pulse 1s infinite; }
.sync-dot.error { background:var(--danger); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Level Badge */
.level-badge { display:flex; align-items:center; gap:6px; padding:4px 12px; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer; position:relative; border:1px solid transparent; transition:all 0.15s; }
.level-badge:hover { border-color:currentColor; }
.level-badge .lv-num { opacity:0.6; }
.level-popover { display:none; position:absolute; top:calc(100% + 8px); left:50%; transform:translateX(-50%); background:var(--surface2); border:1px solid var(--border2); border-radius:12px; padding:16px; width:220px; z-index:10; text-align:center; }
.level-badge.open .level-popover { display:block; }
.xp-bar { height:4px; border-radius:2px; background:var(--surface3); margin:10px 0 6px; overflow:hidden; }
.xp-fill { height:100%; border-radius:2px; transition:width 0.5s ease; position:relative; }
.xp-fill::after { content:''; position:absolute; top:0; left:0; width:100%; height:100%; background:linear-gradient(90deg,transparent,rgba(255,255,255,0.3),transparent); animation:shimmer 2s infinite; transform:translateX(-100%); }
@keyframes shimmer { 100%{transform:translateX(200%)} }
.xp-text { font-size:11px; color:var(--text3); }

/* Upgrade / User Menu */
.upgrade-btn { background:var(--gold); color:#0d0f14; border:none; padding:6px 16px; border-radius:8px; font-size:13px; font-weight:600; transition:opacity 0.15s; }
.upgrade-btn:hover { opacity:0.85; }
.pro-tag { font-size:10px; font-weight:700; background:linear-gradient(135deg,var(--gold),#e8c46a); color:#0d0f14; padding:2px 6px; border-radius:4px; letter-spacing:0.5px; }
.user-menu { position:relative; }
.user-menu-btn { display:flex; align-items:center; gap:8px; background:none; border:1px solid var(--border); border-radius:10px; padding:6px 12px; color:var(--text); font-size:13px; font-weight:500; transition:all 0.15s; }
.user-menu-btn:hover { border-color:var(--border2); background:var(--surface2); }
.user-dropdown { display:none; position:absolute; top:calc(100% + 6px); right:0; background:var(--surface2); border:1px solid var(--border2); border-radius:10px; min-width:200px; z-index:50; overflow:hidden; }
.user-menu.open .user-dropdown { display:block; }
.user-dropdown button { display:block; width:100%; text-align:left; padding:12px 16px; background:none; border:none; color:var(--text2); font-size:13px; transition:all 0.1s; }
.user-dropdown button:hover { background:var(--surface3); color:var(--text); }

/* ========== MAIN CONTENT ========== */
.app-main { max-width:1200px; margin:0 auto; padding:72px 24px 64px; }
.month-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 20px; }
.month-nav h2 { font-size:20px; }
.mn-btn { background:var(--surface2); border:1px solid var(--border); color:var(--text2); width:36px; height:36px; border-radius:8px; font-size:16px; display:flex; align-items:center; justify-content:center; transition:all 0.15s; }
.mn-btn:hover { background:var(--surface3); color:var(--text); }

/* Summary Cards */
.summary-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:var(--gap-card); margin-bottom:var(--gap-section); }
.summary-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:18px 20px; position:relative; overflow:hidden; transition:transform 0.2s, border-color 0.2s; animation:fadeInUp 0.4s ease both; }
.summary-card:hover { border-color:var(--border2); transform:translateY(-2px); }
.summary-card:nth-child(1) { animation-delay:0s; }
.summary-card:nth-child(2) { animation-delay:0.06s; }
.summary-card:nth-child(3) { animation-delay:0.12s; }
.summary-card:nth-child(4) { animation-delay:0.18s; }
.summary-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; }
.summary-card.income::before { background:var(--c-income); }
.summary-card.expense::before { background:var(--c-expense); }
.summary-card.invest::before { background:var(--c-invest); }
.summary-card.net::before { background:var(--gold); }
.sc-label { font-size:12px; color:var(--text3); text-transform:uppercase; letter-spacing:0.8px; font-weight:600; margin-bottom:6px; }
.sc-value { font-family:var(--font-mono); font-size:24px; font-weight:700; margin-bottom:4px; font-variant-numeric:tabular-nums; }
.sc-trend { font-size:12px; font-weight:500; }
.sc-trend.up { color:var(--c-income); }
.sc-trend.down { color:var(--c-expense); }
.sc-trend.neutral { color:var(--text3); }

/* Action Bar */
.action-bar { display:flex; gap:10px; margin-bottom:20px; padding:2px 0; flex-wrap:wrap; justify-content:space-between; align-items:center; }
.action-group { display:flex; gap:10px; flex-wrap:wrap; }
.act-btn { padding:10px 20px; border-radius:10px; font-size:13px; font-weight:600; border:1px solid var(--border); background:var(--surface); color:var(--text); transition:all 0.15s; display:flex; align-items:center; gap:6px; }
.act-btn:hover { background:var(--surface2); border-color:var(--border2); transform:translateY(-1px); }
.act-btn.primary { background:var(--gold); color:#0d0f14; border-color:var(--gold); }
.act-btn.primary:hover { opacity:0.85; transform:none; }
.act-btn.pro { border-color:rgba(251,191,36,0.4); background:linear-gradient(135deg,rgba(251,191,36,0.1),rgba(251,191,36,0.05)); }
.act-btn.pro:hover { border-color:rgba(251,191,36,0.6); background:linear-gradient(135deg,rgba(251,191,36,0.2),rgba(251,191,36,0.1)); }
.act-btn.roast { background:linear-gradient(135deg,#f87171,#fbbf24); color:#0d0f14; border:none; }
.act-btn.roast:hover { opacity:0.85; transform:none; }
.act-btn.search-btn { margin-left:auto; }
.act-btn .pro-badge { font-size:9px; font-weight:700; background:linear-gradient(135deg,var(--gold),#e8c46a); color:#0d0f14; padding:1px 5px; border-radius:3px; }

/* Charts */
.charts-row { display:grid; grid-template-columns:1fr 1.5fr; gap:var(--gap-card); margin-bottom:var(--gap-section); }
.chart-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; animation:fadeInUp 0.4s ease both; }
.chart-card:nth-child(1) { animation-delay:0.06s; }
.chart-card:nth-child(2) { animation-delay:0.12s; }
.chart-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.chart-header h3 { font-size:16px; }
.chart-toggle { display:flex; gap:4px; background:var(--surface2); border-radius:8px; padding:2px; }
.chart-toggle button { padding:4px 10px; border-radius:6px; font-size:11px; font-weight:600; background:none; border:none; color:var(--text3); transition:all 0.15s; }
.chart-toggle button.active { background:var(--surface3); color:var(--text); }
.chart-wrap { position:relative; }

/* Transactions */
.txn-section { margin-bottom:20px; }
.txn-header { display:flex; justify-content:space-between; align-items:center; padding:14px 20px; background:var(--surface); border:1px solid var(--border); border-radius:12px; cursor:pointer; user-select:none; transition:all 0.15s; }
.txn-section.open .txn-header { border-radius:12px 12px 0 0; }
.txn-header:hover { background:var(--surface2); }
.txn-header h3 { font-size:15px; display:flex; align-items:center; gap:8px; }
.txn-header .total { font-family:var(--font-mono); font-size:16px; font-weight:700; font-variant-numeric:tabular-nums; }
.txn-chevron { color:var(--text3); font-size:14px; transition:transform 0.3s; }
.txn-section.open .txn-chevron { transform:rotate(180deg); }
.txn-body { display:grid; grid-template-rows:0fr; overflow:hidden; transition:grid-template-rows 0.3s ease; border:1px solid var(--border); border-top:none; border-radius:0 0 12px 12px; }
.txn-section:not(.open) .txn-body { border-color:transparent; }
.txn-section.open .txn-body { grid-template-rows:1fr; }
.txn-body-inner { min-height:0; overflow:hidden; }
.txn-table { width:100%; border-collapse:collapse; }
.txn-table th { text-align:left; padding:12px 16px; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--text3); background:var(--surface); border-bottom:1px solid var(--border); }
.txn-table td { padding:14px 16px; font-size:13px; border-bottom:1px solid var(--border); background:var(--surface); }
.txn-table tr:last-child td { border-bottom:none; }
.txn-table tr:hover td { background:var(--surface2); }
.txn-amount { font-family:var(--font-mono); font-weight:700; font-size:14px; font-variant-numeric:tabular-nums; }
.txn-amount.income { color:var(--c-income); }
.txn-amount.expense { color:var(--c-expense); }
.txn-amount.invest { color:var(--c-invest); }
.subcat-chip { display:inline-flex; align-items:center; gap:4px; padding:4px 10px; border-radius:20px; font-size:12px; font-weight:600; white-space:nowrap; }
.recurring-icon { color:var(--gold); font-size:12px; }
.txn-actions { display:flex; gap:4px; }
.txn-act { width:28px; height:28px; border-radius:6px; background:var(--surface2); border:1px solid var(--border); color:var(--text3); font-size:12px; display:flex; align-items:center; justify-content:center; transition:all 0.1s; }
.txn-act:hover { color:var(--text); background:var(--surface3); }
.txn-empty { padding:32px; text-align:center; color:var(--text3); font-size:13px; background:var(--surface); }
.cat-pills { display:flex; flex-wrap:wrap; gap:8px; }
.cat-pill { padding:8px 14px; border-radius:20px; font-size:13px; font-weight:600; border:1px solid var(--border); background:var(--surface2); color:var(--text2); cursor:pointer; transition:all 0.15s; display:inline-flex; align-items:center; gap:6px; }
.cat-pill:hover { border-color:var(--border2); background:var(--surface3); }
.cat-pill.active { border-color:currentColor; color:var(--text); }

/* Scrollbar for txn-body horizontal overflow */
.txn-body-inner::-webkit-scrollbar { height:6px; }
.txn-body-inner::-webkit-scrollbar-track { background:var(--surface); border-radius:3px; }
.txn-body-inner::-webkit-scrollbar-thumb { background:var(--surface3); border-radius:3px; }
.txn-body-inner::-webkit-scrollbar-thumb:hover { background:var(--text3); }

/* Unified Transaction Tabs + Scroll */
.txn-tabs { display:flex; gap:6px; padding:12px 16px 8px; background:var(--surface); }
.txn-tab { padding:5px 14px; border-radius:20px; font-size:12px; font-weight:600; background:var(--surface2); border:1px solid var(--border); color:var(--text3); transition:all 0.15s; cursor:pointer; }
.txn-tab:hover { border-color:var(--border2); color:var(--text); }
.txn-tab.active { border-color:var(--gold); color:var(--gold); background:rgba(212,168,67,0.08); }
.txn-tab .total { font-family:var(--font-mono); font-size:11px; font-variant-numeric:tabular-nums; }
.txn-scroll { max-height:400px; overflow-y:auto; }
.txn-scroll::-webkit-scrollbar { width:6px; }
.txn-scroll::-webkit-scrollbar-track { background:var(--surface); }
.txn-scroll::-webkit-scrollbar-thumb { background:var(--surface3); border-radius:3px; }
.txn-scroll::-webkit-scrollbar-thumb:hover { background:var(--text3); }

/* Notes Dropdown in Month Nav */
.mn-right { display:flex; align-items:center; gap:8px; }
.mn-note-btn { position:relative; font-size:14px; }
.mn-note-btn.has-notes::after { content:''; position:absolute; top:4px; right:4px; width:6px; height:6px; border-radius:50%; background:var(--gold); }
.month-notes-drop { background:var(--surface); border:1px solid var(--border); border-radius:0 0 12px 12px; padding:12px 16px; margin-top:-1px; margin-bottom:16px; animation:fadeInUp 0.15s ease; }

/* Ad Banner */
.ad-banner { margin:16px 0; }
.ad-banner-inner { display:flex; align-items:center; gap:12px; padding:12px 20px; background:var(--surface); border:1px solid var(--border); border-radius:10px; font-size:13px; color:var(--text2); }
.ad-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:var(--text3); background:var(--surface3); padding:2px 8px; border-radius:4px; flex-shrink:0; }
.ad-text { flex:1; }

/* Budget */
.budget-section { margin-bottom:var(--gap-section); }
.budget-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; }
.budget-card h3 { font-size:16px; margin-bottom:16px; }
.budget-row { display:flex; align-items:center; gap:14px; margin-bottom:14px; }
.budget-row:last-child { margin-bottom:0; }
.budget-label { font-size:13px; color:var(--text2); min-width:100px; }
.budget-bar-wrap { flex:1; height:8px; border-radius:4px; background:var(--surface3); overflow:hidden; }
.budget-bar { height:100%; border-radius:4px; transition:width 0.5s ease, background 0.3s; }
.budget-bar.green { background:var(--c-income); }
.budget-bar.yellow { background:var(--c-dining); }
.budget-bar.red { background:var(--danger); }
.budget-val { font-family:var(--font-mono); font-size:12px; color:var(--text3); min-width:110px; text-align:right; font-variant-numeric:tabular-nums; }
.budget-limit-input { width:80px; padding:4px 8px; border-radius:6px; background:var(--surface2); border:1px solid var(--border); color:var(--text); font-size:13px; text-align:right; }

/* Net Worth (used inside Wealth section) */
.nw-cols { display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:20px; }
.nw-col h4 { font-size:13px; color:var(--text3); text-transform:uppercase; letter-spacing:1px; margin-bottom:12px; }
.nw-item { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border); }
.nw-item-name { font-size:13px; }
.nw-item-bal { font-family:var(--font-mono); font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; }
.nw-add-btn { font-size:12px; color:var(--gold); background:none; border:none; padding:4px 0; }
.nw-snapshot-btn { padding:10px 20px; border-radius:10px; background:var(--surface2); border:1px solid var(--border); color:var(--text); font-size:13px; font-weight:600; transition:all 0.15s; }
.nw-snapshot-btn:hover { background:var(--surface3); }

/* Goals (used inside Wealth section) */
.goals-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:16px; }
.goal-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; transition:transform 0.2s, border-color 0.2s; }
.goal-card:hover { border-color:var(--border2); transform:translateY(-2px); }
.goal-icon { font-size:28px; margin-bottom:8px; }
.goal-name { font-size:15px; font-weight:600; margin-bottom:4px; }
.goal-progress-bar { height:8px; border-radius:4px; background:var(--surface3); overflow:hidden; margin:10px 0 6px; }
.goal-progress-fill { height:100%; border-radius:4px; background:var(--gold); transition:width 0.5s; }
.goal-meta { font-size:12px; color:var(--text3); display:flex; justify-content:space-between; }
.goal-actions { display:flex; gap:4px; margin-top:10px; }
.add-goal-btn { background:var(--surface); border:2px dashed var(--border2); border-radius:16px; padding:20px; display:flex; align-items:center; justify-content:center; gap:8px; color:var(--text3); font-size:14px; font-weight:500; transition:all 0.15s; min-height:160px; }
.add-goal-btn:hover { border-color:var(--gold); color:var(--gold); }

/* Wealth Section (Goals + Net Worth combined) */
.wealth-section { margin-bottom:var(--gap-section); }
.wealth-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; overflow:hidden; }
.wealth-header { padding:18px 24px 12px; display:flex; justify-content:space-between; align-items:center; }
.wealth-header h3 { font-size:16px; }
.wealth-summary { font-family:var(--font-mono); font-size:13px; color:var(--text2); }
.wealth-tabs { display:flex; gap:4px; padding:0 24px 16px; }
.wealth-tab { padding:5px 14px; border-radius:20px; font-size:12px; font-weight:600; background:var(--surface2); border:1px solid var(--border); color:var(--text3); cursor:pointer; transition:all 0.15s; }
.wealth-tab:hover { border-color:var(--border2); color:var(--text); }
.wealth-tab.active { background:var(--surface3); color:var(--text); border-color:var(--border2); }
.wealth-content { padding:0 24px 24px; }

/* Year Table (inline in charts) */
.year-inline { padding:8px 0; }
.year-inline .year-nav { display:flex; justify-content:center; align-items:center; gap:8px; margin-bottom:12px; }
.year-table-wrap { overflow-x:auto; }
.year-table { width:100%; border-collapse:collapse; font-size:12px; }
.year-table th { padding:10px 14px; text-align:right; font-size:10px; text-transform:uppercase; letter-spacing:0.5px; color:var(--text3); background:var(--surface); border-bottom:1px solid var(--border); }
.year-table th:first-child { text-align:left; }
.year-table td { padding:10px 14px; text-align:right; border-bottom:1px solid var(--border); color:var(--text2); font-family:var(--font-mono); font-variant-numeric:tabular-nums; }
.year-table td:first-child { text-align:left; font-weight:600; color:var(--text); font-family:inherit; }
.year-table tr.current td { background:rgba(212,168,67,0.05); }
.year-table tfoot td { font-weight:700; color:var(--text); background:var(--surface2); }

/* Notes */
.notes-textarea { width:100%; min-height:80px; padding:12px; border-radius:10px; background:var(--surface2); border:1px solid var(--border); color:var(--text); font-size:14px; line-height:1.6; resize:vertical; }
.notes-textarea:focus { outline:none; border-color:var(--gold); }

/* Data Mgmt */
.data-section { margin-bottom:48px; }
.data-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; }
.data-card h3 { font-size:16px; margin-bottom:16px; }
.data-btns { display:flex; gap:10px; flex-wrap:wrap; }
.data-btn { padding:8px 16px; border-radius:8px; font-size:13px; font-weight:500; background:var(--surface2); border:1px solid var(--border); color:var(--text2); transition:all 0.15s; }
.data-btn:hover { background:var(--surface3); color:var(--text); }
.data-btn.danger { border-color:rgba(248,113,113,0.3); color:var(--danger); }
.data-btn.danger:hover { background:rgba(248,113,113,0.1); }
.sec-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.sec-header h3 { font-size:18px; display:flex; align-items:center; gap:8px; }

/* ========== MODALS ========== */
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.6); backdrop-filter:blur(8px); z-index:200; align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; animation:overlayIn 0.2s ease; }
.modal { display:none; background:var(--surface); border:1px solid var(--border2); border-radius:16px; width:calc(100% - 48px); max-height:90vh; overflow-y:auto; position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); z-index:201; }
.modal.open { display:block; animation:modalIn 0.2s ease both; }
.modal-sm { max-width:440px; }
.modal-md { max-width:600px; }
.modal-lg { max-width:800px; }
.modal-head { display:flex; justify-content:space-between; align-items:center; padding:20px 24px; border-bottom:1px solid var(--border); }
.modal-head h3 { font-size:18px; }
.modal-close { width:32px; height:32px; border-radius:8px; background:var(--surface2); border:1px solid var(--border); color:var(--text3); font-size:16px; display:flex; align-items:center; justify-content:center; transition:all 0.1s; }
.modal-close:hover { color:var(--text); background:var(--surface3); }
.modal-body { padding:24px; }
.modal-foot { padding:16px 24px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; }

/* Forms */
.form-group { margin-bottom:16px; }
.form-label { display:block; font-size:12px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
.form-input, .form-select { width:100%; padding:10px 14px; border-radius:10px; background:var(--surface2); border:1px solid var(--border); color:var(--text); font-size:14px; transition:border-color 0.15s; }
.form-input:focus, .form-select:focus { outline:none; border-color:var(--gold); }
.form-select { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ba3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:32px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-check { display:flex; align-items:center; gap:8px; }
.form-check input[type="checkbox"] { width:16px; height:16px; accent-color:var(--gold); }
.form-check label { font-size:13px; color:var(--text2); }
.btn { padding:10px 20px; border-radius:10px; font-size:14px; font-weight:600; border:none; transition:all 0.15s; }
.btn-gold { background:var(--gold); color:#0d0f14; }
.btn-gold:hover { opacity:0.85; }
.btn-outline { background:none; border:1px solid var(--border); color:var(--text2); }
.btn-outline:hover { background:var(--surface2); color:var(--text); }
.btn-danger { background:rgba(248,113,113,0.1); border:1px solid rgba(248,113,113,0.3); color:var(--danger); }
.btn-danger:hover { background:rgba(248,113,113,0.2); }

/* Search */
.search-input-wrap { position:relative; margin-bottom:16px; }
.search-input { padding-left:36px !important; }
.search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text3); font-size:14px; pointer-events:none; }
.search-results { max-height:400px; overflow-y:auto; }
.search-result { padding:12px 16px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.1s; display:flex; justify-content:space-between; align-items:center; }
.search-result:hover { background:var(--surface2); }
.sr-name { font-size:14px; font-weight:500; }
.sr-meta { font-size:12px; color:var(--text3); }
.sr-amount { font-family:var(--font-mono); font-size:14px; font-weight:600; font-variant-numeric:tabular-nums; }

/* Upgrade Modal */
.upgrade-plans { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.upgrade-plan { border:1px solid var(--border); border-radius:12px; padding:20px; text-align:center; }
.upgrade-plan.current { border-color:var(--text3); }
.upgrade-plan.pro { border-color:var(--gold); background:rgba(212,168,67,0.03); }
.up-tier { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:1px; color:var(--text3); margin-bottom:6px; }
.up-price { font-family:var(--font-mono); font-size:32px; font-weight:700; font-variant-numeric:tabular-nums; }
.up-price span { font-size:14px; font-weight:400; color:var(--text2); }
.up-features { list-style:none; text-align:left; margin:16px 0; }
.up-features li { font-size:13px; color:var(--text2); padding:6px 0; display:flex; align-items:center; gap:8px; }
.up-features li::before { content:'\2713'; color:var(--c-income); font-weight:700; }
.up-cta { display:flex; flex-direction:column; gap:8px; }
.up-cta .btn { width:100%; text-align:center; }

/* AI Import */
.import-steps { display:flex; gap:8px; margin-bottom:24px; }
.import-step { flex:1; text-align:center; padding:8px; border-radius:8px; font-size:12px; font-weight:600; color:var(--text3); background:var(--surface2); }
.import-step.active { background:var(--gold); color:#0d0f14; }
.import-step.done { background:var(--c-income); color:#0d0f14; }
.upload-zone { border:2px dashed var(--border2); border-radius:12px; padding:48px 24px; text-align:center; cursor:pointer; transition:all 0.15s; }
.upload-zone:hover { border-color:var(--gold); }
.upload-zone.dragover { border-color:var(--gold); background:rgba(212,168,67,0.03); }
.upload-zone p { color:var(--text3); font-size:14px; margin-top:8px; }
.upload-zone .hint { font-size:12px; color:var(--text3); margin-top:4px; }
.import-loading { text-align:center; padding:40px; }
.import-spinner { width:40px; height:40px; border:3px solid var(--surface3); border-top-color:var(--gold); border-radius:50%; animation:spin 0.8s linear infinite; margin:0 auto 16px; }
@keyframes spin { to{transform:rotate(360deg)} }
.import-msg { color:var(--text2); font-size:14px; }
.import-review-table { width:100%; border-collapse:collapse; font-size:13px; }
.import-review-table th { text-align:left; padding:8px 10px; font-size:11px; color:var(--text3); text-transform:uppercase; background:var(--surface2); }
.import-review-table td { padding:8px 10px; border-bottom:1px solid var(--border); }
.import-review-table .form-select { padding:4px 8px; font-size:12px; }

/* Roast */
.roast-modal-inner { display:flex; flex-direction:column; align-items:center; padding:24px; }
.roast-card { width:360px; max-width:100%; background:var(--bg); border:1px solid var(--border2); border-radius:16px; padding:40px 28px; text-align:center; box-shadow:0 0 60px rgba(212,168,67,0.08), 0 0 120px rgba(212,168,67,0.04); }
.roast-brand { font-size:12px; color:var(--text3); margin-bottom:20px; display:flex; align-items:center; justify-content:center; gap:6px; }
.roast-level { display:inline-flex; align-items:center; gap:6px; padding:6px 16px; border-radius:20px; font-size:13px; font-weight:700; margin-bottom:20px; }
.roast-divider { width:80%; height:1px; background:var(--border); margin:0 auto 20px; }
.roast-text { font-size:17px; line-height:1.8; color:var(--text); font-weight:500; padding:0 8px; }
.roast-stats { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-top:20px; }
.roast-stat { padding:4px 12px; border-radius:6px; font-size:11px; font-weight:600; }
.roast-url { font-size:11px; color:var(--text3); margin-top:20px; }
.roast-share-btns { display:flex; gap:10px; margin-top:20px; width:360px; max-width:100%; }
.roast-share-btns .btn { flex:1; text-align:center; }
.roast-loading { text-align:center; padding:40px 28px; }
.roast-loading .fire { font-size:48px; animation:bounce 0.6s infinite alternate; }
@keyframes bounce { to{transform:translateY(-8px)} }
.roast-loading-msg { color:var(--text2); font-size:14px; margin-top:16px; }

/* ========== TOASTS ========== */
#toast-container { position:fixed; bottom:24px; right:24px; z-index:300; display:flex; flex-direction:column; gap:8px; }
.toast { padding:12px 20px; border-radius:10px; font-size:13px; font-weight:500; background:var(--surface2); border:1px solid var(--border2); color:var(--text); animation:toastIn 0.3s ease; min-width:240px; max-width:360px; display:flex; align-items:center; gap:8px; }
.toast.success { border-left:3px solid var(--c-income); }
.toast.error { border-left:3px solid var(--danger); }
.toast.levelup { border-left:3px solid var(--gold); background:linear-gradient(135deg,var(--surface2),rgba(212,168,67,0.05)); }
@keyframes toastIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes toastOut { from{opacity:1} to{opacity:0;transform:translateY(10px)} }
.toast.leaving { animation:toastOut 0.3s ease forwards; }

/* ========== PROFILE BUTTON & MODAL ========== */
.profile-btn { width:36px; height:36px; border-radius:50%; border:1px solid var(--border); background:var(--surface2); display:flex; align-items:center; justify-content:center; padding:0; overflow:hidden; cursor:pointer; transition:all 0.15s; flex-shrink:0; }
.profile-btn:hover { border-color:var(--border2); background:var(--surface3); }
.profile-avatar { width:100%; height:100%; border-radius:50%; object-fit:cover; display:none; }
.profile-initials { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:var(--text2); background:var(--surface3); border-radius:50%; user-select:none; }
.profile-section { padding:16px 0; border-bottom:1px solid var(--border); }
.profile-section:first-child { padding-top:0; }
.profile-section:last-child { border-bottom:none; padding-bottom:0; }
.profile-section h4 { font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--text3); margin-bottom:10px; font-weight:600; }
.profile-account { display:flex; align-items:center; gap:16px; }
.profile-account-avatar { width:48px; height:48px; border-radius:50%; object-fit:cover; border:2px solid var(--border); flex-shrink:0; }
.profile-account-initial { width:48px; height:48px; border-radius:50%; background:var(--surface3); border:2px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:700; color:var(--text2); flex-shrink:0; }
.profile-account .profile-name { font-size:16px; font-weight:600; color:var(--text); }
.profile-account .profile-email { font-size:13px; color:var(--text2); word-break:break-all; }
.profile-plan-badge { display:inline-block; padding:4px 12px; border-radius:6px; font-size:12px; font-weight:700; letter-spacing:0.5px; }
.profile-plan-badge.free { background:var(--surface3); color:var(--text2); }
.profile-plan-badge.pro { background:linear-gradient(135deg,var(--gold),#e8c46a); color:#0d0f14; }
.profile-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.profile-stat { text-align:center; padding:12px 8px; background:var(--surface2); border-radius:10px; border:1px solid var(--border); }
.profile-stat .ps-value { font-family:var(--font-mono); font-size:20px; font-weight:700; color:var(--text); }
.profile-stat .ps-label { font-size:11px; color:var(--text3); margin-top:2px; }
.profile-referral-code { display:flex; gap:8px; }
.profile-referral-code input { flex:1; font-size:12px; }
.profile-referral-count { font-size:13px; color:var(--text2); margin-top:8px; }
.profile-danger { background:rgba(248,113,113,0.05); border:1px solid rgba(248,113,113,0.15); border-radius:10px; padding:16px; }
.profile-danger p { font-size:12px; color:var(--text3); margin-bottom:12px; line-height:1.5; }
.profile-danger .btn-danger { width:100%; height:40px; border-radius:8px; border:1px solid var(--danger); background:transparent; color:var(--danger); font-weight:600; font-size:13px; cursor:pointer; transition:all 0.15s; }
.profile-danger .btn-danger:hover { background:var(--danger); color:#0d0f14; }
.profile-actions { display:flex; gap:10px; }
.profile-actions .btn { height:40px; border-radius:8px; font-weight:600; font-size:13px; cursor:pointer; transition:all 0.15s; display:flex; align-items:center; justify-content:center; gap:6px; }
.profile-actions .btn-outline { background:transparent; border:1px solid var(--border2); color:var(--text2); }
.profile-actions .btn-outline:hover { background:var(--surface2); color:var(--text); border-color:var(--text3); }
.profile-signout-btn { color:var(--danger) !important; border-color:rgba(248,113,113,0.3) !important; }
.profile-signout-btn:hover { background:rgba(248,113,113,0.08) !important; color:var(--danger) !important; }

/* ========== PRINT ========== */
@media print {
  #login-screen,.app-header,.modal-overlay,.modal,#toast-container,.action-bar,.txn-actions,.data-section,.act-btn,.mn-btn,button,.roast-share-btns,.month-notes-drop { display:none !important; }
  body { background:white !important; color:black !important; }
  .app-main { padding:0 !important; }
  .summary-card,.chart-card,.txn-section,.budget-card,.wealth-card,.goal-card { background:white !important; border:1px solid #ddd !important; color:black !important; break-inside:avoid; }
  .summary-card::before { display:none; }
  .sc-value,.sc-label,.txn-header h3,.txn-header .total,.chart-header h3,td,th,h3,h4 { color:black !important; }
  .txn-body { display:block !important; grid-template-rows:1fr !important; }
}

/* ========== UPCOMING BILLS STRIP ========== */
.bills-strip { display:flex; align-items:center; gap:12px; overflow-x:auto; scrollbar-width:none; margin-bottom:22px; padding:2px 0; scroll-snap-type:x mandatory; }
.bills-strip::-webkit-scrollbar { display:none; }
.bills-strip-label { font-size:11px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:0.5px; white-space:nowrap; min-width:70px; }
.bill-card { min-width:150px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 14px; flex-shrink:0; scroll-snap-align:start; transition:all 0.15s; }
.bill-card:hover { border-color:var(--border2); transform:translateY(-1px); }
.bill-card-soon { border-color:var(--gold); }
.bill-card-top { display:flex; align-items:center; gap:6px; margin-bottom:4px; }
.bill-emoji { font-size:14px; }
.bill-card-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bill-card-amount { font-family:var(--font-mono); font-size:14px; font-weight:700; font-variant-numeric:tabular-nums; }
.bill-card-date { font-size:11px; color:var(--text3); margin-top:2px; }

/* ========== CHART FILTER BADGE ========== */
.chart-filter-badge { display:flex; align-items:center; gap:6px; margin-left:8px; }
.chart-filter-badge span { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; }
.filter-reset-btn { background:var(--surface2); border:1px solid var(--border); color:var(--text3); width:24px; height:24px; border-radius:6px; font-size:14px; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:all 0.1s; }
.filter-reset-btn:hover { color:var(--text); background:var(--surface3); }
.compare-btn { padding:4px 10px; font-size:11px; font-weight:600; border-radius:6px; background:none; border:none; color:var(--text3); cursor:pointer; transition:all 0.15s; margin-left:4px; }
.compare-btn.active { background:var(--surface3); color:var(--gold); }
.compare-btn:hover { color:var(--text); }

/* ========== BUDGET PROFILE SELECTOR ========== */
.budget-profile-selector { display:flex; align-items:center; gap:8px; margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid var(--border); }
.budget-profile-select { flex:1; max-width:240px; }
.budget-row { display:flex; align-items:center; gap:14px; margin-bottom:14px; position:relative; }
.budget-row:last-child { margin-bottom:0; }
.whatif-btn { background:none; border:1px solid var(--border); color:var(--text3); width:26px; height:26px; border-radius:6px; font-size:13px; display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; transition:all 0.15s; }
.whatif-btn:hover { border-color:var(--gold); color:var(--gold); }

/* ========== WHAT-IF PANEL ========== */
.whatif-panel { background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:14px 16px; margin:-4px 0 12px 0; animation:whatifIn 0.2s ease; }
@keyframes whatifIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.whatif-inner { display:flex; flex-direction:column; gap:8px; }
.whatif-label { font-size:12px; color:var(--text2); font-weight:500; }
.whatif-label .whatif-pct-val { color:var(--gold); font-weight:700; }
.whatif-slider { width:100%; accent-color:var(--gold); height:6px; cursor:pointer; }
.whatif-result { font-size:13px; color:var(--text2); }
.whatif-result strong { color:var(--gold); }

/* ========== INCOME ALLOCATION ========== */
.allocation-section { margin-bottom:var(--gap-section); }
.allocation-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; }
.alloc-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.alloc-header h3 { font-size:16px; }
.alloc-bars { margin-bottom:16px; }
.alloc-bar-label { font-size:11px; color:var(--text3); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; margin-bottom:4px; }
.alloc-bar { display:flex; height:12px; border-radius:6px; overflow:hidden; gap:2px; margin-bottom:10px; }
.alloc-seg { border-radius:4px; min-width:4px; transition:flex 0.5s ease; }
.alloc-grid { font-size:13px; }
.alloc-row { display:grid; grid-template-columns:16px 1fr 80px 80px 80px; gap:8px; align-items:center; padding:6px 0; border-bottom:1px solid var(--border); }
.alloc-row:last-child { border-bottom:none; }
.alloc-row-head { font-size:11px; color:var(--text3); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; border-bottom:1px solid var(--border); padding-bottom:8px; }
.alloc-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.alloc-name { font-weight:500; }
.alloc-planned, .alloc-actual { font-family:var(--font-mono); font-variant-numeric:tabular-nums; text-align:right; font-size:12px; }
.alloc-under { color:var(--c-income); font-family:var(--font-mono); font-variant-numeric:tabular-nums; text-align:right; font-size:12px; font-weight:600; }
.alloc-over { color:var(--c-expense); font-family:var(--font-mono); font-variant-numeric:tabular-nums; text-align:right; font-size:12px; font-weight:600; }

/* Allocation modal */
.alloc-bucket { background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:14px; margin-bottom:12px; }
.alloc-cat-pills { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.alloc-cat-pills .cat-pill { font-size:11px; padding:5px 10px; }

/* ========== SPARKLINES ========== */
.sparkline { display:inline-block; vertical-align:middle; margin-left:6px; opacity:0.6; transition:opacity 0.15s; }
.sparkline:hover { opacity:1; }

/* ========== LAYOUT EDITOR ========== */
.layout-item { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-bottom:1px solid var(--border); transition:background 0.1s; }
.layout-item:last-child { border-bottom:none; }
.layout-item.layout-hidden { opacity:0.45; }
.layout-item-label { font-size:14px; font-weight:500; flex:1; }
.layout-item-controls { display:flex; align-items:center; gap:6px; }
.layout-toggle-wrap { position:relative; display:inline-block; width:36px; height:20px; }
.layout-toggle-wrap input { opacity:0; width:0; height:0; }
.layout-toggle-slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:var(--surface3); border-radius:10px; transition:background 0.2s; }
.layout-toggle-slider::before { content:''; position:absolute; height:14px; width:14px; left:3px; bottom:3px; background:var(--text3); border-radius:50%; transition:all 0.2s; }
.layout-toggle-wrap input:checked + .layout-toggle-slider { background:var(--gold); }
.layout-toggle-wrap input:checked + .layout-toggle-slider::before { transform:translateX(16px); background:#0d0f14; }
.layout-arrow { background:var(--surface2); border:1px solid var(--border); color:var(--text3); width:28px; height:28px; border-radius:6px; font-size:13px; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:all 0.1s; }
.layout-arrow:hover:not(:disabled) { color:var(--text); background:var(--surface3); }
.layout-arrow:disabled { opacity:0.3; cursor:not-allowed; }
.layout-hidden-section { display:none !important; }

/* ========== EMPTY PROMPT ========== */
.empty-prompt { text-align:center; padding:20px 16px; }
.empty-prompt p { font-size:13px; color:var(--text3); margin-bottom:12px; }

/* ========== ACCESSIBILITY ========== */
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; }
}

/* ========== RESPONSIVE ========== */
@media(max-width:1200px) { .summary-grid { grid-template-columns:repeat(2,1fr); } .alloc-row { grid-template-columns:16px 1fr 70px 70px 70px; } }
@media(max-width:900px) { :root { --gap-section:24px; } .charts-row { grid-template-columns:1fr; } .nw-cols { grid-template-columns:1fr; } .upgrade-plans { grid-template-columns:1fr; } .alloc-row { grid-template-columns:10px 1fr 65px 65px 65px; gap:6px; font-size:12px; } }
@media(max-width:768px) {
  :root { --gap-section:22px; }
  .app-header { padding:0 16px; height:54px; }
  .app-main { padding:66px 18px 40px; }
  .action-bar { flex-wrap:wrap; overflow-x:visible; padding-bottom:4px; }
  .action-group { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; padding-bottom:4px; flex:1; }
  .action-group::-webkit-scrollbar { display:none; }
  .act-btn { white-space:nowrap; flex-shrink:0; padding:10px 16px; font-size:12px; min-height:44px; }
  .act-btn.search-btn { margin-left:0; flex-shrink:0; }
  .act-btn .pro-badge { display:none; }
  .month-nav { padding:10px 16px; }
  .month-nav h2 { font-size:18px; }
  .summary-card { padding:16px 18px; }
  .sc-value { font-size:22px; }
  .chart-card { padding:16px; }
  .chart-header h3 { font-size:14px; }
  .txn-header { padding:12px 16px; }
  .txn-header h3 { font-size:14px; }
  .txn-table th { padding:8px 12px; font-size:10px; }
  .txn-table td { padding:10px 12px; font-size:12px; }
  .txn-act { min-width:44px; min-height:44px; font-size:14px; }
  .modal-head { padding:16px 20px; }
  .modal-body { padding:20px; }
  .modal-foot { padding:14px 20px; }
  .sec-header h3 { font-size:16px; }
  .cards-grid { grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); }
  .goals-grid { grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); }
  .txn-tabs { padding:10px 14px 6px; }
  .txn-tab { padding:4px 12px; font-size:11px; }
  .wealth-header { padding:16px 18px 10px; }
  .wealth-tabs { padding:0 18px 14px; }
  .wealth-content { padding:0 18px 18px; }
  .header-right { gap:8px; }
  .upgrade-btn { padding:5px 12px; font-size:12px; }
  .level-badge { font-size:11px; padding:3px 10px; }
}
@media(max-width:600px) {
  :root { --gap-section:18px; }
  .app-main { padding:62px 14px 36px; }
  .summary-grid { grid-template-columns:repeat(2,1fr); gap:12px; }
  .summary-card, .chart-card, .goal-card, .bank-card, .bill-card { animation-delay:0s !important; }
  .sc-value { font-size:20px; }
  .sc-label { font-size:11px; }
  .action-bar { gap:6px; }
  .action-group { gap:6px; }
  .act-btn { padding:8px 14px; font-size:12px; min-height:44px; }
  .modal { width:calc(100% - 16px); max-height:calc(100vh - 16px); border-radius:12px; }
  .modal-head { padding:14px 16px; }
  .modal-head h3 { font-size:16px; }
  .modal-body { padding:16px; }
  .modal-foot { padding:12px 16px; }
  .modal-foot .btn { min-height:44px; }
  .form-row { grid-template-columns:1fr; }
  .form-input, .form-select { padding:12px 14px; font-size:13px; min-height:44px; }
  .charts-row { gap:12px; }
  .chart-card { padding:12px; }
  .chart-header { margin-bottom:12px; }
  .month-nav h2 { font-size:16px; }
  .mn-btn { min-width:44px; min-height:44px; font-size:14px; }
  .cards-grid { grid-template-columns:1fr; }
  .goals-grid { grid-template-columns:1fr; }
  .nw-cols { gap:14px; }
  .txn-scroll { max-height:350px; }
  .txn-tab { font-size:11px; padding:4px 10px; }
  .wealth-header { padding:14px 16px 10px; }
  .wealth-tabs { padding:0 16px 12px; }
  .wealth-content { padding:0 16px 16px; }
  .bank-card { padding:16px; }
  .goal-card { padding:16px; }
  .roast-card { width:100%; }
  .roast-text { font-size:15px; }
  .txn-header { padding:10px 14px; }
  .txn-header h3 { font-size:13px; }
  .txn-header .total { font-size:14px; }
  .txn-body-inner { overflow-x:auto; }
  .txn-table { min-width:540px; }
  .txn-table th { padding:8px 10px; }
  .txn-table td { padding:12px 10px; font-size:12px; }
  .sec-header h3 { font-size:15px; }
  .cat-pill { padding:10px 14px; font-size:14px; }
  .bill-card { min-width:140px; padding:10px 12px; }
  .alloc-row { grid-template-columns:10px 1fr 60px 60px 60px; gap:4px; font-size:11px; }
  .alloc-header h3 { font-size:14px; }
  .allocation-card { padding:16px; }
  .whatif-btn { min-width:44px; min-height:44px; }
  .budget-profile-selector { flex-wrap:wrap; }
  .layout-arrow { min-width:44px; min-height:44px; }
}
@media(max-width:400px) {
  :root { --gap-section:14px; }
  .app-header { height:50px; padding:0 12px; }
  .app-main { padding:58px 10px 28px; }
  .summary-grid { grid-template-columns:1fr; gap:10px; }
  .summary-card, .chart-card, .goal-card, .bank-card, .bill-card { animation:none !important; }
  .summary-card { padding:12px 14px; }
  .sc-value { font-size:18px; }
  .sc-label { font-size:10px; letter-spacing:0.5px; }
  .month-nav { padding:8px 12px; border-radius:10px; }
  .month-nav h2 { font-size:15px; }
  .mn-btn { min-width:44px; min-height:44px; font-size:13px; }
  .action-bar { gap:4px; }
  .action-group { gap:4px; }
  .act-btn { padding:7px 10px; font-size:11px; border-radius:8px; }
  .modal { width:calc(100% - 12px); border-radius:10px; }
  .modal-head { padding:12px 14px; }
  .modal-head h3 { font-size:15px; }
  .modal-body { padding:14px; }
  .modal-foot { padding:10px 14px; }
  .chart-card { padding:10px; }
  .chart-header h3 { font-size:13px; }
  .level-badge { padding:2px 8px; font-size:10px; }
  .level-badge .lv-name { display:none; }
  .upgrade-btn { padding:4px 10px; font-size:11px; }
  .login-card { padding:32px 24px; }
  .login-logo { font-size:24px; }
  .sparkline { display:none; }
  .bill-card { min-width:130px; padding:8px 10px; border-radius:10px; }
  .bill-card-name { font-size:12px; }
  .bill-card-amount { font-size:12px; }
  .alloc-row { grid-template-columns:8px 1fr 55px 55px 55px; }
  .allocation-card { padding:14px; }
  .budget-profile-select { max-width:100%; }
  .chart-filter-badge { display:none; }
  .txn-scroll { max-height:300px; }
  .txn-tabs { gap:4px; padding:8px 10px 6px; }
  .txn-tab { padding:3px 8px; font-size:10px; }
  .wealth-header { padding:12px 14px 8px; }
  .wealth-header h3 { font-size:14px; }
  .wealth-tabs { padding:0 14px 10px; }
  .wealth-content { padding:0 14px 14px; }
}
