:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --line: #334155;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; border: 0; border-radius: var(--radius); }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: #fca5a5; }

/* ---------- kiosk ---------- */
.kiosk { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vh; padding: 16px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.kiosk header { text-align: center; }
.kiosk h1 { margin: 0; font-size: clamp(22px, 3.2vh, 34px); font-weight: 600; letter-spacing: .02em; }
.clock { font-size: clamp(34px, 6vh, 64px); font-variant-numeric: tabular-nums; font-weight: 700; }
.clock-date { color: var(--muted); font-size: clamp(16px, 2.2vh, 22px); }
.pin { display: flex; gap: 18px; height: 34px; align-items: center; }
.pin span { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--muted); }
.pin span.on { background: var(--text); border-color: var(--text); }
.status { min-height: 1.6em; font-size: clamp(18px, 2.6vh, 26px); text-align: center; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: min(92vw, 480px); }
.keypad button { height: clamp(64px, 10.5vh, 104px); font-size: clamp(28px, 4.6vh, 44px); font-weight: 600; background: var(--panel); color: var(--text); box-shadow: 0 2px 0 #0b1222; }
.keypad button:active { background: var(--panel-2); transform: translateY(1px); }
.keypad .clear { background: #3f3f46; font-size: clamp(20px, 3vh, 28px); }
.keypad .enter { background: var(--accent); font-size: clamp(20px, 3vh, 28px); }
.keypad .enter:active { background: var(--accent-2); }
.keypad:has(button:disabled) { opacity: .45; }
.footer-link { position: fixed; bottom: 10px; right: 14px; color: var(--muted); font-size: 13px; background: none; }

.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, .92); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.card { background: var(--panel); border-radius: 22px; padding: clamp(20px, 4vh, 40px); width: min(94vw, 760px); text-align: center; }
.card h2 { margin: 0 0 18px; font-size: clamp(24px, 3.6vh, 36px); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.choices button { height: clamp(110px, 18vh, 180px); font-size: clamp(26px, 4vh, 40px); font-weight: 700; color: #fff; background: var(--accent); }
.choices button.alt { background: var(--warn); }
.cancel { margin-top: 18px; background: transparent; color: var(--muted); font-size: 20px; padding: 10px 24px; }
.camera video { width: min(80vw, 560px); border-radius: 16px; transform: scaleX(-1); background: #000; }
.countdown { font-size: clamp(26px, 4vh, 40px); font-weight: 700; margin-top: 14px; }
.confirm .line1 { font-size: clamp(24px, 3.8vh, 40px); font-weight: 800; line-height: 1.25; word-break: break-word; }
.confirm .line2 { font-size: clamp(15px, 2vh, 20px); color: var(--muted); margin-top: 10px; }
.confirm.ok { border: 4px solid var(--ok); }
.confirm.bad { border: 4px solid var(--bad); }
.block .card { border: 4px solid var(--bad); }
.block p { font-size: clamp(20px, 3vh, 30px); line-height: 1.35; }
.big-btn { background: var(--accent); color: #fff; font-size: 26px; padding: 18px 44px; font-weight: 700; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { background: var(--panel); padding: 28px; border-radius: 18px; width: min(94vw, 420px); display: grid; gap: 14px; }
.login h1 { margin: 0 0 6px; font-size: 24px; }
.login input { padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 18px; }
.login button { background: var(--accent); color: #fff; padding: 14px; font-size: 18px; font-weight: 600; }

/* ---------- admin ---------- */
.admin { display: flex; flex-direction: column; min-height: 100dvh; }
.admin-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-top h1 { font-size: 20px; margin: 0; flex: 1; }
.tabs { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; color: var(--muted); padding: 10px 14px; white-space: nowrap; border-radius: 10px; }
.tabs button.active { background: var(--panel-2); color: var(--text); }
main.admin-main { padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.btn { background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 600; }
.btn.secondary { background: var(--panel-2); color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 14px; }
.panel { background: var(--panel); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.grid-form label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.grid-form input, .grid-form select, .grid-form textarea, .inline input, .inline select { padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; margin: 1px 2px; background: var(--panel-2); }
.chip.bad { background: #7f1d1d; }
.chip.warn { background: #78350f; }
.chip.info { background: #1e3a8a; }
.chip.ok { background: #14532d; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: #000; vertical-align: middle; }
.company { margin: 18px 0 8px; font-size: 16px; color: var(--muted); }
.emp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.emp-list button { background: var(--panel); color: var(--text); text-align: left; padding: 12px; border-radius: 10px; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.live-item { background: var(--panel); border-radius: 10px; padding: 10px 12px; border-left: 6px solid var(--line); }
.live-item.in { border-color: var(--ok); }
.live-item.lunch { border-color: var(--warn); }
.live-item.out { border-color: var(--muted); }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--panel-2); padding: 12px 18px; border-radius: 10px; z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; width: min(94vw, 520px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
@media (max-width: 600px) {
  .choices { grid-template-columns: 1fr; }
}
table.data a { color: #93c5fd; }
