:root {
    --azul-1: #0b3d84;
    --azul-2: #0a4f9d;
    --azul-3: #124b8d;
    --azul-4: #0c3b72;
    --azul-texto: #17395e;
    --gris-borde: #c8d4e2;
    --gris-fondo: rgba(236, 242, 248, 0.94);
    --card: rgba(243, 247, 251, 0.94);
    --dorado-1: #e5ad34;
    --dorado-2: #cf8d14;
    --verde-1: #4f9d6d;
    --verde-2: #3e8058;
    --naranja-1: #ef9b22;
    --naranja-2: #d8840f;
    --sombra: 0 10px 24px rgba(0, 0, 0, 0.14);
    --radio: 12px;
    --radio-sm: 8px;
    --rojo-suave: #f4d8d8;
    --rojo-texto: #c74f45;
    --verde-suave: #dcebe4;
    --verde-texto: #347a5b;
    --azul-suave: #d9e4f7;
    --azul-badge: #1f5898;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    width: 100%;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--azul-texto);
    background: #CED3E5;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

h1,
h2,
h3 {
    font-family: Arial, Helvetica, sans-serif;
}

.results-page {
    width: min(96%, 1380px);
    margin: 14px auto 24px;
}

.results-card {
    background: var(--card);
    border: 1px solid rgba(123, 157, 194, 0.55);
    border-radius: var(--radio);
    overflow: hidden;
    box-shadow: var(--sombra);
}

/* =========================
   RESUMEN PACIENTE
========================= */
.patient-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px 14px;
    background: linear-gradient(180deg, var(--azul-3) 0%, var(--azul-4) 100%);
    color: #ffffff;
}

.patient-summary__name {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.patient-summary__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.86rem;
    line-height: 1.4;
    opacity: 0.96;
}

.patient-summary__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.patient-summary__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 700;
    transition: background 0.18s ease;
}

.patient-summary__back:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =========================
   TABS
========================= */
.results-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 12px 0;
    background: rgba(215, 226, 241, 0.82);
}

.results-tab {
    min-height: 42px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px 8px 0 0;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
    opacity: 0.88;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.results-tab:hover {
    opacity: 1;
}

.results-tab.is-active {
    opacity: 1;
    transform: translateY(-1px);
}

.results-tab--blue {
    background: linear-gradient(180deg, #124b8d 0%, #0c3b72 100%);
}

.results-tab--gold {
    background: linear-gradient(180deg, var(--dorado-1) 0%, var(--dorado-2) 100%);
}

.results-tab--green {
    background: linear-gradient(180deg, var(--verde-1) 0%, var(--verde-2) 100%);
}

/* =========================
   INFO SUPERIOR
========================= */
.info-box {
    margin: 0 12px;
    background: #ffffff;
    border: 1px solid var(--gris-borde);
    border-radius: 0 0 10px 10px;
    padding: 12px 14px;
    color: var(--azul-texto);
}

.info-box--single {
    margin-top: 0;
    margin-bottom: 14px;
}

.info-box h3 {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--azul-3);
}

.info-box p {
    font-size: 0.93rem;
    line-height: 1.5;
}

/* =========================
   SECCIÓN RESULTADOS
========================= */
.results-section {
    padding: 0 12px 16px;
}

.results-section__title {
    color: var(--azul-3);
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #aec2d8;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    -webkit-overflow-scrolling: touch;
}

.table-wrap::-webkit-scrollbar {
    height: 14px;
}

.table-wrap::-webkit-scrollbar-track {
    background: rgba(198, 211, 227, 0.95);
    border-radius: 20px;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d89c17 0%, #b67b0a 100%);
    border-radius: 20px;
    border: 2px solid rgba(198, 211, 227, 0.95);
}

table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    text-align: center;
    background: #ffffff;
}

#tablaAuditiva,
#tablaVisual {
    min-width: 1180px;
}

#tablaResultados {
    min-width: 920px;
}

