/* ─────────────────────────────────────────────────────────
   Finance Tracker — Design System
   Dark theme | Inter / system-ui
   ───────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #334155;
  --surface3:  #475569;

  /* Borders */
  --border:    #334155;
  --border2:   #475569;

  /* Text */
  --text:      #f1f5f9;
  --text-muted:#94a3b8;
  --text-dim:  #64748b;

  /* Brand / accent */
  --primary:       #10b981;
  --primary-hover: #059669;
  --primary-dim:   rgba(16,185,129,.15);

  /* Semantic */
  --income:  #10b981;
  --expense: #ef4444;
  --balance: #3b82f6;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;
  --secondary: #3b82f6;

  /* Semantic dim */
  --income-dim:  rgba(16,185,129,.12);
  --expense-dim: rgba(239,68,68,.12);
  --balance-dim: rgba(59,130,246,.12);
  --warning-dim: rgba(245,158,11,.12);

  /* Light compat aliases */
  --light: #334155;
  --dark:  #f1f5f9;

  /* Misc */
  --radius:   10px;
  --radius-lg:16px;
  --radius-sm:6px;
  --shadow:   0 4px 16px rgba(0,0,0,.35);
  --shadow-sm:0 2px 8px  rgba(0,0,0,.25);
  --transition:.18s ease;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ─────────────────────────────────────────────────────────
   NAVBAR
   ───────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  margin-right: 16px;
  white-space: nowrap;
}

.navbar-brand .logo-icon,
.navbar-brand i[data-lucide] {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}

.nav-link i { width: 16px; height: 16px; }

.nav-link:hover {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-dim);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.user-info { font-size: 14px; color: var(--text-muted); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}
.menu-toggle i { width: 22px; height: 22px; }

@media (max-width: 768px) {
  .navbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 0; }
  .navbar-brand { flex: 1; }
  .menu-toggle { display: flex; align-items: center; }
  .navbar-menu {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 8px 0 4px;
    gap: 2px;
    overflow: visible;
  }
  .navbar-menu.open { display: flex; }
  .nav-link { width: 100%; }
  .navbar-user {
    width: 100%;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
    margin-left: 0;
  }
}

