/* ─── TOKENS ─────────────────────────────────────────── */
:root {
  --bg: #0b0c10;
  --bg-2: #12141a;
  --bg-3: #1a1d26;
  --bg-4: #22263a;
  --border: rgba(255,255,255,0.07);
  --border-active: rgba(255,255,255,0.15);
  --text: #eef0f6;
  --text-2: #9198b0;
  --text-3: #555e7a;
  --accent: #7c6af7;
  --accent-2: #9f94f9;
  --accent-glow: rgba(124,106,247,0.25);
  --green: #34d399;
  --green-dim: rgba(52,211,153,0.15);
  --red: #f87171;
  --red-dim: rgba(248,113,113,0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251,191,36,0.12);
  --sidebar-w: 220px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-2: #ffffff;
  --bg-3: #eef0f6;
  --bg-4: #e3e6f0;
  --border: rgba(0,0,0,0.07);
  --border-active: rgba(0,0,0,0.15);
  --text: #1a1d2e;
  --text-2: #4e5573;
  --text-3: #9198b0;
  --accent-glow: rgba(124,106,247,0.15);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ─── RESET & BASE ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  display: flex;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition), background var(--transition);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  padding: 0 8px;
}
.logo-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--bg-3); }
.nav-item.active {
  color: var(--accent-2);
  background: var(--accent-glow);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.sidebar-bottom { padding-top: 20px; border-top: 1px solid var(--border); }

/* Theme Toggle */
.theme-toggle-wrap { display: flex; align-items: center; gap: 8px; padding: 8px; }
.toggle-label { font-size: 0.75rem; color: var(--text-3); font-family: var(--font-mono); }
.theme-toggle {
  width: 40px; height: 22px;
  background: var(--bg-4);
  border: 1px solid var(--border-active);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: var(--text-2);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
[data-theme="light"] .toggle-knob {
  transform: translateX(18px);
  background: var(--accent);
}

/* ─── MOBILE HEADER ───────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  justify-content: space-between;
  z-index: 200;
}
.hamburger {
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
.mobile-logo { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.role-badge-mobile { font-size: 0.7rem; font-family: var(--font-mono); padding: 3px 8px; border-radius: 20px; background: var(--accent-glow); color: var(--accent-2); }

/* ─── MAIN CONTENT ────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  min-height: 100vh;
  max-width: 1400px;
  transition: margin var(--transition);
}

/* ─── TOPBAR ──────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.page-subtitle { color: var(--text-2); font-size: 0.85rem; margin-top: 4px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.role-label { font-size: 0.72rem; font-family: var(--font-mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.role-switcher { display: flex; align-items: center; gap: 8px; }
.role-select-wrap { position: relative; }
.role-select {
  background: var(--bg-3);
  border: 1px solid var(--border-active);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 7px 32px 7px 12px;
  border-radius: var(--radius-sm);
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.role-select:focus { outline: none; border-color: var(--accent); }
.role-select-wrap::after {
  content: '▾';
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-2); font-size: 0.8rem;
}
.export-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border-active);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.export-btn svg { width: 15px; height: 15px; }
.export-btn:hover { background: var(--bg-4); border-color: var(--accent); color: var(--accent-2); }

/* ─── SECTION ─────────────────────────────────────────── */
.section { animation: fadeUp 0.35s ease both; }
.section.hidden { display: none; }

/* ─── SUMMARY CARDS ───────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeUp 0.4s ease both;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-active); }
.card-label {
  font-size: 0.75rem;
  color: var(--text-2);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.card-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.card-trend {
  font-size: 0.78rem;
  font-family: var(--font-mono);
}
.card-trend.positive { color: var(--green); }
.card-trend.negative { color: var(--red); }
.card-bg-shape {
  position: absolute;
  right: -20px; bottom: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.07;
}
.card-balance .card-bg-shape { background: var(--accent); }
.card-income .card-bg-shape { background: var(--green); }
.card-expense .card-bg-shape { background: var(--red); }
.card-savings .card-bg-shape { background: var(--yellow); }
.card-balance { border-top: 2px solid var(--accent); }
.card-income { border-top: 2px solid var(--green); }
.card-expense { border-top: 2px solid var(--red); }
.card-savings { border-top: 2px solid var(--yellow); }
.card-balance .card-value { color: var(--accent-2); }
.card-income .card-value { color: var(--green); }
.card-expense .card-value { color: var(--red); }
.card-savings .card-value { color: var(--yellow); }

/* ─── CHARTS ──────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  animation: fadeUp 0.4s ease both;
  transition: border-color var(--transition);
}
.chart-card.full-width { width: 100%; }
.chart-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.chart-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.chart-subtitle { color: var(--text-2); font-size: 0.78rem; margin-top: 2px; }
.chart-wrap { position: relative; height: 220px; }
.donut-wrap { height: 200px; }
.tall-chart { height: 280px; }
.chart-tabs { display: flex; gap: 4px; }
.chart-tab {
  background: none; border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.chart-tab.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-2);
}
.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
}
.legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.73rem; color: var(--text-2);
}
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─── RECENT TX CARD ──────────────────────────────────── */
.recent-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  animation: fadeUp 0.4s ease both;
}
.section-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}
.section-sub { color: var(--text-2); font-size: 0.78rem; margin-top: 2px; }
.view-all-btn {
  background: none; border: none;
  color: var(--accent-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: opacity var(--transition);
}
.view-all-btn:hover { opacity: 0.7; }

/* ─── TX LIST ─────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; gap: 2px; }
.tx-row {
  display: flex; align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.tx-row:hover { background: var(--bg-3); }
.tx-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.tx-icon.income { background: var(--green-dim); }
.tx-icon.expense { background: var(--red-dim); }
.tx-info { flex: 1; min-width: 0; }
.tx-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-meta { font-size: 0.75rem; color: var(--text-2); font-family: var(--font-mono); margin-top: 1px; }
.tx-cat {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-3);
  color: var(--text-2);
  white-space: nowrap;
}
.tx-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 80px;
  text-align: right;
}
.tx-amount.income { color: var(--green); }
.tx-amount.expense { color: var(--red); }

/* ─── TRANSACTIONS TABLE ──────────────────────────────── */
.tx-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.search-wrap {
  position: relative;
  max-width: 380px;
}
.search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-active);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 9px 12px 9px 38px;
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-3); }
.filter-row {
  display: flex; align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-select {
  background: var(--bg-2);
  border: 1px solid var(--border-active);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 7px 28px 7px 10px;
  border-radius: var(--radius-sm);
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239198b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 14px;
}
.filter-select:focus { outline: none; border-color: var(--accent); }
.add-tx-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-left: auto;
}
.add-tx-btn svg { width: 14px; height: 14px; }
.add-tx-btn:hover { background: var(--accent-2); transform: translateY(-1px); }

