/* ==========================================================================
   NexusHub Dark Theme Base Layer
   Scoped strictly to html.dark so light mode remains untouched.
   ========================================================================== */

html.dark {
    color-scheme: dark;
}

html.dark body {
    background-color: #090d16;
    color: #e2e8f0;
}

/* Primary Surfaces */
html.dark .bg-white,
html.dark .bg-white\/80,
html.dark .bg-white\/90,
html.dark .bg-white\/95 {
    background-color: #0f172a;
}

html.dark .bg-gray-50,
html.dark .bg-gray-50\/90,
html.dark .bg-gray-50\/80,
html.dark .bg-gray-50\/70,
html.dark .bg-gray-50\/60,
html.dark .bg-gray-50\/50,
html.dark .bg-gray-50\/40,
html.dark .bg-gray-50\/30 {
    background-color: #131c2e;
}

html.dark .bg-gray-100,
html.dark .bg-gray-100\/80 {
    background-color: #1e293b;
}

html.dark .bg-gray-200,
html.dark .bg-gray-200\/80 {
    background-color: #1e293b;
}

/* Active dark cards & progress bars vs primary CTAs */
html.dark .bg-gray-900 {
    background-color: #1e293b;
    border-color: #334155;
}

html.dark button.dash-fuel-btn.bg-gray-900,
html.dark button.benchmark-btn.bg-gray-900 {
    background-color: #223047;
    color: #f8fafc;
}

html.dark .bg-gray-900 .text-gray-300 {
    color: #cbd5e1;
}

html.dark .bg-gray-100 > .bg-gray-900 {
    background-color: #e2e8f0;
}

html.dark button.bg-gray-900:not(.dash-fuel-btn):not(.benchmark-btn),
html.dark a.bg-gray-900 {
    background-color: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

html.dark button.bg-gray-900:not(.dash-fuel-btn):not(.benchmark-btn):hover,
html.dark a.bg-gray-900:hover {
    background-color: #4338ca;
}

/* Borders & Dividers */
html.dark .border-gray-200,
html.dark .sm\:border-gray-200,
html.dark .border-gray-200\/50,
html.dark .border-gray-200\/60,
html.dark .border-gray-200\/70,
html.dark .border-gray-200\/80,
html.dark .border-gray-300,
html.dark .sm\:hover\:border-gray-300:hover {
    border-color: #1e293b;
}

html.dark #header-search-btn {
    background-color: #131b2c;
    border-color: #1e293b;
}

html.dark #header-search-btn:hover {
    background-color: #1a263b;
    border-color: #334155;
    color: #cbd5e1;
}

html.dark .border-gray-100,
html.dark .border-gray-100\/50,
html.dark .border-gray-100\/60,
html.dark .border-gray-100\/70,
html.dark .border-gray-100\/80 {
    border-color: #172033;
}

html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: #1e293b;
}

/* Typography */
html.dark .text-gray-900,
html.dark .text-gray-800 {
    color: #f1f5f9;
}

html.dark .text-gray-700,
html.dark .text-gray-600 {
    color: #cbd5e1;
}

html.dark .text-gray-500 {
    color: #94a3b8;
}

html.dark .text-gray-400 {
    color: #8494aa;
}

html.dark .text-gray-300 {
    color: #475569;
}

/* Hover States */
html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-gray-50\/50:hover,
html.dark .hover\:bg-gray-50\/60:hover,
html.dark .hover\:bg-gray-50\/70:hover,
html.dark .hover\:bg-gray-50\/80:hover {
    background-color: #1a263b;
}

html.dark .hover\:bg-gray-100:hover,
html.dark .hover\:bg-gray-100\/80:hover {
    background-color: #243247;
}

html.dark .hover\:text-gray-900:hover {
    color: #f8fafc;
}

/* Form Controls */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
    background-color: #0b1220;
    border-color: #283548;
    color: #f1f5f9;
}

