@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&display=swap');

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

/* ── DESIGN TOKENS ── */
:root {
  --bg:            #080808;
  --bg-card:       rgba(255,255,255,0.025);
  --bg-card-hover: rgba(255,255,255,0.055);
  --border:        rgba(255,255,255,0.07);
  --border-hover:  rgba(255,255,255,0.16);
  --text:          #ffffff;
  --text-muted:    rgba(255,255,255,0.35);
  --text-dim:      rgba(255,255,255,0.6);
  --btn-bg:        #ffffff;
  --btn-text:      #000000;
  --glow:          rgba(255,255,255,0.14);
  --radius-card:   20px;
  --radius-btn:    12px;
  --radius-chip:   20px;
  --radius-input:  12px;
  --font:          'Plus Jakarta Sans', sans-serif;
  --tr:            0.2s ease;
}

[data-theme="light"] {
  --bg:            #f4f4f5;
  --bg-card:       rgba(0,0,0,0.03);
  --bg-card-hover: rgba(0,0,0,0.07);
  --border:        rgba(0,0,0,0.08);
  --border-hover:  rgba(0,0,0,0.18);
  --text:          #09090b;
  --text-muted:    rgba(0,0,0,0.4);
  --text-dim:      rgba(0,0,0,0.65);
  --btn-bg:        #09090b;
  --btn-text:      #ffffff;
  --glow:          rgba(0,0,0,0.1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--tr), color var(--tr);
  position: relative;
}

body::before {
  content: '';
  position: fixed; top: -20%; left: 15%;
  width: 55%; height: 55%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.025) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
[data-theme="light"] body::before {
  background: radial-gradient(ellipse, rgba(0,0,0,0.015) 0%, transparent 70%);
}

/* ── NAVBAR ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,8,8,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .navbar {
  background: rgba(244,244,245,0.9);
}

.nav-container {
  max-width: 1380px; margin: 0 auto;
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--btn-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
  box-shadow: 0 0 20px var(--glow);
}
.logo-name { font-size: 18px; font-weight: 900; letter-spacing: -0.5px; }
.logo-muted { color: var(--text-muted); font-weight: 400; }

.nav-links { display: flex; gap: 2px; }
.nav-link {
  padding: 7px 15px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); text-decoration: none;
  transition: all var(--tr);
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active {
  background: var(--bg-card-hover);
  color: var(--text);
  border: 1px solid var(--border-hover);
}

.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; transition: all var(--tr);
  color: var(--text);
}
.icon-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

/* ── BUTTONS ── */
.btn-primary {
  padding: 10px 22px; border-radius: var(--radius-btn);
  background: var(--btn-bg); color: var(--btn-text);
  font-size: 13px; font-weight: 800; border: none; cursor: pointer;
  font-family: var(--font); letter-spacing: -0.2px;
  box-shadow: 0 4px 18px var(--glow);
  transition: all var(--tr); white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 26px var(--glow); }
.btn-primary.full-width { width: 100%; padding: 13px; }

.btn-ghost {
  padding: 6px 14px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: var(--font);
  transition: all var(--tr);
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
.btn-ghost.full-width { width: 100%; padding: 10px; }

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: border-color var(--tr);
}
.card:hover { border-color: var(--border-hover); }

/* ── INPUTS ── */
.field {
  width: 100%; display: block;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  font-size: 13px; font-weight: 500; color: var(--text);
  font-family: var(--font); outline: none; margin-bottom: 10px;
  transition: border-color var(--tr);
}
[data-theme="light"] .field { background: rgba(0,0,0,0.04); }
.field:focus { border-color: var(--border-hover); }
.field::placeholder { color: var(--text-muted); }
select.field { cursor: pointer; }
select.field option { background: #111; color: #fff; }
[data-theme="light"] select.field option { background: #f4f4f5; color: #09090b; }

/* ── LAYOUT ── */
.main-wrap {
  max-width: 1380px; margin: 0 auto;
  padding: 28px 28px 60px;
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 16px;
}

/* ── HERO ROW ── */
.hero-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
}
.hero-main { padding: 28px 30px; position: relative; overflow: hidden; }
.hero-main::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 55%);
  pointer-events: none;
}
.hero-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.8px; color: var(--text-muted); margin-bottom: 12px;
  position: relative;
}
.hero-amount {
  font-size: 46px; font-weight: 900; letter-spacing: -3px; line-height: 1;
  position: relative;
}
.hero-sub { font-size: 13px; color: var(--text-muted); margin-top: 8px; font-weight: 500; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 14px; padding: 5px 13px; border-radius: var(--radius-chip);
  background: var(--bg-card-hover); border: 1px solid var(--border-hover);
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  position: relative;
}
.progress-track {
  height: 3px; background: var(--border);
  border-radius: 2px; margin-top: 18px; overflow: hidden; position: relative;
}
.progress-fill {
  height: 100%; width: 0; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.85), rgba(255,255,255,0.4));
  transition: width 0.5s ease;
}

.stat-card { padding: 22px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.stat-icon { font-size: 22px; margin-bottom: 6px; }
.stat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted);
}
.stat-value { font-size: 24px; font-weight: 900; letter-spacing: -1px; }
.stat-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ── QUICK STATS ── */
.quick-stats {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 12px;
}
.qstat { padding: 18px; text-align: center; }
.qval { font-size: 22px; font-weight: 900; letter-spacing: -0.8px; }
.qlbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-top: 5px;
}

