/* =====================================================================
   ARCHIVO DE DOCUMENTACIÓN · Estilo claro institucional
   Fondo claro, cabecera verde oliva sobrio, tipografía del sistema.
   ===================================================================== */

:root {
    --fondo: #f3f4f1;
    --superficie: #ffffff;
    --superficie-2: #f8f9f6;
    --borde: #dde0d7;
    --borde-fuerte: #c6cbbd;
    --texto: #1f241c;
    --texto-suave: #5d6457;
    --texto-tenue: #848b7d;
    --oliva: #4b5b2a;
    --oliva-osc: #3f4d24;
    --oliva-hover: #36421f;
    --oliva-claro: #e9eddf;
    --oliva-medio: #c9d3ad;
    --carpeta: #c9a227;
    --carpeta-osc: #a9861c;
    --ok: #2f7d32;
    --ok-fondo: #e8f3e8;
    --alerta: #9a6700;
    --alerta-fondo: #fff6e0;
    --error: #b3261e;
    --error-fondo: #fdecea;
    --info-fondo: #eef2f7;
    --info: #2f4f7a;
    --radio: 8px;
    --radio-peq: 5px;
    --sombra: 0 1px 2px rgba(31, 36, 28, .06), 0 2px 8px rgba(31, 36, 28, .05);
    --sombra-alta: 0 10px 30px rgba(31, 36, 28, .18);
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--fondo);
    color: var(--texto);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--oliva); }
