/* ── MODO OSCURO (clase `dark` en <html>, preferencia por navegador) ──────
   Debe cargarse DESPUÉS de app.generated.css.
   Estrategia: en vez de añadir variantes dark: en cada una de las páginas,
   se remapean bajo `.dark` las utilidades de color que usa el sistema de
   diseño (superficies blancas y slate, textos slate, bordes, tintes -50/-100
   y sus textos). Así todas las pantallas se oscurecen con una sola regla por
   color y el claro queda intacto. Las utilidades con `!` se cubren aparte. */
html.dark { background-color: #0b1220; color-scheme: dark; }
.dark body { background-color: #0b1220; color: #e2e8f0; }

/* Superficies */
.dark .bg-white { background-color: #0f172a; }
.dark .bg-slate-50 { background-color: #162238; }
.dark .bg-slate-50\/50 { background-color: #121c30; }
.dark .bg-slate-100 { background-color: #1e293b; }
.dark .bg-slate-200 { background-color: #334155; }
.dark .bg-slate-900 { background-color: #0ea5e9; }
.dark .hover\:bg-slate-50:hover { background-color: #1e293b; }
.dark .hover\:bg-slate-100:hover { background-color: #283548; }
.dark .hover\:bg-white:hover { background-color: #1e293b; }

/* Textos */
.dark .text-slate-950, .dark .text-slate-900 { color: #f1f5f9; }
.dark .text-slate-800 { color: #e2e8f0; }
.dark .text-slate-700 { color: #cbd5e1; }
.dark .text-slate-600, .dark .text-slate-500 { color: #94a3b8; }
.dark .text-slate-400 { color: #64748b; }
.dark .text-slate-300 { color: #475569; }
.dark .hover\:text-slate-800:hover, .dark .hover\:text-slate-700:hover, .dark .hover\:text-slate-600:hover { color: #f1f5f9; }
.dark .placeholder-slate-400::placeholder, .dark input::placeholder, .dark textarea::placeholder { color: #64748b; }

/* Bordes y divisores */
.dark .border-slate-100 { border-color: #1e293b; }
.dark .border-slate-200 { border-color: #283548; }
.dark .border-slate-300 { border-color: #334155; }
.dark .border-white { border-color: #0f172a; }
.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: #1e293b; }
.dark .divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: #283548; }
.dark .ring-white { --tw-ring-color: #0f172a; }
.dark .ring-offset-2 { --tw-ring-offset-color: #0f172a; }
.dark .ring-black\/5 { --tw-ring-color: rgba(255, 255, 255, 0.06); }

/* Tintes de color (-50 / -100) y sus textos oscuros */
.dark .bg-teal-50 { background-color: rgba(20, 184, 166, 0.12); }
.dark .bg-teal-50\/40, .dark .bg-teal-50\/60 { background-color: rgba(20, 184, 166, 0.08); }
.dark .bg-teal-100 { background-color: rgba(20, 184, 166, 0.22); }
.dark .bg-sky-50 { background-color: rgba(14, 165, 233, 0.12); }
.dark .bg-sky-100 { background-color: rgba(14, 165, 233, 0.22); }
.dark .bg-amber-50 { background-color: rgba(245, 158, 11, 0.12); }
.dark .bg-amber-100 { background-color: rgba(245, 158, 11, 0.22); }
.dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.12); }
.dark .bg-red-100 { background-color: rgba(239, 68, 68, 0.22); }
.dark .bg-emerald-50 { background-color: rgba(16, 185, 129, 0.12); }
.dark .bg-emerald-100 { background-color: rgba(16, 185, 129, 0.22); }
.dark .bg-violet-100 { background-color: rgba(139, 92, 246, 0.22); }
.dark .hover\:bg-teal-100:hover { background-color: rgba(20, 184, 166, 0.3); }
.dark .hover\:bg-red-50:hover { background-color: rgba(239, 68, 68, 0.2); }
.dark .hover\:bg-sky-50:hover { background-color: rgba(14, 165, 233, 0.2); }
.dark .hover\:bg-sky-100:hover { background-color: rgba(14, 165, 233, 0.3); }
.dark .text-teal-950, .dark .text-teal-900 { color: #99f6e4; }
.dark .text-teal-800 { color: #5eead4; }
.dark .text-teal-700, .dark .text-teal-600 { color: #2dd4bf; }
.dark .text-sky-900, .dark .text-sky-800 { color: #7dd3fc; }
.dark .text-sky-700, .dark .text-sky-600 { color: #38bdf8; }
.dark .hover\:text-sky-700:hover { color: #7dd3fc; }
.dark .text-amber-900, .dark .text-amber-800 { color: #fcd34d; }
.dark .text-amber-700, .dark .text-amber-600 { color: #fbbf24; }
.dark .text-red-900, .dark .text-red-800 { color: #fca5a5; }
.dark .text-red-700, .dark .text-red-600 { color: #f87171; }
.dark .text-emerald-800, .dark .text-emerald-700 { color: #6ee7b7; }
.dark .text-emerald-600 { color: #34d399; }
.dark .text-violet-600 { color: #c4b5fd; }
.dark .border-teal-200, .dark .border-teal-300 { border-color: rgba(45, 212, 191, 0.4); }
.dark .border-sky-200, .dark .border-sky-300 { border-color: rgba(56, 189, 248, 0.4); }
.dark .border-amber-200 { border-color: rgba(251, 191, 36, 0.4); }
.dark .border-red-200 { border-color: rgba(248, 113, 113, 0.4); }
.dark .border-emerald-200 { border-color: rgba(52, 211, 153, 0.4); }
.dark .border-red-700 { border-color: #f87171; }
.dark .border-teal-700 { border-color: #0f766e; }

/* Utilidades con `!important` */
.dark .\!text-slate-600 { color: #94a3b8 !important; }
.dark .\!text-slate-700 { color: #cbd5e1 !important; }
.dark .\!text-red-800 { color: #fca5a5 !important; }
.dark .\!text-amber-800 { color: #fcd34d !important; }
.dark .\!text-sky-900 { color: #7dd3fc !important; }
.dark .\!bg-white { background-color: #0f172a !important; }
.dark .\!border-amber-200 { border-color: rgba(251, 191, 36, 0.4) !important; }
.dark .\!border-teal-300 { border-color: rgba(45, 212, 191, 0.4) !important; }
.dark .\!bg-sky-50 { background-color: rgba(14, 165, 233, 0.12) !important; }
.dark .\!text-sky-800 { color: #7dd3fc !important; }
.dark .\!border-sky-400 { border-color: #38bdf8 !important; }

/* Formularios y controles nativos */
.dark .form-input, .dark .form-input-icon, .dark select.form-input, .dark textarea.form-input {
  background-color: #0b1220; border-color: #334155; color: #e2e8f0;
}
.dark input[type="checkbox"], .dark input[type="radio"] { accent-color: #0ea5e9; }
.dark .form-label { color: #cbd5e1; }
.dark .btn-secondary { background-color: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .btn-secondary:hover { background-color: #1e293b; }
.dark .btn-ghost:hover { background-color: #1e293b; }
.dark .btn-inline-ghost { background-color: #0f172a; border-color: #334155; color: #cbd5e1; }
.dark .btn-inline-ghost:hover { background-color: #1e293b; }
.dark .shadow-sm, .dark .shadow, .dark .shadow-lg, .dark .shadow-xl, .dark .shadow-2xl { --tw-shadow-color: rgba(0, 0, 0, 0.45); --tw-shadow: var(--tw-shadow-colored); }

/* Componentes del sistema de diseño que llevan fondo/colores en @apply */
.dark .card, .dark .card-sm, .dark .metric-card, .dark .kpi-card, .dark .filter-bar, .dark .page-guide-panel { background-color: #0f172a; border-color: #283548; }
.dark .helptip > .helptip-pop { background-color: #1e293b; color: #e2e8f0; }
.dark .nav-link-active { background-color: rgba(14, 165, 233, 0.22); color: #7dd3fc; }
.dark .nav-group-btn:hover, .dark .nav-link:hover { background-color: #1e293b; color: #f1f5f9; }
.dark .nav-group-items { border-color: #283548; }
.dark .table-header { color: #94a3b8; }
.dark .table-cell { color: #cbd5e1; }
.dark #blazor-error-ui { background-color: #3b2a07; color: #fcd34d; border-color: #92400e; }

/* Grillas estándar: cabecera y columna fija de acciones */
.dark div:has(> table.min-w-full:not(.sin-acciones)) > table > thead th:last-child { background-color: #162238; }
.dark div:has(> table.min-w-full:not(.sin-acciones)) > table > tbody td:last-child { background-color: #0f172a; }
.dark div:has(> table.min-w-full:not(.sin-acciones)) > table > tbody tr:hover > td:last-child { background-color: #1e293b; }

.dark .badge-success { background-color: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.dark .badge-warning { background-color: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.dark .badge-error   { background-color: rgba(239, 68, 68, 0.20);  color: #fca5a5; }
.dark .badge-info    { background-color: rgba(14, 165, 233, 0.20); color: #7dd3fc; }
.dark .badge-neutral { background-color: #1e293b; color: #cbd5e1; }
.dark .interruptor { background-color: #334155; }
.dark .medidor-pista { stroke: #334155; }
.dark .interruptor.interruptor-on { background-color: #0284c7; }
