/* ============================================================================
   Sistema Global de Temas iQuántica: Modo Oscuro (por defecto) y Modo Claro
   Cobertura completa de contraste WCAG AA/AAA para todas las vistas y estados.
   ============================================================================ */

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

/* ============================================================================
   1. FONDOS ESTRUCTURALES NEUTROS (SLATE) EN MODO CLARO
   ============================================================================ */
html[data-theme="light"],
html[data-theme="light"] body.bg-slate-950,
html[data-theme="light"] .bg-slate-950 {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

html[data-theme="light"] .bg-slate-950\/40,
html[data-theme="light"] .bg-slate-950\/50,
html[data-theme="light"] .bg-slate-950\/60,
html[data-theme="light"] .bg-slate-950\/70,
html[data-theme="light"] .bg-slate-950\/80 {
    background-color: #f8fafc !important;
}

html[data-theme="light"] #sidebarBackdrop,
html[data-theme="light"] .modal-cdoc-backdrop {
    background-color: rgba(15, 23, 42, 0.55) !important;
}

/* Tarjetas principales, Sidebar y Topbar */
html[data-theme="light"] .bg-slate-900,
html[data-theme="light"] .bg-slate-900\/90,
html[data-theme="light"] .bg-slate-900\/80,
html[data-theme="light"] .bg-slate-900\/70,
html[data-theme="light"] .bg-slate-900\/60,
html[data-theme="light"] .bg-slate-900\/50 {
    background-color: #ffffff !important;
}

/* Cajas secundarias, filas de tabla, pestañas y cabeceras */
html[data-theme="light"] .bg-slate-800,
html[data-theme="light"] .bg-slate-800\/90,
html[data-theme="light"] .bg-slate-800\/80,
html[data-theme="light"] .bg-slate-800\/70,
html[data-theme="light"] .bg-slate-800\/60,
html[data-theme="light"] .bg-slate-800\/50,
html[data-theme="light"] .bg-slate-800\/40,
html[data-theme="light"] .bg-slate-800\/30 {
    background-color: #f1f5f9 !important;
}

html[data-theme="light"] .bg-slate-700 {
    background-color: #e2e8f0 !important;
}

html[data-theme="light"] .hover\:bg-slate-800:hover,
html[data-theme="light"] .hover\:bg-slate-800\/80:hover,
html[data-theme="light"] .hover\:bg-slate-800\/60:hover,
html[data-theme="light"] .hover\:bg-slate-800\/40:hover,
html[data-theme="light"] .hover\:bg-slate-800\/30:hover,
html[data-theme="light"] .hover\:bg-slate-700:hover,
html[data-theme="light"] .hover\:bg-slate-700\/60:hover {
    background-color: #e2e8f0 !important;
}

/* ============================================================================
   2. FONDOS SEMÁNTICOS DE ALERTA, ACCIÓN Y ETAPAS EN MODO CLARO
   ============================================================================ */

/* Azul (Blue) */
html[data-theme="light"] .bg-blue-950,
html[data-theme="light"] .bg-blue-950\/60,
html[data-theme="light"] .bg-blue-950\/40,
html[data-theme="light"] .bg-blue-950\/30 {
    background-color: #eff6ff !important;
    border-color: #93c5fd !important;
}

html[data-theme="light"] .bg-blue-600\/20 {
    background-color: #dbeafe !important;
}

html[data-theme="light"] .hover\:bg-blue-600\/30:hover {
    background-color: #bfdbfe !important;
}

/* Cian (Cyan) */
html[data-theme="light"] .bg-cyan-950,
html[data-theme="light"] .bg-cyan-950\/80,
html[data-theme="light"] .bg-cyan-950\/30 {
    background-color: #ecfeff !important;
    border-color: #67e8f9 !important;
}

html[data-theme="light"] .bg-cyan-600\/20,
html[data-theme="light"] .bg-cyan-500\/10 {
    background-color: #cffafe !important;
}

/* Índigo (Indigo) */
html[data-theme="light"] .bg-indigo-950,
html[data-theme="light"] .bg-indigo-950\/40,
html[data-theme="light"] .bg-indigo-950\/25 {
    background-color: #eef2ff !important;
    border-color: #a5b4fc !important;
}

html[data-theme="light"] .bg-indigo-600\/20,
html[data-theme="light"] .bg-indigo-500\/10 {
    background-color: #e0e7ff !important;
}

/* Esmeralda / Éxito (Emerald) */
html[data-theme="light"] .bg-emerald-950,
html[data-theme="light"] .bg-emerald-950\/80,
html[data-theme="light"] .bg-emerald-950\/60,
html[data-theme="light"] .bg-emerald-950\/40,
html[data-theme="light"] .bg-emerald-950\/30,
html[data-theme="light"] .bg-emerald-950\/25,
html[data-theme="light"] .bg-emerald-950\/20 {
    background-color: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
}

html[data-theme="light"] .bg-emerald-600\/20,
html[data-theme="light"] .bg-emerald-500\/10 {
    background-color: #d1fae5 !important;
}

html[data-theme="light"] .hover\:bg-emerald-600\/30:hover {
    background-color: #a7f3d0 !important;
}

/* Ámbar / Advertencia (Amber) */
html[data-theme="light"] .bg-amber-950,
html[data-theme="light"] .bg-amber-950\/80,
html[data-theme="light"] .bg-amber-950\/70,
html[data-theme="light"] .bg-amber-950\/60,
html[data-theme="light"] .bg-amber-950\/50,
html[data-theme="light"] .bg-amber-950\/40,
html[data-theme="light"] .bg-amber-950\/30,
html[data-theme="light"] .bg-amber-950\/25 {
    background-color: #fffbeb !important;
    border-color: #fbbf24 !important;
}

html[data-theme="light"] .bg-amber-600\/20,
html[data-theme="light"] .bg-amber-500\/20,
html[data-theme="light"] .bg-amber-500\/10 {
    background-color: #fef3c7 !important;
}

/* Rosa / Error / Devolución (Rose) */
html[data-theme="light"] .bg-rose-950,
html[data-theme="light"] .bg-rose-950\/80,
html[data-theme="light"] .bg-rose-950\/60,
html[data-theme="light"] .bg-rose-950\/40,
html[data-theme="light"] .bg-rose-950\/30,
html[data-theme="light"] .bg-rose-950\/20,
html[data-theme="light"] .bg-rose-950\/15 {
    background-color: #fff1f2 !important;
    border-color: #fda4af !important;
}

html[data-theme="light"] .bg-rose-600\/20,
html[data-theme="light"] .bg-rose-500\/10,
html[data-theme="light"] .hover\:bg-rose-950:hover {
    background-color: #ffe4e6 !important;
    border-color: #fda4af !important;
}

/* Púrpura, Violeta y Naranja */
html[data-theme="light"] .bg-purple-950,
html[data-theme="light"] .bg-violet-950,
html[data-theme="light"] .bg-violet-950\/70 {
    background-color: #f5f3ff !important;
    border-color: #ddd6fe !important;
}

html[data-theme="light"] .border-violet-700 {
    border-color: #c4b5fd !important;
}

html[data-theme="light"] .bg-orange-950 {
    background-color: #fff7ed !important;
    border-color: #fed7aa !important;
}

/* ============================================================================
   3. BORDES Y DIVISORES EN MODO CLARO
   ============================================================================ */
html[data-theme="light"] .border-slate-900,
html[data-theme="light"] .border-slate-800,
html[data-theme="light"] .border-slate-800\/80,
html[data-theme="light"] .border-slate-800\/70,
html[data-theme="light"] .border-slate-700,
html[data-theme="light"] .border-slate-700\/80,
html[data-theme="light"] .border-slate-700\/70,
html[data-theme="light"] .border-slate-700\/60,
html[data-theme="light"] .border-slate-700\/40 {
    border-color: #cbd5e1 !important;
}

html[data-theme="light"] .border-slate-600 {
    border-color: #94a3b8 !important;
}

html[data-theme="light"] .divide-slate-800\/80 > :not([hidden]) ~ :not([hidden]),
html[data-theme="light"] .divide-slate-800\/70 > :not([hidden]) ~ :not([hidden]),
html[data-theme="light"] .divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]),
html[data-theme="light"] .divide-slate-800 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e2e8f0 !important;
}

