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

/* --- CSS Variables & Design Tokens (Premium Light Aurora Theme) --- */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(15, 23, 42, 0.06);
  --card-hover-border: rgba(79, 70, 229, 0.3);
  
  --primary: #4f46e5;      /* Indigo 600 */
  --primary-glow: rgba(79, 70, 229, 0.1);
  --secondary: #0d9488;    /* Teal 600 */
  --accent: #e11d48;       /* Rose 600 */
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
  --gradient-accent: linear-gradient(135deg, var(--secondary), var(--accent));
  --gradient-text: linear-gradient(135deg, #1e1b4b 20%, #4f46e5 100%);
  --gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(13, 148, 136, 0.05));

  --font-body: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --sidebar-bg: rgba(255, 255, 255, 0.85);
  --spotlight-card-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* --- Dark Theme Variable Overrides --- */
[data-theme="dark"] {
  --bg-primary: #070913;
  --bg-secondary: #0f1322;
  --bg-tertiary: #191f35;
  
  --card-bg: rgba(15, 19, 34, 0.65);
  --card-border: rgba(255, 255, 255, 0.05);
  --card-hover-border: rgba(79, 70, 229, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --gradient-text: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  --gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(13, 148, 136, 0.15));
  
  --sidebar-bg: rgba(15, 19, 34, 0.95);
  --spotlight-card-bg: linear-gradient(135deg, rgba(15, 19, 34, 0.95), rgba(23, 29, 49, 0.9));
}

/* --- Base & Reset --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) var(--bg-tertiary);
}

/* Prevent subpixel layout clipping on SVG icon strokes */
svg {
  overflow: visible !important;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background-color: var(--bg-primary);
}

/* Aurora background blobs */
body::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: absolute;
  bottom: 10%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.08) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* --- Typography Helpers --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-accent {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Layout Grid --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-item a:hover,
.nav-item.active a {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.04);
}

.nav-item.active a {
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.15);
  font-weight: 600;
}

.nav-item a svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform var(--transition-fast);
}

.nav-item a:hover svg {
  transform: translateX(3px);
}

.main-content {
  flex: 1;
  padding: 2rem 3rem;
  min-width: 0;
}

/* Header & Controls */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.header-title h1 {
  font-size: 2.25rem;
  margin-bottom: 0.25rem;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.global-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  padding: 0.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.control-btn:hover {
  color: var(--text-primary);
}

.control-btn.active {
  background: var(--bg-secondary);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(79, 70, 229, 0.08);
}

/* --- Hero Section & Welcome --- */
.hero-section {
  position: relative;
  background: radial-gradient(100% 100% at 0% 0%, rgba(79, 70, 229, 0.06) 0%, transparent 100%), var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 3rem;
  margin-bottom: 2.5rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.02);
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.hero-content {
  max-width: 820px;
}

.hero-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(79, 70, 229, 0.12);
}

.hero-content h2 {
  font-size: 2.75rem;
  margin-bottom: 1rem;
  line-height: 1.15;
  color: var(--text-primary);
}

.hero-content p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 4rem;
}

.hero-stat-item {
  display: flex;
  flex-direction: column;
}

.hero-stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-display);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* --- Glassmorphism Cards & KPIs --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.kpi-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
}

.kpi-card:hover {
  transform: translateY(-5px);
  border-color: var(--card-hover-border);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.08);
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: rgba(79, 70, 229, 0.05);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.08);
}

.kpi-card:nth-child(2) .kpi-icon { color: var(--accent); background: rgba(225, 29, 72, 0.05); border-color: rgba(225, 29, 72, 0.08); }
.kpi-card:nth-child(3) .kpi-icon { color: var(--secondary); background: rgba(13, 148, 136, 0.05); border-color: rgba(13, 148, 136, 0.08); }
.kpi-card:nth-child(4) .kpi-icon { color: #d97706; background: rgba(217, 119, 6, 0.05); border-color: rgba(217, 119, 6, 0.08); }

.kpi-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.kpi-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kpi-desc span {
  font-weight: 600;
  color: var(--text-secondary);
}

/* --- State Spotlight Explorer Section --- */
.spotlight-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.spotlight-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.02);
}

