/* ──────────────────────────────────────────────────────────────────────────
   FinTrack – Design System
   Color palette inspired by PayPal: #003087 (deep navy), #0070ba (sky blue),
   #00a8e0 (light blue), white surfaces, clean typography, zero fluff.
   Font: Inter (same weight and clarity as PayPal's system font)
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --navy:      #003087;
  --blue:      #0070ba;
  --light-blue:#00a8e0;
  --blue-hover:#005ea6;
  --blue-light:#e8f4fc;
  --green:     #1a9e6b;
  --green-light:#e6f7f0;
  --red:       #c0392b;
  --red-light: #fdecea;
  --orange:    #ff6900;
  --purple:    #6c47ff;

  --bg:        #f5f7fa;
  --surface:   #ffffff;
  --surface-2: #f0f4f8;
  --border:    #e1e8f0;
  --border-2:  #ccd6e0;

  --text:      #1a2332;
  --text-2:    #4a5568;
  --text-3:    #718096;
  --text-inv:  #ffffff;

  --sidebar-w: 256px;
  --topbar-h:  64px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 12px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --transition: 0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select { font-family: inherit; }
.hidden { display: none !important; }

/* ── Auth Screen ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #005ea6 60%, var(--blue) 100%);
  padding: 20px;
}

.auth-container {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 44px;
  height: 44px;
  background: var(--navy);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 24px;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
  margin-top: 20px;
}
.auth-switch a { color: var(--blue); font-weight: 500; }

.auth-demo {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── App Shell ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-close {
  color: rgba(255,255,255,0.5);
  display: none;
  padding: 4px;
}
.sidebar-close:hover { color: #fff; }

.nav-list {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}
.nav-item.active {
  color: #fff;
  background: var(--blue);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: auto;
}
.user-avatar {
  width: 36px; height: 36px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; truncate: true; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: rgba(255,255,255,0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { color: rgba(255,255,255,0.45); padding: 6px; border-radius: 6px; flex-shrink: 0; }
.logout-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
}

/* ── Main ── */
.main {
  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;
  gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}
