.apu-pin-overlay {
  position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 23, 42, .9); touch-action: manipulation;
  --pin-accent: #1e293b;
}
.apu-pin-overlay.hidden { display: none; }
.apu-pin-card {
  width: min(92vw, 340px); background: #fff; border-radius: 26px; padding: 24px 20px 18px; text-align: center;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
}
.apu-pin-icon {
  width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: var(--pin-accent); color: #fff; font-size: 20px;
}
.apu-pin-card h3 { font-size: 17px; font-weight: 800; color: #0f172a; }
.apu-pin-desc { margin-top: 4px; font-size: 12px; font-weight: 600; color: #64748b; line-height: 1.5; }
.apu-pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 8px; }
.apu-pin-dots span { width: 14px; height: 14px; border-radius: 999px; border: 2px solid #cbd5e1; transition: background-color .12s ease, border-color .12s ease; }
.apu-pin-dots span.filled { background: var(--pin-accent); border-color: var(--pin-accent); }
.apu-pin-dots.shake { animation: apu-pin-shake .35s ease; }
@keyframes apu-pin-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.apu-pin-message { min-height: 18px; font-size: 11px; font-weight: 700; color: #be123c; line-height: 1.4; }
.apu-pin-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 8px; }
.apu-pin-key {
  height: 54px; border-radius: 16px; background: #f1f5f9; color: #0f172a; font-size: 21px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; transition: background-color .12s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.apu-pin-key:active { background: #e2e8f0; transform: scale(.96); }
.apu-pin-key:disabled { opacity: .45; }
.apu-pin-key.ghost { background: transparent; }
.apu-pin-cancel { width: 100%; min-height: 46px; margin-top: 8px; padding: 10px 14px; font-size: 14px; font-weight: 800; color: #334155; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 14px; }
.apu-pin-cancel:active { background: #e2e8f0; }
.apu-pin-action { width: 100%; margin-top: 14px; padding: 12px; font-size: 13px; font-weight: 800; color: #fff; border-radius: 14px; background: var(--pin-accent); }
.apu-pin-hint { margin-top: 8px; font-size: 10px; font-weight: 600; color: #94a3b8; line-height: 1.5; }

body.apu-pin-locked #attendancePage,
body.apu-pin-locked #payslipPage,
body.apu-pin-locked #attendanceModalRoot,
body.apu-pin-locked #payslipModalRoot { pointer-events: none; user-select: none; }

.apu-pin-section { margin-top: 14px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 18px; background: #fff; }
.apu-pin-section-head { display: flex; align-items: center; gap: 12px; }
.apu-pin-section-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #e2e8f0; color: #334155; flex: 0 0 auto; }
.apu-pin-section-title { font-size: 13px; font-weight: 800; color: #1e293b; }
.apu-pin-section-sub { font-size: 10px; font-weight: 600; color: #64748b; margin-top: 2px; }
.apu-pin-section-btn { margin-left: auto; padding: 9px 14px; border-radius: 12px; background: #1e293b; color: #fff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.apu-pin-section-btn:disabled { opacity: .5; }
.apu-switch { margin-left: auto; position: relative; width: 48px; height: 28px; flex: 0 0 auto; border-radius: 999px; background: #cbd5e1; transition: background .2s; -webkit-tap-highlight-color: transparent; }
.apu-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .2s; }
.apu-switch[aria-checked="true"] { background: #1e293b; }
.apu-switch[aria-checked="true"]::after { transform: translateX(20px); }
.apu-switch:disabled { opacity: .5; }
@media (prefers-reduced-motion: reduce) { .apu-switch, .apu-switch::after { transition: none; } }
.apu-switch.is-busy:disabled { opacity: 1; cursor: progress; }
/* Posisi lewat left (bukan translate) agar putaran tetap di tempat. */
.apu-switch-spinner { position: absolute; z-index: 1; top: 8px; left: 8px; width: 12px; height: 12px; border: 2px solid #cbd5e1; border-top-color: #1e293b; border-radius: 50%; animation: apuSwitchSpin .7s linear infinite; transition: left .2s; }
.apu-switch[aria-checked="true"] .apu-switch-spinner { left: 28px; }
@keyframes apuSwitchSpin { to { transform: rotate(360deg); } }

.apu-pin-settings-body { display: flex; flex-direction: column; gap: 10px; }
.apu-pin-settings-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; cursor: pointer; }
.apu-pin-settings-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: #1e293b; flex: 0 0 auto; }
.apu-pin-settings-row strong { display: block; font-size: 12px; font-weight: 800; color: #1e293b; }
.apu-pin-settings-row small { display: block; margin-top: 2px; font-size: 10px; font-weight: 600; color: #64748b; line-height: 1.5; }
.apu-pin-settings-field { flex-direction: column; gap: 8px; cursor: default; }
.apu-pin-settings-field select { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; font-size: 16px; font-weight: 700; color: #1e293b; }
.apu-pin-settings-message { min-height: 16px; font-size: 11px; font-weight: 700; color: #be123c; }
.apu-pin-settings-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.apu-pin-settings-actions button:disabled { opacity: .5; }

.apu-pin-form-field { margin-top: 10px; text-align: left; }
.apu-pin-form-field label { display: block; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #64748b; margin-bottom: 4px; }
.apu-pin-form-field input {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 11px 12px; font-size: 16px; font-weight: 700; color: #0f172a;
  background: #f8fafc; outline: none;
}
.apu-pin-form-field input:focus { border-color: #1e293b; box-shadow: 0 0 0 3px rgba(30, 41, 59, .12); }
.apu-pw-field { position: relative; }
.apu-pw-field input { padding-right: 44px; }
.apu-pw-eye { position: absolute; top: 0; right: 0; bottom: 0; width: 44px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: #94a3b8; cursor: pointer; }
.apu-pw-eye:hover, .apu-pw-eye[aria-pressed="true"] { color: #1e293b; }
.apu-pin-form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.apu-pin-form-actions button { padding: 12px; border-radius: 14px; font-size: 13px; font-weight: 800; }
.apu-pin-form-actions .primary { background: #1e293b; color: #fff; }
.apu-pin-form-actions .ghost { background: #f1f5f9; color: #475569; }
.apu-pin-form-actions .primary { display: flex; align-items: center; justify-content: center; gap: 8px; }
.apu-pin-form-actions button:disabled { opacity: .7; cursor: not-allowed; }
.apu-btn-spinner { width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: apuSwitchSpin .7s linear infinite; }
