:root {
  --bg: #0e1420;
  --panel: #17202f;
  --panel2: #1d2942;
  --line: #2a3a55;
  --text: #dbe4f0;
  --muted: #7d8ca3;
  --accent: #38b6ff;
  --ok: #35c76f;
  --warn: #f0b429;
  --bad: #ef4b5f;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, Arial, sans-serif;
}
h1, h2, h3 { font-weight: 600; letter-spacing: .3px; }
a { color: var(--accent); text-decoration: none; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-size: 16px; }
.topbar .brand b { color: var(--accent); }
.wrap { padding: 18px; max-width: 1500px; margin: 0 auto; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px; margin-bottom: 16px;
}
label { display: block; color: var(--muted); font-size: 12px; margin: 8px 0 3px; }
input, select, button, textarea {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 5px; padding: 7px 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { cursor: pointer; }
.btn { background: var(--accent); color: #06121f; font-weight: 600; border: none; }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); color: #221a00; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag.created { background: #2a3a55; }
.tag.waiting { background: var(--warn); color: #221a00; }
.tag.live { background: var(--ok); color: #04270f; }
.tag.completed { background: #35577c; }
.tag.terminated, .tag.void { background: var(--bad); color: #fff; }
.score { font-weight: 700; }
.score.g { color: var(--ok); } .score.y { color: var(--warn); } .score.r { color: var(--bad); }

/* live grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tile.alert { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.tile header { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: var(--panel2); font-size: 13px; }
.tile .vids { position: relative; background: #000; aspect-ratio: 16/9; }
.tile .vids video.screen { width: 100%; height: 100%; object-fit: contain; }
.tile .vids video.cam {
  position: absolute; right: 8px; bottom: 8px; width: 26%;
  border: 1px solid var(--line); border-radius: 4px; background: #111;
}
.tile .events { max-height: 96px; overflow-y: auto; font-size: 12px; padding: 6px 10px; }
.tile .events div { padding: 1px 0; color: var(--muted); }
.tile .events .s2 { color: var(--warn); } .tile .events .s3 { color: var(--bad); }
.tile footer { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.tile footer button { font-size: 12px; padding: 5px 9px; }

/* candidate */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.panel { width: 100%; max-width: 620px; }
.step { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.step .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--panel2);
  display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.step.done .dot { background: var(--ok); color: #04270f; }
.step.fail .dot { background: var(--bad); }
.small { color: var(--muted); font-size: 12px; }

#callView { display: none; height: 100vh; flex-direction: column; }
#callView .stage { flex: 1; display: flex; align-items: center; justify-content: center; background: #000; }
#callView video#adminVideo { max-width: 92%; max-height: 88%; border-radius: 6px; }
#callView .bar { padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; }
#selfCam { position: fixed; right: 14px; top: 14px; width: 180px; border: 1px solid var(--line);
  border-radius: 6px; background: #111; z-index: 5; }

.overlay {
  position: fixed; inset: 0; background: rgba(10, 6, 6, .93); z-index: 50;
  display: none; align-items: center; justify-content: center; text-align: center; padding: 20px;
}
.overlay .box { max-width: 460px; }
.overlay h2 { color: var(--bad); margin-bottom: 10px; }
.overlay p { margin-bottom: 16px; color: var(--text); }

.linkbox { background: var(--panel2); border: 1px dashed var(--line); border-radius: 5px;
  padding: 8px 10px; font-family: Consolas, monospace; font-size: 12px; word-break: break-all; margin-top: 8px; }
.rowflex { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.rowflex > div { flex: 1; min-width: 140px; }
