:root {
  /* Halaman depan, login & sebelum masuk meeting: tema terang */
  --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f9fafb; --line: #e4e7ec;
  --text: #101828; --muted: #667085; --accent: #2a78d6; --accent-2: #1c5cab;
  --danger: #d03b3b; --ok: #0ca30c; --warn: #fab219; --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Di dalam ruang meeting: tema gelap agar video menonjol */
body.in-room {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1f232c; --line: #2a2f3a;
  --text: #e8eaf0; --muted: #9aa1b2; --accent: #2f7cf6; --accent-2: #1f5fd0; --danger: #e5484d; --ok: #2fb27a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
a.btn { text-decoration: none; display: inline-block; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
button, input, select { font: inherit; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--accent-2); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--line); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local] {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); outline: none;
}
input:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.center { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 12px 32px rgba(16,24,40,.08); }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card p.sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #2f7cf633; }
.err { color: #d03b3b; font-size: 14px; min-height: 20px; margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.preview { margin-top: 14px; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; position: relative; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.toggles { display: flex; gap: 8px; margin-top: 10px; }
.chip { flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 14px; }
.chip.off { color: #b42318; border-color: #fecdca; background: #fef3f2; }

/* ---------- Ruang meeting ---------- */
.room { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.topbar .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.main { display: flex; min-height: 0; }
.stage { flex: 1; min-width: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.grid { flex: 1; display: grid; gap: 8px; min-height: 0; align-content: center; }
.tile { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; min-height: 0; aspect-ratio: 16/9; border: 2px solid transparent; }
.tile.speaking { border-color: var(--ok); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.local video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; }
.tile .avatar { position: absolute; inset: 0; display: grid; place-items: center; background: var(--panel-2); }
.tile .avatar span { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.tile .name { position: absolute; left: 8px; bottom: 8px; font-size: 13px; padding: 3px 8px; border-radius: 6px; background: #000a; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); }
.tile .name .mic-off { color: #ff8a8d; }
.pager { display: flex; justify-content: center; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.side { width: 300px; border-left: 1px solid var(--line); display: none; flex-direction: column; background: var(--panel); }
.side.open { display: flex; }
.side h3 { margin: 0; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.side .list { flex: 1; overflow: auto; padding: 8px 14px; font-size: 14px; }
.side .list .item { padding: 6px 0; border-bottom: 1px solid #ffffff08; display: flex; justify-content: space-between; gap: 8px; }
.chat-msg { padding: 6px 0; }
.chat-msg b { font-size: 13px; }
.chat-msg div { white-space: pre-wrap; word-break: break-word; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.controls { display: flex; justify-content: center; gap: 10px; padding: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ctl { min-width: 52px; height: 48px; border-radius: 24px; padding: 0 16px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 14px; }
.ctl:hover { background: var(--line); }
.ctl.off { background: #3a1d20; border-color: #5a2b2e; color: #ffb3b5; }
.ctl.on { background: #17305e; border-color: var(--accent); }
.ctl.leave { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctl svg { width: 20px; height: 20px; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; }
@media (max-width: 760px) {
  .side.open { position: fixed; inset: 56px 0 72px 0; width: auto; z-index: 5; }
  .ctl .lbl { display: none; }
}

/* ---------- Admin ---------- */
.admin { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.admin header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.form-inline { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; align-items: end; }
.form-inline label { margin-top: 0; }
@media (max-width: 700px) { .form-inline { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #ffffff05; }
.table-wrap { overflow-x: auto; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.badge.live { color: var(--ok); border-color: #1d5c42; background: #10291f; }
.badge.closed { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; min-width: 80px; position: relative; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.bar i.cam { background: var(--ok); }
.timeline { position: relative; height: 10px; background: var(--panel-2); border-radius: 5px; min-width: 160px; }
.timeline i { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 5px; }
.copy { font-family: ui-monospace, monospace; font-size: 13px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.legend span.cam::before { background: var(--ok); }

.notice { font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 12px 0 0; line-height: 1.5; }
.pill.ok { color: #6ee7a8; border-color: #1d5c42; background: #10291f; }
.pill.warn { color: #ffd27a; border-color: #6b4a12; background: #2c2210; }
.face-alert { position: fixed; inset: 0; z-index: 20; display: grid; place-items: start center; padding-top: 70px; pointer-events: none;
  box-shadow: inset 0 0 0 6px #e5484d; animation: faceFlash 1.2s ease-in-out infinite; }
.face-alert-box { pointer-events: auto; display: flex; gap: 14px; align-items: center; max-width: 560px; margin: 0 16px;
  background: #fff; color: #101828; border-radius: 14px; padding: 16px 18px; box-shadow: 0 16px 40px rgba(0,0,0,.45); border-left: 6px solid #d03b3b; }
.face-alert-box svg { width: 36px; height: 36px; color: #d03b3b; flex: none; }
.face-alert-box b { font-size: 16px; }
.face-alert-box p { margin: 4px 0 0; font-size: 14px; color: #475467; }
@keyframes faceFlash { 50% { box-shadow: inset 0 0 0 6px transparent; } }
