/* =========================================================================
   EVF Sales Map Rev 21.0 — Complete Design System
   =========================================================================
   Dark mode glassmorphism. Replicas Rev 18.0 layout with dark theme.
   No framework dependencies — vanilla CSS only (.cursorrules Rule #9).
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. CSS Custom Properties
   ------------------------------------------------------------------------- */
:root {
  --evf-primary: #00d4ff;
  --evf-primary-glow: rgba(0, 212, 255, 0.3);
  --evf-accent: #7c3aed;
  --evf-accent-glow: rgba(124, 58, 237, 0.25);
  --bg-base: #0a0a0f;
  --bg-surface: #12121a;
  --bg-elevated: #1a1a2e;
  --bg-glass: rgba(14, 14, 22, 0.88);
  --text-primary: #e8e8f0;
  --text-secondary: #9494a8;
  --text-muted: #5c5c70;
  --tier-platinum: #2ecc40;
  --tier-gold: #ffdc00;
  --tier-blue: #0074d9;
  --tier-growth: #ff4136;
  --dc-pulse: #00d4ff;
  --glass-blur: 16px;
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font-main: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-normal: 250ms var(--ease-out);
}

/* Light mode overrides */
body.light-mode {
  --bg-base: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-elevated: #e8eaed;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --text-primary: #1a1a2e;
  --text-secondary: #555570;
  --text-muted: #8888a0;
  --evf-primary: #0088cc;
  --evf-primary-glow: rgba(0, 136, 204, 0.2);
  --glass-border: rgba(0, 0, 0, 0.12);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  transition: background var(--transition-fast), transform 0.2s;
  line-height: 1;
}
.theme-toggle:hover {
  background: var(--evf-primary);
  transform: scale(1.1);
}

/* Smooth theme transitions */
body, .sidebar, .sidebar-section, .dropdown-wrapper,
.performance-section, .btn, .territory-btn, .branch-table,
.branch-table th, .branch-table td, .maplibregl-popup-content {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Light mode specific overrides for elements that don't use variables */
body.light-mode .sidebar {
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}
body.light-mode .branch-table th {
  background: #e0e2e6;
  color: #1a1a2e;
}
body.light-mode .branch-table td {
  border-bottom: 1px solid #e0e2e6;
}
body.light-mode .tier-badge {
  color: #fff;
}
body.light-mode .evf-hover-popup .maplibregl-popup-content {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1a1a2e !important;
}
body.light-mode .evf-hover-popup .maplibregl-popup-content * {
  color: #1a1a2e !important;
}

/* -------------------------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------
   3. Map Container
   ------------------------------------------------------------------------- */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* -------------------------------------------------------------------------
   4. MapLibre Overrides
   ------------------------------------------------------------------------- */
.maplibregl-popup-content {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(var(--glass-blur)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur)) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--glass-shadow) !important;
  color: var(--text-primary) !important;
  padding: 14px !important;
  font-family: var(--font-main) !important;
  min-width: 240px;
}
.maplibregl-popup-close-button {
  color: var(--text-secondary) !important;
  font-size: 18px;
  padding: 4px 8px;
}
.maplibregl-popup-close-button:hover {
  color: var(--evf-primary) !important;
  background: transparent !important;
}
.maplibregl-popup-tip {
  border-top-color: var(--bg-glass) !important;
}
.maplibregl-ctrl-group {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(var(--glass-blur)) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--glass-shadow) !important;
}
.maplibregl-ctrl-group button {
  background: transparent !important;
  color: var(--text-primary) !important;
}
.maplibregl-ctrl-group button:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}

/* Hover popup (company name + purple badge) */
.evf-hover-popup .maplibregl-popup-content {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #333 !important;
  padding: 8px 12px !important;
  min-width: auto;
  border-radius: 6px !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: none !important;
}
.evf-hover-popup .maplibregl-popup-tip {
  border-top-color: rgba(255, 255, 255, 0.95) !important;
}

/* -------------------------------------------------------------------------
   5. Glassmorphism Utilities
   ------------------------------------------------------------------------- */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  padding: 20px;
}

/* -------------------------------------------------------------------------
   6. RIGHT FILTER PANEL (Accordion Container)
   ------------------------------------------------------------------------- */
#filter-container {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 280px;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  z-index: 1100;
  font-size: 12px;
}

