/* ===== CSS Variables & Reset ===== */
:root {
  --bg: #f3f0f5;
  --bg-card: #ffffff;
  --bg-secondary: #f9f7fb;
  --bg-sidebar: #1a0e2e;
  --bg-sidebar-hover: #2a1845;
  --bg-sidebar-active: #3d2560;
  --text: #1a0e2e;
  --text-secondary: #6b5b7b;
  --text-sidebar: #b8a5cf;
  --text-sidebar-active: #ffffff;
  --border: #e2dce8;
  --primary: #5b2d8e;
  --primary-hover: #4a2375;
  --primary-light: #f3edf9;
  --accent: #b8860b;
  --accent-light: #fdf6e3;
  --income: #059669;
  --income-light: #ecfdf5;
  --expense: #dc2626;
  --expense-light: #fef2f2;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #7c3aed;
  --info-light: #f3edf9;
  --shadow-sm: 0 1px 2px rgba(26,14,46,0.04);
  --shadow: 0 1px 3px rgba(26,14,46,0.06), 0 1px 2px rgba(26,14,46,0.04);
  --shadow-md: 0 4px 12px rgba(26,14,46,0.08), 0 2px 4px rgba(26,14,46,0.04);
  --shadow-lg: 0 12px 24px rgba(26,14,46,0.12), 0 4px 8px rgba(26,14,46,0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-width: 260px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0d0818;
  --bg-card: #150e24;
  --bg-secondary: #1e1433;
  --border: #2a1d42;
  --text: #f1f0f5;
  --text-secondary: #b8a5cf;
  --primary: #a855f7;
  --primary-hover: #9333ea;
  --primary-light: #2a1545;
  --accent: #d4a843;
  --accent-light: #1a1505;
  --income-light: #052e16;
  --expense-light: #2d0a0a;
  --warning-light: #2d1a04;
  --info-light: #2a1545;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.5);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1a0e2e 0%, #120828 100%);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-text {
  font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
  font-size: 1.25rem;
  font-weight: 700;
  font-style: italic;
  color: white;
  letter-spacing: 0.02em;
}

.nav-links {
  list-style: none;
  padding: 1.25rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #e2e8f0;
}

.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: linear-gradient(135deg, var(--bg-sidebar-active), rgba(184,134,11,0.15));
  color: var(--text-sidebar-active);
  border-left: 3px solid #daa520;
  font-weight: 600;
}

