/* ===== SpendWise Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Colors - Dark Mode Palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #6366f1;
  --accent-primary-glow: rgba(99, 102, 241, 0.25);
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Category Colors */
  --cat-food: #f472b6;
  --cat-transport: #60a5fa;
  --cat-entertainment: #a78bfa;
  --cat-shopping: #fb923c;
  --cat-healthcare: #34d399;
  --cat-utilities: #fbbf24;
  --cat-other: #94a3b8;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-xs: 0.75rem;
  --font-sm: 0.8125rem;
  --font-base: 0.9375rem;
  --font-lg: 1.125rem;
  --font-xl: 1.5rem;
  --font-2xl: 2rem;
  --font-3xl: 2.5rem;

  /* Borders & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-primary-glow);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
  backdrop-filter: blur(20px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  color: white;
  box-shadow: var(--shadow-glow);
}

.brand-name {
  font-size: var(--font-xl);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  justify-content: flex-start;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-primary);
  border-radius: 0 2px 2px 0;
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

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

.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* Sidebar Sign Out button */
.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: var(--space-md);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.5);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Mobile Header ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-md);
  z-index: 99;
  backdrop-filter: blur(20px);
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--bg-glass-hover);
}

.mobile-brand {
  font-weight: 700;
  font-size: var(--font-lg);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: var(--space-2xl);
  max-width: 1700px;
  width: 100%;
}

/* ===== Page Header ===== */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  font-size: var(--font-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-xs);
}

.page-header p {
  color: var(--text-secondary);
  font-size: var(--font-base);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: var(--font-xs);
}

/* ===== Summary Cards Grid ===== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

.summary-card:nth-child(1) { animation-delay: 0.1s; }
.summary-card:nth-child(2) { animation-delay: 0.2s; }
.summary-card:nth-child(3) { animation-delay: 0.3s; }
.summary-card:nth-child(4) { animation-delay: 0.4s; }

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.summary-card:nth-child(1)::before { background: var(--accent-gradient); }
.summary-card:nth-child(2)::before { background: linear-gradient(135deg, #10b981, #34d399); }
.summary-card:nth-child(3)::before { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.summary-card:nth-child(4)::before { background: linear-gradient(135deg, #f472b6, #ec4899); }

.summary-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  z-index: 10;
}

.summary-card .label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.summary-card .value {
  font-size: var(--font-2xl);
  font-weight: 800;
  letter-spacing: -1px;
}

.summary-card .sub {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ===== Charts ===== */
.chart-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
}

.chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) 0;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  color-scheme: dark;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px;
}

.form-select option:checked {
  background: var(--accent-primary);
  color: white;
}

.form-select option:hover {
  background: var(--bg-glass-hover);
}

/* Currency-Amount Inline Row */
.currency-amount-row {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
}

.currency-amount-row .currency-select-col {
  flex: 0 0 130px;
}

.currency-amount-row .amount-col {
  flex: 1;
}

.inr-equivalent {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

.inr-equivalent strong {
  color: var(--accent-primary);
  font-style: normal;
}

.original-currency {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-primary-glow);
}

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

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-xs);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  padding-bottom: 8px; /* Adds padding to prevent scrollbar overlap */
}

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

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 7px 12px;
  font-size: var(--font-sm);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

