/* ═══════════════════════════════════════════════════════════
   ZONINGA DESIGN SYSTEM
   CSS Custom Properties for Light/Dark Mode
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800&display=swap');

/* ─── LIGHT THEME (default) ─── */
:root, [data-theme="light"] {
  --bg: #F8FAFC;
  --surface: #ffffff;
  --surface-alt: #F1F5F9;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --accent: #0EA5E9;
  --accent-glow: rgba(14, 165, 233, 0.2);
  --accent-pill-bg: #E8F6FD;
  --gradient: linear-gradient(135deg, #0EA5E9, #06B6D4);
  --hero-bg: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 50%, #F0F9FF 100%);
  --hero-orb: rgba(14, 165, 233, 0.06);
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.07);
  --green-border: rgba(22, 163, 74, 0.15);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.06);
  --red-border: rgba(220, 38, 38, 0.12);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.06);
  --cyan: #0891b2;
  --cyan-bg: rgba(8, 145, 178, 0.06);
  --pink: #db2777;
  --progress-track: rgba(15, 23, 42, 0.06);
  --tip-bg: linear-gradient(135deg, rgba(14, 165, 233, 0.04), rgba(6, 182, 212, 0.04));
  --tip-border: rgba(14, 165, 233, 0.12);
  --tip-text: #0284C7;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --toggle-bg: #F0F9FF;
  --toggle-border: rgba(14, 165, 233, 0.2);
  --subtle-bg: rgba(255, 255, 255, 0.8);
  --subtle-border: rgba(15, 23, 42, 0.06);
  --inset-bg: rgba(15, 23, 42, 0.02);
  --inset-border: rgba(15, 23, 42, 0.04);
  --table-header: rgba(15, 23, 42, 0.03);
  --table-row-alt: rgba(15, 23, 42, 0.015);
  --grid-line: rgba(15, 23, 42, 0.06);
  --win-bg: rgba(22, 163, 74, 0.05);
  --win-border: rgba(22, 163, 74, 0.15);
  --hero-text: #0F172A;
  --focus-ring: rgba(14, 165, 233, 0.5);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --modal-bg: #ffffff;
  --accent-text: #0369A1;
  --green-text: #15803d;
  --amber-text: #B45309;
  --red-text: #B91C1C;
}

/* ─── DARK THEME ─── */
[data-theme="dark"] {
  --bg: #0F172A;
  --surface: #1E293B;
  --surface-alt: #334155;
  --border: rgba(148, 163, 184, 0.1);
  --border-strong: rgba(148, 163, 184, 0.2);
  --text: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --topbar-bg: rgba(15, 23, 42, 0.92);
  --accent: #38BDF8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --accent-pill-bg: #172A3E;
  --gradient: linear-gradient(135deg, #0EA5E9, #06B6D4);
  --hero-bg: linear-gradient(135deg, #0F172A 0%, #164E63 50%, #0F172A 100%);
  --hero-orb: rgba(14, 165, 233, 0.12);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --green-border: rgba(34, 197, 94, 0.2);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --red-border: rgba(239, 68, 68, 0.2);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.1);
  --cyan: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.1);
  --pink: #ec4899;
  --progress-track: rgba(255, 255, 255, 0.06);
  --tip-bg: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(6, 182, 212, 0.08));
  --tip-border: rgba(14, 165, 233, 0.15);
  --tip-text: #7DD3FC;
  --card-shadow: none;
  --toggle-bg: rgba(14, 165, 233, 0.1);
  --toggle-border: rgba(14, 165, 233, 0.2);
  --subtle-bg: rgba(255, 255, 255, 0.04);
  --subtle-border: rgba(255, 255, 255, 0.06);
  --inset-bg: rgba(255, 255, 255, 0.02);
  --inset-border: rgba(255, 255, 255, 0.04);
  --table-header: rgba(148, 163, 184, 0.06);
  --table-row-alt: rgba(255, 255, 255, 0.02);
  --grid-line: rgba(255, 255, 255, 0.04);
  --win-bg: rgba(34, 197, 94, 0.08);
  --win-border: rgba(34, 197, 94, 0.2);
  --hero-text: #ffffff;
  --focus-ring: rgba(56, 189, 248, 0.5);
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --modal-bg: #1E293B;
  --accent-text: #38BDF8;
  --green-text: #4ADE80;
  --amber-text: #FBBF24;
  --red-text: #F87171;
  color-scheme: dark;
}

/* ═══════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.4s, color 0.4s;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text, #0369A1); text-decoration: none; }
a:hover { opacity: 0.85; }

.text-link {
  color: var(--accent-text, #0369A1);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.text-link:hover { opacity: 0.85; }

/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #0F172A 0%, #020617 100%);
  border-right: 1px solid rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
  border-right-color: rgba(15, 23, 42, 0.15);
}

.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 20px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-title { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 1.5px; }
.sidebar-subtitle { font-size: 9px; color: rgba(255,255,255,0.65); letter-spacing: 2px; margin-top: 1px; }

/* Nav */
.sidebar-nav { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 2px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.75); opacity: 1; }
.nav-item.active { background: rgba(255, 255, 255, 0.12); color: #BAE6FD; font-weight: 600; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

/* Nav group with dropdown submenu */
.nav-group { position: relative; }
.nav-group > .nav-item { justify-content: flex-start; }
.nav-caret {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.5;
  transition: transform 0.2s;
}
.nav-group:hover .nav-caret { transform: rotate(-180deg); opacity: 0.8; }
.nav-submenu {
  display: none;
  padding-left: 12px;
}
.nav-group:hover .nav-submenu { display: block; }
.nav-submenu .nav-item {
  font-size: 12px;
  padding: 7px 14px;
  gap: 10px;
}
.nav-submenu .nav-icon { font-size: 13px; width: 18px; }

/* Sidebar user */
.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #0EA5E9, #06B6D4);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-avatar--img {
  width: 32px; height: 32px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}

