/* ==========================================================================
   Unilever RYK Sales Dashboard - Design System & Modern Responsive Styles
   ========================================================================== */

@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');

:root {
  /* Theme: Dark Luxury Obsidian (Default) */
  --bg-app: #080c14;
  --bg-surface: #0d1322;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: rgba(22, 33, 58, 0.88);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-input: rgba(30, 41, 59, 0.75);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(6, 182, 212, 0.5);
  --border-highlight: rgba(255, 255, 255, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Accent Vibrancies */
  --cyan-primary: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --amber-primary: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --rose-primary: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.25);
  --violet-primary: #8b5cf6;
  --violet-glow: rgba(139, 92, 246, 0.25);
  --blue-primary: #3b82f6;

  /* Shadows & Glass */
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 25px rgba(6, 182, 212, 0.2);
  --shadow-glow-emerald: 0 0 25px rgba(16, 185, 129, 0.2);
  --blur-glass: blur(16px);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --bg-input: #f8fafc;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(2, 132, 199, 0.6);
  --border-highlight: rgba(0, 0, 0, 0.12);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --cyan-primary: #0284c7;
  --cyan-glow: rgba(2, 132, 199, 0.2);
  --emerald-primary: #059669;
  --emerald-glow: rgba(5, 150, 105, 0.2);
  --amber-primary: #d97706;
  --amber-glow: rgba(217, 119, 6, 0.2);
  --rose-primary: #e11d48;
  --rose-glow: rgba(225, 29, 72, 0.2);
  --violet-primary: #7c3aed;
  --violet-glow: rgba(124, 58, 237, 0.2);
  --blue-primary: #2563eb;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.07);
  --shadow-glow-cyan: 0 0 20px rgba(2, 132, 199, 0.15);
  --shadow-glow-emerald: 0 0 20px rgba(5, 150, 105, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
}

.app-container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1.25rem 2rem 3rem 2rem;
}

/* ==========================================================================
   1. Header & Navigation Bar
   ========================================================================== */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 1rem;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-container {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
  transition: var(--transition-smooth);
}

[data-theme="light"] .brand-logo-container {
  background: rgba(0, 0, 0, 0.03);
}

.brand-logo-container:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px var(--cyan-glow);
}

.unilever-header-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.brand-info h1 {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
  color: var(--cyan-primary);
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* Button Component System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.05rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-primary), #0284c7);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--cyan-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--cyan-glow);
  filter: brightness(1.1);
}

.btn-success {
  background: linear-gradient(135deg, var(--emerald-primary), #059669);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--emerald-glow);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--emerald-glow);
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981, #047857);
  color: #ffffff;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-emerald:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  filter: brightness(1.1);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.btn-icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Live Data Badge */
.live-dataset-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--emerald-primary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald-primary);
  box-shadow: 0 0 10px var(--emerald-primary);
  animation: pulseAnim 2s infinite ease-in-out;
}

@keyframes pulseAnim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   2. 7-Tier Dynamic Cascading Filter Bar
   ========================================================================== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.filter-group-cascade {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.52rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition-smooth);
  text-overflow: ellipsis;
}

.form-select:focus, .form-input:focus {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 0 2px var(--cyan-glow);
}

