/* ══════════════════════════════════════
   FINPRO – Thanh Nam BĐS Finance App
   Design: Dark Navy + Gold Premium
   ══════════════════════════════════════ */

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

/* ─── CSS VARIABLES ─── */
:root {
  --bg-base:       #060c1a;
  --bg-surface:    #0d1729;
  --bg-card:       #111f38;
  --bg-card-hover: #162645;
  --bg-modal:      #0d1834;
  --border:        rgba(255,255,255,0.07);
  --border-light:  rgba(255,255,255,0.12);

  --gold:          #f0b429;
  --gold-light:    #fcd34d;
  --gold-dim:      rgba(240,180,41,0.15);
  --blue-accent:   #3b82f6;
  --blue-dim:      rgba(59,130,246,0.15);
  --green:         #10b981;
  --green-dim:     rgba(16,185,129,0.15);
  --red:           #ef4444;
  --red-dim:       rgba(239,68,68,0.15);

  --text-primary:  #f0f4ff;
  --text-secondary:#8ba4c7;
  --text-muted:    #4d6585;

  --sidebar-w:     260px;
  --topbar-h:      70px;
  --radius:        16px;
  --radius-sm:     10px;
  --shadow:        0 8px 32px rgba(0,0,0,0.4);
  --shadow-gold:   0 4px 20px rgba(240,180,41,0.2);
  --transition:    0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(240,180,41,0.3); border-radius: 3px; }

/* ═══════════════════════════ SIDEBAR ═══ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 26px 24px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), #e08000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #000;
  box-shadow: var(--shadow-gold);
  flex-shrink: 0;
}

.logo-title {
  display: block;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
}
.logo-sub {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--gold-dim), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}
.nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.nav-item:hover::before { opacity: 0.5; }
.nav-item.active {
  color: var(--gold-light);
  background: var(--gold-dim);
  border: 1px solid rgba(240,180,41,0.25);
}
.nav-item.active::before { opacity: 1; }

.nav-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
}
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #c07800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}
.user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { display: block; font-size: 11px; color: var(--text-secondary); }

/* ═══════════════════════════ TOPBAR ═══ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: rgba(6,12,26,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 100;
  gap: 16px;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

.topbar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.btn-add-tx {
  background: linear-gradient(135deg, var(--gold), #d4960a);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
  box-shadow: var(--shadow-gold);
}
.btn-add-tx:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(240,180,41,0.4); }
.btn-add-tx:active { transform: translateY(0); }
.date-badge {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ═══════════════════════════ MAIN CONTENT ═══ */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  padding: calc(var(--topbar-h) + 28px) 28px 40px;
  min-height: 100vh;
}

.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ═══════════════════════════ KPI CARDS ═══ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-net::before    { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.kpi-income::before { background: linear-gradient(90deg, var(--green), #34d399); }
.kpi-expense::before{ background: linear-gradient(90deg, var(--red), #f87171); }
.kpi-savings::before{ background: linear-gradient(90deg, var(--blue-accent), #60a5fa); }

.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-light); }

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.2;
}
.kpi-change { font-size: 13px; font-weight: 600; margin-top: 6px; }
.kpi-change.positive { color: var(--green); }
.kpi-change.negative { color: var(--red); }
.kpi-icon { position: absolute; right: 20px; top: 20px; font-size: 32px; opacity: 0.12; }
.kpi-rate { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* ═══════════════════════════ CHARTS ═══ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  /* Fix: explicit min-height to prevent collapse */
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
.chart-card:hover { border-color: var(--border-light); }
/* Canvas wrapper: always explicit height so Chart.js can measure */
.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  height: 220px;
}
.canvas-wrap canvas {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}
.legend-dot.gold { background: var(--gold); }
.legend-dot.blue { background: var(--blue-accent); }

.donut-legend {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}
.donut-legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  margin-right: 8px; flex-shrink: 0;
}

/* ═══════════════════════════ BOTTOM ROW ═══ */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.link-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition);
}
.link-btn:hover { color: var(--gold-light); }

/* ─── TX LIST ─── */
.tx-list { display: flex; flex-direction: column; gap: 10px; }
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  transition: all var(--transition);
}
.tx-item:hover { background: rgba(255,255,255,0.06); }
.tx-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tx-dot.income { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.tx-dot.expense { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.tx-info { flex: 1; min-width: 0; }
.tx-info-note { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-info-cat  { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.tx-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.tx-amount { font-size: 14px; font-weight: 700; white-space: nowrap; }
.tx-amount.income  { color: var(--green); }
.tx-amount.expense { color: var(--red); }

/* ─── CATEGORY LIST ─── */
.cat-list { display: flex; flex-direction: column; gap: 12px; }
.cat-item { display: flex; flex-direction: column; gap: 6px; }
.cat-item-header { display: flex; justify-content: space-between; font-size: 13px; }
.cat-item-name { color: var(--text-primary); font-weight: 500; }
.cat-item-val  { color: var(--text-secondary); }
.cat-bar-bg { height: 6px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-light)); transition: width 0.8s ease; }

/* ═══════════════════════════ TRANSACTIONS TABLE ═══ */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--gold); }
.filter-search {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 220px;
  transition: border-color var(--transition);
}
.filter-search:focus { border-color: var(--gold); }
.filter-search::placeholder { color: var(--text-muted); }

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 6px;
}
.tx-table { width: 100%; border-collapse: collapse; }
.tx-table thead { background: rgba(255,255,255,0.03); }
.tx-table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.tx-table td {
  padding: 14px 18px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.tx-table tbody tr { transition: background var(--transition); }
.tx-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.tx-table tbody tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }

