/* ==========================================================================
   VARIABLES DE COLOR (Por defecto: Modo Claro Modernizado)
   ========================================================================== */
:root {
    --bg-principal: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --texto-principal: #1e293b;
    --texto-label: #475569;
    --border-color: #e2e8f0;
    --th-bg: #f8fafc;
    --td-bg: #ffffff;
    --td-border: #f1f5f9;
    --link-color: #0284c7;
    --tr-hover: #f8fafc;
    
    /* 🎨 Transparencias Modo Claro (Dejan pasar el fondo blanco/gris) */
    --bg-urgente: rgba(254, 226, 226, 0.85);        /* Rosa suave */
    --text-urgente: #991b1b;
    --bg-urgente-hover: rgba(254, 202, 202, 0.9);   /* Rosa un toque más fuerte al pasar el mouse */
    
    --bg-informado: rgba(217, 254, 228, 0.85);      /* Verde tierno */
    --text-informado: #166534;
    --bg-informado-hover: rgba(174, 244, 198, 0.9);

    --bg-tarde: #fefaf0;
    --text-tarde: #b45309;
    --bg-tarde-hover: #fef3c7;
}

/* ==========================================================================
   VARIABLES PARA MODO OSCURO ATENUADO (Se activa con .dark-mode)
   ========================================================================== */
body.dark-mode {
    --bg-principal: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --texto-principal: #e2e8f0;
    --texto-label: #94a3b8;
    --border-color: #334155;
    --th-bg: #1e293b;
    --td-bg: #1e293b;
    --td-border: #334155;
    --link-color: #38bdf8;
    --tr-hover: #24334d;
    
    /* 🎨 Transparencias Modo Oscuro (Se fusionan con el fondo gris azulado oscuro de la tarjeta) */
    --bg-urgente: rgba(239, 68, 68, 0.18);          /* 18% de Rojo: queda un rosa pastel apagado precioso */
    --text-urgente: #fca5a5;                        /* Texto rosa clarito para que resalte sin encandilar */
    --bg-urgente-hover: rgba(239, 68, 68, 0.28);    /* Se ilumina un toque más al pasar el mouse */
    
    --bg-informado: rgba(34, 197, 94, 0.15);        /* 15% de Verde: un tono esmeralda oscuro super sutil */
    --text-informado: #bbf7d0;                      /* Texto verde pastel legible */
    --bg-informado-hover: rgba(34, 197, 94, 0.25);

    --bg-tarde: rgba(245, 158, 11, 0.12);
    --text-tarde: #fde047;
    --bg-tarde-hover: rgba(245, 158, 11, 0.22);
}

/* ==========================================================================
   ESTILOS BASE
   ========================================================================== */
body { 
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif; 
    margin: 0; 
    background: var(--bg-principal);
    color: var(--texto-principal);
    font-size: 13px; 
    transition: background 0.2s, color 0.2s;
}

.container { padding: 14px; }

.card { 
    background: var(--bg-card); 
    border-radius: 8px; 
    padding: 12px; 
    box-shadow: 0 1px 3px rgba(0,0,0,.05); 
    margin-bottom: 12px; 
    border: 1px solid var(--border-color);
    transition: background 0.2s, border-color 0.2s;
}

