:root {
    --azul: #0f3d5e;
    --azul-oscuro: #09283f;
    --celeste: #e8f4fb;
    --gris: #f4f6f8;
    --texto: #1f2933;
    --verde: #1f9d55;
    --rojo: #c53030;
    --naranja: #dd6b20;
    --borde: #d9e2ec;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
    zoom: 80%;
    /* Con zoom activo, "vh" en este motor no se recalcula sobre el viewport
       ya escalado (queda basado en el tamaño real, no en el visual). Por eso
       toda regla que use 100vh en este proyecto usa 125vh (100/0.8) para
       compensar exactamente el 80% de zoom de arriba. Si cambias el zoom,
       recalcula ese número (100 / zoom) en los 5 lugares que usan *vh:
       styles.css (este archivo), base.html, login.html, recuperar_clave.html
       y restablecer_clave.html. */
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    background: var(--gris);
    color: var(--texto);
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--borde);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand span {
    display: block;
    font-size: 13px;
    color: #66788a;
}

.logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--azul);
    color: white;
    display: grid;
    place-items: center;
    font-weight: bold;
    font-size: 22px;
}

nav a {
    margin-left: 18px;
    text-decoration: none;
    color: var(--azul);
    font-weight: bold;
}

.btn-salir {
    color: var(--rojo);
}

.nav-docente {
    background: #eff6ff;
    color: #1d4ed8 !important;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
}

.nav-admin {
    background: #f5f3ff;
    color: #4a2178 !important;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px;
}

/* generales */
.hero {
    background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
    color: white;
    padding: 32px;
    border-radius: 18px;
    margin-bottom: 24px;
}

.hero h1 {
    margin-top: 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.card,
.panel,
.caso-card,
.login-card,
.resultado-box,
.tabla-section {
    background: white;
    border-radius: 18px;
    padding: 24px;
    border: 1px solid var(--borde);
    box-shadow: 0 8px 22px rgba(15, 61, 94, 0.06);
}

.numero {
    font-size: 42px;
    margin: 0;
    font-weight: bold;
    color: var(--azul);
}

.estado {
    font-size: 22px;
    font-weight: bold;
    color: var(--verde);
}

.btn-principal,
.btn-secundario,
.btn-finalizar,
button {
    display: inline-block;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: bold;
    margin-top: 12px;
    font-family: inherit;
}

.btn-principal,
button {
    background: var(--azul);
    color: white;
}

.btn-secundario {
    background: var(--celeste);
    color: var(--azul);
}

.btn-finalizar {
    background: var(--verde);
    color: white;
    width: 100%;
    text-align: center;
}

/* login */
.login-wrapper {
    min-height: 70vh;
    display: grid;
    place-items: center;
}

.login-card {
    max-width: 420px;
    width: 100%;
}

.login-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    margin-bottom: 14px;
}

.login-card label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.demo-box {
    background: var(--celeste);
    padding: 14px;
    border-radius: 12px;
    margin-top: 18px;
    font-size: 14px;
}

/* casos */
.grid-casos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.tag {
    display: inline-block;
    background: var(--celeste);
    color: var(--azul);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

/* mensajes */
.mensajes {
    margin-bottom: 18px;
}

.mensaje {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.mensaje.success {
    background: #e6ffed;
    color: #1f7a3f;
}

.mensaje.error {
    background: #ffe6e6;
    color: #9b1c1c;
}

/* resultados */
.puntaje {
    font-size: 52px;
    font-weight: bold;
    color: var(--azul);
    margin: 8px 0;
}

/* ── Calificación destacada (páginas de resultado) ── */
.calif-destacada {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    border: 2px solid;
    border-radius: 16px;
    padding: 22px 28px;
    margin: 4px 0 20px;
}
.calif-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    opacity: .85;
}
.calif-nota {
    font-size: 72px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}
.calif-max {
    font-size: 24px;
    font-weight: 700;
    opacity: .45;
    margin-left: 8px;
}
.calif-badge {
    display: inline-block;
    padding: 6px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #fff;
}
.calif-aprob {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #16a34a;
    color: #15803d;
}
.calif-aprob .calif-badge { background: #16a34a; }
.calif-reprob {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-color: #dc2626;
    color: #b91c1c;
}
.calif-reprob .calif-badge { background: #dc2626; }

.puntaje-sub {
    font-size: 16px;
    color: #64748b;
    margin: 0 0 12px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--borde);
    text-align: left;
}

th {
    background: var(--celeste);
    color: var(--azul);
}

.estado-correcto {
    color: var(--verde);
    font-weight: bold;
}

.estado-revisar {
    color: var(--naranja);
    font-weight: bold;
}

.estado-no-registrado {
    color: var(--rojo);
    font-weight: bold;
}

.estado-sin-respuesta {
    color: #5e2b97;
    font-weight: bold;
}

.estado-vo-penalizada {
    color: var(--rojo);
    font-weight: bold;
}

.estado-no-evaluado {
    color: #6b7280;
    font-weight: 600;
}

/* caso compacto */
.caso-compacto {
    background: white;
    border: 1px solid var(--borde);
    border-radius: 18px;
    padding: 14px 18px;
    margin-bottom: 14px;
    box-shadow: 0 8px 20px rgba(15, 61, 94, 0.06);
}

.caso-compacto-inner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.caso-compacto-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2.5px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    background: #f1f5f9;
}

.caso-compacto h1 {
    font-size: 21px;
    margin: 0 0 8px 0;
    color: var(--azul);
}

.caso-compacto p {
    margin: 4px 0;
    font-size: 14px;
}

/* layout simulador */
.simulador-screen {
    display: grid;
    grid-template-columns: minmax(620px, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.audiograma-workspace {
    background: white;
    border: 1px solid var(--borde);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 10px 26px rgba(15, 61, 94, 0.07);
    min-width: 0;
}

.audiograma-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.audiograma-toolbar h2 {
    margin: 0;
    color: var(--azul);
}

.audiograma-toolbar p {
    margin: 4px 0 0 0;
    color: #66788a;
    font-size: 14px;
}

.estado-actual-mini {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.estado-actual-mini span {
    border: 1px solid #cde7f7;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    background: #eef6fb;
    color: #174565;
}

.od-tag {
    background: #fdecec !important;
    color: #b42318 !important;
    border-color: #f5c2c7 !important;
}

.oi-tag {
    background: #eaf3ff !important;
    color: #0b5ed7 !important;
    border-color: #bfd6ff !important;
}

.canvas-wrapper {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--borde);
    border-radius: 16px;
    background: white;
}

.canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(125vh - 250px);   /* 125vh = compensación del zoom:80% del html */
    min-height: 410px;
}

.leyenda-audiograma {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
    font-size: 14px;
}

.leyenda-audiograma .rojo {
    color: #c53030;
}

.leyenda-audiograma .azul {
    color: #1f5fbf;
}

/* panel audiometría azulado */
.audiometro-lateral {
    background: linear-gradient(160deg, #1d4f6b 0%, #12384f 45%, #0b2434 100%);
    color: white;
    border-radius: 22px;
    padding: 16px;
    border: 1px solid #2d6685;
    box-shadow: 0 18px 38px rgba(9, 36, 52, 0.28);
    position: sticky;
    top: 12px;
}

.aud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.aud-header h2 {
    margin: 0;
    font-size: 22px;
}

.aud-header p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: #d4e6f2;
}

.luz-estimulo-mini {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #2f5568;
    border: 2px solid #7ba8c0;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.7);
}

.luz-estimulo-mini.activo {
    background: #facc15;
    border-color: #fde68a;
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.95);
}

.aud-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: rgba(6, 28, 42, 0.7);
    border: 1px solid #356888;
    padding: 10px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.aud-display div {
    background: rgba(12, 43, 63, 0.9);
    border: 1px solid #356888;
    border-radius: 12px;
    padding: 9px;
}

.aud-display span {
    display: block;
    font-size: 11px;
    color: #bdd8e7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
}

.aud-display strong {
    display: block;
    font-size: 17px;
    color: #d9f1ff;
}

.od-texto {
    color: #ffb3b3 !important;
}

.oi-texto {
    color: #9fd0ff !important;
}

/* guía */
.guia-hw-box {
    background: rgba(6, 28, 42, 0.7);
    border: 1px solid #356888;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.guia-hw-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.guia-hw-header strong {
    display: block;
    color: #f8fafc;
    font-size: 14px;
}

.guia-hw-header span {
    display: block;
    color: #bdd8e7;
    font-size: 11px;
    margin-top: 2px;
}

.switch-guia {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch-guia input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-guia span {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #55809a;
    border-radius: 999px;
    transition: 0.2s;
}

.switch-guia span:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.switch-guia input:checked + span {
    background: #16a34a;
}

.switch-guia input:checked + span:before {
    transform: translateX(20px);
}

.panel-guia-hw {
    margin-top: 10px;
    background: rgba(11, 37, 54, 0.95);
    border: 1px solid #356888;
    border-radius: 12px;
    padding: 10px;
}

.panel-guia-hw.oculta {
    display: none;
}

.panel-guia-hw p {
    margin: 0 0 8px 0;
    color: #e8f4fb;
    font-size: 12px;
    line-height: 1.35;
}

.guia-hw-estado {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.guia-hw-estado span {
    background: rgba(5, 22, 33, 0.95);
    border: 1px solid #356888;
    color: #d2e8f4;
    border-radius: 8px;
    padding: 6px;
    font-size: 11px;
    text-align: center;
}

#sugerenciaHW {
    color: #ffd76a;
    font-weight: bold;
}

/* respuesta */
.respuesta-lateral {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    align-items: center;
    background: rgba(6, 28, 42, 0.7);
    border: 1px solid #356888;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.luz-respuesta {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #375b70;
    border: 2px solid #7ba8c0;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.7);
}

.luz-respuesta.responde {
    background: #22c55e;
    border-color: #bbf7d0;
    box-shadow: 0 0 22px rgba(34, 197, 94, 0.95);
}

.luz-respuesta.no-responde {
    background: #ef4444;
    border-color: #fecaca;
    box-shadow: 0 0 22px rgba(239, 68, 68, 0.9);
}

.luz-respuesta.registrado {
    background: #38bdf8;
    border-color: #bae6fd;
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.9);
}

.luz-respuesta.advertencia {
    background: #f59e0b;
    border-color: #fed7aa;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.9);
}

.respuesta-lateral span {
    display: block;
    color: #bdd8e7;
    font-size: 12px;
    margin-bottom: 4px;
}

.respuesta-lateral strong {
    display: block;
    font-size: 18px;
    color: #f8fafc;
}

/* estímulo */
.boton-estimulo-grande {
    width: 100%;
    background: #c73a3a;
    color: white;
    border: 2px solid #ffd0d0;
    border-radius: 18px;
    padding: 16px 12px;
    font-size: 17px;
    font-weight: bold;
    margin: 0 0 14px 0;
    box-shadow: 0 8px 20px rgba(199, 58, 58, 0.35);
}

.boton-estimulo-grande.presionando {
    transform: scale(0.98);
    filter: brightness(1.08);
    box-shadow: 0 0 24px rgba(199, 58, 58, 0.65);
}

.boton-estimulo-grande small,
.boton-registrar-umbral small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: normal;
    opacity: 0.85;
}

