/* =====================================================================
 * Hural Meet — загварын систем
 * Нүүр, dashboard: цайвар/бараан (системээс). Хурлын өрөө: үргэлж бараан.
 * ===================================================================== */
:root {
  --bg: #f6f7fb;
  --bg2: #ffffff;
  --bg3: #f1f3f8;
  --bg4: #e6e9f1;
  --line: #e3e6ee;
  --line2: #d3d8e4;
  --text: #121826;
  --text2: #3b4456;
  --muted: #6b7489;
  --accent: #2d6bff;
  --accent2: #1f56dd;
  --accent-soft: rgba(45, 107, 255, .1);
  --accent-text: #1f56dd;
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, .1);
  --ok: #1f9d63;
  --ok-soft: rgba(31, 157, 99, .12);
  --warn: #c27c0e;
  --warn-soft: rgba(245, 165, 36, .14);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 48px rgba(16, 24, 40, .18);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017; --bg2: #151922; --bg3: #1c212c; --bg4: #262c39; --line: #262c38; --line2: #333a49;
    --text: #e9ecf3; --text2: #c4cad6; --muted: #8d96a8;
    --accent-soft: rgba(45, 107, 255, .18); --accent-text: #8db1ff;
    --danger-soft: rgba(229, 72, 77, .18); --ok-soft: rgba(48, 164, 108, .18); --warn: #f5b142; --warn-soft: rgba(245, 165, 36, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
/* Хурлын өрөө үргэлж бараан */
body.room-page {
  --bg: #0d1017; --bg2: #161a23; --bg3: #1f2430; --bg4: #2a303d; --line: #2a303c; --line2: #363d4c;
  --text: #e9ecf3; --text2: #c4cad6; --muted: #949db0;
  --accent-soft: rgba(45, 107, 255, .2); --accent-text: #8db1ff;
  --danger-soft: rgba(229, 72, 77, .2); --ok: #30a46c; --ok-soft: rgba(48, 164, 108, .2); --warn: #f5b142;
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Үндсэн элементүүд ---------- */
.input, select.input, textarea.input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
body.room-page .input { background: var(--bg3); border-color: var(--line); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.bad { border-color: var(--danger); }
.input.good { border-color: var(--ok); }
textarea.input { resize: vertical; min-height: 80px; }
label.field { display: block; margin: 14px 0 6px; color: var(--text2); font-size: 13px; font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--danger); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  background: var(--accent); color: #fff; font-weight: 600; transition: background .15s, opacity .15s, transform .05s;
}
.btn:hover { background: var(--accent2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--bg2); color: var(--text); border-color: var(--line2); }
.btn.secondary:hover { background: var(--bg3); }
body.room-page .btn.secondary { background: var(--bg4); border-color: var(--line2); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #c93a3f; }
.btn.soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--text); border-color: transparent; }
.btn.ghost:hover { background: var(--bg3); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.icon { width: 20px; height: 20px; flex: none; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 26px; height: 26px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch .s-title { font-weight: 600; display: block; }
.switch .s-hint { font-size: 12.5px; color: var(--muted); display: block; font-weight: 400; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 12px; background: var(--line2); position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 20px; }

.seg { display: inline-flex; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: transparent; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--bg2); color: var(--text); box-shadow: var(--shadow); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--bg4); color: var(--text2); font-weight: 600; white-space: nowrap; }
.badge.host { background: var(--accent-soft); color: var(--accent-text); }
.badge.cohost { background: var(--ok-soft); color: var(--ok); }
.badge.admin { background: var(--warn-soft); color: var(--warn); }
.badge.live { background: var(--danger-soft); color: var(--danger); }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: blink 1.2s infinite; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.blue { background: var(--accent-soft); color: var(--accent-text); }
@keyframes blink { 50% { opacity: .3; } }

