/* ═══════════════════════════════════════════════════════════════
   کلاس آنلاین — «rm-» namespace
   Layout (RTL): [chat right] [stage centre] [rail left]
   It follows the same stored light/dark preference as the dashboard.
   ═══════════════════════════════════════════════════════════════ */

.rm {
  --rm-bg: #F3F7F8;
  --rm-surface: #FFFFFF;
  --rm-surface-2: #EFF5F4;
  --rm-line: #DCE8E5;
  --rm-text: #12201D;
  --rm-muted: #5D706B;
  --rm-soft: #84938F;
  --rm-primary: #0EA678;
  --rm-primary-soft: rgba(14, 166, 120, 0.16);
  --rm-danger: #EF4444;
  --rm-warn: #F59E0B;
  --rm-radius: 12px;

  background: var(--rm-bg);
  color: var(--rm-text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-family);
}

[data-theme='dark'] .rm {
  --rm-bg: #0B1220;
  --rm-surface: #141C2B;
  --rm-surface-2: #1B2434;
  --rm-line: #26313F;
  --rm-text: #E6EDF5;
  --rm-muted: #8A9AAF;
  --rm-soft: #5D6B7E;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.rm-top {
  align-items: center;
  background: var(--rm-surface);
  border-bottom: 1px solid var(--rm-line);
  display: flex;
  flex-shrink: 0;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
}

.rm-brand { align-items: center; display: flex; gap: 0.6rem; min-width: 0; }

