* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

html,
body {
    margin: 0;
    padding: 0;
    touch-action: manipulation;
    width: 100%;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #0b1220 0%, #09101d 100%);
    color: #f1f5f9;
    min-height: 100vh;
    overflow: hidden;
}

.kiosco-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================= HEADER ================= */

.header {
    width: 100%;
    min-height: 88px;
    background: #1F2933;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.30);
    gap: 18px;
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
}

.kiosco-logo-horizontal {
    height: 42px;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

#empresaNombre {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
}

.estado {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.estado.online {
    color: #3FA36B;
}

.estado.offline {
    color: #ef4444;
}

.estado-geo {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.06);
}

.estado-geo.geo-ok {
    color: #86efac;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
}

.estado-geo.geo-denegado,
.estado-geo.geo-error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}

.estado-geo.geo-pendiente,
.estado-geo.geo-no-disponible {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
}

.hora-actual,
.reloj-kiosco {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
    min-width: 86px;
    text-align: right;
    white-space: nowrap;
}

/* ================= PANTALLAS ================= */

.pantallas-wrapper {
    flex: 1;
    height: calc(100vh - 90px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.pantalla {
    display: none;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.pantalla.active {
    display: flex;
    opacity: 1;
}

/* ================= CARD ================= */

.card {
    background: #1e293b;
    width: 460px;
    max-width: 100%;
    padding: 42px 34px;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.50);
    text-align: center;
}

.card h2 {
    margin-top: 0;
}

/* ================= PIN ================= */

#pinInput {
    width: 100%;
    height: 64px;
    font-size: 2rem;
    text-align: center;
    border-radius: 16px;
    border: none;
    margin-bottom: 28px;
    background: #334155;
    color: white;
    letter-spacing: 8px;
    outline: none;
}

/* ================= TECLADO ================= */

#teclado {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

#teclado button {
    height: 78px;
    font-size: 1.8rem;
    border-radius: 18px;
    border: none;
    background: #334155;
    color: white;
    transition: 0.2s ease;
}

#teclado button:active {
    transform: scale(0.95);
    background: #475569;
}

/* ================= ACCIONES ================= */

#botonesAccion {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

#botonesAccion button {
    width: 100%;
    height: 78px;
    font-size: 1.45rem;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    transition: 0.2s ease;
}

#botonesAccion button:disabled {
    opacity: 0.4;
}

#botonesAccion button:not(:disabled):active {
    transform: scale(0.97);
}

/* ================= COLORES ACCIONES ================= */

button.accion-entrada {
    background: #22c55e;
    color: #0f172a;
}

button.accion-salida {
    background: #ef4444;
    color: white;
}

button.accion-pausa {
    background: #3b82f6;
    color: white;
}

button.accion-ausencia {
    background: #f59e0b;
    color: #111827;
}

button.accion-ausencia-fin {
    background: #8b5cf6;
    color: white;
}

button.accion-entrada:active {
    background: #16a34a;
}

button.accion-salida:active {
    background: #dc2626;
}

button.accion-pausa:active {
    background: #2563eb;
}

button.accion-ausencia:active {
    background: #d97706;
}

button.accion-ausencia-fin:active {
    background: #7c3aed;
}

#empleadoNombre {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.texto-estado {
    margin-bottom: 20px;
}

#geoResumenAccion {
    margin-bottom: 18px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
}

#geoResumenAccion.hidden {
    display: none;
}

/* ================= MENSAJES ================= */

.mensaje-error {
    margin-top: 16px;
    color: #f87171;
    font-size: 0.95rem;
    min-height: 1.2em;
}

.mensaje-info {
    margin-top: 16px;
    color: #93c5fd;
    font-size: 0.95rem;
    min-height: 1.2em;
}

/* ================= CONFIRMACION ================= */

.confirmacion {
    background: #16a34a;
    color: white;
    text-align: center;
}

.iconoConfirmacion {
    font-size: 4rem;
    margin-bottom: 20px;
}

#mensajeConfirmacion {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}

#nombreConfirmacion {
    font-size: 1.4rem;
    margin-bottom: 5px;
}

#horaConfirmacion {
    font-size: 1.2rem;
    opacity: 0.9;
}

