@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Colores Institucionales UPT - EPIS */
    --primary: #0F1F4B;
    /* Azul Noche Institucional UPT */
    --primary-hover: #1A3273;
    /* Azul noche interactivo */
    --primary-light: #EEF2FF;
    /* Azul tenue para selecciones y badges */
    --primary-glow: rgba(15, 31, 75, 0.28);

    --accent: #F5A623;
    /* Dorado Institucional UPT */
    --accent-hover: #E09516;
    /* Dorado interactivo */
    --accent-light: #FFF8EE;
    /* Dorado suave */
    --accent-glow: rgba(245, 166, 35, 0.35);

    /* Semánticos */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --info: #0284c7;
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;

    /* Fondo y texto (Dashboard blanco y limpio / Cards elevadas) */
    --bg-app: #F4F6F9;
    --surface: #FFFFFF;
    --surface-secondary: #F8FAFC;
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --text-main: #0F1F4B;
    --text-muted: #64748B;
    --text-light: #94A3B8;

    /* Sidebar Tematizado UPT (Azul Noche Profundo + Acentos Dorados) */
    --sidebar-bg: #0A1535;
    --sidebar-surface: #0F1F4B;
    --sidebar-border: rgba(255, 255, 255, 0.12);
    --sidebar-text: #F1F5F9;
    --sidebar-text-muted: #94A3B8;
    --sidebar-active-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-border: #ffffff;

    /* Sombras y elevaciones */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 31, 75, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 31, 75, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px rgba(15, 31, 75, 0.05), 0 10px 24px -5px rgba(15, 31, 75, 0.06);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
   LAYOUT PRINCIPAL: SIDEBAR + CONTENEDOR
========================================================= */
.layout-contenedor {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR IZQUIERDO --- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--sidebar-border);
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: 1.4rem 1.25rem 1.2rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    border: none;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-titulo {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-titulo h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-titulo span {
    font-size: 0.72rem;
    color: #ffffff;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Navegación del Sidebar */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.nav-grupo-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    padding: 0 0.75rem 0.5rem;
}

.nav-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.nav-link.active {
    color: #ffffff;
    background: var(--sidebar-active-bg);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    background: var(--sidebar-active-border);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.45);
}

.nav-link .icono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--sidebar-text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.nav-link .icono svg,
.nav-link .nav-svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
}

.nav-link:hover .icono,
.nav-link:hover .nav-svg {
    color: #ffffff;
}

.nav-link.active .icono,
.nav-link.active .nav-svg {
    color: #ffffff;
}

.nav-link .badge-nav {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.badge-alert {
    background: var(--danger);
    color: white;
    animation: pulsoAlerta 2s infinite;
}

.badge-prox {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-muted);
    font-size: 0.65rem;
}

@keyframes pulsoAlerta {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.75;
        transform: scale(1.05);
    }
}

/* Footer del Sidebar (Usuario) */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.usuario-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #162B64 0%, #0F1F4B 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.usuario-detalles {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.usuario-nombre {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.usuario-rol {
    font-size: 0.7rem;
    color: #ffffff;
    opacity: 0.85;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================================
   CONTENEDOR DE PÁGINA (MAIN)
