/* ============================================================
   Financial Dashboard - macOS/Numbers Style RTL Stylesheet
   ============================================================ */

/* ═══════════════════════════════════════════════════════════
   🍎 macOS/NUMBERS STYLE EXPERIMENTAL SECTION
   ═══════════════════════════════════════════════════════════
   כל הקוד שמסומן כאן הוא ניסוי בסגנון macOS/Numbers.
   אם לא אוהבים - אפשר למחוק את כל הבלוק הזה בקלות.
   ═══════════════════════════════════════════════════════════ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Custom Properties - Official macOS System Colors ---------- */
:root {
  /* macOS Light Mode backgrounds (from NSColor) */
  --bg-primary:    #ececec;  /* windowBackgroundColor */
  --bg-secondary:  #ffffff;  /* controlBackgroundColor */
  --bg-tertiary:   #f5f5f5;  /* underPageBackgroundColor */
  --accent:        #007aff;  /* controlAccentColor / systemBlue */
  --accent-dim:    #e6f2ff;  /* systemBlue 10% on white – solid */

  /* macOS system semantic colours - Light Mode */
  --income:        #28cd41;  /* systemGreen RGB(40,205,65) */
  --income-dim:    #eafaec;  /* systemGreen 10% on white – solid */
  --expense:       #ff3b30;  /* systemRed RGB(255,59,48) */
  --expense-dim:   #ffebea;  /* systemRed 10% on white – solid */
  --neutral:       #007aff;  /* systemBlue RGB(0,122,255) */
  --neutral-dim:   #e6f2ff;  /* systemBlue 10% on white – solid */
  --savings:       #ff9500;  /* systemOrange RGB(255,149,0) */
  --savings-dim:   #fff4e6;  /* systemOrange 10% on white – solid */
  --warning:       #ffcc00;  /* systemYellow RGB(255,204,0) */
  --purple:        #af52de;  /* systemPurple RGB(175,82,222) */
  --purple-dim:    #f5eafb;  /* systemPurple 12% on white – solid */
  --teal:          #59adc4;  /* systemTeal RGB(89,173,196) */
  --teal-dim:      #ebf5f8;  /* systemTeal 12% on white – solid */
  --indigo:        #5856d6;  /* systemIndigo RGB(88,86,214) */
  --pink:          #ff2d55;  /* systemPink RGB(255,45,85) */
  --pink-dim:      #ffe6eb;  /* systemPink 12% on white – solid */
  --mint:          #00c7be;  /* systemMint RGB(0,199,190) */
  --brown:         #a2845e;  /* systemBrown RGB(162,132,94) */
  --gray-system:   #8e8e93;  /* systemGray RGB(142,142,147) */

  /* macOS typography (using Heebo as Hebrew proxy for SF Pro) */
  --font-family:   'Heebo', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
  --text-primary:  rgba(0, 0, 0, 0.847);    /* labelColor */
  --text-secondary:rgba(0, 0, 0, 0.498);    /* secondaryLabelColor */
  --text-muted:    rgba(0, 0, 0, 0.247);     /* tertiaryLabelColor / placeholderTextColor */

  /* macOS UI element colors - Light Mode */
  --separator:     rgba(0, 0, 0, 0.098);     /* separatorColor */
  --grid-color:    #e6e6e6;                   /* gridColor */
  --link-color:    #0068da;                   /* linkColor */
  --selected-bg:   #b3d7ff;                   /* selectedTextBackgroundColor */
  --selected-content: #0063e1;                /* selectedContentBackgroundColor */

  /* Spacing scale */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* Border radius - macOS standard */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  /* Shadows - macOS native window/card shadows */
  --shadow-card:    0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  --shadow-hover:   0 4px 12px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --shadow-glow:    0 0 0 3px rgba(0, 122, 255, 0.3);  /* macOS focus ring */

  /* Transitions - macOS standard */
  --transition-fast:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- DARK THEME OVERRIDES - Official macOS Dark Mode ---------- */
body.theme-dark {
  /* macOS Dark Mode backgrounds (from NSColor) */
  --bg-primary:    #323232;  /* windowBackgroundColor dark */
  --bg-secondary:  #1e1e1e;  /* controlBackgroundColor dark */
  --bg-tertiary:   #2a2a2a;  /* underPageBackgroundColor dark */
  --accent:        #0a84ff;  /* systemBlue dark RGB(10,132,255) */
  --accent-dim:    rgba(10, 132, 255, 0.15);

  /* macOS system colours - Dark Mode */
  --income:        #32d74b;  /* systemGreen dark RGB(50,215,75) */
  --income-dim:    rgba(50, 215, 75, 0.15);
  --expense:       #ff453a;  /* systemRed dark RGB(255,69,58) */
  --expense-dim:   rgba(255, 69, 58, 0.15);
  --neutral:       #0a84ff;  /* systemBlue dark RGB(10,132,255) */
  --neutral-dim:   rgba(10, 132, 255, 0.15);
  --savings:       #ff9f0a;  /* systemOrange dark RGB(255,159,10) */
  --savings-dim:   rgba(255, 159, 10, 0.15);
  --warning:       #ffd60a;  /* systemYellow dark */
  --purple:        #bf5af2;  /* systemPurple dark */
  --teal:          #6ac4dc;  /* systemTeal dark RGB(106,196,220) */
  --indigo:        #5e5ce6;  /* systemIndigo dark */
  --pink:          #ff375f;  /* systemPink dark RGB(255,55,95) */
  --mint:          #63e6e2;  /* systemMint dark RGB(99,230,226) */
  --brown:         #ac8e68;  /* systemBrown dark RGB(172,142,104) */
  --gray-system:   #98989d;  /* systemGray dark RGB(152,152,157) */

  /* macOS Dark Mode text (from NSColor) */
  --text-primary:  rgba(255, 255, 255, 0.847);  /* labelColor dark */
  --text-secondary:rgba(255, 255, 255, 0.498);  /* secondaryLabelColor dark */
  --text-muted:    rgba(255, 255, 255, 0.247);   /* tertiaryLabelColor dark */

  /* macOS Dark Mode UI elements */
  --separator:     rgba(255, 255, 255, 0.098);   /* separatorColor dark */
  --grid-color:    #1a1a1a;                       /* gridColor dark */
  --link-color:    #419cff;                       /* linkColor dark */
  --selected-bg:   #3f638b;                       /* selectedTextBackgroundColor dark */
  --selected-content: #0058d0;                    /* selectedContentBackgroundColor dark */

  /* Shadows - macOS dark mode style */
  --shadow-card:    0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
  --shadow-hover:   0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  --shadow-glow:    0 0 0 3px rgba(10, 132, 255, 0.35);
}

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

html {
  direction: rtl;
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.47059; /* macOS line-height */
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: -0.011em; /* macOS letter-spacing */

  /* macOS-style flat background */
  background-image: none;
  background-attachment: fixed;
}

body.theme-dark {
  background-image: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ---------- Selection - macOS style ---------- */
::selection {
  background: var(--selected-bg);
  color: var(--text-primary);
}

/* ---------- Typography Utilities ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent);
}

/* ============================================================
   LAYOUT - Main Dashboard Container
   ============================================================ */
.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);  /* 24px - consistent section spacing */
}