/* ===== Table pagination footer ===== */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.pagination .page-indicator {
  font-size: var(--font-sm);
  color: var(--text-muted);
  white-space: nowrap;
}
.pagination .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ===== Privacy toggle (hide/show amounts) ===== */
.privacy-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.privacy-toggle:hover {
  border-color: var(--accent-primary);
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.privacy-toggle:active { transform: scale(0.96); }

/* The privacy toggle is pointless on the login screen (no amounts to protect),
   so hide it while the login overlay is visible. */
.login-overlay:not(.hidden) ~ .privacy-toggle { display: none !important; }

/* When privacy mode is ON, blur the sensitive summary amounts */
body.privacy-mode .summary-card .value,
body.privacy-mode .bill-amount,
body.privacy-mode .cc-stat-val,
body.privacy-mode .bank-balance-small,
body.privacy-mode .usage-bar-value,
body.privacy-mode .privacy-amt {
  filter: blur(7px);
  user-select: none;
  transition: filter 0.25s ease;
}

/* ===== Expenses table: responsive columns ===== */
.data-table td.cell-notes {
  white-space: normal;
  max-width: 240px;
  overflow-wrap: break-word;
  line-height: 1.35;
}
.data-table td.cell-method {
  white-space: normal;
  max-width: 200px;
  overflow-wrap: break-word;
}
.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.table-wrapper {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* On small screens: keep the essentials + Actions visible, hide the Notes column */
@media (max-width: 720px) {
  .header-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .expenses-table th:nth-child(6),
  .expenses-table td:nth-child(6) {
    display: none;
  }
  .expenses-table td.cell-notes { max-width: none; }
}

/* Investments table: hide the two least-essential columns so it fits the width */
.investments-table td { padding: 6px 10px; }
.investments-table td.cell-asset { min-width: 150px; white-space: normal; max-width: 220px; }
.investments-table .col-symbol,
.investments-table .col-period { display: none; }

/* ===== Category Badges ===== */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
}

.cat-food { background: rgba(244, 114, 182, 0.15); color: var(--cat-food); }
.cat-transport { background: rgba(96, 165, 250, 0.15); color: var(--cat-transport); }
.cat-entertainment { background: rgba(167, 139, 250, 0.15); color: var(--cat-entertainment); }
.cat-shopping { background: rgba(251, 146, 60, 0.15); color: var(--cat-shopping); }
.cat-healthcare { background: rgba(52, 211, 153, 0.15); color: var(--cat-healthcare); }
.cat-utilities { background: rgba(251, 191, 36, 0.15); color: var(--cat-utilities); }
.cat-other { background: rgba(148, 163, 184, 0.15); color: var(--cat-other); }

/* ===== Progress Bars ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-glass);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--space-sm) 0;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--accent-gradient);
}

.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #fb923c); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), #f87171); }
.progress-fill.success { background: linear-gradient(90deg, var(--success), #34d399); }

/* ===== Status Badges ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
}

.status-upcoming { background: var(--info-bg); color: var(--info); }
.status-due { background: var(--warning-bg); color: var(--warning); }
.status-overdue { background: var(--danger-bg); color: var(--danger); }
.status-paid { background: var(--success-bg); color: var(--success); }

/* ===== Milestone Badges ===== */
.milestone-badges {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.milestone-badge {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: var(--font-sm);
  font-weight: 700;
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.milestone-badge.unlocked {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-bg);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
  animation: badgeUnlock 0.5s ease;
}

@keyframes badgeUnlock {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Shopping List ===== */
.shopping-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.shopping-item:hover {
  background: var(--bg-glass-hover);
}

.shopping-item.checked .item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.shopping-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  background: transparent;
  color: transparent;
}

.shopping-checkbox.checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.item-name {
  flex: 1;
  font-size: var(--font-base);
}

.item-tag {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  background: var(--bg-glass);
  color: var(--text-muted);
}

.priority-high { color: var(--danger); background: var(--danger-bg); }
.priority-medium { color: var(--warning); background: var(--warning-bg); }
.priority-low { color: var(--success); background: var(--success-bg); }

/* ===== Toast Notifications ===== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 300px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  backdrop-filter: blur(20px);
}

.toast.toast-exit {
  animation: slideOut 0.3s ease forwards;
}

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

.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast-danger .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: var(--font-sm);
  font-weight: 600;
}

.toast-message {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-xl);
  position: relative;
  animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition: max-width 0.3s ease;
}

.modal.modal-lg {
  max-width: 1000px;
}

.modal-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.modal-title {
  font-size: var(--font-xl);
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Savings Progress Ring ===== */
.progress-ring-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-ring-text {
  position: absolute;
  text-align: center;
}

.progress-ring-text .percentage {
  font-size: var(--font-xl);
  font-weight: 800;
}

.progress-ring-text .label {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ===== Goal Cards ===== */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
}

.goal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.12);
}