/* Suavizar bordes semánticos oscuros (-800 / -700) pensados para modo oscuro */
html[data-theme="light"] .border-blue-800,
html[data-theme="light"] .border-blue-800\/60,
html[data-theme="light"] .border-blue-700,
html[data-theme="light"] .border-blue-700\/40 {
    border-color: #93c5fd !important;
}

html[data-theme="light"] .border-cyan-800,
html[data-theme="light"] .border-cyan-800\/50 {
    border-color: #67e8f9 !important;
}

html[data-theme="light"] .border-indigo-800,
html[data-theme="light"] .border-indigo-800\/60,
html[data-theme="light"] .border-indigo-700 {
    border-color: #a5b4fc !important;
}

html[data-theme="light"] .border-emerald-800,
html[data-theme="light"] .border-emerald-800\/60,
html[data-theme="light"] .border-emerald-700,
html[data-theme="light"] .border-emerald-700\/70,
html[data-theme="light"] .border-emerald-700\/60,
html[data-theme="light"] .border-emerald-700\/40 {
    border-color: #6ee7b7 !important;
}

html[data-theme="light"] .border-amber-800,
html[data-theme="light"] .border-amber-800\/70,
html[data-theme="light"] .border-amber-800\/60,
html[data-theme="light"] .border-amber-800\/50,
html[data-theme="light"] .border-amber-800\/40,
html[data-theme="light"] .border-amber-700,
html[data-theme="light"] .border-amber-700\/70,
html[data-theme="light"] .border-amber-600\/80 {
    border-color: #fbbf24 !important;
}