.tx-table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tx-table { width: 100%; border-collapse: collapse; }
.tx-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.tx-table td {
  padding: 11px 16px;
  font-size: 0.865rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.tx-table tbody tr:last-child td { border-bottom: none; }
.tx-table tbody tr:hover td { background: var(--bg-3); }
.type-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.type-badge.income { background: var(--green-dim); color: var(--green); }
.type-badge.expense { background: var(--red-dim); color: var(--red); }
.amount-cell { font-family: var(--font-mono); font-weight: 500; }
.amount-cell.income { color: var(--green); }
.amount-cell.expense { color: var(--red); }
.action-btns { display: flex; gap: 6px; }
.btn-edit, .btn-del {
  background: none;
  border: 1px solid var(--border-active);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-edit { color: var(--accent-2); }
.btn-edit:hover { background: var(--accent-glow); border-color: var(--accent); }
.btn-del { color: var(--red); }
.btn-del:hover { background: var(--red-dim); border-color: var(--red); }

.empty-state {
  padding: 60px 20px;
  text-align: center;
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-text { font-family: var(--font-display); font-weight: 600; color: var(--text-2); font-size: 1rem; }
.empty-sub { color: var(--text-3); font-size: 0.82rem; margin-top: 4px; }

/* Pagination */
.pagination {
  display: flex; align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.page-btn {
  background: var(--bg-2);
  border: 1px solid var(--border-active);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.page-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent-2); }
.page-btn:disabled { opacity: 0.35; cursor: default; }

/* ─── INSIGHTS ────────────────────────────────────────── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.insight-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform var(--transition), border-color var(--transition);
  animation: fadeUp 0.4s ease both;
}
.insight-card:hover { transform: translateY(-2px); border-color: var(--border-active); }
.insight-card.insight-highlight { border-top: 2px solid var(--accent); }
.insight-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.insight-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.insight-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.insight-detail { font-size: 0.78rem; color: var(--text-2); }

/* Category Breakdown */
.category-breakdown { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.cat-row { display: flex; align-items: center; gap: 12px; }
.cat-name { width: 110px; font-size: 0.82rem; color: var(--text-2); flex-shrink: 0; }
.cat-bar-wrap { flex: 1; height: 8px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.cat-bar { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.cat-amount { font-family: var(--font-mono); font-size: 0.8rem; min-width: 72px; text-align: right; }
.cat-pct { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); width: 38px; text-align: right; }

/* ─── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-sm { max-width: 380px; }
.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}
.modal-close {
  background: none; border: none;
  color: var(--text-2);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal-body { padding: 20px 22px; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-active);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.btn-cancel {
  background: var(--bg-3);
  border: 1px solid var(--border-active);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-cancel:hover { color: var(--text); }
.btn-save {
  background: var(--accent);
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-save:hover { background: var(--accent-2); }
.btn-delete {
  background: var(--red);
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-delete:hover { opacity: 0.85; }
.delete-msg { color: var(--text-2); font-size: 0.875rem; line-height: 1.5; }

/* ─── ROLE ────────────────────────────────────────────── */
[data-role="viewer"] .admin-only { display: none !important; }

/* ─── STAGGER ANIMATIONS ──────────────────────────────── */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1200px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .chart-small { max-width: 100%; }
  .donut-wrap { height: 260px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.4); }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; padding: 80px 16px 24px; }
  .overlay-bg {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 99; display: none;
  }
  .overlay-bg.show { display: block; }
}

@media (max-width: 640px) {
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .insights-grid { grid-template-columns: 1fr 1fr; }
  .card-value { font-size: 1.4rem; }
  .page-title { font-size: 1.4rem; }
  .topbar { flex-direction: column; align-items: stretch; }
  .tx-table th:nth-child(2), .tx-table td:nth-child(2) { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .filter-row { gap: 6px; }
  .filter-select { font-size: 0.78rem; }
}

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