:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1d222d;
  --border: #262d3a;
  --text: #e6edf3;
  --muted: #8a96a8;
  --accent: #4f8cff;
  --accent-fg: #fff;
  --good: #2ecc71;
  --bad: #e74c3c;
  --warn: #f39c12;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar nav { display: flex; gap: 14px; margin-left: auto; }
.topbar nav a { color: var(--muted); font-size: 14px; }
.topbar nav a.active { color: var(--text); }

.container { max-width: 1100px; margin: 0 auto; padding: 18px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px 0; font-size: 16px; font-weight: 600; }
.card .muted { color: var(--muted); font-size: 13px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 220px; }

input, select, button, textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type="file"] { padding: 6px; }

label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }

button {
  cursor: pointer; background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
  font-weight: 500;
}
button.secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
button.danger { background: var(--bad); border-color: var(--bad); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.pill.ok { background: rgba(46,204,113,0.15); color: var(--good); }
.pill.bad { background: rgba(231,76,60,0.15); color: var(--bad); }
.pill.warn { background: rgba(243,156,18,0.15); color: var(--warn); }

/* Camera view */
.cam-stack { position: relative; width: 100%; aspect-ratio: 4/3; background: #000; border-radius: var(--radius); overflow: hidden; }
.cam-stack video, .cam-stack canvas, .cam-stack img, .cam-stack #dce-mount { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-stack canvas { pointer-events: none; }
.cam-stack .hud { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,0.55); padding: 6px 10px; border-radius: 8px; font-size: 12px; }
.cam-stack .hud .fps { color: var(--good); }

.recent-detections { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.recent-detections .chip {
  display: flex; gap: 8px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px 4px 4px; font-size: 13px;
}
.recent-detections .chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.recent-detections .chip .dot.ok { background: var(--good); }
.recent-detections .chip .dot.bad { background: var(--bad); }

#log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); height: 120px; overflow-y: auto; background: #0a0d12; padding: 8px; border-radius: 8px; }
