:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #6a7384;
  --line: #e2e5ea;
  --accent: #2563eb;
  --good: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --surface: #1a2029;
    --text: #e6e9ef;
    --muted: #97a0b0;
    --line: #2b3340;
    --accent: #6ea0ff;
    --good: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 8px 0 16px; overflow-wrap: anywhere; }
h2 { font-size: 16px; margin: 28px 0 10px; }
.muted { color: var(--muted); font-weight: normal; }

.top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top .brand { font-weight: 700; color: var(--text); }
.top nav { display: flex; gap: 16px; flex: 1; }
.top form { margin: 0; }

button {
  font: inherit; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.link { background: none; border: none; color: var(--accent); padding: 0; }
.btn-danger { background: var(--bad); border-color: var(--bad); }
input, select {
  font: inherit; padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.login { max-width: 340px; margin: 12vh auto; display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 4px; }
.error { color: var(--bad); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tile span, .tile small { display: block; color: var(--muted); font-size: 12px; }
.tile b { font-size: 24px; font-variant-numeric: tabular-nums; }

.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.kv { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.kv th { color: var(--muted); font-weight: normal; width: 40%; }
.kv td { white-space: normal; overflow-wrap: anywhere; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 16px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid currentColor; vertical-align: middle;
}
.badge-good, .badge-complete { color: var(--good); }
.badge-warning, .badge-uploading { color: var(--warn); }
.badge-failed, .badge-session_loss { color: var(--bad); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input { flex: 1; min-width: 200px; }
.pager { display: flex; gap: 16px; justify-content: center; color: var(--muted); }

.player { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; }
.json {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; overflow: auto; max-height: 420px; font-size: 12px;
}
.danger { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.upload-progress { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.upload-progress progress { width: 100%; height: 10px; accent-color: var(--accent); }
.upload-progress span { color: var(--muted); font-size: 13px; }