th {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 10px 8px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid #8ba9ca;
    white-space: normal;
    line-height: 1.25;
    background: linear-gradient(180deg, #124b8d 0%, #0c3b72 100%);
}

td {
    padding: 10px 8px;
    border: 1px solid #cad6e3;
    background: rgba(255, 255, 255, 0.96);
    color: #27486f;
    font-size: 0.85rem;
    line-height: 1.35;
    text-align: center;
    vertical-align: middle;
}

tr:nth-child(even) td {
    background: #f1f5fa;
}

/* tabla general por bloques de color */
#tablaResultados th:nth-child(1),
#tablaResultados th:nth-child(2),
#tablaResultados th:nth-child(3) {
    background: linear-gradient(180deg, #5e87c5 0%, #5e93c5 100%);
}

#tablaResultados th:nth-child(4),
#tablaResultados th:nth-child(5),
#tablaResultados th:nth-child(6) {
    background: linear-gradient(180deg, #124b8d 0%, #0c3b72 100%);
    
}

#tablaResultados th:nth-child(7),
#tablaResultados th:nth-child(8),
#tablaResultados th:nth-child(9) {
    background: linear-gradient(180deg, var(--verde-1) 0%, var(--verde-2) 100%);
}

#tablaResultados th:nth-child(10),
#tablaResultados th:nth-child(11),
#tablaResultados th:nth-child(12) {
    background: linear-gradient(180deg, var(--naranja-1) 0%, var(--naranja-2) 100%);
}

#tablaResultados td:nth-child(4),
#tablaResultados td:nth-child(5),
#tablaResultados td:nth-child(6) {
    background: rgba(52, 173, 229, 0.12);
}

#tablaResultados td:nth-child(7),
#tablaResultados td:nth-child(8),
#tablaResultados td:nth-child(9) {
    background: rgba(79, 157, 109, 0.12);
}

#tablaResultados td:nth-child(10),
#tablaResultados td:nth-child(11),
#tablaResultados td:nth-child(12) {
    background: rgba(239, 155, 34, 0.15);
}

/* =========================
   BADGES
========================= */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    background: #edf2f7;
    color: #5c6e86;
    white-space: nowrap;
}

.status-badge--normal {
    background: var(--verde-suave);
    color: var(--verde-texto);
}

.status-badge--deficiente {
    background: var(--rojo-suave);
    color: var(--rojo-texto);
}

.status-badge--acelerado {
    background: var(--azul-suave);
    color: var(--azul-badge);
}

/* =========================
   OBSERVACIONES
========================= */
.observations-panel {
    margin-top: 14px;
}

.observations-panel h3 {
    color: var(--azul-3);
    font-size: 0.96rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.observations-box {
    min-height: 86px;
    border: 1px solid #9db5d0;
    background: #ffffff;
    border-radius: 4px;
    padding: 12px;
}

.observations-box p {
    color: #27486f;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

.observations-box p:last-child {
    margin-bottom: 0;
}

/* =========================
   RESPONSIVE TABLET
========================= */
@media (max-width: 1024px) {
    .results-page {
        width: min(98%, 1380px);
    }

    .patient-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .patient-summary__name {
        font-size: 1.5rem;
    }

    .results-tabs {
        flex-direction: column;
        gap: 6px;
    }

    .results-tab {
        width: 100%;
        border-radius: 8px;
    }

    th,
    td {
        font-size: 0.8rem;
        padding: 9px 7px;
    }
}

/* =========================
   RESPONSIVE CELULAR
========================= */
@media (max-width: 680px) {
    .results-page {
        width: min(96%, 1380px);
        margin: 12px auto 24px;
    }

    .patient-summary {
        padding: 14px 12px;
    }

    .patient-summary__name {
        font-size: 1.18rem;
    }

    .patient-summary__meta {
        flex-direction: column;
        gap: 4px;
        font-size: 0.8rem;
    }

    .results-tabs {
        padding: 12px 10px 0;
    }

    .results-section {
        padding: 0 10px 14px;
    }

    .info-box {
        margin: 0 10px 12px;
    }

    th,
    td {
        font-size: 0.76rem;
        padding: 8px 6px;
    }

    .status-badge {
        min-width: 74px;
        font-size: 0.8rem;
    }
}