/* ============================================================
   1. HEADER - macOS Toolbar Style
   ============================================================ */
.header {
  padding: 8px 16px;
  background: var(--bg-secondary);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 0.5px solid var(--separator);
  border-radius: 0;
  position: relative;
  z-index: 10;
  box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.05);
  margin-bottom: 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
}

/* macOS Traffic Lights (left side in RTL) */
.header-traffic-lights {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.2);
}

.traffic-light--close { background: #ff5f57; }
.traffic-light--minimize { background: #ffbd2e; }
.traffic-light--maximize { background: #28ca42; }

.header-right {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.header-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-subtitle {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.header-balances {
  display: flex;
  gap: var(--space-md);
}

.header-balance {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 122, 255, 0.08);
  border: 0.5px solid rgba(0, 122, 255, 0.15);
  min-width: 120px;
}

.balance-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 1px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.balance-value {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.last-updated {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* macOS header doesn't need gradient border */
.header::before {
  display: none;
}

.header .logo,
.header-logo {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--indigo));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.header .date,
.header-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 400;
}

.header .user-info,
.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header .avatar,
.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}

.header nav,
.header-nav {
  display: flex;
  gap: var(--space-sm);
}

.header nav a,
.header-nav a {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.header nav a:hover,
.header-nav a:hover,
.header nav a.active,
.header-nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ============================================================
   2. SUMMARY CARDS
   ============================================================ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);  /* 16px - consistent card grid spacing */
}

.card {
  position: relative;
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
  overflow: hidden;
}

/* macOS cards - no gradient borders, subtle hover */
.card::before {
  display: none;
}

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

.card::after {
  display: none;
}

.card .card-icon,
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
  background: rgba(0, 122, 255, 0.08);
}

.card .card-label,
.card-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.sum-bar-desktop {
  height: 4px;
  background: var(--separator, rgba(0,0,0,0.08));
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.sum-bar-desktop__fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.65s ease;
}

.card .card-subtitle,
.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.card .card-value,
.card-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.022em; /* macOS number spacing */
  margin-bottom: var(--space-xs);
  line-height: 1.2;
}

.card .card-change,
.card-change {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Colour-coded card variants */
.card--income .card-icon   { background: var(--income-dim);  color: var(--income);  }
.card--income .card-value  { color: var(--income); }
.card--income .card-change { color: var(--income); }

.card--expense .card-icon   { background: var(--expense-dim);  color: var(--expense);  }
.card--expense .card-value  { color: var(--expense); }
.card--expense .card-change { color: var(--expense); }

.card--neutral .card-icon   { background: var(--neutral-dim);  color: var(--neutral);  }
.card--neutral .card-value  { color: var(--neutral); }

.card--savings .card-icon   { background: var(--savings-dim);  color: var(--savings);  }
.card--savings .card-value  { color: var(--savings); }
.card--savings .card-change { color: var(--savings); }

.card--accent .card-icon   { background: var(--accent-dim);  color: var(--accent);  }
.card--accent .card-value  { color: var(--accent); }

/* ============================================================
   GENERIC SECTION PANEL
   (shared by charts, loans, savings, expenses, timeline, etc.)
   ============================================================ */
.section-panel,
.chart-container,
.loans,
.savings,
.fixed-expenses,
.timeline,
.credit-cards {
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-normal);
}