.goal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.goal-name {
  font-size: var(--font-lg);
  font-weight: 700;
}

.goal-amounts {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.goal-target-date {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ===== Export Page ===== */
.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.export-preview {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-height: 400px;
  overflow-y: auto;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state h3 {
  font-size: var(--font-lg);
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.empty-state p {
  font-size: var(--font-sm);
  margin-bottom: var(--space-lg);
}

/* ===== Utility ===== */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.action-buttons {
  display: flex;
  gap: var(--space-sm);
}

/* ===== Bill Status Cards ===== */
.bills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.bill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
}

.bill-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.bill-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.bill-name {
  font-size: var(--font-lg);
  font-weight: 600;
}

.bill-amount {
  font-size: var(--font-xl);
  font-weight: 800;
}

.bill-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ===== Budget Cards ===== */
.budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.budget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
}

.budget-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.budget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.budget-spent {
  font-size: var(--font-2xl);
  font-weight: 800;
  margin: var(--space-sm) 0;
}

.budget-limit {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 160px;
}

/* ===== Expenses: sticky filters + bulk selection ===== */
.sticky-filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-primary);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--space-sm) var(--space-xs);
  margin-bottom: var(--space-lg);
}
.sticky-filters .filter-bar { margin-bottom: var(--space-sm); }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
}
.bulk-bar .bulk-count {
  font-size: var(--font-sm);
  color: var(--text-primary);
  font-weight: 600;
}
.bulk-bar .bulk-spacer { flex: 1; }

.data-table th.col-check,
.data-table td.col-check { width: 38px; text-align: center; }
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary, #6366f1);
  cursor: pointer;
  vertical-align: middle;
}
.data-table tbody tr.row-selected { background: rgba(99, 102, 241, 0.10); }

/* ===== Contributions Log ===== */
.contributions-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: var(--space-md);
}

.contribution-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-sm);
}

.contribution-item:last-child {
  border-bottom: none;
}

/* ===== Login Screen ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.25) 0%, transparent 40%),
              radial-gradient(circle at 80% 90%, rgba(139, 92, 246, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.1) 0%, transparent 60%),
              var(--bg-primary);
  background-size: 150% 150%;
  animation: pulseBg 12s infinite alternate linear;
}

@keyframes pulseBg {
  0% { filter: hue-rotate(0deg); background-position: 0% 0%; }
  100% { filter: hue-rotate(20deg); background-position: 100% 100%; }
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  background: rgba(17, 24, 39, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  width: 90%;
  max-width: 420px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.1);
  text-align: center;
  transition: all 0.4s ease;
  animation: modalSlideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.login-card:hover {
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7), 0 0 60px rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.3);
}

.login-logo {
  margin-bottom: var(--space-lg);
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); box-shadow: 0 12px 24px rgba(99, 102, 241, 0.5); border-color: rgba(99, 102, 241, 0.6); }
  100% { transform: translateY(0px); }
}

.login-logo-img {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow-glow);
  border: 2px solid rgba(99, 102, 241, 0.3);
  animation: float 5s ease-in-out infinite;
  transition: border-color 0.3s ease;
}

.login-title {
  font-size: var(--font-2xl);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  color: var(--text-muted);
  font-size: var(--font-sm);
  margin-bottom: var(--space-xl);
}

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: var(--font-base);
  margin-top: var(--space-sm);
}

.login-error {
  color: var(--danger);
  font-size: var(--font-sm);
  min-height: 20px;
  margin-top: var(--space-sm);
}

.login-card .form-group {
  text-align: left;
}

.login-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
  font-size: var(--font-xs);
  color: var(--text-muted);
  text-align: center;
}

.login-footer .heart {
  color: #ef4444;
  animation: pulse 2s infinite;
}

/* ===== Monthly History ===== */
.monthly-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  padding: var(--space-md) 0;
}

