:root {
  --bg-app: #090d16;
  --bg-card: #131b2e;
  --bg-card-hover: #19243d;
  --bg-elevated: #1e293b;
  --bg-input: #0f172a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(59, 130, 246, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ========================================================
   THEME: NEON ROSE (#ff0072)
   ======================================================== */
[data-theme="rose"] {
  --bg-app: #0b0911;
  --bg-card: #151120;
  --bg-card-hover: #1c162b;
  --bg-elevated: #241d37;
  --bg-input: #100d1a;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 0, 114, 0.55);

  --text-main: #fdf2f8;
  --text-muted: #a89cb5;
  --text-dim: #796e85;

  --color-primary: #ff0072;
  --color-primary-hover: #e10065;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}

[data-theme="rose"] .card-hero {
  background: linear-gradient(145deg, #240e1f 0%, #150915 100%);
  border: 1px solid rgba(255, 0, 114, 0.35);
}

[data-theme="rose"] .card-hero::after {
  background: radial-gradient(circle, rgba(255, 0, 114, 0.22) 0%, transparent 70%);
}

[data-theme="rose"] .card-top-savings {
  background: linear-gradient(145deg, #220e1e 0%, #140914 100%);
  border: 1px solid rgba(255, 0, 114, 0.28);
}

[data-theme="rose"] .card-top-savings::after {
  background: radial-gradient(circle, rgba(255, 0, 114, 0.16) 0%, transparent 70%);
}

[data-theme="rose"] .card-top-savings:hover {
  border-color: rgba(255, 0, 114, 0.5);
}

[data-theme="rose"] .hero-badge-tag {
  background: rgba(255, 0, 114, 0.16);
  color: #ff338f;
}

[data-theme="rose"] .hero-badge-tag.blue {
  background: rgba(255, 0, 114, 0.16);
  color: #ff338f;
}

[data-theme="rose"] .hero-badge-tag.manual {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

[data-theme="rose"] .settings-tab-btn.active {
  background: #ff0072;
  box-shadow: 0 2px 10px rgba(255, 0, 114, 0.45);
}

[data-theme="rose"] .desktop-nav-link.active {
  background: rgba(255, 0, 114, 0.18);
  border-color: rgba(255, 0, 114, 0.35);
  color: #ff338f;
}

[data-theme="rose"] .chip.active {
  background: rgba(255, 0, 114, 0.18);
  border-color: #ff0072;
  color: #ff66aa;
}

[data-theme="rose"] .hero-progress-fill {
  background: linear-gradient(90deg, #ff0072 0%, #ff5c9f 100%);
}

/* Theme Picker UI */
.theme-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.theme-card-option {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-card-option:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.theme-card-option.active {
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.theme-preview-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.theme-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.theme-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.theme-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.35;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Base Container */
.container {
  width: 100%;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 22px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.header-brand-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.header-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* Desktop Navigation (Segmented Pill Bar) */
.desktop-nav {
  display: none; /* Shown on desktop via media query */
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 12px;
  gap: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.desktop-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 7px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.desktop-nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.desktop-nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

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

/* Top Motivational Savings Cards */
.card-top-savings {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, #131b2e 0%, #0e1524 100%);
  border: 1px solid rgba(59, 130, 246, 0.28);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  height: 100%;
}

.card-top-savings::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-top-savings:hover {
  border-color: rgba(59, 130, 246, 0.45);
}

.card-top-piggybank {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, #0d1e19 0%, #0a1713 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  height: 100%;
}

.card-top-piggybank::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-top-piggybank:hover {
  border-color: rgba(16, 185, 129, 0.55);
}

.card-content-top {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-actions-bottom {
  margin-top: auto;
  padding-top: 16px;
}

.card-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, #162038 0%, #101726 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.card-accounts {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.balance-row.living-divider-row {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: none;
}

.living-title {
  color: var(--text-main);
  font-weight: 600;
}

.living-val {
  color: var(--color-success);
  font-size: 1.18rem;
  font-weight: 700;
}

.card-hero::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-title-sm {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Hero Daily Limit Display */
.hero-amount {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 8px;
}

.hero-amount.overspent {
  color: var(--color-danger);
}

.hero-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hero-badge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-primary);
}

.hero-badge-tag.manual {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.hero-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-top: 14px;
  overflow: hidden;
}

.hero-progress-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.hero-progress-fill.warning {
  background: var(--color-warning);
}

.hero-progress-fill.danger {
  background: var(--color-danger);
}

/* Quick Action Buttons Grid */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.action-grid-3 {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.hero-action-buttons {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0;
}

@media (max-width: 480px) {
  .action-grid-3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Base Button Styling (Variant 1 Fintech Gradients with Soft Glow) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: 40px;
  min-height: 40px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-family: inherit;
  white-space: nowrap;
  box-sizing: border-box;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary Fintech Button (Expense - Red) */
.btn-primary {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 18px rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}

/* Payday Wizard Button (Salary - Green) */
.btn-payday {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-payday:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 18px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

/* Extra Income / Frosted Action Button */
.btn-income {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.btn-income:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Success / Emerald Button (Piggybank sweep) */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 14px rgba(16, 185, 129, 0.32);
}

.btn-success:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 18px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

/* Outline Button */
.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

/* Elevated Button */
.btn-elevated {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-elevated:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-sm {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

/* Accounts Summary */
.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.balance-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.balance-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.balance-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance-val {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
}

.balance-val.positive {
  color: var(--color-success);
}

/* Feed / Transactions list */
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

#recentTxList {
  height: 200px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#recentTxList::-webkit-scrollbar {
  width: 4px;
}

#recentTxList::-webkit-scrollbar-track {
  background: transparent;
}

#recentTxList::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

#recentTxList::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  transition: opacity 0.15s ease;
  gap: 16px;
}

.tx-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tx-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.tx-cat {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  white-space: nowrap;
}

.tx-amount {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.tx-amount.expense {
  color: var(--text-main);
}

.tx-amount.income {
  color: var(--color-success);
}

/* Modal Overlay Base */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  display: flex;
}

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

.modal-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.payday-grid-2col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

/* Form inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1.05rem;
  padding: 12px 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--color-primary);
}

.input-huge {
  font-size: 2.2rem;
  font-weight: 800;
  text-align: center;
  padding: 12px;
  letter-spacing: -0.5px;
}

/* Category & Account selector chips */
.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  height: 32px;
  min-height: 32px;
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.16s ease;
  box-sizing: border-box;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.12);
}

.chip.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Number Pad (Mobile) */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.numpad-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 600;
  padding: 12px 0;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s ease;
  user-select: none;
}

.numpad-btn:active {
  background: var(--bg-card-hover);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 440px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideDown 0.25s ease-out;
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid var(--color-success);
}

.toast.error {
  border-left: 4px solid var(--color-danger);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================================
   SETTINGS TABS & SUB-NAVIGATION
   ======================================================== */
.settings-tabs-wrapper {
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.settings-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.settings-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  outline: none;
  user-select: none;
}

.settings-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.settings-tab-btn.active {
  color: #ffffff;
  background: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.settings-tab-badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  font-weight: 700;
}

.settings-tab-btn.active .settings-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.settings-tab-pane {
  display: none;
  animation: fadeInSettingsTab 0.2s ease-out;
}

.settings-tab-pane.active {
  display: block;
}

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

/* ========================================================
   RESPONSIVE DUAL-DESIGN: MOBILE VS DESKTOP
   ======================================================== */

/* 1. MOBILE (<= 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: 80px; /* Space for bottom nav */
  }

  .container {
    max-width: 520px;
    padding: 16px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: grid !important;
  }

  .desktop-nav {
    display: none !important;
  }

  /* Bottom Navigation Bar */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    max-width: 520px;
    margin: 0 auto;
  }

  .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    width: 25%;
    height: 100%;
    transition: color 0.15s ease;
  }

  .nav-link.active {
    color: var(--color-primary);
  }

  .nav-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
  }

  /* Bottom-Sheet Modals on Phone */
  .modal-overlay {
    align-items: flex-end;
    justify-content: center;
  }

  .modal-sheet {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-width: 520px;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .modal-overlay.active .modal-sheet {
    transform: translateY(0);
  }

  .sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    margin: 0 auto 16px;
    display: block;
  }

  /* Mobile Dashboard Ordering */
  .dashboard-container {
    display: flex;
    flex-direction: column;
  }

  .dash-limit      { order: 1; }
  .dash-envelopes  { order: 2; }
  .dash-history    { order: 3; }
  .dash-accounts   { order: 4; }
  .dash-piggybank  { order: 5; }
  .dash-savings    { order: 6; }

  .dash-item {
    width: 100%;
  }
}

/* 2. DESKTOP / LAPTOP (> 768px) */
@media (min-width: 769px) {
  body {
    padding-bottom: 40px;
  }

  .container {
    max-width: 1140px;
    padding: 24px 36px;
  }

  .mobile-only {
    display: none !important;
  }

  .desktop-only {
    display: inline-flex !important;
  }

  .bottom-nav {
    display: none !important;
  }

  .desktop-nav {
    display: flex !important;
  }

  /* Desktop Layout: 2 columns (Operations/Limit ~25% wider, Accounts/Envelopes ~25% narrower) */
  .dashboard-container {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    grid-template-areas:
      "limit     envelopes"
      "history   accounts"
      "piggybank savings";
    gap: 24px;
    align-items: stretch;
  }

  .dash-limit      { grid-area: limit; height: 100%; display: flex; flex-direction: column; }
  .dash-envelopes  { grid-area: envelopes; height: 100%; display: flex; flex-direction: column; }
  .dash-history    { grid-area: history; height: 100%; display: flex; flex-direction: column; }
  .dash-accounts   { grid-area: accounts; height: 100%; display: flex; flex-direction: column; }
  .dash-piggybank  { grid-area: piggybank; height: 100%; display: flex; flex-direction: column; }
  .dash-savings    { grid-area: savings; height: 100%; display: flex; flex-direction: column; }

  .dash-savings .card,
  .dash-piggybank .card,
  .dash-limit .card,
  .dash-accounts .card,
  .dash-history .card,
  .dash-envelopes .card {
    height: 100%;
    margin-bottom: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  /* Top 2-Column Savings & Piggybank Motivational Grid */
  .top-savings-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
  }

  /* 2-Column Responsive Dashboard Grid */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 28px;
    align-items: start;
  }

  .envelopes-grid,
  .settings-grid,
  .help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
  }

  /* Desktop Dialog Modals */
  .modal-overlay {
    align-items: center;
    justify-content: center;
  }

  .modal-sheet {
    border-radius: var(--radius-lg);
    max-width: 500px;
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }

  .modal-sheet.modal-sheet-wide,
  #paydayModal .modal-sheet {
    max-width: 680px;
    width: 680px;
  }

  .payday-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }

  .modal-overlay.active .modal-sheet {
    transform: scale(1);
    opacity: 1;
  }

  .sheet-handle {
    display: none !important;
  }
}

/* Help & Reference System Styles */
.help-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.help-formula-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-primary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 10px 0;
}

.help-formula-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.help-formula-math {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.help-live-calc {
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.82rem;
}

.help-live-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  color: var(--text-muted);
}

.help-live-row.total {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 6px;
  padding-top: 6px;
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.9rem;
}

.help-step-item {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

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

.help-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.help-step-content {
  flex: 1;
}

.help-step-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.help-step-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.help-badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.help-badge-tag.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.help-badge-tag.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.help-badge-tag.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.help-badge-tag.amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.help-qa-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.help-qa-box:last-child {
  margin-bottom: 0;
}

.help-qa-q {
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.help-qa-a {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}