.type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.type-badge.income  { background: var(--green-dim); color: var(--green); }
.type-badge.expense { background: var(--red-dim); color: var(--red); }

.action-btns { display: flex; gap: 6px; justify-content: flex-end; }
.action-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.action-btn.del:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }

/* ═══════════════════════════ ASSETS ═══ */
.asset-summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.asset-sum-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.asset-sum-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.asset-sum-value { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.asset-sum-value.negative { color: var(--red); }
.asset-sum-value.gold { color: var(--gold); }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.asset-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.asset-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-light); }
.asset-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.asset-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.asset-icon.real_estate { background: linear-gradient(135deg, rgba(240,180,41,0.2), rgba(240,180,41,0.05)); }
.asset-icon.savings     { background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(16,185,129,0.05)); }
.asset-icon.investment  { background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(59,130,246,0.05)); }
.asset-icon.vehicle     { background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(139,92,246,0.05)); }
.asset-icon.debt        { background: linear-gradient(135deg, rgba(239,68,68,0.2), rgba(239,68,68,0.05)); }
.asset-icon.other       { background: linear-gradient(135deg, rgba(107,114,128,0.2), rgba(107,114,128,0.05)); }

.asset-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.asset-note-text { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.asset-value { font-size: 20px; font-weight: 800; }
.asset-value.debt-val { color: var(--red); }
.asset-card-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ═══════════════════════════ BUDGET ═══ */
.budget-month-selector { margin-bottom: 20px; }
.budget-list { display: flex; flex-direction: column; gap: 16px; }
.budget-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.budget-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.budget-cat-name { font-size: 15px; font-weight: 700; }
.budget-vals { display: flex; gap: 16px; font-size: 13px; }
.spent-val { color: var(--red); font-weight: 600; }
.limit-val { color: var(--text-secondary); }
.budget-progress-bg { height: 8px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; }
.budget-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}
.budget-progress-fill.ok      { background: linear-gradient(90deg, var(--green), #34d399); }
.budget-progress-fill.warning { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.budget-progress-fill.over    { background: linear-gradient(90deg, var(--red), #f87171); }
.budget-pct { font-size: 11px; color: var(--text-secondary); margin-top: 6px; text-align: right; }

/* ═══════════════════════════ GOALS ═══ */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.goal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.goal-card-top { display: flex; align-items: center; gap: 14px; }
.goal-icon-badge {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.goal-name { font-size: 16px; font-weight: 700; }
.goal-deadline { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.goal-amounts { display: flex; justify-content: space-between; align-items: flex-end; }
.goal-current { font-size: 20px; font-weight: 800; color: var(--gold); }
.goal-target-label { font-size: 12px; color: var(--text-secondary); }
.goal-target-val { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.goal-bar-bg { height: 8px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; }
.goal-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.8s ease;
}
.goal-pct { font-size: 12px; color: var(--text-secondary); text-align: right; }
.goal-card-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ═══════════════════════════ REPORTS ═══ */
.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.report-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rk-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.rk-val { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.rk-val.gold { color: var(--gold); }
.rk-val.negative { color: var(--red); }

/* ═══════════════════════════ BUTTONS ═══ */
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #d4960a);
  color: #000;
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  box-shadow: var(--shadow-gold);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(240,180,41,0.4); }
.btn-primary.btn-full { width: 100%; padding: 14px; font-size: 15px; margin-top: 8px; }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--border-light); }

.btn-settings {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-settings:hover { background: var(--gold-dim); border-color: var(--gold); transform: rotate(20deg); }

/* ─── NAV BADGE ─── */
.nav-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--gold), #e08000);
  color: #000;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════ AUTOMATION PAGE ═══ */
.auto-status-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.auto-status-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}
.auto-status-item:hover { border-color: var(--border-light); }
.status-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
  position: relative;
}
.status-dot.active {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.2);
}
.status-dot.active::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(16,185,129,0.3);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0; }
}
.status-dot.connected { background: var(--gold); box-shadow: 0 0 0 4px rgba(240,180,41,0.2); }
.status-info { flex: 1; min-width: 0; }
.status-title { display: block; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.status-sub   { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.status-config-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all var(--transition);
}
.status-config-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

.auto-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.auto-feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
}
.auto-feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-light); }
.auto-feature-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.auto-feature-card h3 { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.auto-feature-card p  { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.auto-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  flex: 1;
}
.auto-feature-list li { font-size: 13px; color: var(--text-secondary); }

/* Quick Entry */
.quick-entry-demo { display: flex; flex-direction: column; gap: 10px; }
.qe-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.qe-input-row { display: flex; gap: 8px; }
.qe-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.qe-input:focus { border-color: var(--gold); }
.qe-input::placeholder { color: var(--text-muted); }
.qe-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.qe-hint {
  background: rgba(240,180,41,0.1);
  border: 1px solid rgba(240,180,41,0.2);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.qe-hint:hover { background: var(--gold-dim); }

/* Recurring List */
.recurring-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.recurring-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  margin-bottom: 10px;
  transition: all var(--transition);
}
.recurring-item:last-child { margin-bottom: 0; }
.recurring-item:hover { background: rgba(255,255,255,0.06); }
.rec-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.rec-info { flex: 1; min-width: 0; }
.rec-name { font-size: 14px; font-weight: 700; }
.rec-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.rec-amount { font-size: 16px; font-weight: 800; white-space: nowrap; }
.rec-amount.income  { color: var(--green); }
.rec-amount.expense { color: var(--red); }

/* Sync Log */
.sync-log-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.auto-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}
.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}
.log-time { color: var(--text-muted); white-space: nowrap; }
.log-icon { flex-shrink: 0; }
.log-msg  { color: var(--text-secondary); line-height: 1.4; }
.log-item.success .log-msg { color: var(--green); }
.log-item.error   .log-msg { color: var(--red); }
.log-item.info    .log-msg { color: var(--gold); }

