/* Pose3D device console — tokens first, components after. Light is the base theme;
   dark redefines tokens only (system preference, or an explicit data-theme). */
:root {
  --ground: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --ink: #15212b;
  --ink-2: #435361;
  --muted: #6b7a86;
  --line: #dde4e8;
  --line-strong: #c5d0d6;
  --accent: #0c7482;
  --accent-ink: #ffffff;
  --accent-weak: #e2f1f3;
  --accent-line: #9fd0d6;
  --good: #1e7d47;  --good-weak: #e3f3ea;
  --warn: #a4660c;  --warn-weak: #fbf0dc;
  --bad: #b8352f;   --bad-weak: #fbe6e4;
  --idle: #6b7a86;  --idle-weak: #eceff1;
  --side: #13212b;
  --side-ink: #d6e1e7;
  --side-muted: #8aa0ad;
  --side-active: #1f3542;
  --focus: #1592a3;
  --shadow: 0 1px 2px rgba(16, 32, 43, .06), 0 4px 16px rgba(16, 32, 43, .06);
  --radius: 10px;
  --radius-sm: 7px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'DejaVu Sans Mono', Menlo, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0e161c; --surface: #152029; --surface-2: #192631; --ink: #e4ecf0;
    --ink-2: #b4c3cc; --muted: #8597a3; --line: #243441; --line-strong: #31465a;
    --accent: #3fb3c2; --accent-ink: #062228; --accent-weak: #133a41; --accent-line: #2a6d76;
    --good: #52c07f; --good-weak: #153625; --warn: #e2a64a; --warn-weak: #3a2c14;
    --bad: #ef7a72; --bad-weak: #3d1d1b; --idle: #8597a3; --idle-weak: #1d2a33;
    --side: #0a1116; --side-ink: #d6e1e7; --side-muted: #7f95a2; --side-active: #16252f;
    --focus: #5cc6d4; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0e161c; --surface: #152029; --surface-2: #192631; --ink: #e4ecf0;
  --ink-2: #b4c3cc; --muted: #8597a3; --line: #243441; --line-strong: #31465a;
  --accent: #3fb3c2; --accent-ink: #062228; --accent-weak: #133a41; --accent-line: #2a6d76;
  --good: #52c07f; --good-weak: #153625; --warn: #e2a64a; --warn-weak: #3a2c14;
  --bad: #ef7a72; --bad-weak: #3d1d1b; --idle: #8597a3; --idle-weak: #1d2a33;
  --side: #0a1116; --side-ink: #d6e1e7; --side-muted: #7f95a2; --side-active: #16252f;
  --focus: #5cc6d4; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--ink); font-family: var(--sans);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 650; }
h1 { font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── shell ─────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand svg { flex: none; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.brand-sub { font-size: 11.5px; color: var(--side-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted);
  padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  color: var(--side-ink); text-decoration: none; font-weight: 500;
}
.nav a svg { opacity: .75; }
.nav a:hover { background: var(--side-active); }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active svg { opacity: 1; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--side-muted); display: grid; gap: 6px; }
.side-foot button { background: none; border: 0; color: var(--side-muted); padding: 0; cursor: pointer; text-align: left; }
.side-foot button:hover { color: var(--side-ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.topbar .where { font-weight: 600; }
.topbar .spacer { flex: 1; }
.page { padding: 28px 32px 64px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .lead { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 20;
    flex-direction: row; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .brand, .nav-label, .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; min-width: 0; }
  /* tabs must fit a 360 px phone: let each shrink (min-width 0) and clip long labels */
  .nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 1px; flex: 1 1 0; min-width: 0; text-align: center; }
  .nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .topbar { padding: 10px 16px; flex-wrap: wrap; row-gap: 6px; }
  .topbar .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { padding: 18px 16px 96px; }
  h1 { font-size: 21px; }
}

/* ── building blocks ───────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .l { font-size: 12px; color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px;
  padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 550; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn .spin { width: 14px; height: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 550; }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--idle-weak); color: var(--idle); white-space: nowrap;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-weak); color: var(--good); }
.pill.warn { background: var(--warn-weak); color: var(--warn); }
.pill.bad { background: var(--bad-weak); color: var(--bad); }
.pill.accent { background: var(--accent-weak); color: var(--accent); }
.pill.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.tag.accent { background: var(--accent-weak); border-color: var(--accent-line); color: var(--accent); }

/* forms */
.field { display: grid; gap: 5px; }
.field > label, .label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 38px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); width: 100%; min-width: 0;
}
textarea.input { height: auto; padding: 9px 11px; }
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.input.num { font-variant-numeric: tabular-nums; }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit .input { width: 120px; }
.input-unit > .unit { width: 46px; }
.form-grid { display: grid; gap: 14px; }
.form-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 600px) { .form-cols { grid-template-columns: 1fr; } }
.err { color: var(--bad); font-size: 13px; font-weight: 550; }
.okmsg { color: var(--good); font-size: 13px; font-weight: 550; }

