/* ============================================
   CLOCKIN KIOSK — Redesigned
   Industry-standard restaurant time clock
   ============================================ */

:root {
    /* Base palette — deep navy dark mode */
    --bg-primary: #0b0f19;
    --bg-elevated: #141926;
    --bg-card: #1a2033;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-light: rgba(255, 255, 255, 0.12);

    --text-primary: #f0f2f5;
    --text-secondary: rgba(240, 242, 245, 0.6);
    --text-tertiary: rgba(240, 242, 245, 0.35);

    --accent-green: #22c55e;
    --accent-green-soft: rgba(34, 197, 94, 0.15);
    --accent-green-glow: 0 0 40px rgba(34, 197, 94, 0.2);
    --accent-red: #ef4444;
    --accent-red-soft: rgba(239, 68, 68, 0.15);
    --accent-red-glow: 0 0 40px rgba(239, 68, 68, 0.2);

    /* Spacing */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 32px;
    --sp-2xl: 48px;

    /* Radius */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-full: 9999px;

    /* Motion */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 120ms;
    --dur-normal: 250ms;

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', Menlo, monospace;
}

/* ── Reset ─────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

input, select, textarea { font-size: 16px !important; }

/* ── App & Screens ─────────────────────── */

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.kiosk-lock-form {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    z-index: 70;
}

.kiosk-lock-button {
    height: 40px;
    padding: 0 14px;
    border-radius: var(--r-full);
    border: 1px solid var(--border-subtle);
    background: rgba(20, 25, 38, 0.72);
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    -webkit-appearance: none;
    appearance: none;
    transition: color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
}

.kiosk-lock-button:active {
    transform: scale(0.96);
    color: var(--text-primary);
    border-color: var(--border-light);
    background: rgba(26, 32, 51, 0.9);
}

.kiosk-lock-button svg {
    width: 16px;
    height: 16px;
}

