:root {
    --navy: #1B2B6B;
    --blue: #2196F3;
    --gold: #F5C518;
    --bg: #F4F6FB;
    --text: #1a1a1a;
    --muted: #6b7280;
    --danger: #D64545;
    --success: #2E9E5B;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Manrope', -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.kiosk-body { min-height: 100vh; display: flex; flex-direction: column; }

.kiosk-header {
    background: var(--navy);
    color: #fff;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kiosk-header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.kiosk-clock { font-size: 1.5rem; font-variant-numeric: tabular-nums; opacity: .9; }

.punch-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    vertical-align: middle;
}
.punch-in { background: var(--success); }
.punch-out { background: var(--danger); }

/* ---------- Staff grid ---------- */
.staff-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding: 32px;
    align-content: start;
}

.staff-card {
    background: #fff;
    border: none;
    border-radius: 16px;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    cursor: pointer;
    transition: transform .1s ease;
}
.staff-card:active { transform: scale(0.96); }

.staff-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.staff-name { font-weight: 600; text-align: center; }

/* ---------- PIN modal ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    width: 340px;
    text-align: center;
}
.modal-box h2 { margin-top: 0; }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0; }
.pin-dots span {
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid var(--navy);
    display: inline-block;
}
.pin-dots span.filled { background: var(--navy); }

.pin-error { color: var(--danger); font-size: .9rem; margin-bottom: 8px; }

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.pin-key {
    padding: 18px 0;
    font-size: 1.3rem;
    border: none;
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
}
.pin-key:active { background: #e2e6f0; }
.pin-key-cancel, .pin-key-back { font-size: 1rem; color: var(--muted); }

/* ---------- Capture flow ---------- */
.capture-flow {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
}
.capture-step { width: 100%; max-width: 640px; text-align: center; }
.capture-step h2 { margin-bottom: 20px; }
.hidden { display: none !important; }

#video, #photoPreview {
    width: 100%;
    max-width: 480px;
    border-radius: 16px;
    background: #000;
}

#sigPad {
    width: 100%;
    max-width: 600px;
    height: 250px;
    background: #fff;
    border: 2px dashed #c8ccd8;
    border-radius: 16px;
    touch-action: none;
}

.capture-actions { margin-top: 20px; display: flex; gap: 12px; justify-content: center; }

.btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-secondary { background: #e2e6f0; color: var(--text); }
.btn:disabled { opacity: .6; }

.success-check {
    width: 90px; height: 90px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    font-size: 2.5rem;
    display: flex; align-items: center; justify-content: center;
    margin: 40px auto 20px;
}

@media (max-width: 480px) {
    .kiosk-header { flex-direction: column; gap: 8px; text-align: center; }
    .staff-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