.nav-link.active svg { opacity: 1; color: #daa520; }

/* Sub-navigation */
.nav-parent { position: relative; }

.nav-links .nav-parent ul.nav-sub {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links .nav-parent.expanded ul.nav-sub {
  max-height: 200px;
}

.nav-sub-link {
  padding-left: 2.75rem !important;
  font-size: 0.85rem !important;
  opacity: 0.85;
}

.nav-sub-link svg {
  width: 16px !important;
  height: 16px !important;
}

.nav-sub-link.active {
  opacity: 1;
}

/* Nested sub-navigation (3rd level) */
.nav-sub-nested {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-sub-nested.expanded {
  max-height: 200px;
}

.nav-sub-nested-link {
  padding-left: 3.75rem !important;
  font-size: 0.8rem !important;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Mobile header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(135deg, #1a0e2e, #120828);
  color: white;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.menu-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.25rem;
}

.menu-btn svg { width: 24px; height: 24px; }

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.25rem 2.5rem;
  max-width: 1200px;
  width: 100%;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.view-header h1 {
  font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.view-subtitle {
  color: var(--text-secondary);
  margin-top: 0.3rem;
  font-size: 0.925rem;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.view h2, .view h3, .card h3 {
  font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header-row h3 { margin-bottom: 0; }

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.summary-card:hover {
  border-color: rgba(184,134,11,0.25);
  box-shadow: 0 4px 16px rgba(184,134,11,0.08);
}

.card-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg { width: 24px; height: 24px; }

.income-icon { background: var(--income-light); color: var(--income); }
.expense-icon { background: var(--expense-light); color: var(--expense); }
.balance-icon { background: var(--primary-light); color: var(--primary); }
.savings-icon { background: var(--accent-light); color: var(--accent); }

.card-info { display: flex; flex-direction: column; }

.card-label {
  font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.2rem;
}

/* ===== Charts ===== */
.charts-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chart-card { min-height: 320px; }
.chart-container { position: relative; height: 260px; }
.chart-container-doughnut { height: 240px; display: flex; align-items: center; justify-content: center; }

/* ===== Dashboard Bottom ===== */
.dashboard-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== Budget Progress Bars ===== */
.budget-item {
  margin-bottom: 1rem;
}

.budget-item:last-child { margin-bottom: 0; }

.budget-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.budget-item-label {
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.budget-item-values {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}

[data-theme="dark"] .progress-bar {
  background: rgba(255,255,255,0.08);
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4a2375);
  color: white;
  box-shadow: 0 2px 6px rgba(91,45,142,0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4a2375, #3a1a5e);
  box-shadow: 0 4px 12px rgba(91,45,142,0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: var(--expense-light);
  color: var(--expense);
  border: 1px solid transparent;
}

.btn-danger:hover { background: var(--expense); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 0.4rem 0.75rem;
}

.btn-ghost:hover { background: var(--primary-light); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--bg); color: var(--text); }
[data-theme="dark"] .btn-icon:hover { background: rgba(255,255,255,0.08); }

.btn-icon svg { width: 16px; height: 16px; }

.btn-toggle {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.btn-toggle.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.toggle-group { display: flex; gap: 0.5rem; }

.link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.link:hover { text-decoration: underline; }

.muted { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 0.75rem; }

/* ===== Filters ===== */
.filters-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 0.85rem;
  flex: 1;
  min-width: 200px;
  transition: border-color var(--transition);
}

.search-box:focus-within { border-color: var(--primary); }

[data-theme="dark"] .search-box { background: rgba(255,255,255,0.04); }

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: transparent;
  padding: 0.6rem 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  width: 100%;
}

select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

select:focus { border-color: var(--primary); }

/* ===== Tables ===== */
.table-container { overflow-x: auto; }

.txn-table {
  width: 100%;
  border-collapse: collapse;
}

.txn-table th {
  text-align: left;
  padding: 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border);
}

.txn-table td {
  padding: 0.85rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.txn-table tr:hover td { background: var(--primary-light); }

.text-right { text-align: right; }

.txn-amount-income { color: var(--income); font-weight: 700; }
.txn-amount-expense { color: var(--expense); font-weight: 700; }
.txn-amount-transfer { color: var(--info); font-weight: 700; }

.txn-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  font-size: 0.775rem;
  font-weight: 600;
  background: var(--bg);
  letter-spacing: 0.01em;
}

[data-theme="dark"] .txn-category-badge { background: rgba(255,255,255,0.06); }

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Budgets Grid ===== */
.budget-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.budget-month-nav h3 { margin: 0; }

.budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.budget-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.budget-card-header h3 {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-spent {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.budget-limit-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.budget-progress-lg {
  height: 12px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .budget-progress-lg { background: rgba(255,255,255,0.08); }

.budget-progress-lg .progress-fill { height: 100%; border-radius: 99px; transition: width 0.5s ease; }

.budget-remaining {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===== Accounts Grid ===== */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.account-card {
  position: relative;
  overflow: hidden;
}

.account-card-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.account-type-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.account-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.account-balance {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.account-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ===== Settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.settings-grid select {
  width: 100%;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0.2rem;
  background: var(--bg);
}

[data-theme="dark"] .category-tag { background: rgba(255,255,255,0.06); }

.category-tag .remove-cat {
  cursor: pointer;
  margin-left: 0.2rem;
  opacity: 0.5;
  font-size: 1rem;
  line-height: 1;
}

.category-tag .remove-cat:hover { opacity: 1; }

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input[type="text"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}

.inline-form input[type="text"]:focus { border-color: var(--primary); }

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,14,46,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text); }

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1rem;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="color"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,45,142,0.15);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary);
}

.empty-state p {
  margin-bottom: 0.5rem;
  font-size: 0.925rem;
}

/* ===== Goals ===== */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.goal-card {
  padding: 1.5rem;
}

.goal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.goal-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.goal-amount {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.goal-target-text {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.goal-progress-lg {
  height: 10px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

[data-theme="dark"] .goal-progress-lg {
  background: rgba(255,255,255,0.08);
}

.goal-progress-lg .progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.goal-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.goal-contribute-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.goal-contribute-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.goal-contribute-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,45,142,0.15);
}

.goal-linked-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  font-weight: 500;
}

.form-hint {
  display: block;
  font-size: 0.775rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ===== Bank Connections ===== */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}

.connection-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.connection-info {
  flex: 1;
  min-width: 0;
}

.connection-name {
  font-weight: 600;
  font-size: 0.925rem;
  margin-bottom: 0.15rem;
}

.connection-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Categories ===== */
.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.category-row:last-child {
  border-bottom: none;
}

.category-row:hover {
  background: rgba(91,45,142,0.03);
}

[data-theme="dark"] .category-row:hover {
  background: rgba(255,255,255,0.03);
}

.category-row-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.category-row-name {
  font-weight: 500;
  font-size: 0.925rem;
}

.category-row-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0.4;
  transition: opacity var(--transition);
}

.category-row:hover .category-row-actions {
  opacity: 1;
}

/* ===== Investments ===== */
.inv-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.positive { color: var(--income) !important; }
.negative { color: var(--expense) !important; }
.bold { font-weight: 700; }

/* ===== Auto-suggest ===== */
.suggest-dropdown {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 180px;
  overflow-y: auto;
  z-index: 300;
  font-size: 0.85rem;
}

.suggest-item {
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition);
}

.suggest-item:hover { background: var(--primary-light); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem;
    padding-top: calc(60px + 1.25rem);
  }

  .charts-row { grid-template-columns: 1fr; }
  .dashboard-bottom { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .view-header h1 { font-size: 1.5rem; }
}

/* ===== Auth Screen ===== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #1a0e2e 0%, #3b1a5e 50%, #1a0e2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  margin-bottom: 0.75rem;
}

.auth-logo h1 {
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-logo p {
  color: #b8a5cf;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.auth-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h2 {
  font-size: 1.25rem;
  color: #1a0e2e;
  margin-bottom: 0.25rem;
}

.auth-card .auth-subtitle {
  color: #6b5b7b;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.auth-card .form-group {
  margin-bottom: 1rem;
}

.auth-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a0e2e;
  margin-bottom: 0.35rem;
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid #e2dce8;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #f9f7fb;
  color: #1a0e2e;
  transition: border-color 0.2s;
}

.auth-card input:focus {
  outline: none;
  border-color: #5b2d8e;
  box-shadow: 0 0 0 3px rgba(91,45,142,0.1);
}

.auth-btn {
  width: 100%;
  padding: 0.75rem;
  background: #5b2d8e;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.auth-btn:hover {
  background: #4a2375;
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-toggle {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: #6b5b7b;
}

.auth-toggle a {
  color: #5b2d8e;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

.auth-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.auth-success {
  background: #ecfdf5;
  color: #059669;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: #b8a5cf;
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2dce8;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: #b8a5cf;
}

.auth-footer a {
  color: #b8a5cf;
  text-decoration: underline;
}

/* ===== Landing Page ===== */
#landing-page {
  position: fixed;
  inset: 0;
  z-index: 9998;
  overflow-y: auto;
  background: #ffffff;
}

/* Nav */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(26, 14, 46, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(184, 165, 207, 0.15);
}

.landing-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #ffffff;
  font-family: 'Times New Roman MT', 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.3px;
}

.landing-nav-brand img {
  border-radius: 8px;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.landing-nav-links a {
  color: #b8a5cf;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.landing-nav-links a:hover {
  color: #ffffff;
}

.landing-nav-signin {
  cursor: pointer;
}

.landing-nav-cta {
  background: var(--accent, #b8860b);
  color: #ffffff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.landing-nav-cta:hover {
  background: #9a7209;
}

/* Hero */
.landing-hero {
  background: linear-gradient(135deg, #1a0e2e 0%, #3b1a5e 50%, #1a0e2e 100%);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
}

.landing-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.landing-hero h1 {
  font-family: 'Times New Roman MT', 'Times New Roman', serif;
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -1px;
}

.landing-hero-sub {
  color: #b8a5cf;
  font-size: 1.15rem;
  line-height: 1.65;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.landing-hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.landing-btn-primary {
  background: var(--accent, #b8860b);
  color: #ffffff;
  border: none;
  padding: 0.85rem 2rem;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.landing-btn-primary:hover {
  background: #9a7209;
  transform: translateY(-1px);
}

.landing-btn-ghost {
  color: #b8a5cf;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 1.5rem;
  border: 1.5px solid rgba(184, 165, 207, 0.3);
  border-radius: 10px;
  transition: border-color 0.2s, color 0.2s;
}

.landing-btn-ghost:hover {
  border-color: #b8a5cf;
  color: #ffffff;
}

.landing-hero-note {
  color: rgba(184, 165, 207, 0.6);
  font-size: 0.8rem;
}

/* Hero Screenshot */
.landing-hero-screenshot {
  max-width: 960px;
  margin: 3rem auto 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(184, 165, 207, 0.15);
}

.landing-hero-screenshot img {
  width: 100%;
  display: block;
}

/* Sections */
.landing-section {
  padding: 4rem 1.5rem;
}

.landing-section-light {
  background: #ffffff;
}

.landing-section-dark {
  background: linear-gradient(135deg, #1a0e2e 0%, #2a1845 100%);
}

.landing-container {
  max-width: 1100px;
  margin: 0 auto;
}

.landing-section-title {
  font-family: 'Times New Roman MT', 'Times New Roman', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #1a0e2e;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.landing-section-sub {
  text-align: center;
  color: #6b5b7b;
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

/* Features Grid */
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.landing-feature-card {
  background: #ffffff;
  border: 1px solid #e2dce8;
  border-radius: 14px;
  padding: 1.5rem;
  transition: box-shadow 0.25s, transform 0.2s;
}

.landing-feature-card:hover {
  box-shadow: 0 8px 24px rgba(26, 14, 46, 0.1);
  transform: translateY(-2px);
}

.landing-feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.landing-feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a0e2e;
  margin-bottom: 0.4rem;
}

.landing-feature-card p {
  font-size: 0.85rem;
  color: #6b5b7b;
  line-height: 1.55;
}

/* Showcase Grid */
.landing-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.landing-showcase-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(184, 165, 207, 0.12);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.landing-showcase-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.landing-showcase-item img {
  width: 100%;
  display: block;
  border-bottom: 1px solid rgba(184, 165, 207, 0.1);
}

.landing-showcase-item h4 {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 1.25rem 0.25rem;
}

.landing-showcase-item p {
  color: #b8a5cf;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 1.25rem 1.25rem;
}

/* How It Works */
.landing-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.landing-step {
  text-align: center;
  flex: 1;
  max-width: 240px;
}

.landing-step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent, #b8860b);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.landing-step h3 {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.landing-step p {
  color: #b8a5cf;
  font-size: 0.9rem;
  line-height: 1.55;
}

.landing-step-arrow {
  flex-shrink: 0;
}

/* Pricing Grid */
.landing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

.landing-price-card {
  background: #ffffff;
  border: 2px solid #e2dce8;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  transition: box-shadow 0.25s, transform 0.2s;
}

.landing-price-card:hover {
  box-shadow: 0 12px 32px rgba(26, 14, 46, 0.12);
  transform: translateY(-3px);
}

.landing-price-featured {
  border-color: #5b2d8e;
  box-shadow: 0 8px 24px rgba(91, 45, 142, 0.15);
}

.landing-price-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #5b2d8e;
  color: #ffffff;
  padding: 2px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.landing-price-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a0e2e;
  margin-bottom: 0.5rem;
}

.landing-price {
  font-size: 2.25rem;
  font-weight: 800;
  color: #5b2d8e;
  margin-bottom: 0.25rem;
}

.landing-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: #6b5b7b;
}

.landing-price-desc {
  color: #6b5b7b;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.landing-price-features {
  list-style: none;
  padding: 0;
  text-align: left;
  margin-bottom: 1.5rem;
}

.landing-price-features li {
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: #1a0e2e;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.landing-price-features li::before {
  content: '\2713';
  color: #059669;
  font-weight: 700;
  flex-shrink: 0;
}

.landing-price-btn {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid #e2dce8;
  border-radius: 10px;
  background: #f9f7fb;
  color: #1a0e2e;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.landing-price-btn:hover {
  background: #f3edf9;
  border-color: #5b2d8e;
}

.landing-price-btn-primary {
  background: #5b2d8e;
  color: #ffffff;
  border-color: #5b2d8e;
}

.landing-price-btn-primary:hover {
  background: #4a2375;
}

.landing-pricing-note {
  text-align: center;
  color: #6b5b7b;
  font-size: 0.8rem;
  margin-top: 1.5rem;
}

/* Trust */
.landing-trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid #e2dce8;
}

.landing-trust-item h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a0e2e;
  margin: 0.75rem 0 0.25rem;
}

.landing-trust-item p {
  color: #6b5b7b;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Final CTA */
.landing-final-cta {
  padding: 4rem 1.5rem;
}

/* Footer */
.landing-footer {
  background: #1a0e2e;
  padding: 1.5rem;
  border-top: 1px solid rgba(184, 165, 207, 0.15);
}

.landing-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.landing-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  font-family: 'Times New Roman MT', 'Times New Roman', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 0.9rem;
}

.landing-footer-brand img {
  border-radius: 6px;
}

.landing-footer-links {
  display: flex;
  gap: 1.5rem;
}

.landing-footer-links a {
  color: #b8a5cf;
  text-decoration: none;
  font-size: 0.8rem;
}

.landing-footer-links a:hover {
  color: #ffffff;
}

.landing-footer-copy {
  color: #6b5b7b;
  font-size: 0.75rem;
}

/* Landing Responsive */
@media (max-width: 768px) {
  .landing-hero h1 {
    font-size: 2rem;
  }

  .landing-hero-sub {
    font-size: 1rem;
  }

  .landing-hero-actions {
    flex-direction: column;
  }

  .landing-features-grid {
    grid-template-columns: 1fr;
  }

  .landing-showcase-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero-screenshot {
    margin: 2rem -0.5rem 0;
    border-radius: 8px;
  }

  .landing-steps {
    flex-direction: column;
  }

  .landing-step-arrow {
    transform: rotate(90deg);
  }

  .landing-pricing-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  .landing-trust-grid {
    grid-template-columns: 1fr;
  }

  .landing-nav-links a:not(.landing-nav-signin):not(.landing-nav-cta) {
    display: none;
  }

  .landing-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .landing-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-showcase-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Subscription Banner ===== */
.subscription-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.subscription-banner .btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}

.banner-warning {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 2px solid #f59e0b;
}

.banner-warning .btn-sm {
  background: #f59e0b;
  color: #fff;
}

.banner-error {
  background: #fee2e2;
  color: #991b1b;
  border-bottom: 2px solid #ef4444;
}

.banner-error .btn-sm {
  background: #ef4444;
  color: #fff;
}

/* ===== Tier Selection ===== */
.tier-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  overflow-y: auto;
  padding: 2rem 1rem;
  display: none;
}

.tier-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tier-header h1 {
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.tier-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

.tier-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.tier-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.tier-card.recommended {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.tier-card.recommended::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 2px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tier-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.tier-price {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.tier-price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.tier-features {
  list-style: none;
  text-align: left;
  margin: 1.25rem 0;
  padding: 0;
}

.tier-features li {
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.tier-features li::before {
  content: '✓';
  color: var(--income);
  font-weight: 700;
  flex-shrink: 0;
}

.tier-features li.locked::before {
  content: '—';
  color: var(--text-secondary);
}

.tier-features li.locked {
  color: var(--text-secondary);
}

.tier-btn {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.tier-btn-primary {
  background: var(--primary);
  color: white;
}

.tier-btn-primary:hover {
  background: var(--primary-hover);
}

.tier-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.tier-btn-secondary:hover {
  border-color: var(--primary);
}

/* Tier badge in sidebar */
.tier-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.tier-badge-pro {
  background: linear-gradient(135deg, #d4a017, #f5c842);
  color: #1a0e2e;
}

.tier-badge-plus {
  background: linear-gradient(135deg, #5b2d8e, #7c3aed);
  color: white;
}

/* Locked feature overlay */
.feature-locked {
  position: relative;
}

.feature-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(var(--bg), 0.7);
  backdrop-filter: blur(2px);
  border-radius: var(--radius);
  z-index: 10;
}

.upgrade-prompt {
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.upgrade-prompt h3 {
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.upgrade-prompt p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.upgrade-prompt .btn {
  background: var(--primary);
  color: white;
}

@media (max-width: 768px) {
  .tier-grid {
    grid-template-columns: 1fr;
  }
  .auth-container {
    max-width: 100%;
  }
}

/* ===== Print Styles ===== */
@media print {
  /* Hide all app UI */
  .sidebar,
  .mobile-header,
  .no-print,
  .modal-overlay,
  .modal,
  .filters-row {
    display: none !important;
  }

  /* Reset layout */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    background: #fff !important;
    font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
    color: #1a0e2e !important;
    font-size: 11pt;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Show only the reports view */
  .view { display: none !important; }
  .view#view-reports { display: block !important; }

  /* Hide the normal view header — we use the branded cover instead */
  #view-reports > .view-header {
    display: none !important;
  }

  /* ===== Branded Report Cover Header ===== */
  .print-cover {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
    border-bottom: 3px solid #1a0e2e;
    margin-bottom: 1.5rem;
  }

  .print-cover-logo {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .print-cover-icon {
    width: 44px;
    height: 44px;
    background: #1a0e2e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #daa520;
    font-weight: 700;
    font-size: 1.25rem;
    font-family: Arial, sans-serif;
  }

  .print-cover-name {
    font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
    font-size: 26pt;
    font-weight: 700;
    color: #1a0e2e;
    letter-spacing: 1px;
  }

  .print-cover-title {
    font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
    font-size: 16pt;
    color: #5b2d8e;
    font-weight: 400;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
  }

  .print-cover-meta {
    font-size: 9.5pt;
    color: #6b5b7b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }

  .print-cover-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #5b2d8e, #daa520);
    margin: 0.75rem auto 0;
    border: none;
  }

  /* ===== Section Headers ===== */
  .print-section-header {
    display: block !important;
    font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
    font-size: 13pt;
    font-weight: 700;
    color: #1a0e2e;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 2px solid #daa520;
    padding-bottom: 0.35rem;
    margin: 1.75rem 0 0.75rem;
  }

  /* ===== Cards ===== */
  .card {
    box-shadow: none !important;
    border: 1px solid #d8d0e3 !important;
    border-radius: 6px !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 0.75rem !important;
    padding: 1rem !important;
  }

  .card h3 {
    font-family: 'Times New Roman MT', 'Times New Roman', Times, serif;
    font-size: 11.5pt !important;
    font-weight: 600;
    color: #1a0e2e !important;
    margin-bottom: 0.5rem;
  }

  .card-header-row h3 {
    margin-bottom: 0;
  }

  /* ===== Summary Cards ===== */
  .summary-cards {
    display: flex !important;
    gap: 0.6rem;
    flex-wrap: wrap;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 0.75rem !important;
  }

  .summary-card {
    box-shadow: none !important;
    border: 1px solid #d8d0e3 !important;
    border-radius: 6px !important;
    padding: 0.75rem !important;
  }

  .card-label {
    font-size: 8pt !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b5b7b !important;
  }

  .card-value {
    font-size: 13pt !important;
    font-weight: 700;
  }

  .card-icon {
    width: 36px !important;
    height: 36px !important;
  }

  /* ===== Charts ===== */
  canvas {
    max-width: 100% !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .chart-container,
  [style*="height:400px"],
  [style*="height:420px"] {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* ===== Expand "Other" for print ===== */
  #other-cat-breakdown {
    max-height: none !important;
    overflow: visible !important;
  }
  #other-chevron {
    display: none !important;
  }
  #other-cat-row {
    cursor: default !important;
  }

  /* ===== Budget color dots ===== */
  .budget-color-dot {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ===== Page Footer ===== */
  .print-footer {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    font-size: 8pt;
    color: #9ca3af;
    margin-top: 2rem;
    padding-top: 0.75rem;
    border-top: 1px solid #d8d0e3;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }

  .print-footer-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .print-footer-icon {
    width: 16px;
    height: 16px;
    background: #1a0e2e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #daa520;
    font-size: 7pt;
    font-weight: 700;
    font-family: Arial, sans-serif;
  }

  /* ===== Page Settings ===== */
  @page {
    margin: 0.6in 0.75in;
    size: letter;
  }

  @page :first {
    margin-top: 0.4in;
  }
}
