:root {
  --indigo: #6366f1;
  --indigo-dark: #4f46e5;
  --bg: #0e1016;
  --panel: #171a23;
  --panel-2: #20242f;
  --text: #e7e9ee;
  --muted: #949bad;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; }
.brand-name { font-weight: 800; letter-spacing: .3px; }
.brand-name span { color: var(--indigo); }
.btn {
  border: none; cursor: pointer; font-size: 15px; font-weight: 600;
  padding: 11px 18px; border-radius: 10px; color: #fff; transition: .15s; background: var(--panel-2);
}
.btn--primary { background: var(--indigo); }
.btn--primary:hover { background: var(--indigo-dark); }
.btn--danger { background: var(--danger); }
.btn--ghost { background: var(--panel-2); }
.btn--small { padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Beranda */
.hero { max-width: 760px; margin: 8vh auto 0; padding: 0 18px; text-align: center; }
.hero h1 { font-size: 40px; margin: 10px 0; }
.hero p { color: var(--muted); font-size: 17px; margin-bottom: 36px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 620px; margin: 0 auto; }
@media (max-width: 620px) { .actions { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid #ffffff10; border-radius: var(--radius); padding: 24px; text-align: left; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.card .muted { color: var(--muted); font-size: 13px; }
input, select {
  width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 10px; margin-bottom: 12px;
  border: 1px solid #ffffff1a; background: var(--panel-2); color: var(--text);
}
.row { display: flex; gap: 10px; }
.row .btn { white-space: nowrap; }
.hint { font-size: 13px; min-height: 18px; margin-top: 4px; }
.hint.err { color: #fca5a5; }

/* Modal */
.overlay { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 50; }
.dialog { background: var(--panel); padding: 26px; border-radius: var(--radius); width: min(400px, 92vw); border: 1px solid #ffffff14; }
.dialog h3 { margin: 0 0 16px; }
.hidden { display: none !important; }

/* Lobby */
.lobby { max-width: 860px; margin: 5vh auto; padding: 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 760px) { .lobby { grid-template-columns: 1fr; } }
.preview { background: #000; border-radius: var(--radius); aspect-ratio: 16/9; position: relative; overflow: hidden; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview .noavatar { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.lobby-form h2 { margin: 0 0 6px; }
.lobby-form .muted { color: var(--muted); margin-bottom: 18px; }
.toggle-row { display: flex; gap: 10px; margin: 12px 0; }
.toggle { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 10px; background: var(--panel-2); cursor: pointer; font-size: 14px; user-select: none; }
.toggle.off { background: #3a2030; color: #fca5a5; }

/* Ruang meeting */
.meet { position: fixed; inset: 0; display: flex; flex-direction: column; background: #0a0c11; }
.stage { flex: 1; display: grid; gap: 10px; padding: 12px; overflow: auto; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { background: var(--panel); border-radius: 12px; position: relative; aspect-ratio: 16/9; overflow: hidden; display: grid; place-items: center; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.local video { transform: scaleX(-1); }
.tile.speaking { outline: 3px solid var(--indigo); }
.tile .name { position: absolute; left: 8px; bottom: 8px; background: #000a; padding: 3px 9px; border-radius: 7px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.tile .avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--indigo); display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.tile .muted-ic { color: #fca5a5; }
.toolbar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; background: var(--panel); position: relative; }
.toolbar .meet-code { position: absolute; left: 16px; color: var(--muted); font-size: 13px; }
.tbtn { width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer; background: var(--panel-2); color: #fff; font-size: 18px; display: grid; place-items: center; }
.tbtn.off { background: #3a2030; color: #fca5a5; }
.tbtn.leave { background: var(--danger); }
.tbtn.active { background: var(--indigo); }

/* Side panel (chat/peserta) */
.side { position: fixed; right: 0; top: 0; bottom: 0; width: 320px; background: var(--panel); border-left: 1px solid #ffffff10; display: flex; flex-direction: column; z-index: 20; transform: translateX(100%); transition: .2s; }
.side.open { transform: translateX(0); }
.side header { padding: 14px 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ffffff10; }
.side .body { flex: 1; overflow: auto; padding: 12px 16px; }
.msg { margin-bottom: 12px; }
.msg .who { font-size: 12px; color: var(--indigo); font-weight: 600; }
.msg .txt { font-size: 14px; }
.side .compose { padding: 12px; border-top: 1px solid #ffffff10; display: flex; gap: 8px; }
.side .compose input { margin: 0; }
.plist .pitem { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 14px; border-bottom: 1px solid #ffffff08; }
.plist .pitem .sp { flex: 1; }
.pill { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.pill.host { background: var(--indigo); color: #fff; }
.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--panel-2); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 40; }
