/* ==========================================
   MONEY STORY - DESIGN SYSTEM STYLESHEET
   Calming, Premium, Mobile-First PWA Styles
   ========================================== */

/* Design Tokens & Theme Variables */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  /* Calming Slate & Emerald Theme (Dark Mode) */
  --bg-app: #080f0c;
  --bg-card: #122018;
  --bg-card-hover: #172c21;
  --bg-glass: rgba(18, 32, 24, 0.75);
  --border-color: rgba(52, 211, 153, 0.12);
  --border-focus: rgba(52, 211, 153, 0.4);
  
  /* Text colors */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Intent Colors */
  --accent-emerald: #10b981;
  --accent-emerald-light: rgba(16, 185, 129, 0.15);
  --accent-gold: #fbbf24;
  --accent-gold-light: rgba(251, 191, 36, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-light: rgba(244, 63, 94, 0.15);
  --accent-blue: #3b82f6;
  --accent-blue-light: rgba(59, 130, 246, 0.15);
  --accent-purple: #a855f7;
  --accent-purple-light: rgba(168, 85, 247, 0.15);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light Theme Variables */
body.light-theme {
  --bg-app: #f4f7f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fbf9;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-color: rgba(16, 185, 129, 0.15);
  --border-focus: rgba(16, 185, 129, 0.5);
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --shadow-sm: 0 4px 6px -1px rgba(16, 185, 129, 0.05);
  --shadow-lg: 0 10px 20px -5px rgba(16, 185, 129, 0.1);
  
  --accent-emerald-light: rgba(16, 185, 129, 0.1);
  --accent-gold-light: rgba(251, 191, 36, 0.1);
  --accent-rose-light: rgba(244, 63, 94, 0.1);
  --accent-blue-light: rgba(59, 130, 246, 0.1);
  --accent-purple-light: rgba(168, 85, 247, 0.1);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-emerald);
}

/* Text Colors helper Classes */
.text-emerald { color: var(--accent-emerald); }
.text-rose { color: var(--accent-rose); }
.text-amber { color: var(--accent-gold); }
.text-blue { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-gold { color: var(--accent-gold); }

.bg-emerald { background-color: var(--accent-emerald); }
.bg-rose { background-color: var(--accent-rose); }
.bg-blue { background-color: var(--accent-blue); }
.bg-purple { background-color: var(--accent-purple); }

.hidden { display: none !important; }

/* 1. LOCK SCREEN / PIN SECURITY OVERLAY */
.lock-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #11221a 0%, #050d0a 100%);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.lock-screen.active {
  opacity: 1;
  pointer-events: all;
}
.lock-container {
  width: 90%;
  max-width: 360px;
  text-align: center;
  padding: 24px;
}
.lock-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}
.logo-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px rgba(52, 211, 153, 0.4));
}
.app-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.lock-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 30px;
}
.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px stroke var(--border-color);
  background: transparent;
  transition: all 0.2s ease;
  box-shadow: inset 0 0 0 2px var(--border-color);
}
.pin-dot.filled {
  background: var(--accent-emerald);
  box-shadow: 0 0 12px var(--accent-emerald);
  transform: scale(1.1);
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.pin-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 500;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  margin: 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.pin-btn:active {
  background: var(--accent-emerald-light);
  border-color: var(--accent-emerald);
  transform: scale(0.9);
}
.pin-btn.action {
  font-size: 16px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
}
.pin-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* 2. BASE APP LAYOUT */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(76px + var(--safe-area-bottom));
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}
.header-logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-emerald-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.header-avatar img {
  width: 24px;
  height: 24px;
}
.header-greeting {
  font-size: 12px;
  color: var(--text-secondary);
}
.header-username {
  font-size: 16px;
  font-weight: 600;
}
.header-actions {
  display: flex;
  gap: 10px;
}
.header-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}
.header-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}
.header-icon {
  width: 18px;
  height: 18px;
}
.noti-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent-rose);
  color: white;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-app);
}

/* 3. DYNAMIC CONTENT MAIN */
.app-main-content {
  flex: 1;
  padding: 16px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Tab panes switching */
.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}
.tab-pane.active {
  display: block;
}

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