a:hover { color: var(--oliva-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; color: var(--texto); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

.mono { font-family: var(--mono); font-size: .92em; }
.texto-suave { color: var(--texto-suave); }
.texto-mini { font-size: .82rem; color: var(--texto-tenue); margin: .6rem 0 0; }
.oculto { display: none !important; }
.en-linea { display: inline; margin: 0; }

/* ---------- Cabecera ---------- */
.cabecera {
    background: var(--oliva-osc);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.cabecera-interior {
    max-width: 1180px;
    margin: 0 auto;
    padding: .7rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.marca { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.marca:hover { color: #fff; }
.marca-logo { border-radius: 6px; background: #fff; padding: 2px; }
.marca-texto { display: flex; flex-direction: column; line-height: 1.2; }
.marca-nombre { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.marca-sub { font-size: .75rem; color: #d7dec4; }

.menu { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.menu a {
    color: #e8ecdc;
    text-decoration: none;
    padding: .45rem .75rem;
    border-radius: var(--radio-peq);
    font-size: .93rem;
}
.menu a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.menu a.activo { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.menu-usuario { font-size: .85rem; color: #d7dec4; padding: 0 .4rem 0 .8rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-salir { margin: 0; }
.menu-boton { display: none; }
.chip { display: inline-block; font-size: .72rem; padding: .05rem .4rem; margin-left: .3rem; border-radius: 10px; background: #fff; color: var(--oliva-osc); font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
    .menu-boton {
        display: inline-block;
        background: rgba(255, 255, 255, .12);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, .3);
        padding: .4rem .8rem;
        border-radius: var(--radio-peq);
        font-size: .9rem;
        cursor: pointer;
    }
    .menu { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-top: .4rem; }
    .menu.abierto { display: flex; }
    .menu a { padding: .7rem .6rem; }
    .menu-usuario { padding: .6rem; max-width: none; }
    .form-salir .btn { width: 100%; }
}

/* ---------- Estructura ---------- */
.contenedor { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; flex: 1; }
.pie {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
    max-width: 1180px; width: 100%; margin: 0 auto;
    padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom));
    font-size: .8rem; color: var(--texto-tenue);
    border-top: 1px solid var(--borde);
}

.tarjeta {
    background: var(--superficie);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 1.4rem;
    box-shadow: var(--sombra);
    margin-bottom: 1.2rem;
}

.sello {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--oliva);
    background: var(--oliva-claro);
    padding: .2rem .6rem;
    border-radius: 20px;
    margin-bottom: .6rem;
    letter-spacing: .02em;
}
.sello-rojo { color: var(--error); background: var(--error-fondo); }

.encabezado-seccion { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.2rem; }
.titulo-bloque { font-size: .85rem; font-weight: 700; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .06em; margin: 1.6rem 0 .8rem; }
.lista-simple { padding-left: 1.2rem; color: var(--texto-suave); }

/* ---------- Avisos ---------- */
.aviso { padding: .8rem 1rem; border-radius: var(--radio-peq); margin: 0 0 1rem; border: 1px solid; font-size: .95rem; }
.aviso-ok    { background: var(--ok-fondo); border-color: #b9dbba; color: #1e5a21; }
.aviso-info  { background: var(--info-fondo); border-color: #cdd8e6; color: var(--info); }
.aviso-aviso { background: var(--alerta-fondo); border-color: #f0d79a; color: #6d4b00; }
.aviso-error { background: var(--error-fondo); border-color: #f2c0bb; color: #8c1d17; }

/* ---------- Formularios ---------- */
.formulario { display: flex; flex-direction: column; gap: .3rem; }
.formulario label, .rejilla-form label { font-size: .85rem; font-weight: 600; color: var(--texto-suave); margin-top: .6rem; display: block; }
input[type="text"], input[type="password"], input[type="search"], select {
    width: 100%;
    background: #fff;
    color: var(--texto);
    border: 1px solid var(--borde-fuerte);
    border-radius: var(--radio-peq);
    padding: .65rem .75rem;
    font-size: 1rem; /* 16px evita el zoom automático en iPhone */
    font-family: var(--sans);
}
input:focus, select:focus { outline: 2px solid var(--oliva-medio); outline-offset: 0; border-color: var(--oliva); }
.casilla { display: flex; align-items: center; gap: .5rem; margin: 1rem 0 0; font-size: .95rem; cursor: pointer; }
.casilla input { width: 18px; height: 18px; accent-color: var(--oliva); }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    padding: .6rem 1.1rem;
    border-radius: var(--radio-peq);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: .93rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    transition: background .15s, border-color .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--oliva); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--oliva-hover); color: #fff; }
.btn-secundario { background: #fff; color: var(--texto); border-color: var(--borde-fuerte); }
.btn-secundario:hover:not(:disabled) { border-color: var(--oliva); color: var(--oliva); background: var(--superficie-2); }
.btn-peligro { background: #fff; color: var(--error); border-color: #e6b3ae; }
.btn-peligro:hover:not(:disabled) { background: var(--error); color: #fff; border-color: var(--error); }
.btn-claro { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn-claro:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.btn-bloque { width: 100%; margin-top: 1.2rem; }
.btn-peq { padding: .38rem .7rem; font-size: .84rem; }
.fila-botones { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* ---------- Login ---------- */
.pagina-login .contenedor { display: flex; align-items: flex-start; justify-content: center; }
.login-caja { width: 100%; max-width: 420px; margin: 3rem auto; padding: 2rem; }
.login-cabecera { margin-bottom: 1rem; }

/* =====================================================================
   EXPLORADOR DE CARPETAS
   ===================================================================== */
.explorador-cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.explorador-cabecera h1 { margin-bottom: .25rem; }
.explorador-cabecera .texto-suave { margin: 0; }
.explorador-lateral { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.zona-etiqueta { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--oliva); margin: 0 0 .3rem; }
.zona-etiqueta.zona-restringida { color: var(--error); }

.buscador { display: flex; gap: .4rem; }
.buscador input { width: 240px; padding: .5rem .7rem; }
@media (max-width: 600px) {
    .explorador-lateral, .buscador { width: 100%; }
    .buscador input { flex: 1; width: auto; }
}

.migas {
    display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
    background: var(--superficie);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: .6rem .9rem;
    margin-bottom: 1rem;
    font-size: .92rem;
}
.migas a { text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.migas a:hover { text-decoration: underline; }
.migas-sep { color: var(--texto-tenue); }
.migas-actual { font-weight: 600; color: var(--texto); }
.icono-mini { width: 16px; height: 16px; fill: currentColor; }

.barra-admin {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    background: var(--oliva-claro);
    border: 1px dashed var(--oliva-medio);
    border-radius: var(--radio);
    padding: .55rem .8rem;
    margin-bottom: 1.2rem;
}
.barra-admin-titulo { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--oliva); margin-right: .4rem; }

/* Carpetas */
.rejilla-carpetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; margin-bottom: 1.4rem; }
.carpeta {
    display: flex; flex-direction: column; align-items: flex-start; gap: .35rem;
    background: var(--superficie);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 1rem;
    text-decoration: none;
    color: var(--texto);
    box-shadow: var(--sombra);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.carpeta:hover { border-color: var(--oliva-medio); box-shadow: var(--sombra-alta); transform: translateY(-2px); color: var(--texto); }
.icono-carpeta { width: 48px; height: 40px; }
.carpeta-fondo { fill: var(--carpeta-osc); }
.carpeta-frente { fill: var(--carpeta); }
.carpeta-nombre { font-weight: 650; font-size: 1rem; word-break: break-word; }
.carpeta-meta { font-size: .8rem; color: var(--texto-tenue); }

/* Documentos */
.lista-archivos { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.archivo { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--borde); }
.archivo:last-child { border-bottom: 0; }
.archivo:hover { background: var(--superficie-2); }
.archivo-icono {
    width: 42px; height: 50px;
    display: grid; place-items: center;
    border-radius: 5px;
    font-size: .68rem; font-weight: 800; letter-spacing: .03em;
    color: #fff; text-decoration: none;
    background: #7a8270;
    position: relative;
}
.archivo-icono::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 10px 10px 0; border-style: solid; border-color: var(--fondo) var(--fondo) rgba(0, 0, 0, .25) rgba(0, 0, 0, .25); border-radius: 0 5px 0 3px; }
.archivo-icono:hover { color: #fff; filter: brightness(1.08); }
.tipo-pdf { background: #c0392b; }
.tipo-doc { background: #2b5797; }
.tipo-xls { background: #1e7145; }
.tipo-ppt { background: #c55a11; }
.tipo-img { background: #7b3fa0; }
.tipo-kml { background: #0f7c8c; }
.archivo-cuerpo { min-width: 0; }
.archivo-titulo { font-weight: 600; color: var(--texto); text-decoration: none; word-break: break-word; }
.archivo-titulo:hover { color: var(--oliva); text-decoration: underline; }
.archivo-desc { margin: .1rem 0 0; font-size: .88rem; color: var(--texto-suave); }
.archivo-meta { margin: .15rem 0 0; font-size: .8rem; color: var(--texto-tenue); }
.archivo-ruta { color: var(--texto-suave); }
.archivo-acciones { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
    .archivo { grid-template-columns: auto 1fr; }
    .archivo-acciones { grid-column: 1 / -1; justify-content: flex-start; }
}

.vacio { text-align: center; padding: 3rem 1rem; background: var(--superficie); border: 1px dashed var(--borde-fuerte); border-radius: var(--radio); color: var(--texto-suave); }
.vacio .icono-carpeta { width: 64px; height: 54px; opacity: .45; margin-bottom: .6rem; }

/* Cuenta atrás (zona restringida) */
.cuenta-atras {
    display: grid; grid-template-columns: auto auto; align-items: center; column-gap: .6rem;
    background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
    padding: .45rem .8rem;
}
.cuenta-atras-etiqueta { font-size: .75rem; color: var(--texto-suave); }
.cuenta-atras-valor { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ok); }
.cuenta-atras-barra { grid-column: 1 / -1; height: 3px; background: var(--borde); margin-top: .3rem; border-radius: 2px; overflow: hidden; }
.cuenta-atras-barra span { display: block; height: 100%; width: 100%; background: var(--ok); transition: width 1s linear; }
.cuenta-atras.critica .cuenta-atras-valor { color: var(--error); }
.cuenta-atras.critica .cuenta-atras-barra span { background: var(--error); }

/* Diálogos (administración) */
.dialogo {
    border: 0; border-radius: 12px; padding: 1.5rem;
    width: min(520px, calc(100vw - 2rem));
    box-shadow: var(--sombra-alta);
    color: var(--texto);
}
.dialogo::backdrop { background: rgba(20, 24, 16, .45); }
.dialogo h2 { margin-bottom: .3rem; }
.dialogo-botones { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }
.zona-soltar {
    display: flex !important; flex-direction: column; align-items: center; gap: .3rem;
    text-align: center; cursor: pointer;
    border: 2px dashed var(--oliva-medio); border-radius: var(--radio);
    background: var(--superficie-2); padding: 1.4rem 1rem; margin-top: .8rem !important;
    color: var(--texto) !important; font-weight: 400 !important;
}
.zona-soltar span { font-size: .8rem; color: var(--texto-tenue); }
.zona-soltar.encima { background: var(--oliva-claro); border-color: var(--oliva); }
#subArchivos { font-size: .9rem; margin-top: .4rem; }
.lista-subida { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 180px; overflow-y: auto; font-size: .85rem; }
.lista-subida li { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem .1rem; border-bottom: 1px solid var(--borde); }
.lista-subida li.mal { color: var(--error); }

/* =====================================================================
   PANEL / ESTADO (admin)
   ===================================================================== */
.estado-rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.estado-item { background: var(--superficie); border: 1px solid var(--borde); padding: .8rem 1rem; border-radius: var(--radio); display: flex; flex-direction: column; gap: .15rem; box-shadow: var(--sombra); }
.estado-etiqueta { font-size: .75rem; color: var(--texto-tenue); text-transform: uppercase; letter-spacing: .04em; }
.estado-valor { font-size: 1.3rem; font-weight: 700; }
.estado-valor.ok { color: var(--ok); }
.estado-valor.alerta { color: var(--alerta); }
.estado-valor.apagado { color: var(--texto-tenue); }

.tabla-envoltorio { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 760px; }
.tabla th, .tabla td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla th { background: var(--superficie-2); font-size: .75rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr:hover td { background: var(--superficie-2); }
.tabla form { margin: 0 .2rem .2rem 0; display: inline-block; }
.ua { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texto-tenue); font-size: .78rem; }

.etiqueta { display: inline-block; font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 20px; white-space: nowrap; }
.etiqueta-ok { color: var(--ok); background: var(--ok-fondo); }
.etiqueta-error { color: var(--error); background: var(--error-fondo); }
.etiqueta-aviso { color: var(--alerta); background: var(--alerta-fondo); }
.etiqueta-neutra { color: var(--texto-suave); background: #eceee8; }

.interruptor {
    display: inline-flex; align-items: center; gap: .45rem;
    border: 1px solid var(--borde-fuerte); background: #fff; color: var(--texto-suave);
    border-radius: 20px; padding: .25rem .7rem .25rem .3rem; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.interruptor::before { content: ""; width: 26px; height: 15px; border-radius: 10px; background: #cfd3c8 radial-gradient(circle at 7px 50%, #fff 5px, transparent 5.5px); transition: background .15s; }
.interruptor.activo { color: var(--ok); border-color: #b9dbba; background: var(--ok-fondo); }
.interruptor.activo::before { background: var(--ok) radial-gradient(circle at 19px 50%, #fff 5px, transparent 5.5px); }

.pestanas { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--borde); }
.pestanas a { padding: .6rem 1rem; text-decoration: none; color: var(--texto-suave); font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.pestanas a.activo { color: var(--oliva); border-color: var(--oliva); }

.rejilla-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .2rem 1rem; align-items: end; }
.rejilla-form + .casilla + .btn, .rejilla-form + .btn { margin-top: 1rem; }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filtros select { width: auto; min-width: 200px; }
.paginacion { display: flex; gap: .6rem; justify-content: center; align-items: center; margin-top: 1rem; font-size: .9rem; }

/* =====================================================================
   CÁMARA: registro y verificación facial
   (el visor del vídeo sigue siendo oscuro: es la imagen de la cámara)
   ===================================================================== */
.camara-rejilla { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .camara-rejilla { grid-template-columns: 1fr; } }

.visor {
    position: relative; width: 100%; aspect-ratio: 4 / 3;
    background: #111; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra);
}
.visor video, .visor canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.visor canvas { pointer-events: none; }
.visor-reticula { position: absolute; inset: 14px; pointer-events: none; border: 2px solid rgba(255, 255, 255, .25); border-radius: 10px; }
.visor-escaneo { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, #b5c98a, transparent); animation: escaneo 2.6s linear infinite; opacity: .6; pointer-events: none; }
@keyframes escaneo { from { top: 0; } to { top: 100%; } }
.visor-hud { position: absolute; top: 10px; left: 16px; right: 16px; display: flex; justify-content: space-between; font-family: var(--mono); font-size: .72rem; color: #fff; text-shadow: 0 0 4px #000; pointer-events: none; }
.rec { color: #ff6b5a; }
.rec::before { content: "● "; animation: parpadeo 1s steps(2, start) infinite; }
@keyframes parpadeo { to { visibility: hidden; } }
.visor-estado { position: absolute; left: 0; right: 0; bottom: 0; padding: .6rem .9rem; background: linear-gradient(0deg, rgba(0,0,0,.8), rgba(0,0,0,0)); font-size: .85rem; color: #fff; pointer-events: none; }

.reto-instruccion {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 92%;
    text-align: center; font-weight: 800; font-size: clamp(1.4rem, 5vw, 2.4rem); letter-spacing: .03em;
    color: #fff; text-shadow: 0 0 10px #000, 0 0 20px rgba(0,0,0,.8); pointer-events: none; text-transform: uppercase;
}
.reto-instruccion.arriba {
    top: 4%; transform: translate(-50%, 0);
    font-size: clamp(.95rem, 2.6vw, 1.25rem); text-transform: none; letter-spacing: 0;
    background: rgba(0, 0, 0, .55); padding: .4rem .7rem; border-radius: var(--radio-peq);
}
.reto-flecha { display: block; font-size: 1.5em; color: #ffd166; animation: latido 1s ease-in-out infinite; }
.reto-sub { display: block; font-size: .45em; letter-spacing: 0; margin-top: .3em; color: #f1f3ea; text-transform: none; font-weight: 600; }
@keyframes latido { 50% { transform: scale(1.15); opacity: .75; } }

.visor-mensaje {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem;
    text-align: center; padding: 1.5rem; background: rgba(250, 250, 248, .97); color: var(--texto); z-index: 5;
}
.visor-mensaje.error { color: var(--error); }
.cargador { width: 40px; height: 40px; border: 3px solid var(--borde); border-top-color: var(--oliva); border-radius: 50%; animation: giro .9s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

.resultado { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; z-index: 6; text-align: center; animation: aparecer .35s ease-out; }
.resultado-titulo { font-size: clamp(1.5rem, 5.5vw, 2.6rem); font-weight: 900; letter-spacing: .08em; padding: .35rem 1.1rem; border: 4px solid currentColor; border-radius: 6px; background: rgba(255,255,255,.92); transform: rotate(-3deg); animation: sello-golpe .5s cubic-bezier(.2, 1.6, .4, 1); }
.resultado-sub { font-size: .95rem; color: #fff; text-shadow: 0 0 6px #000; font-weight: 600; }
.resultado.concedido { background: rgba(47, 125, 50, .55); color: var(--ok); }
.resultado.denegado { background: rgba(179, 38, 30, .55); color: var(--error); }
.resultado.denegado .resultado-titulo { animation: sello-golpe .5s cubic-bezier(.2, 1.6, .4, 1), temblor .4s .5s; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes sello-golpe { from { transform: scale(2) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(-3deg); opacity: 1; } }
@keyframes temblor { 20%, 60% { transform: translateX(-8px) rotate(-3deg); } 40%, 80% { transform: translateX(8px) rotate(-3deg); } }

.telemetria { display: flex; flex-direction: column; gap: .8rem; }
.telemetria h2 { font-size: 1.05rem; }
.telemetria-fila { display: flex; justify-content: space-between; gap: .6rem; font-size: .88rem; border-bottom: 1px solid var(--borde); padding-bottom: .35rem; }
.telemetria-fila span:first-child { color: var(--texto-suave); }
.telemetria-fila span:last-child { font-family: var(--mono); text-align: right; }

.medidor-cabecera { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; color: var(--texto-suave); margin-bottom: .3rem; }
.medidor-valor { font-size: 1.5rem; font-weight: 800; color: var(--texto); }
.medidor-barra { position: relative; height: 14px; background: #eceee8; border-radius: 7px; overflow: hidden; }
.medidor-relleno { height: 100%; width: 0; background: var(--ok); border-radius: 7px; transition: width 1.2s cubic-bezier(.2, .8, .2, 1), background .3s; }
.medidor-relleno.bajo { background: var(--error); }
.medidor-umbral { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--alerta); }
.medidor-leyenda { display: flex; justify-content: space-between; font-size: .7rem; color: var(--texto-tenue); margin-top: .25rem; }
.progreso-reto { height: 6px; background: #eceee8; border-radius: 3px; overflow: hidden; }
.progreso-reto span { display: block; height: 100%; width: 0; background: var(--oliva); transition: width .2s linear; }

.muestras { display: flex; gap: .5rem; flex-wrap: wrap; }
.muestra { width: 52px; height: 52px; border: 1px dashed var(--borde-fuerte); border-radius: var(--radio-peq); display: grid; place-items: center; font-size: .8rem; color: var(--texto-tenue); background: var(--superficie-2); overflow: hidden; }
.muestra img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.muestra.ok { border: 2px solid var(--ok); }

/* Guía visual de giro de cabeza */
.guia-giro { position: absolute; left: 6%; right: 6%; bottom: 2.6rem; display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; background: rgba(0,0,0,.6); border-radius: var(--radio-peq); pointer-events: none; z-index: 3; }
.guia-etq { font-size: .68rem; color: #e6e9df; white-space: nowrap; font-weight: 700; }
.guia-pista { position: relative; flex: 1; height: 14px; background: rgba(255,255,255,.15); border-radius: 7px; }
.guia-zona { position: absolute; top: 0; bottom: 0; background: rgba(120, 200, 110, .4); border-left: 2px solid #8fd14f; border-right: 2px solid #8fd14f; }
.guia-centro { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(255,255,255,.6); }
.guia-marca { position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #ffd166; box-shadow: 0 0 8px #ffd166; transition: left .12s linear, background .2s; }
.guia-giro.dentro .guia-marca { background: #8fd14f; box-shadow: 0 0 10px #8fd14f; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ajustes de cabecera en pantallas medianas */
@media (max-width: 1320px) and (min-width: 901px) {
    .marca-sub { display: none; }
    .menu a { padding: .45rem .6rem; font-size: .9rem; }
    .menu-usuario { max-width: 140px; }
}

/* Input de archivos oculto visualmente (se usa la zona de soltar como botón) */
.visualmente-oculto { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.zona-soltar:focus-within { outline: 2px solid var(--oliva-medio); }
