/* Ascent.fn() Dashboard — Design System v2
   Warm midnight glassmorphism + light/dark theming
   Sprint 26: Original palette, WCAG AA compliant */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ═══════════════════════════════════════════
   DESIGN TOKENS — Dark Mode (default)
   Palette: "Midnight Plum" — aubergine + violet + copper-gold
   ═══════════════════════════════════════════ */
:root {
  /* ── Backgrounds — aubergine-charcoal (unique, not navy) ── */
  --bg: #130F1A;
  --bg-gradient: linear-gradient(135deg, #130F1A 0%, #17121F 40%, #1A1425 100%);
  --bg-card: #1C1726;
  --bg-elevated: #241E30;
  --bg-hover: #2A2338;

  /* ── Glass (preserved for glassmorphism cards) ── */
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --glass-blur: 20px;

  /* ── Brand / Primary — Rich violet-blue (not teal, not cornflower) ── */
  --brand: #7C6AE8;
  --brand-rgb: 124, 106, 232;
  --brand-hover: #9585F0;
  --brand-glow: rgba(124, 106, 232, 0.15);

  /* ── Accent — Warm copper-gold (wealth + warmth) ── */
  --accent: #D4944C;
  --accent-rgb: 212, 148, 76;
  --accent-hover: #E0A865;
  --accent-glow: rgba(212, 148, 76, 0.15);

  /* ── Semantic colors ── */
  --success: #5C9E6B;
  --success-rgb: 92, 158, 107;
  --success-glow: rgba(92, 158, 107, 0.15);

  --warning: #E6B800;
  --warning-rgb: 230, 184, 0;
  --warning-glow: rgba(230, 184, 0, 0.15);

  --danger: #C97070;
  --danger-rgb: 201, 112, 112;
  --danger-glow: rgba(201, 112, 112, 0.15);

  --info: #5BABDE;
  --info-rgb: 91, 171, 222;
  --info-glow: rgba(91, 171, 222, 0.15);

  /* ── Legacy aliases (for backward compat during migration) ── */
  --accent-glow-border: rgba(124, 106, 232, 0.12);
  --purple: #a78bfa;
  --pink: #f472b6;
  --gold: #D4944C;
  --amber: #E6B800;

  /* ── Text — warm pearl over aubergine ── */
  --text: #EAE6E1;
  --text-secondary: #A09CB0;
  --text-dim: #918DA6;

  /* ── Borders ── */
  --border: #2A2340;
  --border-strong: #3A3350;

  /* ── Radii ── */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-full: 9999px;

  /* ── Spacing tokens ── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ── Typography scale ── */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.25rem;    /* 20px */
  --text-xl: 1.5rem;     /* 24px */
  --text-2xl: 2rem;      /* 32px */

  /* ── Shadows ── */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(124, 106, 232, 0.1);

  /* ── Transitions ── */
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════
   LIGHT MODE — Warm ivory + deep violet
   ═══════════════════════════════════════════ */
[data-theme="light"] {
  --bg: #FAF7F2;
  --bg-gradient: linear-gradient(135deg, #FAF7F2 0%, #F5F1EA 40%, #EFE9E0 100%);
  --bg-card: #FFFFFF;
  --bg-elevated: #F2EDE4;
  --bg-hover: #EAE4DA;

  --glass: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-hover: rgba(0, 0, 0, 0.05);

  --brand: #5C4AC7;
  --brand-rgb: 92, 74, 199;
  --brand-hover: #4A3AAF;
  --brand-glow: rgba(92, 74, 199, 0.1);

  --accent: #B87A30;
  --accent-rgb: 184, 122, 48;
  --accent-hover: #A06A25;
  --accent-glow: rgba(184, 122, 48, 0.1);

  --success: #3D7A3D;
  --success-rgb: 61, 122, 61;
  --success-glow: rgba(61, 122, 61, 0.1);

  --warning: #CC9E00;
  --warning-rgb: 204, 158, 0;
  --warning-glow: rgba(204, 158, 0, 0.1);

  --danger: #B34545;
  --danger-rgb: 179, 69, 69;
  --danger-glow: rgba(179, 69, 69, 0.1);

  --info: #3070B3;
  --info-rgb: 48, 112, 179;
  --info-glow: rgba(48, 112, 179, 0.1);

  --accent-glow-border: rgba(92, 74, 199, 0.1);
  --purple: #6D4FC0;
  --pink: #B84080;
  --gold: #B87A30;
  --amber: #CC9E00;

  --text: #2A2530;
  --text-secondary: #5E5870;
  --text-dim: #8A8498;

  --border: #E5DED4;
  --border-strong: #D5CEC4;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 20px rgba(92, 74, 199, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ═══════════════════════════════════════════
   PERFORMANCE — 60fps everywhere
   ═══════════════════════════════════════════ */

/* Isolate card repaints — each card is its own layer boundary */
.card, .badge-card-earned, .badge-card-locked, .toast,
.achievement-banner, .milestone-content {
  contain: layout style paint;
}

/* GPU-promote elements that animate transform/opacity */
.card:hover, .badge-card-earned:hover, .toast-visible,
.achievement-banner, .milestone-content, .confetti-particle,
.loading-spinner, .skeleton-card::after {
  will-change: transform, opacity;
}

/* Reduced motion — respect user preference, kill non-essential animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card:hover { transform: none; }
  .badge-card-earned:hover { transform: none; }
  .confetti-particle { display: none; }
}

/* Ambient background orbs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 500px; height: 500px;
  background: var(--brand);
  top: -100px; right: -100px;
}
body::after {
  width: 400px; height: 400px;
  background: var(--accent);
  bottom: -50px; left: -50px;
}
/* Light mode: hide ambient orbs */
[data-theme="light"] body::before,
[data-theme="light"] body::after {
  opacity: 0;
}

/* ── Focus & Interaction States ── */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Active press state for interactive elements */
.nav-tab:active, button:active, .card:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Skip-to-content for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Theme transition — scoped to avoid perf issues */
.card, .nav-bar, .nav-tab, button, .header, .phase-badge {
  transition: background-color var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out);
}

/* Header */
.header {
  position: relative;
  z-index: 1;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header h1 span {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.status-dot.connected {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.status-dot.disconnected { background: var(--text-dim); }

/* Phase badge */
.phase-badge {
  background: rgba(255, 92, 92, 0.15);
  color: var(--danger);
  border: 1px solid rgba(255, 92, 92, 0.25);
  padding: 6px 18px;
  border-radius: 24px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.phase-badge.phase-2 { background: var(--warning-glow); color: var(--warning); border-color: rgba(255, 179, 71, 0.25); }
.phase-badge.phase-3 { background: var(--info-glow); color: var(--info); border-color: rgba(92, 200, 255, 0.25); }
.phase-badge.phase-4 { background: rgba(59, 130, 246, 0.15); color: #5b9cff; border-color: rgba(59, 130, 246, 0.25); }
.phase-badge.phase-5 { background: rgba(167, 139, 250, 0.15); color: var(--purple); border-color: rgba(167, 139, 250, 0.25); }
.phase-badge.phase-6 { background: var(--accent-glow); color: var(--accent); border-color: rgba(var(--accent-rgb), 0.25); }
.phase-badge.phase-7 { background: rgba(251, 191, 36, 0.15); color: var(--gold); border-color: rgba(251, 191, 36, 0.25); }

/* Grid */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Glass cards */
.card {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  /* Specific properties only — never use 'all' (causes layout thrash) */
  transition: background-color var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.card-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-weight: 700;
}

.card-full { grid-column: 1 / -1; }

.card-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.9rem;
}

/* Stats */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; }
.stat-value { font-weight: 700; font-size: 1.05rem; }
.stat-value.danger { color: var(--danger); }
.stat-value.warning { color: var(--warning); }
.stat-value.success { color: var(--success); }
.stat-value.info { color: var(--info); }

/* Big number */
.big-number {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

.big-number.debt-color {
  background: linear-gradient(135deg, var(--danger), var(--warning));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.big-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: 500;
}

/* Debt items */
.debt-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.debt-item:last-child { border-bottom: none; }

.debt-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.debt-item-name {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

.debt-item-when {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.debt-item-reason {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-weight: 500;
}

/* Legacy debt bar name (keep for compat) */
.debt-bar-name {
  width: 100px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.debt-bar-track {
  flex: 1;
  height: 22px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  overflow: hidden;
}

.debt-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s ease;
  position: relative;
}

.debt-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.15), transparent);
  border-radius: 6px 6px 0 0;
}

.debt-bar-amount {
  width: 80px;
  text-align: right;
  font-weight: 700;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.late-tag {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(255, 92, 92, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 6px;
}

/* Charts */
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Timeline */
.timeline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  margin-top: 16px;
}

.timeline-bar {
  flex: 1;
  border-radius: 6px 6px 0 0;
  position: relative;
  min-width: 30px;
  transition: height 1s ease;
}

.timeline-bar .label {
  position: absolute;
  bottom: -24px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  font-weight: 500;
}

.timeline-bar .amount {
  position: absolute;
  top: -20px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Actions */
.action-list {
  list-style: none;
  counter-reset: actions;
}

.action-list li {
  counter-increment: actions;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
  font-weight: 500;
}

.action-list li:last-child { border-bottom: none; }

.action-list li::before {
  content: counter(actions);
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  width: 26px; height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.action-list li.critical::before {
  background: var(--danger-glow);
  color: var(--danger);
  border-color: rgba(255, 92, 92, 0.3);
}

.action-list li.warning::before {
  background: var(--warning-glow);
  color: var(--warning);
  border-color: rgba(255, 179, 71, 0.3);
}

/* Budget progress bars */
.budget-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}

.budget-label {
  width: 120px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: capitalize;
}

.budget-track {
  flex: 1;
  min-width: 0;
  height: 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 7px;
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.5s ease;
}

.budget-fill.under { background: linear-gradient(90deg, var(--accent), #00e6b8); }
.budget-fill.near { background: linear-gradient(90deg, var(--warning), #ffc95c); }
.budget-fill.over { background: linear-gradient(90deg, var(--danger), #ff7e7e); }

.budget-amounts {
  width: 80px;
  min-width: 80px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.budget-amounts-grid {
  display: grid;
  grid-template-columns: 60px 60px 70px;
  gap: 4px;
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Heatmap detail panel */
.heatmap-detail-panel {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Milestone & celebration */
.milestone-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-rgb), 0.05));
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  color: var(--accent);
  animation: milestone-glow 2s ease-in-out infinite alternate;
}

@keyframes milestone-glow {
  from { box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.1); }
  to { box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.25); }
}

.pulse-badge {
  float: right;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  padding: 2px 8px;
  border-radius: 20px;
  animation: pulse-accent 2s ease-in-out infinite;
}

@keyframes pulse-accent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Credit score gauge */
.credit-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
}

.credit-gauge {
  position: relative;
  width: 180px;
  height: 100px;
  overflow: hidden;
}

.credit-gauge-bg,
.credit-gauge-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  clip-path: inset(0 0 50% 0);
}

.credit-gauge-bg {
  background: conic-gradient(from 180deg,
    var(--danger) 0deg,
    var(--danger) 36deg,
    var(--warning) 54deg,
    var(--gold) 90deg,
    var(--accent) 126deg,
    #2dd4bf 162deg,
    #2dd4bf 180deg,
    transparent 180deg
  );
  opacity: 0.15;
}

.credit-gauge-fill {
  background: conic-gradient(from 180deg,
    var(--danger) 0deg,
    var(--danger) 36deg,
    var(--warning) 54deg,
    var(--gold) 90deg,
    var(--accent) 126deg,
    #2dd4bf 162deg,
    #2dd4bf 180deg,
    transparent 180deg
  );
  clip-path: inset(0 0 50% 0);
  mask: conic-gradient(from 180deg, #000 0deg, #000 calc(var(--gauge-pct) * 180deg), transparent calc(var(--gauge-pct) * 180deg));
  -webkit-mask: conic-gradient(from 180deg, #000 0deg, #000 calc(var(--gauge-pct) * 180deg), transparent calc(var(--gauge-pct) * 180deg));
}

.credit-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 2px;
  height: 80px;
  background: var(--text);
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(calc(var(--needle-deg) - 90deg));
  border-radius: 2px;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.credit-needle::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--text);
  border-radius: 50%;
}

.credit-gauge-labels {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  color: var(--text-dim);
  padding: 0 4px;
}

.credit-score-display {
  text-align: center;
  margin-top: -6px;
}

/* Phase roadmap */
.phase-roadmap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.phase-step {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  position: relative;
}

.phase-step.active {
  background: linear-gradient(135deg, rgba(197, 160, 40, 0.15), rgba(197, 160, 40, 0.08));
  border-color: rgba(197, 160, 40, 0.4);
  color: #e8c840;
  box-shadow: 0 0 20px rgba(197, 160, 40, 0.1);
  animation: pulse-phase 2s ease-in-out infinite;
}

@keyframes pulse-phase {
  0%, 100% { box-shadow: 0 0 12px rgba(197, 160, 40, 0.08); }
  50% { box-shadow: 0 0 20px rgba(197, 160, 40, 0.18); }
}

.phase-step.completed {
  background: var(--accent-glow);
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
}

.phase-step.locked { opacity: 0.35; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-dim);
  font-weight: 500;
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Sync indicator */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

.sync-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { opacity: 0.5; box-shadow: 0 0 0 6px transparent; }
}

/* Privacy toggle */
.privacy-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
  backdrop-filter: blur(10px);
}
.privacy-btn:hover {
  background: var(--glass-hover);
  border-color: rgba(255,255,255,0.15);
}
.privacy-btn.active {
  background: var(--danger-glow);
  border-color: rgba(255, 92, 92, 0.3);
  color: var(--danger);
}

/* Lesson cards */
.lesson-card {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s var(--ease-out);
}
.lesson-card:last-child { border-bottom: none; }
.lesson-card:hover { background: rgba(255, 255, 255, 0.03); }

/* Lesson modal */
.lesson-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lesson-modal-content {
  background: var(--bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

.lesson-modal-content h1 { font-size: 1.3rem; margin-bottom: 16px; color: var(--text); }
.lesson-modal-content h2 { font-size: 1rem; margin: 20px 0 10px; color: var(--accent); font-weight: 700; }
.lesson-modal-content p { font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary); margin-bottom: 12px; }
.lesson-modal-content ul, .lesson-modal-content ol { margin: 8px 0 12px 20px; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; }
.lesson-modal-content strong { color: var(--text); }
.lesson-modal-content code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }
.lesson-modal-content hr { border: none; border-top: 1px solid var(--glass-border); margin: 24px 0; }

.lesson-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lesson-close:hover { background: var(--glass-hover); }

.lesson-complete-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--accent-glow);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.lesson-complete-btn:hover {
  background: rgba(var(--accent-rgb), 0.25);
  transform: translateY(-1px);
}

/* Bill Calendar */
.bill-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bill-row {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s;
}
.bill-row:hover { background: rgba(255, 255, 255, 0.04); }

.bill-row-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bill-merchant {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bill-amount {
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bill-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.bill-due {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 500;
}

.bill-urgency-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid;
}

.bill-source-tag {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.bill-source-tag.debt {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(255, 92, 92, 0.2);
}
.bill-source-tag.sub {
  background: rgba(167, 139, 250, 0.12);
  color: var(--purple);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

/* Recurring Subscriptions */
.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recurring-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s;
  border-left: 3px solid var(--purple);
}
.recurring-item:hover { background: rgba(255, 255, 255, 0.04); }

.recurring-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recurring-merchant {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.recurring-amount {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
}

.recurring-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.recurring-freq {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.recurring-confidence {
  font-size: 0.65rem;
  letter-spacing: 2px;
}

.recurring-next {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: auto;
}

/* Alert Banners */
.alert-strip {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  backdrop-filter: blur(10px);
}

.alert-icon {
  font-weight: 900;
  font-size: 0.7rem;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.alert-content {
  flex: 1;
  color: var(--text);
}

.alert-content strong {
  font-weight: 700;
}

.alert-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.alert-dismiss:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

/* Scheduled bill source tag */
.bill-source-tag.sched {
  color: var(--info);
  border-color: var(--info);
}

/* ============================================================
   Navigation Bar
   ============================================================ */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 24px;
  background: rgba(19, 15, 26, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
}
[data-theme="light"] .nav-bar {
  background: rgba(250, 247, 242, 0.92);
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
  cursor: pointer;
  user-select: none;
  position: relative;
}

.nav-tab .nav-dot {
  position: absolute;
  top: 4px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--bg);
}

.nav-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-icon {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   Page Container + Transitions
   ============================================================ */
.page-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  min-height: 60vh;
  animation: pageFadeIn 0.2s ease;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card grid — replaces old .grid */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* ============================================================
   Loading States
   ============================================================ */
.page-loading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 0;
}

.skeleton-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 160px;
  position: relative;
  overflow: hidden;
}
.skeleton-card.full { grid-column: 1 / -1; min-height: 100px; }
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.skeleton-line.title { width: 40%; height: 14px; margin-bottom: 20px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.long  { width: 85%; }
.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%);
  animation: shimmer 1.8s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50%      { transform: scale(1.2); opacity: 0.6; }
}

.page-empty, .page-error {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.page-error button {
  margin-top: 12px;
  padding: 8px 20px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.page-error button:hover {
  background: var(--accent-glow);
}

/* ============================================================
   Settings — Toggle Switch + Roadmap Timeline
   ============================================================ */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(var(--accent-rgb), 0.25);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

.roadmap-timeline {
  position: relative;
  padding: 8px 0;
}
.roadmap-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 8px 0;
  position: relative;
}
.roadmap-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  position: relative;
  z-index: 1;
}
.roadmap-step.active .roadmap-dot {
  background: rgba(92,200,255,0.12);
  border-color: var(--info);
  box-shadow: 0 0 12px rgba(92,200,255,0.2);
}
.roadmap-step.completed .roadmap-dot {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: var(--accent);
}
.roadmap-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 36px;
  width: 2px;
  height: calc(100% - 20px);
  background: var(--glass-border);
}
.roadmap-step.completed:not(:last-child)::before {
  background: var(--accent);
  opacity: 0.4;
}
.roadmap-content {
  padding-top: 3px;
}

/* ============================================================
   Toast / Celebration System
   ============================================================ */
/* ============================================================
   Apple Glass iOS Notification System
   ============================================================ */
#toast-container {
  position: fixed;
  top: 24px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 18px;
  border-radius: 20px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Micro-win toast — subtle glass pill */
.toast-micro {
  background: rgba(28, 23, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow:
    0 2px 16px rgba(0,0,0,0.3),
    0 0 0 0.5px rgba(255,255,255,0.06) inset;
}

/* Achievement toast — accent glow glass */
.toast-achievement {
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow:
    0 4px 24px rgba(var(--accent-rgb), 0.12),
    0 0 0 0.5px rgba(var(--accent-rgb), 0.1) inset,
    0 0 60px -12px rgba(var(--accent-rgb), 0.08);
}

/* Badge toast — with emblem */
.toast-badge {
  background: rgba(28, 23, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.35),
    0 0 0 0.5px rgba(255,255,255,0.08) inset;
  padding: 12px 18px 12px 14px;
}

.toast-badge .toast-emblem {
  flex-shrink: 0;
}

.toast-badge .toast-body {
  flex: 1;
  min-width: 0;
}

.toast-badge .toast-badge-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.toast-badge .toast-badge-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* XP gain pill */
.toast-xp {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
  font-weight: 700;
  color: var(--purple);
  font-size: 0.8rem;
  padding: 10px 18px;
}

/* Level up toast — gold shimmer */
.toast-levelup {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.08) 100%);
  border: 1px solid rgba(251, 191, 36, 0.25);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow:
    0 4px 30px rgba(251, 191, 36, 0.15),
    0 0 0 0.5px rgba(251, 191, 36, 0.12) inset;
}

/* Milestone overlay — Apple full-screen modal */
.milestone-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.milestone-overlay.milestone-visible {
  opacity: 1;
}

.milestone-content {
  text-align: center;
  padding: 48px 40px;
  background: rgba(28, 23, 38, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  max-width: 420px;
  box-shadow:
    0 24px 80px rgba(0,0,0,0.4),
    0 0 0 0.5px rgba(255,255,255,0.08) inset;
  transform: scale(0.9);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.milestone-visible .milestone-content {
  transform: scale(1);
}

.milestone-emblem {
  margin-bottom: 20px;
}

.milestone-title {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.milestone-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}

.milestone-dismiss {
  padding: 12px 36px;
  border: none;
  background: var(--accent);
  color: #130F1A;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: background-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.milestone-dismiss:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}

/* ============================================================
   Badge Emblem System — SVG-based tier icons
   ============================================================ */
.badge-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  position: relative;
  flex-shrink: 0;
}

.badge-emblem-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.badge-emblem-lg {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.badge-emblem-xl {
  width: 80px;
  height: 80px;
  border-radius: 22px;
}

/* Tier backgrounds with gradients */
.badge-emblem.tier-bronze {
  background: linear-gradient(145deg, #cd7f32 0%, #b5651d 50%, #8b4513 100%);
  box-shadow: 0 2px 12px rgba(205, 127, 50, 0.3), 0 0 0 1px rgba(205, 127, 50, 0.2) inset;
}

.badge-emblem.tier-silver {
  background: linear-gradient(145deg, #e8e8e8 0%, #c0c0c0 40%, #a8a8a8 100%);
  box-shadow: 0 2px 12px rgba(192, 192, 192, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

.badge-emblem.tier-gold {
  background: linear-gradient(145deg, #ffd700 0%, #ffb800 40%, #e6a800 100%);
  box-shadow: 0 2px 16px rgba(255, 215, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
}

.badge-emblem.tier-platinum {
  background: linear-gradient(145deg, #a5b4fc 0%, #818cf8 40%, #6366f1 100%);
  box-shadow: 0 2px 16px rgba(129, 140, 248, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.badge-emblem.tier-legendary {
  background: linear-gradient(145deg, #00d4aa 0%, #00b894 30%, #8b5cf6 70%, #f472b6 100%);
  box-shadow: 0 2px 20px rgba(0, 212, 170, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: legendaryShimmer 3s ease-in-out infinite;
}

@keyframes legendaryShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

/* Emblem inner icon text */
.badge-emblem-icon {
  font-size: 18px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.75);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
  line-height: 1;
  letter-spacing: -0.5px;
}

.badge-emblem-sm .badge-emblem-icon { font-size: 14px; }
.badge-emblem-lg .badge-emblem-icon { font-size: 24px; }
.badge-emblem-xl .badge-emblem-icon { font-size: 30px; }

/* Unearned badge — locked state */
.badge-emblem.locked {
  background: rgba(36, 30, 48, 0.6);
  box-shadow: none;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.badge-emblem.locked .badge-emblem-icon {
  color: rgba(255, 255, 255, 0.15);
  text-shadow: none;
}

/* Badge grid for showcase */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.badge-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition: background-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  cursor: default;
}

.badge-cell:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
}

.badge-cell.earned {
  border-color: rgba(255, 255, 255, 0.12);
}

.badge-cell-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}

.badge-cell.locked .badge-cell-name {
  color: var(--text-dim);
}

.badge-cell-desc {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.3;
}

/* Badge category headers */
.badge-category {
  margin-bottom: 16px;
}

.badge-category-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--glass-border);
}

/* ============================================================
   XP Bar & Level Display
   ============================================================ */
.xp-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.xp-level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--purple), #6366f1);
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
}

.xp-bar-info {
  flex: 1;
  min-width: 0;
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.xp-bar-level-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.xp-bar-xp-text {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.xp-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--purple), #818cf8);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Streak display */
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(var(--warning-rgb), 0.1);
  border: 1px solid rgba(var(--warning-rgb), 0.2);
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--warning);
}

/* Confetti particles for milestones */
.confetti-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 10001;
  animation: confettiFall 2.5s ease-in forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) scale(0.3); opacity: 0; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
  .page-container { padding: 16px; }
  .header { padding: 16px; flex-direction: column; gap: 12px; }
  .big-number { font-size: 2.2rem; }
  .debt-bar-name { width: 80px; }
  .budget-label { width: 80px; }

  /* Bottom tab bar on mobile */
  .nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    justify-content: space-around;
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    border-bottom: none;
    border-top: 1px solid var(--glass-border);
    background: rgba(19, 15, 26, 0.96);
  }
  [data-theme="light"] .nav-bar {
    background: rgba(250, 247, 242, 0.96);
  }

  .nav-tab {
    padding: 6px 8px;
  }

  .nav-label {
    display: none;  /* Icon-only on mobile — labels overflow at 375px with 6 tabs */
  }

  /* Space for bottom nav */
  .page-container {
    padding-bottom: 80px;
  }

  #toast-container {
    bottom: 100px;
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }

  /* Debt page mobile fixes */
  .card { overflow-x: auto; }
  .card-full { overflow-x: auto; }
}

/* Keep old .grid class for backwards compat during transition */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; padding: 16px; }
}

/* Heatmap custom tooltip */
.heatmap-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(19, 15, 26, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.72rem;
  color: var(--text);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transition: opacity 0.15s ease;
  max-width: 200px;
}
.heatmap-tooltip .ht-date { color: var(--text-dim); font-size: 0.65rem; margin-bottom: 4px; }
.heatmap-tooltip .ht-amount { font-size: 1rem; font-weight: 800; margin-bottom: 2px; }
.heatmap-tooltip .ht-merchant { color: var(--text-secondary); font-size: 0.65rem; }
.heatmap-tooltip .ht-vs { font-size: 0.6rem; margin-top: 4px; }

/* Interactive lesson slides */
.il-slide { min-height: 280px; }
.il-slide-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 900; color: #080d1a;
}
.il-slide h2 { font-size: 1.2rem; font-weight: 800; }
.il-slide p { margin: 0; }
.il-slide input[type="number"] { outline: none; }
.il-slide input[type="number"]:focus { border-color: var(--purple); }

/* ============================================================
   Achievement Banner — Xbox/PlayStation-style Popup
   ============================================================ */
#achievement-banner-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.achievement-banner {
  display: flex;
  align-items: stretch;
  max-width: 420px;
  min-width: 340px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(28, 23, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-80px) scale(0.92);
  animation: achievementSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
}

.achievement-banner.achievement-dismissing {
  animation: achievementSlideOut 0.4s ease-in forwards;
}

/* Tier accent bar on left */
.achievement-accent {
  width: 5px;
  flex-shrink: 0;
}
.achievement-accent.tier-bronze    { background: linear-gradient(180deg, #cd7f32, #8b4513); }
.achievement-accent.tier-silver    { background: linear-gradient(180deg, #e8e8e8, #a8a8a8); }
.achievement-accent.tier-gold      { background: linear-gradient(180deg, #ffd700, #e6a800); }
.achievement-accent.tier-platinum  { background: linear-gradient(180deg, #a5b4fc, #6366f1); }
.achievement-accent.tier-legendary { background: linear-gradient(180deg, #00d4aa, #8b5cf6, #f472b6); }

.achievement-banner-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  flex: 1;
  min-width: 0;
}

.achievement-banner-icon {
  flex-shrink: 0;
}

.achievement-banner-text {
  flex: 1;
  min-width: 0;
}

.achievement-banner-header {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.achievement-banner-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.achievement-banner-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rarity-indicator {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 4px;
}
.rarity-indicator.rarity-bronze    { color: #cd7f32; background: rgba(205, 127, 50, 0.12); }
.rarity-indicator.rarity-silver    { color: #c0c0c0; background: rgba(192, 192, 192, 0.12); }
.rarity-indicator.rarity-gold      { color: #ffd700; background: rgba(255, 215, 0, 0.12); }
.rarity-indicator.rarity-platinum  { color: #818cf8; background: rgba(129, 140, 248, 0.15); }
.rarity-indicator.rarity-legendary { color: #00d4aa; background: rgba(0, 212, 170, 0.15); }

/* Progress bar (auto-dismiss timer) */
.achievement-progress-bar {
  position: absolute;
  bottom: 0;
  left: 5px;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border-radius: 0 0 14px 0;
}

.achievement-progress-fill {
  height: 100%;
  border-radius: 2px;
  animation: progressShrink var(--dismiss-duration, 5s) linear forwards;
}
.achievement-progress-fill.tier-bronze    { background: #cd7f32; }
.achievement-progress-fill.tier-silver    { background: #c0c0c0; }
.achievement-progress-fill.tier-gold      { background: #ffd700; }
.achievement-progress-fill.tier-platinum  { background: #818cf8; }
.achievement-progress-fill.tier-legendary { background: linear-gradient(90deg, #00d4aa, #8b5cf6, #f472b6); }

/* Legendary-tier glow pulse on the banner */
.achievement-banner.achievement-legendary {
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(0, 212, 170, 0.2),
    0 0 60px rgba(139, 92, 246, 0.1),
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  animation: achievementSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             legendaryBannerPulse 2s ease-in-out infinite 0.6s;
}

/* Legendary full-screen flash */
.legendary-flash {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: radial-gradient(ellipse at center, rgba(0, 212, 170, 0.3), rgba(139, 92, 246, 0.15), transparent 70%);
  animation: legendaryFlash 0.8s ease-out forwards;
  pointer-events: none;
}

/* Animations */
@keyframes achievementSlideIn {
  0%   { opacity: 0; transform: translateY(-80px) scale(0.92); }
  60%  { opacity: 1; transform: translateY(8px) scale(1.02); }
  80%  { transform: translateY(-3px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes achievementSlideOut {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.9); }
}

@keyframes progressShrink {
  0%   { width: 100%; }
  100% { width: 0%; }
}

@keyframes legendaryFlash {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes legendaryBannerPulse {
  0%, 100% { box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 30px rgba(0,212,170,0.2), 0 0 60px rgba(139,92,246,0.1); }
  50%      { box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 40px rgba(0,212,170,0.35), 0 0 80px rgba(139,92,246,0.2); }
}

/* ============================================================
   Achievement Gallery — PS5 Trophy Case
   ============================================================ */
.achievement-gallery {
  width: 100%;
}

.achievement-gallery-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.achievement-gallery-completion {
  flex-shrink: 0;
  text-align: center;
}

.achievement-gallery-completion-pct {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.achievement-gallery-completion-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}

.achievement-gallery-tier-breakdown {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.achievement-gallery-tier-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 0.68rem;
  font-weight: 700;
}
.achievement-gallery-tier-pill .tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tier-dot.tier-bronze    { background: #cd7f32; }
.tier-dot.tier-silver    { background: #c0c0c0; }
.tier-dot.tier-gold      { background: #ffd700; }
.tier-dot.tier-platinum  { background: #818cf8; }
.tier-dot.tier-legendary { background: #00d4aa; }

/* Filter tabs */
.achievement-filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.achievement-filter-tabs::-webkit-scrollbar { display: none; }

.achievement-filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
  user-select: none;
}
.achievement-filter-tab:hover {
  background: var(--glass-hover);
  color: var(--text);
}
.achievement-filter-tab.active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.25);
  color: var(--accent);
}

/* Sort dropdown */
.achievement-sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.achievement-sort-bar select {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

/* Category progress */
.achievement-category-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.7rem;
}

.achievement-category-progress-label {
  font-weight: 700;
  color: var(--text);
  min-width: 110px;
}

.achievement-category-progress-track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.achievement-category-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.achievement-category-progress-count {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.68rem;
  min-width: 40px;
  text-align: right;
}

/* Badge card grid */
.achievement-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

/* Collapsed unearned category sections */
.achievement-unearned-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}
.achievement-unearned-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--glass);
  transition: background-color 0.2s ease;
}
.achievement-unearned-header:hover {
  background: var(--glass-hover);
}
.achievement-unearned-cat-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.achievement-unearned-cat-count {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.achievement-unearned-chevron {
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}
.achievement-unearned-chevron.expanded {
  transform: rotate(0deg);
}
.achievement-unearned-section .achievement-gallery-grid {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* Earned badge card */
.badge-card-earned {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.badge-card-earned::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.badge-card-earned.tier-bronze::before    { background: radial-gradient(ellipse at 50% 0%, rgba(205,127,50,0.15), transparent 70%); }
.badge-card-earned.tier-silver::before    { background: radial-gradient(ellipse at 50% 0%, rgba(192,192,192,0.15), transparent 70%); }
.badge-card-earned.tier-gold::before      { background: radial-gradient(ellipse at 50% 0%, rgba(255,215,0,0.15), transparent 70%); }
.badge-card-earned.tier-platinum::before  { background: radial-gradient(ellipse at 50% 0%, rgba(129,140,248,0.18), transparent 70%); }
.badge-card-earned.tier-legendary::before { background: radial-gradient(ellipse at 50% 0%, rgba(0,212,170,0.18), transparent 70%); }

.badge-card-earned:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
}
.badge-card-earned:hover::before {
  opacity: 1;
}

.badge-card-earned .badge-card-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}

.badge-card-earned .badge-card-date {
  font-size: 0.55rem;
  color: var(--text-dim);
}

/* Locked badge card */
.badge-card-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 38, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: opacity 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
  opacity: 0.55;
}

.badge-card-locked:hover {
  opacity: 0.75;
  border-color: rgba(255, 255, 255, 0.12);
}

.badge-card-locked .badge-card-lock-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(36, 30, 48, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.12);
}

.badge-card-locked .badge-card-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
}

/* Badge detail modal */
.badge-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 10003;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.badge-detail-modal.modal-visible {
  opacity: 1;
  pointer-events: auto;
}

.badge-detail-content {
  background: rgba(28, 23, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-detail-modal.modal-visible .badge-detail-content {
  transform: scale(1);
}

.badge-detail-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 14px;
  margin-bottom: 6px;
}

.badge-detail-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.badge-detail-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.badge-detail-close {
  padding: 10px 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--glass);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background-color 0.2s var(--ease-out);
}

.badge-detail-close:hover {
  background: var(--glass-hover);
}

/* Locked badge hint in modal */
.badge-detail-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  margin-bottom: 18px;
}

.badge-detail-progress-hint {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}

@media (max-width: 768px) {
  #achievement-banner-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }
  .achievement-banner {
    max-width: 100%;
    min-width: 0;
  }
  .achievement-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

/* ============================================================
   TRANSACTIONS PAGE
   ============================================================ */

.txn-summary-card {
  margin-bottom: 0;
}

.txn-summary-row {
  display: flex;
  gap: 24px;
  justify-content: space-around;
  flex-wrap: wrap;
}

.txn-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.txn-stat-label {
  font-size: 0.75rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.txn-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.txn-stat-value.expense { color: var(--danger, #ef4444); }
.txn-stat-value.income { color: var(--success, #22c55e); }

.txn-filter-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}

.txn-search-row {
  display: flex;
  gap: 10px;
}

.txn-search-input {
  flex: 1;
  background: var(--glass, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text, #e8eaed);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.txn-search-input:focus {
  border-color: var(--accent, #60a5fa);
}

.txn-search-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.txn-select, .txn-date-input {
  background: var(--glass, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text, #e8eaed);
  font-size: 0.85rem;
  outline: none;
}

.txn-select:focus, .txn-date-input:focus {
  border-color: var(--accent, #60a5fa);
}

.txn-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.txn-count {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.5;
}

.txn-table-card {
  overflow-x: auto;
}

.txn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.txn-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.txn-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  background: var(--glass, rgba(255,255,255,0.04));
}

.txn-sortable {
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

.txn-sortable:hover {
  opacity: 1;
}

.txn-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

.txn-table tr:hover td {
  background: var(--glass-hover, rgba(255,255,255,0.07));
}

.txn-date {
  white-space: nowrap;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.txn-payee {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txn-category {
  font-size: 0.8rem;
  opacity: 0.6;
}

.txn-amount {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.txn-amount.income { color: var(--success, #22c55e); }
.txn-amount.expense { color: var(--danger, #ef4444); }

.txn-pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 12px 0;
}

.txn-page-btn {
  background: var(--glass, rgba(255,255,255,0.04));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--text, #e8eaed);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.txn-page-btn:hover {
  background: var(--glass-hover, rgba(255,255,255,0.07));
}

.txn-page-btn.active {
  background: var(--accent, #60a5fa);
  color: #fff;
  border-color: var(--accent, #60a5fa);
}

@media (max-width: 600px) {
  .txn-search-row {
    flex-direction: column;
  }
  .txn-summary-row {
    gap: 12px;
  }
  .txn-payee {
    max-width: 120px;
  }
}