.menu-btn { color: var(--text-2); padding: 6px; border-radius: 6px; display: none; }
.menu-btn:hover { background: var(--bg); }
.topbar-title { font-size: 18px; font-weight: 600; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-action {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: var(--bg);
  transition: all var(--transition);
}
.topbar-action:hover { background: var(--blue-light); color: var(--blue); }
.topbar-avatar {
  width: 36px; height: 36px;
  background: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  cursor: pointer;
}

/* ── Pages ── */
.page-container { flex: 1; }
.page { display: none; }
.page.active { display: block; }
.page-content { padding: 28px 32px; max-width: 1280px; }

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}
.section-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 2px;
}
.header-period { padding-top: 4px; }
.period-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-light);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── KPI Grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); }
.kpi-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  border-color: transparent;
  color: #fff;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.kpi-primary .kpi-label { color: rgba(255,255,255,0.7); }
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.kpi-primary .kpi-value { color: #fff; }
.kpi-green { color: var(--green); }
.kpi-red   { color: var(--red); }
.kpi-sub { font-size: 12px; color: var(--text-3); }
.kpi-primary .kpi-sub { color: rgba(255,255,255,0.65); }
.kpi-trend { font-size: 12px; font-weight: 600; }
.kpi-trend.up { color: var(--red); }
.kpi-trend.down { color: var(--green); }
.kpi-icon {
  position: absolute;
  right: 16px; top: 16px;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon-balance { background: rgba(255,255,255,0.15); color: #fff; }
.kpi-icon-income  { background: var(--green-light); color: var(--green); }
.kpi-icon-expense { background: var(--red-light); color: var(--red); }
.kpi-icon-savings { background: var(--blue-light); color: var(--blue); }

/* ── Charts ── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-title { font-size: 15px; font-weight: 600; color: var(--text); }
.chart-sub { font-size: 12px; color: var(--text-3); }
.chart-wrap { height: 220px; position: relative; }
.chart-wrap-doughnut { height: 180px; }
.cat-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 120px;
  overflow-y: auto;
}
.cat-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.cat-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-legend-name { flex: 1; }
.cat-legend-val { font-weight: 600; color: var(--text); }

/* ── Section Blocks ── */
.section-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.section-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.section-block-title { font-size: 15px; font-weight: 600; color: var(--text); }
.link-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ── Account Strip (dashboard) ── */
.accounts-strip {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  overflow-x: auto;
}
.account-chip {
  background: linear-gradient(135deg, var(--color-from, var(--navy)) 0%, var(--color-to, var(--blue)) 100%);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  min-width: 220px;
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
}
.account-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.account-chip-type { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.75; margin-bottom: 8px; }
.account-chip-balance { font-size: 22px; font-weight: 700; letter-spacing: -0.6px; margin-bottom: 12px; }
.account-chip-num { font-size: 12px; opacity: 0.7; font-family: 'Courier New', monospace; letter-spacing: 1px; }

/* ── Transaction List ── */
.txn-list { display: flex; flex-direction: column; }
.txn-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.txn-item:last-child { border-bottom: none; }
.txn-item:hover { background: var(--bg); }
.txn-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--surface-2);
}
.txn-info { flex: 1; min-width: 0; }
.txn-desc { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.txn-amount { font-size: 15px; font-weight: 600; text-align: right; white-space: nowrap; }
.txn-amount.credit { color: var(--green); }
.txn-amount.debit  { color: var(--text); }
.txn-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.txn-status-badge.pending { background: #fff8e6; color: #b7830a; }
.txn-status-badge.completed { background: var(--green-light); color: var(--green); }
.txn-status-badge.failed { background: var(--red-light); color: var(--red); }

/* ── Accounts Grid ── */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.account-card:hover { box-shadow: var(--shadow); }
.account-card-hero {
  padding: 28px 24px;
  color: #fff;
  position: relative;
  min-height: 140px;
}
.account-card-hero::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.account-card-hero::before {
  content: '';
  position: absolute;
  right: 30px; bottom: -30px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.account-card-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; opacity: 0.75; margin-bottom: 4px; }
.account-card-name { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.account-card-balance { font-size: 30px; font-weight: 700; letter-spacing: -1px; margin-bottom: 16px; }
.account-card-num {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  opacity: 0.75;
}
.account-card-body { padding: 16px 24px; }
.account-meta-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); margin-bottom: 12px; }
.account-meta-row span:last-child { color: var(--text-2); font-weight: 500; }
.account-actions { display: flex; gap: 8px; }

/* ── Budgets Grid ── */
.budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.budget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.budget-card:hover { box-shadow: var(--shadow); }
.budget-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.budget-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.budget-name { font-size: 15px; font-weight: 600; color: var(--text); }
.budget-period { font-size: 12px; color: var(--text-3); }
.budget-amounts { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.budget-spent { font-size: 20px; font-weight: 700; color: var(--text); }
.budget-limit { font-size: 13px; color: var(--text-3); }
.progress-bar { height: 8px; background: var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; border-radius: 8px; transition: width 0.6s ease; }
.budget-footer { display: flex; justify-content: space-between; font-size: 12px; }
.budget-remaining { color: var(--text-2); font-weight: 500; }
.budget-pct { font-weight: 600; }
.budget-pct.over { color: var(--red); }
.budget-pct.warn { color: var(--orange); }
.budget-pct.ok   { color: var(--green); }
.budget-actions { display: flex; gap: 6px; margin-top: 12px; justify-content: flex-end; }

/* ── Bills List ── */
.bills-list { display: flex; flex-direction: column; gap: 12px; }
.bill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.bill-card:hover { box-shadow: var(--shadow); }
.bill-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.bill-info { flex: 1; }
.bill-name { font-size: 15px; font-weight: 600; color: var(--text); }
.bill-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bill-due {
  text-align: right;
  flex-shrink: 0;
}
.bill-amount { font-size: 18px; font-weight: 700; color: var(--text); }
.bill-days {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  margin-top: 4px;
  display: inline-block;
}
.bill-days.overdue { background: var(--red-light); color: var(--red); }
.bill-days.urgent  { background: #fff3e0; color: var(--orange); }
.bill-days.upcoming{ background: var(--blue-light); color: var(--blue); }
.bill-days.ok      { background: var(--green-light); color: var(--green); }
.bill-auto-badge {
  font-size: 11px;
  background: var(--green-light);
  color: var(--green);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 8px;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,112,186,0.1); }
.filter-select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--blue); }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 20px 0;
}
.page-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--blue); color: var(--blue); }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-light); }
.btn-text { display: block; }
.btn-loader {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group-full { grid-column: 1 / -1; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,112,186,0.1); }
.form-input::placeholder { color: var(--text-3); }
select.form-input { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-input { padding-right: 44px; }
.input-icon-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); padding: 4px; border-radius: 4px;
}
.input-icon-btn:hover { color: var(--text-2); }
.amount-input-wrap { position: relative; }
.amount-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 15px; font-weight: 600; color: var(--text-3);
  pointer-events: none;
}
.amount-input { padding-left: 28px !important; font-size: 22px !important; font-weight: 700 !important; }

/* ── Color Options ── */
.color-options { display: flex; gap: 10px; }
.color-opt {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: all var(--transition);
}
.color-opt.active { border-color: var(--text); transform: scale(1.15); }
.color-opt:hover { transform: scale(1.1); }

/* ── Modals ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  backdrop-filter: blur(3px);
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 400;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close { color: var(--text-3); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--text-2); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky; bottom: 0;
}

/* ── Tab Row ── */
.tab-row {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  transition: all var(--transition);
}
.tab-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-btn:hover:not(.active) { color: var(--text-2); }

/* ── Alerts ── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.alert-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(192,57,43,0.2);
}
.alert-success {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(26,158,107,0.2);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.25s ease;
  max-width: 320px;
}
.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--red); }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.empty-state svg { opacity: 0.3; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr; }
  .chart-card { grid-column: 1; }
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .page-content { padding: 20px 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-value { font-size: 20px; }
  .charts-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .accounts-grid { grid-template-columns: 1fr; }
  .budgets-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-select { width: 100%; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 18px; }
  .modal { width: 95%; max-height: 92vh; }
  .auth-container { padding: 28px 20px; }
}