/* ================= TAB 1: DASHBOARD ================= */
.spendable-banner {
  position: relative;
  background: radial-gradient(circle at top right, #133a27 0%, #0d1e15 100%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
body.light-theme .spendable-banner {
  background: linear-gradient(135deg, #e6f6ef 0%, #d1f0e2 100%);
}
.banner-content {
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
}
.banner-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 500;
}
.banner-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--accent-emerald);
  margin: 8px 0;
}
.banner-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Inline Can I Buy Calculator */
.inline-calculator {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}
body.light-theme .inline-calculator {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(16, 185, 129, 0.1);
}
.inline-calculator h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
.calc-inputs {
  display: flex;
  gap: 8px;
}
.calc-inputs input {
  flex: 1;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.calc-inputs select {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
}
.calc-btn {
  background: var(--accent-emerald);
  border: none;
  color: var(--bg-app);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.calc-btn:hover {
  filter: brightness(1.1);
}
.calc-result-msg {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  animation: fadeIn 0.3s ease;
}
.calc-result-msg.success {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.calc-result-msg.danger {
  background: var(--accent-rose-light);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}
.metric-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}
.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.metric-value {
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0;
}
.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Info Cards Row */
.info-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (min-width: 600px) {
  .info-row {
    grid-template-columns: 1fr 1fr;
  }
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* Health Score radial progress */
.health-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.score-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.score-header h3 {
  font-size: 14px;
  color: var(--text-secondary);
}
.info-icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
}
.score-radial-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 10px 0;
}
.radial-progress-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}
.radial-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.radial-bg-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 8;
}
body.light-theme .radial-bg-ring {
  stroke: rgba(0, 0, 0, 0.05);
}
.radial-fg-ring {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251.2; /* 2 * PI * r (r=40) */
  transition: stroke-dashoffset 0.6s ease-in-out;
}
.score-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex;
  flex-direction: column;
}
.score-center-text span:first-child {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-heading);
}
.score-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.score-tip {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 8px;
}

/* Emergency fund buffer design */
.emergency-card h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.progress-bar-container {
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
  border: 1px solid var(--border-color);
}
body.light-theme .progress-bar-container {
  background: rgba(0, 0, 0, 0.05);
}
.progress-bar-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar-bar.fill-emerald { background: var(--accent-emerald); }
.progress-bar-bar.fill-gold { background: var(--accent-gold); }
.progress-bar-bar.fill-rose { background: var(--accent-rose); }
.progress-bar-bar.fill-blue { background: var(--accent-blue); }

.emergency-details {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}
.emergency-months {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-block;
  margin-top: 6px;
}

/* Quick Actions Widget */
.quick-actions-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.quick-actions-card h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.action-btn-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 480px) {
  .action-btn-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
.action-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}
body.light-theme .action-btn {
  background: #fdfdfd;
}
.btn-icon {
  font-size: 16px;
}
.action-btn:active {
  transform: scale(0.96);
}
.btn-expense:hover {
  background: var(--accent-rose-light);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}
.btn-income:hover {
  background: var(--accent-emerald-light);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}
.btn-saving:hover {
  background: var(--accent-blue-light);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* Gamification achievements */
.achievements-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.badge-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  padding: 4px 8px;
  border-radius: 20px;
}
.badge-scroller {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.achievement-badge {
  flex: 0 0 120px;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  opacity: 0.4;
  transition: var(--transition-smooth);
}
body.light-theme .achievement-badge {
  background: #fafafa;
}
.achievement-badge.unlocked {
  opacity: 1;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(251, 191, 36, 0.05) 100%);
  border-color: var(--accent-gold);
}
.badge-emoji {
  font-size: 24px;
  margin-bottom: 6px;
}
.achievement-badge.unlocked .badge-emoji {
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.6));
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.badge-name {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}
.badge-desc {
  font-size: 9px;
  color: var(--text-muted);
}

/* ================= TAB 2: TIMELINE ================= */
.section-header {
  margin-bottom: 20px;
}
.section-header h2 {
  font-size: 24px;
  font-weight: 700;
}
.section-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.calendar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.calendar-header h3 {
  font-size: 16px;
}
.arrow-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}
.calendar-day.empty {
  cursor: default;
  opacity: 0;
  pointer-events: none;
}
.calendar-day:hover:not(.empty) {
  background: var(--bg-card-hover);
  border-color: var(--border-color);
}
.calendar-day.selected {
  background: var(--accent-emerald);
  color: var(--bg-app) !important;
  font-weight: 700;
}
.calendar-day.today {
  border-color: var(--accent-gold);
}
.day-dots {
  display: flex;
  gap: 2px;
  position: absolute;
  bottom: 4px;
}
.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}
.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.transactions-list-section h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.transaction-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-smooth);
}
.transaction-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.txn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.txn-title {
  font-size: 14px;
  font-weight: 600;
}
.txn-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.txn-value {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
}

/* ================= TAB 3: BUDGETS ================= */
.wishlist-alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.wishlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.wishlist-limit-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  background: var(--accent-gold-light);
  padding: 4px 8px;
  border-radius: 12px;
}
.wishlist-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.wishlist-warning-banner {
  margin-top: 14px;
  background: var(--accent-rose-light);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.budgets-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.edit-budgets-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--accent-emerald);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.budgets-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.budget-progress-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.budget-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.budget-labels span:first-child {
  font-weight: 600;
}
.budget-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.category-legend-box {
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 480px) {
  .category-legend-box {
    grid-template-columns: 1fr 1fr;
  }
}
.legend-pillar h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.legend-pillar p {
  font-size: 11px;
  color: var(--text-muted);
}