.section-panel:hover,
.chart-container:hover,
.loans:hover,
.savings:hover,
.fixed-expenses:hover,
.timeline:hover,
.credit-cards:hover {
  box-shadow: var(--shadow-hover);
}

/* Section headings inside panels */
.section-title,
.chart-container h2,
.loans h2,
.savings h2,
.fixed-expenses h2,
.timeline h2,
.credit-cards h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.section-title {
  cursor: pointer;
  user-select: none;
}

.section-title::after {
  content: '▾';
  font-size: 13px;
  margin-right: auto;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  line-height: 1;
}

.section.collapsed .section-title::after {
  transform: rotate(-90deg);
}

.section.collapsed > *:not(.section-title) {
  display: none;
}

.section.collapsed .section-title {
  margin-bottom: 0;
  border-bottom-color: transparent;
}

.section-title::before,
.chart-container h2::before,
.loans h2::before,
.savings h2::before,
.fixed-expenses h2::before,
.timeline h2::before,
.credit-cards h2::before {
  display: none; /* macOS doesn't use accent bars */
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.section > .card {
  padding: var(--space-lg);
}

/* ============================================================
   3. CHARTS SECTION
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--space-md);  /* 16px */
}

.chart-container {
  min-height: 300px;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 320px;
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-md);  /* 16px */
}

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

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

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

/* ============================================================
   4. LOANS SECTION
   ============================================================ */
.loans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);  /* 16px */
}

.loan-card {
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
}

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

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

.loan-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.loan-badge {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.loan-badge--active {
  background: var(--income-dim);
  color: var(--income);
}

.loan-badge--completed {
  background: var(--accent-dim);
  color: var(--accent);
}

.loan-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  font-size: 0.85rem;
}

.loan-detail-label {
  color: var(--text-muted);
}

.loan-detail-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--indigo));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Animated shimmer on progress bar */
.progress-bar__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-bar--income .progress-bar__fill {
  background: linear-gradient(90deg, var(--income), var(--mint));
}

.progress-bar--expense .progress-bar__fill {
  background: linear-gradient(90deg, var(--expense), var(--pink));
}

.progress-bar--savings .progress-bar__fill {
  background: linear-gradient(90deg, var(--savings), var(--warning));
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ============================================================
   5. SAVINGS SECTION
   ============================================================ */
/* ── Goals ── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
}
.goal-card {
  padding: 18px 20px !important;
}
.goal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.goal-icon {
  font-size: 22px;
}
.goal-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.goal-status-icon {
  font-size: 18px;
}
.goal-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}
.goal-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s ease-out;
}
.goal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.goal-percent {
  font-weight: 700;
  color: var(--text-primary);
}
.goal-values {
  color: var(--text-secondary);
}

.savings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);  /* 16px */
}

.savings-card {
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

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

.savings-card::before {
  display: none;
}

.savings-type {
  font-size: 0.8rem;
  color: var(--savings);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.savings-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.savings-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--savings);
  margin-bottom: var(--space-md);
}

.savings-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ============================================================
   6. FIXED EXPENSES TABLE
   ============================================================ */
.fixed-expenses table,
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.fixed-expenses thead th,
.table thead th {
  text-align: right;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 0.5px solid var(--separator);
  white-space: nowrap;
  background: var(--bg-tertiary);
}

.fixed-expenses tbody tr,
.table tbody tr {
  transition: background var(--transition-fast);
}

.fixed-expenses tbody tr:hover,
.table tbody tr:hover {
  background: var(--accent-dim);
}

.fixed-expenses tbody td,
.table tbody td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--separator);
  color: var(--text-primary);
  vertical-align: middle;
  font-size: 13px;
}

.fixed-expenses tbody tr:last-child td,
.table tbody tr:last-child td {
  border-bottom: none;
}

/* Expense category tag */
.expense-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.expense-tag--housing   { background: rgba(175, 82, 222, 0.12); color: var(--purple); }
.expense-tag--insurance { background: var(--savings-dim);        color: var(--savings); }
.expense-tag--utilities { background: rgba(89, 173, 196, 0.12); color: var(--teal); }
.expense-tag--transport { background: var(--neutral-dim);        color: var(--neutral); }
.expense-tag--education { background: rgba(255, 45, 85, 0.12);  color: var(--pink); }
.expense-tag--health    { background: var(--income-dim);         color: var(--income); }
.expense-tag--other     { background: var(--bg-tertiary);        color: var(--text-secondary); }

/* Amount styling in tables */
.amount,
.amount--positive,
.amount--negative,
.amount--neutral {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: embed;
}