/* controles */
.bloque-control {
    margin-bottom: 12px;
}

.bloque-control h3 {
    font-size: 13px;
    margin: 0 0 8px 0;
    color: #e8f4fb;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.intensidad-control-compacto {
    display: grid;
    grid-template-columns: 48px 48px 1fr 48px 48px;
    gap: 6px;
    align-items: center;
}

.intensidad-control-compacto button,
.frecuencia-control-compacto button,
.frecuencias-rapidas button,
.botones-dos-columnas button {
    background: #2e5b75;
    color: white;
    border: 1px solid #4e84a3;
    border-radius: 12px;
    padding: 10px 6px;
    font-weight: bold;
    margin: 0;
}

.dial-db {
    background: radial-gradient(circle, #5f8aa4, #0d2d40);
    border: 4px solid #7aa8c2;
    border-radius: 50%;
    width: 92px;
    height: 92px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    text-align: center;
    box-shadow: inset 0 0 18px rgba(0,0,0,0.7);
}

.dial-db strong {
    font-size: 30px;
    color: #ffe169;
    line-height: 1;
}

.dial-db span {
    display: block;
    font-size: 11px;
    color: #e5f4fd;
}

.frecuencia-control-compacto {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.freq-central {
    background: rgba(7, 28, 41, 0.9);
    border: 1px solid #4f87a7;
    border-radius: 14px;
    text-align: center;
    padding: 10px;
}

.freq-central strong {
    display: block;
    font-size: 30px;
    color: #b9d9ff;
    line-height: 1;
}

.freq-central span {
    display: block;
    font-size: 12px;
    color: #d7eaf6;
}

.frecuencias-rapidas {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
}

.frecuencias-rapidas button {
    font-size: 12px;
    padding: 8px 4px;
}

.frecuencias-rapidas button.activo {
    background: #5c6fd6;
    border-color: #cad2ff;
    box-shadow: 0 0 12px rgba(92, 111, 214, 0.6);
}

.frecuencias-rapidas button.deshabilitado {
    opacity: 0.35;
    cursor: not-allowed;
}

.botones-dos-columnas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.botones-dos-columnas button {
    font-size: 17px;
    padding: 12px 8px;
}

.od-boton.activo {
    background: #b93131 !important;
    border-color: #ffc7c7 !important;
    box-shadow: 0 0 12px rgba(185, 49, 49, 0.45);
}

.oi-boton.activo {
    background: #1769c7 !important;
    border-color: #b9dbff !important;
    box-shadow: 0 0 12px rgba(23, 105, 199, 0.45);
}

#btnAerea.activo,
#btnOsea.activo {
    background: #0ea5e9;
    border-color: #7dd3fc;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.5);
}

.registro-extra {
    background: rgba(6, 28, 42, 0.65);
    border: 1px solid #356888;
    border-radius: 12px;
    padding: 10px;
}

.check-nr {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e8f4fb;
    font-size: 13px;
}

.check-nr input {
    transform: scale(1.1);
}

.boton-registrar-umbral {
    width: 100%;
    background: #18a05f;
    color: white;
    border: 2px solid #bdf5d7;
    border-radius: 16px;
    padding: 13px 10px;
    font-size: 15px;
    font-weight: bold;
    margin: 0 0 10px 0;
}

.atajos-compactos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 11px;
    color: #d7ebf6;
    margin-bottom: 12px;
}

.atajos-compactos span {
    background: rgba(7, 28, 41, 0.9);
    border: 1px solid #356888;
    border-radius: 8px;
    padding: 6px;
    text-align: center;
}

.boton-finalizar-examen {
    display: block;
    text-align: center;
    text-decoration: none;
    background: #f0a71a;
    color: #102331;
    border-radius: 14px;
    padding: 12px;
    font-weight: bold;
}

/* responsive */
@media (max-width: 1100px) {
    .simulador-screen {
        grid-template-columns: 1fr;
    }

    .audiometro-lateral {
        position: static;
        order: -1;
    }

    .canvas-wrapper canvas {
        max-height: none;
        min-height: 360px;
    }

    .cards,
    .grid-casos {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .container {
        padding: 14px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    nav a {
        margin-left: 0;
        margin-right: 14px;
    }

    .audiograma-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .estado-actual-mini {
        justify-content: flex-start;
    }

    .intensidad-control-compacto {
        grid-template-columns: 1fr 1fr;
    }

    .dial-db {
        grid-column: span 2;
        order: -1;
    }
}

/* =========================
   AJUSTE PANEL AZUL CLARO CLÍNICO
========================= */

.audiometro-lateral {
    background: linear-gradient(160deg, #eef9ff 0%, #d8eefb 45%, #c7e4f3 100%) !important;
    color: #12384f !important;
    border: 1px solid #9fc9dd !important;
    box-shadow: 0 18px 38px rgba(46, 103, 132, 0.22) !important;
}

.aud-header h2 {
    color: #0f3d5e !important;
}

.aud-header p {
    color: #426b81 !important;
}

.aud-display {
    background: rgba(255, 255, 255, 0.72) !important;
    border: 1px solid #aacfe1 !important;
}

.aud-display div {
    background: #ffffff !important;
    border: 1px solid #b8d8e8 !important;
}

.aud-display span {
    color: #52758a !important;
}

.aud-display strong {
    color: #0f3d5e !important;
}

.guia-hw-box,
.respuesta-lateral,
.registro-extra {
    background: rgba(255, 255, 255, 0.72) !important;
    border: 1px solid #aacfe1 !important;
}

.guia-hw-header strong,
.bloque-control h3 {
    color: #0f3d5e !important;
}

.guia-hw-header span,
.respuesta-lateral span,
.check-nr {
    color: #426b81 !important;
}

.panel-guia-hw {
    background: #f7fcff !important;
    border: 1px solid #b8d8e8 !important;
}

.panel-guia-hw p {
    color: #12384f !important;
}

.guia-hw-estado span {
    background: #ffffff !important;
    border: 1px solid #c7deea !important;
    color: #365f76 !important;
}

#sugerenciaHW {
    color: #0f7a9d !important;
}

.respuesta-lateral strong {
    color: #12384f !important;
}

.luz-estimulo-mini {
    background: #d4e7f2 !important;
    border: 2px solid #7ba8c0 !important;
}

.luz-estimulo-mini.activo {
    background: #facc15 !important;
    border-color: #fde68a !important;
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.95) !important;
}

.luz-respuesta {
    background: #d4e7f2 !important;
    border: 2px solid #7ba8c0 !important;
}

.luz-respuesta.responde {
    background: #22c55e !important;
    border-color: #bbf7d0 !important;
}

.luz-respuesta.no-responde {
    background: #ef4444 !important;
    border-color: #fecaca !important;
}

.luz-respuesta.registrado {
    background: #38bdf8 !important;
    border-color: #bae6fd !important;
}

.luz-respuesta.advertencia,
.luz-respuesta.esperando {
    background: #f59e0b !important;
    border-color: #fed7aa !important;
}

.instrucciones-teclado-panel {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid #aacfe1;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.instrucciones-teclado-panel h3 {
    margin: 0 0 10px 0;
    color: #0f3d5e;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tecla-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.tecla-grid div {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
    background: #f7fcff;
    border: 1px solid #c7deea;
    border-radius: 10px;
    padding: 7px;
    font-size: 12px;
    color: #12384f;
}

.tecla-grid kbd {
    display: inline-block;
    background: #0f3d5e;
    color: white;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: bold;
    min-width: 28px;
    text-align: center;
}

.tecla-grid span {
    color: #12384f;
}

.boton-estimulo-grande {
    background: #c73a3a !important;
    border: 2px solid #ffd0d0 !important;
    color: white !important;
}

.boton-registrar-umbral {
    background: #16855a !important;
    border: 2px solid #bdf5d7 !important;
}

.boton-finalizar-examen {
    background: #f0a71a !important;
    color: #102331 !important;
}

.botones-dos-columnas button {
    background: #d8eefb !important;
    color: #0f3d5e !important;
    border: 1px solid #9fc9dd !important;
}

.od-boton.activo {
    background: #b93131 !important;
    color: white !important;
    border-color: #ffc7c7 !important;
}

.oi-boton.activo {
    background: #1769c7 !important;
    color: white !important;
    border-color: #b9dbff !important;
}

#btnAerea.activo,
#btnOsea.activo {
    background: #0ea5e9 !important;
    color: white !important;
    border-color: #7dd3fc !important;
}

/* =========================
   BARRA SUPERIOR DE TECLADO
========================= */

.barra-teclado-superior {
    background: #f7fcff;
    border: 1px solid #b8d8e8;
    border-radius: 16px;
    margin-bottom: 14px;
    box-shadow: 0 8px 18px rgba(15, 61, 94, 0.05);
    overflow: hidden;
}

.barra-teclado-superior summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.barra-teclado-superior summary::-webkit-details-marker {
    display: none;
}

.barra-teclado-superior summary strong {
    color: #0f3d5e;
    font-size: 15px;
}

.barra-teclado-superior summary span {
    color: #52758a;
    font-size: 13px;
}

.teclado-ayuda-horizontal {
    border-top: 1px solid #d7eaf6;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.teclado-ayuda-horizontal div {
    display: flex;
    align-items: center;
    gap: 7px;
    background: white;
    border: 1px solid #c7deea;
    border-radius: 10px;
    padding: 8px;
    font-size: 12px;
    color: #12384f;
}

.teclado-ayuda-horizontal kbd {
    display: inline-block;
    background: #0f3d5e;
    color: white;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: bold;
    min-width: 28px;
    text-align: center;
}

.teclado-ayuda-horizontal span {
    color: #12384f;
}

@media (max-width: 1100px) {
    .teclado-ayuda-horizontal {
        grid-template-columns: repeat(2, 1fr);
    }

    .barra-teclado-superior summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 600px) {
    .teclado-ayuda-horizontal {
        grid-template-columns: 1fr;
    }
}

/* =========================
   ENMASCARAMIENTO
========================= */

.enmascaramiento-box {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #aacfe1;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.enmascaramiento-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.enmascaramiento-header strong {
    display: block;
    color: #0f3d5e;
    font-size: 14px;
}