.monthly-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.monthly-bar-fill {
  width: 100%;
  min-height: 4px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--accent-gradient);
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
}

.monthly-bar-fill:hover {
  filter: brightness(1.2);
}

.monthly-bar-fill .bar-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.monthly-bar-fill:hover .bar-tooltip {
  display: block;
}

.monthly-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.monthly-bar-amount {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}

.monthly-bar.current .monthly-bar-fill {
  background: linear-gradient(135deg, var(--success), #10b981);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.monthly-bar.current .monthly-bar-label {
  color: var(--success);
  font-weight: 700;
}

/* ===== Brand Logo Img ===== */
.brand-logo-img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

/* ===== Settings Page ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
}

.settings-card h3 {
  font-size: var(--font-lg);
  font-weight: 700;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.currency-preview {
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  margin-top: var(--space-md);
}

.currency-preview .amount {
  font-size: var(--font-3xl);
  font-weight: 800;
}

.currency-preview .label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.logout-section {
  margin-top: var(--space-xl);
}

/* ===== Credit Cards ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.credit-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.credit-card-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.credit-card-item.card-overdue {
  border-color: rgba(239, 68, 68, 0.35);
  border-left: 4px solid var(--danger);
}

.credit-card-item.card-due-soon {
  border-color: rgba(245, 158, 11, 0.35);
  border-left: 4px solid var(--warning);
}

.cc-visual {
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cc-chip {
  width: 36px;
  height: 26px;
  background: linear-gradient(135deg, #d4af37, #f5e6a3, #d4af37);
  border-radius: 4px;
  margin-bottom: var(--space-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.cc-name {
  font-size: var(--font-base);
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  letter-spacing: 0.3px;
}

.cc-type-badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cc-details {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.cc-visual-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.cc-visual-top .cc-chip { margin-bottom: 0; }

.cc-visual-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-lg);
}
.cc-mask {
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}
.cc-brand {
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
}

.cc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.cc-due-right { text-align: right; }
.cc-label {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.cc-due-val {
  display: block;
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.cc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.cc-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}
.cc-stat-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.cc-stat-val {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.cc-util { margin-bottom: var(--space-md); }
.cc-util-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cc-util-pct { font-size: var(--font-sm); font-weight: 700; }
.cc-util-track {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px;
  overflow: hidden;
}
.cc-util-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
}

.cc-past {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
  margin-bottom: var(--space-md);
}
.cc-past-val {
  font-size: var(--font-sm);
  color: var(--text-muted);
  text-align: right;
}

.status-ok { background: var(--info-bg); color: var(--info); }

/* ===== Bank Segment ===== */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.bank-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.bank-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

/* Type-colored accent for bank cards */
.bank-card.bank-bank { border-left: 4px solid var(--accent-primary); }
.bank-card.bank-post-office { border-left: 4px solid var(--warning); }
.bank-card.bank-cash { border-left: 4px solid var(--success); }

.bank-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.bank-type-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.bank-info {
  flex: 1;
}

.bank-name {
  font-size: var(--font-lg);
  font-weight: 700;
  margin: 0;
}

.bank-type-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.bank-balance-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
}
.bank-balance-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.bank-balance-small {
  font-size: var(--font-2xl);
  font-weight: 800;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bank-details-mini {
  background: var(--bg-glass);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.detail-item .detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.detail-item .detail-val {
  font-size: var(--font-xs);
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
}

/* ===== Bank transaction history modal ===== */
.history-table {
  border-collapse: separate;
  border-spacing: 0;
}
.history-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
  border-bottom: 1px solid var(--border-color);
}
.tx-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.tx-credit { background: rgba(16, 185, 129, 0.14); color: var(--success); }
.tx-debit { background: rgba(239, 68, 68, 0.14); color: var(--danger); }

/* Let the description wrap so the table fits the modal (no horizontal scroll) */
.history-table td.tx-desc {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 420px;
  min-width: 0;
}

/* On small screens, drop the Type column to free room (Amount +/- color still shows in/out) */
@media (max-width: 560px) {
  .history-table .col-type { display: none; }
  .history-table td.tx-desc { max-width: none; }
}

/* Tabs for Fund Ops */
.tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-xs);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.tab-btn.active {
  color: var(--accent-primary);
  background: var(--bg-glass);
}

