/* ═══════════════════════════════════════════════════════════
   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: #64748B;
  --text-muted: #94A3B8;
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --accent: #0EA5E9;
  --accent-glow: rgba(14, 165, 233, 0.2);
  --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;
}

/* ─── 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: #94A3B8;
  --text-muted: #475569;
  --topbar-bg: rgba(15, 23, 42, 0.92);
  --accent: #38BDF8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --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;
  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-decoration: none; }
a: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.3); 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.35);
  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.6); 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-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: #6366f1;
  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; }
.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);
  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);
  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);
  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); }

/* ─── 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); 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); }
.badge--red { background: var(--red-bg); color: var(--red); }
.badge--accent { background: var(--toggle-bg); color: var(--accent); }

/* ─── 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); }
.account-card__balance--red { color: var(--red); }

/* 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-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);
}

.account-card-actions svg {
  width: 18px;
  height: 18px;
}

.account-card-balance {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
}

.account-card.debt .account-card-balance {
  color: var(--red);
}

.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);
  border-color: rgba(14, 165, 233, 0.15);
}

.account-tag.rate {
  background: var(--amber-bg);
  color: var(--amber);
  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); }

.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); }
.txn-amount--expense { color: var(--red); }
.txn-amount--transfer { color: var(--accent); }

/* 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);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.transaction-tag.withdrawal {
  background: var(--red-bg);
  color: var(--red);
}

.transaction-tag.category {
  background: rgba(14, 165, 233, 0.06);
  color: var(--accent);
}

.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); }
.transaction-amount.negative { color: var(--red); }

.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); }
.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); }
.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); }
.category-label--debt { color: var(--red); }

/* ─── 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);
  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); }
.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); 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); color: var(--accent); }
.filter-pill.active {
  background: rgba(14, 165, 233, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  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;
}

/* ═══════════════════════════════════════
   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);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-row {
  display: grid;
  grid-template-columns: 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);
  font-size: 13px;
  margin-bottom: 4px;
}

.form-error:last-child { margin-bottom: 0; }

.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);
}

.recurring-fields {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
}

.multi-select {
  min-height: 80px;
  padding: 8px;
}

.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);
  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-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);
}

.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);
  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);
  border: 1px solid var(--green-border);
}

.messages .error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.messages .info {
  background: rgba(14, 165, 233, 0.06);
  color: var(--accent);
  border: 1px solid rgba(14, 165, 233, 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);
  opacity: 1;
}

.page-link.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  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); }

.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); }
.report-table .amount.negative { color: var(--red); }

.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-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);
  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); }
.net-worth-box.negative .net-worth-value { color: var(--red); }

.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: 12px;
}

.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;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-input { flex: 1; min-width: 150px; }
.filter-select { min-width: 140px; }
.filter-date { flex: 0; min-width: 140px; }

.filter-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ═══════════════════════════════════════
   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);
  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); }

.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); background: var(--inset-bg); }
.category-actions button.delete:hover { color: var(--red); 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); background: var(--inset-bg); }
.tag-actions button.delete:hover { color: var(--red); 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); opacity: 1; }
.filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.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); }
.notification-card.notification-severity-danger { border-left-color: var(--red); }
.notification-card.notification-severity-info { border-left-color: var(--accent); }

.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); }
.notification-type-bill_reminder { background: rgba(14, 165, 233, 0.06); color: var(--accent); }
.notification-type-large_transaction { background: var(--red-bg); color: var(--red); }
.notification-type-weekly_summary { background: var(--green-bg); color: var(--green); }

.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); }

.notification-card-message {
  font-size: 12px;
  color: var(--text-muted);
  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); }
.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); }

.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); }
.import-stat.duplicate { background: var(--amber-bg); color: var(--amber); }
.import-stat.error { background: var(--red-bg); color: var(--red); }

.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);
}

.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); }
.import-status-icon.duplicate { color: var(--amber); }
.import-status-icon.error { color: var(--red); }

.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);
}

.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); }
.summary-card-value.negative { color: var(--red); }

/* 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-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);
}

[data-theme="dark"] option {
  background-color: var(--surface);
  color: var(--text);
}

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
.color-green { color: var(--green); }
.color-red { color: var(--red); }
.color-amber { color: var(--amber); }
.color-accent { color: var(--accent); }
.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);
    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);
    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);
    width: 14px;
    height: 14px;
}

.auth-link--small {
    font-size: 12px;
    color: var(--accent);
    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);
    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);
    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);
    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);
}

.auth-message--error {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red);
}

.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);
    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);
    font-weight: 600;
    text-decoration: underline;
}

.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);
}

.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);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.12);
    transform: translateY(-2px);
}

.badge-card--locked {
    opacity: 0.4;
    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-muted);
    line-height: 1.3;
}

.badge-card__date {
    font-size: 10px;
    color: var(--accent);
    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, #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);
    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);
    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);
    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);
    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);
    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);
    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, #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);
    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; }

/* ── 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;
    }
}
