/* NXshield console — NXSI Labs identity v1.1: premium darkness, quiet metallic detail, calm under pressure.
   Core palette and type from design-system/tokens.json; semantic soft tints and light theme are derived. */
:root {
  /* brand core */
  --nx-obsidian: #07090C;
  --nx-graphite: #11161B;
  --nx-steel: #8C969F;
  --nx-silver: #B5BEC7;
  --nx-ice: #EFF3F5;
  --nx-line: #546772;
  --nx-focus: #9DDAFF;
  --nx-success: #91D4B1;
  --nx-warning: #F2CD80;
  --nx-danger: #FFAAAA;

  --bg: var(--nx-obsidian);
  --bg-2: #0B0F13;
  --panel: var(--nx-graphite);
  --panel-2: #161C22;
  --line: #1F2830;
  --line-2: #2E3A44;
  --text: var(--nx-ice);
  --text-2: var(--nx-silver);
  --text-3: var(--nx-steel);
  --accent: var(--nx-silver);         /* primary actions: silver fill, dark text */
  --accent-hover: var(--nx-ice);
  --accent-press: var(--nx-steel);
  --accent-ink: var(--nx-obsidian);
  --accent-soft: rgba(181, 190, 199, 0.10);
  --link: var(--nx-focus);
  --focus: var(--nx-focus);
  --critical: var(--nx-danger);
  --critical-soft: rgba(255, 170, 170, 0.12);
  --critical-ink: #2A0B0B;
  --high: var(--nx-warning);
  --high-soft: rgba(242, 205, 128, 0.12);
  --normal: var(--nx-focus);
  --normal-soft: rgba(157, 218, 255, 0.12);
  --ok: var(--nx-success);
  --ok-soft: rgba(145, 212, 177, 0.12);
  --muted-soft: rgba(140, 150, 159, 0.14);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --radius: 12px;      /* cards */
  --radius-sm: 6px;    /* controls */
  --font: "DM Sans", Arial, sans-serif;
  --display: "Space Grotesk", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F6F8F9;
  --bg-2: var(--nx-ice);
  --panel: #FFFFFF;
  --panel-2: #F3F6F7;
  --line: #DDE3E7;
  --line-2: #C6CFD5;
  --text: var(--nx-obsidian);
  --text-2: #3E4A53;
  --text-3: #5F6B74;
  --accent: var(--nx-graphite);
  --accent-hover: #26303A;
  --accent-press: var(--nx-line);
  --accent-ink: var(--nx-ice);
  --accent-soft: rgba(17, 22, 27, 0.07);
  --link: #1E6497;
  --focus: #1E6497;
  --critical: #B42828;
  --critical-soft: rgba(180, 40, 40, 0.09);
  --critical-ink: #FFFFFF;
  --high: #8A5A00;
  --high-soft: rgba(138, 90, 0, 0.10);
  --normal: #1E6497;
  --normal-soft: rgba(30, 100, 151, 0.09);
  --ok: #1E7A50;
  --ok-soft: rgba(30, 122, 80, 0.10);
  --muted-soft: rgba(84, 103, 114, 0.10);
  --shadow: 0 16px 40px rgba(7, 9, 12, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100%; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; padding: 22px 16px 16px; }
.brand img { width: 200px; height: auto; display: block; }
img.logo-light, .brand img.logo-light { display: none; }
:root[data-theme="light"] img.logo-dark, :root[data-theme="light"] .brand img.logo-dark { display: none; }
:root[data-theme="light"] img.logo-light, :root[data-theme="light"] .brand img.logo-light { display: block; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-3); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; position: relative; }
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--nx-silver); }
.nav a .count { margin-left: auto; }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.shell.full { grid-template-columns: 1fr; }
.shell.full > .sidebar, .shell.full .topbar { display: none; }
.shell.full .main { position: relative; }
.full-bar { position: fixed; top: 10px; right: 14px; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; opacity: .35; transition: opacity .2s; }
.full-bar:hover, .full-bar:focus-within { opacity: 1; }
.nav-gap { height: 14px; }
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.help-toc { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.help-toc a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text-2); }
.help-toc a:hover { background: var(--panel); color: var(--text); }
.help-toc a.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.help-toc .nav-section { padding: 14px 10px 4px; }
.help-search { position: relative; margin-bottom: 6px; }
.help-search > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3, var(--text-2)); }
.help-search .input { padding-left: 34px; width: 100%; }
.help-main { max-width: 760px; min-width: 0; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.help-card, .help-toc a { text-decoration: none !important; }
.help-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; color: var(--text); }
.help-card:hover { border-color: var(--line-2); background: var(--panel-2); }
.help-body { line-height: 1.6; font-size: 14px; }
.help-body h3 { margin: 26px 0 8px; font-size: 16px; }
.help-body p { margin: 0 0 12px; }
.help-body ol, .help-body ul { margin: 0 0 14px; padding-left: 22px; }
.help-body li { margin: 4px 0; }
.help-body li ul { margin: 4px 0 0; }
.help-body code { font-family: var(--mono, monospace); font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.help-body .callout { margin: 4px 0 14px; line-height: 1.5; }
.help-more { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 900px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--bg); flex: none; }
.content { flex: 1; overflow: auto; padding: 32px; min-height: 0; }
.content.flush { padding: 0; overflow: hidden; display: flex; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--text-2); }