.btn-full {
  width: 100%;
}

.radio-group {
  display: flex;
  gap: var(--space-lg);
  margin-top: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-sm);
}


.cc-date-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cc-date-value {
  font-size: var(--font-sm);
  color: var(--text-primary);
  font-weight: 600;
}

.text-warning {
  color: var(--warning) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-success {
  color: var(--success) !important;
}

.mt-md {
  margin-top: var(--space-md);
}

/* Card Alerts */
.card-alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  font-size: var(--font-sm);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-alert:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.card-alert-danger {
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
}

.card-alert-warning {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
}

.card-alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.card-alert-text {
  flex: 1;
}

/* Card tag in expense table */
.card-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-glass-hover);
  border: 1px solid var(--border-color);
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Responsive ===== */

/* --- Tablet (1024px) --- */
@media (max-width: 1024px) {
  .chart-container {
    grid-template-columns: 1fr;
  }

  .export-options {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Mobile (768px) --- */
@media (max-width: 768px) {
  /* Sidebar becomes overlay */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  }

  /* Backdrop when sidebar is open */
  .sidebar.open::after {
    content: '';
    position: fixed;
    top: 0;
    right: calc(-100vw + var(--sidebar-width));
    width: calc(100vw - var(--sidebar-width));
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  /* Show mobile header */
  .mobile-header {
    display: flex;
  }

  /* Main content fills screen */
  .main-content {
    margin-left: 0;
    padding: 72px var(--space-md) var(--space-lg);
    max-width: 100%;
  }

  /* Page header adjustments */
  .page-header h1 {
    font-size: var(--font-xl);
  }

  .page-header p {
    font-size: var(--font-sm);
  }

  .flex-between {
    flex-direction: column;
    gap: var(--space-md);
    align-items: stretch !important;
  }

  .flex-between .btn {
    align-self: flex-start;
  }

  /* Grids become single column */
  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .summary-card {
    padding: var(--space-md);
  }

  .summary-card .value {
    font-size: var(--font-xl);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .goals-grid,
  .bills-grid,
  .budgets-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Filter bar stacked */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .form-input,
  .filter-bar .form-select {
    width: 100%;
  }

  /* Tables scroll horizontally */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--space-lg) * -1);
    padding: 0 var(--space-lg);
  }

  .data-table {
    min-width: 600px;
    font-size: var(--font-sm);
  }

  .data-table th,
  .data-table td {
    padding: var(--space-sm) var(--space-md);
    white-space: nowrap;
  }

  /* Modal fills screen on mobile */
  .modal {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
    margin: 5vh auto;
  }

  /* Currency amount row stacks */
  .currency-amount-row {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .currency-amount-row .currency-select-col {
    flex: none;
    width: 100%;
  }

  /* Monthly bar chart */
  .monthly-bar-chart {
    height: 160px;
    gap: 3px;
    overflow-x: auto;
    padding-bottom: var(--space-sm);
  }

  .monthly-bar {
    min-width: 36px;
  }

  .monthly-bar-label {
    font-size: 9px;
  }

  .monthly-bar-amount {
    font-size: 9px;
  }

  /* Toasts */
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }

  .toast {
    min-width: auto;
  }

  /* Cards compact padding */
  .card {
    padding: var(--space-md);
  }

  .chart-card {
    padding: var(--space-md);
  }

  /* Budget cards & Bill cards */
  .budget-card,
  .bill-card,
  .goal-card {
    padding: var(--space-md);
  }

  /* Action buttons wrap */
  .action-buttons {
    flex-wrap: wrap;
  }

  /* Nav links larger touch target */
  .nav-link {
    padding: var(--space-md) var(--space-md);
    font-size: var(--font-base);
  }

  /* Login card */
  .login-card {
    padding: var(--space-xl) var(--space-lg);
    width: 95%;
  }

  .login-logo-img {
    width: 80px;
    height: 80px;
  }

  .login-title {
    font-size: var(--font-xl);
  }

  /* Shopping list form */
  .shopping-form {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .shopping-form .form-input,
  .shopping-form .form-select {
    width: 100%;
  }

  /* Chart wrapper */
  .chart-wrapper {
    max-height: 280px;
  }

  /* Settings */
  .settings-card {
    padding: var(--space-md);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .currency-preview .amount {
    font-size: var(--font-2xl);
  }
}

/* --- Small phone (480px) --- */
@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .summary-card .value {
    font-size: var(--font-lg);
  }

  .main-content {
    padding: 64px var(--space-sm) var(--space-md);
  }

  .page-header {
    margin-bottom: var(--space-md);
  }

  .page-header h1 {
    font-size: var(--font-lg);
  }

  /* Modal full screen on small phones */
  .modal {
    width: 95%;
    max-width: 95%;
    border-radius: var(--radius-lg);
    max-height: 90vh;
    margin: auto;
    overflow-y: auto;
  }

  /* Monthly chart smaller */
  .monthly-bar-chart {
    height: 130px;
  }

  .monthly-bar {
    min-width: 28px;
  }

  /* Card padding compact */
  .card,
  .chart-card {
    padding: var(--space-sm);
    border-radius: var(--radius-md);
  }

  /* Login card */
  .login-card {
    padding: var(--space-lg) var(--space-md);
    border-radius: var(--radius-lg);
  }

  .login-logo-img {
    width: 64px;
    height: 64px;
  }

  .login-title {
    font-size: var(--font-lg);
  }

  .login-subtitle {
    font-size: var(--font-xs);
  }

  /* Buttons touch-friendly */
  .btn {
    padding: 10px 16px;
    font-size: var(--font-sm);
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: var(--font-xs);
  }

  /* Table even more compact */
  .data-table {
    font-size: var(--font-xs);
    min-width: 500px;
  }

  .data-table th,
  .data-table td {
    padding: var(--space-xs) var(--space-sm);
  }

  /* Expense/Bill form labels */
  .form-label {
    font-size: var(--font-sm);
  }

  .form-input,
  .form-select {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-sm);
  }

  /* Bill meta stack */
  .bill-meta {
    flex-direction: column;
    gap: 2px;
  }

  /* Sidebar brand smaller */
  .sidebar-brand {
    padding: var(--space-md);
  }

  .brand-name {
    font-size: var(--font-lg);
  }

  .brand-logo-img {
    width: 36px;
    height: 36px;
  }

  /* Milestone badges smaller */
  .milestone-badges {
    gap: var(--space-sm);
  }

  .milestone-badge {
    font-size: 1.2rem;
  }

  /* Progress ring smaller */
  .progress-ring-container {
    transform: scale(0.8);
  }
}