html[data-theme="light"] .border-rose-800,
html[data-theme="light"] .border-rose-800\/70,
html[data-theme="light"] .border-rose-800\/60,
html[data-theme="light"] .border-rose-800\/50,
html[data-theme="light"] .border-rose-700,
html[data-theme="light"] .border-rose-700\/60,
html[data-theme="light"] .border-rose-700\/50,
html[data-theme="light"] .border-rose-600 {
    border-color: #fda4af !important;
}

/* ============================================================================
   4. FORMULARIOS (INPUTS, SELECTS, TEXTAREAS) EN MODO CLARO
   ============================================================================ */
html[data-theme="light"] input:not([type="checkbox"]):not([type="range"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

html[data-theme="light"] input[readonly] {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: #64748b !important;
}

/* ============================================================================
   5. TIPOGRAFÍA NEUTRA Y SEMÁNTICA DE ALTO CONTRASTE EN MODO CLARO
   ============================================================================ */
html[data-theme="light"] .text-white {
    color: #0f172a !important;
}

html[data-theme="light"] .text-white\/70 {
    color: #475569 !important;
}

html[data-theme="light"] .text-slate-100,
html[data-theme="light"] .text-slate-200 {
    color: #1e293b !important;
}

html[data-theme="light"] .text-slate-300 {
    color: #334155 !important;
}

html[data-theme="light"] .text-slate-400,
html[data-theme="light"] .text-slate-500 {
    color: #475569 !important;
}

html[data-theme="light"] .hover\:text-white:hover {
    color: #0f172a !important;
}

/* Acentos semánticos (-100, -200, -300, -400) oscurecidos para máxima nitidez */
html[data-theme="light"] .text-blue-200,
html[data-theme="light"] .text-blue-300,
html[data-theme="light"] .text-blue-400,
html[data-theme="light"] .hover\:text-blue-300:hover,
html[data-theme="light"] .hover\:text-blue-400:hover {
    color: #1d4ed8 !important;
}

html[data-theme="light"] .text-cyan-200,
html[data-theme="light"] .text-cyan-300,
html[data-theme="light"] .text-cyan-400,
html[data-theme="light"] .text-cyan-500,
html[data-theme="light"] .hover\:text-cyan-300:hover {
    color: #0e7490 !important;
}

html[data-theme="light"] .text-indigo-200,
html[data-theme="light"] .text-indigo-300,
html[data-theme="light"] .text-indigo-400 {
    color: #4338ca !important;
}

html[data-theme="light"] .text-emerald-200,
html[data-theme="light"] .text-emerald-300,
html[data-theme="light"] .text-emerald-400,
html[data-theme="light"] .text-emerald-500 {
    color: #047857 !important;
}

html[data-theme="light"] .text-amber-100\/90,
html[data-theme="light"] .text-amber-200,
html[data-theme="light"] .text-amber-300,
html[data-theme="light"] .text-amber-400,
html[data-theme="light"] .hover\:text-amber-300:hover {
    color: #b45309 !important;
}

html[data-theme="light"] .text-rose-100,
html[data-theme="light"] .text-rose-200,
html[data-theme="light"] .text-rose-300,
html[data-theme="light"] .text-rose-400,
html[data-theme="light"] .hover\:text-rose-300:hover,
html[data-theme="light"] .hover\:text-rose-400:hover {
    color: #be123c !important;
}

html[data-theme="light"] .text-purple-400,
html[data-theme="light"] .text-violet-200,
html[data-theme="light"] .text-violet-300 {
    color: #5b21b6 !important;
}

html[data-theme="light"] .text-orange-400 {
    color: #c2410c !important;
}

/* ============================================================================
   6. PRESERVAR TEXTO BLANCO PURO EN BOTONES SÓLIDOS Y AVATARES VIBRANTES
      (Ubicado al final para prevalecer sobre .text-white y .hover:text-white)
   ============================================================================ */
html[data-theme="light"] .bg-blue-600,
html[data-theme="light"] .bg-blue-600 span,
html[data-theme="light"] .bg-blue-600 i,
html[data-theme="light"] .bg-blue-500,
html[data-theme="light"] .bg-blue-500 span,
html[data-theme="light"] .bg-blue-500 i,
html[data-theme="light"] .bg-cyan-600,
html[data-theme="light"] .bg-cyan-600 span,
html[data-theme="light"] .bg-cyan-600 i,
html[data-theme="light"] .bg-indigo-600,
html[data-theme="light"] .bg-indigo-600 span,
html[data-theme="light"] .bg-indigo-600 i,
html[data-theme="light"] .bg-indigo-500,
html[data-theme="light"] .bg-violet-600,
html[data-theme="light"] .bg-violet-600 span,
html[data-theme="light"] .bg-violet-600 i,
html[data-theme="light"] .bg-teal-600,
html[data-theme="light"] .bg-teal-600 span,
html[data-theme="light"] .bg-teal-600 i,
html[data-theme="light"] .bg-emerald-600,
html[data-theme="light"] .bg-emerald-600 span,
html[data-theme="light"] .bg-emerald-600 i,
html[data-theme="light"] .bg-amber-600,
html[data-theme="light"] .bg-amber-600 span,
html[data-theme="light"] .bg-amber-600 i,
html[data-theme="light"] .bg-rose-600,
html[data-theme="light"] .bg-rose-600 span,
html[data-theme="light"] .bg-rose-600 i,
html[data-theme="light"] .bg-rose-700,
html[data-theme="light"] .bg-rose-700 span,
html[data-theme="light"] .bg-rose-700 i,
html[data-theme="light"] .bg-gradient-to-tr,
html[data-theme="light"] .bg-gradient-to-tr i,
html[data-theme="light"] .hover\:bg-blue-600:hover,
html[data-theme="light"] .hover\:bg-blue-600:hover span,
html[data-theme="light"] .hover\:bg-blue-600:hover i,
html[data-theme="light"] .hover\:bg-blue-500:hover,
html[data-theme="light"] .hover\:bg-blue-500:hover span,
html[data-theme="light"] .hover\:bg-blue-500:hover i,
html[data-theme="light"] .hover\:bg-cyan-500:hover,
html[data-theme="light"] .hover\:bg-cyan-500:hover span,
html[data-theme="light"] .hover\:bg-cyan-500:hover i,
html[data-theme="light"] .hover\:bg-indigo-500:hover,
html[data-theme="light"] .hover\:bg-indigo-500:hover span,
html[data-theme="light"] .hover\:bg-indigo-500:hover i,
html[data-theme="light"] .hover\:bg-violet-500:hover,
html[data-theme="light"] .hover\:bg-violet-500:hover span,
html[data-theme="light"] .hover\:bg-violet-500:hover i,
html[data-theme="light"] .hover\:bg-teal-500:hover,
html[data-theme="light"] .hover\:bg-teal-500:hover span,
html[data-theme="light"] .hover\:bg-teal-500:hover i,
html[data-theme="light"] .hover\:bg-emerald-600:hover,
html[data-theme="light"] .hover\:bg-emerald-600:hover span,
html[data-theme="light"] .hover\:bg-emerald-600:hover i,
html[data-theme="light"] .hover\:bg-emerald-500:hover,
html[data-theme="light"] .hover\:bg-emerald-500:hover span,
html[data-theme="light"] .hover\:bg-emerald-500:hover i,
html[data-theme="light"] .bg-amber-600.hover\:bg-amber-500:hover,
html[data-theme="light"] .bg-amber-600.hover\:bg-amber-500:hover span,
html[data-theme="light"] .bg-amber-600.hover\:bg-amber-500:hover i,
html[data-theme="light"] .hover\:bg-rose-600:hover,
html[data-theme="light"] .hover\:bg-rose-600:hover span,
html[data-theme="light"] .hover\:bg-rose-600:hover i,
html[data-theme="light"] .hover\:bg-rose-500:hover,
html[data-theme="light"] .hover\:bg-rose-500:hover span,
html[data-theme="light"] .hover\:bg-rose-500:hover i {
    color: #ffffff !important;
}

/* ============================================================================
   7. ASISTENTE INTERACTIVO iQUÁNTICA (BARRA CLÁSICA MODO OSCURO Y CLARO)
   ============================================================================ */
.iq-visually-hidden {
    position: absolute;
    clip-path: inset(50%);
    overflow: hidden;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    white-space: nowrap;
}

.iq-chatbot-tab {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #ffffff;
    border: 1px solid #3b82f6;
    border-bottom: none;
}

.iq-chatbot-tab:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

.iq-chatbot-tab:focus-visible,
.iq-chatbot-header-btn:focus-visible,
.iq-chatbot-chip:focus-visible,
.iq-chatbot-action-btn:focus-visible,
.iq-chatbot-send-btn:focus-visible,
.iq-chatbot-input:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

.iq-chatbot-role-pill {
    background-color: rgba(15, 23, 42, 0.32);
    color: #e0f2fe;
}

.iq-chatbot-header {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #ffffff;
}

.iq-chatbot-avatar {
    background-color: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.iq-chatbot-header-btn {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.iq-chatbot-header-btn:hover {
    background-color: rgba(255, 255, 255, 0.24);
}

.iq-chatbot-send-btn {
    background-color: #2563eb;
    color: #ffffff;
}

.iq-chatbot-send-btn:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.iq-chatbot-send-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.iq-chatbot-msg-user {
    background-color: #2563eb;
    color: #ffffff;
}

/* Modo Oscuro */
html[data-theme="dark"] .iq-chatbot-panel {
    background-color: #0f172a;
    border: 1px solid #334155;
    border-bottom: none;
}

html[data-theme="dark"] .iq-chatbot-body {
    background-color: #020617;
}

html[data-theme="dark"] .iq-chatbot-msg-bot {
    background-color: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
}

html[data-theme="dark"] .iq-chatbot-inline-code {
    background-color: #0f172a;
    color: #93c5fd;
}

html[data-theme="dark"] .iq-chatbot-action-btn {
    background-color: #1d4ed8;
    color: #ffffff;
    border: 1px solid #3b82f6;
}

html[data-theme="dark"] .iq-chatbot-action-btn:hover {
    background-color: #2563eb;
}

html[data-theme="dark"] .iq-chatbot-time {
    color: #94a3b8;
}

html[data-theme="dark"] .iq-chatbot-chips-wrap {
    background-color: #0f172a;
    border-top: 1px solid #1e293b;
}

html[data-theme="dark"] .iq-chatbot-chip {
    background-color: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
}

html[data-theme="dark"] .iq-chatbot-chip:hover {
    background-color: #334155;
    color: #ffffff;
}

html[data-theme="dark"] .iq-chatbot-footer {
    background-color: #0f172a;
    border-top: 1px solid #1e293b;
}

html[data-theme="dark"] .iq-chatbot-input {
    background-color: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
}

html[data-theme="dark"] .iq-chatbot-status {
    background-color: #172554;
    color: #bfdbfe;
    border-top: 1px solid #1e40af;
}

html[data-theme="dark"] .iq-chatbot-status-error {
    background-color: #4c0519;
    color: #fecdd3;
    border-top-color: #be123c;
}

/* Modo Claro */
html[data-theme="light"] .iq-chatbot-tab,
html[data-theme="light"] .iq-chatbot-tab span,
html[data-theme="light"] .iq-chatbot-tab i,
html[data-theme="light"] .iq-chatbot-header,
html[data-theme="light"] .iq-chatbot-header h2,
html[data-theme="light"] .iq-chatbot-header p,
html[data-theme="light"] .iq-chatbot-header span,
html[data-theme="light"] .iq-chatbot-header i,
html[data-theme="light"] .iq-chatbot-msg-user,
html[data-theme="light"] .iq-chatbot-send-btn,
html[data-theme="light"] .iq-chatbot-send-btn i,
html[data-theme="light"] .iq-chatbot-action-btn,
html[data-theme="light"] .iq-chatbot-action-btn span,
html[data-theme="light"] .iq-chatbot-action-btn i {
    color: #ffffff !important;
}

html[data-theme="light"] .iq-chatbot-panel {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-bottom: none !important;
}

html[data-theme="light"] .iq-chatbot-body {
    background-color: #f8fafc !important;
}

html[data-theme="light"] .iq-chatbot-msg-bot {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .iq-chatbot-inline-code {
    background-color: #e2e8f0 !important;
    color: #1e40af !important;
}

html[data-theme="light"] .iq-chatbot-action-btn {
    background-color: #1d4ed8 !important;
    border: 1px solid #1e40af !important;
}

html[data-theme="light"] .iq-chatbot-action-btn:hover {
    background-color: #1e40af !important;
}

html[data-theme="light"] .iq-chatbot-time {
    color: #475569 !important;
}

html[data-theme="light"] .iq-chatbot-chips-wrap {
    background-color: #f1f5f9 !important;
    border-top: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .iq-chatbot-chip {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #94a3b8 !important;
}

html[data-theme="light"] .iq-chatbot-chip:hover {
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    border-color: #2563eb !important;
}

html[data-theme="light"] .iq-chatbot-footer {
    background-color: #ffffff !important;
    border-top: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .iq-chatbot-input {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #64748b !important;
}

html[data-theme="light"] .iq-chatbot-status {
    background-color: #eff6ff !important;
    color: #1e40af !important;
    border-top: 1px solid #93c5fd !important;
}

html[data-theme="light"] .iq-chatbot-status-error {
    background-color: #fff1f2 !important;
    color: #be123c !important;
    border-top-color: #fda4af !important;
}

@media (pointer: coarse) {
    .iq-chatbot-input {
        font-size: 1rem;
    }
}

/* Modo Depuración del Asistente (Dark / Light) */
.iq-chatbot-debug-btn-active {
    background-color: #f59e0b !important;
    color: #0f172a !important;
}

.iq-chatbot-debug-btn-active i {
    color: #0f172a !important;
}

html[data-theme="dark"] .iq-chatbot-debug-banner {
    background-color: #451a03;
    color: #fde68a;
    border-bottom: 1px solid #92400e;
}

html[data-theme="light"] .iq-chatbot-debug-banner {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border-bottom: 1px solid #f59e0b !important;
}

html[data-theme="dark"] .iq-chatbot-debug-ok {
    background-color: #0f172a;
    color: #cbd5e1;
    border: 1px solid #334155;
}

html[data-theme="dark"] .iq-chatbot-debug-warn {
    background-color: #2d0f16;
    color: #fecdd3;
    border: 1px solid #9f1239;
}

html[data-theme="light"] .iq-chatbot-debug-ok {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .iq-chatbot-debug-warn {
    background-color: #fff1f2 !important;
    color: #881337 !important;
    border: 1px solid #fda4af !important;
}

html[data-theme="dark"] .iq-chatbot-debug-error-text {
    color: #fda4af;
}

html[data-theme="light"] .iq-chatbot-debug-error-text {
    color: #be123c !important;
}

html[data-theme="dark"] .iq-chatbot-debug-pre {
    background-color: #020617;
    color: #93c5fd;
    border: 1px solid #1e293b;
}

html[data-theme="light"] .iq-chatbot-debug-pre {
    background-color: #ffffff !important;
    color: #1e3a8a !important;
    border: 1px solid #cbd5e1 !important;
}

html[data-theme="dark"] .iq-chatbot-debug-pill {
    background-color: #451a03;
    color: #fde68a;
    border: 1px solid #b45309;
}

html[data-theme="dark"] .iq-chatbot-debug-pill:hover {
    background-color: #78350f;
}

html[data-theme="light"] .iq-chatbot-debug-pill {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #f59e0b !important;
}

html[data-theme="light"] .iq-chatbot-debug-pill:hover {
    background-color: #fde68a !important;
}

/* ============================================================================
   8. SINCRONIZACIÓN EN VIVO (INDICADOR, BANNER PROTECTOR Y TOAST TOP-LAYER)
   ============================================================================ */
.iq-live-toast {
    position: fixed;
    inset: auto 1.25rem auto auto;
    top: 4.75rem;
    right: 1.25rem;
    margin: 0;
    z-index: 45;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: reduce) {
    .iq-live-toast,
    #iqLiveStatusDot {
        transition: none !important;
        animation: none !important;
    }
}

html[data-theme="light"] .iq-live-status-badge {
    background-color: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
    color: #065f46 !important;
}

html[data-theme="light"] .iq-live-status-badge span {
    color: #065f46 !important;
}

html[data-theme="light"] .iq-live-pending-banner {
    background-color: #eff6ff !important;
    border-color: #60a5fa !important;
    color: #1e3a8a !important;
}

html[data-theme="light"] .iq-live-toast {
    background-color: #ffffff !important;
    border-color: #10b981 !important;
    color: #0f172a !important;
}

/* ============================================================================
   9. TABLAS RESPONSIVAS, GRILLA RÁPIDA LMP Y CONTENCIÓN DE REFLUJO
   ============================================================================ */
.iq-lmp-scope input[type="checkbox"],
.iq-lmp-scope input[type="radio"] {
    accent-color: #2563eb;
}

.iq-sticky-table-wrap {
    overflow: auto;
    max-inline-size: 100%;
    max-block-size: min(620px, 72vh);
    container-type: inline-size;
    scroll-behavior: smooth;
}

.iq-sticky-table-wrap:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

.iq-sticky-table-wrap table {
    border-collapse: separate;
    border-spacing: 0;
}

.iq-sticky-table-wrap thead {
    position: sticky;
    inset-block-start: 0;
    z-index: 3;
}

html[data-theme="dark"] .iq-sticky-table-wrap thead th {
    background-color: #0f172a;
    border-bottom: 1px solid #334155;
}

html[data-theme="light"] .iq-sticky-table-wrap thead th {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border-bottom: 1px solid #cbd5e1 !important;
}

.iq-fast-grid-contain {
    content-visibility: auto;
    contain-intrinsic-size: auto 1000px auto 640px;
}

@supports not (content-visibility: auto) {
    .iq-fast-grid-contain {
        contain: layout style paint;
    }
}

.iq-heading-balance {
    text-wrap: balance;
    overflow-wrap: break-word;
}

.iq-text-pretty {
    text-wrap: pretty;
    overflow-wrap: break-word;
}

/* ============================================================================
   10. DIÁLOGOS MODALES NATIVOS (<dialog>:modal Y ::backdrop)
   ============================================================================ */
dialog:modal {
    overscroll-behavior: contain;
}

dialog::backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
}

html[data-theme="light"] dialog#modalInspeccionValidar {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

html[data-theme="light"] dialog#modalInspeccionValidar::backdrop {
    background-color: rgba(15, 23, 42, 0.55);
}

dialog.iq-fullscreen-dialog[open] {
    display: flex;
    flex-direction: column;
    width: calc(100vw - 1rem);
    height: calc(100dvh - 1rem);
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: hidden;
}

html[data-theme="light"] dialog.iq-fullscreen-dialog {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

html[data-theme="light"] dialog.iq-fullscreen-dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.6);
}

.iq-modal-table-wrap {
    flex: 1 1 0px;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    container-type: inline-size;
    scroll-behavior: smooth;
}

.iq-modal-table-wrap:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: -2px;
}

.iq-modal-table-wrap table {
    border-collapse: separate;
    border-spacing: 0;
}

.iq-modal-table-wrap thead {
    position: sticky;
    inset-block-start: 0;
    z-index: 4;
}

html[data-theme="dark"] .iq-modal-table-wrap thead th {
    background-color: #0f172a;
    border-bottom: 1px solid #334155;
}

html[data-theme="light"] .iq-modal-table-wrap thead th {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border-bottom: 1px solid #cbd5e1 !important;
}

.iq-hide-opt-cols .col-opt-lmp {
    display: none;
}

/* ============================================================================
   MENÚS DESPLEGABLES AGRUPADOS Y MODAL UNIFICADO DE EXPORTACIÓN
   ============================================================================ */
details.iq-dropdown > summary {
    list-style: none;
}

details.iq-dropdown > summary::-webkit-details-marker {
    display: none;
}

details.iq-dropdown[open] > summary .iq-dropdown-caret {
    transform: rotate(180deg);
}

.iq-dropdown-panel {
    background-color: #0f172a;
    border-color: #334155;
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.65);
}

html[data-theme="light"] .iq-dropdown-panel {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16) !important;
}

html[data-theme="light"] .iq-dropdown-item:hover {
    background-color: #f1f5f9 !important;
}

dialog.iq-modal-dialog {
    margin: auto;
    width: calc(100vw - 2rem);
    max-width: 46rem;
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border-radius: 1.5rem;
    overflow: hidden;
    background-color: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.75);
}

dialog.iq-modal-dialog[open] {
    display: flex;
    flex-direction: column;
}

dialog.iq-modal-dialog::backdrop {
    background-color: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
}

html[data-theme="light"] dialog.iq-modal-dialog {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2) !important;
}

html[data-theme="light"] dialog.iq-modal-dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.52);
}

/* Botones nativos de carga de archivos en Modo Claro */
html[data-theme="light"] input[type="file"] {
    color: #334155 !important;
}

html[data-theme="light"] input[type="file"]::file-selector-button {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 1px solid #1d4ed8 !important;
    font-weight: 700 !important;
    border-radius: 0.65rem !important;
    padding: 0.35rem 0.85rem !important;
    margin-right: 0.75rem !important;
    cursor: pointer !important;
}

html[data-theme="light"] input[type="file"]::file-selector-button:hover {
    background-color: #1d4ed8 !important;
}
