:root {
  --bg: #0f1115;
  --bg2: #151922;
  --bg3: #1d2330;
  --line: #2a3140;
  --text: #e8ebf0;
  --muted: #9aa4b2;
  --accent: #d9803f;
  --ok: #46b37c;
  --bad: #d96060;
  --warn: #c9a227;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#topbar {
  height: 52px; flex: 0 0 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--bg2); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; letter-spacing: .2px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; }
#whoami { color: var(--muted); }
.primary {
  background: var(--accent); border: 1px solid var(--accent); color: #14100c;
  padding: 9px 14px; border-radius: 7px; font-weight: 600;
}
.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  padding: 6px 11px; border-radius: 7px; font-size: 13px; text-decoration: none;
}
.ghost:hover, .primary:hover { filter: brightness(1.12); }
#login { flex: 1; display: grid; place-items: center; padding: 24px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 26px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 8px; }
.login-card h1 { font-size: 19px; margin: 0 0 2px; }
.sub { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
label { color: var(--muted); font-size: 12px; margin-top: 6px; }
input, select {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 10px; outline: none; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }
#app { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
#sidebar {
  display: flex; flex-direction: column; min-height: 0; background: var(--bg2);
  border-right: 1px solid var(--line);
}
.side-block { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.mini { font-size: 11px; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; }
.stats { color: var(--muted); font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  background: var(--bg3); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px;
}
.chips button.active { background: var(--accent); border-color: var(--accent); color: #14100c; font-weight: 600; }
.list-head { flex-direction: row; align-items: center; justify-content: space-between; }
.auto-next { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.auto-next input { width: auto; }
#clip-list { flex: 1; overflow: auto; min-height: 0; }
.clip-row {
  display: grid; grid-template-columns: 46px 1fr 96px 52px; gap: 8px; align-items: center;
  padding: 7px 12px; border-bottom: 1px solid #1b2130; cursor: pointer; font-size: 13px;
}
.clip-row:hover { background: var(--bg3); }
.clip-row.active { background: #1f2a3c; box-shadow: inset 3px 0 0 var(--accent); }
.clip-row .no { color: var(--muted); font-variant-numeric: tabular-nums; }
.clip-row .uid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-row .range { color: var(--muted); font-variant-numeric: tabular-nums; }
.clip-row .tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; text-align: center; }
.tag.pass { background: rgba(70, 179, 124, .16); color: var(--ok); }
.tag.fail { background: rgba(217, 96, 96, .16); color: var(--bad); }
.tag.pending { background: rgba(201, 162, 39, .16); color: var(--warn); }
.group-head { padding: 7px 12px; font-size: 12px; color: var(--muted); background: #12151c; border-bottom: 1px solid #1b2130; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
#player-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px; gap: 10px; }
.player-wrap { flex: 1; min-height: 0; background: #000; border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
#video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; background: #000; }
.clip-meta { color: var(--muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; }
.clip-meta b { color: var(--text); font-weight: 600; }
.player-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; margin-left: auto; }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; }
  #sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}