/* ---------- live indicator ---------- */
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live.on i { background: var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(145, 212, 177, 0.5); } 70% { box-shadow: 0 0 0 7px rgba(145, 212, 177, 0); } 100% { box-shadow: 0 0 0 0 rgba(145, 212, 177, 0); } }

/* ---------- panels, cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 20px 24px; background: var(--bg-2); }
.stat .label { font-size: 12px; color: var(--text-2); }
.stat .value { font-family: var(--display); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; letter-spacing: 0.04em; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); position: sticky; top: 0; }
.table td { padding: 8px 14px; height: 48px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--panel-2); }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--text-3); background: var(--accent-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); border-color: var(--accent-press); }
.btn.danger { background: transparent; border-color: var(--critical); color: var(--critical); }
.btn.danger.solid { background: var(--critical); color: var(--critical-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 16px; }
.btn svg { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input { height: 44px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: inherit; width: 100%; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.input.sm { height: 36px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--nx-silver); width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; }
.search { min-width: 240px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: none; color: var(--text-2); font: inherit; font-weight: 550; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--nx-silver); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--muted-soft); color: var(--text-2); white-space: nowrap; }
.badge.critical { background: var(--critical-soft); color: var(--critical); }
.badge.high { background: var(--high-soft); color: var(--high); }
.badge.normal { background: var(--normal-soft); color: var(--normal); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.accent { background: var(--accent-soft); color: var(--text); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--critical); color: var(--critical-ink); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.count.muted { background: var(--line-2); color: var(--text); }

/* ---------- avatars / faces ---------- */
.avatar { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--line); flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); font-weight: 600; font-size: 13px; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar.xl { width: 120px; height: 120px; border-radius: 12px; font-size: 32px; }