/* ─────────────────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e1b4b 100%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.logo { text-align: center; margin-bottom: 32px; }

.logo-icon,
.logo i[data-lucide] {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto 12px;
  color: var(--primary);
}

.logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }

/* ─────────────────────────────────────────────────────────
   FORMS
   ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-dim); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.form-group select option { background: var(--surface2); color: var(--text); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-actions { margin-top: 24px; }

.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.2;
}

.btn i { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface3);
  text-decoration: none;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  text-decoration: none;
  color: #fff;
}

.btn-link {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  padding: 6px 4px;
}
.btn-link:hover { text-decoration: underline; }

.btn-small { padding: 5px 10px; font-size: 12px; }

.btn-icon {
  padding: 7px;
  width: 34px;
  height: 34px;
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-icon:hover { background: var(--surface3); color: var(--text); }

.btn-full { width: 100%; }

/* ─────────────────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 i { width: 18px; height: 18px; color: var(--primary); }

/* Summary / stat cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 640px) { .summary-cards { grid-template-columns: 1fr; } }

.card-income, .card-expense, .card-balance {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.card-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  padding: 10px;
}

.income-icon  { background: var(--income-dim);  color: var(--income); }
.expense-icon { background: var(--expense-dim); color: var(--expense); }
.balance-icon { background: var(--balance-dim); color: var(--balance); }

.card-content h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-amount { font-size: 22px; font-weight: 700; color: var(--text); }
.card-income  .card-amount { color: var(--income); }
.card-expense .card-amount { color: var(--expense); }
.card-balance .card-amount { color: var(--balance); }

/* ─────────────────────────────────────────────────────────
   MONTH SELECTOR
   ───────────────────────────────────────────────────────── */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.month-selector h2 {
  font-size: 20px;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────
   QUICK ADD
   ───────────────────────────────────────────────────────── */
.quick-add {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.quick-add h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.quick-add h3 i { width: 18px; height: 18px; color: var(--primary); }

.quick-form {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr 1fr 2fr auto;
  gap: 10px;
  align-items: end;
}
.quick-form .form-group { margin-bottom: 0; }

@media (max-width: 900px) { .quick-form { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 600px) { .quick-form { grid-template-columns: 1fr; } }

/* ─────────────────────────────────────────────────────────
   DASHBOARD SECTIONS
   ───────────────────────────────────────────────────────── */
.alerts-section,
.budgets-section,
.goals-section,
.recent-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.alerts-section h3,
.budgets-section h3,
.goals-section h3,
.recent-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.alerts-section h3 i,
.budgets-section h3 i,
.goals-section h3 i,
.recent-section h3 i { width: 18px; height: 18px; color: var(--primary); }

.budget-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.budget-item:last-child { border-bottom: none; }
.budget-info { flex: 1; }
.budget-name { font-weight: 500; margin-bottom: 6px; color: var(--text); }
.budget-amounts { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.goal-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.goal-item:last-child { border-bottom: none; }
.goal-name { font-weight: 500; margin-bottom: 4px; color: var(--text); }
.goal-progress-text { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

/* ─────────────────────────────────────────────────────────
   TRANSACTIONS
   ───────────────────────────────────────────────────────── */
.transaction-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.transaction-item:last-child { border-bottom: none; }

.transaction-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.transaction-details { flex: 1; min-width: 0; }
.transaction-description {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.transaction-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.transaction-amount { font-weight: 700; font-size: 15px; white-space: nowrap; }
.transaction-income  .transaction-amount { color: var(--income); }
.transaction-expense .transaction-amount { color: var(--expense); }
.transaction-actions { display: flex; gap: 4px; }

/* ─────────────────────────────────────────────────────────
   TABLE
   ───────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 11px 16px;
  text-align: left;
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 12px 16px; color: var(--text); vertical-align: middle; }

td.amount-income  { color: var(--income);  font-weight: 600; }
td.amount-expense { color: var(--expense); font-weight: 600; }

/* ─────────────────────────────────────────────────────────
   MODALS
   ───────────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal.active { display: flex; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  animation: modal-in .18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header h2 i { width: 20px; height: 20px; color: var(--primary); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-close i { width: 20px; height: 20px; }

.modal-body { padding: 20px 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

.confirm-dialog { max-width: 380px; }
.confirm-dialog .modal-body { text-align: center; padding: 28px 24px; }
.confirm-dialog .modal-body p { color: var(--text-muted); margin-top: 8px; }

/* ─────────────────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--text);
  transition: all .3s ease;
}

.toast-success { border-left-color: var(--income); }
.toast-error   { border-left-color: var(--expense); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--info); }

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: var(--income); }
.toast-error   .toast-icon { color: var(--expense); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }

.toast-message { flex: 1; line-height: 1.4; }

.toast-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 0; display: flex; align-items: center; flex-shrink: 0;
}
.toast-close i { width: 15px; height: 15px; }

.toast-enter  { opacity: 0; transform: translateX(20px); }
.toast-visible{ opacity: 1; transform: translateX(0); }
.toast-exit   { opacity: 0; transform: translateX(20px); }

/* ─────────────────────────────────────────────────────────
   FILTERS
   ───────────────────────────────────────────────────────── */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.filters h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.filters h3 i { width: 16px; height: 16px; color: var(--primary); }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─────────────────────────────────────────────────────────
   SUMMARY BAR
   ───────────────────────────────────────────────────────── */
.summary-bar {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  color: var(--text);
}

.summary-stat { text-align: center; }
.summary-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.summary-value { font-size: 20px; font-weight: 700; }
.summary-value.income  { color: var(--income); }
.summary-value.expense { color: var(--expense); }
.summary-value.balance { color: var(--balance); }

/* ─────────────────────────────────────────────────────────
   PAGE HEADER
   ───────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header h1 i { width: 26px; height: 26px; color: var(--primary); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─────────────────────────────────────────────────────────
   PAGINATION
   ───────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 4px;
}
.pagination .btn { min-width: 36px; }
.pagination-info { font-size: 13px; color: var(--text-muted); padding: 0 8px; }

/* ─────────────────────────────────────────────────────────
   TAGS
   ───────────────────────────────────────────────────────── */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 42px;
  cursor: text;
}
.tags-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface3);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text);
}
.tag-item button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; display: flex; }
.tag-item button i { width: 13px; height: 13px; }
.tags-input input { flex: 1; min-width: 80px; background: none; border: none; outline: none; color: var(--text); font-size: 14px; padding: 2px 4px; }

.tag-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-suggestion {
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
}
.tag-suggestion:hover { background: var(--surface3); color: var(--text); border-color: var(--primary); }

/* ─────────────────────────────────────────────────────────
   ALERTS
   ───────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid transparent;
  font-size: 14px;
}
.alert i { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: var(--warning-dim); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.alert-danger  { background: var(--expense-dim); border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-info    { background: var(--balance-dim); border-color: rgba(59,130,246,.3); color: #93c5fd; }
.alert-success { background: var(--income-dim);  border-color: rgba(16,185,129,.3); color: #6ee7b7; }

/* ─────────────────────────────────────────────────────────
   ERROR / EMPTY STATES
   ───────────────────────────────────────────────────────── */
.error-message {
  background: var(--expense-dim);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-top: 14px;
}

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state i { width: 48px; height: 48px; margin: 0 auto 14px; display: block; opacity: .4; }
.empty-state p { font-size: 15px; }

/* ─────────────────────────────────────────────────────────
   BUDGET PAGE
   ───────────────────────────────────────────────────────── */
.period-toggle {
  display: flex;
  gap: 6px;
  background: var(--surface2);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.period-toggle button {
  padding: 7px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: all var(--transition);
  font-family: inherit;
}
.period-toggle button.active { background: var(--primary); color: #fff; }
.period-toggle button:hover:not(.active) { color: var(--text); background: var(--surface3); }

.budget-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* ─────────────────────────────────────────────────────────
   RECURRING
   ───────────────────────────────────────────────────────── */
.recurring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.recurring-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.recurring-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }

.recurring-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.recurring-category { display: flex; align-items: center; gap: 10px; }

.recurring-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.recurring-name { font-weight: 600; color: var(--text); }
.recurring-frequency { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.recurring-actions { display: flex; gap: 4px; }
.recurring-amount { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.recurring-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.recurring-meta span { display: flex; align-items: center; gap: 4px; }
.recurring-meta i { width: 13px; height: 13px; }

/* ─────────────────────────────────────────────────────────
   STATS PAGE
   ───────────────────────────────────────────────────────── */
.view-selector {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.view-btn {
  padding: 10px 22px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
}
.view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.view-btn:hover:not(.active) { background: var(--surface3); color: var(--text); }

/* ─────────────────────────────────────────────────────────
   ANALYTICS PAGE
   ───────────────────────────────────────────────────────── */
.trends-summary { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }

.trend-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.trend-item { padding: 14px; background: var(--surface2); border-radius: var(--radius); }
.trend-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.trend-value { font-size: 20px; font-weight: 600; color: var(--text); }
.trend-value.positive { color: var(--income); }
.trend-value.negative { color: var(--expense); }

.waste-results { margin-top: 18px; }

.waste-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.waste-stat { padding: 16px; background: var(--surface2); border-radius: var(--radius); text-align: center; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-value.waste { color: var(--expense); }

.recommendations {
  padding: 16px;
  background: var(--balance-dim);
  border-left: 4px solid var(--balance);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.recommendations h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #93c5fd; }
.recommendations ul { margin-left: 20px; color: var(--text-muted); }
.recommendations li { margin-bottom: 6px; }

.waste-categories { margin-top: 18px; }
.waste-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.waste-table th, .waste-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.waste-table th { background: var(--surface2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.waste-table td { color: var(--text); }
.waste-table td.amount { font-weight: 600; color: var(--expense); }

.patterns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 18px;
}
.patterns-grid h4 { margin-bottom: 14px; font-size: 15px; color: var(--text); }
.patterns-grid canvas { max-height: 280px; }

/* ─────────────────────────────────────────────────────────
   ACCOUNT PAGE
   ───────────────────────────────────────────────────────── */
.account-container { max-width: 780px; margin: 0 auto; }
.account-header { text-align: center; margin-bottom: 28px; }
.account-header h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.account-header p  { color: var(--text-muted); font-size: 14px; }

.avatar-section { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }

.avatar-display {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: var(--surface2);
  border: 3px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  font-size: 48px;
}
.avatar-display img { width: 100%; height: 100%; object-fit: cover; }
.avatar-display i   { width: 48px; height: 48px; color: var(--text-muted); }

.avatar-options { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.avatar-option {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  transition: all var(--transition);
}
.avatar-option:hover, .avatar-option.selected { border-color: var(--primary); background: var(--primary-dim); }

.section-divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ─────────────────────────────────────────────────────────
   CATEGORY BADGE
   ───────────────────────────────────────────────────────── */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────
   LOADING
   ───────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
  backdrop-filter: blur(2px);
}
.loading-overlay.hidden { display: none; }

/* ─────────────────────────────────────────────────────────
   MISC
   ───────────────────────────────────────────────────────── */
.budget-card--overbudget {
  border-color: var(--danger) !important;
  background: rgba(239,68,68,.06) !important;
}

.budget-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

canvas { display: block; }

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .recurring-grid     { grid-template-columns: 1fr; }
  .patterns-grid      { grid-template-columns: 1fr; }
  .waste-summary      { grid-template-columns: 1fr 1fr; }
  .trend-summary-grid { grid-template-columns: 1fr 1fr; }
  .budget-stats       { grid-template-columns: 1fr 1fr; }
  .container          { padding: 16px 14px; }
}

@media (max-width: 480px) {
  .waste-summary      { grid-template-columns: 1fr; }
  .trend-summary-grid { grid-template-columns: 1fr; }
  .budget-stats       { grid-template-columns: 1fr; }
  .summary-cards      { grid-template-columns: 1fr; }
}