html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(#command-palette-input):focus,
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(#command-palette-input):focus-visible,
html.dark select:focus,
html.dark select:focus-visible,
html.dark textarea:focus,
html.dark textarea:focus-visible {
    outline: none !important;
    border-color: #64748b !important;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.22) !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #64748b;
}

/* Semantic Soft Badges & Threshold Wells */
html.dark .bg-emerald-50,
html.dark .bg-emerald-50\/50 {
    background-color: rgba(16, 185, 129, 0.14);
}
html.dark .border-emerald-100,
html.dark .border-emerald-200,
html.dark .border-emerald-200\/60 {
    border-color: rgba(16, 185, 129, 0.3);
}
html.dark .text-emerald-700,
html.dark .text-emerald-600 {
    color: #34d399;
}

html.dark .bg-amber-50,
html.dark .bg-amber-50\/50 {
    background-color: rgba(245, 158, 11, 0.14);
}
html.dark .border-amber-100,
html.dark .border-amber-200 {
    border-color: rgba(245, 158, 11, 0.3);
}
html.dark .text-amber-700,
html.dark .text-amber-600 {
    color: #fbbf24;
}

html.dark .bg-red-50,
html.dark .bg-red-50\/50,
html.dark .bg-rose-50 {
    background-color: rgba(239, 68, 68, 0.14);
}
html.dark .border-red-100,
html.dark .border-red-200,
html.dark .border-red-200\/60 {
    border-color: rgba(239, 68, 68, 0.3);
}
html.dark .text-red-700,
html.dark .text-red-600,
html.dark .text-rose-600 {
    color: #f87171;
}

html.dark .bg-indigo-50,
html.dark .bg-indigo-50\/70,
html.dark .bg-indigo-50\/60,
html.dark .bg-indigo-50\/40,
html.dark .bg-indigo-50\/30,
html.dark .bg-indigo-50\/25,
html.dark .bg-indigo-50\/20 {
    background-color: rgba(99, 102, 241, 0.16);
}
html.dark .hover\:bg-indigo-100:hover,
html.dark .hover\:bg-indigo-50\/30:hover,
html.dark .hover\:bg-indigo-50\/40:hover {
    background-color: rgba(99, 102, 241, 0.24);
}
html.dark .border-indigo-100,
html.dark .border-indigo-200,
html.dark .border-indigo-200\/80,
html.dark .border-indigo-200\/70 {
    border-color: rgba(99, 102, 241, 0.32);
}
html.dark .text-indigo-700,
html.dark .text-indigo-600 {
    color: #818cf8;
}

/* Command Palette */
html.dark #command-palette-overlay {
    background-color: rgba(2, 6, 23, 0.72);
}

html.dark #command-palette-container {
    background: #0f172a;
    border-color: #1e293b;
    color: #f1f5f9;
}

html.dark #command-palette-input-container {
    border-bottom-color: #1e293b;
}

html.dark #command-palette-input {
    background: transparent;
    color: #f1f5f9;
}

html.dark #command-palette-input::placeholder {
    color: #64748b;
}

html.dark .command-item.active {
    background-color: #1e293b;
}

html.dark .command-item:hover {
    background-color: #162032;
}

html.dark .command-icon-container {
    background-color: #1e293b;
    color: #94a3b8;
}

html.dark .command-item.active .command-icon-container {
    background-color: #4f46e5;
    color: #ffffff;
}

html.dark .command-title {
    color: #f1f5f9;
}

html.dark .command-subtitle {
    color: #94a3b8;
}

html.dark .category-label {
    color: #64748b;
}

html.dark .cp-clear-recents-btn:hover {
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.14);
}

html.dark #command-palette-footer {
    background-color: #131c2e;
    border-top-color: #1e293b;
    color: #94a3b8;
}

html.dark .kbd-hint {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

html.dark #command-palette-context-pill {
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
}

html.dark #command-palette-results::-webkit-scrollbar-thumb {
    background: #334155;
}

/* Leaflet Map Dark Tiles */
html.dark .leaflet-tile-pane {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
html.dark .tactical-dark-native .leaflet-tile-pane {
    filter: none !important;
}
