:root {
  /* --- DESIGN TOKENS (Light Mode) --- */
  --bg-app:         #EEF2F7;
  --bg-surface:     #FFFFFF;
  --bg-elevated:    #F8FAFC;
  --bg-sidebar:     #F4F6FA;
  --bg-input:       #FAFBFC;

  --glass-surface:       rgba(255, 255, 255, 0.72);
  --glass-surface-hover: rgba(241, 245, 249, 0.92);
  --glass-border:        rgba(213, 221, 232, 1);

  --text-primary:   #0D1526;
  --text-secondary: #44556B;
  --text-tertiary:  #8B9BB2;
  --text-muted:     #C4CDD9;
  --text-inverse:   #FFFFFF;

  --primary-600:    #4F46E5;
  --primary-hover:  #4338CA;
  --primary-subtle: #EEF2FF;

  --color-success: #0EA569;
  --color-warning: #E8930A;
  --color-danger:  #E53E5C;
  --color-info:    #2B7FE8;
  --rose-500:      #E53E5C;

  --border-default: rgba(213, 221, 232, 1);
  --border-strong:  rgba(180, 192, 207, 1);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);

  --aurora-1: #DDE5FF;
  --aurora-2: #F5E8FF;
  --aurora-3: #D1F5EA;
}

.dark {
  --bg-app:         #0B1120;
  --bg-surface:     #161F2E;
  --bg-elevated:    #1E2B3F;
  --bg-sidebar:     #111827;
  --bg-input:       #1A2336;

  --glass-surface:       rgba(22, 31, 46, 0.82);
  --glass-surface-hover: rgba(40, 55, 78, 0.92);
  --glass-border:        rgba(45, 60, 82, 1);

  --text-primary:   #EEF2F8;
  --text-secondary: #8EA4BF;
  --text-tertiary:  #516278;
  --text-muted:     #364559;
  --text-inverse:   #0D1526;

  --primary-600:    #6366F1;
  --primary-hover:  #818CF8;
  --primary-subtle: #1E1B4B;

  --color-success: #34D399;
  --color-warning: #FBBF24;
  --color-danger:  #FB7185;
  --color-info:    #60A5FA;
  --rose-500:      #FB7185;

  --border-default: rgba(45, 60, 82, 1);
  --border-strong:  rgba(65, 85, 110, 1);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.30), 0 2px 4px rgba(0,0,0,0.15);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.40), 0 4px 8px rgba(0,0,0,0.20);

  --aurora-1: #1e1b4b;
  --aurora-2: #312e81;
  --aurora-3: #0f172a;
}

/* --- CORE LAYOUT --- */
@media print {
  body { font-family: 'Noto Serif', 'Times New Roman', Times, serif !important; background: #fff !important; overflow: auto !important; }
  .print\:hidden { display: none !important; }
}
html, body {
  height: 100%;
  width: 100%;
  margin: 0; padding: 0;
  overflow: hidden;
  font-family: var(--custom-font, 'Inter', sans-serif);
  font-size: var(--custom-font-size, 15px);
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- OPTIMIZED AURORA BACKGROUND (GPU Accelerated) --- */
#app-background {
  position: fixed;
  inset: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at center, transparent 0%, var(--bg-app) 70%),
              conic-gradient(from 0deg at 50% 50%, var(--aurora-1), var(--aurora-2), var(--aurora-3), var(--aurora-1));
  filter: blur(80px);
  opacity: 0.4;
  z-index: -1;
  animation: aurora-spin 60s linear infinite;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
}

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

/* --- UTILITIES — hide all scrollbars globally --- */
*, *::before, *::after { -ms-overflow-style: none; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.glass-card {
  background: var(--glass-surface);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

/* --- COMPACT BUTTON SYSTEM --- */
.card-surface {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}
.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-md);
}

.animate-enter { animation: soft-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes soft-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* --- ENHANCED LOADER --- */
.initial-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 24px;
  color: var(--text-secondary);
  z-index: 50;
  position: relative;
}
.loader-logo {
  width: 64px; height: 64px;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: breathe 2s infinite ease-in-out;
}
.loader-bar {
  width: 120px;
  height: 4px;
  background: rgba(125,125,125,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.loader-progress {
  height: 100%;
  width: 50%;
  background: var(--primary-600);
  border-radius: 2px;
  animation: progress 1.5s infinite ease-in-out;
}
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }

/* --- ENTERPRISE MAP OVERRIDES (White Labeling & Fixes) --- */
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.7) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border-radius: 12px !important;
  padding: 2px 8px !important;
  margin: 0 8px 8px 0 !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 9px !important;
  color: #94a3b8 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
  border: 1px solid rgba(255,255,255,0.5) !important;
  pointer-events: auto !important;
  z-index: 500 !important;
}
.leaflet-control-attribution a {
  color: #64748b !important;
  text-decoration: none !important;
  font-weight: 600 !important;
}
.leaflet-control-zoom { display: none !important; }
.leaflet-container {
  background: #e2e8f0;
}

/* --- CUSTOM PIN FIX --- */
.custom-map-pin,
.custom-map-pin-container {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}
.leaflet-marker-icon.custom-map-pin-container {
  overflow: visible !important;
}

/* --- LANDING PAGE ANIMATIONS --- */
@keyframes scroll-x {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.animate-scroll-x {
  animation: scroll-x 25s linear infinite;
  width: max-content;
}
.mask-linear-fade {
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}
@keyframes blink { 50% { opacity: 0; } }
.animate-blink { animation: blink 1s step-end infinite; }

/* --- SKELETON LOADER TEXT --- */
.loader-status-text {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.5;
}

/* --- NOSCRIPT FALLBACK --- */
.noscript-wrapper {
  padding: 40px;
  text-align: center;
  color: var(--text-primary);
}
.noscript-wrapper h2 {
  font-weight: 800;
  margin-bottom: 10px;
}

/* --- MARKDOWN STYLES --- */
.markdown-body {
  font-family: inherit;
}
.markdown-body p { margin-bottom: 0.75em; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }
.markdown-body ul { list-style-type: disc; padding-left: 1.5em; margin-bottom: 0.75em; }
.markdown-body ol { list-style-type: decimal; padding-left: 1.5em; margin-bottom: 0.75em; }
.markdown-body li { margin-bottom: 0.25em; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { font-weight: 700; margin-top: 1em; margin-bottom: 0.5em; }
.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.25em; }
.markdown-body h3 { font-size: 1.125em; }
.markdown-body code { background-color: rgba(0,0,0,0.05); padding: 0.1em 0.3em; border-radius: 0.25em; font-family: var(--font-mono); font-size: 0.9em; }
.dark .markdown-body code { background-color: rgba(255,255,255,0.1); }
.markdown-body pre { background-color: rgba(0,0,0,0.05); padding: 0.75em; border-radius: 0.5em; overflow-x: auto; margin-bottom: 0.75em; }
.dark .markdown-body pre { background-color: rgba(255,255,255,0.05); }
.markdown-body pre code { background-color: transparent; padding: 0; }
.markdown-body blockquote { border-left: 3px solid rgba(0,0,0,0.1); padding-left: 1em; margin-left: 0; color: var(--text-secondary); font-style: italic; }
.dark .markdown-body blockquote { border-left-color: rgba(255,255,255,0.1); }
.markdown-body a { color: var(--primary-600); text-decoration: underline; text-underline-offset: 2px; }