/* switch */
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .45; }

/* notices */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-weak); border: 1px solid var(--accent-line); color: var(--ink);
}
.notice.warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.notice.bad { background: var(--bad-weak); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice.good { background: var(--good-weak); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.notice svg { flex: none; margin-top: 1px; }
.notice .body { display: grid; gap: 4px; min-width: 0; }

/* steps */
.steps { display: flex; gap: 0; margin: 4px 0 18px; padding: 0; counter-reset: step; flex-wrap: wrap; }
.steps li {
  list-style: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600;
  font-size: 13px; padding-right: 26px; position: relative;
}
.steps li::before {
  counter-increment: step; content: counter(step); width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; background: var(--idle-weak); color: var(--muted);
}
.steps li.done::before { content: '\2713'; background: var(--good-weak); color: var(--good); }
.steps li.now { color: var(--ink); }
.steps li.now::before { background: var(--accent); color: var(--accent-ink); }
.steps li:not(:last-child)::after {
  content: ''; position: absolute; right: 8px; top: 50%; width: 10px; height: 1px; background: var(--line-strong);
}

/* checklist */
.check { display: grid; gap: 2px; }
.check a, .check div {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none;
}
.check a:hover { background: var(--surface-2); }
.check .mark {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--line-strong); color: transparent; font-size: 12px; font-weight: 700;
}
.check .ok .mark { background: var(--good); border-color: var(--good); color: #fff; }
.check .go { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 13px; }

/* camera tiles */
.cam-tile .thumb {
  aspect-ratio: 16 / 9; background: var(--surface-2); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); display: grid; place-items: center; position: relative; margin-bottom: 12px;
}
.cam-tile .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.cam-tile .thumb img.ok { opacity: 1; }
.cam-tile .thumb .ph { display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.cam-tile .thumb .role {
  position: absolute; top: 10px; left: 10px; background: rgba(8, 18, 24, .72); color: #fff;
  border-radius: 6px; padding: 2px 9px; font-weight: 700; font-size: 12px; letter-spacing: .04em;
}
.thumb-empty { color: var(--muted); display: grid; gap: 8px; place-items: center; text-align: center; padding: 20px; }

/* lists / tables */
.list { display: flex; flex-direction: column; }
.list > .item {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line);
}
.list > .item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.table-wrap { overflow-x: auto; }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }

.events { display: grid; gap: 0; }
.ev { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ev:first-child { border-top: 0; }
.ev .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.ev.warn .m::before, .ev.error .m::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px;
}
.ev.warn .m::before { background: var(--warn); }
.ev.error .m::before { background: var(--bad); }