.rm-rec-dot {
  background: var(--rm-soft);
  border-radius: 50%;
  flex-shrink: 0;
  height: 9px;
  width: 9px;
}
.rm-rec-dot.is-live {
  background: var(--rm-danger);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: rm-pulse 2s infinite;
}
@keyframes rm-pulse {
  70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.rm-brand-text { display: flex; flex-direction: column; min-width: 0; }
.rm-brand-text strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-brand-text small { color: var(--rm-muted); font-size: 0.7rem; }

.rm-top-meta { align-items: center; display: flex; flex-shrink: 0; gap: 0.4rem; }
.rm-top-meta button { font-family: inherit; }

.rm-pill {
  align-items: center;
  background: var(--rm-surface-2);
  border: 1px solid var(--rm-line);
  border-radius: 999px;
  color: var(--rm-muted);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 600;
  gap: 0.32rem;
  padding: 0.28rem 0.6rem;
  text-decoration: none;
  white-space: nowrap;
}

/* Connection quality — colour tracks the graded level */
.rm-conn.lvl-3 { color: #34D399; }
.rm-conn.lvl-2 { color: var(--rm-warn); }
.rm-conn.lvl-1 { color: var(--rm-danger); }
.rm-conn.lvl-0 { color: var(--rm-soft); }
.rm-conn-text { align-items: baseline; display: inline-flex; gap: 0.12rem; font-variant-numeric: tabular-nums; }
.rm-conn-text b { font-size: 0.76rem; }
.rm-conn-text small { font-size: 0.62rem; opacity: 0.75; }
.rm-loss { color: var(--rm-danger); font-size: 0.62rem; }

.rm-status.is-live { background: var(--rm-primary-soft); border-color: transparent; color: #34D399; }
.rm-status.is-ended { color: var(--rm-soft); }
.rm-server.is-healthy { color: var(--rm-primary); }
.rm-server span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.rm-sound { border-color: rgba(245, 158, 11, 0.4); color: #B45309; cursor: pointer; }
.rm-icon-pill { cursor: pointer; padding-inline: 0.5rem; }

.rm-leave { transition: background 0.15s, color 0.15s; }
.rm-leave:hover { background: rgba(239, 68, 68, 0.14); border-color: transparent; color: #FCA5A5; }

/* ── Body: three columns ─────────────────────────────────────── */
.rm-body {
  display: grid;
  flex: 1;
  gap: 0.6rem;
  grid-template-columns: 310px minmax(0, 1fr) 190px;
  min-height: 0;
  padding: 0.6rem;
}

/* ── Chat / files (right in RTL) ─────────────────────────────── */
.rm-side {
  background: var(--rm-surface);
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.rm-side-tabs {
  border-bottom: 1px solid var(--rm-line);
  display: flex;
  flex-shrink: 0;
  gap: 0.2rem;
  padding: 0.35rem;
}
.rm-side-tabs button {
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--rm-muted);
  cursor: pointer;
  flex: 1;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem;
  transition: background 0.15s, color 0.15s;
}
.rm-side-tabs button:hover { background: var(--rm-surface-2); color: var(--rm-text); }
.rm-side-tabs button.is-active { background: var(--rm-primary); color: #fff; }
.rm-side-tabs button b {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 0.62rem;
  margin-right: 0.2rem;
  padding: 0 0.28rem;
}
.rm-side-poll { flex: 0 0 auto !important; padding: 0.4rem 0.55rem !important; }
.rm-side-poll.is-active { background: var(--rm-warn) !important; color: #111 !important; }

.rm-room-settings {
  border-bottom: 1px solid var(--rm-line);
  display: grid;
  flex-shrink: 0;
  gap: 0.25rem;
  grid-template-columns: 1fr 1fr;
  padding: 0 0.4rem 0.4rem;
}
.rm-room-settings button {
  align-items: center;
  background: var(--rm-surface-2);
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--rm-soft);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.6rem;
  gap: 0.2rem;
  justify-content: center;
  padding: 0.28rem;
}
.rm-room-settings button.is-enabled { background: var(--rm-primary-soft); color: var(--rm-primary); }

.rm-chat, .rm-files { display: flex; flex: 1; flex-direction: column; min-height: 0; }

.rm-chat-scope { flex-shrink: 0; padding: 0.45rem; }
.rm-chat-scope select,
.rm-poll-form select,
.rm-poll-form input {
  background: var(--rm-surface-2);
  border: 1px solid var(--rm-line);
  border-radius: 8px;
  color: var(--rm-text);
  font: inherit;
  font-size: 0.76rem;
  padding: 0.38rem 0.5rem;
  width: 100%;
}

/* Messages — mine on the RIGHT (inline-start in RTL) */
.rm-msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem;
  scrollbar-color: var(--rm-line) transparent;
  scrollbar-width: thin;
}

.rm-msg {
  background: var(--rm-surface-2);
  border-radius: 12px 12px 12px 3px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-width: 85%;
  padding: 0.42rem 0.6rem;
  /* others: inline-end == left in RTL */
  align-self: flex-end;
}
/* mine: inline-start == right in RTL, tail flipped to match */
.rm-msg.is-mine {
  align-self: flex-start;
  background: var(--rm-primary);
  border-radius: 12px 12px 3px 12px;
  color: #fff;
}
.rm-msg.is-host { border: 1px solid rgba(14, 166, 120, 0.4); }

.rm-msg-from { color: var(--rm-primary); font-size: 0.66rem; font-weight: 700; }
.rm-msg.is-host .rm-msg-from { color: #34D399; }
.rm-msg p { font-size: 0.82rem; line-height: 1.6; margin: 0; word-break: break-word; }
.rm-msg-time {
  align-items: center;
  align-self: flex-start;
  color: var(--rm-soft);
  display: flex;
  font-size: 0.6rem;
  gap: 0.2rem;
}
.rm-msg.is-mine .rm-msg-time { color: rgba(255, 255, 255, 0.72); align-self: flex-end; }

.rm-composer {
  border-top: 1px solid var(--rm-line);
  display: flex;
  flex-shrink: 0;
  gap: 0.4rem;
  padding: 0.5rem;
}
.rm-composer input {
  background: var(--rm-surface-2);
  border: 1px solid var(--rm-line);
  border-radius: 999px;
  color: var(--rm-text);
  flex: 1;
  font: inherit;
  font-size: 0.8rem;
  min-width: 0;
  outline: none;
  padding: 0.45rem 0.75rem;
  transition: border-color 0.15s;
}
.rm-composer input:focus { border-color: var(--rm-primary); }
.rm-composer input:disabled { opacity: 0.5; }
.rm-composer button {
  background: var(--rm-primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: grid;
  flex-shrink: 0;
  height: 34px;
  place-items: center;
  transition: transform 0.15s, opacity 0.15s;
  width: 34px;
}
.rm-composer button:hover:not(:disabled) { transform: scale(1.06); }
.rm-composer button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Poll ────────────────────────────────────────────────────── */
.rm-poll-form {
  background: var(--rm-surface-2);
  border-bottom: 1px solid var(--rm-line);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem;
}
.rm-poll-row { display: flex; gap: 0.3rem; }
.rm-poll-row button {
  background: none;
  border: 1px solid var(--rm-line);
  border-radius: 8px;
  color: var(--rm-muted);
  cursor: pointer;
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 28px;
}
.rm-poll-row button:hover { border-color: var(--rm-danger); color: var(--rm-danger); }
.rm-poll-form footer { display: flex; gap: 0.35rem; justify-content: space-between; }
.rm-poll-form footer button {
  align-items: center;
  background: none;
  border: 1px solid var(--rm-line);
  border-radius: 8px;
  color: var(--rm-muted);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.72rem;
  gap: 0.2rem;
  padding: 0.35rem 0.7rem;
}
.rm-poll-form footer button.is-primary { background: var(--rm-primary); border-color: transparent; color: #fff; font-weight: 700; }

.rm-poll {
  background: var(--rm-surface-2);
  border-bottom: 1px solid var(--rm-line);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.6rem;
}
.rm-poll > header { align-items: center; color: var(--rm-warn); display: flex; font-size: 0.68rem; font-weight: 700; justify-content: space-between; }
.rm-poll > header span { align-items: center; display: inline-flex; gap: 0.25rem; }
.rm-poll > header button { background: none; border: none; color: var(--rm-muted); cursor: pointer; }
.rm-poll-q { font-size: 0.84rem; line-height: 1.5; }
.rm-poll-opts { display: flex; flex-direction: column; gap: 0.3rem; }

.rm-poll-opt {
  align-items: center;
  background: var(--rm-surface);
  border: 1px solid var(--rm-line);
  border-radius: 8px;
  color: var(--rm-text);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.78rem;
  gap: 0.4rem;
  justify-content: space-between;
  overflow: hidden;
  padding: 0.42rem 0.6rem;
  position: relative;
  text-align: right;
  transition: border-color 0.15s, transform 0.12s;
}
.rm-poll-opt:hover:not(:disabled) { border-color: var(--rm-primary); transform: translateX(-2px); }
.rm-poll-opt:disabled { cursor: default; }
.rm-poll-fill {
  background: var(--rm-primary-soft);
  inset-block: 0;
  inset-inline-start: 0;
  position: absolute;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.rm-poll-opt.is-mine { border-color: var(--rm-primary); }
.rm-poll-opt.is-mine .rm-poll-fill { background: rgba(14, 166, 120, 0.34); }
.rm-poll-opt.is-leading .rm-poll-pct { color: #34D399; }
.rm-poll-label, .rm-poll-pct { position: relative; z-index: 1; }
.rm-poll-pct { color: var(--rm-muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.rm-poll > footer { color: var(--rm-soft); font-size: 0.66rem; }

/* ── Files ───────────────────────────────────────────────────── */
.rm-files { gap: 0.35rem; overflow-y: auto; padding: 0.55rem; }
.rm-upload {
  align-items: center;
  background: var(--rm-surface-2);
  border: 1px dashed var(--rm-line);
  border-radius: 8px;
  color: var(--rm-muted);
  cursor: pointer;
  display: flex;
  font-size: 0.76rem;
  font-weight: 600;
  gap: 0.35rem;
  justify-content: center;
  padding: 0.55rem;
  transition: border-color 0.15s, color 0.15s;
}
.rm-upload:hover { border-color: var(--rm-primary); color: var(--rm-primary); }
.rm-upload.is-busy { opacity: 0.5; pointer-events: none; }

.rm-file {
  align-items: center;
  background: var(--rm-surface-2);
  border-radius: 8px;
  color: var(--rm-text);
  display: flex;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  text-decoration: none;
  transition: background 0.15s;
}
.rm-file:hover { background: var(--rm-line); }
.rm-file-name { flex: 1; font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-file small { color: var(--rm-soft); font-size: 0.64rem; white-space: nowrap; }

/* ── Centre stage ────────────────────────────────────────────── */
.rm-main { display: flex; flex-direction: column; gap: 0.6rem; min-height: 0; min-width: 0; }

.rm-alert {
  align-items: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  color: #FCD34D;
  display: flex;
  flex-shrink: 0;
  font-size: 0.76rem;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
}
.rm-alert span { flex: 1; }
.rm-alert button { background: none; border: none; color: inherit; cursor: pointer; }

.rm-audio-layer { height: 0; overflow: hidden; position: absolute; width: 0; }
.rm-audio-notice {
  align-items: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: 9px;
  color: #B45309;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  font: inherit;
  font-size: 0.74rem;
  gap: 0.4rem;
  justify-content: center;
  padding: 0.45rem 0.7rem;
}
[data-theme='dark'] .rm-audio-notice, [data-theme='dark'] .rm-sound { color: #FCD34D; }

.rm-hands {
  align-items: center;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 8px;
  color: var(--rm-warn);
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  font-size: 0.72rem;
  gap: 0.3rem;
  padding: 0.35rem 0.55rem;
}
.rm-hands button {
  background: rgba(245, 158, 11, 0.18);
  border: none;
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
}
.rm-hands button:hover { background: rgba(245, 158, 11, 0.32); }
.rm-hands b { font-variant-numeric: tabular-nums; opacity: 0.7; }

.rm-stage {
  background: #000;
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-radius);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.rm-stage.is-board { background: var(--rm-surface); }

.rm-spotlight { height: 100%; position: relative; width: 100%; }
.rm-spotlight video { height: 100%; object-fit: cover; width: 100%; }
.rm-spotlight video.fit-contain { background: #000; object-fit: contain; }

/* Speaking ring around the whole stage */
.rm-spotlight.is-speaking::after {
  border: 2.5px solid var(--rm-primary);
  border-radius: var(--rm-radius);
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
  animation: rm-glow 1.4s ease-in-out infinite;
}
@keyframes rm-glow {
  0%, 100% { box-shadow: inset 0 0 22px rgba(14, 166, 120, 0.32); }
  50% { box-shadow: inset 0 0 42px rgba(14, 166, 120, 0.6); }
}

.rm-spot-avatar { align-items: center; display: flex; height: 100%; justify-content: center; }
.rm-spot-avatar span {
  align-items: center;
  background: var(--rm-surface-2);
  border: 2px solid var(--rm-line);
  border-radius: 50%;
  display: flex;
  font-size: 2rem;
  font-weight: 800;
  height: 108px;
  justify-content: center;
  width: 108px;
}

.rm-spot-bar {
  align-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  display: flex;
  inset-block-end: 0;
  inset-inline: 0;
  justify-content: space-between;
  padding: 1.4rem 0.8rem 0.55rem;
  position: absolute;
  color: #fff;
}
.rm-spot-name { align-items: center; display: flex; font-size: 0.82rem; font-weight: 700; gap: 0.35rem; }
.rm-spot-name small { background: rgba(255, 255, 255, 0.16); border-radius: 4px; font-size: 0.6rem; padding: 0.05rem 0.28rem; }
.rm-spot-name em { align-items: center; color: var(--rm-primary); display: inline-flex; font-size: 0.66rem; font-style: normal; gap: 0.2rem; }
.rm-spot-icons { color: #fff; }
.rm-spot-icons .is-off, .rm-tile-bar .is-off { color: var(--rm-danger); }

.rm-waiting {
  align-items: center;
  color: var(--rm-muted);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  text-align: center;
}
.rm-waiting strong { color: #fff; font-size: 0.9rem; }
.rm-waiting span { font-size: 0.74rem; max-width: 30ch; }

.rm-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  inset-block-start: 0.55rem;
  inset-inline-start: 0.55rem;
  position: absolute;
}
.rm-reactions span {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.66rem;
  gap: 0.22rem;
  padding: 0.18rem 0.5rem;
  animation: rm-float 0.4s ease-out;
}
@keyframes rm-float { from { opacity: 0; transform: translateY(6px); } }

/* ── Control bar ─────────────────────────────────────────────── */
.rm-controls {
  align-items: center;
  background: var(--rm-surface);
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-radius);
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  padding: 0.45rem;
}

.rm-ctl {
  align-items: center;
  background: var(--rm-surface-2);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--rm-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font: inherit;
  gap: 0.12rem;
  min-width: 62px;
  padding: 0.4rem 0.55rem;
  position: relative;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.rm-ctl span { font-size: 0.62rem; font-weight: 600; white-space: nowrap; }
.rm-ctl:hover:not(:disabled) { background: var(--rm-line); color: var(--rm-text); transform: translateY(-1px); }
.rm-ctl.is-on { background: var(--rm-primary); color: #fff; }
.rm-ctl.is-primary { background: var(--rm-primary); color: #fff; }
.rm-ctl.is-danger { background: rgba(239, 68, 68, 0.16); color: #FCA5A5; }
.rm-ctl.is-danger:hover { background: var(--rm-danger); color: #fff; }
.rm-ctl.is-rec { background: var(--rm-danger); color: #fff; animation: rm-pulse 2s infinite; }
.rm-ctl:disabled { cursor: not-allowed; opacity: 0.45; }
/* Locked = teacher has not granted this permission */
.rm-ctl.is-locked { opacity: 0.5; }
.rm-ctl-lock {
  display: grid;
  inset-block-start: 2px;
  inset-inline-end: 4px;
  position: absolute;
}

.rm-emoji { display: flex; gap: 0.15rem; }
.rm-emoji button {
  background: var(--rm-surface-2);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.3rem 0.4rem;
  transition: transform 0.12s, background 0.15s;
}
.rm-emoji button:hover { background: var(--rm-line); transform: scale(1.15); }

/* ── Participant rail (left in RTL) ──────────────────────────── */
.rm-rail {
  background: var(--rm-surface);
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rm-rail-head {
  align-items: baseline;
  border-bottom: 1px solid var(--rm-line);
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
}
.rm-rail-head strong { font-size: 0.8rem; }
.rm-rail-head small { color: var(--rm-soft); font-size: 0.66rem; }

.rm-rail-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  padding: 0.45rem;
  scrollbar-color: var(--rm-line) transparent;
  scrollbar-width: thin;
}

.rm-tile {
  aspect-ratio: 4 / 3;
  background: #000;
  border: 2px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  transition: border-color 0.18s;
  width: 100%;
}
.rm-tile video { height: 100%; object-fit: cover; width: 100%; }
.rm-tile.is-off { opacity: 0.45; }
.rm-tile.is-speaking { border-color: var(--rm-primary); }
.rm-tile.is-speaking::after {
  content: '';
  inset: 0;
  position: absolute;
  pointer-events: none;
  animation: rm-tile-glow 1.4s ease-in-out infinite;
}
@keyframes rm-tile-glow {
  0%, 100% { box-shadow: inset 0 0 10px rgba(14, 166, 120, 0.4); }
  50% { box-shadow: inset 0 0 20px rgba(14, 166, 120, 0.75); }
}

.rm-tile-avatar {
  align-items: center;
  background: var(--rm-surface-2);
  color: var(--rm-muted);
  display: flex;
  font-size: 1.05rem;
  font-weight: 800;
  height: 100%;
  justify-content: center;
}
.rm-tile-bar {
  align-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: #fff;
  display: flex;
  gap: 0.2rem;
  inset-block-end: 0;
  inset-inline: 0;
  justify-content: space-between;
  padding: 0.7rem 0.35rem 0.25rem;
  position: absolute;
}
.rm-tile-name { font-size: 0.62rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-tile-hand {
  align-items: center;
  background: var(--rm-warn);
  border-radius: 999px;
  color: #111;
  display: inline-flex;
  font-size: 0.58rem;
  font-weight: 700;
  gap: 0.15rem;
  inset-block-start: 0.25rem;
  inset-inline-start: 0.25rem;
  padding: 0.08rem 0.3rem;
  position: absolute;
}
.rm-tile-pin {
  background: var(--rm-primary);
  border-radius: 999px;
  color: #fff;
  inset-block-start: 0.25rem;
  inset-inline-end: 0.25rem;
  padding: 0.12rem 0.22rem;
  position: absolute;
}

/* ── Host management ─────────────────────────────────────────── */
.rm-manage {
  border-top: 1px solid var(--rm-line);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
  max-height: 38%;
  overflow-y: auto;
  padding: 0.45rem;
  scrollbar-color: var(--rm-line) transparent;
  scrollbar-width: thin;
}
.rm-manage > header { color: var(--rm-soft); font-size: 0.64rem; font-weight: 700; padding: 0.1rem 0.15rem 0.25rem; }
.rm-manage-row { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.22rem 0.15rem; }
.rm-manage-row.is-off { opacity: 0.5; }
.rm-manage-name {
  align-items: center;
  display: flex;
  font-size: 0.68rem;
  gap: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rm-manage-name i { background: var(--rm-soft); border-radius: 50%; flex-shrink: 0; height: 5px; width: 5px; }
.rm-manage-name i.on { background: #34D399; }
.rm-manage-acts { display: flex; gap: 0.12rem; }
.rm-manage-acts button {
  background: var(--rm-surface-2);
  border: none;
  border-radius: 5px;
  color: var(--rm-soft);
  cursor: pointer;
  display: grid;
  flex: 1;
  padding: 0.22rem 0;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.rm-manage-acts button:hover { background: var(--rm-line); color: var(--rm-text); }
.rm-manage-acts button.is-allowed { background: var(--rm-primary-soft); color: #34D399; }
.rm-manage-acts button.is-danger:hover { background: var(--rm-danger); color: #fff; }
.rm-manage-acts button.is-danger.is-active { background: rgba(239, 68, 68, 0.15); color: var(--rm-danger); }
.rm-restore {
  align-items: center;
  background: var(--rm-primary-soft);
  border: 0;
  border-radius: 7px;
  color: var(--rm-primary);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.64rem;
  gap: 0.25rem;
  padding: 0.35rem 0.45rem;
}
.rm-recent { color: var(--rm-soft); font-size: 0.6rem; padding: 0.2rem 0.15rem 0; }

.rm-empty { color: var(--rm-soft); font-size: 0.72rem; padding: 1rem 0.5rem; text-align: center; }

.rm-mobile-nav { display: none; }

.wb { min-height: 0; }
.wb-toolbar { max-height: 40%; overflow: auto; }
.wb-canvas-wrap { min-height: 0; }

/* ── Kicked gate ─────────────────────────────────────────────── */
.rm-gate {
  align-items: center;
  background: var(--color-bg-soft);
  color: var(--color-text);
  display: flex;
  font-family: var(--font-family);
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
}
.rm-gate-card {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
  padding: 2.2rem 1.8rem;
  text-align: center;
}
.rm-gate-icon {
  background: rgba(239, 68, 68, 0.14);
  border-radius: 50%;
  color: #EF4444;
  display: grid;
  height: 62px;
  place-items: center;
  width: 62px;
}
.rm-gate-card h2 { font-size: 1.05rem; margin: 0.3rem 0 0; }
.rm-gate-card p { color: var(--color-text-muted); font-size: 0.82rem; margin: 0 0 0.6rem; }
.rm-gate-icon--lock { background: rgba(14, 166, 120, 0.14); color: #0EA678; }

.rm-btn-primary {
  background: #0EA678;
  border: none;
  border-radius: 9px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem 1.4rem;
  text-decoration: none;
}
.rm-btn-primary:disabled { cursor: not-allowed; opacity: 0.45; }

.rm-btn-ghost {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  text-decoration: none;
}
.rm-btn-ghost:hover { border-color: #0EA678; color: var(--color-text); }

/* Token gate */
.rm-gate-form { max-width: 430px; width: 100%; }
.rm-gate-btn { display: block; text-align: center; width: 100%; }

.rm-token-input {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  outline: none;
  padding: 0.7rem;
  text-align: center;
  transition: border-color 0.15s;
  width: 100%;
}
.rm-token-input:focus { border-color: #0EA678; }
.rm-token-input::placeholder { color: #5D6B7E; letter-spacing: 0.2em; }

.rm-gate-error { color: #FCA5A5; font-size: 0.8rem; margin: 0; }
.rm-gate-warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 9px;
  color: #FCD34D;
  font-size: 0.76rem;
  line-height: 1.7;
  margin: 0;
  padding: 0.55rem 0.75rem;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .rm-body { grid-template-columns: 260px minmax(0, 1fr) 150px; }
}

@media (max-width: 860px) {
  .rm { height: 100dvh; min-height: 100dvh; overflow: hidden; }
  .rm-top { padding: 0.45rem 0.55rem; }
  .rm-body { display: block; min-height: 0; padding: 0.45rem; }
  .rm-main, .rm-side, .rm-rail { display: none; height: 100%; max-height: none; min-height: 0; }
  .rm-main.is-mobile-active, .rm-side.is-mobile-active, .rm-rail.is-mobile-active { display: flex; }
  .rm-stage { min-height: 0; }
  .rm-controls { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 0.35rem; scrollbar-width: none; }
  .rm-controls::-webkit-scrollbar { display: none; }
  .rm-ctl { flex: 0 0 auto; min-width: 52px; }
  .rm-ctl span { font-size: 0.56rem; }
  .rm-rail-list { display: grid; flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; }
  .rm-tile { width: 100%; }
  .rm-manage { max-height: 45%; }
  .rm-side { border-radius: 10px; }
  .rm-mobile-nav {
    align-items: stretch;
    background: var(--rm-surface);
    border-top: 1px solid var(--rm-line);
    display: grid;
    flex-shrink: 0;
    grid-template-columns: repeat(3, 1fr);
    padding: 0.25rem max(0.35rem, env(safe-area-inset-right)) calc(0.25rem + env(safe-area-inset-bottom)) max(0.35rem, env(safe-area-inset-left));
  }
  .rm-mobile-nav button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: var(--rm-muted);
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 0.62rem;
    gap: 0.28rem;
    justify-content: center;
    padding: 0.45rem;
    position: relative;
  }
  .rm-mobile-nav button.is-active { background: var(--rm-primary-soft); color: var(--rm-primary); }
  .rm-mobile-nav b { background: var(--rm-primary); border-radius: 999px; color: #fff; font-size: 0.55rem; min-width: 16px; padding: 0.05rem 0.25rem; }
  .wb-toolbar { flex-wrap: nowrap !important; max-height: 58px; overflow-x: auto; overflow-y: hidden; padding: 0.35rem !important; }
  .wb-toolbar > * { flex-shrink: 0; }
  .wb-hints { display: none !important; }
}

@media (max-width: 620px) {
  .rm-brand-text strong { font-size: 0.78rem; max-width: 42vw; }
  .rm-brand-text small { font-size: 0.6rem; }
  .rm-top-meta { gap: 0.25rem; }
  .rm-top-meta > .rm-status, .rm-top-meta > .rm-server, .rm-top-meta > span[title*='نفر'] { display: none; }
  .rm-pill { font-size: 0.65rem; padding: 0.25rem 0.42rem; }
  .rm-conn-text small { max-width: 54px; overflow: hidden; text-overflow: ellipsis; }
  .rm-leave { font-size: 0; gap: 0; }
  .rm-leave svg { height: 16px; width: 16px; }
  .rm-stage { border-radius: 9px; }
  .rm-spot-avatar span { height: 82px; width: 82px; }
  .rm-emoji { display: none; }
  .rm-rail-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .rm-conn-text { display: none; }
  .rm-controls { gap: 0.22rem; }
  .rm-ctl { min-width: 48px; padding-inline: 0.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rm-rec-dot.is-live,
  .rm-ctl.is-rec,
  .rm-spotlight.is-speaking::after,
  .rm-tile.is-speaking::after,
  .rm-reactions span { animation: none; }
  .rm-ctl, .rm-poll-opt, .rm-composer button, .rm-emoji button { transition: none; }
  .rm-ctl:hover, .rm-poll-opt:hover, .rm-emoji button:hover { transform: none; }
}