.spotlight-header {
  margin-bottom: 1.5rem;
}

.spotlight-header h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.spotlight-select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all var(--transition-fast);
}

.spotlight-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.spotlight-kpis {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.spotlight-kpi {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.spotlight-kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.spotlight-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.15rem;
}

.spotlight-card {
  background: var(--spotlight-card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.spotlight-details h3 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.spotlight-details p.meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
}

.spotlight-narrative {
  background: rgba(79, 70, 229, 0.03);
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.5rem;
}

.spotlight-narrative h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.spotlight-narrative p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.policy-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(13, 148, 136, 0.08);
  color: var(--secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(13, 148, 136, 0.12);
  margin-top: 0.5rem;
}

/* --- Section Design --- */
.dashboard-section {
  margin-bottom: 3rem;
  scroll-margin-top: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  display: flex;
  flex-direction: column;
}

.section-title h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-title p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Chart Card & Layout Styles */
.chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  width: 100%;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.02);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.chart-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.chart-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.chart-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chart-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

/* Grid Layout for Multiple Charts */
.chart-grid-2x1 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

/* Heatmap Grid */
.heatmap-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 120px repeat(12, 1fr);
  gap: 6px;
  margin-top: 1rem;
}

.heatmap-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  font-weight: 600;
}

.heatmap-header-cell {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  padding-bottom: 0.5rem;
}

.heatmap-cell {
  aspect-ratio: 1.8 / 1;
  background: var(--bg-tertiary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(0,0,0,0.02);
}

.heatmap-cell:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.heatmap-cell.empty {
  background: rgba(0,0,0,0.02);
  color: var(--text-muted);
  font-weight: 400;
  cursor: default;
}

.heatmap-cell.empty:hover::after {
  display: none;
}

/* Color Ranges for Light Heatmap (Cool to Warm Gradients) */
.h-range-1 { background-color: #f0fdf4; color: #166534; border-color: #dcfce7; }
.h-range-2 { background-color: #f0f9ff; color: #075985; border-color: #e0f2fe; }
.h-range-3 { background-color: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.h-range-4 { background-color: #f5f3ff; color: #5b21b6; border-color: #edd9ff; }
.h-range-5 { background-color: #fff1f2; color: #9f1239; border-color: #ffe4e6; }
.h-range-6 { background-color: #ffe4e6; color: #9f1239; border-color: #fecdd3; font-weight: 800; }

.heatmap-legend {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.05);
}

/* --- Interactive Data Explorer Table --- */
.table-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.02);
}

.table-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.table-search-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  min-width: 260px;
  transition: all var(--transition-fast);
}

.table-search-input:focus {
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--card-border);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  color: var(--primary);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-primary);
}

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

.data-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.02);
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

.page-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Insight Cards --- */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
}

.insight-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
}

.insight-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 70, 229, 0.15);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.06);
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.insight-badge {
  background: rgba(79, 70, 229, 0.06);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.insight-card:nth-child(2) .insight-badge {
  background: rgba(225, 29, 72, 0.06);
  color: var(--accent);
  border: 1px solid rgba(225, 29, 72, 0.1);
}

.insight-card:nth-child(3) .insight-badge {
  background: rgba(13, 148, 136, 0.06);
  color: var(--secondary);
  border: 1px solid rgba(13, 148, 136, 0.1);
}

.insight-card h4 {
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--text-primary);
}

.insight-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Mobile Toggle Menu */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 110;
}

/* Footer styling */
.footer {
  margin-top: 5rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary);
}

/* --- Scroll and Reveal Animations --- */
.reveal {
  position: relative;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive Layout Breakpoints --- */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .insights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .spotlight-grid {
    grid-template-columns: 1fr;
  }
  .spotlight-kpis {
    flex-direction: row;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }
  .spotlight-kpi {
    flex: 1;
    margin-top: 0;
  }
}