/* Accordion */
.accordion-section {
  border-bottom: 1px solid var(--glass-border);
}
.accordion-header {
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.accordion-header:hover {
  background: rgba(255, 255, 255, 0.03);
}
.accordion-header.active {
  background: rgba(0, 212, 255, 0.05);
  border-bottom: 1px solid var(--glass-border);
}
.accordion-content {
  display: none;
  padding: 12px 14px;
}
.accordion-content.open {
  display: block;
}
.toggle-icon {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

/* Control groups */
.control-group {
  margin-bottom: 10px;
}
.control-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Section title */
.section-title {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}

/* Badge count */
.badge-count {
  background: rgba(0, 212, 255, 0.15);
  color: var(--evf-primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

/* -------------------------------------------------------------------------
   7. MULTI-SELECT DROPDOWNS
   ------------------------------------------------------------------------- */
.dropdown-check-list {
  display: inline-block;
  width: 100%;
  position: relative;
}
.dropdown-check-list .anchor {
  position: relative;
  cursor: pointer;
  display: block;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.dropdown-check-list .anchor:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}
.dropdown-check-list .anchor::after {
  content: "";
  border-left: 2px solid var(--text-muted);
  border-top: 2px solid var(--text-muted);
  padding: 3px;
  right: 10px;
  top: 30%;
  position: absolute;
  transform: rotate(-135deg);
}
.dropdown-check-list ul.items {
  padding: 8px;
  display: none;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  position: absolute;
  width: 100%;
  background: var(--bg-elevated);
  z-index: 2000;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.dropdown-check-list ul.items li {
  list-style: none;
  margin-bottom: 2px;
  font-size: 12px;
}
.dropdown-check-list ul.items li label {
  color: var(--text-primary);
}
.dropdown-check-list ul.items li label:hover {
  color: var(--evf-primary);
}
.dropdown-check-list.visible .items {
  display: block;
}

/* -------------------------------------------------------------------------
   8. PROXIMITY SLIDER
   ------------------------------------------------------------------------- */
.prox-slider {
  width: 100%;
  cursor: pointer;
  padding: 0 !important;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--evf-primary), var(--tier-growth));
  outline: none;
}
.prox-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--evf-primary);
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 0 8px var(--evf-primary-glow);
}
.prox-ticks {
  position: relative;
  height: 15px;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
}
.prox-ticks span {
  position: absolute;
  transform: translateX(-50%);
}

/* -------------------------------------------------------------------------
   9. PERFORMANCE BREAKDOWN (Tier Legend)
   ------------------------------------------------------------------------- */
.legend-card {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  margin-top: 10px;
}
.legend-title {
  margin: 0 0 6px 0;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
}
.tier-input-label {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}
.tier-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-align: center;
  transition: all var(--transition-fast);
}
.tier-input:focus {
  border-color: var(--evf-primary);
  box-shadow: 0 0 8px var(--evf-primary-glow);
  outline: none;
}