/* ================= TAB 4: WEALTH & SAVINGS ================= */
.section-subheader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.add-goal-btn, .add-debit-btn {
  background: var(--accent-blue-light);
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.goals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 480px) {
  .goals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.goal-title {
  font-size: 14px;
  font-weight: 600;
}
.goal-class-badge {
  font-size: 9px;
  font-weight: 700;
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  padding: 2px 6px;
  border-radius: 4px;
}
.goal-value {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.goal-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.investments-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.investments-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

/* Contribution grid dots */
.contribution-calendar-card {
  margin-bottom: 16px;
}
.contribution-calendar-card h4 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.contribution-dots-grid {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding: 4px 0;
}
.contrib-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
}
body.light-theme .contrib-dot {
  background: rgba(0, 0, 0, 0.05);
}
.contrib-dot.active-1 { background: rgba(59, 130, 246, 0.3); }
.contrib-dot.active-2 { background: rgba(59, 130, 246, 0.6); }
.contrib-dot.active-3 { background: rgba(59, 130, 246, 1); }

.assets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.asset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}
.asset-item:last-child {
  border-bottom: none;
}
.asset-details h5 {
  font-size: 13px;
  font-weight: 600;
}
.asset-details span {
  font-size: 11px;
  color: var(--text-muted);
}
.asset-rates {
  text-align: right;
}
.asset-cur-val {
  font-size: 13px;
  font-weight: 700;
}
.asset-gain {
  font-size: 10px;
}

/* Auto debits segment list */
.auto-debits-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.debit-timelines {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}
.debit-segment {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.segment-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-left: 2px solid var(--accent-emerald);
  padding-left: 6px;
}
.debit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.debit-item {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.debit-info h5 {
  font-size: 13px;
  font-weight: 600;
}
.debit-info span {
  font-size: 11px;
  color: var(--text-muted);
}
.debit-amt {
  font-size: 13px;
  font-weight: 700;
}

/* ================= TAB 5: STORY & SIMULATION ================= */
.ai-story-card {
  background: linear-gradient(135deg, #13221a 0%, #0c1511 100%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
body.light-theme .ai-story-card {
  background: linear-gradient(135deg, #f2f7f4 0%, #e6efe9 100%);
}
.ai-story-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.ai-story-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-emerald);
  color: var(--bg-app);
  padding: 4px 8px;
  border-radius: 4px;
}
.ai-story-date {
  font-size: 12px;
  color: var(--text-muted);
}
.ai-story-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}

.insights-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.insights-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.insights-list li {
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.insights-list li::before {
  content: "✦";
  color: var(--accent-gold);
  font-weight: 700;
}

/* Simulator sandbox */
.simulator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.sim-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.sim-sliders {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.slider-header label {
  color: var(--text-secondary);
}
.slider-header span {
  font-weight: 700;
  color: var(--accent-emerald);
}
.slider-group input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
}
body.light-theme .slider-group input[type="range"] {
  background: rgba(0, 0, 0, 0.05);
}
.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-emerald);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-emerald);
}

.simulator-results {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}
body.light-theme .simulator-results {
  background: #fcfcfc;
}
.simulator-results h4 {
  font-size: 13px;
  margin-bottom: 12px;
}
.sim-projection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.proj-box {
  display: flex;
  flex-direction: column;
}
.proj-label {
  font-size: 11px;
  color: var(--text-muted);
}
.proj-val {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-heading);
}
.sim-verdict {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Exports Card & Settings */
.reports-card, .settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.reports-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.reports-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.reports-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}
.reports-btn:active {
  transform: scale(0.96);
}
.btn-pdf {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}
.btn-pdf:hover {
  background: var(--accent-emerald-light);
}
.btn-csv {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.btn-csv:hover {
  background: var(--accent-blue-light);
}
.btn-reset {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}
.btn-reset:hover {
  background: var(--accent-rose-light);
}
.btn-svg {
  width: 16px;
  height: 16px;
}

/* Settings fields styling */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.setting-item label {
  font-size: 13px;
  color: var(--text-secondary);
}
.setting-item input {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.setting-item button {
  background: var(--accent-emerald);
  border: none;
  color: var(--bg-app);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

/* ================= 4. BOTTOM MOBILE NAVIGATION ================= */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 10px 0 calc(10px + var(--safe-area-bottom));
  border-top: 1px solid var(--border-color);
  z-index: 990;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
}
.nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.nav-icon {
  width: 22px;
  height: 22px;
  transition: transform 0.2s ease;
}
.nav-item span {
  font-size: 10px;
  font-weight: 500;
}
.nav-item.active {
  color: var(--accent-emerald);
}
.nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 4px var(--accent-emerald));
}

