/* SJ Attendance — gate machine (face kiosk) */
:root {
  --ink: #1d3f8f;
  --ink-2: #2c55b3;
  --ink-soft: #e4eaf7;
  --night: #0d1424;
  --night-2: #18233a;
  --paper: #f6f8fc;
  --rule: #d8dfeb;
  --rule-2: #bfcae0;
  --text: #18233a;
  --muted: #5b6577;
  --good: #19734a;
  --bad: #b42318;
  --warn: #9a5a06;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Hind", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.5 var(--body); background: var(--night); color: #fff; overflow: hidden; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, select { font: inherit; }
:focus-visible { outline: 3px solid #8fb0ff; outline-offset: 2px; }

/* ---------- light panels (setup, loading, manager) ---------- */
.panel-screen { position: fixed; inset: 0; overflow: auto; background: var(--paper); color: var(--text); display: flex; align-items: center; justify-content: center; padding: 24px 16px; color-scheme: light; }
.panel { width: 100%; max-width: 420px; }
.panel.center { text-align: center; }
.panel .logo { border-radius: 14px; display: block; }
.panel.center .logo { margin: 0 auto; }
.panel h1 { font-family: var(--display); font-size: 34px; line-height: 1.1; color: var(--ink); margin: 14px 0 6px; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select { width: 100%; border: 1.5px solid var(--rule-2); border-radius: 10px; background: #fff; color: var(--text); padding: 10px 12px; min-height: 48px; font-size: 17px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.form-error { margin: 0; color: var(--bad); }
.form-error:empty { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 18px; min-height: 46px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule-2); }
.btn.danger { background: #fff; color: var(--bad); box-shadow: inset 0 0 0 1.5px #efc2bd; }
.btn.wide { width: 100%; min-height: 52px; font-size: 17px; }
.btn.ghost-dark { background: rgba(255, 255, 255, .14); color: #fff; }
.btn:disabled { opacity: .55; }
.bar { height: 8px; border-radius: 99px; background: var(--ink-soft); overflow: hidden; margin: 18px auto 0; max-width: 320px; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .3s ease; }

/* ---------- camera screen ---------- */
.main { position: fixed; inset: 0; }
.main video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.main video.mirror { transform: scaleX(-1); }
.guide {
  position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%);
  width: min(56vw, 46vh, 360px); aspect-ratio: 3 / 4; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .8); box-shadow: 0 0 0 4000px rgba(13, 20, 36, .45);
  transition: border-color .2s ease;
}
.main.s-match .guide { border-color: #7fb2ff; }
.main.s-live .guide { border-color: #ffd27a; }
.main.s-unknown .guide { border-color: #ff9b8f; }

.top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: max(14px, env(safe-area-inset-top)) 18px 0; }
.who b { display: block; font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.1; }
.who span { color: rgba(255, 255, 255, .7); font-size: 14px; }
.clock { text-align: right; }
.clock b { display: block; font-family: var(--display); font-size: 52px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.clock span { color: rgba(255, 255, 255, .75); font-size: 14px; }
.chips { position: absolute; top: calc(max(14px, env(safe-area-inset-top)) + 72px); left: 18px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .14); }
.chip.off { background: rgba(180, 35, 24, .85); }
.chip.warn { background: rgba(154, 90, 6, .9); }

.status {
  position: absolute; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(92vw, 560px); text-align: center; padding: 14px 18px; border-radius: 16px;
  background: rgba(13, 20, 36, .78); backdrop-filter: blur(6px);
}
.status b { display: block; font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.15; }
.status span { display: block; color: rgba(255, 255, 255, .8); font-size: 16px; margin-top: 2px; }
.main.s-live .status b { color: #ffd27a; }
.main.s-unknown .status b { color: #ffb4aa; }
.main.s-match .status b { color: #b9d2ff; }

.enroll-bar { position: absolute; left: 50%; bottom: calc(max(26px, env(safe-area-inset-bottom)) + 104px); transform: translateX(-50%); display: flex; gap: 14px; align-items: center; }
.dots { display: flex; gap: 8px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, .25); border: 2px solid rgba(255, 255, 255, .7); }
.dots i.on { background: #4fd18b; border-color: #4fd18b; }

.gear { position: absolute; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .75); cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---------- result card ---------- */
.result {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 24px;
  background: var(--good); animation: pop .25s ease-out; text-align: left;
}
.result.out { background: var(--ink); }
.result.already { background: var(--night-2); }
.result.queued { background: var(--warn); }
.result.error { background: var(--bad); }
.result img { width: min(34vw, 200px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 5px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .1); }
.result span { display: block; font-size: 20px; opacity: .9; }
.result b { display: block; font-family: var(--display); font-size: clamp(40px, 8vw, 72px); font-weight: 700; line-height: 1.02; }
.result strong { display: block; font-family: var(--display); font-size: clamp(28px, 5vw, 44px); font-weight: 600; margin-top: 6px; }
@keyframes pop { from { transform: scale(.96); opacity: .3; } to { transform: none; opacity: 1; } }
@media (max-aspect-ratio: 4/5) {
  .result { flex-direction: column; text-align: center; }
}

/* ---------- manager sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(13, 20, 36, .55); color-scheme: light; }
.sheet-panel { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--paper); color: var(--text); border-radius: 18px 18px 0 0; padding: 6px 20px calc(22px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-panel { border-radius: 16px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--paper); padding: 8px 0; z-index: 1; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-size: 28px; color: var(--ink); }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.menu { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.menu button { width: 100%; text-align: left; border: 0; background: none; padding: 15px 4px; border-bottom: 1px solid var(--rule); font-size: 17px; cursor: pointer; color: var(--text); }
.menu button small { display: block; color: var(--muted); font-size: 13px; }
.menu button.danger { color: var(--bad); }
.emp-list { list-style: none; margin: 10px 0 0; padding: 0; border-top: 2px solid var(--text); }
.emp-list button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 0; background: none; padding: 12px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; text-align: left; color: var(--text); font-size: 16px; }
.emp-list small { color: var(--muted); display: block; font-size: 13px; }
.tag { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: #eaeef4; color: #5d6b82; }
.tag.ok { background: #e2f2e9; color: var(--good); }
.search { width: 100%; border: 1.5px solid var(--rule-2); border-radius: 10px; padding: 10px 12px; min-height: 46px; font-size: 16px; margin-top: 4px; }
.info { font-size: 13px; color: var(--muted); margin-top: 14px; }

.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60; background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.toast.good { background: var(--good); }
.toast.bad { background: var(--bad); }

@media (prefers-reduced-motion: reduce) { .result { animation: none; } .bar i { transition: none; } }

/* 2.0: company of this address */
.setup-co { margin: -4px 0 8px; font-size: 22px; font-weight: 700; }
