@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@400;500&family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --purple: #7c3aed;
  --sidebar-w: 240px;
  --topbar-h: 62px;
  --bg: #f6f5f0;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.07);
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #1a1a1a;
  --accent-hover: #333;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { font-family: 'Outfit', sans-serif; cursor: pointer; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* APP SHELL */
.app-shell { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; height: 100vh;
  z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 34px; height: 34px; background: #fff; color: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: 'DM Serif Display', serif; font-size: 18px; font-weight: bold; flex-shrink: 0; }
.logo-name { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }
.logo-sub { font-size: 10px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.8px; }
.sidebar-close { background: none; border: none; color: rgba(255,255,255,0.4); font-size: 16px; display: none; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 400; color: rgba(255,255,255,0.6); transition: all 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 500; }
.nav-item svg { flex-shrink: 0; opacity: 0.8; }

.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-balance-card { background: rgba(255,255,255,0.07); border-radius: 10px; padding: 14px; }
.sb-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.4); margin-bottom: 4px; }
.sb-amount { font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 500; color: #fff; }
.sb-meta { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 2px; }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* TOPBAR */
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.menu-btn { background: none; border: none; color: var(--muted); padding: 4px; display: none; }
.page-title { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: 12px; color: var(--muted); }
.add-btn { display: flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.add-btn:hover { background: var(--accent-hover); }

/* PAGE BODY */
.page-body { padding: 1.5rem; max-width: 1100px; display: flex; flex-direction: column; gap: 1.25rem; }

/* KPI CARDS */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.kpi-card { background: var(--surface); border-radius: 12px; padding: 1.25rem; display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--border); }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-income .kpi-icon { background: #dcfce7; color: #16a34a; }
.kpi-expense .kpi-icon { background: #ffedd5; color: #ea580c; }
.kpi-net .kpi-icon { background: #dbeafe; color: #2563eb; }
.kpi-txn .kpi-icon { background: #f3e8ff; color: #7c3aed; }
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.kpi-value { font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 500; letter-spacing: -0.5px; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* CHARTS */
.charts-row { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; }
.chart-card { background: var(--surface); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border); }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.chart-title { font-size: 14px; font-weight: 600; }
.chart-legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; }
.leg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.chart-wrap { position: relative; height: 220px; }

/* SECTION CARDS */
.section-card { background: var(--surface); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-size: 14px; font-weight: 600; }
.view-all { font-size: 12px; color: var(--muted); transition: color 0.15s; }
.view-all:hover { color: var(--text); }

/* TRANSACTION ROWS */
.tx-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tx-row:last-child { border-bottom: none; }
.tx-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tx-dot.income { background: var(--green); }
.tx-dot.expense { background: var(--red); }
.tx-info { flex: 1; }
.tx-desc { font-size: 13px; font-weight: 500; }
.tx-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tx-cat { background: #f3f4f6; padding: 1px 7px; border-radius: 20px; }
.tx-amt { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; }
.tx-amt.income { color: var(--green); }
.tx-amt.expense { color: var(--red); }

/* BUDGET MINI */
.budget-mini { padding: 10px 0; border-bottom: 1px solid var(--border); }
.budget-mini:last-child { border-bottom: none; }
.bm-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bm-bar { height: 5px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.bm-bar div { height: 100%; border-radius: 3px; transition: width 0.5s; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 2.5rem; color: var(--muted); font-size: 13px; }
.empty-icon { font-size: 28px; margin-bottom: 8px; }

/* FULL TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { font-weight: 500; font-size: 11px; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge.income { background: #dcfce7; color: #15803d; }
.badge.expense { background: #fee2e2; color: #b91c1c; }

/* FORM */
.form-card { background: var(--surface); border-radius: 12px; padding: 1.5rem; border: 1px solid var(--border); margin-bottom: 1.25rem; }
.form-title { font-size: 15px; font-weight: 600; margin-bottom: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.form-input, .form-select { padding: 9px 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px; font-family: 'Outfit', sans-serif; color: var(--text); background: #fff; transition: border 0.15s; outline: none; }
.form-input:focus, .form-select:focus { border-color: #a3a3a3; }
.form-actions { margin-top: 1.25rem; display: flex; gap: 8px; }
.btn-primary { background: var(--accent); color: #fff; border: none; padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: 'Outfit', sans-serif; transition: background 0.15s; }
.btn-primary:hover { background: #333; }
.btn-secondary { background: none; color: var(--text); border: 1px solid #e5e7eb; padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: 'Outfit', sans-serif; }
.btn-danger { background: #fee2e2; color: #b91c1c; border: none; padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; font-family: 'Outfit', sans-serif; }
.btn-icon { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }

/* FILTER ROW */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar .form-input, .filter-bar .form-select { font-size: 12px; padding: 7px 10px; }

/* BUDGET CARDS */
.budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.budget-card { background: var(--surface); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border); }
.bc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bc-cat { font-size: 14px; font-weight: 600; }
.bc-amounts { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.bc-bar { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.bc-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.bc-pct { font-size: 12px; font-weight: 500; }
.bc-alert { font-size: 11px; color: var(--red); margin-top: 4px; }

/* EXPORT PAGE */
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.export-card { background: var(--surface); border-radius: 12px; padding: 1.5rem; border: 1px solid var(--border); cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.export-card:hover { border-color: #a3a3a3; transform: translateY(-1px); }
.ec-icon { font-size: 28px; margin-bottom: 10px; }
.ec-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.ec-desc { font-size: 12px; color: var(--muted); }
.ec-btn { margin-top: 1rem; display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; border: none; cursor: pointer; font-family: 'Outfit', sans-serif; }

/* REPORTS */
.report-filters { display: flex; gap: 8px; margin-bottom: 1.25rem; }
.report-tab { padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; cursor: pointer; font-family: 'Outfit', sans-serif; color: var(--muted); }
.report-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.report-stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; margin-bottom: 1.25rem; }
.report-stat { background: var(--surface); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border); text-align: center; }
.rs-val { font-family: 'DM Mono', monospace; font-size: 24px; font-weight: 500; margin-bottom: 4px; }
.rs-lbl { font-size: 12px; color: var(--muted); }

/* NOTIFICATION */
.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: #1a1a1a; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 13px; z-index: 9999; transform: translateY(20px); opacity: 0; transition: all 0.25s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }

/* MOBILE */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .menu-btn { display: block; }
  .main-content { margin-left: 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .topbar-date { display: none; }
  .export-grid { grid-template-columns: 1fr; }
  .report-stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-body { padding: 1rem; }
}

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