/* Control de acceso (lector QR) — pantalla completa, mobile-first */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body.check-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: #0a0a14;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

/* ===================== LOGIN ===================== */
.check-login {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
}
.check-login__logo { width: 120px; height: auto; margin-bottom: 1rem; }
.check-login h1 { margin: 0; font-size: 1.5rem; font-weight: 800; }
.check-login__sub { color: rgba(255,255,255,0.6); margin: 0.4rem 0 2rem; }
.check-login__alert {
    background: rgba(255,80,80,0.15); border: 1px solid rgba(255,80,80,0.35);
    padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.88rem;
    margin-bottom: 1rem; max-width: 320px; width: 100%;
}
.check-login form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 0.9rem; }
.check-login label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem;
    color: rgba(255,255,255,0.7); letter-spacing: 0.05em; text-transform: uppercase; text-align: left; }
.check-login input {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
    padding: 0.85rem 0.9rem; border-radius: 10px; color: #fff;
    font-size: 1.05rem; outline: none;
}
.check-login input:focus { border-color: #d9a21b; background: rgba(255,255,255,0.12); }
.check-login button {
    background: #d9a21b; color: #1a1a2e;
    border: 0; padding: 0.95rem; border-radius: 12px;
    font-size: 1.05rem; font-weight: 700; letter-spacing: 0.02em;
    margin-top: 0.4rem; cursor: pointer;
}
.check-login button:active { transform: translateY(1px); }

/* ===================== SCAN ===================== */
.check-scan-body { overflow: hidden; }

.check-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: 52px; padding: env(safe-area-inset-top, 0) 0.8rem 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0));
    display: flex; align-items: center; justify-content: space-between;
    z-index: 10; pointer-events: none;
}
.check-header > * { pointer-events: auto; }
.check-header__title {
    font-size: 0.92rem; font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 60%;
}
.check-header__actions { display: flex; gap: 0.5rem; align-items: center; }
.check-icon-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,0.14); border: 0; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; cursor: pointer; text-decoration: none;
    backdrop-filter: blur(8px);
}
.check-icon-btn--on { background: #d9a21b; color: #1a1a2e; }
.check-icon-btn:active { transform: scale(0.92); }

.check-main {
    height: 100vh; height: 100dvh;
    display: grid; grid-template-rows: 60vh 1fr;
}

.check-cam {
    position: relative; overflow: hidden;
    background: #000;
}
.check-cam video {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
}
.check-cam__overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.check-cam__frame {
    width: 70vw; max-width: 280px; aspect-ratio: 1;
    border: 3px solid rgba(255,255,255,0.85);
    border-radius: 22px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
    position: relative;
    animation: scanPulse 1.6s ease-in-out infinite;
}
.check-cam__frame::before, .check-cam__frame::after {
    content: ''; position: absolute; left: 8%; right: 8%; height: 2px;
    background: linear-gradient(90deg, transparent, #d9a21b, transparent);
}
.check-cam__frame::before { top: 50%; animation: scanLine 2.4s ease-in-out infinite alternate; }
.check-cam__frame::after  { display: none; }
@keyframes scanLine {
    from { transform: translateY(-46%); opacity: 0.95; }
    to   { transform: translateY( 46%); opacity: 0.95; }
}
@keyframes scanPulse {
    0%, 100% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.35), 0 0 0 0 rgba(217,162,27,0); }
    50%      { box-shadow: 0 0 0 9999px rgba(0,0,0,0.35), 0 0 0 6px rgba(217,162,27,0.15); }
}
.check-cam__hint {
    position: absolute; left: 0; right: 0; bottom: 12px;
    text-align: center;
    font-size: 0.85rem; font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* ===== RESULTADO ===== */
.check-result {
    background: #14141f;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    display: flex; flex-direction: column; align-items: center;
    text-align: center;
    transition: background 0.2s ease;
}
.check-result__placeholder { padding-top: 1.2rem; opacity: 0.65; }
.check-result__icon { font-size: 3rem; line-height: 1; margin-bottom: 0.35rem; }
.check-result__title {
    font-size: 1.55rem; font-weight: 800; letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}
.check-result__fam {
    font-size: 1rem; color: rgba(255,255,255,0.8);
    margin-bottom: 0.6rem; font-weight: 600;
}
.check-result__sub {
    font-size: 0.88rem; color: rgba(255,255,255,0.6);
}
.check-result__counts {
    display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
    margin: 0.4rem 0 0.6rem;
}
.check-result__counts span {
    background: rgba(255,255,255,0.1);
    padding: 0.35rem 0.7rem; border-radius: 999px;
    font-size: 0.8rem;
}
.check-result__counts strong { font-size: 1.05rem; }
.check-result__counts .check-result__total {
    background: rgba(255,255,255,0.18); font-weight: 700;
}
.check-result__detail {
    font-size: 0.78rem; color: rgba(255,255,255,0.7);
    line-height: 1.5;
    margin-top: 0.2rem;
    max-width: 100%; word-break: break-word;
}
.check-result__tap {
    margin-top: 0.7rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.05em;
}

/* Estados */
.check-result--entry          { background: #0f3d22; }
.check-result--entry .check-result__icon  { color: #43d984; }
.check-result--entry .check-result__title { color: #6cf2a3; }

.check-result--reentry        { background: #14304a; }
.check-result--reentry .check-result__icon  { color: #4ec3ff; }
.check-result--reentry .check-result__title { color: #8ad6ff; }

.check-result--invalid,
.check-result--not_registered { background: #4a1414; }
.check-result--invalid .check-result__icon,
.check-result--not_registered .check-result__icon  { color: #ff5e5e; }
.check-result--invalid .check-result__title,
.check-result--not_registered .check-result__title { color: #ff8a8a; }

/* ===== FAB entrada manual ===== */
.check-fab {
    position: fixed; right: 14px; bottom: 14px;
    width: 52px; height: 52px; border-radius: 50%;
    background: #d9a21b; color: #1a1a2e;
    border: 0; font-size: 1.4rem; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    z-index: 20;
}

/* ===== Diálogo manual ===== */
.check-dialog {
    border: 0; border-radius: 18px;
    padding: 1.3rem 1.4rem 1.1rem;
    background: #1a1a2e; color: #fff;
    max-width: 340px; width: 92%;
}
.check-dialog::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.check-dialog h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.check-dialog p { margin: 0 0 0.9rem; color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.check-dialog input {
    width: 100%; padding: 0.85rem 0.9rem;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px; color: #fff; font-size: 1.1rem;
    letter-spacing: 0.05em; text-align: center; outline: none;
}
.check-dialog__actions {
    display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem;
}
.check-dialog__actions button {
    padding: 0.65rem 1rem; border-radius: 10px; border: 0;
    font-weight: 600; cursor: pointer;
}
.btn-ghost   { background: rgba(255,255,255,0.1); color: #fff; }
.btn-primary { background: #d9a21b; color: #1a1a2e; }
