:root {
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.15);
  --ink: #0f1f3a;
  --muted: #64748b;
  --line: #e2e8f0;
  --page: #f3f6fb;
  --success: #16a34a;
  --success-ink: #15803d;
  --error: #dc2626;
  --warn: #d97706;
  font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 18px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: #1d4ed8; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 2px; }

/* Pita biru di atas */
.kiosk-band {
  position: absolute;
  inset: 0 0 auto;
  height: 320px;
  background: linear-gradient(120deg, #2563eb 0%, #3b82f6 60%, #60a5fa 100%);
}

.kiosk-band svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.kiosk {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  min-height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 40px 32px;
}

.kiosk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
}

.kiosk-brand { display: flex; align-items: center; gap: 12px; }
.kiosk-brand strong { display: block; font-size: 18px; }
.kiosk-brand small { font-size: 13px; opacity: 0.85; }

.kiosk-logo {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: #fff;
  font-size: 14px;
  font-weight: 800;
}

.kiosk-time { text-align: right; }

.kiosk-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.kiosk-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.kiosk-admin-link:hover { color: var(--accent); background: #fff; }

.kiosk-clock {
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kiosk-date { margin-top: 4px; font-size: 14px; opacity: 0.9; }

.kiosk-greeting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.kiosk-greeting {
  margin: 0;
  color: #fff;
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 800;
}

.kiosk-banner {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  color: #78350f;
  background: #fef3c7;
  font-size: 14px;
  font-weight: 700;
}

/* Kartu utama */
.kiosk-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 28px;
  min-height: 520px;
  padding: 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 31, 58, 0.12);
}