.enmascaramiento-header span {
    display: block;
    color: #426b81;
    font-size: 11px;
    margin-top: 2px;
}

.panel-enmascaramiento {
    margin-top: 10px;
}

.panel-enmascaramiento.oculta {
    display: none;
}

.mask-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.mask-display div {
    background: #ffffff;
    border: 1px solid #b8d8e8;
    border-radius: 12px;
    padding: 9px;
}

.mask-display span {
    display: block;
    color: #52758a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.mask-display strong {
    color: #0f3d5e;
    font-size: 15px;
}

.mask-instruccion {
    background: #f7fcff;
    border: 1px solid #c7deea;
    border-radius: 12px;
    padding: 9px;
    margin-bottom: 10px;
}

.mask-instruccion p {
    margin: 0;
    font-size: 12px;
    color: #12384f;
    line-height: 1.35;
}

.mask-instruccion kbd {
    background: #0f3d5e;
    color: white;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
}

.boton-registrar-mask {
    width: 100%;
    background: #0f7a9d !important;
    color: white !important;
    border: 1px solid #9bd8ef !important;
    border-radius: 14px;
    padding: 11px;
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: bold;
}

.estado-plateau {
    border-radius: 12px;
    padding: 9px;
    font-size: 12px;
    line-height: 1.35;
}