========================================================= */
.layout-principal {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

/* Topbar */
.topbar {
    background: var(--surface);
    height: 64px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

.topbar-izq {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.topbar-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.topbar-der {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-accion-top {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
    box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-accion-top:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Contenido Principal de Página */
.contenido-pagina {
    padding: 2rem;
    flex: 1;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* =========================================================
   COMPONENTES GLOBALES (CARDS, BADGES, BOTONES)
========================================================= */
/* Tarjetas */
.tarjeta {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    transition: var(--transition);
}

.tarjeta-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

/* Tarjetas de Métricas (KPIs) de Dashboard - Nuevo Estilo Split-Card */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.kpi-top {
    padding: 1.25rem 1.35rem 1.15rem 1.35rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.kpi-val-row {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.kpi-numero {
    font-size: 2.15rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

.kpi-sufijo {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.kpi-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon-box svg {
    width: 24px;
    height: 24px;
}

.kpi-bottom {
    background: #f8fafc;
    border-top: 1px solid #edf2f7;
    padding: 0.65rem 1.35rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.kpi-bottom-left {
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.25;
}

.kpi-bottom-right {
    display: flex;
    align-items: center;
    line-height: 1.25;
}

.kpi-pill {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.kpi-pill-online {
    background: #a7f3d0;
    color: #047857;
}

.kpi-pill-offline {
    background: #dbeafe;
    color: #1e40af;
}

.kpi-pill-danger {
    background: #fee2e2;
    color: #991b1b;
}

.kpi-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.kpi-dot-online {
    background: #10b981;
}

.kpi-dot-offline {
    background: #64748b;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-accent {
    background: var(--accent);
    color: #0F1F4B;
    font-weight: 700;
    box-shadow: 0 2px 6px var(--accent-glow);
}

.btn-accent:hover {
    background: var(--accent-hover);
    color: #0F1F4B;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--surface-secondary);
    border-color: #cbd5e1;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Badges / Etiquetas */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-online {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid var(--success-border);
}

.badge-offline {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid var(--warning-border);
}

/* LED de Estado */
.led-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.led-online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.led-offline {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.led-warning {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

/* Alertas */
.alerta {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alerta-error {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid var(--danger-border);
}

.alerta-ok {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid var(--success-border);
}

/* Pantalla Login */
.pagina-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
    padding: 1.5rem;
}

.tarjeta-login {
    background: var(--surface);
    padding: 2.75rem 2.25rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.tarjeta-login .login-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.tarjeta-login h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.tarjeta-login .subtitulo {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.75rem;
}

.campo-form {
    margin-bottom: 1.25rem;
}

.campo-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.4rem;
}

.campo-form input,
.campo-form select,
.campo-form textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.925rem;
    font-family: var(--font-sans);
    transition: var(--transition);
    background: var(--surface);
}

.campo-form input:focus,
.campo-form select:focus,
.campo-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   SISTEMA DE NOTIFICACIONES TOAST Y MODALES GLOBALES
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    min-width: 320px;
    max-width: 440px;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    background: #0f172a;
    border: 1px solid #334155;
    color: #f8fafc;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, border-color 0.25s ease;
}

.toast-item.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-item.toast-salida {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-icono svg {
    width: 20px;
    height: 20px;
    display: block;
}

.toast-contenido {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.45;
    font-weight: 500;
}

.toast-cerrar {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.toast-cerrar:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icono {
    color: #10b981;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icono {
    color: #f59e0b;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icono {
    color: #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icono {
    color: #3b82f6;
}

.toast-loading {
    border-left: 4px solid #0ea5e9;
}

.toast-loading .toast-icono {
    color: #0ea5e9;
}

.toast-spinner {
    animation: toast-rotar 0.85s linear infinite;
}

@keyframes toast-rotar {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Modales globales (Estilo Glassmorphism) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.abierto {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 92%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.abierto .modal-card {
    transform: scale(1);
    animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 1.15rem 1.4rem;
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.25rem 1.4rem;
}

.modal-footer {
    padding: 0.85rem 1.4rem;
    background: var(--surface-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

@keyframes modalPop {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Sección de Monitoreo de Alertas y Conflictos - Rediseño Profesional */
.estado-red-strip {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.estado-red-izq {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.estado-red-icono-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #ecfdf5;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.estado-red-titulo {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.estado-red-desc {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.2rem;
    line-height: 1.2;
}

.btn-resolver-incidente {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #10b981;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
    padding: 0;
    flex-shrink: 0;
}

.btn-resolver-incidente:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.4);
}

.btn-resolver-incidente:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.3);
}

.btn-resolver-incidente:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-resolver-incidente svg {
    stroke: #ffffff;
}



/* ==========================================================================
   DISEÑO INSTITUCIONAL UPT · EPIS (SISTEMA UNIFICADO DASHBOARD E HISTORIAL)
   ========================================================================== */

/* --- ENCABEZADOS DE PÁGINA --- */
.page-header-upt {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title-upt {
    margin: 0;
    font: 700 32px/1.15 var(--font-sans);
    color: var(--primary);
}

.page-sub-upt {
    margin: 8px 0 0;
    font-size: 16px;
    color: #556072;
    max-width: 680px;
    line-height: 1.45;
}

.page-meta-upt {
    font-size: 13.5px;
    color: #556072;
    text-align: right;
}

.page-meta-time {
    font: 500 14px var(--font-mono);
    color: #172033;
}

/* --- TARJETAS DE SECCIÓN --- */
.section-card {
    background: #ffffff;
    border: 1px solid #D8DEE8;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 31, 75, 0.06);
    margin-bottom: 28px;
    overflow: hidden;
}

.section-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid #D8DEE8;
}

.section-title-upt {
    margin: 0;
    font: 700 20px var(--font-sans);
    color: var(--primary);
}

.section-sub-upt {
    margin: 4px 0 0;
    font-size: 14.5px;
    color: #556072;
}

.section-badges-upt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* --- TARJETA DE FILTROS --- */
.filter-card {
    background: #ffffff;
    border: 1px solid #D8DEE8;
    border-radius: 8px;
    padding: 18px 24px;
    box-shadow: 0 1px 2px rgba(15, 31, 75, 0.06);
    margin-bottom: 24px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group-grow {
    flex: 1 1 320px;
}

.filter-group-select {
    flex: 0 1 280px;
    min-width: 220px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #33415A;
}

.filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6B7686;
    pointer-events: none;
}

.filter-input {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    padding: 0 12px 0 36px;
    border: 1px solid #B9C2D2;
    border-radius: 6px;
    font: 400 14.5px var(--font-sans);
    color: #172033;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #1D4E9E;
    box-shadow: 0 0 0 3px rgba(29, 78, 158, 0.12);
}

.filter-select {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #B9C2D2;
    border-radius: 6px;
    font: 400 14.5px var(--font-sans);
    color: #172033;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* --- TARJETAS KPI DASHBOARD --- */
.kpi-grid-upt {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card-upt {
    background: #ffffff;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #D8DEE8;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 31, 75, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card-upt:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(15, 31, 75, 0.08);
}

.kpi-label-upt {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #556072;
}

.kpi-label-alert {
    color: #A32626 !important;
}

.kpi-val-row-upt {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.kpi-num-upt {
    font: 700 40px/1 var(--font-sans);
    color: #172033;
}

.kpi-num-online {
    color: #1F7A4D;
}

.kpi-num-alert {
    color: #A32626;
}

.kpi-sufijo-upt {
    font-size: 14px;
    color: #556072;
}

.kpi-bar-upt {
    height: 6px;
    border-radius: 3px;
    background: #E4E8EF;
    overflow: hidden;
}

.kpi-bar-fill {
    height: 100%;
}

.kpi-bar-online {
    background: #1F7A4D;
}

.kpi-bar-offline {
    background: #6B7686;
}

.kpi-desc-upt {
    font-size: 13.5px;
    color: #556072;
}

/* --- TARJETAS DE LABORATORIOS --- */
.labs-grid-upt {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.lab-card-upt {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 22px;
    background: #ffffff;
    border: 1px solid #D8DEE8;
    border-radius: 8px;
    color: #172033;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lab-card-upt:hover {
    border-color: #8FA0C0 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 31, 75, 0.08);
    text-decoration: none;
}

.lab-card-header-upt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lab-title-upt {
    font: 700 18px var(--font-sans);
    color: var(--primary);
}

.lab-status-online {
    font-size: 13px;
    font-weight: 600;
    color: #1F7A4D;
}

.lab-status-offline {
    font-size: 13px;
    font-weight: 600;
    color: #6B7686;
}

.lab-count-upt {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.lab-num-upt {
    font: 700 28px/1 var(--font-sans);
    color: #172033;
}

.lab-link-upt {
    font-size: 14px;
    font-weight: 600;
    color: #1D4E9E;
}

/* --- BADGES REUTILIZABLES --- */
.badge-pill-upt {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.badge-pill-neutral {
    border: 1px solid #C5CDDB;
    background: #F3F5F8;
    color: #172033;
}

.badge-pill-blue {
    border: 1px solid #BCD0EE;
    background: #E8F0FB;
    color: #1B4283;
}

.badge-pill-danger {
    background: #FBE9E9;
    color: #8F1F1F;
}

.badge-aula-upt {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #C5CDDB;
    border-radius: 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: #33415A;
    background: #F3F5F8;
}

.badge-iface-inst {
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #E8F0FB;
    color: #1B4283;
    border: 1px solid #BCD0EE;
}

.badge-iface-sec {
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #F3F5F8;
    color: #33415A;
    border: 1px solid #C5CDDB;
}

.badge-iface-warn {
    font-size: 10.5px;
    font-weight: 600;
    color: #7A4A00;
    background: #FFF1D6;
    padding: 1px 5px;
    border-radius: 3px;
}

.badge-sev-critica {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    padding: 4px 10px;
    border-radius: 4px;
    background: #FBE9E9;
    color: #8F1F1F;
    font-size: 13px;
    font-weight: 700;
}

.badge-sev-advertencia {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    padding: 4px 10px;
    border-radius: 4px;
    background: #FFF1D6;
    color: #7A4A00;
    font-size: 13px;
    font-weight: 700;
}

/* --- TABLAS Y GRILLAS MODERNAS --- */
.eq-grid {
    display: grid;
    grid-template-columns: 85px minmax(130px, 1fr) 75px 115px 110px 130px 80px minmax(190px, 1fr);
    column-gap: 12px;
    align-items: center;
}

.al-grid {
    display: grid;
    grid-template-columns: 110px 120px 115px 130px 150px minmax(220px, 1fr) 60px;
    column-gap: 16px;
    align-items: center;
}

.grid-header-row.al-grid [role="columnheader"] {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
}

/* Severidad en texto plano negro (sin badge) */
.sev-texto-plano {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
}

.sev-texto-plano svg {
    color: #0f172a;
    stroke: #0f172a;
    flex-shrink: 0;
}

/* Botón Aula Azul Noche Institucional UPT */
.badge-aula-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.715rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 5px;
    background: #0F1F4B;
    color: #ffffff !important;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 1px 3px rgba(15, 31, 75, 0.25);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.badge-aula-item svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.badge-aula-item:hover {
    background: #1A3273;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(15, 31, 75, 0.38);
    transform: translateY(-1px);
}

.badge-aula-sin {
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 2px 7px;
    border-radius: 4px;
    text-align: center;
    display: inline-block;
}

/* Detalle Técnico en grilla de alertas (Dashboard) */
.al-detalle-celda {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.al-detalle-principal {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
}

.al-detalle-sugerencia {
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.35;
}


.ip-grid {
    display: grid;
    grid-template-columns: 90px minmax(210px, 1.4fr) minmax(130px, 1fr) 80px 135px 115px;
    column-gap: 12px;
    align-items: start;
}

.grid-header-row {
    padding: 12px 24px;
    background: #F3F5F8;
    border-bottom: 1px solid #D8DEE8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #556072;
    align-items: center;
}

.grid-header-row [role="columnheader"] {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
}

.grid-header-row.eq-grid {
    padding: 10px 18px;
    font-size: 11px;
}

.grid-header-row.ip-grid {
    padding: 10px 18px;
    font-size: 11px;
}

.eq-row {
    padding: 9px 18px;
    border-bottom: 1px solid #E4E8EF;
    font-size: 13px;
    transition: background 0.15s ease;
}

.eq-row:hover {
    background: #F8FAFC !important;
}

.al-row {
    padding: 16px 24px;
    border-bottom: 1px solid #E4E8EF;
    font-size: 14.5px;
    transition: all 0.2s ease;
}

.al-row:hover {
    background: #F8FAFC !important;
}

.ip-row {
    padding: 10px 18px;
    border-bottom: 1px solid #E4E8EF;
    font-size: 13px;
    transition: background 0.15s ease;
}

.ip-row:hover {
    background: #F8FAFC !important;
}

/* Indicador de estado punto + texto */
.status-pill-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #1F7A4D;
}

.status-pill-offline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6B7686;
}

.status-dot-online {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #1F7A4D;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot-offline {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #99A3B5;
    display: inline-block;
    flex-shrink: 0;
}

/* Tipografía de IP monoespaciada */
.ip-mono-title {
    font: 600 12.5px var(--font-mono);
    color: #0F1F4B;
}

.ip-mono-sub {
    font: 500 12.5px var(--font-mono);
    color: #172033;
}

.mono-val {
    font: 400 12px var(--font-mono);
    color: #33415A;
}

.mono-serial {
    font: 600 12px var(--font-mono);
    color: #172033;
}

.mono-mac {
    font: 400 11.5px var(--font-mono);
    color: #556072;
}

/* --- PAGINACIÓN INSTITUCIONAL --- */
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    background: #F8FAFC;
    border-top: 1px solid #E4E8EF;
}

.pagination-info {
    font-size: 14px;
    color: #556072;
}

.pagination-info strong {
    color: #172033;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- FOOTER INSTITUCIONAL --- */
.footer-upt {
    padding: 16px 0 8px;
    border-top: 1px solid #D8DEE8;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #6B7686;
    margin-top: 24px;
}

/* --- BOTÓN PRIMARIO UPT --- */
.btn-p {
    background: #0F1F4B !important;
    border-color: #0F1F4B !important;
    color: #ffffff !important;
}

.btn-p:hover {
    background: #1A2E6A !important;
    color: #ffffff !important;
}