:root {
  --bg: #0f1216;
  --panel: #171b21;
  --line: #262c35;
  --text: #e6e9ee;
  --dim: #8b94a3;
  --accent: #4f9cff;
  --ok: #3ccf7a;
  --warn: #f2b33d;
  --bad: #ff5468;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}
header h1 { font-size: 17px; margin: 0; font-weight: 650; }
nav { display: flex; gap: 4px; flex: 1; }
nav button {
  background: none;
  border: 0;
  color: var(--dim);
  padding: 7px 12px;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
}
nav button.on { color: var(--text); background: var(--line); }
main { padding: 18px; max-width: 1400px; margin: 0 auto; }
.hidden { display: none !important; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.grid-live { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
/* minmax(0, ...) so the 896 px camera frame cannot widen the column */
@media (max-width: 900px) { .grid-live { grid-template-columns: minmax(0, 1fr); } }
.live img { width: 100%; border-radius: 8px; background: #000; display: block; aspect-ratio: 896 / 512; }
.stat { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat span:first-child { color: var(--dim); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--dim); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
button.btn, input[type=submit] {
  background: var(--line);
  color: var(--text);
  border: 1px solid #333b47;
  border-radius: 7px;
  padding: 7px 13px;
  font: inherit;
  cursor: pointer;
}
button.btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select, textarea {
  background: #0c0f13;
  color: var(--text);
  border: 1px solid #333b47;
  border-radius: 7px;
  padding: 7px 9px;
  font: inherit;
}
textarea { width: 100%; font: 13px/1.4 ui-monospace, "JetBrains Mono", monospace; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; margin-top: 14px; }
.event img { width: 100%; border-radius: 7px; display: block; cursor: zoom-in; background: #000; }
.event .meta { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 4px; }
.event p { margin: 4px 0; color: #c9ced6; font-size: 14px; white-space: pre-wrap; }
.event .thumbs { display: flex; gap: 6px; margin-top: 6px; }
.event .thumbs button { font-size: 12px; padding: 3px 8px; }
.tag { padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; text-transform: uppercase; }
.tag.friend { background: #173d29; color: var(--ok); }
.tag.stranger { background: #48161f; color: var(--bad); }
.tag.unidentified { background: #45360f; color: var(--warn); }
.tag.none { background: var(--line); color: var(--dim); }
.threat-high, .threat-medium { color: var(--bad); }
.threat-low { color: var(--warn); }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; margin-top: 14px; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.sample { position: relative; }
.sample img { width: 84px; height: 84px; object-fit: cover; border-radius: 7px; display: block; }
.sample button {
  position: absolute; top: 3px; right: 3px; border: 0; border-radius: 50%;
  width: 22px; height: 22px; background: #000a; color: #fff; cursor: pointer; line-height: 1;
}
.msg { color: var(--dim); font-size: 14px; min-height: 1.4em; }
.msg.bad { color: var(--bad); }
.msg.ok { color: var(--ok); }
.lightbox {
  position: fixed; inset: 0; background: #000d; display: flex; align-items: center; justify-content: center;
  z-index: 20; cursor: zoom-out;
}
.lightbox img { max-width: 96vw; max-height: 94vh; }
.login { max-width: 340px; margin: 14vh auto; }
.login input { width: 100%; margin: 10px 0; }
.login button { width: 100%; }
small, .dim { color: var(--dim); }
img { max-width: 100%; }

@media (max-width: 600px) {
  header { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  header h1 { flex: 1; }
  /* tabs get their own full-width row under the title */
  nav { order: 3; flex-basis: 100%; }
  nav button { flex: 1; padding: 9px 4px; }
  main { padding: 10px; }
  .panel { padding: 12px; }
  /* text fields stack full width; checkbox labels stay inline */
  .row label:not(:has(input[type=checkbox])) { display: flex; flex-direction: column; gap: 4px; flex: 1 1 100%; }
  .row label input:not([type=checkbox]), .row label select { width: 100% !important; }
  /* 16 px stops iOS zooming in when a field is tapped */
  input, select, textarea, button { font-size: 16px; }
  button.btn { min-height: 40px; }
  .event .thumbs { flex-wrap: wrap; }
  .sample img { width: 72px; height: 72px; }
}
