:root {
  --bg: #0f1720; --panel: #17222e; --panel2: #1e2b39; --line: #2a3a4b;
  --text: #e8eef4; --muted: #8fa3b6; --accent: #2ec27e; --accent-ink: #062014;
  --out: #f5a524; --out-ink: #2a1a00; --bad: #ef5b5b; --link: #6cb6ff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif;
  -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
.wrap { max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; }
.wide { max-width: 1100px; }
header.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 16px; }
.brand { font-weight: 700; letter-spacing: .2px; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.2; }
h2 { font-size: 18px; } h3 { font-size: 15px; color: var(--muted); font-weight: 600; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 16px; }
input:focus, select:focus { outline: 2px solid var(--link); outline-offset: 1px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-size: 16px; font-weight: 600;
  background: var(--panel2); color: var(--text); cursor: pointer; text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--accent-ink); }
.warn { background: var(--out); color: var(--out-ink); }
.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.ghost { background: transparent; border: 1px solid var(--line); }
.small { padding: 7px 11px; font-size: 14px; border-radius: 9px; }
.block { width: 100%; }
.big { padding: 22px; font-size: 22px; border-radius: 18px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }
.okc { color: var(--accent); }
.hidden { display: none !important; }
.pill { white-space: nowrap; display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--panel2); color: var(--muted); }
.pill.in, .pill.ok, .pill.on_site { background: rgba(46,194,126,.15); color: var(--accent); }
.pill.out, .pill.left { background: rgba(245,165,36,.15); color: var(--out); }
.pill.rejected, .pill.absent { background: rgba(239,91,91,.14); color: var(--bad); }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
ul.list li:first-child { border-top: 0; }

/* camera */
.cam { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 3/4; }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam .oval { position: absolute; inset: 12% 18% 16%; border: 3px dashed rgba(255,255,255,.55); border-radius: 50%; pointer-events: none; transition: border-color .2s; }
.cam .oval.turn { border-color: var(--out); border-style: solid; }
.cam .oval.final, .cam .oval.done { border-color: var(--accent); border-style: solid; }
.cam .hint { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; text-align: center;
  font-weight: 600; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.steps { display: flex; gap: 6px; margin: 10px 0 0; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--accent); }
.result { text-align: center; padding: 28px 16px; }
.result .icon { font-size: 54px; line-height: 1; }
.spinner { width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* admin */
nav.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
nav.tabs button { white-space: nowrap; }
nav.tabs button.on { background: var(--link); color: #061423; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi b { display: block; font-size: 26px; }
.kpi span { color: var(--muted); font-size: 13px; }
.tbl { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td.num { font-variant-numeric: tabular-nums; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px;
  width: min(520px, calc(100vw - 24px)); padding: 18px; max-height: calc(100vh - 24px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; color: var(--text); margin: 0; font-size: 15px; }
.checks input { width: auto; }
img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; cursor: pointer; background: var(--panel2); }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