#geoConfirmacion {
    margin-top: 14px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.92);
}

/* ======================================
   MODAL CIERRE JORNADA / AUSENCIA
====================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1e293b;
    padding: 30px;
    border-radius: 12px;
    width: 420px;
    max-width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
    color: #f59e0b;
    margin-top: 0;
    margin-bottom: 10px;
}

.modal-content label {
    display: block;
    margin-top: 20px;
    margin-bottom: 8px;
}

.modal-content input,
.modal-content select {
    padding: 10px;
    font-size: 18px;
    width: 100%;
    max-width: 220px;
    border-radius: 8px;
    border: none;
    background: #334155;
    color: #ffffff;
}

.modal-botones {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.btn-confirmar {
    background: #22c55e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 16px;
}

.btn-cancelar {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 16px;
}

/* ================= KIOSCO BLOQUEADO ================= */

.kiosco-bloqueado-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: #111827;
    color: #f9fafb;
    text-align: center;
}

.kiosco-bloqueado-card {
    max-width: 520px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.kiosco-bloqueado-card h1 {
    margin: 0 0 16px;
    font-size: 28px;
    color: #f9fafb;
}

.kiosco-bloqueado-card p {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.5;
    color: #f9fafb;
}

.kiosco-bloqueado-help {
    margin: 0 0 20px;
    font-size: 14px;
    color: #9ca3af;
}

.btn-reintentar-kiosco {
    border: 0;
    border-radius: 10px;
    padding: 12px 20px;
    background: #2563eb;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
}

.btn-reintentar-kiosco:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* ================= PWA INSTALL ================= */

.instalacion-pwa {
    margin: 14px auto 18px auto;
    width: 100%;
    display: flex;
    justify-content: center;
}

.instalacion-pwa.hidden {
    display: none;
}

.instalacion-pwa-card {
    width: min(92%, 560px);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 18px 20px;
    text-align: center;
    backdrop-filter: blur(8px);
}

.instalacion-pwa-logo {
    height: 36px;
    max-width: 220px;
    object-fit: contain;
    margin: 0 auto 12px auto;
    display: block;
}

.instalacion-pwa-titulo {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #ffffff;
}

.instalacion-pwa-texto {
    margin: 0 0 14px 0;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
}

.instalacion-pwa-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-instalar-pwa,
.btn-cerrar-instalar-pwa {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-instalar-pwa {
    background: #ffffff;
    color: #1F2933;
}

.btn-cerrar-instalar-pwa {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.instalacion-pwa-fallback {
    margin-top: 14px;
    font-size: 0.92rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.instalacion-pwa-fallback.hidden {
    display: none;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 900px) {
    .header {
        min-height: 82px;
        padding: 12px 16px;
        gap: 12px;
    }

    .kiosco-logo-horizontal {
        height: 34px;
        max-width: 180px;
    }

    .header-right {
        gap: 8px;
    }

    #empresaNombre {
        font-size: 1.25rem;
    }

    .estado {
        font-size: 0.9rem;
    }

    .estado-geo {
        font-size: 0.78rem;
        padding: 5px 8px;
    }

    .hora-actual,
    .reloj-kiosco {
        font-size: 1.05rem;
        min-width: auto;
    }

    .pantallas-wrapper {
        height: calc(100vh - 86px);
        padding: 18px;
    }

    .card {
        width: 100%;
        max-width: 430px;
        padding: 32px 26px;
    }

    #pinInput {
        height: 60px;
        font-size: 1.8rem;
        margin-bottom: 22px;
    }

    #teclado {
        gap: 12px;
    }

    #teclado button {
        height: 68px;
        font-size: 1.65rem;
    }

    #botonesAccion button {
        height: 72px;
        font-size: 1.3rem;
    }
}

/* ========================= */
/* 🔵 Banner demo */
/* ========================= */
.demo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: #000;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    z-index: 9999;
}

/* ========================= */
/* 🔑 Panel PINs */
/* ========================= */
.demo-pins {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    max-width: 240px;
    z-index: 9999;
}

.demo-pins h3 {
    margin: 0 0 6px 0;
    font-size: 14px;
}

.demo-pins ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.demo-pins li {
    margin-bottom: 4px;
}