.estado-plateau.pendiente {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

.estado-plateau.logrado {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-weight: bold;
}

.tabla-enmascaramiento-section {
    background: white;
    border: 1px solid var(--borde);
    border-radius: 18px;
    padding: 18px;
    margin-top: 18px;
    box-shadow: 0 8px 20px rgba(15, 61, 94, 0.06);
}

.tabla-header h2 {
    margin: 0;
    color: var(--azul);
}

.tabla-header p {
    margin: 4px 0 14px 0;
    color: #66788a;
    font-size: 14px;
}

.tabla-scroll {
    overflow-x: auto;
}

.tabla-scroll table {
    min-width: 900px;
}

/* =========================
   CONTROLES DE TECLADO MÁS VISIBLES
========================= */

.barra-teclado-superior {
    background: linear-gradient(135deg, #e3f4ff, #f7fcff) !important;
    border: 1px solid #7fb7d6 !important;
    box-shadow: 0 8px 20px rgba(15, 61, 94, 0.10) !important;
}

.barra-teclado-superior summary {
    background: #d9effb !important;
    border-left: 6px solid #0f7a9d !important;
}

.barra-teclado-superior summary strong {
    color: #0f3d5e !important;
    font-size: 16px !important;
}

.barra-teclado-superior summary span {
    color: #24566f !important;
    font-weight: 600 !important;
}

.teclado-ayuda-horizontal {
    background: #f7fcff !important;
}

.teclado-ayuda-horizontal div {
    background: white !important;
    border: 1px solid #9fc9dd !important;
}

.teclado-ayuda-horizontal kbd {
    background: #0f7a9d !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(15, 61, 94, 0.18);
}

.teclado-ayuda-horizontal span {
    color: #12384f !important;
    font-weight: 500;
}

/* =========================
   BOTÓN SIN RESPUESTA
========================= */

.boton-sin-respuesta {
    width: 100%;
    margin-top: 10px;
    background: #eef6fb !important;
    color: #0f3d5e !important;
    border: 1px solid #9fc9dd !important;
    border-radius: 12px;
    padding: 10px;
    font-size: 13px;
    font-weight: bold;
}

.boton-sin-respuesta small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: normal;
    color: #426b81;
}

.boton-sin-respuesta.activo {
    background: #fff7ed !important;
    color: #9a3412 !important;
    border-color: #fb923c !important;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.18);
}

.boton-sin-respuesta.activo small {
    color: #9a3412;
}

/* =========================
   AYUDAS FUERA DEL PANEL OPERATIVO
========================= */

.ayudas-simulador {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.ayuda-card-hw {
    margin-bottom: 0 !important;
    background: #ffffff !important;
    border: 1px solid #8fc5df !important;
    box-shadow: 0 10px 24px rgba(15, 61, 94, 0.10) !important;
}

.ayuda-card-hw .guia-hw-header strong {
    color: #0f3d5e !important;
    font-size: 15px !important;
}

.ayuda-card-hw .guia-hw-header span {
    color: #426b81 !important;
}

.ayuda-card-hw .panel-guia-hw {
    background: #f7fcff !important;
    border: 1px solid #c7deea !important;
}

.ayuda-card-hw .panel-guia-hw p {
    color: #12384f !important;
}

/* =========================
   INTEGRACIÓN GRÁFICO + AUDIÓMETRO
========================= */

.simulador-screen {
    background: linear-gradient(135deg, #ffffff 0%, #f4fbff 100%);
    border: 1px solid #b8d8e8;
    border-radius: 26px;
    padding: 16px;
    box-shadow: 0 14px 34px rgba(15, 61, 94, 0.12);
    gap: 0 !important;
    grid-template-columns: minmax(620px, 1fr) 360px;
    overflow: hidden;
}

.audiograma-workspace {
    border-radius: 20px 0 0 20px !important;
    border: 1px solid #c7deea !important;
    border-right: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

.audiometro-lateral {
    border-radius: 0 20px 20px 0 !important;
    border-left: 1px solid #9fc9dd !important;
    box-shadow: none !important;
    position: sticky;
    top: 12px;
    min-height: 100%;
}

/* Separador clínico entre gráfico y panel */
.audiometro-lateral::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 18px;
    bottom: 18px;
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent,
        #8fc5df,
        transparent
    );
}

/* El panel queda más operativo y menos recargado */
.audiometro-lateral .aud-display,
.audiometro-lateral .respuesta-lateral,
.audiometro-lateral .enmascaramiento-box,
.audiometro-lateral .registro-extra {
    box-shadow: 0 6px 16px rgba(15, 61, 94, 0.06);
}

/* =========================
   TARJETA DE CONTROLES MÁS AUTÓNOMA
========================= */

.barra-teclado-superior {
    margin-bottom: 0 !important;
    background: #ffffff !important;
    border: 1px solid #8fc5df !important;
    box-shadow: 0 10px 24px rgba(15, 61, 94, 0.10) !important;
}

.barra-teclado-superior summary {
    background: linear-gradient(135deg, #d9effb, #edf9ff) !important;
    border-left: 6px solid #0f7a9d !important;
    border-radius: 16px 16px 0 0;
}

.teclado-ayuda-horizontal {
    background: #ffffff !important;
}

.teclado-ayuda-horizontal div {
    background: #f7fcff !important;
    border: 1px solid #c7deea !important;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .ayudas-simulador {
        grid-template-columns: 1fr;
    }

    .simulador-screen {
        grid-template-columns: 1fr;
        gap: 16px !important;
        padding: 14px;
    }

    .audiograma-workspace {
        border-radius: 20px !important;
        border-right: 1px solid #c7deea !important;
    }

    .audiometro-lateral {
        border-radius: 20px !important;
        position: static;
    }

    .audiometro-lateral::before {
        display: none;
    }
}

/* =========================
   AYUDAS EN TRES TARJETAS
========================= */

.ayudas-simulador-tres {
    display: grid !important;
    grid-template-columns: 1.35fr 1fr 1fr !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
    align-items: stretch !important;
}

.ayuda-card-enmascaramiento {
    background: #ffffff;
    border: 1px solid #8fc5df;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 61, 94, 0.10);
    padding: 12px;
}

.ayuda-mask-header strong {
    display: block;
    color: #0f3d5e;
    font-size: 15px;
}

.ayuda-mask-header span {
    display: block;
    color: #426b81;
    font-size: 11px;
    margin-top: 2px;
}

.ayuda-mask-contenido {
    margin-top: 10px;
    background: #f7fcff;
    border: 1px solid #c7deea;
    border-radius: 12px;
    padding: 10px;
}

.ayuda-mask-contenido p {
    margin: 0 0 8px 0;
    color: #12384f;
    font-size: 12px;
    line-height: 1.35;
}

.ayuda-mask-contenido p:last-child {
    margin-bottom: 0;
}

.ayuda-mask-contenido kbd {
    background: #0f3d5e;
    color: white;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
}

/* =========================
   DISPLAY ENMASCARAMIENTO ARRIBA
========================= */

.aud-display {
    grid-template-columns: 1fr 1fr !important;
}

.aud-display-mask {
    background: #f7fcff !important;
    border: 1px solid #8fc5df !important;
}

.aud-display-mask strong {
    color: #0f7a9d !important;
}

.mini-mask {
    background: #e6f8ff !important;
    color: #0f7a9d !important;
    border-color: #8fc5df !important;
}

.oculto {
    display: none !important;
}

/* =========================
   PANEL ENMASCARAMIENTO MÁS LIMPIO
========================= */

.enmascaramiento-box .panel-enmascaramiento {
    margin-top: 10px;
}

.enmascaramiento-box .boton-registrar-mask {
    margin-bottom: 10px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1200px) {
    .ayudas-simulador-tres {
        grid-template-columns: 1fr !important;
    }
}

/* =========================
   BOTÓN DE CONTROLES DE TECLADO
========================= */

.teclado-control-bar {
    margin-bottom: 16px;
}

.boton-toggle-teclado {
    width: 100%;
    background: linear-gradient(135deg, #0f7a9d, #0f3d5e) !important;
    color: white !important;
    border: 1px solid #9bd8ef !important;
    border-radius: 16px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: bold;
    text-align: left;
    box-shadow: 0 10px 24px rgba(15, 61, 94, 0.16);
}

.boton-toggle-teclado small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: normal;
    opacity: 0.9;
}

.teclado-ayuda-popup {
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #8fc5df;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 24px rgba(15, 61, 94, 0.12);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    position: relative;
    z-index: 5;
}

.teclado-ayuda-popup div {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7fcff;
    border: 1px solid #c7deea;
    border-radius: 10px;
    padding: 8px;
    font-size: 12px;
    color: #12384f;
}

.teclado-ayuda-popup kbd {
    display: inline-block;
    background: #0f3d5e;
    color: white;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: bold;
    min-width: 28px;
    text-align: center;
}

.teclado-ayuda-popup span {
    color: #12384f;
    font-weight: 500;
}

/* =========================
   AYUDAS EN DOS TARJETAS
========================= */

.ayudas-dos {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
    align-items: stretch !important;
}

.ayuda-mask-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.ayuda-card-enmascaramiento {
    background: #ffffff;
    border: 1px solid #8fc5df;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 61, 94, 0.10);
    padding: 12px;
}

.ayuda-mask-header strong {
    display: block;
    color: #0f3d5e;
    font-size: 15px;
}

.ayuda-mask-header span {
    display: block;
    color: #426b81;
    font-size: 11px;
    margin-top: 2px;
}

.ayuda-mask-contenido {
    margin-top: 10px;
    background: #f7fcff;
    border: 1px solid #c7deea;
    border-radius: 12px;
    padding: 10px;
}

.ayuda-mask-contenido.oculta {
    display: none;
}

.ayuda-mask-contenido p {
    margin: 0 0 8px 0;
    color: #12384f;
    font-size: 12px;
    line-height: 1.35;
}

.ayuda-mask-contenido p:last-child {
    margin-bottom: 0;
}

.ayuda-mask-contenido kbd {
    background: #0f3d5e;
    color: white;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
}

/* =========================
   PANEL ENMASCARAMIENTO LIMPIO
========================= */

.enmascaramiento-box .panel-enmascaramiento.oculta {
    display: none;
}

.oculto {
    display: none !important;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1200px) {
    .teclado-ayuda-popup {
        grid-template-columns: repeat(2, 1fr);
    }

    .ayudas-dos {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 650px) {
    .teclado-ayuda-popup {
        grid-template-columns: 1fr;
    }
}

/* =========================
   BOTONES DE EDICIÓN AUDIOGRAMA
========================= */

.bloque-edicion-curva {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid #aacfe1;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.boton-eliminar-umbral,
.boton-eliminar-curva {
    width: 100%;
    border-radius: 14px;
    padding: 11px 10px;
    font-size: 13px;
    font-weight: bold;
    margin: 0 0 8px 0;
}

.boton-eliminar-umbral {
    background: #fff7ed !important;
    color: #9a3412 !important;
    border: 1px solid #fed7aa !important;
}

.boton-eliminar-curva {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

.boton-eliminar-umbral small,
.boton-eliminar-curva small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: normal;
    opacity: 0.85;
}

/* =========================
   TABLA PTP BAJO AUDIOGRAMA
========================= */

.ptp-section {
    margin-top: 16px;
    background: #f7fcff;
    border: 1px solid #b8d8e8;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 6px 16px rgba(15, 61, 94, 0.06);
}

.ptp-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.ptp-header h3 {
    margin: 0;
    color: #0f3d5e;
    font-size: 17px;
}

.ptp-header p {
    margin: 4px 0 0 0;
    color: #52758a;
    font-size: 13px;
}

.boton-calcular-ptp {
    background: #0f7a9d !important;
    color: white !important;
    border: 1px solid #9bd8ef !important;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    margin: 0;
}

.ptp-tabla-wrapper {
    overflow-x: auto;
}

.tabla-ptp {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.tabla-ptp th {
    background: #e8f4fb;
    color: #0f3d5e;
    font-size: 13px;
    padding: 10px;
    border-bottom: 1px solid #c7deea;
}

.tabla-ptp td {
    padding: 10px;
    border-bottom: 1px solid #edf4f8;
    vertical-align: middle;
}

.input-ptp,
.input-ptp-obs {
    width: 100%;
    border: 1px solid #b8d8e8;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    color: #12384f;
    background: #ffffff;
}

.input-ptp {
    max-width: 110px;
}

.input-ptp:focus,
.input-ptp-obs:focus {
    outline: none;
    border-color: #0f7a9d;
    box-shadow: 0 0 0 3px rgba(15, 122, 157, 0.12);
}

.diag-simetria-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 4px 2px;
}

.diag-simetria-row .input-ptp {
    max-width: 160px;
}

.diag-simetria-ayuda {
    font-size: 12px;
    color: #5b7180;
}

.tabla-simetria {
    width: 100%;
    margin-top: 14px;
    border-collapse: collapse;
}

.tabla-simetria th,
.tabla-simetria td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.ptp-nota {
    margin-top: 10px;
    color: #52758a;
    font-size: 12px;
    background: #ffffff;
    border: 1px solid #d7eaf6;
    border-radius: 10px;
    padding: 8px 10px;
}

/* Selector de frecuencias del PTP */
.ptp-frecuencias {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 6px 0 12px;
}
.ptp-frecuencias-label { font-size: 12px; font-weight: 700; color: #52758a; margin-right: 4px; }
.ptp-freq-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: #ffffff; border: 1px solid #d7eaf6; border-radius: 999px;
    padding: 4px 11px; font-size: 12px; color: #335; cursor: pointer; user-select: none;
}
.ptp-freq-chip:has(input:checked) { background: #e3f2fd; border-color: #4a90c2; color: #1a4e72; font-weight: 700; }
.ptp-freq-chip input { accent-color: #2a6f9e; cursor: pointer; }
.diag-aud-section { margin-top: 16px; }

@media (max-width: 800px) {
    .ptp-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .boton-calcular-ptp {
        width: 100%;
    }

    .tabla-ptp {
        min-width: 650px;
    }
}

/* =========================
   UTILIDADES GLOBALES
========================= */

.rojo { color: #c53030; }
.azul { color: #1f5fbf; }

/* =========================
   LISTA DE CASOS — BOTONES
========================= */

.caso-botones {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.caso-botones a {
    margin-top: 0;
    flex: 1;
    text-align: center;
}

/* =========================
   IMPEDANCIOMETRO — DEVICE FRAME
========================= */

.imp-device-frame {
    background: #10202e;
    border-radius: 22px;
    overflow: hidden;
    margin-bottom: 22px;
    box-shadow: 0 24px 56px rgba(9, 36, 52, 0.40);
}

.imp-device-header {
    background: linear-gradient(135deg, #0c1e2d 0%, #162d40 100%);
    border-bottom: 1px solid #1f3f57;
    padding: 14px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.imp-brand {
    display: block;
    font-size: 15px;
    font-weight: bold;
    color: #e2f0f9;
    letter-spacing: 0.1em;
    font-family: monospace;
}

.imp-model {
    display: block;
    font-size: 11px;
    color: #6da8c8;
    margin-top: 3px;
    letter-spacing: 0.04em;
}

.imp-status-badge {
    background: #0a1e2c;
    border: 1px solid #1f4a66;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: bold;
    color: #fcd34d;
    letter-spacing: 0.12em;
    font-family: monospace;
}

/* =========================
   TIMPANOMETRÍA — WORKSPACE
========================= */

.timpanometria-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #10202e;
}

.timpa-panel {
    background: #f7fbfe;
    padding: 18px;
}

.od-device-panel {
    border-right: 2px solid #10202e;
}

/* ── Channel header ── */

.timpa-ch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dce9f3;
}

.timpa-ch-id {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ch-led {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #64748b;
    border: 2px solid #94a3b8;
    display: inline-block;
    flex-shrink: 0;
}

.ch-led.led-ok {
    background: #22c55e;
    border-color: #86efac;
    box-shadow: 0 0 8px rgba(34,197,94,0.75);
}

.ch-nombre {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.06em;
}

.ch-probe-status {
    font-size: 11px;
    font-weight: bold;
    color: #94a3b8;
    font-family: monospace;
    letter-spacing: 0.06em;
}

.ch-probe-status.status-ok {
    color: #16a34a;
}

/* ── Seal step ── */

.timpa-estado-sello {
    background: #eef5fb;
    border: 1px solid #b8d8e8;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
    text-align: center;
}

.sello-icono {
    margin-bottom: 10px;
    opacity: 0.55;
}

.sello-instruccion {
    color: #426b81;
    font-size: 13px;
    line-height: 1.55;
    margin: 0 0 14px 0;
}

.boton-sellar {
    width: 100%;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    font-family: inherit;
    margin: 0 0 10px 0;
    letter-spacing: 0.03em;
    transition: opacity 0.2s;
}

.od-sellar { background: #dc2626; color: white; }
.oi-sellar { background: #2563eb; color: white; }
.boton-sellar:disabled { background: #94a3b8; cursor: not-allowed; }

.sello-loader { margin-top: 4px; }

.sello-loader small {
    display: block;
    color: #52758a;
    font-size: 12px;
    margin-bottom: 8px;
}

.sello-bar-track {
    width: 100%;
    height: 8px;
    background: #c7deea;
    border-radius: 999px;
    overflow: hidden;
}

.sello-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0f7a9d, #22c55e);
    border-radius: 999px;
    transition: width 0.04s linear;
}

/* ── Canvas ── */

.timpa-canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #d0e8f4;
    border-radius: 12px;
    background: #f9fafb;
    margin-bottom: 10px;
}

/* ── Measurement button ── */

.timpa-medir-btn { margin-bottom: 10px; }

.boton-medir {
    width: 100%;
    border-radius: 12px;
    padding: 13px;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.07em;
    cursor: pointer;
    border: none;
    font-family: inherit;
    margin: 0;
    transition: opacity 0.2s;
}

.od-medir { background: #dc2626; color: white; }
.oi-medir { background: #2563eb; color: white; }
.boton-medir:disabled { background: #64748b; cursor: not-allowed; }
.boton-medir.btn-completado { background: #16a34a !important; }

/* ── Digital readout ── */

.timpa-readout { margin-top: 10px; }

.readout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.readout-cell {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.readout-lbl {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 600;
}

.readout-val {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #0f3d5c;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.readout-unt {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* =========================
   TIMPANOMETRÍA — INTERPRETACIÓN
========================= */

.interpretacion-section {
    background: white;
    border: 1px solid var(--borde);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 22px rgba(15, 61, 94, 0.07);
    margin-bottom: 24px;
}

.interpretacion-section h2 {
    margin: 0 0 6px 0;
    color: var(--azul);
}

.interpretacion-section > p {
    margin: 0 0 20px 0;
    color: #66788a;
    font-size: 14px;
}

.interpretacion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.interpretacion-oido {
    background: #f7fcff;
    border: 1px solid #b8d8e8;
    border-radius: 14px;
    padding: 16px;
}

.interpretacion-oido h3 {
    margin: 0 0 14px 0;
    font-size: 16px;
}

.interpretacion-oido label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #0f3d5e;
    margin: 12px 0 6px 0;
}

.interpretacion-oido label:first-of-type { margin-top: 0; }

.interpretacion-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #b8d8e8;
    border-radius: 10px;
    font-size: 14px;
    color: #12384f;
    background: white;
    font-family: inherit;
    cursor: pointer;
}

.interpretacion-select:focus {
    outline: none;
    border-color: #0f7a9d;
    box-shadow: 0 0 0 3px rgba(15,122,157,0.12);
}

.obs-grupo { margin-bottom: 18px; }

.obs-grupo label {
    display: block;
    font-weight: bold;
    color: #0f3d5e;
    font-size: 14px;
    margin-bottom: 8px;
}

.obs-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #b8d8e8;
    border-radius: 12px;
    font-size: 14px;
    color: #12384f;
    font-family: inherit;
    resize: vertical;
    background: white;
    box-sizing: border-box;
}

.obs-textarea:focus {
    outline: none;
    border-color: #0f7a9d;
    box-shadow: 0 0 0 3px rgba(15,122,157,0.12);
}

.boton-enviar-timpa {
    display: block;
    width: 100%;
    background: #f0a71a;
    color: #102331;
    border: none;
    border-radius: 14px;
    padding: 14px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 4px;
    font-family: inherit;
}

.boton-enviar-timpa:disabled {
    background: #94a3b8;
    color: white;
    cursor: not-allowed;
}

/* =========================
   RESULTADO TIMPANOMETRÍA
========================= */

.botones-resultado {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.botones-resultado a { margin-top: 0; }

/* =========================
   RESPONSIVE TIMPANOMETRÍA
========================= */

@media (max-width: 1050px) {
    .timpanometria-workspace {
        grid-template-columns: 1fr;
    }
    .od-device-panel {
        border-right: none;
        border-bottom: 2px solid #10202e;
    }
    .interpretacion-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .caso-botones { flex-direction: column; }
    .botones-resultado { flex-direction: column; }
    .readout-grid { grid-template-columns: 1fr 1fr; }
}

/* ======================================================
   ACCESIBILIDAD — Tamaños mínimos de fuente y controles
   Ningún texto de interfaz por debajo de 14px.
   Objetivos táctiles mínimos de 44px de altura.
====================================================== */

/* Foco visible claro para navegación por teclado */
:focus-visible {
    outline: 3px solid #0f7a9d;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Altura mínima de botones (objetivo táctil 44px) */
button,
.btn-principal,
.btn-secundario,
.boton-sellar,
.boton-medir,
.boton-iniciar-timpa,
.boton-estimulo-grande,
.boton-registrar-umbral,
.boton-finalizar-examen,
.boton-enviar-timpa,
.boton-toggle-teclado {
    min-height: 44px;
}

/* Inputs y selects: tamaño mínimo legible */
input,
select,
textarea,
.interpretacion-select,
.input-ptp,
.input-ptp-obs {
    font-size: 16px !important;
    min-height: 44px;
}

.input-ptp { min-height: 38px; }

/* Navegación principal */
.brand span     { font-size: 15px !important; }
nav a           { font-size: 16px !important; }

/* Tarjetas del dashboard */
.card h3        { font-size: 17px !important; }
.numero         { font-size: 44px !important; }
.estado         { font-size: 24px !important; }
.panel p,
.card p         { font-size: 16px !important; }

/* Tags y etiquetas de caso */
.tag            { font-size: 15px !important; }
.caso-card p    { font-size: 16px !important; }

/* Info compacta del caso en simulador */
.caso-compacto p { font-size: 15px !important; }

/* Panel de audiometría lateral — textos pequeños */
.aud-display span          { font-size: 13px !important; }
.aud-display strong        { font-size: 18px !important; }
.aud-header p              { font-size: 14px !important; }
.estado-actual-mini span   { font-size: 14px !important; }

/* Guía Hughson-Westlake */
.guia-hw-header strong     { font-size: 15px !important; }
.guia-hw-header span       { font-size: 14px !important; }
.panel-guia-hw p           { font-size: 14px !important; }
.guia-hw-estado span       { font-size: 14px !important; }
#sugerenciaHW              { font-size: 14px !important; }

/* Respuesta del paciente */
.respuesta-lateral span    { font-size: 14px !important; }
.respuesta-lateral strong  { font-size: 19px !important; }

/* Ayuda de enmascaramiento */
.ayuda-mask-contenido p    { font-size: 14px !important; }
.ayuda-mask-header strong  { font-size: 16px !important; }
.ayuda-mask-header span    { font-size: 14px !important; }
.estado-plateau            { font-size: 14px !important; }
.mask-instruccion p        { font-size: 14px !important; }

/* Botones del audiómetro */
.boton-estimulo-grande          { font-size: 18px !important; }
.boton-estimulo-grande small    { font-size: 13px !important; }
.boton-registrar-umbral         { font-size: 16px !important; }
.boton-registrar-umbral small   { font-size: 13px !important; }
.boton-sin-respuesta            { font-size: 15px !important; }
.boton-sin-respuesta small      { font-size: 13px !important; }
.boton-eliminar-umbral          { font-size: 14px !important; }
.boton-eliminar-curva           { font-size: 14px !important; }
.boton-eliminar-umbral small,
.boton-eliminar-curva small     { font-size: 13px !important; }

/* Frecuencias rápidas */
.frecuencias-rapidas button    { font-size: 13px !important; }

/* Bloque de control (títulos h3) */
.bloque-control h3             { font-size: 14px !important; }

/* Controles de teclado popup */
.teclado-ayuda-popup div       { font-size: 14px !important; }
.teclado-ayuda-popup kbd       { font-size: 13px !important; min-width: 32px; padding: 4px 8px; }
.teclado-ayuda-popup span      { font-size: 14px !important; }
.boton-toggle-teclado          { font-size: 16px !important; }
.boton-toggle-teclado small    { font-size: 13px !important; }

/* Leyenda del audiograma */
.leyenda-audiograma            { font-size: 15px !important; }

/* PTP */
.ptp-header h3    { font-size: 18px !important; }
.ptp-header p     { font-size: 15px !important; }
.ptp-nota         { font-size: 14px !important; }
.tabla-ptp th     { font-size: 14px !important; }
.tabla-ptp td     { font-size: 15px !important; }

/* Tabla de enmascaramiento */
.tabla-header h2  { font-size: 20px !important; }
.tabla-header p   { font-size: 15px !important; }
th                { font-size: 15px !important; }
td                { font-size: 15px !important; }

/* Resultados */
.resultado-box h2  { font-size: 22px !important; }
.resultado-box h3  { font-size: 18px !important; }
.resultado-box p   { font-size: 16px !important; }
.puntaje           { font-size: 56px !important; }

/* Login */
.login-card label  { font-size: 16px !important; }
.demo-box          { font-size: 15px !important; }

/* Mensajes flash */
.mensaje           { font-size: 16px !important; }

/* Impedanciómetro — readout digital */
.readout-lbl  { font-size: 11px !important; }
.readout-val  { font-size: 26px !important; }
.readout-unt  { font-size: 13px !important; }

/* Impedanciómetro — labels de dispositivo */
.imp-brand          { font-size: 16px !important; }
.imp-model          { font-size: 13px !important; }
.imp-status-badge   { font-size: 13px !important; }
.ch-nombre          { font-size: 17px !important; }
.ch-probe-status    { font-size: 13px !important; }
.sello-instruccion  { font-size: 15px !important; }
.sello-loader small { font-size: 14px !important; }
.boton-sellar       { font-size: 15px !important; }
.boton-medir        { font-size: 15px !important; }

/* Interpretación timpanometría */
.interpretacion-section h2    { font-size: 22px !important; }
.interpretacion-section > p   { font-size: 16px !important; }
.interpretacion-oido h3       { font-size: 18px !important; }
.interpretacion-oido label    { font-size: 15px !important; }

/* =========================
   RESULTADO — TIMPANOMETRÍA CANVASES
========================= */

.resultado-timpa-canvases-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 24px 0;
}

.resultado-timpa-canvases-section h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.seccion-subtitulo {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.resultado-timpa-canvases {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.resultado-canvas-wrap {
    flex: 1;
    min-width: 280px;
    max-width: 480px;
}

.resultado-canvas-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.resultado-canvas-label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.resultado-canvas-label.correcto { color: #166534; }
.resultado-canvas-label.revisar  { color: #92400e; }

.tipo-badge {
    font-size: 12px;
    font-weight: normal;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px 10px;
}

.resultado-canvas-label.correcto .tipo-badge { background: #dcfce7; color: #166534; }
.resultado-canvas-label.revisar  .tipo-badge { background: #fef3c7; color: #92400e; }

/* =========================
   RESULTADO — AUDIOGRAMA CANVAS
========================= */

.resultado-audio-canvas-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 24px 0;
}

.resultado-audio-canvas-section h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.resultado-audio-canvases {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: auto;
}

.resultado-audio-canvas-wrap {
    flex: 1;
    min-width: 260px;
    max-width: 430px;
}

.resultado-audio-canvas-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.resultado-canvas-oido-label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 6px;
}

.leyenda-resultado-audio {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 14px;
    font-size: 14px;
    color: #374151;
    align-items: center;
}

.leyenda-punteada {
    color: #6b7280;
    font-weight: bold;
    letter-spacing: 3px;
}

/* =========================
   REFERENCIA CLÍNICA
========================= */

.clinica-ref-section {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 24px 0;
}

.clinica-ref-section h2 {
    color: #0369a1;
    font-size: 20px;
    margin-bottom: 16px;
}

.clinica-ref-section h3 {
    color: #0369a1;
    font-size: 17px;
    margin: 22px 0 10px;
}

.jerger-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.jerger-card {
    background: #fff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 14px;
}

.jerger-card-activo {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14,165,233,0.18);
}

.jerger-card h4 {
    color: #0369a1;
    font-size: 15px;
    margin: 0 0 6px 0;
}

.jerger-card p {
    color: #374151;
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}

.tabla-referencia {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 8px;
}

.tabla-referencia th,
.tabla-referencia td {
    padding: 9px 14px;
    border: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    line-height: 1.5;
}

.tabla-referencia th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #374151;
}

.clinica-correlacion {
    background: #fff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 16px;
}

.clinica-correlacion h3 {
    font-size: 16px;
    color: #0369a1;
    margin: 0 0 10px 0;
}

.clinica-correlacion ul {
    margin: 0;
    padding-left: 20px;
}

.clinica-correlacion li {
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 4px;
}

/* =========================
   BTN-TERCIARIO
========================= */

.btn-terciario {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: bold;
    text-decoration: none;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #6ee7b7;
    transition: background 0.15s;
}
.btn-terciario:hover { background: #a7f3d0; }

/* =========================
   REFLEJOS — DEVICE FRAME
========================= */

.ref-device-frame {
    background: #10202e;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 56px rgba(9,36,52,0.40);
    margin: 24px 0;
}

/* ── Header (igual que el impedanciómetro) ── */

.ref-device-header {
    background: linear-gradient(135deg, #0c1e2d 0%, #162d40 100%);
    border-bottom: 1px solid #1f3f57;
    padding: 14px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.ref-brand-block { display: flex; flex-direction: column; }

.ref-brand {
    font-size: 15px;
    font-weight: bold;
    color: #e2f0f9;
    letter-spacing: 0.1em;
    font-family: monospace;
}

.ref-model {
    font-size: 11px;
    color: #6da8c8;
    margin-top: 3px;
    letter-spacing: 0.04em;
}

.ref-status-badge {
    background: #0a1e2c;
    border: 1px solid #1f4a66;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: bold;
    color: #fcd34d;
    letter-spacing: 0.12em;
    font-family: monospace;
}

.ref-status-badge.badge-midiendo { color: #a3e635; border-color: #3a6018; }
.ref-status-badge.badge-ok       { color: #4ade80; border-color: #166534; }
.ref-status-badge.badge-ausente  { color: #fca5a5; border-color: #7f1d1d; }

/* ── Workspace ── */

.ref-workspace {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    background: #10202e;
}

/* ── Controls panel (fondo clínico claro) ── */

.ref-controls-panel {
    background: #f7fbfe;
    padding: 18px 16px;
    border-right: 2px solid #10202e;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ref-selector-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ref-selector-label {
    font-size: 11px;
    font-weight: bold;
    color: #52758a;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.ref-btn-group {
    display: flex;
    gap: 6px;
}

.ref-btn-group-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 5px;
}

.ref-ear-btn,
.ref-freq-btn {
    flex: 1;
    padding: 9px 6px;
    background: #fff;
    color: #0f3d5e;
    border: 1px solid #c7deea;
    border-radius: 10px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 40px;
    font-family: inherit;
}

.ref-ear-btn:hover, .ref-freq-btn:hover {
    background: #e8f4fb;
    border-color: #8fc5df;
}

.ref-ear-od.activo {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
}

.ref-ear-oi.activo {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

.ref-freq-btn.activo {
    background: #e8f4fb;
    border-color: #0f3d5e;
    color: #0f3d5e;
}

/* ── Intensity display ── */

.ref-intensity-display {
    background: #fff;
    border: 1px solid #b8d8e8;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(15,61,94,0.06);
}

.ref-int-val {
    font-size: 46px;
    font-weight: bold;
    color: #0f3d5e;
    letter-spacing: -1px;
    min-width: 3ch;
    text-align: right;
    font-family: monospace;
}

.ref-int-unit {
    font-size: 14px;
    color: #52758a;
}

/* ── Progress bar ── */

.ref-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ref-progress-track {
    width: 100%;
    height: 7px;
    background: #e8f4fb;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #c7deea;
}

.ref-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f7a9d, #1f9d55, #c53030);
    border-radius: 999px;
    width: 0;
    transition: width 0.3s ease;
}

.ref-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #7ab8d4;
    padding: 0 2px;
}

/* ── Start button ── */

.ref-btn-iniciar {
    width: 100%;
    background: #0f3d5e;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 13px 10px;
    font-size: 14px;
    font-weight: bold;
    font-family: inherit;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 52px;
}

.ref-btn-iniciar small {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: #a8d4e8;
    margin-top: 3px;
}

.ref-btn-iniciar:hover    { background: #09283f; }
.ref-btn-iniciar:disabled {
    background: #b8d8e8;
    color: #52758a;
    cursor: not-allowed;
}

/* ── Status panel ── */

.ref-status-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #eef5fb;
    border: 1px solid #c7deea;
    border-radius: 10px;
    padding: 12px 14px;
}

.ref-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ref-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c7deea;
    flex-shrink: 0;
    transition: all 0.2s;
}

.ref-status-dot.dot-evaluando {
    background: #f59e0b;
    box-shadow: 0 0 7px rgba(245,158,11,0.6);
    animation: dot-pulse 0.8s infinite;
}

.ref-status-dot.dot-presente {
    background: #16a34a;
    box-shadow: 0 0 8px rgba(22,163,74,0.55);
}

.ref-status-dot.dot-ausente {
    background: #dc2626;
    box-shadow: 0 0 7px rgba(220,38,38,0.45);
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.ref-status-text {
    font-size: 13px;
    color: #426b81;
}

.ref-umbral-badge {
    background: #dcfce7;
    color: #14532d;
    border: 1px solid #86efac;
    border-radius: 7px;
    padding: 5px 12px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* ── Reflexogram panel (fondo clínico blanco) ── */

.ref-reflexogram-panel {
    background: #f7fbfe;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ref-reflexogram-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ref-reflexogram-title {
    font-size: 11px;
    font-weight: bold;
    color: #52758a;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ref-reflexogram-sub {
    font-size: 13px;
    color: #0f3d5e;
    font-weight: bold;
}

.ref-reflexogram-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: flex-start;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}

.ref-grid-vacio {
    width: 100%;
    text-align: center;
    color: #8fc5df;
    font-size: 13px;
    padding: 60px 0;
}

.ref-box {
    border: 1px solid #c7deea;
    border-radius: 8px;
    background: #f7fbfe;
    padding: 4px 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ref-box-presente {
    border-color: #16a34a;
    box-shadow: 0 0 0 1px #16a34a inset;
}

.ref-box-canvas {
    display: block;
    width: 132px;
    height: 96px;
    border-radius: 4px;
}

.ref-box-label {
    font-size: 11px;
    font-weight: bold;
    color: #4a6e86;
}

.ref-reflexogram-legend {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #7ab8d4;
    padding: 0 2px;
}

/* ── Results table ── */

.ref-resultados-section {
    background: #fff;
    border: 1px solid #dce9f3;
    border-radius: 14px;
    padding: 22px 28px;
    margin: 20px 0;
    box-shadow: 0 4px 16px rgba(15,61,94,0.07);
}

.ref-resultados-section h2 { font-size: 20px; margin-bottom: 4px; }

.ref-tabla-resultados {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.ref-tabla-resultados th,
.ref-tabla-resultados td {
    padding: 11px 18px;
    border: 1px solid #dce9f3;
    text-align: center;
}

.ref-tabla-resultados th {
    background: #eef5fb;
    font-weight: 600;
    color: #0f3d5e;
}

.ref-tabla-resultados tbody tr:nth-child(even) { background: #f7fbfe; }

.ref-celda-pendiente { color: #94a3b8; font-size: 18px; }
.ref-celda-presente  { color: #14532d; font-weight: bold; background: #dcfce7 !important; }
.ref-celda-ausente   { color: #7c2d12; font-weight: bold; background: #fef3c7 !important; }

/* ── Responsive ── */

@media (max-width: 800px) {
    .ref-workspace { grid-template-columns: 1fr; }
    .ref-controls-panel { border-right: none; border-bottom: 2px solid #10202e; }
    .ref-btn-group-4 { grid-template-columns: 1fr 1fr; }
}

/* ── Historial de trazas ── */

.ref-historial-section {
    max-width: 900px;
    margin: 24px auto 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ref-historial-grupo {
    background: #fff;
    border: 1px solid #c8dce9;
    border-radius: 8px;
    overflow: hidden;
}

.ref-historial-grupo-header {
    background: #eef5fb;
    border-bottom: 1px solid #c8dce9;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: bold;
    color: #0f3d5e;
}

.ref-historial-grupo-header .ref-grupo-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ref-grupo-tag.tag-od { background: #fee2e2; color: #991b1b; }
.ref-grupo-tag.tag-oi { background: #dbeafe; color: #1e40af; }

.ref-historial-traces-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    background: #f7fbfe;
}

.ref-mini-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.ref-mini-canvas {
    display: block;
    border: 1px solid #c8dce9;
    border-radius: 4px;
    background: #f7fbfe;
}

.ref-mini-label {
    font-size: 11px;
    color: #4a6e86;
    font-weight: bold;
}

.ref-historial-resultado {
    padding: 6px 14px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #4a6e86;
    border-top: 1px solid #e0ecf4;
}

.ref-btn-registrar-grupo {
    margin-left: auto;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.ref-btn-registrar-grupo:hover {
    background: #1d4ed8;
}

.ref-btn-modificar {
    background: #64748b;
}

.ref-btn-modificar:hover {
    background: #475569;
}

/* Formulario de registro inline dentro de cada grupo de toma */
.ref-registro-inline {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: #f1f8fd;
    border: 1px dashed #93c5e8;
    border-radius: 8px;
}

.ref-registro-inline-titulo {
    font-size: 13px;
    font-weight: bold;
    color: #2c5670;
}

.ref-resultado-presente {
    display: inline-block;
    background: #dcfce7;
    color: #14532d;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.ref-resultado-ausente {
    display: inline-block;
    background: #fef3c7;
    color: #7c2d12;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}

/* ── Panel de registro (student fills in) ── */

.ref-registro-panel {
    background: #fff;
    border: 2px solid #0f3d5e;
    border-radius: 8px;
    padding: 16px 20px;
    max-width: 900px;
    margin: 0 auto;
}

.ref-registro-panel h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #0f3d5e;
}

.ref-registro-subtitulo {
    font-size: 13px;
    color: #4a6e86;
    margin: 0 0 14px;
}

.ref-registro-opciones {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ref-btn-ausente {
    padding: 7px 18px;
    background: #fef3c7;
    color: #78350f;
    border: 1.5px solid #d97706;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background .15s;
}
.ref-btn-ausente:hover { background: #fde68a; }

.ref-presente-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ref-presente-group label {
    font-size: 14px;
    color: #0f3d5e;
    font-weight: bold;
}

.ref-input-umbral {
    width: 72px;
    padding: 6px 8px;
    border: 1.5px solid #8fc5df;
    border-radius: 6px;
    font-size: 14px;
    color: #0f3d5e;
    text-align: center;
}

.ref-btn-presente {
    padding: 7px 18px;
    background: #dcfce7;
    color: #14532d;
    border: 1.5px solid #16a34a;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background .15s;
}
.ref-btn-presente:hover { background: #bbf7d0; }
/* ══ PRUEBAS SUPRALIMINARES ══════════════════════════════════════════════════ */
.supra-section {
    margin: 24px 0;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    overflow: hidden;
}
.supra-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 12px;
}
.supra-header h2 { margin: 0 0 2px; font-size: 15px; color: #0f172a; }
.supra-header p  { margin: 0; font-size: 12px; color: #64748b; }
.supra-tabs-wrap { display: flex; gap: 6px; }
.supra-tab {
    padding: 7px 22px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}
.supra-tab.activo {
    background: #1e293b;
    color: #fff;
    border-color: #1e293b;
}
.supra-panel { padding: 20px 24px 24px; }
.supra-intro {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: #0c4a6e;
    margin-bottom: 18px;
    line-height: 1.5;
}
.supra-intro strong { display: block; font-size: 13px; margin-bottom: 4px; }

/* Controles */
.supra-controles-grid {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.supra-ctrl-group { display: flex; flex-direction: column; gap: 6px; }
.supra-ctrl-group label { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.supra-btn-pair { display: flex; gap: 6px; }
.supra-oido-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}
.supra-oido-btn.activo { background: #1e293b; color: #fff; border-color: #1e293b; }
.supra-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: 13px;
    color: #0f172a;
    cursor: pointer;
    min-width: 120px;
}
.supra-intens-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}
.supra-intens-ctrl button {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    color: #334155;
    transition: background .15s;
}
.supra-intens-ctrl button:hover { background: #e2e8f0; }
.supra-intens-display {
    min-width: 100px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
}
.supra-btn-estimulo {
    padding: 9px 20px;
    background: #1e40af;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.supra-btn-estimulo:active, .supra-btn-estimulo.presionando {
    background: #1e3a8a;
    transform: scale(.98);
}
.supra-btn-registrar {
    padding: 9px 18px;
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.supra-btn-registrar:hover { background: #047857; }

/* Caja de respuesta */
.supra-respuesta-box {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    transition: all .2s;
}
.supra-resp-neutro   { background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b; }
.supra-resp-ok       { background: #dcfce7; border: 1px solid #86efac; color: #15803d; }
.supra-resp-alerta   { background: #fee2e2; border: 1px solid #fca5a5; color: #b91c1c; }
.supra-resp-disconfort { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }

/* Tabla */
.supra-tabla-wrap { overflow-x: auto; }
.supra-tabla {
    width: 100%;
    border-collapse: collapse;
}
.supra-tabla th {
    padding: 9px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.supra-tabla td {
    padding: 10px 14px;
    border-bottom: 1px solid #f8fafc;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}
.supra-tabla tr:last-child td { border-bottom: none; }
.supra-tabla tbody tr:hover td { background: #f8faff; }
.supra-empty { color: #94a3b8; font-style: italic; text-align: center; padding: 20px; }

/* SISI */
.supra-portadora-info {
    padding: 8px 14px;
    background: #ede9fe;
    color: #4a2178;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.supra-btn-iniciar-sisi {
    padding: 9px 22px;
    background: #5e2b97;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.supra-btn-iniciar-sisi:hover { background: #4a2178; }
.supra-btn-iniciar-sisi:disabled { background: #cdbbe4; cursor: not-allowed; }
.supra-sisi-estado { margin-bottom: 16px; }
.sisi-progreso-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}
.sisi-score-badge {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    background: #ede9fe;
    color: #4a2178;
}
.sisi-score-positivo { background: #fee2e2; color: #b91c1c; }
.sisi-score-negativo  { background: #dcfce7; color: #15803d; }
.sisi-incrementos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.sisi-inc {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 1.5px solid;
}
.sisi-inc-si   { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.sisi-inc-no   { background: #dcfce7; color: #15803d; border-color: #86efac; }
.sisi-inc-vacio { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; }
.sisi-interpretacion {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
}

/* Score pills para tabla */
.sisi-pill-pos { background: #fee2e2; color: #b91c1c; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-block; }
.sisi-pill-neg { background: #dcfce7; color: #15803d; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-block; }
.sisi-pill-bdr { background: #fef3c7; color: #b45309; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-block; }

@media (max-width: 800px) {
    .supra-controles-grid { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════
   AUDIOMETER MODE SELECTOR + INTEGRATED SUPRA CONTROLS
══════════════════════════════════════════════════════ */

.aud-modo-selector {
    display: flex;
    gap: 4px;
    background: rgba(18, 56, 79, 0.10);
    border: 1px solid rgba(18, 56, 79, 0.15);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 14px;
}
.aud-modo-btn {
    flex: 1;
    padding: 7px 0;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: #426b81;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .5px;
    transition: background .15s, color .15s;
}
.aud-modo-btn.activo {
    background: #1d6fa4;
    color: #fff;
    box-shadow: 0 2px 8px rgba(18,56,79,.25);
}
.aud-modo-btn:hover:not(.activo) {
    background: rgba(18, 56, 79, 0.12);
    color: #0f3d5e;
}

/* ── Visibility rules (data-modo attribute on aside) ── */
.aud-solo-umbral      { }
.aud-solo-ldl         { display: none; }
.aud-solo-sisi        { display: none; }
.aud-solo-umbral-ldl  { }

[data-modo="ldl"] .aud-solo-umbral     { display: none !important; }
[data-modo="ldl"] .aud-solo-ldl        { display: block !important; }
[data-modo="ldl"] .aud-solo-sisi       { display: none !important; }
[data-modo="ldl"] .aud-solo-umbral-ldl { display: block !important; }

[data-modo="sisi"] .aud-solo-umbral     { display: none !important; }
[data-modo="sisi"] .aud-solo-ldl        { display: none !important; }
[data-modo="sisi"] .aud-solo-sisi       { display: block !important; }
[data-modo="sisi"] .aud-solo-umbral-ldl { display: none !important; }

/* ── REGISTRAR LDL button ── */
.boton-registrar-ldl {
    display: none;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #5e2b97, #4a2178);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    letter-spacing: .5px;
    transition: all .2s;
    margin-top: 8px;
}
.boton-registrar-ldl:hover {
    background: linear-gradient(135deg, #4a2178, #4a2178);
    transform: translateY(-1px);
}
.boton-registrar-ldl small {
    display: block;
    font-size: 10px;
    font-weight: 500;
    opacity: .75;
    margin-top: 3px;
}

/* ── LDL mini panel (inside aside) ── */
.ldl-mini-panel {
    display: none;
    background: rgba(18, 56, 79, 0.07);
    border: 1px solid rgba(18, 56, 79, 0.12);
    border-radius: 10px;
    padding: 10px;
    margin-top: 8px;
}
.ldl-mini-titulo {
    font-size: 10px;
    font-weight: 700;
    color: #5a8ba0;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 6px;
}
.ldl-mini-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.ldl-mini-tabla td {
    padding: 3px 5px;
    color: #0f3d5e;
    vertical-align: middle;
}
.ldl-mini-empty {
    color: #7aa3b8;
    font-style: italic;
    font-size: 11px;
}

/* ── INICIAR SISI button (inside aside) ── */
.boton-iniciar-sisi {
    display: none;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #5e2b97, #4a2178);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    letter-spacing: .5px;
    transition: all .2s;
    margin-top: 8px;
}
.boton-iniciar-sisi:hover {
    background: linear-gradient(135deg, #4a2178, #4a2178);
    transform: translateY(-1px);
}
.boton-iniciar-sisi:disabled {
    background: #9b7bc4;
    cursor: not-allowed;
    transform: none;
}
.boton-iniciar-sisi small {
    display: block;
    font-size: 10px;
    font-weight: 500;
    opacity: .75;
    margin-top: 3px;
}

/* ── SISI mini panel (inside aside) ── */
.sisi-mini-panel {
    display: none;
    background: rgba(18, 56, 79, 0.07);
    border: 1px solid rgba(18, 56, 79, 0.12);
    border-radius: 10px;
    padding: 10px;
    margin-top: 8px;
}
.sisi-mini-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #0f3d5e;
    font-weight: 600;
}
.sisi-mini-score-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    background: rgba(18,56,79,.12);
    color: #0f3d5e;
}
.sisi-mini-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.sisi-mini-grid .sisi-inc {
    width: 26px;
    height: 26px;
    font-size: 10px;
}
.sisi-mini-interp {
    font-size: 11px;
    color: #5a8ba0;
    font-style: italic;
    line-height: 1.4;
}

/* when LDL mode is active, show these as block (overrides display:none default) */
[data-modo="ldl"] .boton-registrar-ldl { display: block !important; }
[data-modo="ldl"] .ldl-mini-panel      { display: block !important; }

/* when SISI mode is active */
[data-modo="sisi"] .boton-iniciar-sisi { display: block !important; }
[data-modo="sisi"] .sisi-mini-panel    { display: block !important; }

/* ── Modal selección de pruebas ────────────────────────────────────── */
.modal-pruebas-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 30, 50, 0.62);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-pruebas-overlay.activo {
    display: flex;
}
.modal-pruebas-box {
    background: #fff;
    border-radius: 20px;
    padding: 36px 40px 32px;
    max-width: 560px;
    width: 94vw;
    box-shadow: 0 24px 60px rgba(10, 30, 50, 0.3);
}
.modal-pruebas-titulo {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
    color: #0f3d5e;
}
.modal-pruebas-subtitulo {
    margin: 0 0 24px;
    font-size: 14px;
    color: #4a7a93;
    line-height: 1.5;
}
.modal-pruebas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 28px;
}
.modal-prueba-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 2px solid #d1e8f2;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.modal-prueba-item:has(input:checked) {
    border-color: #1d6fa4;
    background: #eaf4fb;
}
.modal-prueba-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1d6fa4;
    cursor: pointer;
    flex-shrink: 0;
}
.modal-prueba-nombre {
    font-size: 13px;
    font-weight: 600;
    color: #0f3d5e;
    line-height: 1.3;
}
.modal-pruebas-footer {
    display: flex;
    justify-content: flex-end;
}
.modal-pruebas-btn-confirmar {
    padding: 12px 28px;
    background: linear-gradient(135deg, #1d6fa4, #1551a0);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .15s;
}
.modal-pruebas-btn-confirmar:hover {
    opacity: .9;
    transform: translateY(-1px);
}

/* ── Tira de pruebas seleccionadas (debajo del caso) ────── */
.tira-pruebas-seleccionadas {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #eaf4fb;
    border: 1px solid #c0ddef;
    border-radius: 10px;
    padding: 8px 16px;
    margin-bottom: 12px;
    font-size: 13px;
}
.tira-pruebas-label {
    font-weight: 700;
    color: #0f3d5e;
    white-space: nowrap;
}
.tira-pruebas-lista {
    color: #1d6fa4;
    font-weight: 600;
}
.tira-pruebas-editar {
    margin-left: auto;
    padding: 4px 12px;
    background: transparent;
    border: 1.5px solid #1d6fa4;
    border-radius: 6px;
    color: #1d6fa4;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tira-pruebas-editar:hover {
    background: #1d6fa4;
    color: #fff;
}

/* ── Docente form: pruebas_indicadas checkgroup ─────────── */
.pruebas-checkgroup {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.prueba-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    transition: border-color .15s, background .15s;
}
.prueba-check-item:has(input:checked) {
    border-color: #5e2b97;
    background: #f3eefa;
    color: #3b1a66;
}
.prueba-check-item input[type="checkbox"] {
    accent-color: #5e2b97;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.form-ayuda {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0;
}

/* ── Resultado: selección de pruebas ────────────────────── */
.estado-correcto   { color: #15803d; font-weight: 700; }
.estado-omitida    { color: #b45309; font-weight: 700; }
.estado-no-indicada { color: #6b7280; font-weight: 600; }

/* ── Función Tubaria: casos.html button ──────────────────── */
.btn-tubaria {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: #5e2b97;
    color: #fff;
    transition: background .15s;
}
.btn-tubaria:hover { background: #4a2178; }

/* ── VT: leyenda y instrucciones ────────────────────────── */
.vt-leyenda {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #374151;
    padding: 6px 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin: 6px 0;
}
.vt-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vt-instruccion {
    font-size: 13px;
    color: #374151;
    background: #f0f9ff;
    border-left: 3px solid #0284c7;
    padding: 8px 12px;
    border-radius: 0 8px 8px 0;
    margin: 0 0 8px;
}

/* ── VT: delta readout ──────────────────────────────────── */
.vt-readout, .bs-readout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.delta-normal  { color: #15803d; font-weight: 700; font-size: 13px; }
.delta-anormal { color: #dc2626; font-weight: 700; font-size: 13px; }
.delta-warning { color: #b45309; font-weight: 700; font-size: 13px; }

/* ── Bluestone: presion display ─────────────────────────── */
.bs-presion-display {
    background: #1e293b;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 12px 0;
    text-align: center;
}
.bs-presion-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 6px;
}
.bs-presion-valor {
    font-size: 28px;
    font-weight: 800;
    color: #f0f9ff;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}
.bs-bar-track {
    height: 12px;
    background: #334155;
    border-radius: 6px;
    overflow: hidden;
}
.bs-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #0284c7);
    border-radius: 6px;
    transition: width .2s;
}
.bs-bar-fill.od-medir { background: linear-gradient(90deg, #f87171, #dc2626); }
.bs-bar-fill.oi-medir { background: linear-gradient(90deg, #60a5fa, #2563eb); }

/* ── Resultado tubaria: estado-warning ──────────────────── */
.estado-warning { color: #b45309; font-weight: 700; }

/* ════════════════════════════════════════════════════════════
   CONTROLES TÁCTILES DEL SIMULADOR (móvil y escritorio)
   ════════════════════════════════════════════════════════════ */
.pad-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pad-btn {
    padding: 12px 8px;
    min-height: 46px;
    border: 1.5px solid #9fc9dd;
    border-radius: 10px;
    background: #ffffff;
    color: #0f3d5e;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    transition: background .12s, transform .08s;
}

.pad-btn:hover  { background: #eaf4fb; }
.pad-btn:active { background: #d8eefb; transform: scale(0.97); }

.pad-btn-plateau {
    grid-column: 1 / -1;
    background: #f0a71a;
    border-color: #f0a71a;
    color: #102331;
}
.pad-btn-plateau:hover { background: #e09405; }

.pad-grid-mask { margin-top: 10px; }

.boton-sin-respuesta {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1.5px dashed #9fc9dd;
    border-radius: 12px;
    background: transparent;
    color: #41657d;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}
.boton-sin-respuesta:hover { background: #eaf4fb; }
.boton-sin-respuesta small { display: block; font-weight: 500; font-size: 10.5px; margin-top: 2px; }

/* El botón de estímulo se mantiene presionado: bloquear long-press del navegador */
.boton-estimulo-grande,
.boton-registrar-umbral,
.boton-registrar-ldl {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Canvas sin distorsión en pantallas angostas */
@media (max-width: 700px) {
    .canvas-wrapper canvas { min-height: 0; }
    .leyenda-audiograma { font-size: 11px; }
    .pad-btn { min-height: 50px; }
}

/* ════════════════════════════════════════════════════════════
   ASISTENTE DE PLATEAU (guía interactiva de enmascaramiento)
   ════════════════════════════════════════════════════════════ */
.mask-asist-situacion {
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 10px;
}
.mask-asist-situacion.neutro { background: #eef4f8; color: #41657d; border: 1px solid #d4e4ee; }
.mask-asist-situacion.ok     { background: #ecfdf3; color: #15803d; border: 1px solid #bbf7d0; }
.mask-asist-situacion.alerta { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.mask-asist-pasos {
    margin: 0 0 10px;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.mask-asist-pasos li {
    font-size: 11.5px;
    line-height: 1.4;
    color: #8aa0b0;
    transition: color .15s;
}
.mask-asist-pasos li.activo {
    color: #0f3d5e;
    font-weight: 700;
}
.mask-asist-pasos li.activo::marker { color: #1d6fa5; font-weight: 700; }
.mask-asist-pasos li.completado {
    color: #15803d;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(21, 128, 61, 0.4);
}

.mask-asist-consejo {
    padding: 8px 12px;
    border-radius: 9px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    margin-bottom: 10px;
}

.plateau-chart-wrap {
    border: 1px solid #d4e4ee;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #f8fbfd;
}
.plateau-chart-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* ════════════════════════════════════════════════════════════
   BOTÓN Y POP-UP DE SÍMBOLOS AUDIOLÓGICOS
   ════════════════════════════════════════════════════════════ */
.boton-simbolos {
    padding: 5px 12px;
    border: 1px solid #9fc9dd;
    border-radius: 8px;
    background: #fff;
    color: #0f3d5e;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
}
.boton-simbolos:hover { background: #eaf4fb; }

.simbolos-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: simbFadeIn .15s ease;
}
@keyframes simbFadeIn { from { opacity: 0; } to { opacity: 1; } }

.simbolos-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    animation: simbSlideUp .18s ease;
}
@keyframes simbSlideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.simbolos-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eef0f2;
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 14px 14px 0 0;
}
.simbolos-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0d1b2a;
}
.simbolos-cerrar {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    transition: color .12s;
}
.simbolos-cerrar:hover { color: #0d1b2a; }

/* La leyenda dentro del modal: en columna, legible */
.simbolos-modal .leyenda-audiograma {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    padding: 18px 20px;
    margin: 0;
}
.simbolos-modal .leyenda-audiograma span {
    font-size: 12.5px;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 7px;
}
.simbolos-modal .leyenda-audiograma strong {
    font-size: 16px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.simbolos-modal-footer {
    padding: 14px 20px 18px;
    text-align: right;
    border-top: 1px solid #eef0f2;
}
.simbolos-btn-cerrar {
    padding: 9px 22px;
    border: none;
    border-radius: 8px;
    background: #1d6fa5;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .12s;
}
.simbolos-btn-cerrar:hover { background: #155a87; }

@media (max-width: 560px) {
    .simbolos-modal .leyenda-audiograma { grid-template-columns: 1fr; }
}

/* ===============================
   AVISO DE TECLADO AL ENTRAR
=============================== */

.aviso-teclado-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
    animation: simbFadeIn .15s ease;
}
.aviso-teclado-overlay.oculto { display: none; }

.aviso-teclado-modal {
    position: relative;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 14px 14px 18px;
    text-align: center;
    animation: simbSlideUp .18s ease;
}
.aviso-teclado-modal img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
}

.aviso-teclado-cerrar {
    position: absolute;
    top: 22px;
    right: 22px;
    /* El `button` global impone padding 12/18 y min-height 44px (objetivo
       tactil): sin anular el padding el circulo se deforma en ovalo. */
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    transition: color .12s, background .12s;
}
/* el clic debe registrarse en el boton, no en el svg (ver cerrarAvisoTeclado) */
.aviso-teclado-cerrar svg { pointer-events: none; display: block; }
.aviso-teclado-cerrar:hover { color: #0d1b2a; background: #fff; }

.aviso-teclado-btn {
    margin-top: 16px;
    padding: 10px 28px;
    border: none;
    border-radius: 8px;
    background: #1d6fa5;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .12s;
}
.aviso-teclado-btn:hover { background: #155a87; }

/* ===============================
   RÚBRICA — modal antes de iniciar el examen
=============================== */
.rubrica-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 20px;
    animation: simbFadeIn .15s ease;
}
.rubrica-overlay.oculto { display: none; }

.rubrica-modal {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    overflow: hidden;
    animation: simbSlideUp .18s ease;
}
.rubrica-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid #eef0f2;
}
.rubrica-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #1d6fa5;
    margin-bottom: 3px;
}
.rubrica-head h2 { margin: 0; font-size: 19px; color: #0d1b2a; line-height: 1.2; }
.rubrica-x {
    background: none; border: none; font-size: 26px; line-height: 1;
    color: #94a3b8; cursor: pointer; padding: 0 2px; flex-shrink: 0;
    transition: color .12s;
}
.rubrica-x:hover { color: #0d1b2a; }

.rubrica-body { padding: 16px 22px 8px; overflow-y: auto; }
.rubrica-intro { margin: 0 0 14px; font-size: 13.5px; color: #475569; }
.rubrica-intro strong { color: #0d1b2a; }

.rubrica-peso {
    display: inline-block; font-size: 12px; font-weight: 700; color: #1d6fa5;
    background: #eaf4fb; border-radius: 999px; padding: 3px 11px; margin: 0 0 12px;
}
.rubrica-sub {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: #64748b; margin: 16px 0 4px;
}
.rubrica-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.rubrica-tabla th {
    text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
    color: #94a3b8; font-weight: 700; padding: 6px 10px 6px 0; border-bottom: 1px solid #eef0f2;
}
.rubrica-tabla th.pts, .rubrica-tabla td.pts {
    text-align: right; white-space: nowrap; width: 1%; padding-right: 0;
    font-variant-numeric: tabular-nums;
}
.rubrica-tabla td {
    padding: 9px 10px 9px 0; border-bottom: 1px solid #f1f5f9; vertical-align: top; color: #1e293b;
}
.rubrica-tabla tr:last-child td { border-bottom: none; }
.rubrica-tabla td.comp { font-weight: 600; white-space: nowrap; padding-right: 16px; }
.rubrica-tabla td.crit { color: #64748b; font-size: 13px; }
.rubrica-tabla .pt { font-weight: 800; color: #0d1b2a; }
.rubrica-chip {
    display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 5px;
    padding: 1px 6px; font-variant-numeric: tabular-nums;
}
.rubrica-chip.full { color: #0f8f6f; background: #e5f4ee; }
.rubrica-chip.part { color: #b8781c; background: #f8efdd; }

.rubrica-callout {
    display: flex; gap: 8px; margin: 12px 0 2px; padding: 10px 12px;
    background: #f8fafc; border: 1px solid #eef0f2; border-radius: 9px;
    font-size: 12.5px; color: #64748b;
}
.rubrica-callout b { color: #0d1b2a; }

.rubrica-foot {
    padding: 14px 22px 18px; border-top: 1px solid #eef0f2; text-align: right;
    background: #fff;
}
.rubrica-btn {
    padding: 11px 26px; border: none; border-radius: 9px;
    background: #1d6fa5; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background .12s;
}
.rubrica-btn:hover { background: #155a87; }

@media (max-width: 520px) {
    .rubrica-tabla td.comp { white-space: normal; }
}

/* Avatares deshabilitados temporalmente (pendiente de rehacerlos según la edad).
   Para reactivarlos: eliminar esta regla y el `return ""` de avatar_url() en app.py. */
.brief-avatar, .caso-avatar, .caso-compacto-avatar, .eb-avatar, .pd-caso-avatar {
    display: none !important;
}