.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; }
.card h3 { font-size: 15px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.2px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo .mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3b82ff, #2457e6); display: grid; place-items: center; color: #fff; flex: none; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.notice.info { background: var(--accent-soft); color: var(--accent-text); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

/* ---------- Нүүр хуудас ---------- */
.landing { min-height: 100%; display: flex; flex-direction: column; }
.topnav { display: flex; align-items: center; justify-content: space-between; padding: 16px clamp(16px, 4vw, 48px); }
.hero { flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(24px, 5vw, 72px); align-items: center; padding: 24px clamp(16px, 4vw, 48px) 48px; max-width: 1240px; width: 100%; margin: 0 auto; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(30px, 4.4vw, 50px); letter-spacing: -1.2px; margin-bottom: 14px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #2d6bff, #7c4dff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { color: var(--muted); font-size: 17px; margin: 0 0 26px; max-width: 520px; }
.join-inline { display: flex; gap: 8px; max-width: 520px; flex-wrap: wrap; }
.join-inline .input { flex: 1 1 220px; padding: 12px 14px; font-size: 15px; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin-top: 32px; max-width: 560px; }
.feature-list div { display: flex; gap: 10px; align-items: flex-start; color: var(--text2); font-size: 13.5px; }
.feature-list .fi { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.feature-list b { display: block; color: var(--text); }
.auth-card { max-width: 420px; width: 100%; justify-self: center; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg3); border-radius: 10px; padding: 3px; margin-bottom: 8px; }
.auth-tabs button { border: 0; background: transparent; padding: 8px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.auth-tabs button.on { background: var(--bg2); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Dashboard ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { padding: 2px 8px 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text2); font-weight: 600; }
.nav a:hover { background: var(--bg3); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent-text); }
.nav .count { margin-left: auto; font-size: 11px; background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; }
.sidebar .new-btn { margin: 0 0 16px; }
.user-card { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.user-card .grow div:first-child { font-weight: 700; }
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--bg2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
}
.main { padding: clamp(16px, 3vw, 36px); max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -.5px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; margin-bottom: 26px; }
.action { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg2); text-align: left; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, border-color .12s; }
.action:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.action .ai { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.action b { font-size: 15px; display: block; }
.action span { color: var(--muted); font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.stat .k { color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; }
.toolbar-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-row .input { max-width: 280px; padding: 8px 12px; }
.mlist { display: flex; flex-direction: column; gap: 10px; }
.mitem { display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); }
.mitem:hover { border-color: var(--line2); }
.date-chip { width: 58px; flex: none; text-align: center; border-radius: 12px; background: var(--bg3); padding: 7px 0; }
.date-chip .d { font-size: 20px; font-weight: 800; line-height: 1.1; }
.date-chip .m { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.date-chip.live { background: var(--danger-soft); color: var(--danger); }
.date-chip.perm { background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; height: 54px; }
.mitem .info { flex: 1; min-width: 0; }
.mitem .t { font-weight: 700; font-size: 15px; }
.mitem .sub { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.mitem .sub span { display: inline-flex; align-items: center; gap: 5px; }
.mitem .acts { display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) { .mitem { flex-wrap: wrap; } .mitem .acts { width: 100%; } .mitem .acts .btn:first-child { flex: 1; } }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .form-grid { grid-template-columns: 1fr; } }
.form-section { margin-bottom: 16px; }
.form-section > h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.form-section > h3 .num { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-size: 13px; }
.form-section > p { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.code-box { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.code-preview { flex: 1; font-size: 22px; font-weight: 800; letter-spacing: 2px; padding: 10px 14px; background: var(--bg3); border-radius: 10px; }
.prefix-input { display: flex; align-items: stretch; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background: var(--bg2); }
.prefix-input span { padding: 10px 12px; background: var(--bg3); color: var(--muted); border-right: 1px solid var(--line2); white-space: nowrap; }
.prefix-input .input { border: 0; border-radius: 0; box-shadow: none !important; }
.prefix-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.cap-grid button { background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 0; font-weight: 700; }
.cap-grid button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.sticky-side { position: sticky; top: 20px; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 12px 0 18px; font-size: 13.5px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kv > div { background: var(--bg3); border-radius: 12px; padding: 12px 14px; }
.kv .k { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kv .v { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; margin-top: 2px; overflow-wrap: anywhere; }
.invite-box { background: var(--bg3); border-radius: 12px; padding: 14px; white-space: pre-wrap; font-size: 13.5px; border: 1px dashed var(--line2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-text { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn { background: transparent; border: 0; color: var(--muted); padding: 4px; border-radius: 6px; display: inline-grid; place-items: center; }
.copy-btn:hover { background: var(--bg4); color: var(--text); }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: var(--bg3); }
table.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); }

/* ---------- Багц ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan-card { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.popular { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card.current { border-color: var(--ok); }
.plan-card .tag { position: absolute; top: -10px; left: 16px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--accent); color: #fff; }
.plan-card.current .tag { background: var(--ok); }
.plan-card h3 { font-size: 16px; }
.plan-card .price { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.plan-card .price small { font-size: 13px; color: var(--muted); font-weight: 600; }
.plan-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text2); flex: 1; }
.plan-card li { display: flex; gap: 6px; align-items: flex-start; }
.plan-card li .icon { color: var(--ok); margin-top: 2px; }
.plan-card .cap { font-size: 30px; font-weight: 800; color: var(--accent-text); line-height: 1; }
.usage-bar { height: 8px; background: var(--bg4); border-radius: 4px; overflow: hidden; margin: 6px 0 4px; }
.usage-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.usage-bar.warn i { background: var(--danger); }
.pricing { max-width: 1240px; width: 100%; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 56px; }
.pricing h2 { font-size: 26px; letter-spacing: -.5px; margin-bottom: 4px; }
table.tbl input.input { padding: 6px 8px; font-size: 13px; min-width: 70px; }

/* ---------- Pre-join ---------- */
.prejoin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.prejoin-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; max-width: 1000px; width: 100%; align-items: center; }
@media (max-width: 760px) { .prejoin-inner { grid-template-columns: 1fr; } }
.preview { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview .avatar-big { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg3); }
.preview .controls { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; }
.preview .controls .tb { background: rgba(0,0,0,.6); backdrop-filter: blur(6px); }
.meter { height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.waiting-box { text-align: center; padding: 18px 0 6px; }
.waiting-box .spinner { margin: 0 auto 14px; }

/* ---------- Хурал ---------- */
.meeting { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); min-height: 52px; }
.topbar .title { font-weight: 700; }
.topbar .mark { width: 28px; height: 28px; border-radius: 8px; }
.rec-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--danger-soft); color: #ff8a8d; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.rec-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: blink 1.2s infinite; }
.body { display: flex; min-height: 0; min-width: 0; overflow: hidden; }
.stage { flex: 1; min-width: 0; position: relative; padding: 10px; display: flex; gap: 10px; }
.stage .main-view { flex: 1; min-width: 0; display: flex; }
.stage .strip { width: 220px; flex: none; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
@media (max-width: 760px) {
  .stage.spotlight { flex-direction: column; }
  .stage .strip { width: auto; height: 110px; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .stage .strip .tile { width: 160px; flex: none; }
}
.grid { flex: 1; display: grid; gap: 8px; align-content: center; min-height: 0; overflow-y: auto; }
.tile { position: relative; background: #0b0d10; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; border: 2px solid transparent; transition: border-color .15s; min-width: 0; }
.main-view .tile { aspect-ratio: auto; width: 100%; height: 100%; }
.tile.speaking { border-color: var(--ok); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.screen video, .main-view .tile video { object-fit: contain; }
.tile.self:not(.screen) video { transform: scaleX(-1); }
.tile .avatar { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg3); }
.avatar-circle { width: 34%; max-width: 110px; min-width: 40px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: clamp(14px, 3vw, 36px); color: #fff; }
.tile .label { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px); background: rgba(0,0,0,.6); border-radius: 7px; padding: 3px 8px; font-size: 12px; color: #fff; }
.tile .label .icon { width: 14px; height: 14px; }
.tile .hand { position: absolute; top: 8px; left: 8px; font-size: 22px; animation: wave 1s ease-in-out infinite; }
@keyframes wave { 50% { transform: rotate(15deg); } }
.tile .tile-menu { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-menu { opacity: 1; }
.icon-btn { background: rgba(0,0,0,.55); border: 0; color: #fff; border-radius: 8px; padding: 5px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(0,0,0,.8); }
.icon-btn.plain { background: transparent; color: var(--muted); }
.icon-btn.plain:hover { background: var(--bg4); color: var(--text); }
.reactions-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pager { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.65); color: #fff; border-radius: 999px; padding: 4px 6px; font-size: 13px; font-weight: 600; z-index: 5; }
.pager .icon-btn { width: 30px; height: 30px; font-size: 20px; line-height: 1; border-radius: 50%; }
.pager .icon-btn:disabled { opacity: .35; cursor: default; }
.float-emoji { position: absolute; bottom: 10px; font-size: 34px; animation: floatUp 3s ease-out forwards; }
.float-emoji small { display: block; font-size: 11px; text-align: center; background: rgba(0,0,0,.5); border-radius: 4px; padding: 0 4px; color: #fff; }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-60vh); opacity: 0; } }

.side { width: 350px; flex: none; background: var(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 760px) { .side { position: fixed; inset: 0 0 64px 0; width: auto; z-index: 30; } }
.side-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: transparent; border: 0; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--bg4); color: var(--text); }
.side-body { flex: 1; min-height: 0; overflow-y: auto; }
.plist .prow, .wait-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.plist .prow:hover { background: var(--bg3); }
.plist .prow .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; color: #fff; }
.plist .icons { display: flex; gap: 4px; color: var(--muted); align-items: center; }
.plist .icons .off { color: var(--danger); }
.wait-sec { border-bottom: 1px solid var(--line); background: var(--warn-soft); }
.wait-sec h4 { padding: 10px 12px 2px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }

.chat { display: flex; flex-direction: column; height: 100%; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { position: relative; }
.msg .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg .meta b { color: var(--text); }
.msg .meta .dm { color: #ff9fe0; }
.msg .bubble { margin-top: 3px; background: var(--bg3); border-radius: 12px; padding: 7px 11px; overflow-wrap: anywhere; white-space: pre-wrap; display: inline-block; max-width: 100%; }
.msg.mine .bubble { background: var(--accent-soft); }
.msg.private .bubble { outline: 1px dashed rgba(255,159,224,.5); }
.msg .bubble.big-emoji { font-size: 34px; background: transparent; padding: 0; }
.msg img.gif { max-width: 220px; border-radius: 10px; display: block; margin-top: 3px; }
.msg .del { position: absolute; top: 0; right: 0; opacity: 0; background: none; border: 0; color: var(--muted); font-size: 12px; }
.msg:hover .del { opacity: 1; }
.file-card { display: flex; gap: 10px; align-items: center; background: var(--bg3); border-radius: 12px; padding: 8px 10px; margin-top: 3px; color: var(--text); max-width: 280px; }
.file-card:hover { background: var(--bg4); text-decoration: none; }
.file-card .ext { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; text-transform: uppercase; }
.file-card img { max-width: 100%; border-radius: 8px; }
.sys { text-align: center; color: var(--muted); font-size: 12px; }
.composer { border-top: 1px solid var(--line); padding: 8px 10px; position: relative; }
.composer .to { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.composer .to select { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; max-width: 200px; }
.composer textarea { resize: none; height: 44px; min-height: 44px; max-height: 120px; }
.composer .tools { display: flex; gap: 2px; margin-top: 6px; align-items: center; }
.composer .tools button { background: transparent; border: 0; border-radius: 6px; padding: 6px; color: var(--muted); display: inline-grid; place-items: center; }
.composer .tools button:hover { background: var(--bg4); color: var(--text); }
.composer .tools .gif-btn { font-weight: 800; font-size: 11px; border: 1.5px solid currentColor; padding: 1px 4px; border-radius: 4px; }
.popover { position: absolute; bottom: calc(100% + 6px); left: 8px; right: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 20; display: flex; flex-direction: column; max-height: 340px; }
.emoji-cats { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-cats button { background: transparent; border: 0; border-radius: 6px; padding: 4px 6px; font-size: 18px; }
.emoji-cats button.on { background: var(--bg4); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 6px; overflow-y: auto; }
.emoji-grid button { background: transparent; border: 0; font-size: 22px; padding: 4px 0; border-radius: 6px; }
.emoji-grid button:hover { background: var(--bg4); }
.gif-grid { columns: 2; column-gap: 6px; padding: 6px; overflow-y: auto; }
.gif-grid img { width: 100%; border-radius: 6px; margin-bottom: 6px; cursor: pointer; display: block; }
.files-list .frow { display: flex; gap: 10px; padding: 8px 12px; align-items: center; border-bottom: 1px solid var(--line); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--bg2); border-top: 1px solid var(--line); overflow-x: auto; }
.toolbar .group { display: flex; gap: 4px; align-items: center; }
.tb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; border: 0; border-radius: 10px; padding: 6px 10px; min-width: 64px; color: var(--text); font-size: 11px; }
.tb:hover { background: var(--bg4); }
.tb.off { color: #ff6b6f; }
.tb.active { color: var(--accent-text); }
.tb.rec-on { color: #ff6b6f; }
.tb .icon { width: 22px; height: 22px; }
.tb .count { position: absolute; top: 2px; right: 10px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 5px; font-weight: 700; }
.tb.leave { background: var(--danger); color: #fff; min-width: 76px; }
.tb.leave:hover { background: #c93a3f; }
@media (max-width: 760px) { .tb { min-width: 52px; padding: 6px; } .tb span.lbl { display: none; } }

/* ---------- Цэс, цонх, мэдэгдэл ---------- */
.menu { position: fixed; z-index: 100; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 220px; }
.menu button { display: flex; width: 100%; gap: 9px; align-items: center; background: transparent; border: 0; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.menu button:hover { background: var(--bg3); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.modal-bg { position: fixed; inset: 0; background: rgba(8,10,15,.55); display: grid; place-items: center; z-index: 90; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; width: min(520px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.modal h3 .icon-btn { background: transparent; color: var(--muted); }
.modal h3 .icon-btn:hover { background: var(--bg3); color: var(--text); }
.modal .mbody { padding: 8px 20px 16px; overflow-y: auto; }
.modal .mfoot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); border-radius: 10px; padding: 9px 15px; box-shadow: var(--shadow-lg); animation: tIn .2s; pointer-events: auto; max-width: 90vw; font-weight: 500; }
body.room-page .toast { background: var(--bg4); color: var(--text); border: 1px solid var(--line2); }
.toast.err { background: var(--danger); color: #fff; }
@keyframes tIn { from { opacity: 0; transform: translateY(-6px); } }
.reaction-bar { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; display: flex; gap: 4px; z-index: 25; box-shadow: var(--shadow-lg); }
.reaction-bar button { background: transparent; border: 0; font-size: 26px; border-radius: 50%; width: 42px; height: 42px; }
.reaction-bar button:hover { background: var(--bg4); transform: scale(1.15); }
.center-msg { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; }
video.player { width: 100%; border-radius: 10px; background: #000; max-height: 70vh; }
