﻿:root {
  --bg: #0b1220;
  --bg-soft: #111a2e;
  --panel: #162238;
  --panel-2: #1b2942;
  --text: #e5eefc;
  --muted: #94a3b8;
  --border: rgba(148,163,184,0.14);
  --green: #34d399;
  --green-2: #10b981;
  --blue: #60a5fa;
  --danger: #f87171;
  --warn: #fbbf24;
  --shadow: 0 10px 30px rgba(0,0,0,0.25);
  --radius: 16px;
}
[data-theme="light"] {
  --bg: #f3f7fb;
  --bg-soft: #eaf1f8;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15,23,42,0.1);
  --shadow: 0 8px 24px rgba(15,23,42,0.08);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 270px; background: linear-gradient(180deg, #0f1a30 0%, #101d35 100%);
  border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
[data-theme="light"] .sidebar { background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%); }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 24px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--green), #22c55e); color: #052016; display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; }
.brand h1 { font-size: 1.25rem; margin: 0; line-height: 1; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: .2s;
}
.nav-link:hover { background: rgba(52,211,153,0.08); color: var(--text); }
.nav-link.active { background: rgba(52,211,153,0.14); color: var(--green); border-color: rgba(52,211,153,0.25); font-weight: 600; }
.nav-icon { width: 22px; text-align: center; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.month-picker-wrap label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.main-wrap { flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 20px 28px;
  background: rgba(11,18,32,0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
[data-theme="light"] .topbar { background: rgba(243,247,251,0.88); }
.topbar h2 { margin: 0; font-size: 1.55rem; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.income-chip { padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.income-chip span { display: block; font-size: .72rem; color: var(--muted); }
.income-chip strong { color: var(--green); font-size: .98rem; }
.mobile-menu-btn { display: none; }
.content { padding: 24px 28px 40px; }
.page-section { display: none; animation: fade .25s ease; }
.page-section.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 20px; }
.compact-stats { grid-template-columns: repeat(4, 1fr); }
.stat-card, .panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(52,211,153,0.12); display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.stat-card p { margin: 0; color: var(--muted); font-size: .8rem; }
.stat-card h3 { margin: 6px 0 0; font-size: 1.3rem; line-height: 1.2; word-break: break-word; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 20px; }
.align-start { align-items: start; }
.panel { padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.chart-wrap { position: relative; height: 300px; }
.chart-wrap.tall { height: 380px; }
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; transition: .2s; background: var(--panel-2); color: var(--text);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #052016; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: rgba(248,113,113,0.12); color: var(--danger); border-color: rgba(248,113,113,0.25); }
.btn-sm { padding: 6px 10px; font-size: .78rem; border-radius: 8px; }
.icon-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; font-size: 1.2rem; }
.full-width { width: 100%; }
.input {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
}
.input:focus { outline: 2px solid rgba(52,211,153,0.35); border-color: rgba(52,211,153,0.5); }
.input-sm { padding: 7px 8px; width: 120px; }
textarea.input { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.form-grid label .input, .form-grid label textarea, .form-grid label select { color: var(--text); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.compact { grid-template-columns: 1fr 120px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters .input { flex: 1; min-width: 150px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .88rem; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tr:hover td { background: rgba(52,211,153,0.03); }
.empty-cell, .empty-state { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty-state { border: 1px dashed var(--border); border-radius: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-main { font-weight: 500; color: var(--text); }
.amount-cell { font-weight: 700; color: var(--text); white-space: nowrap; }
.cat-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(96,165,250,0.08); border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.category-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; max-height: 360px; overflow: auto; padding-right: 2px; }
.category-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); }
.category-item-main { display: flex; gap: 10px; align-items: center; }
.cat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(52,211,153,0.12); font-size: 1rem; }
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 8px; background: rgba(148,163,184,0.18); border-radius: 999px; overflow: hidden; min-width: 90px; }
.progress-bar.large { height: 12px; margin: 14px 0; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .3s; }
.progress-fill.ok { background: linear-gradient(90deg, var(--green), #22c55e); }
.progress-fill.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.progress-fill.danger { background: linear-gradient(90deg, #fb7185, #ef4444); }
.badge { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge-ok { background: rgba(52,211,153,0.14); color: var(--green); }
.badge-warn { background: rgba(251,191,36,0.14); color: var(--warn); }
.badge-danger { background: rgba(248,113,113,0.14); color: var(--danger); }
.badge-muted { background: rgba(148,163,184,0.14); color: var(--muted); }
.text-danger { color: var(--danger) !important; }
.text-green { color: var(--green) !important; }
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); }
.alert-item.warn { border-color: rgba(251,191,36,0.25); }
.alert-item.danger { border-color: rgba(248,113,113,0.25); }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.alert-item.warn .alert-dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(251,191,36,0.15); }
.alert-item.danger .alert-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(248,113,113,0.15); }
.alert-body { flex: 1; }
.alert-body strong { display: block; font-size: .85rem; margin-bottom: 2px; }
.alert-body p { margin: 0; color: var(--muted); font-size: .85rem; }
.alert-pct { font-weight: 700; font-size: .9rem; }
.budget-summary, .report-cards, .whatif-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.mini-stat { padding: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; }
.mini-stat span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.mini-stat strong { font-size: 1.05rem; }
.advisor-hero { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: linear-gradient(135deg, rgba(52,211,153,0.12), rgba(96,165,250,0.08)); }
.advisor-hero h3 { margin: 0 0 6px; font-size: 1.3rem; }
.advisor-hero p { margin: 0; color: var(--muted); max-width: 700px; line-height: 1.5; }
.insights-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.insight-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.insight-card.insight-high { border-color: rgba(248,113,113,0.3); }
.insight-card.insight-medium { border-color: rgba(251,191,36,0.3); }
.insight-card.insight-low { border-color: rgba(52,211,153,0.2); }
.insight-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.insight-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--bg-soft); display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.insight-head h4 { margin: 0 0 6px; font-size: 1rem; }
.insight-body p { margin: 0 0 8px; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.insight-body p strong { color: var(--text); }
.insight-savings { color: var(--green) !important; padding-top: 4px; }
.goals-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.goal-card { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-soft); }
.goal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.goal-head h4 { margin: 0 0 4px; }
.goal-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.goal-stats span { display: block; margin-bottom: 2px; }
.goal-stats strong { font-size: .92rem; }
.whatif-summary { display: flex; justify-content: space-between; gap: 12px; padding: 14px; background: var(--bg-soft); border-radius: 12px; margin: 16px 0 12px; align-items: center; }
.whatif-summary strong { font-size: 1.1rem; }
.settings-actions { display: flex; gap: 12px; margin: 20px 0; flex-wrap: wrap; }
.note-box { padding: 16px; border-radius: 12px; background: rgba(52,211,153,0.08); border: 1px solid rgba(52,211,153,0.18); }
.note-box strong { display: block; margin-bottom: 6px; color: var(--green); }
.note-box p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.toast {
  position: fixed; right: 20px; bottom: 20px; padding: 12px 16px; background: #1f2937; color: #fff; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3); opacity: 0; transform: translateY(10px); transition: .25s; z-index: 100; max-width: min(420px, calc(100vw - 40px)); font-size: .9rem;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
.toast.info { background: #0f766e; }

@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .grid-2, .insights-grid, .goals-grid { grid-template-columns: 1fr; }
  .compact-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; height: 100vh; box-shadow: 20px 0 40px rgba(0,0,0,0.3); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 16px 18px; }
  .content { padding: 18px; }
  .topbar-actions .income-chip { display: none; }
}
@media (max-width: 720px) {
  .stats-grid, .compact-stats, .budget-summary, .report-cards, .whatif-grid, .goal-stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .topbar-actions { margin-left: 0; width: 100%; }
  .topbar-actions .btn { width: 100%; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .advisor-hero { flex-direction: column; align-items: stretch; }
  .chart-wrap { height: 260px; }
  .chart-wrap.tall { height: 300px; }
  .table th, .table td { padding: 10px 8px; font-size: .82rem; }
}
@media (max-width: 480px) {
  .stats-grid, .compact-stats, .budget-summary, .report-cards, .whatif-grid, .goal-stats { grid-template-columns: 1fr; }
  .brand h1 { font-size: 1.15rem; }
  .topbar h2 { font-size: 1.3rem; }
}
@media print {
  .sidebar, .topbar-actions, .mobile-menu-btn, .filters button, .form-actions, .row-actions, .settings-actions, #themeToggle { display: none !important; }
  .main-wrap, .content, .page-section { display: block !important; }
  body { background: #fff; color: #000; }
  .panel, .stat-card { box-shadow: none; border: 1px solid #ccc; }
}