.kiosk-login-page {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(22px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 50% 0%, rgba(96, 165, 250, 0.14), transparent 34%),
        linear-gradient(180deg, #0b0f19 0%, #101522 100%);
}

.kiosk-login-shell {
    width: min(440px, 100%);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.kiosk-login-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.kiosk-login-mark {
    width: 58px;
    height: 58px;
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.kiosk-login-eyebrow {
    margin: 0 0 4px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.kiosk-login-brand h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: 0;
}

.kiosk-login-card {
    width: 100%;
    padding: 30px;
    border-radius: var(--r-xl);
    border: 1px solid var(--border-light);
    background: rgba(20, 25, 38, 0.84);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.kiosk-login-copy h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: 0;
}

.kiosk-login-copy p {
    margin: 8px 0 24px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.kiosk-login-field {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.kiosk-login-field span {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.kiosk-login-field input {
    width: 100%;
    height: 52px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.055);
    color: var(--text-primary);
    padding: 0 16px;
    font-family: var(--font);
    font-size: 16px;
    outline: none;
    transition: border-color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.kiosk-login-field input:focus {
    border-color: rgba(96, 165, 250, 0.75);
    background: rgba(255, 255, 255, 0.075);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.kiosk-login-trap {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.kiosk-login-error,
.kiosk-login-status {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.4;
}

.kiosk-login-error {
    margin-top: 12px;
    margin-bottom: 0;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.kiosk-login-status {
    color: #bfdbfe;
    background: rgba(96, 165, 250, 0.11);
    border: 1px solid rgba(96, 165, 250, 0.25);
}

.kiosk-login-submit {
    width: 100%;
    height: 52px;
    margin-top: 22px;
    border-radius: var(--r-md);
    border: none;
    background: #60a5fa;
    color: #08111f;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 18px 42px rgba(96, 165, 250, 0.24);
    -webkit-appearance: none;
    appearance: none;
    transition: transform var(--dur-fast) var(--ease),
                opacity var(--dur-fast) var(--ease);
}

.kiosk-login-submit:active {
    transform: scale(0.98);
    opacity: 0.92;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease-out,
                visibility 120ms ease-out,
                transform 120ms ease-out;
    transform: scale(0.99);
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 10;
}

/* ════════════════════════════════════════
   IDLE SCREEN
   ════════════════════════════════════════ */

#idle-screen {
    cursor: pointer;
}

.idle-layout {
    display: flex;
    align-items: center;
    gap: var(--sp-2xl);
}

.idle-clock-block {
    text-align: right;
    position: relative;
}

.idle-time {
    font-family: var(--font-mono);
    font-size: 96px;
    font-weight: 200;
    letter-spacing: -4px;
    line-height: 1;
    color: var(--text-primary);
}

.idle-seconds {
    position: absolute;
    top: 8px;
    right: -38px;
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 400;
    color: var(--text-tertiary);
}

.idle-date {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: var(--sp-sm);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.idle-divider {
    width: 1px;
    height: 120px;
    background: var(--border-subtle);
}

.idle-cta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-md);
}

.cta-ring {
    width: 80px;
    height: 80px;
    border-radius: var(--r-full);
    border: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    animation: pulse-ring 3s ease-in-out infinite;
}

@keyframes pulse-ring {
    0%, 100% { border-color: var(--border-light); transform: scale(1); }
    50% { border-color: rgba(255,255,255,0.2); transform: scale(1.04); }
}

.cta-label {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.cta-sub {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* ════════════════════════════════════════
   ACTION SELECT SCREEN
   ════════════════════════════════════════ */

.action-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2xl);
}

.action-heading {
    text-align: center;
}

.action-title {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.8px;
    color: var(--text-primary);
}

.action-subtitle {
    margin-top: var(--sp-sm);
    font-size: 16px;
    color: var(--text-secondary);
}

.clock-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: var(--sp-xl);
}

.clock-action-card {
    width: 320px;
    height: 240px;
    border-radius: var(--r-xl);
    border: 2px solid var(--border-light);
    background: var(--bg-elevated);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-lg);
    font-family: var(--font);
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.clock-action-card:active {
    transform: scale(0.97);
}

.clock-action-card.sign-in {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.32), rgba(34, 197, 94, 0.16));
    border-color: rgba(34, 197, 94, 0.65);
}

.clock-action-card.sign-in:active {
    box-shadow: var(--accent-green-glow);
}

.clock-action-card.sign-out {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.32), rgba(239, 68, 68, 0.16));
    border-color: rgba(239, 68, 68, 0.65);
}

.clock-action-card.sign-out:active {
    box-shadow: var(--accent-red-glow);
}

.clock-action-icon {
    width: 84px;
    height: 84px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 54px;
    line-height: 1;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
}

.clock-action-card.sign-in .clock-action-icon {
    color: var(--accent-green);
}

.clock-action-card.sign-out .clock-action-icon {
    color: var(--accent-red);
}

.clock-action-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.6px;
}

.idle-brand {
    position: absolute;
    bottom: var(--sp-lg);
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* ════════════════════════════════════════
   PHOTO CLOCK-OUT SCREEN
   ════════════════════════════════════════ */

.photo-clockout-layout {
    width: min(1180px, calc(100vw - 80px));
    height: min(700px, calc(100vh - 64px));
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    justify-content: flex-start;
}

.photo-clockout-topbar {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 112px;
    align-items: center;
    min-height: 64px;
    gap: 18px;
}

.photo-clockout-back {
    width: 52px;
    height: 52px;
    border-radius: var(--r-full);
    border: 1px solid var(--border-subtle);
    background: rgba(20, 25, 38, 0.92);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
    -webkit-appearance: none;
    appearance: none;
    transition: transform var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
}

.photo-clockout-back:active {
    transform: scale(0.94);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.photo-clockout-heading {
    text-align: left;
    min-width: 0;
}

.photo-clockout-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--text-primary);
    line-height: 1.05;
}

.photo-clockout-subtitle {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.photo-clockout-camera {
    width: 112px;
    height: 76px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    background: rgba(20, 25, 38, 0.92);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.photo-clockout-camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.photo-clockout-grid {
    width: 100%;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
    grid-auto-rows: 238px;
    gap: 14px;
    overflow-y: auto;
    padding: 2px 4px 14px;
    align-content: start;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.photo-clockout-card {
    height: 238px;
    min-width: 0;
    border-radius: var(--r-lg);
    border: 1px solid var(--border-subtle);
    background: rgba(20, 25, 38, 0.96);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 14px 12px 12px;
    font-family: var(--font);
    text-align: center;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    overflow: hidden;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
    transition: transform var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.photo-clockout-card:active {
    transform: scale(0.982);
    border-color: rgba(239, 68, 68, 0.65);
    background: rgba(35, 24, 31, 0.96);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.photo-clockout-card.is-submitting {
    opacity: 0.7;
    pointer-events: none;
}

.photo-clockout-photo {
    position: relative;
    width: 118px;
    height: 118px;
    border-radius: var(--r-full);
    overflow: hidden;
    background: var(--bg-card);
    border: 3px solid rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04),
                0 14px 26px rgba(0, 0, 0, 0.26);
}

.photo-clockout-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-clockout-initials {
    font-size: 38px;
    font-weight: 800;
    color: var(--text-secondary);
}

.photo-clockout-name {
    width: 100%;
    min-height: 38px;
    margin-top: 0;
    padding: 0 4px;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.12;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.photo-clockout-meta {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
    width: 100%;
    min-height: 24px;
    margin-top: auto;
    padding: 9px 4px 0;
    border-top: 1px solid var(--border-subtle);
}

.photo-clockout-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-clockout-meta span:last-child {
    flex: 0 0 auto;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.photo-clockout-empty {
    grid-column: 1 / -1;
    height: 260px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--r-lg);
    color: var(--text-secondary);
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-xl);
}

@media (max-width: 760px) {
    .photo-clockout-layout {
        width: calc(100vw - 32px);
        height: calc(100vh - 44px);
    }

    .photo-clockout-topbar {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .photo-clockout-camera {
        display: none;
    }

    .photo-clockout-grid {
        grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
        grid-auto-rows: 218px;
    }

    .photo-clockout-card {
        height: 218px;
    }

    .photo-clockout-photo {
        width: 104px;
        height: 104px;
    }
}

/* ════════════════════════════════════════
   STAFF ALERT SCREEN
   ════════════════════════════════════════ */

.staff-alert-layout {
    width: min(760px, calc(100vw - 64px));
    max-height: min(720px, calc(100vh - 56px));
    display: flex;
    align-items: center;
    justify-content: center;
}

.staff-alert-card {
    width: 100%;
    max-height: inherit;
    border-radius: var(--r-lg);
    border: 1px solid var(--border-subtle);
    background: rgba(20, 25, 38, 0.98);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    padding: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.staff-alert-kicker {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.staff-alert-name {
    color: var(--text-primary);
    font-size: 34px;
    font-weight: 850;
    line-height: 1.05;
}

.staff-alert-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.staff-alert-message {
    border-radius: var(--r-md);
    border: 1px solid var(--border-subtle);
    background: rgba(11, 15, 25, 0.58);
    padding: 18px;
}

.staff-alert-message-title {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.16;
}

.staff-alert-message-body {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.staff-alert-message-date {
    margin-top: 14px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-family: var(--font-mono);
}

.staff-alert-ack,
.staff-alert-cancel {
    width: 100%;
    min-height: 58px;
    border-radius: var(--r-md);
    border: 0;
    font-family: var(--font);
    font-size: 17px;
    font-weight: 850;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.staff-alert-ack {
    background: var(--accent-green);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(16, 185, 129, 0.28);
}

.staff-alert-cancel {
    min-height: 46px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.staff-alert-ack:active,
.staff-alert-cancel:active {
    transform: scale(0.985);
}

@media (max-width: 760px) {
    .staff-alert-layout {
        width: calc(100vw - 32px);
        max-height: calc(100vh - 44px);
    }

    .staff-alert-card {
        padding: 20px;
        gap: 14px;
    }

    .staff-alert-name {
        font-size: 27px;
    }

    .staff-alert-message-title {
        font-size: 19px;
    }

    .staff-alert-message-body {
        font-size: 15px;
    }
}

/* ════════════════════════════════════════
   PIN SCREEN
   ════════════════════════════════════════ */

#pin-screen {
    background: var(--bg-primary);
}

.back-btn {
    position: absolute;
    top: var(--sp-lg);
    left: var(--sp-lg);
    width: 44px;
    height: 44px;
    border-radius: var(--r-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all var(--dur-fast) var(--ease);
}

.back-btn:active {
    background: var(--bg-glass-hover);
    transform: scale(0.92);
}

.pin-layout {
    display: flex;
    align-items: center;
    gap: var(--sp-2xl);
    max-width: 820px;
}

/* Camera side */
.pin-camera-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-sm);
}

.camera-frame {
    width: 220px;
    height: 220px;
    border-radius: var(--r-xl);
    overflow: hidden;
    border: 2px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.camera-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
}

/* Keypad side */
.pin-entry-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-lg);
}

.pin-topline {
    display: flex;
    align-items: baseline;
    gap: var(--sp-xl);
    width: 100%;
    justify-content: space-between;
}

.pin-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.pin-clock {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-tertiary);
}

.pin-dots {
    display: flex;
    gap: 20px;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: var(--r-full);
    border: 2px solid var(--border-light);
    transition: all var(--dur-fast) var(--ease-spring);
}

.pin-dot.filled {
    background: var(--text-primary);
    border-color: var(--text-primary);
    transform: scale(1.2);
}

.pin-dot.error {
    border-color: var(--accent-red);
    background: var(--accent-red);
}

.pin-error {
    font-size: 13px;
    color: var(--accent-red);
    height: 18px;
    opacity: 0;
    transition: opacity var(--dur-normal) var(--ease);
}

.pin-error.visible {
    opacity: 1;
}

/* Keypad grid */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.key {
    width: 80px;
    height: 72px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 400;
    font-family: var(--font);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.key:active {
    background: var(--bg-glass-hover);
    transform: scale(0.94);
    border-color: var(--border-light);
}

.key.fn {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.key.fn:active {
    color: var(--text-primary);
}

/* Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake { animation: shake 0.4s var(--ease); }

/* ════════════════════════════════════════
   CONFIRM SCREEN
   ════════════════════════════════════════ */

.confirm-layout {
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-xl);
    padding: var(--sp-2xl) 64px;
    min-width: 340px;
}

.confirm-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--r-full);
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.confirm-name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.3px;
    text-align: center;
}

.confirm-role {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: capitalize;
    margin-top: -12px;
}

.confirm-sep {
    width: 48px;
    height: 1px;
    background: var(--border-subtle);
}

.confirm-time {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-tertiary);
}

.confirm-btn {
    width: 100%;
    padding: var(--sp-md) var(--sp-xl);
    border-radius: var(--r-lg);
    border: none;
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--dur-normal) var(--ease);
    text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.confirm-btn.clock-in {
    background: var(--accent-green);
    color: #0b0f19;
    box-shadow: var(--accent-green-glow);
}

.confirm-btn.clock-in:active {
    transform: scale(0.97);
}

.confirm-btn.clock-out {
    background: var(--accent-red);
    color: #0b0f19;
    box-shadow: var(--accent-red-glow);
}

.confirm-btn.clock-out:active {
    transform: scale(0.97);
}

.confirm-cancel {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    padding: var(--sp-sm) var(--sp-md);
    transition: color var(--dur-fast);
}

.confirm-cancel:active {
    color: var(--text-secondary);
}

/* ════════════════════════════════════════
   SUCCESS SCREEN
   ════════════════════════════════════════ */

.success-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-md);
}

.success-icon {
    width: 88px;
    height: 88px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pop-in 0.4s var(--ease-spring);
}

.success-icon.clock-in {
    background: var(--accent-green-soft);
    color: var(--accent-green);
}

.success-icon.clock-out {
    background: var(--accent-red-soft);
    color: var(--accent-red);
}

@keyframes pop-in {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.success-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.success-label.clock-in { color: var(--accent-green); }
.success-label.clock-out { color: var(--accent-red); }

.success-name {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.success-role {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.success-time {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: var(--sp-sm);
}

.success-progress {
    width: 180px;
    height: 2px;
    background: var(--border-subtle);
    border-radius: var(--r-full);
    margin-top: var(--sp-xl);
    overflow: hidden;
}

.success-progress-bar {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--text-tertiary);
    animation: progress-shrink 4s linear forwards;
}

@keyframes progress-shrink {
    0% { width: 100%; }
    100% { width: 0%; }
}

/* ════════════════════════════════════════
   LOADING
   ════════════════════════════════════════ */

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.loading-overlay.visible {
    display: flex;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--text-primary);
    border-radius: var(--r-full);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════
   SERVER ERROR (HTTP 5xx) — mobile only
   Kiosk shows full-screen white “Server error”; desktop keeps PIN/toast messages.
   ════════════════════════════════════════ */

.server-error-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100002;
    background: #ffffff;
    color: #111111;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-lg);
    font-family: var(--font);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.server-error-overlay.visible {
    display: flex !important;
}

.server-error-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
}

/* ════════════════════════════════════════
   PORTRAIT: server error (looks like a real generic 500 page)
   Landscape: kiosk UI visible as normal.
   ════════════════════════════════════════ */

.kiosk-portrait-server-error {
    display: none;
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    z-index: 100003;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    isolation: isolate;
    background: #f8f9fa;
    color: #202124;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 12px) 20px env(safe-area-inset-bottom, 12px);
}

.kiosk-pse-panel {
    width: 100%;
    max-width: 28rem;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12), 0 2px 6px rgba(60, 64, 67, 0.08);
    overflow: hidden;
}

.kiosk-pse-accent {
    height: 4px;
    background: linear-gradient(90deg, #c5221f 0%, #e37400 50%, #1a73e8 100%);
}

.kiosk-pse-body {
    padding: 28px 24px 32px;
}

.kiosk-pse-code {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #80868b;
    text-transform: uppercase;
}

.kiosk-pse-title {
    margin: 0 0 14px;
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.3;
    color: #202124;
    letter-spacing: -0.02em;
}

.kiosk-pse-message {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: #5f6368;
}

.kiosk-pse-rule {
    margin: 22px 0 16px;
    border: none;
    border-top: 1px solid #dadce0;
}

.kiosk-pse-hint {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #80868b;
}

/* Phones in portrait only — iPad portrait (~768px) keeps normal kiosk */
@media (orientation: portrait) and (max-width: 600px) {
    #app {
        visibility: hidden;
        pointer-events: none;
    }

    .kiosk-portrait-server-error {
        display: flex;
    }
}

/* ════════════════════════════════════════
   HIDDEN ELEMENTS
   ════════════════════════════════════════ */

#camera-canvas, #camera-stream { display: none; }

/* ════════════════════════════════════════
   REDUCED MOTION
   ════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ════════════════════════════════════════
   BIG CLOCK TOAST (floating confirmation)
   ════════════════════════════════════════ */

.kiosk-clock-toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 36px;
    border-radius: 20px;
    min-width: 340px;
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease-out;
    pointer-events: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.kiosk-clock-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.kiosk-clock-toast.exit {
    transform: translateX(-50%) translateY(-120px);
    opacity: 0;
    transition: transform 0.3s ease-in,
                opacity 0.2s ease-in;
}

.toast-clock-in {
    background: rgba(34, 197, 94, 0.18);
    border: 2px solid rgba(34, 197, 94, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.toast-clock-out {
    background: rgba(239, 68, 68, 0.18);
    border: 2px solid rgba(239, 68, 68, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.toast-icon-big {
    font-size: 36px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-action-label {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2.5px;
}

.toast-clock-in .toast-action-label { color: var(--accent-green); }
.toast-clock-out .toast-action-label { color: var(--accent-red); }

.toast-staff-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.toast-timestamp {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ============================================
   STAFF CHATBOT
   ============================================ */

#chatbot-widget {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 800;
}

#chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: var(--r-full);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease-spring);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

#chatbot-toggle:hover,
#chatbot-toggle.active {
    background: var(--accent-green);
    color: #fff;
    transform: scale(1.08);
}

#chatbot-panel {
    position: fixed;
    bottom: 96px;
    left: 28px;
    width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--r-xl);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
    max-height: 520px;
    z-index: 801;
}

#chatbot-panel.open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

#chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar-sm { font-size: 22px; line-height: 1; }

.chatbot-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chatbot-subtitle {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

#chatbot-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

#chatbot-close:hover { color: var(--text-primary); }

#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
    max-height: 220px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
}

.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }

.chat-bubble {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

.chat-msg.bot .chat-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
    background: var(--accent-green);
    color: #fff;
    border-bottom-right-radius: 4px;
}

#chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px 14px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.quick-reply {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: var(--r-full);
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.quick-reply:hover {
    background: var(--accent-green-soft);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

#chatbot-pin-pad {
    padding: 12px 14px 16px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-pin-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
    margin: 0 0 10px;
}

.chat-pin-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.chat-pin-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-light);
    transition: background 0.15s, transform 0.15s;
}

.chat-pin-dot.filled {
    background: var(--accent-green);
    transform: scale(1.2);
}

.chat-pin-dot.error { background: var(--accent-red); }

.chat-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.chat-key {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--r-md);
    padding: 10px 0;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, transform 0.1s;
    user-select: none;
}

.chat-key:active { transform: scale(0.93); }
.chat-key:hover { background: var(--bg-glass-hover); }
.chat-fn { font-size: 13px; color: var(--text-secondary); }

.chat-cancel-pin {
    width: 100%;
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    border-radius: var(--r-md);
    padding: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.chat-cancel-pin:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* Hide chatbot on narrow screens (phones) */
@media (max-width: 600px) {
    #chatbot-widget { display: none; }
}