.amount--positive { color: var(--income); }
.amount--negative { color: var(--expense); }
.amount--neutral  { color: var(--neutral); }

/* ============================================================
   7. TIMELINE
   ============================================================ */
.timeline-list {
  position: relative;
  padding-right: var(--space-xl);
}

/* Vertical line */
.timeline-list::before {
  content: '';
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--accent),
    var(--bg-tertiary) 90%,
    transparent
  );
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
  padding-right: var(--space-lg);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

/* Dot on timeline */
.timeline-item::before {
  content: '';
  position: absolute;
  right: calc(-1 * var(--space-xl) + 3px);
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 0 10px rgba(0, 122, 255, 0.35);
  z-index: 1;
}

.timeline-item--income::before  { background: var(--income);  box-shadow: 0 0 10px rgba(40, 205, 65, 0.35); }
.timeline-item--expense::before { background: var(--expense); box-shadow: 0 0 10px rgba(255, 59, 48, 0.35); }
.timeline-item--savings::before { background: var(--savings); box-shadow: 0 0 10px rgba(255, 149, 0, 0.35); }

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.timeline-content {
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  transition: all var(--transition-fast);
}

.timeline-content:hover {
  box-shadow: var(--shadow-hover);
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.timeline-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.timeline-amount {
  font-size: 1rem;
  font-weight: 700;
  margin-top: var(--space-xs);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   8. CREDIT CARDS SECTION
   ============================================================ */
.credit-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-md);  /* 16px - consistent card grid spacing */
}

.credit-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform var(--transition-normal);
  color: #fff;
}

.credit-card:hover {
  transform: translateY(-4px) scale(1.01);
}

