.popup {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.popup-contenido {
    position: relative;
    width: min(95vw, 900px);
    border-radius: 12px;
    background: #fff;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.popup.activo {
    display: flex;
}

.popup.activo .popup-contenido {
    transform: scale(1);
}

/* BOTÓN CERRAR - AHORA ROJO */
.cerrar-popup {
    position: absolute;
    top: -7px;
    right: 7px;
    cursor: pointer;
    font-size: 40px;
    color: var(--rojo);
    z-index: 1002;
    transition: 0.3s;
}

.cerrar-popup:hover {
    color: #8a373b;
}

/* TABLA - ESTILO AZUL Y ROJO */
.table-card {
    overflow-x: auto;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Inter", sans-serif;
}

/* Encabezados azules */
thead .cat-cell {
    color: #2c3e50;
    padding: 15px;
}

/* Rojo para destacar */

tbody th {
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 12px;
    text-transform: uppercase;
    padding: 15px;
    border-bottom: 1px solid #ddd;
}

tbody td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #444;
}

/* Colores de texto ajustados */
.kva {
    color: #3498db;
    font-weight: bold;
}

.yes {
    color: #27ae60;
    font-weight: bold;
}

/* Verde para éxito */
.no {
    color: #b0464a;
    font-weight: bold;
}

/* Rojo para negativo */
.mid {
    color: #e67e22;
    font-weight: bold;
}

/* Naranja para medio */

tbody tr:hover {
    background: #f1f7fc;
}
.tablecomparativa {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}
/* --- RESPONSIVIDAD MEJORADA --- */

/* Ajustes para dispositivos móviles (pantallas pequeñas) */
@media (max-width: 768px) {
    .popup-contenido {
        width: 95vw;
        /* Casi todo el ancho de pantalla */
        max-height: 90vh;
        /* Para que no se salga de la pantalla */
    }

    .table-card {
        padding: 10px;
        /* Menos padding en móvil */
    }

    table {
        min-width: 600px;
        /* Obliga a que la tabla sea scrolleable */
    }

    thead .cat-name {
        font-size: 13px;
        /* Texto un poco más pequeño en móviles */
    }

    thead .cat-sub {
        font-size: 10px;
    }

    tbody td,
    tbody th {
        padding: 10px 8px;
        font-size: 12px;
        /* Texto más legible para dedos */
    }
}

/* Ajustes para pantallas extra pequeñas (ej. teléfonos angostos) */
@media (max-width: 480px) {
    .cerrar-popup {
        font-size: 30px;
        top: -2px;
        right: 94%;
    }

    .cat-name {
        font-size: 11px !important;
    }
}

.table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Hace que el scroll en móvil sea suave */
}
