:root {
  color-scheme: dark;
  --bg: #0c0e13;
  --card: #151922;
  --line: #2a3140;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --danger: #ff8a8a;
  --ok: #5ddea0;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #1d4ed833, transparent 50%),
    var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 20px 50px #0006;
}
.brand {
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.auth-card h1 { margin: 0 0 8px; font-size: 24px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 14px; line-height: 1.45; }
label { display: block; font-size: 13px; margin: 12px 0 6px; color: var(--muted); }
input, button {
  font: inherit;
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f1218;
  color: inherit;
}
button {
  background: var(--accent);
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  margin-top: 16px;
}
button:hover { background: var(--accent-2); }
button.secondary {
  background: transparent;
  border-color: var(--line);
  font-weight: 500;
  margin-top: 8px;
}
.err { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 8px 0 0; }
.ok { color: var(--ok); }
.foot { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }
.code-box {
  font-family: ui-monospace, monospace;
  font-size: 28px;
  letter-spacing: .28em;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  background: #0f1218;
  border: 1px dashed var(--line);
  margin: 12px 0;
}
.hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #10141c;
}
.app-header h1 { font-size: 16px; margin: 0; }
.badge {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #3a1515; color: #ff6b6b; letter-spacing: .04em;
}
.badge.on { background: #14351c; color: var(--ok); }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.app-main { max-width: 960px; margin: 0 auto; padding: 20px; }
video {
  width: 100%; background: #000; border-radius: 10px;
  aspect-ratio: 16/9; display: block;
}
.row { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; align-items: center; }
.row input, .row button { width: auto; margin: 0; }
.row input { flex: 1; min-width: 160px; }
button.linkish {
  width: auto; margin: 0; background: transparent; border: 1px solid var(--line);
  padding: 8px 12px; font-weight: 500;
}
.admin-main { max-width: 1180px; }
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
.admin-card h2 { margin: 0; font-size: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.compact { width: auto; margin: 0; padding: 7px 10px; font-size: 13px; }
.danger { background: #5b2026; border-color: #7f2934; }
.danger:hover { background: #7f2934; }
.admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.health-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; justify-content: space-between; gap: 8px; }
.health-item b { font-size: 12px; }
.health-item .bad { color: var(--danger); }
.event-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.event-row:first-child { border-top: 0; }
.event-row .muted { display: block; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 500; }
.status-pill { border-radius: 999px; padding: 3px 8px; font-size: 12px; }
.status-pill.active { color: var(--ok); background: #14351c; }
.status-pill.inactive { color: var(--danger); background: #3a1515; }
.traffic-light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: #667080; }
.traffic-light.on { background: var(--ok); box-shadow: 0 0 8px #5ddea0aa; }
.traffic-light.off { background: #667080; }
.secret { display: block; padding: 12px; margin: 10px 0; overflow-wrap: anywhere; background: #0f1218; border: 1px dashed var(--line); color: var(--ok); }
@media (max-width: 720px) { .admin-grid { grid-template-columns: repeat(2, 1fr); } .app-header { flex-wrap: wrap; } .app-header .grow { order: 3; flex-basis: 100%; } }