/* Card gradient backgrounds */
.credit-card--visa {
  background: linear-gradient(135deg, #1a1a5e 0%, #2d2d8a 50%, #1a1a5e 100%);
}

.credit-card--mastercard {
  background: linear-gradient(135deg, #1e1e3a 0%, #3a1a5e 50%, #1e1e3a 100%);
}

.credit-card--amex {
  background: linear-gradient(135deg, #0d2b4a 0%, #1a4a6a 50%, #0d2b4a 100%);
}

.credit-card--default {
  background: linear-gradient(135deg, #1a1a3e 0%, #2a2a5e 50%, #1a1a3e 100%);
}

/* Decorative circles on card */
.credit-card::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -10%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.credit-card::after {
  content: '';
  position: absolute;
  bottom: -40%;
  right: -10%;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.credit-card-type {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

.credit-card-number {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  direction: ltr;
  unicode-bidi: embed;
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.credit-card-number span {
  opacity: 0.5;
}

.credit-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 1;
}

.credit-card-balance-label {
  font-size: 0.7rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credit-card-balance {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.credit-card-expiry {
  font-size: 0.8rem;
  opacity: 0.7;
  direction: ltr;
  unicode-bidi: embed;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Colour helpers */
.text-income  { color: var(--income) !important; }
.text-expense { color: var(--expense) !important; }
.text-neutral { color: var(--neutral) !important; }
.text-savings { color: var(--savings) !important; }
.text-accent  { color: var(--accent) !important; }
.text-muted   { color: var(--text-muted) !important; }

.bg-income  { background-color: var(--income-dim) !important; }
.bg-expense { background-color: var(--expense-dim) !important; }
.bg-neutral { background-color: var(--neutral-dim) !important; }
.bg-savings { background-color: var(--savings-dim) !important; }

/* Badges / pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--income  { background: var(--income-dim);  color: var(--income); }
.badge--expense { background: var(--expense-dim); color: var(--expense); }
.badge--neutral { background: var(--neutral-dim); color: var(--neutral); }
.badge--savings { background: var(--savings-dim); color: var(--savings); }
.badge--accent  { background: var(--accent-dim);  color: var(--accent); }

/* Number display - ensures LTR for currency amounts inside RTL context */
.ltr-num {
  direction: ltr;
  unicode-bidi: embed;
  font-variant-numeric: tabular-nums;
}

/* Stat indicator arrows */
.indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.indicator--up   { color: var(--income); }
.indicator--down { color: var(--expense); }

.indicator--up::before   { content: '\25B2'; font-size: 0.6rem; }
.indicator--down::before { content: '\25BC'; font-size: 0.6rem; }

/* Divider */
.divider {
  border: none;
  height: 0.5px;
  background: var(--separator);
  margin: var(--space-lg) 0;
}

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

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.25);
}

.btn--primary:hover {
  box-shadow: 0 6px 24px rgba(0, 122, 255, 0.4);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(0, 122, 255, 0.25);
}

.btn--ghost:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

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

/* ============================================================
   TOOLTIP (generic)
   ============================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 50%;
  transform: translateX(50%);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 50;
  box-shadow: var(--shadow-card);
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

/* Fade-in on load */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

/* Staggered card entrances */
.summary-cards .card:nth-child(1) { animation: fadeInUp 0.4s 0.05s ease both; }
.summary-cards .card:nth-child(2) { animation: fadeInUp 0.4s 0.12s ease both; }
.summary-cards .card:nth-child(3) { animation: fadeInUp 0.4s 0.19s ease both; }
.summary-cards .card:nth-child(4) { animation: fadeInUp 0.4s 0.26s ease both; }
.summary-cards .card:nth-child(5) { animation: fadeInUp 0.4s 0.33s ease both; }
.summary-cards .card:nth-child(6) { animation: fadeInUp 0.4s 0.40s ease both; }

/* Pulse for active indicators */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Spin for loading */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 122, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Counter animation helper (use with JS) */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.count-animate {
  animation: countUp 0.6s ease forwards;
}

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

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.empty-state-text {
  font-size: 0.95rem;
}

/* Skeleton loading placeholders */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-primary) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeletonWave 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonWave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton--text    { height: 14px; width: 60%; margin-bottom: var(--space-sm); }
.skeleton--heading { height: 22px; width: 40%; margin-bottom: var(--space-md); }
.skeleton--block   { height: 120px; width: 100%; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet - landscape */
@media (max-width: 1200px) {
  .dashboard {
    padding: var(--space-md);
  }

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

  .credit-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablet - portrait */
@media (max-width: 900px) {
  html {
    font-size: 15px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .header nav,
  .header-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

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

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

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

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

/* Mobile */
@media (max-width: 600px) {
  html {
    font-size: 14px;
  }

  .dashboard {
    padding: var(--space-sm);
    gap: var(--space-md);
  }

  .header {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

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

  .card .card-value,
  .card-value {
    font-size: 1.5rem;
  }

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

  .chart-container,
  .loans,
  .savings,
  .fixed-expenses,
  .timeline,
  .credit-cards {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

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

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

  .credit-cards-grid {
    grid-template-columns: 1fr;
  }

  .credit-card {
    min-height: 170px;
    padding: var(--space-lg);
  }

  /* Horizontal scroll for tables on mobile */
  .fixed-expenses {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fixed-expenses table,
  .table {
    min-width: 500px;
  }

  .timeline-list {
    padding-right: var(--space-lg);
  }
}

/* Small mobile */
@media (max-width: 380px) {
  .header .logo,
  .header-logo {
    font-size: 1.3rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }

  .card .card-value,
  .card-value {
    font-size: 1.3rem;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  body {
    background: #fff;
    color: #1a1a1a;
  }

  .header {
    position: static;
    background: none;
    backdrop-filter: none;
    border: 1px solid #ddd;
    box-shadow: none;
  }

  .card,
  .chart-container,
  .loans,
  .savings,
  .fixed-expenses,
  .timeline,
  .credit-cards {
    background: #fff;
    backdrop-filter: none;
    border: 1px solid #ddd;
    box-shadow: none;
    break-inside: avoid;
  }

  .card::before,
  .card::after,
  .header::before {
    display: none;
  }

  .card .card-value,
  .card-value {
    color: #1a1a1a;
  }

  .amount--positive { color: #006600; }
  .amount--negative { color: #cc0000; }
}

/* ============================================================
   TABS - macOS Segmented Control Style
   ============================================================ */
.tabs-bar {
  display: inline-flex;
  justify-content: flex-start;
  gap: 1px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  position: sticky;
  top: 0;
  z-index: 50;
  margin-bottom: 12px;
}

/* Segmented control container effect */
.tabs-bar {
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 0;
  margin: 10px 16px 12px;
}

body.theme-dark .tabs-bar {
  background: rgba(255, 255, 255, 0.08);
}

.tab-btn {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tab-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

body.theme-dark .tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

body.theme-dark .tab-btn.active {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);  /* 16px - matches card grid gaps */
  animation: tabFadeIn 0.3s ease;
}

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

/* ============================================================
   MONTH NAVIGATOR
   ============================================================ */
.month-navigator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 0.5px solid var(--separator);
  position: sticky;
  top: 0;
  z-index: 49;
  margin-bottom: var(--space-md);
}

.month-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--separator);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.05);
}

.month-nav-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.month-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.month-nav-btn:disabled:hover {
  background: var(--bg-secondary);
  border-color: var(--separator);
  transform: none;
  box-shadow: none;
}

.month-nav-label {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 140px;
  text-align: center;
  letter-spacing: -0.01em;
}

/* ============================================================
   TRANSACTION DETAIL MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

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

.modal-content {
  background: var(--bg-secondary);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 0.5px solid var(--separator);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--expense-dim);
  color: var(--expense);
}

/* ---------- Demo Toggle Button ---------- */
.demo-toggle {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--separator);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.05);
}

.demo-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.demo-toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 122, 255, 0.3);
}

/* Demo mode indicator bar */
.demo-bar {
  display: none;
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  padding: 4px;
  letter-spacing: 0.02em;
}

body.demo-mode .demo-bar {
  display: block;
}

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--separator);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.05);
}

.theme-toggle-icon {
  font-size: 1rem;
}

.theme-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.modal-body .expenses-table {
  margin: 0;
}

.modal-total {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--accent);
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.clickable-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

/* Category & Source badges in transaction modal */
.category-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--neutral-dim);
  color: var(--indigo);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.source-bank {
  background: var(--income-dim);
  color: var(--income);
}

.source-card {
  background: var(--savings-dim);
  color: var(--savings);
}

.source-cash {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

/* ── Insights Strip ───────────────────────────────────── */
.insights-strip {
  display: flex;
  gap: 12px;
  padding: 0 0 16px;
  align-items: stretch;
}

/* Gauge card */
.insight-gauge-card {
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 168px;
  flex-shrink: 0;
}

.insight-gauge-card__title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
  align-self: flex-start;
}

.insight-gauge-svg {
  width: 152px;
  height: auto;
}

.gauge-needle { transition: transform 0.85s cubic-bezier(.4,0,.2,1); }

.insight-gauge-card__score {
  font-size: 21px;
  font-weight: 700;
  margin-top: -6px;
  line-height: 1;
}

.insight-gauge-card__badge {
  font-size: 15px;
  margin-top: 5px;
}

/* Chips column */
.insights-chips-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.insight-chip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  box-shadow: var(--shadow-card);
  flex: 1;
  transition: transform 0.15s, box-shadow 0.15s;
}

.insight-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.insight-chip__header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insight-chip__icon { font-size: 20px; flex-shrink: 0; }

.insight-chip__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.insight-chip__label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.insight-chip__value { font-size: 14px; font-weight: 700; white-space: nowrap; }

.insight-chip__bar {
  height: 4px;
  background: var(--separator);
  border-radius: 2px;
  overflow: hidden;
}

.insight-chip__bar-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.65s ease;
}

/* Section headers and subtotals in transaction modal */
.section-row {
  padding: 14px 16px 8px !important;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-top: 0.5px solid var(--separator);
  background: var(--bg-tertiary);
}

.subtotal-row {
  padding: 10px 16px !important;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 0.5px solid var(--separator);
  background: var(--bg-tertiary);
}

/* ============================================================
   REDUCED MOTION PREFERENCE
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}


/* ============================================================
   BUDGET TRACKER - Budget vs Actual
   ============================================================ */
/* --- Draft overlay for budget tracker --- */
.budget-draft-card {
  position: relative;
  opacity: 0.55;
}

.budget-draft-banner {
  background: var(--savings);
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

/* ============================================================
   BUDGET TRACKER - Animated Grid Blocks
   ============================================================ */
.budget-tracker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

/* --- Base Block --- */
.budget-block {
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 2px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.3s;
  position: relative;
  overflow: hidden;
}

.budget-block__icon {
  font-size: 16px;
  line-height: 1;
}

.budget-block__name {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-block__amount {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
}

.budget-block__budget {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
}

.budget-block__pct {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.budget-block__bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.budget-block__bar-fill {
  height: 100%;
  border-radius: 2px;
  background: #fff;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

/* --- Safe (<50%) - solid green --- */
.budget-block--safe {
  background: var(--income);
}

/* --- Warning (50-80%) - solid orange --- */
.budget-block--warning {
  background: var(--savings);
  padding: 9px;
}

/* --- Stress (80-100%) - solid deep orange/red --- */
.budget-block--stress {
  background: #e85d04;
  padding: 10px;
  animation: jitter 3s infinite;
}

/* --- Breach (>100%) - solid red --- */
.budget-block--breach {
  grid-column: span 2;
  background: var(--expense);
  padding: 10px;
  animation: pulse-border 2s infinite;
}
.budget-block--breach .budget-block__icon { font-size: 18px; }
.budget-block--breach .budget-block__name { font-size: 12px; }
.budget-block--breach .budget-block__amount { font-size: 16px; }
.budget-block--breach .budget-block__pct { font-size: 11px; }

/* --- Summary Block (full-width) --- */
.budget-block--summary {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  color: #fff;
}
.budget-block--summary.budget-block--safe { background: var(--income); animation: none; }
.budget-block--summary.budget-block--warning { background: var(--savings); animation: none; }
.budget-block--summary.budget-block--stress { background: #e85d04; animation: none; }
.budget-block--summary.budget-block--breach { background: var(--expense); animation: pulse-border 2s infinite; }

/* --- Animations --- */
@keyframes jitter {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(-1px, 1px); }
  92% { transform: translate(1px, -1px); }
  94% { transform: translate(-1px, 0); }
  96% { transform: translate(1px, 1px); }
  98% { transform: translate(0, -1px); }
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.3); }
  50% { box-shadow: 0 0 10px 3px rgba(255, 59, 48, 0.15); }
}

/* --- Responsive: smaller screens stack blocks --- */
@media (max-width: 500px) {
  .budget-block--breach { grid-column: span 1; }
  .budget-tracker { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
}

/* ============================================================
   FOOTER - macOS Style
   ============================================================ */
.footer {
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 0.5px solid var(--separator);
  text-align: center;
  margin-top: var(--space-xl);
}

.footer p {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 400;
}

/* ============================================================
   INCOME TARGET BAR - Business Tab (Horizontal)
   ============================================================ */
.income-target-section {
  margin-bottom: var(--space-md);
}

.income-target-card {
  padding: var(--space-lg) var(--space-xl) !important;
}

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

.income-target-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.income-target-amount {
  font-size: 24px;
  font-weight: 700;
  color: var(--income);
  letter-spacing: -0.02em;
  direction: ltr;
}

.income-target-bar {
  position: relative;
  width: 100%;
  height: 54px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.income-target-fill {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(to left, var(--income), #34d058);
  border-radius: var(--radius-lg);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.income-target-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 100%
  );
  animation: shimmer-h 2.5s ease-in-out infinite;
}

@keyframes shimmer-h {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.income-target-week-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-right: 1px dashed rgba(120, 120, 128, 0.35);
  z-index: 2;
  pointer-events: none;
}

.income-target-scale {
  display: flex;
  justify-content: space-between;
  direction: rtl;
  margin-top: 6px;
  padding: 0 2px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.income-target-footer {
  margin-top: var(--space-sm);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.income-target-footer .week-badge {
  display: inline-block;
  background: var(--income-dim);
  color: var(--income);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.income-target-footer .pace-info {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .income-target-bar {
    height: 42px;
  }
  .income-target-amount {
    font-size: 18px;
  }
  .income-target-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }
}

/* ============================================================
   EXTENDED CASH FLOW CHART - Overview
   ============================================================ */
.chart-container--wide {
  height: 320px;
}

.extended-cashflow-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-md) 0 var(--space-xs);
  flex-wrap: wrap;
}

.extended-cashflow-stat {
  text-align: center;
}

.extended-cashflow-stat .stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  direction: ltr;
}

.extended-cashflow-stat .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   VAT PREDICTION - Business Tab
   ============================================================ */
.vat-section {
  margin-bottom: var(--space-md);
}

.vat-card {
  padding: var(--space-md) var(--space-lg) !important;
  border-right: 4px solid var(--expense);
}

.vat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.vat-chevron {
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.vat-mini-amount {
  display: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--expense);
}

.vat-card.collapsed .vat-header { margin-bottom: 0; }
.vat-card.collapsed .vat-body { display: none; }
.vat-card.collapsed .vat-period { display: none; }
.vat-card.collapsed .vat-mini-amount { display: inline; }
.vat-card.collapsed .vat-chevron { transform: rotate(-90deg); }

.vat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vat-icon {
  font-size: 20px;
}

.vat-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.vat-period {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.vat-body {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.vat-main-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--expense);
  letter-spacing: -0.02em;
  direction: ltr;
}

.vat-details {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.vat-details span {
  display: inline;
}

@media (max-width: 768px) {
  .vat-body {
    flex-direction: column;
    gap: var(--space-xs);
  }
  .vat-main-amount {
    font-size: 22px;
  }
}

/* ═══════════════════════════════════════════════════════════
   🍎 END OF macOS/NUMBERS STYLE EXPERIMENTAL SECTION
   ═══════════════════════════════════════════════════════════
   כל השינויים לעיל (מההערה בתחילת הקובץ) הם חלק מניסוי
   בסגנון macOS/Numbers. אם לא אוהבים - אפשר למחוק את כל
   הבלוק שמסומן בהערות האלה ולהחזיר את העיצוב הקודם.
   ═══════════════════════════════════════════════════════════ */

/* ── Notifications ─────────────────────────────────── */
.notif-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-bell {
  background: none; border: none; cursor: pointer; font-size: 18px;
  padding: 4px 6px; border-radius: 8px; position: relative;
  transition: background 0.15s;
}
.notif-bell:hover { background: rgba(0,0,0,0.06); }
.notif-badge {
  position: absolute; top: -2px; right: -4px;
  background: #FF3B30; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  pointer-events: none;
}
.notif-panel {
  position: fixed; top: 0; right: 0; left: auto; /* top/right set dynamically by JS */
  width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--card-bg, #fff); border: 1px solid var(--border, #e5e5e5);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9999; padding: 12px 0;
}
.notif-panel.hidden { display: none; }
.notif-panel__title {
  font-size: 13px; font-weight: 700; color: var(--text-muted,#888);
  padding: 0 14px 8px; border-bottom: 1px solid var(--border,#e5e5e5); margin-bottom: 6px;
}
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; transition: background 0.1s;
}
.notif-item:hover { background: rgba(0,0,0,0.03); }
.notif-item--high .notif-item__title { color: #FF3B30; }
.notif-item__icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.notif-item__text { flex: 1; min-width: 0; }
.notif-item__title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.notif-item__body  { font-size: 12px; color: var(--text-muted,#888); line-height: 1.4; }
.notif-item__check {
  background: none; border: 1.5px solid #ccc; cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px;
  color: #aaa; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; margin-top: 2px;
}
.notif-item__check:hover { border-color: #34C759; color: #34C759; }
.notif-empty { padding: 16px 14px; font-size: 13px; color: var(--text-muted,#888); text-align: center; }
.notif-empty.hidden { display: none; }
/* dark */
body.dark-mode .notif-bell:hover { background: rgba(255,255,255,0.08); }
body.dark-mode .notif-panel { background: #1c1c1e; border-color: #3a3a3c; }
body.dark-mode .notif-item:hover { background: rgba(255,255,255,0.04); }
body.dark-mode .notif-item__check { border-color: #555; color: #666; }

/* ── Desktop Credit Cards Grid ─────────────────────── */
.d-cc-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 4px;
}
.d-cc-card {
  background: var(--card-bg,#fff); border-radius: 12px; padding: 14px 16px;
  border: 1px solid var(--border,#e5e5e5); cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  position: relative; overflow: hidden;
}
.d-cc-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-1px); }
.d-cc-card__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.d-cc-card__num { font-size: 15px; font-weight: 800; }
.d-cc-card__meta { font-size: 11px; color: var(--text-muted,#888); margin-top: 2px; }
.d-cc-card__dot  { margin: 0 3px; }
.d-cc-card__amt  { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.d-cc-card__status { font-size: 11px; font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-cc-card__unusual { font-size: 11px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-cc-bar { height: 3px; background: rgba(0,0,0,0.06); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.d-cc-bar__fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.d-cc-card__pct { font-size: 10px; color: var(--text-muted,#888); }
body.dark-mode .d-cc-card { background: #1c1c1e; border-color: #3a3a3c; }
body.dark-mode .d-cc-bar { background: rgba(255,255,255,0.08); }

/* ── Desktop CC Modal ──────────────────────────────── */
.d-cc-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.d-cc-modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.d-cc-modal__box {
  position: relative; background: var(--card-bg,#fff);
  border-radius: 16px; width: 480px; max-height: 80vh; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.d-cc-modal__header { padding: 20px 20px 12px; border-bottom: 1px solid var(--border,#e5e5e5); flex-shrink: 0; }
.d-cc-modal__body   { overflow-y: auto; padding: 12px; flex: 1; }
.d-cc-modal__card-info { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.d-cc-modal__card-num  { font-size: 18px; font-weight: 800; }
.d-cc-modal__card-meta { font-size: 12px; color: var(--text-muted,#888); margin-top: 3px; }
.d-cc-modal__stats { display: flex; gap: 8px; }
.d-cc-modal__stat { flex: 1; background: var(--bg,#f5f5f7); border-radius: 10px; padding: 8px 10px; text-align: center; }
.d-cc-modal__stat-val { font-size: 16px; font-weight: 700; }
.d-cc-modal__stat-lbl { font-size: 10px; color: var(--text-muted,#888); margin-top: 2px; }
.d-cc-modal__close { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text-muted,#888); padding: 4px 8px; }
.d-cc-modal__tx { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; margin-bottom: 4px; background: var(--bg,#f5f5f7); }
.d-cc-modal__tx-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.d-cc-modal__tx-flag { font-size: 13px; flex-shrink: 0; }
.d-cc-modal__tx-desc { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-cc-modal__tx-date { font-size: 10px; color: var(--text-muted,#888); margin-top: 1px; }
.d-cc-modal__tx-amt  { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.d-cc-modal__tx--orange { background: rgba(255,149,0,0.1); border-right: 3px solid #FF9500; }
.d-cc-modal__tx--orange .d-cc-modal__tx-desc { color: #FF9500; font-weight: 700; }
.d-cc-modal__tx--red    { background: rgba(255,59,48,0.1);  border-right: 3px solid #FF3B30; }
.d-cc-modal__tx--red .d-cc-modal__tx-desc    { color: #FF3B30; font-weight: 700; }
.d-cc-modal__empty { padding: 24px; text-align: center; color: var(--text-muted,#888); font-size: 13px; }
body.dark-mode .d-cc-modal__box  { background: #1c1c1e; }
body.dark-mode .d-cc-modal__stat { background: #2c2c2e; }
body.dark-mode .d-cc-modal__tx   { background: #2c2c2e; }

/* ── Reversibility: hide old nav ── */
.month-navigator--hidden { display: none !important; }

/* ── Month Wheel ── */
.month-wheel-wrap {
  position: sticky; top: 0; z-index: 49;
  background: var(--bg-secondary);
  border-bottom: 0.5px solid var(--separator);
  height: 44px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
}
.month-wheel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  height: 100%;
  align-items: center;
}
.month-wheel-track::-webkit-scrollbar { display: none; }
.month-wheel-item {
  flex-shrink: 0;
  scroll-snap-align: center;
  padding: 0 22px;
  font-size: 13px; font-weight: 400;
  color: var(--text-muted);
  opacity: 0.35;
  transition: opacity 0.2s, font-size 0.2s, font-weight 0.2s, color 0.2s;
  cursor: pointer; white-space: nowrap; user-select: none; height: 100%;
  display: flex; align-items: center;
}
.month-wheel-item.active {
  font-size: 14px; font-weight: 700;
  opacity: 1; color: var(--text-primary);
}
body.dark-mode .month-wheel-wrap { background: var(--bg-secondary); }