/* BARRA DE NAVEGACIÓN */
.nav { 
    background: #0f172a; 
    color: #f8fafc; 
    padding: 10px 24px; 
    display: flex; 
    gap: 20px; 
    align-items: center; 
    flex-wrap: wrap;
    border-bottom: 1px solid #1e293b;
}
.nav strong { 
    font-size: 19px; 
    font-weight: 800; 
    letter-spacing: 1.5px; 
    color: #38bdf8; 
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
    margin-right: 15px;
}
.nav a { 
    color: #94a3b8; 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}
.nav a:hover { color: #f8fafc; }

/* Botón Switcher */
.theme-switch {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}
.theme-switch:hover { background: #334155; color: white; }

/* FORMULARIOS */
.tabs a { 
    padding: 6px 12px; 
    background: var(--border-color); 
    margin-right: 6px; 
    border-radius: 6px; 
    color: var(--texto-principal); 
    text-decoration: none; 
    display: inline-block; 
    font-weight: 600;
}
.tabs a.active { background: #0f172a; color: white; }
body.dark-mode .tabs a.active { background: #38bdf8; color: #0f172a; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
label { display: block; font-size: 11px; font-weight: 700; margin-bottom: 3px; color: var(--texto-label); text-transform: uppercase; }

input, select, textarea { 
    padding: 5px 8px; 
    font-size: 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
    background: var(--bg-input);
    color: var(--texto-principal);
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #38bdf8; }

/* BOTONES (Efectos e identidades protegidas) */
button, .btn { 
    background: #111827; 
    color: white; 
    padding: 6px 12px; 
    font-size: 12px; 
    border-radius: 6px; 
    border: 0; 
    text-decoration: none; 
    display: inline-block; 
    cursor: pointer; 
    font-weight: 600;
    transition: background 0.15s, transform 0.05s;
}
button:hover, .btn:hover { background: #1f2937; }
button:active, .btn:active { transform: scale(0.98); }

.btn.secondary { background: #4b5563; }
.btn.secondary:hover { background: #374151; }

/* El botón rojo peligro se mantiene firme en ambos modos */
.btn.danger, body.dark-mode .btn.danger { 
    background: #991b1b !important; 
    color: white !important;
    border: 0 !important;
}
.btn.danger:hover, body.dark-mode .btn.danger:hover { 
    background: #7f1d1d !important; 
}

/* Modificadores de botones para el modo oscuro */
body.dark-mode button:not(.danger):not(.secondary), 
body.dark-mode .btn:not(.danger):not(.secondary) { 
    background: #334155; 
    border: 1px solid #475569; 
}
body.dark-mode button:not(.danger):not(.secondary):hover, 
body.dark-mode .btn:not(.danger):not(.secondary):hover { 
    background: #475569; 
}

/* ==========================================================================
   TABLA CON TRANSPARENCIAS INTEGRADAS
   ========================================================================== */
.table-wrap { overflow: auto; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border-color); }
.compact-table { max-height: calc(100vh - 185px); overflow: auto; }
table { border-collapse: collapse; width: 100%; min-width: 1200px; }
th, td { padding: 6px 8px; font-size: 12px; line-height: 1.3; text-align: left; }
th { background: var(--th-bg); color: var(--texto-label); font-weight: 700; border-bottom: 2px solid var(--border-color); position: sticky; top: 0; z-index: 2; }

/* Quité el color sólido de los td para que hereden el fondo transparente de la fila (tr) */
td { border-bottom: 1px solid var(--td-border); color: var(--texto-principal); }
tr { background: var(--td-bg); }

tr:hover td { background-color: var(--tr-hover) !important; }

/* 🎨 FILAS CON TRANSPARENCIAS IMPUESTAS EXCELENTES */
tr.urgent { background: var(--bg-urgente) !important; color: var(--text-urgente) !important; }
tr.urgent:hover { background: var(--bg-urgente-hover) !important; }

tr.informed { background: var(--bg-informado) !important; color: var(--text-informado) !important; }
tr.informed:hover { background: var(--bg-informado-hover) !important; }

tr.late { background: var(--bg-tarde) !important; color: var(--text-tarde) !important; }
tr.late:hover { background: var(--bg-tarde-hover) !important; }

/* Forzar que los inputs dentro de filas pintadas no queden descolgados */
tr.urgent select, tr.urgent input,
tr.informed select, tr.informed input {
    background: var(--bg-input) !important;
    color: var(--texto-principal) !important;
}

table td a { color: var(--link-color); text-decoration: none; font-weight: 600; }
table td a:hover { text-decoration: underline; }

/* BURBUJAS DE ESTADO (.STATUS) */
.status { padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: bold; }
.status.Pendiente { background: #fee2e2; color: #991b1b; }
.status.Informado { background: #dcfce7; color: #166534; }
.status.No_encontrado, .status.No_informar { background: #e2e8f0; color: #475569; }

body.dark-mode .status.Pendiente { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
body.dark-mode .status.Informado { background: rgba(34, 197, 94, 0.25); color: #84f9ad; }

/* EXTRAS */
.flash { background: #e0f2fe; color: #0369a1; padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; font-weight: 600; border-left: 4px solid #0284c7; }
.badge-preliminar { background-color: #38bdf8; color: #0f172a; border-radius: 10px; padding: 1px 6px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.save-status { position: sticky; top: 0; z-index: 5; display: inline-block; margin-bottom: 6px; padding: 4px 8px; border-radius: 6px; background: var(--border-color); color: var(--texto-principal); font-size: 11px; font-weight: 700; }
.save-status.ok { background: #a5e6bb; color: #166534; }
.save-status.error { background: #fee2e2; color: #991b1b; }
.alerta-urgente-container { width: 100%; box-sizing: border-box; background-color: #ef4444; color: white; padding: 12px 20px; font-size: 14px; font-weight: bold; text-align: center; border-bottom: 4px solid #dc2626; display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 15px; animation: pulso-alerta 2.5s infinite; z-index: 9999; border-radius: 6px; }
.alerta-urgente-container .btn-revisar { background-color: white; color: #ef4444; border: none; padding: 4px 10px; font-weight: bold; border-radius: 4px; cursor: pointer; text-transform: uppercase; font-size: 11px; }
@keyframes pulso-alerta { 0% { background-color: #ef4444; } 50% { background-color: #f87171; } 100% { background-color: #ef4444; } }
table thead th a { color: inherit; text-decoration: none; display: inline-block; width: 100%; height: 100%; }