/* ================= 5. DRAWERS & MODALS LAYOUT ================= */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.drawer-panel {
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

/* Drawer variants: Bottom Sheet & Slide Left */
.drawer-bottom {
  width: 100vw;
  max-height: 85vh;
  margin-top: auto;
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
}
.drawer-overlay.active .drawer-bottom {
  transform: translateY(0);
}

.drawer-right {
  width: 85vw;
  max-width: 380px;
  height: 100vh;
  margin-left: auto;
  transform: translateX(100%);
}
.drawer-overlay.active .drawer-right {
  transform: translateX(0);
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.close-drawer {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

.drawer-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* Modal Form Styles */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-group input, .form-group select {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  transition: var(--transition-smooth);
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--border-focus);
}

.toggle-button-row {
  display: flex;
  gap: 8px;
}
.toggle-button-row input {
  display: none;
}
.toggle-button-row label {
  flex: 1;
  text-align: center;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.toggle-button-row input:checked + label {
  background: var(--accent-emerald);
  color: var(--bg-app);
  font-weight: 700;
  border-color: var(--accent-emerald);
}

.submit-btn {
  width: 100%;
  padding: 14px;
  border: none;
  background: var(--accent-emerald);
  color: var(--bg-app);
  font-weight: 700;
  font-size: 14px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: var(--transition-smooth);
}
.submit-btn:hover {
  filter: brightness(1.1);
}

.budget-modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Notifications Drawer specific styles */
.noti-item {
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
}
.noti-item:last-child {
  border-bottom: none;
}
.noti-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.noti-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.noti-time {
  font-size: 10px;
  color: var(--text-muted);
}
.noti-body {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ================= 6. PRINT MEDIA TEMPLATES ================= */
.print-only {
  display: none;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-layout, .drawer-overlay {
    display: none !important;
  }
  .print-only {
    display: block !important;
    padding: 20px;
    font-family: 'Outfit', sans-serif;
  }
  .report-header {
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 30px;
    text-align: center;
  }
  .report-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
  }
  .report-section {
    margin-bottom: 25px;
  }
  .report-section h2 {
    font-size: 16px;
    border-bottom: 1px solid #cccccc;
    padding-bottom: 5px;
    margin-bottom: 10px;
  }
  .report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
  }
  .report-table th, .report-table td {
    border: 1px solid #dddddd;
    padding: 8px;
    text-align: left;
    font-size: 12px;
  }
  .report-table th {
    background-color: #f2f2f2;
    font-weight: bold;
  }
  .report-summary-text {
    font-size: 13px;
    line-height: 1.5;
    background: #fafafa;
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #10b981;
  }
  .report-footer {
    margin-top: 50px;
    border-top: 1px solid #eeeeee;
    padding-top: 10px;
    text-align: center;
    font-size: 10px;
    color: #777777;
  }
}

/* ================= MISSING / PATCH STYLES ================= */

/* Glass background decoration in spendable banner */
.glass-bg {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(16,185,129,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

/* Text color helper missing */
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* Investment net value headline */
.investment-net-val {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-heading);
  margin-top: 4px;
}

/* Goals section spacing */
.goals-section {
  margin-bottom: 20px;
}

/* ===== MONEY PERSONALITY CARD ===== */
.personality-card {
  background: linear-gradient(135deg, #13221a 0%, #0c1810 100%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
body.light-theme .personality-card {
  background: linear-gradient(135deg, #f0f9f4 0%, #e4f5eb 100%);
}
.personality-emoji {
  font-size: 52px;
  margin-bottom: 10px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(16,185,129,0.4));
}
.personality-type {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--accent-gold);
  margin-bottom: 8px;
}
.personality-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto 16px;
}
.personality-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.trait-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  border: 1px solid rgba(16,185,129,0.2);
}

/* ===== DELETE BUTTONS ON ITEMS ===== */
.item-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}
.item-delete-btn:hover {
  background: var(--accent-rose-light);
  color: var(--accent-rose);
}

/* Extend transaction-item and debit-item to support delete */
.transaction-item, .debit-item, .asset-item {
  position: relative;
}

/* Goals grid add bottom margin */
.goal-card { min-height: 140px; }

/* Wishlist progress bar */
.wishlist-progress {
  margin-top: 8px;
}

/* ===== TOAST NOTIFICATION (non-blocking) ===== */
#toast-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease forwards;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(12px);
}
.toast.success { border-color: var(--accent-emerald); color: var(--accent-emerald); }
.toast.warning { border-color: var(--accent-gold); color: var(--accent-gold); }
.toast.error { border-color: var(--accent-rose); color: var(--accent-rose); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: scale(0.9); }
}