/* --- Landscape phones --- */
@media (max-height: 500px) and (orientation: landscape) {
  .login-overlay {
    align-items: flex-start;
    padding-top: var(--space-md);
    overflow-y: auto;
  }

  .login-card {
    margin-bottom: var(--space-lg);
  }

  .login-logo-img {
    width: 48px;
    height: 48px;
  }
}

/* --- Touch device improvements --- */
@media (hover: none) and (pointer: coarse) {
  .nav-link {
    min-height: 48px;
  }

  .btn {
    min-height: 44px;
  }

  .form-input,
  .form-select {
    min-height: 44px;
  }

  /* Disable hover effects on touch */
  .card:hover {
    border-color: var(--border-color);
    box-shadow: none;
  }

  .monthly-bar-fill:hover {
    filter: none;
  }

  /* Always show bar tooltips on touch */
  .monthly-bar-fill .bar-tooltip {
    display: block;
    position: static;
    transform: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    font-size: 8px;
    color: var(--text-muted);
  }
}

/* ===== Bank Dashboard Enhancements (Phase 11 & 12) ===== */
.summary-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    cursor: default;
}

.summary-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.5);
}

.summary-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.summary-card:hover::after {
    opacity: 1;
}

.usage-bar-wrapper {
    transition: all 0.3s ease;
}