.metric-filter-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* Metric Switcher */
.metric-switcher {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.metric-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.metric-btn.active {
  background: var(--cyan-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--cyan-glow);
}

/* ==========================================================================
   3. KPI Summary Cards Grid
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.15rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.15rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--card-accent, var(--cyan-primary)), transparent);
  opacity: 0.8;
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-accent, var(--border-highlight));
  box-shadow: 0 14px 35px -10px rgba(0, 0, 0, 0.6), 0 0 20px var(--card-glow, var(--cyan-glow));
}

.card-cy { --card-accent: var(--cyan-primary); --card-glow: var(--cyan-glow); }
.card-ly { --card-accent: var(--text-dim); --card-glow: rgba(148, 163, 184, 0.2); }
.card-target { --card-accent: var(--amber-primary); --card-glow: var(--amber-glow); }
.card-goly { --card-accent: var(--emerald-primary); --card-glow: var(--emerald-glow); }
.card-lppp { --card-accent: var(--violet-primary); --card-glow: var(--violet-glow); }
.card-growth { --card-accent: var(--blue-primary); --card-glow: rgba(59, 130, 246, 0.25); }
.card-avg-monthly { --card-accent: #f59e0b; --card-glow: rgba(245, 158, 11, 0.25); }
.card-avg-weekly { --card-accent: #ec4899; --card-glow: rgba(236, 72, 153, 0.25); }

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

.kpi-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-accent, var(--cyan-primary));
}

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

.kpi-main-val {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.kpi-unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.kpi-sub-breakdown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-subtle);
}

.kpi-sub-label {
  color: var(--text-dim);
}

.kpi-sub-val {
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.4rem 0;
}

.kpi-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.trend-up {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.trend-down {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-primary);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.trend-neutral {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-primary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.kpi-lppp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-subtle);
}

.kpi-lppp-item {
  display: flex;
  flex-direction: column;
}

.kpi-lppp-item .kpi-sub-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.kpi-lppp-item .kpi-sub-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

/* ==========================================================================
   4. Interactive Leaflet Map Component & Popups
   ========================================================================== */
.map-section-card {
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.map-status-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-primary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Live Map Layer Switcher */
.map-layer-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.map-layer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.map-layer-btn svg,
.map-layer-btn i {
  width: 13px;
  height: 13px;
}

.map-layer-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.map-layer-btn.active {
  background: var(--gradient-accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.35);
}

.map-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.interactive-leaflet-map {
  height: 440px;
  width: 100%;
  background: var(--bg-surface);
  z-index: 10;
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 500;
  display: flex;
  gap: 0.85rem;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  color: var(--text-main);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

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

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

.dot-positive { background-color: var(--emerald-primary); box-shadow: 0 0 8px var(--emerald-primary); }
.dot-negative { background-color: var(--rose-primary); box-shadow: 0 0 8px var(--rose-primary); }
.dot-selected { background-color: var(--cyan-primary); box-shadow: 0 0 8px var(--cyan-primary); }

/* Custom Leaflet Map Pin Styles */
.custom-outlet-pin-wrap {
  background: transparent;
  border: none;
}

.custom-outlet-pin {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pin-core {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
}

.custom-outlet-pin:hover .pin-core {
  transform: scale(1.15);
}

.pin-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  z-index: 1;
  opacity: 0.6;
  animation: markerPulse 2s infinite ease-out;
}

@keyframes markerPulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

.marker-positive .pin-core { background: linear-gradient(135deg, #10b981, #059669); }
.marker-positive .pin-pulse { background: rgba(16, 185, 129, 0.4); }

.marker-negative .pin-core { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.marker-negative .pin-pulse { background: rgba(244, 63, 94, 0.4); }

.marker-selected .pin-core {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border: 2px solid #ffffff;
  transform: scale(1.2);
}
.marker-selected .pin-pulse { background: rgba(6, 182, 212, 0.7); }

/* Custom Popup Card Styles */
.leaflet-popup-content-wrapper {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border-highlight) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6) !important;
  padding: 0 !important;
  backdrop-filter: blur(20px) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-highlight) !important;
}

.outlet-popup-card {
  padding: 1.15rem;
  max-width: 380px;
  font-family: 'Inter', sans-serif;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.4rem;
}

.popup-header-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.popup-outlet-name {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  line-height: 1.2;
}

.popup-distributor-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cyan-primary);
  margin-top: 0.15rem;
}

.popup-location-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* Popup KPI Grid */
.popup-kpis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.popup-kpi-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
}

.kpi-box-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

.kpi-box-val {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
}

.text-positive { color: var(--emerald-primary) !important; }
.text-negative { color: var(--rose-primary) !important; }

/* Popup Top 10 Products Section */
.popup-products-section {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 0.75rem;
}