.legend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}
.legend-table thead tr {
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}
.legend-table th {
  padding: 4px;
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
}
.legend-table td {
  padding: 6px 4px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.legend-table td:nth-child(3),
.legend-table td:nth-child(4) {
  font-family: var(--font-mono);
  font-size: 10px;
}
.legend-table th:nth-child(1) {
  width: 22px;
}
.legend-table th:nth-child(2) {
  width: 44px;
}
.legend-table th:nth-child(3) {
  width: auto;
}
.legend-table th:nth-child(4) {
  width: 70px;
}

.legend-row {
  cursor: pointer;
  transition: all var(--transition-fast);
}
.legend-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.color-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.color-circle:hover {
  transform: scale(1.3);
}
.dot-green {
  background-color: var(--tier-platinum);
}
.dot-blue {
  background-color: var(--tier-blue);
}
.dot-orange {
  background-color: var(--tier-gold);
}
.dot-red {
  background-color: var(--tier-growth);
}

/* -------------------------------------------------------------------------
   10. TERRITORY BUTTONS
   ------------------------------------------------------------------------- */
.territory-btn {
  flex: 1;
  font-weight: 700;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.territory-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-jn.active {
  background: #0073e6 !important;
  color: #fff !important;
  border-color: #0073e6;
}
.btn-jp.active {
  background: #004080 !important;
  color: #fff !important;
  border-color: #004080;
}
.btn-mc.active {
  background: #66b3ff !important;
  color: #fff !important;
  border-color: #66b3ff;
}

/* -------------------------------------------------------------------------
   11. ACTION BUTTONS
   ------------------------------------------------------------------------- */
.btn-action {
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-purple-dark {
  background: rgba(111, 66, 193, 0.15);
  color: #b388ff;
  border-color: rgba(111, 66, 193, 0.3);
}
.btn-purple-dark:hover {
  background: rgba(111, 66, 193, 0.3);
}
.btn-purple-dark.active {
  background: #6f42c1;
  color: #fff;
}
.btn-blue-dark {
  background: rgba(0, 116, 217, 0.15);
  color: #64b5f6;
  border-color: rgba(0, 116, 217, 0.3);
}
.btn-blue-dark:hover {
  background: rgba(0, 116, 217, 0.3);
}
.btn-yellow-dark {
  background: rgba(255, 193, 7, 0.15);
  color: #ffd740;
  border-color: rgba(255, 193, 7, 0.3);
}
.btn-yellow-dark:hover {
  background: rgba(255, 193, 7, 0.3);
}
.btn-green-dark {
  background: rgba(46, 204, 64, 0.15);
  color: #69f0ae;
  border-color: rgba(46, 204, 64, 0.3);
}
.btn-green-dark:hover {
  background: rgba(46, 204, 64, 0.3);
}

/* Filter action buttons (in sales panel header) */
.btn-filter-action {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-filter-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

/* Column toggle pills */
.col-toggle-btn {
  padding: 2px 8px;
  font-size: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.col-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.col-toggle-btn.active {
  background: var(--evf-primary);
  color: #000;
  border-color: var(--evf-primary);
}

/* Elite buttons */
.elite-btn {
  background: rgba(255, 215, 0, 0.08) !important;
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.2);
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 11px;
}
.elite-btn:hover {
  background: rgba(255, 215, 0, 0.15) !important;
}
.elite-btn.active {
  background: #ffd700 !important;
  color: #000 !important;
  border-color: #e6c200;
}

/* Filter input (for categories panel) */
.filter-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.filter-input:focus {
  border-color: var(--evf-primary);
  box-shadow: 0 0 8px var(--evf-primary-glow);
  outline: none;
}
.filter-input::placeholder {
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------
   12. BOTTOM CONTROLS (Pill Group)
   ------------------------------------------------------------------------- */
.bottom-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  z-index: 1000;
  box-shadow: var(--glass-shadow);
  border-radius: 30px;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}
#btn-view-data {
  border-radius: 30px 0 0 30px;
  border: none;
  border-right: 1px solid var(--glass-border);
  background: transparent;
  padding: 10px 15px;
  font-weight: 700;
  color: var(--evf-primary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: var(--font-main);
}
#btn-view-data:hover {
  background: rgba(255, 255, 255, 0.05);
}
#btn-multi-toggle {
  border-radius: 0 30px 30px 0;
  border: none;
  background: transparent;
  padding: 10px 15px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--font-main);
}
#btn-multi-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}
#btn-multi-toggle.active {
  background: rgba(0, 212, 255, 0.15);
  color: var(--evf-primary);
}

/* -------------------------------------------------------------------------
   13. FLOATING SALES DATA PANEL
   ------------------------------------------------------------------------- */
#sales-panel-card {
  position: absolute;
  bottom: 70px;
  left: -55vw;
  width: 50vw;
  max-height: 60vh;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  z-index: 2000;
  transition: left 0.3s var(--ease-out);
  display: flex;
  flex-direction: column;
}
#sales-panel-card.open {
  left: 20px;
}

.panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
}
.panel-body {
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.sales-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sales-table th {
  text-align: left;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--glass-border);
}
.sales-table th:hover {
  color: var(--evf-primary);
}
.sales-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}
.sales-table tr:hover {
  background: rgba(0, 212, 255, 0.05);
}
.sales-table tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* -------------------------------------------------------------------------
   14. INFO PANEL (Top-Left)
   ------------------------------------------------------------------------- */
#info-panel {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 320px;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  z-index: 1100;
  font-family: var(--font-main);
}

/* -------------------------------------------------------------------------
   15. MODAL OVERLAY
   ------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  backdrop-filter: blur(4px);
}
.rep-modal {
  max-width: 450px;
  width: 90%;
}

/* -------------------------------------------------------------------------
   16. THRESHOLD NOTIFICATION
   ------------------------------------------------------------------------- */
#threshold-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 10px 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  box-shadow: var(--glass-shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 100;
}
#threshold-msg.visible {
  opacity: 1;
}

/* -------------------------------------------------------------------------
   17. LOADING OVERLAY
   ------------------------------------------------------------------------- */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
#loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--bg-elevated);
  border-top: 3px solid var(--evf-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-text {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

/* -------------------------------------------------------------------------
   18. DC PULSE ANIMATION
   ------------------------------------------------------------------------- */
@keyframes dc-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(0, 212, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
  }
}

/* -------------------------------------------------------------------------
   19. SCROLLBAR
   ------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* -------------------------------------------------------------------------
   20. RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
  #filter-container {
    width: 240px;
    font-size: 11px;
  }
  #sales-panel-card {
    width: 85vw;
  }
  #sales-panel-card.open {
    left: 10px;
  }
}