.usage-bar {
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s ease, filter 0.3s ease;
}

.usage-bar:hover {
    filter: brightness(1.3) saturate(1.2);
    box-shadow: 0 0 15px var(--accent-primary);
}

.usage-bar-glow {
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.usage-bar-wrapper:hover .usage-bar-glow {
    opacity: 0.7 !important;
    filter: blur(15px) brightness(1.5);
}

.usage-bar-label {
    transition: color 0.3s ease;
}

.usage-bar-wrapper:hover .usage-bar-label {
    color: var(--text-primary) !important;
}

.btn-revert-tx {
    transition: all 0.2s ease;
}

.btn-revert-tx:hover {
    color: var(--accent-danger) !important;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.15);
}

/* Optimize full APP pass: consistency improvements */
.modal-title {
    background: linear-gradient(to right, var(--text-primary), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* ============================================================
   UI polish + Mobile responsiveness hardening
   ============================================================ */

/* --- Ambient depth glow behind the app --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(70% 40% at 0% 0%, rgba(99, 102, 241, 0.10) 0%, transparent 60%),
    radial-gradient(55% 40% at 100% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.main-content { position: relative; z-index: 1; }

/* --- Summary cards: smooth accent-bar hover + aligned numerals --- */
.summary-card::before {
  transition: height 0.3s ease, opacity 0.3s ease;
}
.summary-card:hover::before {
  height: 4px;
  opacity: 1;
}
.summary-card .value, .summary-card .sub, .summary-card .label {
  font-variant-numeric: tabular-nums;
}

/* --- Improve number-heavy tables readability --- */
.data-table tbody td {
  font-variant-numeric: tabular-nums;
}

/* ===== Dashboard: use the full available width =====
   The gap on the right was caused by the content being capped too narrow
   (max-width: 1200px) on wide monitors. The grids already fill their
   container, so widening the content area removes the void on wide screens.
   (.summary-grid and .chart-container keep their original balanced columns.) */

/* ===== Mobile hardening ===== */

/* Prevent iOS Safari auto-zoom when focusing inputs (font must stay >=16px) */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea, .form-input, .form-select {
    font-size: 16px !important;
  }
}

/* Respect device safe areas (iPhone notch / home-indicator bar) */
@supports (padding: env(safe-area-inset-top)) {
  .mobile-header {
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
  }
  .modal {
    max-height: calc(90vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  @media (max-width: 768px) {
    .main-content {
      padding-top: calc(72px + env(safe-area-inset-top));
      padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
    }
  }
}

/* Comfortable tap targets & spacing on small phones */
@media (max-width: 480px) {
  .btn { min-height: 46px; }
  .modal-close {
    width: 40px;
    height: 40px;
    font-size: var(--font-xl);
  }
  .page-header {
    margin-bottom: var(--space-lg);
  }
  .summary-grid {
    gap: var(--space-sm);
  }
}

/* Avoid horizontal page shift created by long unbroken strings on small screens */
@media (max-width: 768px) {
  body { word-break: break-word; }
  .modal-body h1, .modal-body h2, .modal-body h3 {
    word-break: break-word;
  }
}