/* ---------- monitor (alert queue) ---------- */
.monitor { display: grid; grid-template-columns: 380px 1fr; width: 100%; min-height: 0; }
.queue { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); }
.queue-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.queue-list { overflow-y: auto; flex: 1; }
.qitem { display: grid; grid-template-columns: 4px 52px 1fr; gap: 12px; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.qitem:hover { background: var(--panel); }
.qitem.active { background: var(--panel-2); }
.qitem .bar { border-radius: 0 3px 3px 0; }
.qitem.critical .bar { background: var(--critical); }
.qitem.high .bar { background: var(--high); }
.qitem.normal .bar { background: var(--normal); }
.qitem.is-new { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { background: var(--critical-soft); } 100% { background: transparent; } }
.qitem img, .qitem .avatar { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.qitem .title { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.qitem .meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.qitem .time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.detail { overflow-y: auto; min-height: 0; padding: 22px; }
.alert-hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.faces { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.face { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.face img, .face video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #000; }
.face .cap { padding: 8px 12px; font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; }
.scene img, .scene video { width: 100%; display: block; border-radius: var(--radius); background: #000; max-height: 360px; object-fit: contain; }
.action-banner { border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; font-weight: 600; font-size: 15px; }
.action-banner.critical { background: var(--critical-soft); color: var(--critical); border: 1px solid var(--critical); }
.action-banner.high { background: var(--high-soft); color: var(--high); border: 1px solid var(--high); }
.action-banner.normal { background: var(--normal-soft); color: var(--normal); border: 1px solid var(--normal); }
.action-banner svg { width: 22px; height: 22px; flex: none; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 13px; }
.tl i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-top: 6px; }
.tl.status i { background: var(--nx-silver); }
.score { font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---------- dialog / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(3, 7, 12, 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.dialog { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; width: min(640px, 100%); box-shadow: var(--shadow); }
.dialog.wide { width: min(860px, 100%); }
.dialog-head { padding: 18px 20px 6px; display: flex; align-items: center; gap: 12px; }
.dialog-body { padding: 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--ok); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; }
.toast.error { border-left-color: var(--critical); }
.callout > svg { margin-top: 1px; }
.callout { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; }
.callout.warn { border-color: var(--high); background: var(--high-soft); }
.callout.danger { border-color: var(--critical); background: var(--critical-soft); }
.callout.ok { border-color: var(--ok); background: var(--ok-soft); }
.secret { font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; background: var(--bg-2); border: 1px dashed var(--nx-line); padding: 12px 14px; border-radius: 8px; word-break: break-all; }
.code-big { font-size: 28px; letter-spacing: 0.12em; text-align: center; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(900px 520px at 85% 15%, rgba(181, 190, 199, 0.07), transparent 65%), #07090C; border-right: 1px solid #1F2830; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; color: #EFF3F5; }
.login-art .hero-logo { width: min(440px, 80%); height: auto; }
.login-art h1 { font-size: 56px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; max-width: 600px; }
.login-art p { color: #B5BEC7; max-width: 480px; font-size: 16px; }
.login-art .eyebrow { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: #8C969F; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }

/* ---------- camera tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tile .shot { aspect-ratio: 16 / 9; background: #05080c; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 12px; position: relative; }
.tile .shot img { width: 100%; height: 100%; object-fit: cover; }
.tile .shot .badge { position: absolute; top: 8px; left: 8px; }
.tile .info { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--nx-silver); }
.meter.warn i { background: var(--high); }
.meter.bad i { background: var(--critical); }

.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo { position: relative; }
.photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.photo .badge { position: absolute; bottom: 6px; left: 6px; background: var(--panel); color: var(--text); }
.photo .x { position: absolute; top: 4px; right: 4px; }
.dropzone { width: 96px; height: 96px; border: 1px dashed var(--line-2); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--text-3); cursor: pointer; font-size: 12px; text-align: center; }
.dropzone:hover { border-color: var(--text-3); color: var(--text); }

@media (max-width: 1100px) {
  .alert-hero { grid-template-columns: 1fr; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .monitor { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ---------- detections ---------- */
.faces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.face-tile { position: relative; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; cursor: pointer; text-align: left; color: inherit; font: inherit; }
.face-tile:hover { border-color: var(--text-3); }
.face-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.face-tile.listed { border-color: var(--critical); }
.face-tile img, .face-tile .avatar { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; display: block; border: 0; border-radius: 0; }
.face-tile .meta { padding: 8px 10px; }
.face-tile .when { font-size: 13px; font-weight: 500; }
.face-tile .where { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face-tile .tag { position: absolute; top: 8px; left: 8px; }
.choice { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.choice:hover { border-color: var(--text-3); background: var(--accent-soft); }
.choice svg { width: 28px; height: 28px; flex: none; margin-top: 2px; }
.choice b { display: block; font-family: var(--display); font-weight: 500; font-size: 17px; margin-bottom: 4px; }
.preview { width: 160px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* diagnostics */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { background: none; border: none; color: var(--text-2); font: inherit; font-size: 13px; padding: 6px 12px; min-height: 34px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.stat .value.small-value { font-size: 22px; display: flex; align-items: center; flex-wrap: wrap; }
.table.journal td { height: auto; padding-block: 9px; vertical-align: top; }
.table.journal td.grow-cell { width: 100%; min-width: 260px; }
.table.journal pre.json { margin: 0; max-height: 280px; overflow: auto; font: 12px/1.5 var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* role explanations */
.role-label { display: inline-flex; align-items: center; gap: 6px; cursor: help; border-bottom: 1px dotted var(--text-3); padding-bottom: 1px; }
.role-label svg { color: var(--text-3); }
.role-label:hover svg, .role-label:focus-visible svg { color: var(--text); }
.role-pop { position: fixed; z-index: 1000; width: min(460px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; pointer-events: none; max-height: calc(100vh - 24px); overflow: hidden; }
.role-details { display: grid; gap: 8px; font-size: 13px; }
.role-details p { margin: 0; color: var(--text-2); }
.role-title { font-family: var(--display); font-size: 17px; font-weight: 500; color: var(--text); }
.role-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
.role-details.compact .role-cols { grid-template-columns: 1fr 1fr; }
.role-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.role-h.ok { color: var(--ok); } .role-h.no { color: var(--text-3); }
.role-details ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.role-details li { display: grid; grid-template-columns: 14px 1fr; gap: 7px; align-items: start; line-height: 1.35; }
.role-details li svg { margin-top: 2px; color: var(--ok); }
.role-details ul.no li { color: var(--text-3); }
.role-details ul.no li svg { color: var(--text-3); }
.role-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); padding: 12px 14px; }
@media (max-width: 560px) { .role-cols, .role-details.compact .role-cols { grid-template-columns: 1fr; } }

/* health dashboard */
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.health-banner { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); border-left-width: 4px; }
.health-banner.ok { border-left-color: var(--ok); background: linear-gradient(90deg, var(--ok-soft), var(--panel) 60%); }
.health-banner.warning { border-left-color: var(--high); background: linear-gradient(90deg, var(--high-soft), var(--panel) 60%); }
.health-banner.critical { border-left-color: var(--critical); background: linear-gradient(90deg, var(--critical-soft), var(--panel) 60%); }
.health-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); }
.health-banner.warning .health-dot { background: var(--high); box-shadow: 0 0 0 5px var(--high-soft); }
.health-banner.critical .health-dot { background: var(--critical); box-shadow: 0 0 0 5px var(--critical-soft); animation: health-pulse 1.6s ease-in-out infinite; }
@keyframes health-pulse { 50% { box-shadow: 0 0 0 9px var(--critical-soft); } }
@media (prefers-reduced-motion: reduce) { .health-banner.critical .health-dot { animation: none; } }
.health-headline { font-family: var(--display); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.health-tiles { margin-bottom: 16px; }
.stat .value.bad { color: var(--critical); }
a.tile-link { color: inherit; text-decoration: none; }
a.tile-link:hover { border-color: var(--line-2); background: var(--panel-2); }
.issues { display: grid; }
.issue { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 18px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.issue:last-child { border-bottom: none; }
.issue.critical { border-left-color: var(--critical); }
.issue.warning { border-left-color: var(--high); }
.issue.info { border-left-color: var(--line-2); }
.issue .badge { justify-self: start; margin-top: 1px; }
.issue-body { display: grid; gap: 2px; min-width: 0; }
.issue-title { font-weight: 600; }
.site-health { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.site-health i { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.site-health.ok { color: var(--ok); } .site-health.ok i { background: var(--ok); }
.site-health.warning { color: var(--high); } .site-health.warning i { background: var(--high); }
.site-health.critical { color: var(--critical); } .site-health.critical i { background: var(--critical); }
.site-health.info { color: var(--text-3); }
td.bad-num { color: var(--critical); font-weight: 600; }
@media (max-width: 1100px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .issue { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

.stat .value.words { font-size: 22px; line-height: 1.25; margin-top: 10px; }

/* camera setup and software updates */
.found-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.found { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); color: inherit; font: inherit; cursor: pointer; }
.found:hover:not(:disabled) { border-color: var(--text-3); }
.found:disabled { opacity: .55; cursor: default; }
.danger-text, .btn.danger-text { color: var(--critical); }
.pick-list { display: grid; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check.pick { padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.check.pick:last-child { border-bottom: none; }
.check.pick .grow { min-width: 0; }

/* required fields */
.req { color: var(--critical); font-weight: 700; }
.req-note { margin: 0; }
.req-count { color: var(--high, #b7791f); font-weight: 600; }
.field-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.still-needed { margin-right: auto; align-self: center; display: inline-flex; gap: 6px; align-items: center; color: var(--high, #b7791f); max-width: 60%; line-height: 1.35; }
.still-needed svg { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* detections: pause / hold / go to time */
.det-toolbar { position: sticky; top: -32px; z-index: 5; background: var(--bg); padding-top: 10px; padding-bottom: 10px; margin-top: -10px; }
.new-faces { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 6px 14px; background: var(--accent); color: var(--accent-ink, #04121f); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.face-tile.is-new { animation: tile-in 2.5s ease-out; }
@keyframes tile-in { from { box-shadow: 0 0 0 2px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 760px) { .det-toolbar { top: -16px; } }
.check.pick.disabled { opacity: .55; }

/* alert detail: earlier captures under the latest one */
.sightings-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; }
.sighting { flex: none; width: 112px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.sighting:hover { border-color: var(--text-3); }
.sighting:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sighting img, .sighting .avatar { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; display: block; border: 0; border-radius: 0; }
.sighting .when, .sighting .where { display: block; padding: 0 8px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sighting .when { padding-top: 6px; color: var(--text); }
.sighting .where { padding-bottom: 6px; color: var(--text-3); }

/* Compact sort button + floating menu (Monitor) */
.count-pill { margin-left: 8px; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--muted-soft); color: var(--text-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.menu-wrap { position: relative; }
.menu-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.menu-btn:hover, .menu-btn.open { background: var(--accent-soft); color: var(--text); border-color: var(--line-2); }
.menu-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.menu-btn svg:last-child { opacity: .6; transition: transform .15s; }
.menu-btn.open svg:last-child { transform: rotate(180deg); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 296px; padding: 6px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--panel-2); box-shadow: var(--shadow); animation: menu-in .12s ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-label { padding: 6px 10px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.menu-item b { display: block; font-weight: 600; font-size: 14px; }
.menu-item span span { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent-soft); outline: none; }
.menu-item.on svg { color: var(--focus); }

/* Live video */
.live-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.live-video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.live-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--nx-silver); font-size: 14px; }
.live-badge { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(7, 9, 12, .7); color: var(--nx-ice); font: 600 11px var(--font); letter-spacing: .08em; }
.live-badge .dot, .live-overlay .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--nx-danger); animation: live-pulse 1.4s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; } }

/* Radio choices with a description (NXinside camera role) */
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-list .choice { gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); transition: border-color .15s, background .15s; }
.choice-list .choice.on { border-color: var(--focus); background: var(--normal-soft); }
.choice-list .choice input { margin-top: 3px; accent-color: var(--focus); }
.choice-list .choice b { font-family: var(--font); font-weight: 600; font-size: 15px; margin-bottom: 0; }
.choice .avatar { width: 40px; height: 40px; flex: none; }
.choice span > span, .choice > span { color: var(--text-2); }

/* How a match came about (frames above the line) */
.evidence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Match line: slider + number */
.line-control { display: flex; align-items: center; gap: 10px; }
.line-control input[type=range] { flex: 1; accent-color: var(--focus); }

/* Match confidence words (High / Medium / Low). Not red: red is for Threat. */
.badge.conf-high { background: var(--ok-soft); color: var(--ok); }
.badge.conf-medium { background: var(--normal-soft); color: var(--normal); }
.badge.conf-low { background: var(--high-soft); color: var(--high); }
.conf { cursor: help; }
span.conf:not(.badge) { font-weight: 650; }
span.conf-high:not(.badge) { color: var(--ok); }
span.conf-medium:not(.badge) { color: var(--normal); }
span.conf-low:not(.badge) { color: var(--high); }

/* Monitor: confidence filter */
.menu-btn.active { color: var(--text); border-color: var(--focus); background: var(--accent-soft); }
.check-box { flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); }
.check-box.on { background: var(--focus); border-color: var(--focus); }
.menu-item.on .check-box.on svg { color: var(--bg, #fff); }
.filter-note { display: flex; align-items: center; gap: 10px; margin: 0 10px 8px; padding: 8px 12px; border-radius: 10px; background: var(--muted-soft); color: var(--text-2); font-size: 12.5px; }
.filter-note.threat { background: var(--critical-soft); color: var(--critical); }
.link-btn { border: 0; background: none; padding: 0; color: var(--focus); font: 600 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }
.menu-btn-text { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { white-space: nowrap; }
#monitor-confidence { padding: 0 9px; }
#monitor-confidence .menu-btn-text { max-width: 70px; }
.menu.left { left: 0; right: auto; }

/* Camera pictures (tiles and the camera view) */
button.shot { width: 100%; padding: 0; border: 0; cursor: pointer; font: inherit; }
button.shot:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
button.shot:hover img { filter: brightness(1.08); }
.shot .shot-cap { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(5, 8, 12, .72); color: #e8edf2; font-size: 11px; white-space: nowrap; }
.shot-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 16px; text-align: center; color: var(--text-3); font-size: 12px; }
.camera-view { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 18px; align-items: start; }
.camera-view > p { grid-column: 1 / -1; }
.shot.large { aspect-ratio: 16 / 9; background: #05080c; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; }
.shot.large img { width: 100%; height: 100%; object-fit: contain; }
.shot.large .badge { position: absolute; top: 10px; left: 10px; }
@media (max-width: 720px) { .camera-view { grid-template-columns: 1fr; } }

/* Two-step sign-in */
.code-input { font: 600 22px/1 var(--mono, ui-monospace, Menlo, monospace); letter-spacing: .25em; text-align: center; max-width: 240px; }
.mfa-page { width: min(520px, 100%); display: flex; flex-direction: column; gap: 14px; }
.mfa-page h1 { margin: 6px 0 0; }
ol.mfa-steps { margin: 0; padding: 0; list-style: none; counter-reset: mfa; display: grid; gap: 16px; }
ol.mfa-steps > li { counter-increment: mfa; display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; row-gap: 6px; align-items: start; }
ol.mfa-steps > li::before { content: counter(mfa); grid-row: 1 / span 4; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--text); font: 600 12px/24px var(--font); text-align: center; }
ol.mfa-steps > li > * { grid-column: 2; }
ol.mfa-steps > li > span { color: var(--text-2); font-size: 13px; }
.mfa-qr { width: 190px; height: 190px; padding: 6px; background: #fff; border-radius: 10px; }
.mfa-qr svg { width: 100%; height: 100%; display: block; }
.mfa-key { font: 600 14px var(--mono, ui-monospace, Menlo, monospace); letter-spacing: .06em; user-select: all; word-break: break-all; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 14px; border: 1px dashed var(--line-2); border-radius: 10px; }
.backup-codes code { font: 600 15px var(--mono, ui-monospace, Menlo, monospace); letter-spacing: .08em; text-align: center; user-select: all; }