/* settings */
.set-group { padding: 0; }
.set-group > header { padding: 18px 20px 6px; }
.set-group > header p { color: var(--ink-2); margin-top: 4px; font-size: 13px; }
.set-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.set-row.child { padding-left: 44px; background: var(--surface-2); }
.set-row.off { opacity: .5; }
.set-row .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.set-row .help { color: var(--muted); font-size: 12.5px; grid-column: 1; max-width: 70ch; }
.set-row .ctl { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 8px; }
.set-row .mod { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.set-row .reset { font-size: 12px; }
.set-row .needs { color: var(--warn); font-size: 12px; font-weight: 600; }
.savebar {
  position: sticky; bottom: 16px; z-index: 6; margin-top: 16px; display: flex; align-items: center; gap: 12px;
  background: var(--side); color: var(--side-ink); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.savebar .grow { flex: 1; }
@media (max-width: 860px) { .savebar { bottom: 76px; } }

/* modal + toast */
.scrim {
  position: fixed; inset: 0; background: rgba(8, 16, 22, .45); display: grid; place-items: center; z-index: 50;
  padding: 16px; animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px);
  overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); border: 1px solid var(--line);
}
.modal.wide { width: min(880px, 100%); }
.modal > header { padding: 18px 20px 0; display: flex; align-items: center; gap: 10px; }
.modal > header .x { margin-left: auto; }
.modal > .content { padding: 14px 20px 18px; display: grid; gap: 14px; }
.modal > footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
@media (max-width: 860px) { .toasts { right: 12px; left: 12px; bottom: 80px; } }
.toast {
  background: var(--side); color: var(--side-ink); padding: 11px 14px; border-radius: 9px; box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: center; max-width: 440px; animation: fade .15s ease-out;
}
.toast.bad { background: var(--bad); color: #fff; }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rot .8s linear infinite; display: inline-block; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 4px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 50% -10%, var(--accent-weak), transparent 70%), var(--ground); }
.auth .card { width: min(400px, 100%); padding: 28px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.auth .brand { padding: 0; color: var(--ink); }
.auth .brand-sub { color: var(--muted); }

/* signal bars */
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 3px; background: var(--line-strong); border-radius: 1px; }
.bars i:nth-child(1) { height: 4px; } .bars i:nth-child(2) { height: 7px; }
.bars i:nth-child(3) { height: 10px; } .bars i:nth-child(4) { height: 14px; }
.bars i.on { background: var(--ink-2); }

/* log */
.log {
  font-family: var(--mono); font-size: 12px; background: #0b1318; color: #cfe0e8; border-radius: 8px;
  padding: 12px 14px; height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

/* ── calibrator ────────────────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cal { grid-template-columns: 1fr; } }
.stage {
  position: relative; background: #0b1216; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4608 / 2376; width: 100%; touch-action: none; user-select: none;
}
@media (max-width: 600px) { .stage .hintbar span:last-child { display: none; } }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.stage.panning canvas { cursor: grabbing; }
.stage .overlay {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.stage .overlay .btn { background: rgba(10, 20, 26, .78); color: #e6eef2; border-color: rgba(255,255,255,.18); }
.stage .hintbar {
  position: absolute; left: 12px; top: 12px; right: 12px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none;
}
.stage .hintbar span {
  background: rgba(10, 20, 26, .8); color: #e6eef2; border-radius: 6px; padding: 4px 9px; font-size: 12.5px;
}
.stage .hintbar .armed { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9fb2bd; text-align: center; padding: 20px; }
.cal-side { display: grid; gap: 14px; }
.result .big { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.lm-list { display: flex; flex-direction: column; max-height: 460px; overflow: auto; margin: 0 -8px; }
.lm {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  padding: 9px 8px; border-radius: 8px; cursor: pointer;
}
.lm:hover { background: var(--surface-2); }
.lm.sel { background: var(--accent-weak); }
.lm .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.lm .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm .co { grid-column: 2; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.lm .st { grid-row: 1 / span 2; grid-column: 3; display: flex; align-items: center; gap: 6px; }
.lm .errv { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }
.errv.good { color: var(--good); } .errv.warn { color: var(--warn); } .errv.bad { color: var(--bad); }

/* ── public landing (device list) ──────────────────────────────────── */
.landing { min-height: 100vh; background: var(--ground); }
.landing-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--side); color: var(--side-ink);
}
.landing-top .brand { padding: 0; }
.landing-top .btn { background: transparent; color: var(--side-ink); border-color: rgba(255,255,255,.25); }
.landing-top .btn:hover { border-color: var(--side-ink); }
.landing-page { margin: 0 auto; max-width: 980px; }
.card.device h2 { font-size: 17px; }
.devmark {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent-weak); color: var(--accent);
}
@media (max-width: 600px) { .landing-top { padding: 10px 16px; } .devmark { display: none; } }
.portal-note {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px;
}
.portal-note a { font-weight: 600; }
.cam-tile .thumb.is-live { background: #05090c; }
.cam-tile .thumb img.live { opacity: 1; object-fit: contain; }
.cam-tile .thumb .livebadge { position: absolute; top: 10px; right: 10px; background: rgba(8, 18, 24, .72); color: #7fe0a6; }

/* ── People (face database) ────────────────────────────────────────── */
.face-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
@media (max-width: 900px) { .face-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fstat { padding: 14px 16px; }
.fstat .v { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fstat .l { font-size: 13px; color: var(--ink-2); }
.fstat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.fstat.warn .v { color: var(--warn); }
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 7px 12px; cursor: pointer; font-weight: 550; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent-weak); color: var(--accent); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  text-align: left; cursor: pointer; display: grid; gap: 6px; color: var(--ink);
}
.pcard:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.pthumb, .pbig { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.pthumb img, .pbig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pname { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.person-top { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.pbig { width: 180px; flex: none; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .ph-actions { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.photo:hover .ph-actions, .photo:focus-within .ph-actions { opacity: 1; }
@media (hover: none) { .photo .ph-actions { opacity: 1; } }
.photo .btn.sm { height: 26px; padding: 0 6px; background: rgba(10, 20, 26, .78); color: #fff; border-color: transparent; }
.review-bar {
  position: sticky; top: 58px; z-index: 4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
}
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rcard.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.rimg { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: var(--surface-2); cursor: pointer; }
.rimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rimg .tick {
  position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(10, 20, 26, .6); border: 1.5px solid rgba(255,255,255,.85); color: #fff; font-weight: 700; font-size: 13px;
}
.rcard.on .rimg .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rinfo { padding: 8px 10px 10px; display: grid; gap: 2px; }

/* face samples (one crop per embedding) + change history */
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.stile { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.stile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.stile .rimg { display: grid; place-items: center; }
.stile .rimg:disabled { cursor: default; }
.stile .rimg .tick { top: 5px; left: 5px; width: 18px; height: 18px; font-size: 11px; }
.stile.on .rimg .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stile .anchor { position: absolute; right: 5px; top: 5px; color: #f5c451; display: grid; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.stile.nocrop { opacity: .6; border-style: dashed; }
.smeta { display: flex; justify-content: space-between; gap: 4px; padding: 3px 6px 4px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.review-bar.inset { position: static; margin-bottom: 10px; padding: 8px 10px; }
.hist .item { align-items: center; }
.hthumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-2); display: inline-block; }
.hist-wrap summary { cursor: pointer; list-style: revert; }
.hist-wrap summary h3 { display: inline; }
.hist-wrap[open] summary { margin-bottom: 8px; }
.fstat.linkcard { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.fstat.linkcard:hover { border-color: var(--accent-line); }

.photo .rimg .tick { top: 5px; left: 5px; width: 18px; height: 18px; font-size: 11px; }
.photo.on { box-shadow: 0 0 0 2px var(--accent); }
.photo.on .rimg .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.modal label.row { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
.modal label.row input { margin-top: 3px; flex: none; }

.pcard .punused { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-weak);
  border-radius: 999px; padding: 1px 8px; justify-self: start; }