/* Topbar avatar (replaces SVG icon when profile pic exists) */
.topbar-avatar-btn { padding: 3px; }
.topbar-avatar-img {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover;
}
.topbar-avatar-initials {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #0EA5E9, #06B6D4);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}

/* Profile page — large avatar */
.profile-header-row {
  display: flex; gap: 20px; align-items: flex-start;
}
.profile-avatar-large-wrap { flex-shrink: 0; }
.profile-avatar-large {
  width: 80px; height: 80px; border-radius: 12px;
  object-fit: cover;
}
.profile-avatar-large--initials {
  background: linear-gradient(135deg, #0EA5E9, #06B6D4);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}

/* Profile picture upload area */
.profile-picture-upload {
  display: flex; align-items: center; gap: 16px;
}
.profile-picture-preview { flex-shrink: 0; }
.profile-picture-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}

/* Profile badges row */
.profile-badges-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.profile-badge-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: var(--card-alt, #f1f5f9);
  color: var(--text);
}

/* Grid-3 (for gamification stats) */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }

/* Visually hidden (accessible file inputs) */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Danger outline button variant */
.btn-outline--danger {
  color: var(--red-text, #B91C1C);
  border-color: var(--red-text, #B91C1C);
}
.btn-outline--danger:hover {
  background: var(--red-text, #B91C1C);
  color: #fff;
}

.user-name { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.8); }
.user-plan { font-size: 10px; color: rgba(255,255,255,0.3); }
.trial-badge {
  display: inline-block;
  background: #4f46e5;
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.sidebar-user-link {
  text-decoration: none;
  color: inherit;
  display: block;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.sidebar-user-link:hover {
  background: rgba(255,255,255,0.06);
}
.sidebar-user-link:hover .user-plan {
  color: rgba(255,255,255,0.5);
}

/* Sidebar widget (e.g., debt freedom tracker) */
.sidebar-widget {
  margin: 0 10px 12px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.sidebar-widget__label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.sidebar-widget__value {
  font-size: 22px;
  font-weight: 700;
  color: #22c55e;
}
.sidebar-widget__sub {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
}

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  min-height: 100vh;
}

/* ─── TOPBAR ─── */
.topbar {
  padding: 12px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: all 0.4s;
  gap: 12px;
}

.topbar-title { font-size: 16px; font-weight: 700; white-space: nowrap; margin: 0; line-height: inherit; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Topbar icon buttons (bell, user) */
.topbar-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.2s, color 0.2s;
}
.topbar-icon-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Buttons */
.btn-primary {
  background: var(--accent-text, #0369A1);
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-family: inherit;
  transition: all 0.2s;
}

.btn-primary:hover { background: #0284C7; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 7px 18px;
  color: var(--accent-text, #0369A1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-outline:hover { background: rgba(14, 165, 233, 0.08); }

.btn-secondary {
  background: var(--subtle-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 18px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-secondary:hover { background: var(--inset-bg); border-color: var(--border-strong); }

.btn-danger {
  background: var(--red);
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.btn-danger:hover { opacity: 0.9; }

.btn { font-family: inherit; cursor: pointer; transition: all 0.2s; }
.btn-sm { padding: 5px 14px; font-size: 11px; }

/* Page content area */
.page-content { padding: 24px; }

/* ═══════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════ */

/* ─── CARD ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--card-shadow);
  transition: all 0.4s;
}

.card-flush { padding: 0; overflow: hidden; }

/* ─── SECTION LABEL ─── */
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-label__text {
  font-size: 11px;
  color: var(--accent-text, #0369A1);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.section-label__action {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.section-label__action:hover { color: var(--accent-text, #0369A1); }

/* ─── STAT BOX ─── */
.stat-box {
  background: var(--subtle-bg);
  border-radius: 12px;
  padding: 14px 18px;
  border: 1px solid var(--subtle-border);
  transition: all 0.4s;
}

.stat-box__label { font-size: 10px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.stat-box__value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.stat-box__sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ─── HERO ─── */
.hero {
  background: var(--hero-bg);
  border-radius: 16px;
  padding: 13px 32px;
  margin: 0 100px 20px;
  border: 1px solid var(--border-strong);
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.hero__orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hero-orb) 0%, transparent 70%);
}

.hero__orb--top-right { top: -60px; right: -20px; width: 220px; height: 220px; }
.hero__orb--bottom-left { bottom: -40px; left: 100px; width: 180px; height: 180px; }
.hero__content { position: relative; display: flex; flex-direction: column; align-items: center; }
.hero__center { text-align: center; }
.hero__label { font-size: 15px; color: var(--accent-text, #0369A1); letter-spacing: 2px; margin-bottom: 10px; font-weight: 600; text-transform: uppercase; }
.hero__value { font-size: 59px; font-weight: 800; color: var(--hero-text); letter-spacing: -1px; line-height: 1; }
.hero__stats-row { display: flex; width: 100%; margin-top: 20px; }
.stat-box--flex { flex: 1; text-align: center; background: transparent; border: none; padding: 10px 0; }
.hero__stats-row .stat-box__label { font-size: 14px; }
.hero__stats-row .stat-box__value { font-size: 26px; }
.hero__stats-row .stat-box__sub { font-size: 14px; }
.hero__value--lg { font-size: 40px; }
.hero__value-suffix { font-size: 16px; color: var(--text-secondary); margin-left: 12px; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge--green { background: var(--green-bg); color: var(--green-text, #15803d); }
.badge--red { background: var(--red-bg); color: var(--red-text, #B91C1C); }
.badge--accent { background: var(--toggle-bg); color: var(--accent-text, #0369A1); }

/* ─── GRID LAYOUTS ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* ─── ACCOUNT CARD ─── */
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  cursor: grab;
  box-shadow: var(--card-shadow);
  transition: all 0.3s;
}

.account-card:active { cursor: grabbing; }

/* Restore pointer cursor for interactive children (links, buttons) */
.account-card a,
.account-card button { cursor: pointer; }

/* Card body holds the original row layout (icon + name | balance + actions) */
.account-card__body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Type label inside each card — hidden by default, shown via JS on first of each type */
.account-card__type-label {
  display: none;
  margin-bottom: 6px;
}

.account-card__type-label.visible { display: block; }

.account-card:hover { border-color: var(--border-strong); }
.account-card--asset { border-left: 3px solid var(--green); }
.account-card--debt, .account-card.debt { border-left: 3px solid var(--red); }

.account-card__icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.account-card__icon--asset { background: var(--green-bg); }
.account-card__icon--debt { background: var(--red-bg); }
.account-card__name { font-size: 13px; font-weight: 600; }
.account-card__meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.account-card__balance { font-size: 16px; font-weight: 700; }
.account-card__balance--green { color: var(--green-text, #15803d); }
.account-card__balance--red { color: var(--red-text, #B91C1C); }

/* Account card legacy layout */
.account-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.account-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-card-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}
.account-card-link:hover { color: var(--accent-text, #0369A1); text-decoration: underline; opacity: 1; }

.account-card-actions {
  display: flex;
  gap: 4px;
}

.account-card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.account-card-actions button:hover {
  background: var(--inset-bg);
  color: var(--text);
}

.account-card-actions button.delete:hover {
  background: var(--red-bg);
  color: var(--red-text, #B91C1C);
}

.account-card-actions svg {
  width: 18px;
  height: 18px;
}

.account-card-balance {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--green-text, #15803d);
  margin-bottom: 8px;
}

.account-card.debt .account-card-balance {
  color: var(--red-text, #B91C1C);
}

.converted-balance {
  font-size: 0.7em;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.account-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.account-tag {
  background: var(--inset-bg);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.account-tag.type {
  background: rgba(14, 165, 233, 0.06);
  color: var(--accent-text, #0369A1);
  border-color: rgba(14, 165, 233, 0.15);
}

.account-tag.rate {
  background: var(--amber-bg);
  color: var(--amber-text, #B45309);
  border-color: rgba(217, 119, 6, 0.15);
}

/* Drag handle */
.drag-handle {
  color: var(--text-muted);
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.account-card.sortable-ghost { opacity: 0.4; }
.account-card.sortable-chosen { box-shadow: 0 8px 16px rgba(0,0,0,0.15); transform: scale(1.02); }

/* ─── TRANSACTION ROW ─── */
.txn-row {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.txn-row:hover { background: var(--inset-bg); }
.txn-row + .txn-row { border-top: 1px solid var(--border); }

/* Future-dated transaction styling */
.txn-row--future {
  opacity: 0.7;
  border-left: 3px solid var(--amber);
}
.txn-row--future .txn-desc {
  font-style: italic;
}

.txn-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.txn-icon--income { background: var(--green-bg); }
.txn-icon--expense { background: var(--red-bg); }
.txn-icon--transfer { background: var(--cyan-bg); }
.txn-desc { font-size: 13px; font-weight: 500; }
.txn-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.txn-amount { font-size: 14px; font-weight: 600; }
.txn-amount--income { color: var(--green-text, #15803d); }
.txn-amount--expense { color: var(--red-text, #B91C1C); }
.txn-amount--transfer { color: var(--accent-text, #0369A1); }

/* Transaction list legacy */
.transaction-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--card-shadow);
  margin-bottom: 8px;
}

.transaction-info { flex: 1; }
.transaction-description { font-weight: 500; color: var(--text); margin-bottom: 4px; }
.transaction-date { font-size: 12px; color: var(--text-muted); }

.transaction-tags { display: flex; gap: 6px; margin-top: 6px; }

.transaction-tag {
  background: var(--green-bg);
  color: var(--green-text, #15803d);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.transaction-tag.withdrawal {
  background: var(--red-bg);
  color: var(--red-text, #B91C1C);
}

.transaction-tag.category {
  background: rgba(14, 165, 233, 0.06);
  color: var(--accent-text, #0369A1);
}

.transaction-tag-user {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.transaction-amount {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transaction-amount.positive { color: var(--green-text, #15803d); }
.transaction-amount.negative { color: var(--red-text, #B91C1C); }

.transaction-actions { display: flex; gap: 4px; }

.transaction-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.transaction-actions button:hover { background: var(--inset-bg); color: var(--text); }
.transaction-actions button.delete:hover { background: var(--red-bg); color: var(--red-text, #B91C1C); }
.transaction-actions svg { width: 16px; height: 16px; }

/* Recurring indicators */
.recurring-indicator {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  vertical-align: middle;
}

.recurring-indicator.template svg { color: var(--accent-text, #0369A1); }
.recurring-indicator.instance svg { color: var(--text-muted); }

/* ─── CATEGORY LABELS ─── */
.category-label { font-size: 10px; letter-spacing: 1px; margin-bottom: 8px; font-weight: 600; }
.category-label--asset { color: var(--green-text, #15803d); }
.category-label--debt { color: var(--red-text, #B91C1C); }

/* ─── PROGRESS BAR ─── */
.progress { height: 8px; background: var(--progress-track); border-radius: 4px; overflow: hidden; }
.progress--sm { height: 6px; }
.progress--lg { height: 10px; }
.progress__fill { height: 100%; border-radius: inherit; transition: width 0.5s ease; }
.progress__fill--gradient { background: var(--gradient); }
.progress__fill--green { background: var(--green); }
.progress__fill--red { background: var(--red); }
.progress__fill--amber { background: linear-gradient(90deg, #f59e0b, #eab308); }
.progress__fill--danger { background: linear-gradient(90deg, #ef4444, #f97316); }
.progress__fill--accent { background: linear-gradient(90deg, #0EA5E9, #06B6D4); }

/* ─── DEBT PROGRESS BAR ─── */
.debt-progress-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.debt-progress-card:hover {
  border-color: var(--accent-text, #0369A1);
  box-shadow: 0 0 0 1px var(--accent), var(--card-shadow);
  opacity: 1;
}
.debt-bar {
  height: 10px;
  background: var(--progress-track);
  border-radius: 5px;
  overflow: hidden;
}
.debt-bar__fill {
  height: 100%;
  border-radius: 5px;
  background: var(--gradient);
  transition: width 0.6s ease;
  min-width: 2px;
}

/* ─── TIP BOX ─── */
.tip-box {
  padding: 10px 16px;
  background: var(--tip-bg);
  border: 1px solid var(--tip-border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--tip-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── WIN BOX ─── */
.win-box {
  padding: 16px 18px;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 10px;
}

/* ─── TABLE ─── */
.zon-table { border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.zon-table__header {
  display: grid; padding: 10px 16px;
  background: var(--table-header);
  font-size: 10px; font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.zon-table__row {
  display: grid;
  padding: 12px 16px;
  font-size: 12px;
  border-top: 1px solid var(--border);
  transition: background 0.2s;
  cursor: pointer;
}

.zon-table__row:nth-child(even) { background: var(--table-row-alt); }
.zon-table__row:hover { background: var(--inset-bg); }
.zon-table__row.active { background: rgba(14, 165, 233, 0.06); border-left: 3px solid var(--accent); }

/* ─── STRATEGY SELECTOR ─── */
.strategy-card {
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  border: 1.5px solid var(--border);
  transition: all 0.2s;
}

.strategy-card:hover { border-color: var(--border-strong); }
.strategy-card.active { background: rgba(14, 165, 233, 0.08); border-color: var(--accent-text, #0369A1); }
.strategy-card__name { font-size: 12px; font-weight: 700; }
.strategy-card__desc { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ─── BUDGET ITEM ─── */
.budget-item {
  padding: 16px 0;
}

.budget-item + .budget-item { border-top: 1px solid var(--border); }
.budget-item__over { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--red-bg); color: var(--red-text, #B91C1C); font-weight: 600; }

/* ─── RANGE SLIDER ─── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--progress-track);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
}

/* ─── FILTER PILLS ─── */
.filter-pills { display: flex; gap: 6px; margin-bottom: 14px; }
.filter-pill {
  padding: 5px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.filter-pill:hover { border-color: var(--accent-text, #0369A1); color: var(--accent-text, #0369A1); }
.filter-pill.active {
  background: var(--accent-pill-bg, #E8F6FD);
  border-color: var(--accent-text, #0369A1);
  color: var(--accent-text, #0369A1);
  font-weight: 600;
}

/* ═══════════════════════════════════════
   MODALS
   ═══════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--overlay-bg);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.modal-close:hover { color: var(--text); }
.modal-close svg { width: 24px; height: 24px; }

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--inset-bg);
  border-radius: 0 0 14px 14px;
}

/* Portfolio toggle (Account / Hard Asset tab switcher) */
.portfolio-toggle {
  display: flex;
  gap: 0;
  padding: 4px;
  margin: 0 24px 0;
  background: var(--inset-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.portfolio-toggle__btn {
  flex: 1;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.portfolio-toggle__btn:hover {
  color: var(--text);
}
.portfolio-toggle__btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-text, #0369A1);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row--3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-errors {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.form-error {
  color: var(--red-text, #B91C1C);
  font-size: 13px;
  margin-bottom: 4px;
}

.form-error:last-child { margin-bottom: 0; }

/* Per-field inline validation */
.form-group--error .form-input,
.form-group--error .form-select,
.form-group--error textarea {
  border-color: var(--red-border);
}
.form-group--error .form-input:focus,
.form-group--error .form-select:focus,
.form-group--error textarea:focus {
  border-color: var(--red-text, #B91C1C);
  box-shadow: 0 0 0 3px var(--red-bg);
}
.field-error {
  color: var(--red-text, #B91C1C);
  font-size: 11px;
  margin-top: 4px;
  display: block;
}

.form-help {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-text, #0369A1);
}

.recurring-fields {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
}

.multi-select {
  min-height: 80px;
  padding: 8px;
}

/* ─────────────────────────────────────────
   Category Autocomplete Combobox
   ───────────────────────────────────────── */

.category-autocomplete {
  position: relative;
}

.category-autocomplete__input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

.category-autocomplete__input:focus {
  outline: none;
  border-color: var(--accent-text, #0369A1);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.category-autocomplete__input::placeholder {
  color: var(--text-muted);
}

.category-autocomplete__list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 2100;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 10px;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  list-style: none;
  padding: 4px 0;
}

.category-autocomplete__list--open {
  display: block;
}

.category-autocomplete__group-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  user-select: none;
}

.category-autocomplete__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.1s;
}

.category-autocomplete__item:hover,
.category-autocomplete__item--focused {
  background: var(--inset-bg, rgba(0, 0, 0, 0.04));
}

.category-autocomplete__item--suggested {
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.category-autocomplete__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-autocomplete__type {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--inset-bg, rgba(0, 0, 0, 0.06));
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: capitalize;
}

.category-autocomplete__badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-glow, rgba(14, 165, 233, 0.1));
  color: var(--accent-text, #0369A1);
  white-space: nowrap;
  font-weight: 500;
}

.category-autocomplete__empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-row input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

.color-hex {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   NOTIFICATION BELL & DROPDOWN
   ═══════════════════════════════════════ */

.notification-bell-wrapper {
  position: relative;
}

.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: var(--text-secondary);
}

.nav-btn:hover { background: var(--inset-bg); }
.nav-btn svg { width: 22px; height: 22px; }

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 50%;
  text-align: center;
  pointer-events: none;
}

.notification-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 1050;
  overflow: hidden;
}

.notification-dropdown.open { display: block; }

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.mark-all-read-btn {
  background: none;
  border: none;
  color: var(--accent-text, #0369A1);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  font-family: inherit;
}

.mark-all-read-btn:hover { text-decoration: underline; }

.notification-dropdown-list {
  max-height: 340px;
  overflow-y: auto;
}

.notification-dropdown-item {
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}

.notification-dropdown-item:hover { background: var(--inset-bg); opacity: 1; }
.notification-dropdown-item.unread { background: rgba(14, 165, 233, 0.04); }

.notification-dropdown-item-title {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 2px;
}

.notification-dropdown-item-message {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-dropdown-item-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.notification-dropdown-item .severity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.severity-dot.severity-info { background: var(--accent); }
.severity-dot.severity-warning { background: var(--amber); }
.severity-dot.severity-danger { background: var(--red); }

.notification-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 16px;
  font-size: 12px;
}

.notification-dropdown-footer {
  display: block;
  text-align: center;
  padding: 10px;
  border-top: 1px solid var(--border);
  color: var(--accent-text, #0369A1);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}

.notification-dropdown-footer:hover { background: var(--inset-bg); opacity: 1; }

/* Sidebar notification badge */
.sidebar-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  margin-left: auto;
  padding: 0 5px;
}

/* ═══════════════════════════════════════
   USER DROPDOWN (click-based, with notifications)
   ═══════════════════════════════════════ */

.user-dropdown {
  position: relative;
}

.user-dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  min-width: 220px;
  z-index: 1060;
  overflow: hidden;
}

.user-dropdown.open .user-dropdown-content {
  display: block;
}

.user-dropdown-content a {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
}

.user-dropdown-content a:hover {
  background: var(--inset-bg);
  opacity: 1;
}

.user-dropdown-content a:last-child {
  border-top: 1px solid var(--border);
  color: var(--red-text, #B91C1C);
}

.user-dropdown-notif {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-badge-inline {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  margin-left: auto;
  padding: 0 5px;
}

.notif-badge-inline:empty { display: none; }

/* Notification panel slides in over the user dropdown */
.user-dropdown .notification-dropdown {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1070;
}

.notif-back-btn {
  background: none;
  border: none;
  color: var(--accent-text, #0369A1);
  cursor: pointer;
  font-size: 16px;
  padding: 0 8px 0 0;
  font-family: inherit;
}

/* ═══════════════════════════════════════
   MESSAGES
   ═══════════════════════════════════════ */

.messages {
  list-style: none;
  margin-bottom: 20px;
}

.messages li {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.messages .success {
  background: var(--green-bg);
  color: var(--green-text, #15803d);
  border: 1px solid var(--green-border);
}

.messages .error {
  background: var(--red-bg);
  color: var(--red-text, #B91C1C);
  border: 1px solid var(--red-border);
}

.messages .info {
  background: rgba(14, 165, 233, 0.06);
  color: var(--accent-text, #0369A1);
  border: 1px solid rgba(14, 165, 233, 0.15);
}

.messages .warning {
  background: var(--amber-bg);
  color: var(--amber-text, #B45309);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

/* Sync toast -- lightweight feedback banner */
.sync-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 400px;
}
.sync-toast--visible {
  opacity: 1;
  transform: translateY(0);
}
.sync-toast--success {
  background: var(--green-bg);
  color: var(--green-text, #15803d);
  border: 1px solid var(--green-border);
}
.sync-toast--error {
  background: var(--red-bg);
  color: var(--red-text, #B91C1C);
  border: 1px solid var(--red-border);
}
.sync-toast--warning {
  background: var(--amber-bg);
  color: var(--amber-text, #B45309);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

/* ═══════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  padding: 16px 0;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s;
}

a.page-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-text, #0369A1);
  opacity: 1;
}

.page-link.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-text, #0369A1);
  font-weight: 600;
}

.page-link.disabled {
  color: var(--text-muted);
  cursor: default;
  border-color: var(--border);
}

/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 16px;
}

.empty-state-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--gradient);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.empty-state-btn:hover { opacity: 0.9; }

.empty-state-sm {
  text-align: center;
  padding: 20px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state-inline {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   REPORT PAGES
   ═══════════════════════════════════════ */

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.report-header-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-date {
  color: var(--text-muted);
  font-size: 13px;
}

.report-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.export-buttons {
  display: flex;
  gap: 8px;
}

.export-buttons .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.report-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.report-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.report-section-title svg { color: var(--accent-text, #0369A1); }

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.report-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-table tbody tr:hover { background: var(--inset-bg); }

.report-table .amount { text-align: right; font-family: monospace; font-size: 13px; }
.report-table .amount.positive { color: var(--green-text, #15803d); }
.report-table .amount.negative { color: var(--red-text, #B91C1C); }

.report-table .group-header-row { background: var(--table-header); }
.report-table .group-header { font-weight: 600; color: var(--text); font-size: 13px; padding: 8px 12px; }
.report-table .subtotal-row { background: var(--table-header); font-style: italic; font-size: 13px; }
.report-table .total-row td { border-top: 2px solid var(--border-strong); border-bottom: none; padding-top: 16px; }
.report-table tfoot { background: transparent; }

.report-table .account-name { display: flex; flex-direction: column; gap: 2px; }
.report-table .account-name a { color: var(--text); text-decoration: none; font-weight: 500; }
.report-table .account-name a:hover { color: var(--accent-text, #0369A1); text-decoration: underline; opacity: 1; }
.report-table .account-institution { font-size: 11px; color: var(--text-muted); }
.report-table .account-rate {
  font-size: 10px;
  color: var(--red-text, #B91C1C);
  background: var(--red-bg);
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 2px;
}

/* Net Worth Section */
.net-worth-section { margin-bottom: 20px; }

.net-worth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: 14px;
  text-align: center;
}

.net-worth-box.positive {
  background: var(--green-bg);
  border: 2px solid var(--green);
}

.net-worth-box.negative {
  background: var(--red-bg);
  border: 2px solid var(--red);
}

.net-worth-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.net-worth-value {
  font-size: 2.5em;
  font-weight: 800;
  margin-bottom: 8px;
}

.net-worth-box.positive .net-worth-value { color: var(--green-text, #15803d); }
.net-worth-box.negative .net-worth-value { color: var(--red-text, #B91C1C); }

.net-worth-formula {
  font-size: 12px;
  color: var(--text-muted);
}

/* Chart Container */
.chart-container {
  position: relative;
  width: 100%;
  min-height: 250px;
}

.chart-container canvas { width: 100% !important; }

/* Date Range Picker */
.date-range-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-range-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.date-range-presets .btn {
  font-size: 11px;
  padding: 4px 8px;
}

/* ═══════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════ */

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group--wide { grid-column: span 2; }

.filter-group__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

/* Legacy flex row (kept for backward compat) */
.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent-text, #0369A1);
}

.filter-input { min-width: 0; }
.filter-select { min-width: 0; }
.filter-date { min-width: 0; }

.filter-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-amount-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-amount-range .filter-input {
  flex: 1;
  min-width: 0;
}

.filter-amount-range__sep {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filter-group--wide { grid-column: span 2; }
  .filter-bar { padding: 12px; }
  .filter-actions { flex-wrap: wrap; }
  .filter-actions .btn-primary,
  .filter-actions .btn-outline { flex: 1; text-align: center; }
}

@media (max-width: 400px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .filter-group--wide { grid-column: span 1; }
}

/* ═══════════════════════════════════════
   BULK ACTIONS
   ═══════════════════════════════════════ */

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  margin-bottom: 12px;
}

.bulk-actions form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.bulk-count {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.transaction-checkbox {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 12px;
}

.transaction-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-text, #0369A1);
  cursor: pointer;
}

.transaction-header-row {
  background: var(--table-header);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

.transaction-header-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   CATEGORIES & TAGS PAGES
   ═══════════════════════════════════════ */

.categories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.category-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: background 0.15s;
}

.category-item:hover { background: var(--inset-bg); }
.category-item.system { background: var(--table-header); }

.category-info { display: flex; align-items: center; gap: 12px; }
.category-name { font-weight: 500; color: var(--text); }

.category-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-badge.system { background: var(--table-header); color: var(--text-muted); }
.category-badge.user { background: var(--green-bg); color: var(--green-text, #15803d); }

.category-actions { display: flex; align-items: center; gap: 4px; }

.category-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.category-actions button:hover { color: var(--accent-text, #0369A1); background: var(--inset-bg); }
.category-actions button.delete:hover { color: var(--red-text, #B91C1C); background: var(--red-bg); }
.category-actions button svg { width: 16px; height: 16px; }

/* Tags */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.tag-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  transition: box-shadow 0.15s;
}

.tag-card:hover { box-shadow: var(--card-shadow); }

.tag-info { display: flex; align-items: center; gap: 12px; }

.tag-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.tag-name { font-weight: 500; color: var(--text); }
.tag-color-label { font-size: 11px; color: var(--text-muted); font-family: monospace; }

.tag-actions { display: flex; align-items: center; gap: 4px; }

.tag-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.tag-actions button:hover { color: var(--accent-text, #0369A1); background: var(--inset-bg); }
.tag-actions button.delete:hover { color: var(--red-text, #B91C1C); background: var(--red-bg); }
.tag-actions button svg { width: 16px; height: 16px; }

/* ═══════════════════════════════════════
   NOTIFICATIONS PAGE
   ═══════════════════════════════════════ */

.notifications-page { max-width: 800px; }

.notification-filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.filter-tab:hover { color: var(--text); border-color: var(--accent-text, #0369A1); opacity: 1; }
.filter-tab.active { background: var(--accent-text, #0369A1); color: #fff; border-color: var(--accent-text, #0369A1); }

.notification-list-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-left: 4px solid transparent;
  transition: background 0.15s;
}

.notification-card.notification-unread { background: rgba(14, 165, 233, 0.04); }
.notification-card.notification-severity-warning { border-left-color: var(--amber-text, #B45309); }
.notification-card.notification-severity-danger { border-left-color: var(--red-text, #B91C1C); }
.notification-card.notification-severity-info { border-left-color: var(--accent-text, #0369A1); }

.notification-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

.notification-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.notification-type-budget_alert { background: var(--amber-bg); color: var(--amber-text, #B45309); }
.notification-type-bill_reminder { background: rgba(14, 165, 233, 0.06); color: var(--accent-text, #0369A1); }
.notification-type-large_transaction { background: var(--red-bg); color: var(--red-text, #B91C1C); }
.notification-type-weekly_summary { background: var(--green-bg); color: var(--green-text, #15803d); }

.notification-time { font-size: 11px; color: var(--text-muted); }

.notification-card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.notification-card-title a { color: var(--text); text-decoration: none; }
.notification-card-title a:hover { color: var(--accent-text, #0369A1); }

.notification-card-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.notification-card-actions { flex-shrink: 0; margin-left: 12px; }

/* ═══════════════════════════════════════
   IMPORT/EXPORT PAGES
   ═══════════════════════════════════════ */

.import-upload-section { max-width: 600px; margin: 0 auto; }
.import-upload-form { margin-bottom: 20px; }

.import-upload-area {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  background: var(--inset-bg);
  transition: border-color 0.2s;
}

.import-upload-area:hover { border-color: var(--accent-text, #0369A1); }
.import-upload-area svg { color: var(--text-muted); margin-bottom: 8px; }
.import-upload-area h3 { margin: 0 0 4px; color: var(--text); }

.import-upload-area .form-group {
  text-align: left;
  max-width: 400px;
  margin: 12px auto;
}

.import-upload-area .form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
}

.file-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}

.import-help {
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.import-help h4 { margin: 0 0 8px; color: var(--text); font-size: 13px; }
.import-help ul { margin: 0; padding-left: 16px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }

.import-preview-section { max-width: 100%; }

.import-preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.import-summary { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.import-file-name { color: var(--text-muted); font-size: 13px; }
.import-arrow { color: var(--text-muted); }
.import-account-name { color: var(--accent-text, #0369A1); }

.import-stats { display: flex; gap: 12px; flex-wrap: wrap; }

.import-stat {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--table-header);
}

.import-stat-count { font-weight: 600; }
.import-stat.valid { background: var(--green-bg); color: var(--green-text, #15803d); }
.import-stat.duplicate { background: var(--amber-bg); color: var(--amber-text, #B45309); }
.import-stat.error { background: var(--red-bg); color: var(--red-text, #B91C1C); }

.import-mapping-section {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--inset-bg);
}

.import-mapping-toggle {
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: var(--accent-text, #0369A1);
}

.import-mapping-form { padding: 0 16px 12px; }

.import-mapping-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.import-mapping-col { min-width: 120px; flex-shrink: 0; }

.import-mapping-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-mapping-select {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface);
  color: var(--text);
}

.import-preview-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.import-preview-table th {
  background: var(--table-header);
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.import-preview-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-col-status { width: 40px; text-align: center; }
.import-col-row { width: 40px; color: var(--text-muted); font-size: 12px; }

.import-status-icon { font-size: 14px; font-weight: bold; }
.import-status-icon.valid { color: var(--green-text, #15803d); }
.import-status-icon.duplicate { color: var(--amber-text, #B45309); }
.import-status-icon.error { color: var(--red-text, #B91C1C); }

.import-row-error td { background: var(--red-bg); }
.import-row-duplicate td { background: var(--amber-bg); }

.import-confirm-form {
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.import-confirm-options { margin-bottom: 16px; }

.import-confirm-options .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.import-category-select { max-width: 400px; }

.import-category-select .form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text);
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ═══════════════════════════════════════
   PROFILE & SUBSCRIPTION PAGES
   ═══════════════════════════════════════ */

.profile-page { max-width: 700px; }

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
}

.profile-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.profile-field:last-child { border-bottom: none; }

.profile-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-value { color: var(--text); }

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.profile-stat {
  text-align: center;
  padding: 16px;
  background: var(--inset-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.profile-stat-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-text, #0369A1);
}

.profile-stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.profile-actions {
  display: flex;
  gap: 12px;
}

/* ═══════════════════════════════════════
   SECTION HEADERS (Legacy)
   ═══════════════════════════════════════ */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.section-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all 0.2s;
}

.section-btn:hover { background: var(--inset-bg); color: var(--text); }
.section-btn svg { width: 22px; height: 22px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.section-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Legacy summary cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--card-shadow);
}

.summary-card-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.summary-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.summary-card-value.positive { color: var(--green-text, #15803d); }
.summary-card-value.negative { color: var(--red-text, #B91C1C); }

/* Legacy dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* View All Link */
.view-all-link {
  display: block;
  text-align: center;
  padding: 12px 0;
  color: var(--accent-text, #0369A1);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.view-all-link:hover { opacity: 0.8; }

.inline-form { display: inline; }

/* Account History */
.account-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.account-header-info { display: flex; flex-direction: column; gap: 8px; }
.account-header-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.account-header-balance { font-size: 28px; font-weight: 800; }

.transaction-amount-with-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 120px;
}

.running-balance { font-size: 11px; font-weight: 500; }

.transaction-table-header {
  background: var(--table-header);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 4px;
}

.transaction-amount-header {
  display: flex;
  gap: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 120px;
  justify-content: flex-end;
}

.running-balance-header { min-width: 80px; text-align: right; }

/* Goals page */
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  margin-bottom: 12px;
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* Placeholder page */
.placeholder-page {
  text-align: center;
  padding: 60px 20px;
}

.placeholder-page svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.placeholder-page h1 {
  font-size: 28px;
  color: var(--text);
  margin-bottom: 12px;
}

.placeholder-page p {
  color: var(--text-muted);
  font-size: 15px;
}

.placeholder-page .btn-back {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 24px;
  background: var(--gradient);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.placeholder-page .btn-back:hover { opacity: 0.9; }

/* ═══════════════════════════════════════
   DARK MODE FORM OVERRIDES
   ═══════════════════════════════════════ */

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--accent-text, #0369A1);
}

[data-theme="dark"] option {
  background-color: var(--surface);
  color: var(--text);
}

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
.color-green { color: var(--green-text, #15803d); }
.color-red { color: var(--red-text, #B91C1C); }
.color-amber { color: var(--amber-text, #B45309); }
.color-accent { color: var(--accent-text, #0369A1); }
.color-muted { color: var(--text-muted); }
.color-secondary { color: var(--text-secondary); }

.bg-green { background: var(--green-bg); }
.bg-red { background: var(--red-bg); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }
.fs-28 { font-size: 28px; }
.fs-36 { font-size: 36px; }
.fs-40 { font-size: 40px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.ls-1 { letter-spacing: 1px; }
.ls-2 { letter-spacing: 2px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

/* ═══════════════════════════════════════════════════════════════════════
   SPOTLIGHT TOUR
   ═══════════════════════════════════════════════════════════════════════ */

.spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: all;
    /* Invisible click-blocker; the visual darkness
       comes from the highlight's box-shadow */
}

.spotlight-highlight {
    position: fixed;
    border: 2px solid var(--accent);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    z-index: 9001;
    pointer-events: none;
    transition: top 0.35s ease, left 0.35s ease, width 0.35s ease, height 0.35s ease;
}

.tour-popover {
    position: fixed;
    z-index: 9002;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 24px;
    max-width: 340px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    animation: tourFadeIn 0.25s ease;
}

@keyframes tourFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.tour-popover__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.tour-popover__description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 16px;
}

.tour-popover__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-popover__steps {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 5px;
}

.tour-step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}

.tour-step-dot--active {
    background: var(--accent);
}

.tour-step-dot--done {
    background: var(--green);
}

.tour-popover__actions {
    display: flex;
    gap: 8px;
}

.tour-btn {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.tour-btn--skip {
    background: transparent;
    color: var(--text-muted);
}

.tour-btn--skip:hover {
    color: var(--text);
}

.tour-btn--prev {
    background: var(--inset-bg);
    color: var(--text-secondary);
}

.tour-btn--prev:hover {
    background: var(--border);
}

.tour-btn--next {
    background: var(--accent);
    color: #fff;
}

.tour-btn--next:hover {
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════════════
   SETUP CHECKLIST WIDGET
   ═══════════════════════════════════════════════════════════════════════ */

.checklist-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: checklistSlideIn 0.35s ease;
}

@keyframes checklistSlideIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    user-select: none;
}

.checklist-header__title {
    font-size: 13px;
    font-weight: 700;
}

.checklist-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checklist-header__btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
}

.checklist-header__btn:hover {
    color: #fff;
}

.checklist-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
}

.checklist-progress__fill {
    height: 100%;
    background: #fff;
    transition: width 0.4s ease;
}

.checklist-body {
    max-height: 400px;
    overflow-y: auto;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--text);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item:hover {
    background: var(--inset-bg);
}

.checklist-item--done {
    opacity: 0.55;
    cursor: default;
}

.checklist-item--done:hover {
    background: transparent;
}

.checklist-item__check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    transition: all 0.2s;
}

.checklist-item--done .checklist-item__check {
    background: var(--green);
    border-color: var(--green-text, #15803d);
    color: #fff;
}

.checklist-item__label {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
}

.checklist-item--done .checklist-item__label {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-congrats {
    padding: 20px 18px;
    text-align: center;
}

.checklist-congrats__emoji {
    font-size: 28px;
    margin-bottom: 8px;
}

.checklist-congrats__text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.checklist-congrats__sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════
   AUTH PAGES (login, signup, password reset, etc.)
   ═══════════════════════════════════════════════════════════════════════ */

.auth-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.auth-page {
    width: 100%;
    max-width: 420px;
    padding: 24px 16px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: var(--card-shadow);
}

.auth-card__header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-card__brand {
    font-size: 22px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.auth-card__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}

.auth-card__subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.auth-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-field input {
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--inset-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-field input:focus {
    border-color: var(--accent-text, #0369A1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-field input::placeholder {
    color: var(--text-muted);
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
}

.auth-checkbox input[type="checkbox"] {
    accent-color: var(--accent-text, #0369A1);
    width: 14px;
    height: 14px;
}

.auth-link--small {
    font-size: 12px;
    color: var(--accent-text, #0369A1);
    text-decoration: none;
}

.auth-link--small:hover {
    text-decoration: underline;
}

.auth-btn {
    width: 100%;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--gradient);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 16px var(--accent-glow);
    transition: opacity 0.2s;
    margin-top: 4px;
}

.auth-btn:hover {
    opacity: 0.9;
}

.auth-btn--disabled,
.auth-btn--disabled:hover {
    background: var(--border-strong);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

.auth-error {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--red-text, #B91C1C);
    font-size: 12px;
    line-height: 1.5;
}

.auth-error p {
    margin: 2px 0;
}

.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.auth-google-btn:hover {
    background: var(--inset-bg);
    border-color: var(--accent-text, #0369A1);
    opacity: 1;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin: 20px 0 0;
}

.auth-footer a {
    color: var(--accent-text, #0369A1);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-messages {
    margin-bottom: 16px;
}

.auth-message {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 8px;
}

.auth-message--success {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green-text, #15803d);
}

.auth-message--error {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red-text, #B91C1C);
}

.auth-message--info {
    background: var(--cyan-bg);
    border: 1px solid rgba(8, 145, 178, 0.15);
    color: var(--cyan);
}

/* ============================================
   Legal Pages (Privacy Policy, Terms of Service)
   ============================================ */
.legal-body .auth-page {
    max-width: 800px;
    padding: 2rem 1.5rem;
}

.legal-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
}

.legal-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.legal-effective {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.legal-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.legal-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.legal-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.legal-card ul,
.legal-card ol {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.legal-card li {
    margin-bottom: 0.35rem;
}

.legal-card a {
    color: var(--primary);
    text-decoration: underline;
}

.legal-card strong {
    color: var(--text-primary);
    font-weight: 600;
}

.legal-card table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.legal-card th,
.legal-card td {
    border: 1px solid var(--border-light);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.legal-card th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

/* TOS consent field on signup */
.auth-consent-field {
    margin-bottom: 1rem;
}

.auth-consent-field .auth-checkbox span {
    line-height: 1.4;
}

.auth-consent-field .auth-checkbox a {
    color: var(--primary);
    text-decoration: underline;
}

.auth-field-error {
    color: var(--red-text, #B91C1C);
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Home page footer */
.home-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 2rem 0 1rem;
}

.home-footer a {
    color: var(--text-muted);
    text-decoration: underline;
}

/* Dashboard legal footer */
.dashboard-legal-footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 1.5rem 0 1rem;
    margin-top: auto;
}

.dashboard-legal-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.dashboard-legal-footer a:hover {
    text-decoration: underline;
}

.dashboard-legal-footer span {
    margin: 0 0.35rem;
    opacity: 0.5;
}

/* Legal links in auth footer */
.auth-legal-links {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

.auth-legal-links a {
    color: var(--text-muted);
    text-decoration: underline;
}

/* MFA nudge banner on dashboard */
.mfa-nudge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--cyan-bg, rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(8, 145, 178, 0.15);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.mfa-nudge__content {
    flex: 1;
}

.mfa-nudge__link {
    color: var(--accent-text, #0369A1);
    font-weight: 600;
    text-decoration: underline;
}

.mfa-nudge--warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}

.mfa-nudge__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    padding: 0 4px;
    line-height: 1;
}

/* ============================================
   Family Sharing
   ============================================ */
.badge-family {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(14, 165, 233, 0.12);
    color: var(--accent-text, #0369A1);
}

.family-toggle {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.family-toggle a {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.family-toggle a.active {
    background: var(--accent);
    color: #fff;
}

.family-toggle a:not(.active):hover {
    background: var(--surface-alt);
}

.shared-item {
    border-left: 3px solid var(--accent);
    padding-left: 10px;
}


/* =============================================================================
   Gamification: Badges & Streaks
   ============================================================================= */

/* ── Badge Grid ─────────────────────────────────────────────────────── */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.2s;
}

.badge-card:hover {
    border-color: var(--accent-text, #0369A1);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.12);
    transform: translateY(-2px);
}

.badge-card--locked {
    opacity: 0.8;
    filter: grayscale(80%);
}

.badge-card--locked:hover {
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.badge-card__icon {
    font-size: 28px;
    line-height: 1;
}

.badge-card__name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.badge-card__desc {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.badge-card__date {
    font-size: 10px;
    color: var(--accent-text, #0369A1);
    font-weight: 500;
}

/* ── Badge Progress Bar ─────────────────────────────────────────────── */
.badge-progress-bar {
    height: 8px;
    background: var(--surface-alt);
    border-radius: 4px;
    overflow: hidden;
}

.badge-progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--cyan, #06B6D4));
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

/* ── Dashboard Widget ───────────────────────────────────────────────── */
.gamification-widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
}

.gamification-widget__link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.gamification-widget__link:hover {
    opacity: 0.9;
}

/* ── Streak & Badge Pills ───────────────────────────────────────────── */
.streak-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    background: var(--amber-bg, rgba(217, 119, 6, 0.1));
    color: var(--amber-text, var(--amber, #d97706));
    font-size: 13px;
    font-weight: 600;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 16px;
    border-radius: 50%;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}

/* ── Challenge Cards ────────────────────────────────────────────────── */
.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.challenge-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: all 0.2s;
}

.challenge-card:hover {
    border-color: var(--accent-text, #0369A1);
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.1);
}

.challenge-card--active {
    border-left: 3px solid var(--accent);
}

.challenge-card--completed {
    border-left: 3px solid var(--green, #22c55e);
}

.challenge-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.challenge-card__icon {
    font-size: 24px;
}

.challenge-card__name {
    font-size: 13px;
    font-weight: 600;
}

.challenge-card__type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-text, #0369A1);
    background: rgba(14, 165, 233, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

.challenge-card__desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.challenge-card__progress-wrap {
    margin-top: auto;
}

.challenge-card__progress {
    height: 6px;
    background: var(--surface-alt);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.challenge-card__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--cyan, #06B6D4));
    border-radius: 3px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.challenge-card__stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.challenge-card__meta {
    margin-top: 2px;
}

.challenge-card__join {
    width: 100%;
    margin-top: 4px;
}

.challenge-card__date {
    font-size: 10px;
    color: var(--green, #22c55e);
    font-weight: 500;
}

/* ── Challenge Dashboard Pill ──────────────────────────────────────── */
.challenge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.08);
    color: var(--accent-text, #0369A1);
    font-size: 12px;
    font-weight: 600;
}

/* ── Level Badge ────────────────────────────────────────────────────── */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(6, 182, 212, 0.12));
    color: var(--accent-text, #0369A1);
    font-size: 12px;
    font-weight: 700;
}
.level-badge--large {
    padding: 8px 16px;
    font-size: 20px;
    border-radius: 20px;
}

/* ── Level Progress Bar ────────────────────────────────────────────── */
.level-progress-bar {
    height: 8px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}
.level-progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--cyan, #06b6d4));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ── Level List ────────────────────────────────────────────────────── */
.level-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.level-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.level-item--reached {
    color: var(--text);
}
.level-item--current {
    background: rgba(14, 165, 233, 0.06);
    color: var(--accent-text, #0369A1);
    font-weight: 600;
}
.level-item__icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}
.level-item__name {
    flex: 1;
}
.level-item__points {
    font-size: 11px;
}
.level-item__badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-text, #0369A1);
    color: #fff;
}
.level-item__check {
    color: var(--green, #22c55e);
    font-weight: 700;
}

/* ── Points History ────────────────────────────────────────────────── */
.points-history {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.points-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--card-border);
}
.points-entry:last-child {
    border-bottom: none;
}
.points-entry__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.points-entry__reason {
    font-size: 13px;
    font-weight: 500;
}
.points-entry__date {
    font-size: 11px;
}
.points-entry__amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--green-text, var(--green, #22c55e));
    white-space: nowrap;
}

/* ── Level Pill (Dashboard Widget) ─────────────────────────────────── */
.level-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(6, 182, 212, 0.08));
    color: var(--accent-text, #0369A1);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

/* ── Leaderboard ───────────────────────────────────────────────────── */
.leaderboard-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.leaderboard-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--card-border);
}
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
    font-size: 13px;
}
.leaderboard-row:last-child {
    border-bottom: none;
}
.leaderboard-row--me {
    background: rgba(14, 165, 233, 0.06);
    font-weight: 600;
}
.leaderboard-col--rank { width: 50px; text-align: center; }
.leaderboard-col--name { flex: 1; min-width: 0; }
.leaderboard-col--level { width: 60px; text-align: center; }
.leaderboard-col--points { width: 80px; text-align: right; }
.leaderboard-col--badges { width: 60px; text-align: center; }
.leaderboard-col--streak { width: 60px; text-align: center; }
.leaderboard-col--challenges { width: 80px; text-align: center; }

/* Family dashboard leaderboard widget */
.leaderboard-widget__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.leaderboard-widget__row:last-child { border-bottom: none; }
.leaderboard-widget__row--me { font-weight: 600; }
.leaderboard-widget__rank { width: 24px; text-align: center; font-size: 16px; }
.leaderboard-widget__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Season card styles */
.season-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.season-card--upcoming { opacity: 0.7; }
.season-card--past { opacity: 0.6; }
.season-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.season-card__icon { font-size: 28px; }
.season-card__challenges {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.season-challenge-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}
.season-challenge-row--done { opacity: 0.7; }
.season-challenge-row--locked { opacity: 0.5; }
.season-challenge-row__icon { font-size: 18px; width: 24px; text-align: center; }
.season-challenge-row__info { flex: 1; min-width: 0; }
.season-challenge-row__progress { flex-shrink: 0; }

/* ── Health Score ───────────────────────────────────────────────────── */
.health-gauge {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
}
.health-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.health-gauge__track {
    fill: none;
    stroke: var(--border);
    stroke-width: 12;
}
.health-gauge__ring {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.3s;
}
.health-gauge--excellent .health-gauge__ring { stroke: var(--green); }
.health-gauge--good .health-gauge__ring { stroke: var(--accent); }
.health-gauge--fair .health-gauge__ring { stroke: var(--amber); }
.health-gauge--poor .health-gauge__ring { stroke: var(--red); }
.health-gauge__value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.health-gauge__score {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}
.health-gauge__label {
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}
.health-gauge--excellent .health-gauge__score { color: var(--green-text, #15803d); }
.health-gauge--good .health-gauge__score { color: var(--accent-text, #0369A1); }
.health-gauge--fair .health-gauge__score { color: var(--amber-text, #B45309); }
.health-gauge--poor .health-gauge__score { color: var(--red-text, #B91C1C); }

.health-components {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.health-component {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.health-component__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.health-component__icon {
    font-size: 20px;
}
.health-component__label {
    font-size: 14px;
    font-weight: 600;
}
.health-component__score {
    margin-left: auto;
    font-size: 16px;
    font-weight: 700;
}
.health-component__bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.health-component__bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.health-component__bar-fill--excellent { background: var(--green); }
.health-component__bar-fill--good { background: var(--accent); }
.health-component__bar-fill--fair { background: var(--amber); }
.health-component__bar-fill--poor { background: var(--red); }
.health-component__desc {
    font-size: 12px;
    color: var(--text-muted);
}

.health-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--amber);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.health-tip__icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}
.health-tip__text {
    font-size: 13px;
    line-height: 1.5;
}
.health-tip__label {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.health-widget-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.health-widget-pill:hover { opacity: 0.8; }
.health-widget-pill--excellent { background: rgba(34,197,94,0.15); color: var(--green-text, #15803d); }
.health-widget-pill--good { background: rgba(14,165,233,0.15); color: var(--accent-text, #0369A1); }
.health-widget-pill--fair { background: rgba(245,158,11,0.15); color: var(--amber-text, #B45309); }
.health-widget-pill--poor { background: rgba(239,68,68,0.15); color: var(--red-text, #B91C1C); }

/* ── Budget Streaks ────────────────────────────────────────────────── */
.budget-streak-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
}
.budget-streak-pill--active {
    background: rgba(245,158,11,0.15);
    color: var(--amber-text, #B45309);
}
.budget-streak-pill--broken {
    background: rgba(239,68,68,0.1);
    color: var(--red-text, #B91C1C);
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .badge-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
    .badge-card {
        padding: 12px 8px;
    }
    .badge-card__icon {
        font-size: 22px;
    }
    .challenge-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .challenge-card {
        padding: 12px;
    }
    .level-item {
        padding: 8px 10px;
        font-size: 12px;
    }
    .level-item__icon {
        font-size: 16px;
    }
    .health-gauge {
        width: 160px;
        height: 160px;
    }
    .health-gauge__score {
        font-size: 36px;
    }
    .health-components {
        grid-template-columns: 1fr;
    }
}

/* ── Milestone Celebrations ────────────────────────────────────────── */

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    pointer-events: none;
    display: none;
}

.celebration-confetti-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.celebration-confetti {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 8px;
    opacity: 0;
    animation: confettiDrop 2.5s ease-out forwards;
}

@keyframes confettiDrop {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    25% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

.celebration-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    pointer-events: all;
    z-index: 10001;
    max-width: 400px;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.celebration-toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.celebration-toast--hiding {
    transform: translateY(120%);
    opacity: 0;
}

.celebration-toast__icon {
    font-size: 36px;
    flex-shrink: 0;
    line-height: 1;
}

.celebration-toast__content {
    flex: 1;
    min-width: 0;
}

.celebration-toast__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.celebration-toast__message {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.celebration-toast__dismiss {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.celebration-toast__dismiss:hover {
    color: var(--text);
}

@media (max-width: 600px) {
    .celebration-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
}

/* ── Weekly Recaps ─────────────────────────────────────────────────── */

.recap-card {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recap-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.recap-card__period {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recap-card__icon {
    font-size: 20px;
}

.recap-card__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}

.recap-card__stat-value {
    font-size: 16px;
    font-weight: 700;
}

.recap-card__stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.recap-card__badges {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.recap-detail__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.recap-detail__row:last-child {
    border-bottom: none;
}

.recap-detail__goal {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.recap-detail__goal:last-child {
    border-bottom: none;
}

.recap-section {
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .recap-card__stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Spending Challenges ──────────────────────────────────────── */

.spending-type-toggle {
    display: flex;
    gap: 12px;
}

.spending-type-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.spending-type-option input[type="radio"] {
    display: none;
}

.spending-type-option:hover {
    border-color: var(--accent-text, #0369A1);
}

.spending-type-option--active {
    border-color: var(--accent-text, #0369A1);
    background: var(--accent-bg);
}

.spending-type-option__icon {
    font-size: 24px;
}

.spending-type-option__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.spending-type-option__desc {
    font-size: 11px;
    color: var(--text-muted);
}

.spending-duration-toggle {
    display: flex;
    gap: 12px;
}

.spending-duration-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.spending-duration-option input[type="radio"] {
    display: none;
}

.spending-duration-option:hover {
    border-color: var(--accent-text, #0369A1);
}

.spending-duration-option--active {
    border-color: var(--accent-text, #0369A1);
    background: var(--accent-bg);
}

.spending-duration-option__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.challenge-card--failed {
    opacity: 0.7;
}

.challenge-card__progress-fill--success {
    background: var(--green);
}

.challenge-card__progress-fill--warning {
    background: var(--amber);
}

.challenge-card__progress-fill--danger {
    background: var(--red);
}

@media (max-width: 600px) {
    .spending-type-toggle,
    .spending-duration-toggle {
        flex-direction: column;
    }
}

/* ═══════════════════════════════════════
   FILTER GRID RESPONSIVE (new layout)
   ═══════════════════════════════════════ */

@media (max-width: 600px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filter-group--wide { grid-column: span 2; }
  .filter-bar { padding: 12px; }
  .filter-actions { flex-wrap: wrap; }
  .filter-actions .btn-primary,
  .filter-actions .btn-outline { flex: 1; text-align: center; }
}

@media (max-width: 400px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .filter-group--wide { grid-column: span 1; }
}

/* ═══════════════════════════════════════
   ADDITIONAL THEMES
   ═══════════════════════════════════════ */

/* ─── EMERALD BANKING THEME (Light) ─── */
[data-theme="emerald_banking"] {
  --bg: #F0FDF4;
  --surface: #ffffff;
  --surface-alt: #ECFDF5;
  --border: rgba(5, 150, 105, 0.08);
  --border-strong: rgba(5, 150, 105, 0.15);
  --text: #064E3B;
  --text-secondary: #065F46;
  --text-muted: #047857;
  --topbar-bg: rgba(240, 253, 244, 0.88);
  --accent: #059669;
  --accent-glow: rgba(5, 150, 105, 0.2);
  --accent-pill-bg: #ECFDF5;
  --gradient: linear-gradient(135deg, #059669, #10B981);
  --hero-bg: linear-gradient(135deg, #F0FDF4 0%, #D1FAE5 50%, #F0FDF4 100%);
  --hero-orb: rgba(5, 150, 105, 0.06);
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.07);
  --green-border: rgba(22, 163, 74, 0.15);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.06);
  --red-border: rgba(220, 38, 38, 0.12);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.06);
  --cyan: #0891b2;
  --cyan-bg: rgba(8, 145, 178, 0.06);
  --pink: #db2777;
  --progress-track: rgba(5, 150, 105, 0.06);
  --tip-bg: linear-gradient(135deg, rgba(5, 150, 105, 0.04), rgba(16, 185, 129, 0.04));
  --tip-border: rgba(5, 150, 105, 0.12);
  --tip-text: #047857;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --toggle-bg: #ECFDF5;
  --toggle-border: rgba(5, 150, 105, 0.2);
  --subtle-bg: rgba(255, 255, 255, 0.8);
  --subtle-border: rgba(5, 150, 105, 0.06);
  --inset-bg: rgba(5, 150, 105, 0.02);
  --inset-border: rgba(5, 150, 105, 0.04);
  --table-header: rgba(5, 150, 105, 0.03);
  --table-row-alt: rgba(5, 150, 105, 0.015);
  --grid-line: rgba(5, 150, 105, 0.06);
  --win-bg: rgba(22, 163, 74, 0.05);
  --win-border: rgba(22, 163, 74, 0.15);
  --hero-text: #064E3B;
  --focus-ring: rgba(5, 150, 105, 0.5);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --modal-bg: #ffffff;
  --accent-text: #047857;
  --green-text: #15803d;
  --amber-text: #B45309;
  --red-text: #B91C1C;
}

[data-theme="emerald_banking"] .sidebar {
  background: linear-gradient(180deg, #064E3B 0%, #065F46 100%);
  border-right-color: rgba(5, 150, 105, 0.15);
}

/* ─── FROST GLASS THEME (Light, Glassmorphism) ─── */
[data-theme="frost_glass"] {
  --bg: #F0F4FF;
  --surface: rgba(255, 255, 255, 0.65);
  --surface-alt: rgba(241, 245, 249, 0.7);
  --border: rgba(99, 102, 241, 0.1);
  --border-strong: rgba(99, 102, 241, 0.2);
  --text: #1E1B4B;
  --text-secondary: #3730A3;
  --text-muted: #4338CA;
  --topbar-bg: rgba(240, 244, 255, 0.85);
  --accent: #6366F1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-pill-bg: rgba(255, 255, 255, 0.45);
  --gradient: linear-gradient(135deg, #6366F1, #818CF8);
  --hero-bg: linear-gradient(135deg, #F0F4FF 0%, #E0E7FF 50%, #F0F4FF 100%);
  --hero-orb: rgba(99, 102, 241, 0.08);
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.07);
  --green-border: rgba(22, 163, 74, 0.15);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.06);
  --red-border: rgba(220, 38, 38, 0.12);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.06);
  --cyan: #0891b2;
  --cyan-bg: rgba(8, 145, 178, 0.06);
  --pink: #db2777;
  --progress-track: rgba(99, 102, 241, 0.06);
  --tip-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(129, 140, 248, 0.06));
  --tip-border: rgba(99, 102, 241, 0.12);
  --tip-text: #4338CA;
  --card-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
  --toggle-bg: rgba(224, 231, 255, 0.6);
  --toggle-border: rgba(99, 102, 241, 0.2);
  --subtle-bg: rgba(255, 255, 255, 0.5);
  --subtle-border: rgba(99, 102, 241, 0.08);
  --inset-bg: rgba(99, 102, 241, 0.03);
  --inset-border: rgba(99, 102, 241, 0.06);
  --table-header: rgba(99, 102, 241, 0.04);
  --table-row-alt: rgba(99, 102, 241, 0.02);
  --grid-line: rgba(99, 102, 241, 0.06);
  --win-bg: rgba(22, 163, 74, 0.05);
  --win-border: rgba(22, 163, 74, 0.15);
  --hero-text: #1E1B4B;
  --focus-ring: rgba(99, 102, 241, 0.5);
  --overlay-bg: rgba(0, 0, 0, 0.4);
  --modal-bg: rgba(255, 255, 255, 0.9);
  --accent-text: #4338CA;
  --green-text: #15803d;
  --amber-text: #B45309;
  --red-text: #B91C1C;
}

[data-theme="frost_glass"] .sidebar {
  background: linear-gradient(180deg, #312E81 0%, #4338CA 100%);
  border-right-color: rgba(99, 102, 241, 0.2);
}

[data-theme="frost_glass"] .card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ─── CARBON THEME (Dark, True Black) ─── */
[data-theme="carbon"] {
  --bg: #000000;
  --surface: #0A0A0A;
  --surface-alt: #171717;
  --border: rgba(34, 211, 238, 0.08);
  --border-strong: rgba(34, 211, 238, 0.15);
  --text: #E4E4E7;
  --text-secondary: #D4D4D8;
  --text-muted: #A1A1AA;
  --topbar-bg: rgba(0, 0, 0, 0.92);
  --accent: #22D3EE;
  --accent-glow: rgba(34, 211, 238, 0.2);
  --accent-pill-bg: #0D1B1F;
  --gradient: linear-gradient(135deg, #22D3EE, #06B6D4);
  --hero-bg: linear-gradient(135deg, #000000 0%, #0A0A0A 50%, #000000 100%);
  --hero-orb: rgba(34, 211, 238, 0.08);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --green-border: rgba(34, 197, 94, 0.2);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --red-border: rgba(239, 68, 68, 0.2);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.1);
  --cyan: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.1);
  --pink: #ec4899;
  --progress-track: rgba(255, 255, 255, 0.04);
  --tip-bg: linear-gradient(135deg, rgba(34, 211, 238, 0.06), rgba(6, 182, 212, 0.06));
  --tip-border: rgba(34, 211, 238, 0.12);
  --tip-text: #67E8F9;
  --card-shadow: none;
  --toggle-bg: rgba(34, 211, 238, 0.08);
  --toggle-border: rgba(34, 211, 238, 0.15);
  --subtle-bg: rgba(255, 255, 255, 0.03);
  --subtle-border: rgba(255, 255, 255, 0.05);
  --inset-bg: rgba(255, 255, 255, 0.02);
  --inset-border: rgba(255, 255, 255, 0.03);
  --table-header: rgba(34, 211, 238, 0.05);
  --table-row-alt: rgba(255, 255, 255, 0.015);
  --grid-line: rgba(255, 255, 255, 0.03);
  --win-bg: rgba(34, 197, 94, 0.08);
  --win-border: rgba(34, 197, 94, 0.2);
  --hero-text: #ffffff;
  --focus-ring: rgba(34, 211, 238, 0.5);
  --overlay-bg: rgba(0, 0, 0, 0.8);
  --modal-bg: #0A0A0A;
  --accent-text: #22D3EE;
  --green-text: #4ADE80;
  --amber-text: #FBBF24;
  --red-text: #F87171;
  color-scheme: dark;
}

[data-theme="carbon"] .sidebar {
  background: linear-gradient(180deg, #000000 0%, #0A0A0A 100%);
  border-right-color: rgba(34, 211, 238, 0.1);
}

[data-theme="carbon"] input,
[data-theme="carbon"] select,
[data-theme="carbon"] textarea {
  background-color: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="carbon"] input:focus,
[data-theme="carbon"] select:focus,
[data-theme="carbon"] textarea:focus {
  border-color: var(--accent-text, #0369A1);
}

[data-theme="carbon"] option {
  background-color: var(--surface);
  color: var(--text);
}

/* ─── Theme Gallery Cards ─── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.theme-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.theme-card:hover {
  border-color: var(--border-strong);
}

.theme-card--active {
  border-color: var(--accent-text, #0369A1);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.theme-card--locked {
  opacity: 0.7;
}

.theme-card__preview {
  height: 100px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 10px 10px 0 0;
}

.theme-card__preview-bar {
  height: 12px;
  border-radius: 4px;
}

.theme-card__preview-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  flex: 1;
}

.theme-card__preview-text {
  font-size: 24px;
  font-weight: 700;
}

.theme-card__preview-accent {
  width: 32px;
  height: 16px;
  border-radius: 4px;
}

.theme-card__info {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.theme-card__lock {
  display: flex;
  align-items: center;
  gap: 4px;
}

.theme-card__lock-icon {
  font-size: 14px;
}

.theme-card__status--active {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-text, #15803d);
}

@media (max-width: 600px) {
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .theme-card__preview {
        height: 80px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   FORUM
   ═══════════════════════════════════════════════════════════════════ */

/* Category filter tabs */
.forum-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.forum-category-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--card-bg);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.forum-category-tab:hover {
    color: var(--text);
    border-color: var(--accent-text, #0369A1);
}

.forum-category-tab--active {
    color: #fff;
    background: var(--accent-text, #0369A1);
    border-color: var(--accent-text, #0369A1);
}

/* Post row (list item) */
.forum-post-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.forum-post-row:last-child {
    border-bottom: none;
}

.forum-post-row--pinned {
    border-left: 3px solid var(--warning, #d97706);
    padding-left: 12px;
    margin-left: -12px;
}

.forum-post-row__main {
    flex: 1;
    min-width: 0;
}

.forum-post-row__title-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.forum-post-row__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-post-row__title:hover {
    color: var(--accent-text, #0369A1);
}

.forum-post-row__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.forum-post-row__sep {
    color: var(--border);
}

.forum-post-row__stats {
    flex-shrink: 0;
    margin-left: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Pinned / Locked badges */
.forum-pinned-badge,
.forum-locked-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.forum-pinned-badge {
    background: var(--warning-bg, #fef3c7);
    color: var(--warning, #d97706);
}

.forum-locked-badge {
    background: var(--info-bg, #dbeafe);
    color: var(--info, #6b7280);
}

/* Post detail */
.forum-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.forum-post-category {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.forum-post-actions {
    display: flex;
    gap: 8px;
}

.forum-post-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.forum-post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* Markdown rendered content */
.forum-post-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    word-break: break-word;
}

.forum-post-content h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 0 8px;
    color: var(--text);
}

.forum-post-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 16px 0 6px;
    color: var(--text);
}

.forum-post-content p {
    margin: 0 0 12px;
}

.forum-post-content ul,
.forum-post-content ol {
    margin: 0 0 12px;
    padding-left: 24px;
}

.forum-post-content blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--accent);
    background: var(--bg);
    border-radius: 0 4px 4px 0;
    color: var(--text-muted);
}

.forum-post-content code {
    font-family: monospace;
    font-size: 13px;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--accent-text, #0369A1);
}

.forum-post-content pre {
    margin: 12px 0;
    padding: 14px;
    background: var(--bg);
    border-radius: 6px;
    overflow-x: auto;
}

.forum-post-content pre code {
    background: none;
    padding: 0;
}

.forum-post-content a {
    color: var(--accent-text, #0369A1);
    text-decoration: underline;
}

.forum-post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* Author card */
.forum-author-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.forum-author-avatar-wrap {
    flex-shrink: 0;
}

.forum-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
}

.forum-author-avatar--img {
    object-fit: cover;
}

.forum-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.forum-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.forum-author-level {
    font-size: 11px;
    color: var(--text-muted);
}

.forum-author-badges {
    display: flex;
    gap: 2px;
}

.forum-author-badge {
    font-size: 12px;
    cursor: default;
}

/* Reply */
.forum-reply {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.forum-reply:first-child {
    border-top: none;
}

.forum-reply-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.forum-reply-meta {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.forum-reply-content {
    padding-left: 46px;
}

.forum-reply-actions {
    display: flex;
    gap: 6px;
    padding-left: 46px;
    margin-top: 6px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Forum empty state */
.forum-empty {
    padding: 20px;
}


/* ═══════════════════════════════════════════════════════════════════
   FAMILY CHAT
   ═══════════════════════════════════════════════════════════════════ */

.family-chat {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
}
.family-chat__messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.family-chat__message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 85%;
}
.family-chat__message--own {
    flex-direction: row-reverse;
    align-self: flex-end;
}
.family-chat__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.family-chat__avatar--img {
    object-fit: cover;
    padding: 0;
    background: none;
}
.family-chat__message-bubble {
    background: var(--surface-alt, var(--surface));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    position: relative;
}
.family-chat__message--own .family-chat__message-bubble {
    background: var(--accent-bg, rgba(14, 165, 233, 0.1));
    border-color: var(--accent-border, rgba(14, 165, 233, 0.25));
}
.family-chat__message-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.family-chat__message--own .family-chat__message-sender {
    display: none;
}
.family-chat__message-content {
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    color: var(--text-primary);
}
.family-chat__message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}
.family-chat__message-edited {
    font-style: italic;
    color: var(--text-muted);
    font-size: 10px;
}
.family-chat__message-actions {
    display: none;
    gap: 4px;
    margin-top: 4px;
}
.family-chat__message:hover .family-chat__message-actions {
    display: flex;
}
.chat-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.7;
}
.chat-action-btn:hover {
    opacity: 1;
    background: var(--surface-alt, var(--bg-secondary));
}
.family-chat__input {
    border-top: 1px solid var(--border);
    padding: 10px 14px;
}
.family-chat__input textarea {
    resize: none;
    margin-bottom: 6px;
}
.family-chat__input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.family-chat__empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Forum responsive ── */
@media (max-width: 768px) {
    .forum-category-tabs { gap: 4px; }
    .forum-post-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 12px 0;
    }
    .forum-post-row__stats {
        display: none;
    }
    .forum-post-row__meta {
        flex-wrap: wrap;
    }
    .forum-reply-content {
        padding-left: 0;
    }
    .forum-reply-actions {
        padding-left: 0;
    }
    .forum-reply-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .forum-reply-meta {
        margin-left: 0;
    }
}

/* ── Family chat responsive ── */
@media (max-width: 768px) {
    .family-chat__messages {
        padding: 8px 0;
    }
    .family-chat__message {
        gap: 8px;
    }
    .family-chat__message-bubble {
        max-width: 90%;
    }
    .family-chat__input {
        padding: 8px 10px;
    }
    .chat-action-btn {
        min-height: 36px;
        min-width: 36px;
        font-size: 13px;
        padding: 4px 8px;
    }
}