/* Settings Modal */
.modal-wide { max-width: 620px !important; }
.settings-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: rgba(255,255,255,0.04);
  padding: 5px;
  border-radius: 12px;
}
.stab {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.stab.active { background: var(--bg-card); color: var(--gold); box-shadow: var(--shadow); }
.stab-content { display: none; }
.stab-content.active { display: block; }

.settings-info-box {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.settings-info-box strong { color: var(--text-primary); display: block; margin-bottom: 8px; }
.setup-steps { padding-left: 18px; margin: 8px 0 0; display: flex; flex-direction: column; gap: 5px; }
.setup-steps li { line-height: 1.5; }
.link-ext { color: var(--gold); text-decoration: none; }
.link-ext:hover { text-decoration: underline; }

.code-preview-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.code-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.code-preview {
  margin: 0;
  padding: 16px;
  font-size: 11px;
  color: #a8d5a2;
  background: rgba(0,0,0,0.3);
  overflow-x: auto;
  max-height: 260px;
  overflow-y: auto;
  font-family: 'Fira Code', 'Courier New', monospace;
  line-height: 1.6;
  white-space: pre;
}
.btn-copy {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.btn-copy:hover { border-color: var(--gold); color: var(--gold); }

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.checkbox-item {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 400 !important;
}
.checkbox-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* ═══════════════════════════ MODALS ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.25s ease; }
.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text-primary);
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.form-input option { background: var(--bg-modal); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── TYPE TOGGLE ─── */
.type-toggle { display: flex; gap: 8px; }
.type-btn {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.type-btn.active[data-type="expense"] { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.type-btn.active[data-type="income"]  { background: var(--green-dim); color: var(--green); border-color: var(--green); }

/* ═══════════════════════════ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════════════ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 1000;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--gold); }

/* ═══════════════════════════ SIDEBAR BACKDROP ═══ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}

/* ═══════════════════════════ RESPONSIVE ═══ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
  .report-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); --sidebar-w: 260px; }
  .sidebar-backdrop.open { display: block; }
  .hamburger { display: flex; }
  .topbar { left: 0; }
  .main-content { margin-left: 0; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .asset-summary-bar { grid-template-columns: 1fr; }
  .report-kpi-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .main-content { padding: calc(var(--topbar-h) + 20px) 16px 30px; }
  .form-row { grid-template-columns: 1fr; }
  .date-badge { display: none; }
  .btn-add-tx { padding: 9px 14px; font-size: 12px; }
  .filter-bar { flex-direction: column; }
  .filter-search { min-width: unset; }
}