/* ── MAIN GRID ── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 360px;
  gap: 16px;
}
.chart-panel { grid-column: span 2; }
.exp-panel   { grid-column: span 2; }
.right-col   { display: flex; flex-direction: column; gap: 16px; grid-row: span 2; }

.panel { padding: 22px; }
.panel-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.panel-title { font-size: 14px; font-weight: 800; letter-spacing: -0.3px; }
.panel-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── CHART ── */
.chart-tabs { display: flex; gap: 6px; flex-shrink: 0; }
.tab {
  padding: 5px 13px; border-radius: 8px;
  font-size: 11px; font-weight: 700;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-family: var(--font);
  transition: all var(--tr);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--bg-card-hover); color: var(--text); border-color: var(--border-hover); }
.chart-wrap { position: relative; height: 160px; }

/* ── FILTER CHIPS ── */
.filter-row { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  padding: 5px 13px; border-radius: var(--radius-chip);
  font-size: 11px; font-weight: 700;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-family: var(--font);
  transition: all var(--tr);
}
.chip:hover { color: var(--text); border-color: var(--border-hover); }
.chip.active { background: var(--bg-card-hover); border-color: var(--border-hover); color: var(--text); }

/* ── SEARCH BAR ── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-input); padding: 10px 14px;
  margin-bottom: 12px; transition: border-color var(--tr);
}
.search-bar:focus-within { border-color: var(--border-hover); }
.search-bar input {
  background: none; border: none; outline: none;
  font-size: 13px; font-weight: 500; color: var(--text);
  font-family: var(--font); flex: 1;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ── EXPENSE ROWS ── */
.exp-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 13px; border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  margin-bottom: 7px;
  transition: all var(--tr);
}
.exp-row:hover {
  background: var(--bg-card-hover); border-color: var(--border-hover);
  transform: translateX(3px);
}
.exp-ico {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--bg-card-hover); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.exp-body { flex: 1; min-width: 0; }
.exp-name {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exp-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.exp-right { text-align: right; flex-shrink: 0; }
.exp-amt { font-size: 14px; font-weight: 800; color: var(--text-dim); }
.exp-date { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.exp-actions {
  display: flex; gap: 6px;
  opacity: 0; transition: opacity var(--tr);
}
.exp-row:hover .exp-actions { opacity: 1; }
.act-btn {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--bg-card-hover); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: all var(--tr);
}
.act-btn:hover { border-color: var(--border-hover); }

/* ── CATEGORY LIST ── */
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cat-row:last-child { border-bottom: none; }
.cat-ico {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--bg-card-hover); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-size: 12px; font-weight: 700; }
.cat-bar-track {
  height: 3px; background: var(--border);
  border-radius: 2px; margin-top: 5px; overflow: hidden;
}
.cat-bar-fill {
  height: 100%; border-radius: 2px;
  background: rgba(255,255,255,0.55);
  transition: width 0.5s ease;
}
[data-theme="light"] .cat-bar-fill { background: rgba(0,0,0,0.45); }
.cat-amt { font-size: 12px; font-weight: 800; color: var(--text-dim); flex-shrink: 0; }

/* ── ADD PANEL ── */
.add-panel { padding: 22px; }
.add-panel .panel-title { margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.two-col .field { margin-bottom: 0; }
.form-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

/* ── BUDGET RING PANEL ── */
.budget-panel { padding: 22px; }
.budget-panel .panel-title { margin-bottom: 4px; }
.ring-area { display: flex; justify-content: center; margin: 14px 0; }
.budget-stats { display: flex; justify-content: space-around; text-align: center; }
.bstat-val { font-size: 15px; font-weight: 800; }
.bstat-lbl {
  font-size: 10px; color: var(--text-muted); margin-top: 3px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: var(--text-dim); }
.empty-sub { font-size: 12px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #111; border: 1px solid var(--border-hover);
  border-radius: 22px; padding: 28px;
  width: 100%; max-width: 420px;
  animation: modalIn 0.22s ease;
}
[data-theme="light"] .modal { background: #fafafa; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 12px; cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--tr);
}
.modal-close:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }

/* ── ANIMATIONS ── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
.exp-row { animation: fadeSlideIn 0.22s ease both; }
.exp-row:nth-child(2) { animation-delay: 0.03s; }
.exp-row:nth-child(3) { animation-delay: 0.06s; }
.exp-row:nth-child(4) { animation-delay: 0.09s; }
.exp-row:nth-child(5) { animation-delay: 0.12s; }

@keyframes cardIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
.hero-main  { animation: cardIn 0.3s ease both; }
.stat-card:nth-child(2) { animation: cardIn 0.3s 0.05s ease both; }
.stat-card:nth-child(3) { animation: cardIn 0.3s 0.10s ease both; }
.stat-card:nth-child(4) { animation: cardIn 0.3s 0.15s ease both; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .main-grid { grid-template-columns: 1fr 1fr; }
  .chart-panel, .exp-panel { grid-column: span 2; }
  .right-col { grid-column: span 2; grid-row: auto; flex-direction: row; flex-wrap: wrap; }
  .add-panel, .budget-panel { flex: 1; min-width: 280px; }
}
@media (max-width: 900px) {
  .hero-row { grid-template-columns: 1fr 1fr; }
  .hero-main { grid-column: span 2; }
  .hero-amount { font-size: 38px; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .quick-stats { grid-template-columns: repeat(2,1fr); }
  .main-grid { grid-template-columns: 1fr; }
  .chart-panel, .exp-panel, .right-col { grid-column: span 1; }
  .right-col { flex-direction: column; }
  .main-wrap { padding: 18px 14px 48px; }
  .nav-container { padding: 0 16px; }
}
@media (max-width: 520px) {
  .hero-row { grid-template-columns: 1fr; }
  .hero-main { grid-column: span 1; }
  .hero-amount { font-size: 34px; letter-spacing: -2px; }
  .two-col { grid-template-columns: 1fr; }
  .two-col .field { margin-bottom: 10px; }
}
