:root {
  --navy: #13294b; --navy-2: #1b3a66; --navy-3: #0c1b33; --red: #c8102e; --red-2: #a50d26;
  --ink: #1c2430; --muted: #6b7686; --line: #e3e7ee; --bg: #f5f7fb; --ok: #1f9d55; --warn: #d98e04;
  --radius: 12px; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: var(--navy-2); }
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 16px; padding: 12px 24px; border-bottom: 4px solid var(--red); }
.topbar .brand { font-weight: 700; letter-spacing: .3px; font-size: 18px; }
.topbar .brand small { display: block; font-weight: 400; opacity: .75; font-size: 12px; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button.link { color: #fff; opacity: .85; text-decoration: none; background: none; border: 0; cursor: pointer; font: inherit; }
.wrap { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 24px; margin: 0 0 16px; color: var(--navy); }
h2 { font-size: 18px; margin: 28px 0 12px; color: var(--navy); border-bottom: 2px solid var(--red); padding-bottom: 6px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #cfd6e0; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--navy-2); outline-offset: 0; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer; background: var(--navy); color: #fff; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn.red { background: var(--red); } .btn.red:hover { background: var(--red-2); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid #cfd6e0; }
.btn.ghost:hover { background: #eef2f8; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef2f8; color: var(--navy); }
.pill.ok { background: #e3f5ea; color: var(--ok); } .pill.warn { background: #fff4dc; color: #8a5a00; } .pill.bad { background: #fde7ea; color: var(--red); }
.pill.live { background: var(--red); color: #fff; }
.error { color: var(--red); font-size: 14px; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy-3); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 99; box-shadow: 0 6px 24px rgba(0,0,0,.25); }

/* ---------- Studio ---------- */
body.studio { background: var(--navy-3); color: #fff; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.studio .topbar { flex: none; }
.stage { flex: 1; display: flex; min-height: 0; }
.tiles { flex: 1; display: grid; gap: 10px; padding: 14px; align-content: center; justify-content: center; min-width: 0; }
.tile { position: relative; background: #0a1628; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; border: 3px solid transparent; transition: border-color .15s; }
.tile.speaking { border-color: #4fd1a5; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video.mirror { transform: scaleX(-1); }
.tile video.screen { object-fit: contain; background: #000; }
.tile .nametag { position: absolute; left: 10px; bottom: 10px; background: rgba(12,27,51,.82); padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; border-left: 3px solid var(--red); }
.tile .avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 700; color: #9fb3d1; background: linear-gradient(135deg, #13294b, #0c1b33); }
.tile .badges { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; }
.tile .hostctl { position: absolute; right: 8px; bottom: 8px; display: none; gap: 6px; }
.tile:hover .hostctl { display: flex; }
.side { width: 320px; background: #0f2140; border-left: 1px solid #22385e; padding: 16px; overflow-y: auto; flex: none; }
.side h3 { color: #c9d6ea; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 8px; }
.side .item { background: #13294b; border-radius: 8px; padding: 9px 11px; margin-bottom: 6px; font-size: 13px; }
.controls { flex: none; display: flex; justify-content: center; gap: 10px; padding: 12px; background: #0a1628; border-top: 1px solid #22385e; flex-wrap: wrap; }
.cbtn { font: inherit; font-size: 13px; font-weight: 600; min-width: 92px; padding: 10px 14px; border-radius: 10px; border: 1px solid #2b4677; background: #13294b; color: #fff; cursor: pointer; }
.cbtn:hover { background: #1b3a66; }
.cbtn.off { background: #3b1520; border-color: #6d1f30; }
.cbtn.rec { background: var(--red); border-color: var(--red); }
.cbtn.live { background: #fff; color: var(--red); border-color: #fff; }
.recdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.status-strip { display: flex; gap: 8px; align-items: center; }
.green-room { max-width: 760px; margin: 30px auto; background: #0f2140; border-radius: 16px; padding: 24px; border: 1px solid #22385e; }
.green-room h1 { color: #fff; }
.green-room label { color: #a9bad4; }
.green-room video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px; object-fit: cover; transform: scaleX(-1); }
.meter { height: 8px; background: #22385e; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter > div { height: 100%; width: 0; background: #4fd1a5; transition: width .08s; }
.modal-bg { position: fixed; inset: 0; background: rgba(5,12,25,.7); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; color: var(--ink); border-radius: 14px; padding: 22px; width: min(520px, 92vw); max-height: 88vh; overflow: auto; }
.modal h2 { margin-top: 0; }
.check { display: flex; gap: 10px; align-items: center; padding: 8px 0; color: var(--ink); font-size: 14px; }
.notice { background: #fff4dc; color: #6b4600; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
body.studio .notice { background: #3a2e10; color: #ffe2a3; }

/* ---------- Library ---------- */
.player { width: 100%; background: #000; border-radius: 10px; max-height: 420px; }
.timebox { width: 90px; text-align: center; font-variant-numeric: tabular-nums; }
.clipcard video { width: 100%; border-radius: 8px; background: #000; max-height: 260px; }
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--navy-2); }
.hl { border-left: 3px solid var(--red); padding: 8px 12px; background: #fafbfd; margin-bottom: 8px; border-radius: 0 8px 8px 0; }