.popup-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.badge-sub {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.popup-table-scroll {
  max-height: 155px;
  overflow-y: auto;
}

.popup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.popup-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.popup-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.prod-rank {
  font-weight: 700;
  color: var(--text-dim);
  width: 24px;
}

.prod-name {
  display: flex;
  flex-direction: column;
}

.p-title {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.p-brand {
  font-size: 0.65rem;
  color: var(--cyan-primary);
}

.prod-vol {
  color: var(--text-muted);
  white-space: nowrap;
}

.prod-tons {
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
  white-space: nowrap;
}

/* ==========================================================================
   5. AI Executive Insights Banner
   ========================================================================== */
.insights-banner {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.insights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.insights-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.insight-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  transition: var(--transition-smooth);
}

.insight-item:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.insight-item-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.insight-item p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.insight-item p strong {
  color: var(--text-main);
}

/* ==========================================================================
   6. Primary & Secondary Analytics Charts Grid
   ========================================================================== */
.analytics-grid, .charts-row-secondary {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.analytics-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.analytics-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title-group h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.card-title-group p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-wrapper {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ==========================================================================
   7. Tables: Leaderboard & Raw Data Explorer
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.leaderboard-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.leaderboard-table th, .data-table th {
  text-align: left;
  padding: 0.75rem 0.85rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  white-space: nowrap;
}

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

.leaderboard-table td, .data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.leaderboard-table tr:hover td, .data-table tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.badge-bg {
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.15);
  color: var(--violet-primary);
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
}

/* Performance Tiers */
.tier-badge {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.tier-diamond { background: rgba(6, 182, 212, 0.2); color: var(--cyan-primary); border: 1px solid var(--cyan-primary); }
.tier-gold { background: rgba(245, 158, 11, 0.2); color: var(--amber-primary); border: 1px solid var(--amber-primary); }
.tier-silver { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid #cbd5e1; }
.tier-bronze { background: rgba(217, 119, 6, 0.2); color: #f97316; border: 1px solid #f97316; }

.table-bar-bg {
  width: 50px;
  height: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.4rem;
  overflow: hidden;
}

.table-bar-fill {
  height: 100%;
  background: var(--emerald-primary);
}

/* ==========================================================================
   Outlet-wise LPPP Section Layout
   ========================================================================== */
.lppp-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 1.25rem;
  align-items: stretch;
}

.lppp-chart-container, .lppp-table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.lppp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.4rem;
}

.lppp-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lppp-score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.lppp-table th {
  font-size: 0.68rem;
}

.lppp-table td {
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
}

@media (max-width: 1200px) {
  .lppp-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Data Explorer Controls */
.data-table-section {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

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

.table-search-input {
  width: 260px;
}

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

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

/* ==========================================================================
   8. Upload & Excel Parsing Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  transform: translateY(20px) scale(0.95);
  transition: var(--transition-smooth);
}

.modal-backdrop.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.dropzone {
  border: 2px dashed var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-bottom: 1.5rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--cyan-primary);
  background: rgba(6, 182, 212, 0.05);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.dropzone-icon {
  font-size: 2.5rem;
  color: var(--cyan-primary);
  margin-bottom: 0.75rem;
}

.dropzone h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.dropzone p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--cyan-primary);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: var(--text-main);
  box-shadow: var(--shadow-card);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Pulse Dot Green */
.pulse-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseGreen 1.8s infinite;
  display: inline-block;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

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

.spin-animation {
  animation: spin 0.8s linear infinite !important;
}

/* Google Sheets Modal Specific Styles */
.modal-content-lg {
  max-width: 680px;
}

.sheet-connection-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.sheet-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.8rem;
  color: var(--emerald-primary);
  margin-top: 0.85rem;
}

.sheet-status-banner.status-idle {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.sheet-status-banner.status-syncing {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.25);
  color: var(--cyan-primary);
}

.sheet-status-banner.status-error {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--rose-primary);
}

.sheet-guide-section {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.sheet-guide-section h5 {
  font-size: 0.86rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sheet-columns-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.6rem 0;
}

.sheet-col-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: monospace;
  color: var(--cyan-primary);
}

/* ==========================================================================
   9. Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .insights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-group-cascade {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .analytics-grid, .charts-row-secondary {
    grid-template-columns: 1fr;
  }
  .filter-group-cascade {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 0.75rem;
  }

  .header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    position: static;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

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

  .filter-group-cascade {
    grid-template-columns: 1fr;
  }

  .metric-filter-item {
    justify-content: flex-start;
  }

  .table-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .table-search-input {
    width: 100%;
  }

  .interactive-leaflet-map {
    height: 350px;
  }
}