@media (max-width: 992px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    width: 100%;
    max-width: 320px;
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.05);
    background: var(--sidebar-bg);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .logo-container {
    margin-left: 3.5rem; /* Shift logo to avoid overlap with hamburger button */
    margin-bottom: 2rem;
  }
  
  .menu-toggle {
    display: block;
    position: fixed;
    top: 1.25rem;
    left: 1.5rem; /* Move toggle button to the left */
    background: var(--bg-secondary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.08);
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 1.5rem;
    padding-top: 5rem; /* Push content down to avoid fixed buttons overlap */
  }
  
  .top-header {
    margin-top: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  
  .global-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .control-btn {
    flex: 1;
    text-align: center;
  }
  
  .chart-grid-2x1 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-title h1 {
    font-size: 1.75rem;
  }
  
  .hero-section {
    padding: 2rem 1.5rem;
  }
  .hero-content h2 {
    font-size: 2rem;
  }
  .hero-stats {
    flex-direction: column;
    gap: 1.25rem;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-card {
    padding: 1.25rem;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .chart-controls {
    width: 100%;
  }
  .chart-select {
    width: 100%;
  }
  
  .heatmap-wrapper {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 0.5rem;
  }
  .heatmap-grid {
    min-width: 780px;
    gap: 5px;
    margin-top: 0.5rem;
  }
  
  .table-header-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-search-input {
    width: 100%;
  }
  
  .insights-grid {
    grid-template-columns: 1fr;
  }
  
  .footer {
    flex-direction: column;
    gap: 1.25rem;
    text-align: center;
  }
}

@media (max-width: 576px) {
  .spotlight-kpis {
    flex-direction: column;
    gap: 0.75rem;
  }
  .table-pagination {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  .pagination-buttons {
    width: 100%;
    justify-content: center;
  }
  .page-btn {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .control-btn {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
  }
  .top-header {
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }
  .hero-section {
    padding: 1.5rem 1rem;
  }
  .hero-content h2 {
    font-size: 1.6rem;
  }
}

/* --- Header Controls Wrapper --- */
.header-controls-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Theme Toggle Button --- */
.theme-toggle-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  overflow: visible;
}

.theme-toggle-btn:hover {
  color: var(--primary);
  border-color: var(--card-hover-border);
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: translateY(-2px);
}

/* Hide sun/moon based on theme */
[data-theme="dark"] .theme-toggle-btn .sun-icon {
  display: block !important;
}
[data-theme="dark"] .theme-toggle-btn .moon-icon {
  display: none !important;
}
.theme-toggle-btn .sun-icon {
  display: none;
}
.theme-toggle-btn .moon-icon {
  display: block;
}

/* --- Chart Header Action Layout --- */
.chart-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Icon Buttons (Download Chart) --- */
.icon-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  overflow: visible;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: var(--card-hover-border);
  box-shadow: 0 4px 10px var(--primary-glow);
  transform: translateY(-2px);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* --- Action Buttons (Export CSV) --- */
.action-btn {
  background: var(--gradient-primary);
  border: none;
  color: white !important;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px var(--primary-glow);
  opacity: 0.95;
}

/* Table controls right layout */
.table-controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Toast Notification Container --- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  border-right: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 1rem 1.5rem;
  border-radius: 4px var(--radius-md) var(--radius-md) 4px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toast-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1), toast-fade-out 0.3s ease 2.7s forwards;
  pointer-events: auto;
  min-width: 280px;
}

.toast.toast-success {
  border-left-color: var(--secondary);
}

.toast.toast-error {
  border-left-color: var(--accent);
}

/* Toast Animations */
@keyframes toast-slide-in {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

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

/* Global Transitions for smooth color changes */
body, aside, main, header, section, div.chart-card, div.kpi-card, div.insight-card, button, select, input, table, th, td {
  transition: background var(--transition-normal), 
              background-color var(--transition-normal), 
              border-color var(--transition-normal), 
              color var(--transition-normal), 
              box-shadow var(--transition-normal);
}

/* Additional responsive rules for header controls wrapper */
@media (max-width: 992px) {
  .header-controls-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
  }
  .global-controls {
    flex: 1;
  }
  .theme-toggle-btn {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 110;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.08);
  }
}

@media (max-width: 768px) {
  .table-controls-right {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.5rem;
  }
  .table-controls-right .chart-controls {
    flex: 1;
  }
  .table-controls-right .chart-select {
    width: 100%;
  }
  .table-controls-right .action-btn {
    flex: 1;
    justify-content: center;
    text-align: center;
  }
}
