/* ═══════════════════════════════════════════════════
   BanqueViz — Design System
   Dark mode · Glassmorphism · Premium aesthetics
   ═══════════════════════════════════════════════════ */

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

/* ─── CSS Variables ─────────────────────────────── */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(20, 20, 50, 0.6);
  --bg-card-hover: rgba(30, 30, 70, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-border: rgba(255, 255, 255, 0.08);
  
  --text-primary: #e8e8f0;
  --text-secondary: #9898b8;
  --text-muted: #6868a0;
  --text-accent: #a78bfa;
  
  --accent-primary: #7c3aed;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --accent-gradient-hover: linear-gradient(135deg, #8b5cf6 0%, #22d3ee 100%);
  
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(124, 58, 237, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.5);
}

/* ─── Layout ────────────────────────────────────── */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Range Slider ──────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.threshold-control {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-glass-border);
}

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

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.app-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: -2px;
}

/* ─── Navigation ────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 4px;
}

.nav-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.nav-tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.nav-tab-icon {
  font-size: 1rem;
}

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: rgba(124, 58, 237, 0.15);
  box-shadow: var(--shadow-glow);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1.1rem;
}

/* ─── KPI Cards ─────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.kpi-card:hover::before {
  opacity: 1;
}

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

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-value.positive {
  color: var(--green);
}

.kpi-value.negative {
  color: var(--red);
}

.kpi-value.neutral {
  color: var(--text-primary);
}

.kpi-change {
  font-size: 0.75rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-change.up {
  color: var(--red);
}

.kpi-change.down {
  color: var(--green);
}

/* ─── Charts Grid ───────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.charts-grid .card.full-width {
  grid-column: 1 / -1;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
}

.chart-container.small {
  height: 250px;
}

/* ─── Tab Content ───────────────────────────────── */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* ─── Transactions Table ────────────────────────── */
.table-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  padding-left: 40px;
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  transition: all var(--transition-normal);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
}

.filter-select {
  padding: 10px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  appearance: none;
  min-width: 160px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.filter-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.tx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.tx-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--bg-glass-border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.tx-table thead th:hover {
  color: var(--text-primary);
}

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

.tx-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.05);
}

.tx-table tbody td {
  padding: 12px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.tx-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tx-amount.debit {
  color: var(--red);
}

.tx-amount.credit {
  color: var(--green);
}

.tx-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tx-category-badge:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--accent-primary);
}

.tx-date {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.tx-label {
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

.pagination-btn {
  padding: 8px 16px;
  border: 1px solid var(--bg-glass-border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── Insight Cards ─────────────────────────────── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.insight-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
}

.insight-card:hover {
  border-color: rgba(124, 58, 237, 0.2);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.insight-icon {
  font-size: 1.3rem;
}

.insight-title {
  font-size: 1rem;
  font-weight: 600;
}

.insight-list {
  list-style: none;
}

.insight-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}

.insight-list li:last-child {
  border-bottom: none;
}

.insight-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.insight-name {
  flex: 1;
  margin-left: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: 10px;
  white-space: nowrap;
}

.insight-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.insight-stat {
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.insight-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.insight-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ─── Category Management ───────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.category-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-chip:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 58, 237, 0.2);
  transform: translateY(-1px);
}

.category-chip.active {
  border-color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.1);
}

.category-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-chip-name {
  font-size: 0.8rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chip-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── Period Selector ───────────────────────────── */
.period-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.period-btn {
  padding: 8px 16px;
  border: 1px solid var(--bg-glass-border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

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

/* ─── Loading & Empty States ────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-glass-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ─── Category Donut Legend ──────────────────────── */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  cursor: pointer;
}

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

.donut-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-legend-value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.donut-legend-pct {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 36px;
  text-align: right;
}

/* ─── Trend change badge ────────────────────────── */
.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.trend-badge.up {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.trend-badge.down {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

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

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

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-glass);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--red);
  color: white;
}

.modal-category-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-category-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
  text-align: left;
}

.modal-category-option:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent-primary);
}

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-tab span:not(.nav-tab-icon) {
    display: none;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .insights-grid {
    grid-template-columns: 1fr;
  }
  
  .app-header {
    flex-direction: column;
    gap: 16px;
  }
}

@media (max-width: 600px) {
  html {
    font-size: 14px;
  }
  
  .app-container {
    padding: 0 12px;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .table-controls {
    flex-direction: column;
  }
  
  .search-wrapper, .filter-select {
    width: 100%;
  }
}

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(20, 20, 45, 0.95);
  border: 1px solid rgba(124, 58, 237, 0.5);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(124, 58, 237, 0.3);
  backdrop-filter: blur(12px);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ─── Category Isolation & Toolbar ────────────────────────────── */
.category-isolate-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.isolate-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.isolate-btn:hover {
  background: rgba(124, 58, 237, 0.2);
  color: var(--text-primary);
}

.isolate-btn.active {
  background: var(--accent-purple);
  color: #ffffff;
  border-color: var(--accent-purple);
  box-shadow: var(--glow-purple);
}

.small-select {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 20px;
}

.search-input.small {
  padding: 6px 12px;
  font-size: 0.8rem;
  width: 200px;
}

.category-pills-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 8px;
  scrollbar-width: thin;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.category-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.category-pill.active {
  background: var(--pill-bg, var(--accent-purple));
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

/* ─── Month Explorer / Vue Mensuelle ───────────────────────────── */
.month-selector-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.month-nav-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.month-nav-btn:hover:not(:disabled) {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  box-shadow: var(--glow-purple);
}

.month-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.month-select-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--accent-purple-glow);
  padding: 6px 16px;
  border-radius: 24px;
}

.month-icon {
  font-size: 1.2rem;
}

.month-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.month-select option {
  background: #141428;
  color: var(--text-primary);
}

/* ─── Cost Cutting & Monthly Breakdown Grids ───────────────────── */
.cost-cut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.cost-cut-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.cost-cut-card:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.cost-cut-card.surge {
  border-left: 4px solid var(--accent-pink);
}

.cost-cut-card.discretionary {
  border-left: 4px solid #f59e0b;
}

.cost-cut-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cost-cut-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.surge-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 700;
}

.surge-badge.danger {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.surge-badge.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.surge-badge.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

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

.monthly-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.monthly-cat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.monthly-cat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: var(--shadow-sm);
}

.monthly-cat-card.selected {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.15);
}

.monthly-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.monthly-cat-name {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.monthly-cat-amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.monthly-progress-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.monthly-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.mom-badge {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mom-badge.up {
  color: #f87171;
}

.mom-badge.down {
  color: #4ade80;
}