.kiosk-camera {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(180deg, #e8f0fb, #d3e2f6);
}

.kiosk-camera video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.kiosk-oval {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(56%, 300px);
  aspect-ratio: 4 / 5;
  border: 4px dashed rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 999px rgba(15, 31, 58, 0.18);
  transition: border-color 160ms ease;
}

.kiosk-camera[data-tone="ready"] .kiosk-oval,
.kiosk-camera[data-tone="scan"] .kiosk-oval { border-color: var(--accent); background: transparent; }
.kiosk-camera[data-tone="scan"] .kiosk-oval { border-style: solid; }
.kiosk-camera[data-tone="warn"] .kiosk-oval { border-color: #fbbf24; }
.kiosk-camera[data-tone="error"] .kiosk-oval { border-color: #f87171; }

.kiosk-camera-status {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 600;
}

.kiosk-camera-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.kiosk-camera-status[data-on="true"] i { background: var(--success); }

.kiosk-instruction {
  position: absolute;
  left: 50%;
  bottom: 16px;
  max-width: calc(100% - 32px);
  padding: 12px 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 31, 58, 0.2);
  font-size: clamp(14px, 1.4vw, 17px);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
}

.kiosk-camera[data-tone="warn"] .kiosk-instruction { color: #92400e; }
.kiosk-camera[data-tone="error"] .kiosk-instruction { color: #b91c1c; }
.kiosk-camera[data-tone="scan"] .kiosk-instruction { color: var(--accent); }

.kiosk-left {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.kiosk-left .kiosk-camera { flex: 1; }

.kiosk-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  justify-content: center;
  gap: 12px;
}

.kiosk-absen {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--accent);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  font-size: 16px;
  font-weight: 800;
  transition: background 80ms ease;
}

.kiosk-absen-out { background: #ea580c; box-shadow: 0 6px 16px rgba(234, 88, 12, 0.28); }
.kiosk-absen-out:hover:not(:disabled) { background: #c2410c !important; }

.kiosk-absen:hover:not(:disabled) { background: #1d4ed8; }
.kiosk-absen:active:not(:disabled) { transform: scale(0.97); }

.kiosk-absen:disabled {
  cursor: not-allowed;
  color: #64748b;
  background: #e2e8f0;
  box-shadow: none;
}

.kiosk-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(22, 163, 74, 0.9);
  animation: pop-in 200ms ease-out;
}

.kiosk-overlay[data-tone="out"] { background: rgba(37, 99, 235, 0.9); }
.kiosk-overlay[data-tone="warn"] { background: rgba(217, 119, 6, 0.9); }
.kiosk-overlay[data-tone="error"] { background: rgba(220, 38, 38, 0.88); }

.kiosk-overlay-icon {
  display: grid;
  width: 120px;
  height: 120px;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: #fff;
  font-size: 60px;
  font-weight: 900;
}

.kiosk-overlay[data-tone="out"] .kiosk-overlay-icon { color: var(--accent); }
.kiosk-overlay[data-tone="warn"] .kiosk-overlay-icon { color: var(--warn); }
.kiosk-overlay[data-tone="error"] .kiosk-overlay-icon { color: var(--error); }

.kiosk-retry {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Kolom kanan */
.kiosk-side {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}

.kiosk-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kiosk-steps {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.kiosk-steps li {
  position: relative;
  display: flex;
  gap: 14px;
  padding-bottom: 22px;
}

.kiosk-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 40px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}

.kiosk-step-dot {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: #eef2f7;
  font-size: 15px;
  font-weight: 700;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.kiosk-steps strong { display: block; padding-top: 6px; color: var(--muted); font-size: 17px; }
.kiosk-steps small { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }

.kiosk-steps li[data-state="current"] .kiosk-step-dot { color: #fff; background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.kiosk-steps li[data-state="current"] strong,
.kiosk-steps li[data-state="done"] strong { color: var(--ink); }
.kiosk-steps li[data-state="done"] .kiosk-step-dot { color: #fff; background: var(--success); }

.kiosk-result {
  padding: 24px;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  background: #f0fdf4;
  animation: pop-in 200ms ease-out;
}

.kiosk-result[data-tone="out"] { border-color: #bfdbfe; background: #eff6ff; }

.kiosk-result-person { display: flex; align-items: center; gap: 14px; }
.kiosk-result-person strong { display: block; font-size: 24px; font-weight: 800; }
.kiosk-result-person small { color: var(--muted); font-size: 14px; }

.kiosk-avatar {
  display: grid;
  width: 60px;
  height: 60px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

.kiosk-result-stats { display: flex; gap: 10px; margin-top: 18px; }

.kiosk-result-stats > div {
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
}

.kiosk-result-stats small { display: block; color: var(--muted); font-size: 13px; }
.kiosk-result-stats strong { font-size: 20px; font-weight: 800; }
#kiosk-result-type { color: var(--success-ink); }
.kiosk-result[data-tone="out"] #kiosk-result-type { color: #1d4ed8; }

.kiosk-result-note { margin: 14px 0 0; color: #475569; font-size: 15px; line-height: 1.5; }

.kiosk-message {
  padding: 24px;
  border: 1px solid #fecaca;
  border-radius: 20px;
  background: #fef2f2;
  animation: pop-in 200ms ease-out;
}

.kiosk-message strong { display: block; color: #b91c1c; font-size: 22px; font-weight: 800; }
.kiosk-message p { margin: 8px 0 0; color: #7f1d1d; font-size: 15px; line-height: 1.55; }
.kiosk-message[data-tone="warn"] { border-color: #fde68a; background: #fffbeb; }
.kiosk-message[data-tone="warn"] strong { color: #92400e; }
.kiosk-message[data-tone="warn"] p { color: #78350f; }

.kiosk-note {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.kiosk-note label { color: var(--ink); font-size: 15px; font-weight: 700; }
.kiosk-note label span { color: var(--muted); font-weight: 500; }
.kiosk-note small { color: var(--muted); font-size: 13px; line-height: 1.4; }

.kiosk-note[data-required="true"] { border-color: #fcd34d; background: #fffbeb; }
.kiosk-note[data-required="true"] label span { color: #b45309; font-weight: 700; }
.kiosk-note[data-required="true"] small { color: #92400e; }
.kiosk-note[data-required="true"] input { border-color: #f59e0b; }

.kiosk-note input,
.kiosk-login input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 16px;
}

.kiosk-tip {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding: 14px 16px;
  border: 1px solid #fde68a;
  border-radius: 16px;
  color: #b45309;
  background: #fffbeb;
}

.kiosk-tip svg { flex: none; margin-top: 1px; }
.kiosk-tip p { margin: 0; color: #78350f; font-size: 14px; line-height: 1.5; }

.kiosk-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.kiosk-footer > div { display: flex; gap: 8px; }

.kiosk-small-button {
  min-height: 36px;
  padding: 6px 12px;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 13px;
}

.kiosk-small-button:hover { color: var(--ink); background: #e2e8f0; }

/* Login kiosk */
.kiosk-login {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 31, 58, 0.6);
}

.kiosk-login-card {
  display: grid;
  gap: 14px;
  width: min(100%, 420px);
  padding: 28px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 70px rgba(15, 31, 58, 0.3);
}

.kiosk-login-card .kiosk-logo { color: #fff; background: var(--accent); }
.kiosk-login-card h1 { margin: 0; font-size: 26px; }
.kiosk-login-card > p { margin: 0; color: var(--muted); line-height: 1.5; }
.kiosk-login-card label { display: grid; gap: 6px; color: #475569; font-size: 14px; font-weight: 700; }
.kiosk-login-card button { min-height: 50px; font-size: 16px; }
.kiosk-login-card a { color: var(--accent); font-size: 14px; text-align: center; }
.kiosk-login-message { min-height: 20px; margin: 0; color: #b91c1c; font-weight: 700; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .kiosk { padding: 20px 16px; }
  .kiosk-card { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .kiosk-camera { min-height: 0; aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  .kiosk-overlay, .kiosk-result, .kiosk-message { animation: none; }
}
