:root {
  --accent-primary: #6c6f78;
  --accent-secondary: #9a9fa8;

  /* Тёмно-серая база — не белый и не почти-белый ни на одном уровне.
     Подмес акцентного цвета пользователя (color-mix) остаётся тем же
     механизмом персонализации, просто поверх тёмной нейтральной базы. */
  --bg-app: color-mix(in srgb, var(--accent-primary) 14%, #1b1b1e);
  --bg-panel: color-mix(in srgb, var(--accent-primary) 10%, #202023);
  --bg-sidebar: color-mix(in srgb, var(--accent-primary) 16%, #17171a);
  --bg-rail: color-mix(in srgb, var(--accent-primary) 20%, #131315);
  --bg-elevated: color-mix(in srgb, var(--accent-primary) 12%, #26262a);
  --bg-hover: color-mix(in srgb, var(--accent-primary) 18%, #2c2c31);
  --border: color-mix(in srgb, var(--accent-primary) 22%, #333338);
  --border-soft: color-mix(in srgb, var(--accent-primary) 16%, #2a2a2f);
  --text: #e6e6ea;
  --text-muted: #98989f;
  --text-faint: #6c6c73;
  --accent: #a7abb3;
  --accent-soft: #9a9fa833;
  --danger: #e08376;
  --danger-soft: color-mix(in srgb, var(--danger) 18%, #201a19);
  --radius-sm: 6px;
  --radius-md: 10px;
  --font-ui: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }

.mm-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

input, button, textarea { font-family: inherit; font-size: inherit; }

::selection { background: var(--accent-soft); }

/* user-select:none на body — это ради ощущения нативного приложения (не
   выделяется текст кнопок/навигации при случайном клике-перетаскивании), но
   без явного исключения это блокирует выделение и копирование ЛЮБОГО текста,
   включая сами сообщения. Возвращаем выделение там, где текст должны уметь
   копировать. */
.msg-content, .msg-body, textarea, input[type="text"], input[type="password"] {
  user-select: text;
  -webkit-user-select: text;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.hidden { display: none !important; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= AUTH SCREEN ================= */
#screen-auth {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-app-region: drag;
}

.auth-card {
  width: 360px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  -webkit-app-region: no-drag;
}

.auth-wordmark {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.auth-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 22px 0;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease;
}

.field input:focus { border-color: var(--text-muted); }

.field-hint { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.field-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

.btn-primary {
  width: 100%;
  padding: 10px;
  background: var(--accent-primary);
  color: #f4f4f6;
  border-radius: var(--radius-sm);
  font-weight: 600;
  margin-top: 6px;
  transition: opacity .15s ease;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .4; cursor: default; }

.btn-ghost {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  margin-top: 8px;
}
.btn-ghost:hover { background: var(--bg-hover); }

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-switch a { color: var(--accent-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.auth-banner {
  margin-top: 12px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  display: none;
}
.auth-banner.show { display: block; }

.server-url-toggle {
  text-align: center;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-faint);
  cursor: pointer;
}

/* ================= APP SHELL ================= */
#screen-app {
  height: 100vh;
  display: grid;
  grid-template-columns: 72px 232px 1fr 220px;
  grid-template-rows: 100vh;
}

.rail {
  background: var(--bg-rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 10px;
  -webkit-app-region: drag;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
  transition: border-radius .15s ease, color .15s ease;
  border: 1px solid var(--border-soft);
  -webkit-app-region: no-drag;
  overflow: hidden;
  font-size: 13px;
}
.rail-btn:hover { border-radius: 10px; color: var(--text); }
.rail-btn.active { border-radius: 10px; color: var(--accent-primary); border-color: var(--accent-primary); }
.rail-btn img { width: 100%; height: 100%; object-fit: cover; }

.rail-sep {
  width: 26px;
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.rail-spacer { flex: 1; }

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-header {
  padding: 16px 14px 10px 14px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
}
.sidebar-header .sub { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.list-section-title {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 12px 8px 6px 8px;
  font-family: var(--font-mono);
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  position: relative;
}
.list-item:hover { background: var(--bg-hover); color: var(--text); }
.list-item.active { background: var(--bg-panel); color: var(--text); box-shadow: inset 2px 0 0 var(--accent-primary); }
.list-item .name { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .presence-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.list-item .presence-dot.online { background: #6fae7a; }
.list-item .badge { font-size: 10px; background: var(--text); color: var(--bg-panel); border-radius: 8px; padding: 1px 6px; }
.unread-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-primary);
  color: #fff;
  border-radius: 9px;
  padding: 1px 6px;
  min-width: 8px;
  text-align: center;
}
.unread-badge.mention { background: var(--danger); }
.pin-btn {
  opacity: 0;
  color: var(--text-faint);
  font-size: 11px;
  padding: 2px 4px;
  margin-left: 4px;
}
.list-item:hover .pin-btn { opacity: 1; }
.pin-btn.pinned { opacity: 1; color: var(--accent-primary); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-footer .me-name { font-size: 12px; font-weight: 600; }
.sidebar-footer .me-sub { font-size: 10.5px; color: var(--text-muted); }
.icon-btn { display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-muted); }
.icon-btn:hover { background: var(--bg-hover); color: var(--accent-secondary); }
.sidebar-footer .icon-btn { margin-left: auto; width: 28px; height: 28px; }

/* ---------- avatar & signature gradient frame ---------- */
.avatar {
  --a: var(--accent, #6c6f76);
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar img, .avatar .fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
}
.avatar.sm { width: 26px; height: 26px; }
.avatar.lg { width: 76px; height: 76px; }
.avatar.lg .fallback { font-size: 26px; }

.avatar.frame-ring::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(from var(--shimmer-angle, 0deg), var(--a), var(--a2, color-mix(in srgb, var(--a) 35%, transparent)), var(--a));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: mm-rotate 8s linear infinite;
}
.avatar.frame-dashed::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px dashed var(--a);
  opacity: .75;
  animation: mm-rotate 18s linear infinite;
}
.avatar.frame-dual::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--a), color-mix(in srgb, var(--a) 30%, transparent) 45%, var(--a) 100%);
  background-size: 220% 220%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: mm-shift 6s ease-in-out infinite;
}
.avatar.frame-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--a);
  opacity: .5;
  animation: mm-pulse 2.6s ease-in-out infinite;
}

@keyframes mm-rotate { to { --shimmer-angle: 360deg; transform: rotate(360deg); } }
@keyframes mm-shift { 0%, 100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }
@keyframes mm-pulse { 0%, 100% { transform: scale(1); opacity: .45; } 50% { transform: scale(1.05); opacity: .1; } }

.presence-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
  background: var(--text-faint);
}
.presence-badge.online { background: #6fae7a; }

/* ================= CHAT AREA ================= */
.chat {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  -webkit-app-region: drag;
}
.chat-header .title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.chat-header .subtitle { color: var(--text-muted); font-size: 12px; margin-left: 6px; }

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  flex-direction: column;
  gap: 8px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.msg-row {
  display: flex;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
}
.msg-row:hover { background: var(--bg-elevated); }
.msg-row .avatar { margin-top: 2px; }
.msg-body { min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; font-size: 13.5px; }
.msg-time { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }
.msg-content { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg-content a { color: var(--accent-primary); text-decoration: underline; word-break: break-all; }
.mention {
  color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 16%, transparent);
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}
.mention.me {
  color: #fff;
  background: var(--accent-primary);
}
.msg-edit-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  padding: 6px 8px;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  resize: vertical;
}

.typing-line {
  height: 18px;
  padding: 0 18px 6px 18px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-style: italic;
}

.composer {
  padding: 12px 16px 16px 16px;
}
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: var(--bg-elevated);
}
.composer-box textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  max-height: 140px;
  color: var(--text);
  line-height: 1.4;
}
.composer-send {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #f4f4f6;
  font-size: 12px;
  font-weight: 600;
}
.composer-send:disabled { opacity: .35; }

/* ================= MEMBERS PANEL ================= */
.members-panel {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  padding: 14px 10px;
  overflow-y: auto;
}
.members-panel .list-section-title { margin-top: 0; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: var(--radius-sm); }
.member-row:hover { background: var(--bg-hover); }
.member-row .name { font-size: 12.5px; }
.member-row .role-owner { font-size: 9px; color: var(--text-faint); font-family: var(--font-mono); }

/* ================= MODALS ================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,20,22,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  width: 380px;
  max-width: 92vw;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.modal:has(.admin-modal) { width: 640px; }
.modal:has(.roles-modal) { width: 480px; }
.modal:has(.screen-picker-grid) { width: 460px; }
.modal-title { font-weight: 600; font-size: 15px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.modal-title .close { color: var(--text-faint); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 2px; }
.modal-title .close:hover { color: var(--text); }

.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.selected { border-color: var(--text); }

.frame-options { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.frame-option { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.frame-option.selected { color: var(--accent-primary); background: var(--bg-elevated); box-shadow: inset 0 0 0 1px var(--accent-secondary); }

.avatar-upload-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }

/* ================= ADMIN PANEL ================= */
.admin-modal { width: 100%; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.admin-tab { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted); border: 1px solid var(--border); }
.admin-tab.active { color: var(--accent-primary); background: var(--bg-elevated); border-color: var(--accent-primary); }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.stat-box .num { font-size: 20px; font-weight: 700; font-family: var(--font-mono); }
.stat-box .label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
#admin-content { max-height: 46vh; overflow-y: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { text-align: left; color: var(--text-faint); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--bg-panel); }
.admin-table td { padding: 7px 4px; border-bottom: 1px solid var(--border-soft); }
.admin-action { font-size: 11px; color: var(--danger); }
.admin-action:hover { text-decoration: underline; }
.admin-badge { font-size: 9px; padding: 1px 6px; border-radius: 6px; background: var(--bg-elevated); border: 1px solid var(--border); }

/* ================= SCREEN SOURCE PICKER ================= */
.screen-picker-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-height: 50vh; overflow-y: auto; }
.screen-picker-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; background: var(--bg-elevated); }
.screen-picker-item:hover { border-color: var(--accent-primary); }
.screen-picker-item img { width: 100%; height: 100px; object-fit: cover; display: block; background: #101012; }
.screen-picker-noimg { width: 100%; height: 100px; display: flex; align-items: center; justify-content: center; font-size: 30px; background: #101012; }
.screen-picker-name { font-size: 11px; padding: 6px 8px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* toast */
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--text);
  color: var(--bg-panel);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  z-index: 100;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ================= CHANNEL LIST ICONS / ROLE BADGES ================= */
.list-item .channel-icon { color: var(--text-faint); font-size: 12px; width: 14px; text-align: center; flex-shrink: 0; }
.list-item.voice-item.connected { color: var(--text); background: var(--bg-panel); }
.list-item .voice-count { font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); }

.role-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid currentColor;
  display: inline-block;
  margin-left: 4px;
}
.user-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  vertical-align: -1px;
}

/* ================= PERSISTENT VOICE CONNECTION BAR ================= */
#voice-connected-bar {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
}
#voice-connected-bar .vc-info { min-width: 0; flex: 1; }
#voice-connected-bar .vc-channel { font-size: 12px; font-weight: 600; color: #5a9e6b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
#voice-connected-bar .vc-server { font-size: 10.5px; color: var(--text-muted); }
#voice-connected-bar .vc-btn {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px;
}
#voice-connected-bar .vc-btn:hover { background: var(--bg-hover); color: var(--text); }
#voice-connected-bar .vc-btn.active-off { color: var(--danger); }
#voice-connected-bar .vc-btn.leave { color: var(--danger); }

/* ================= VOICE ROOM VIEW ================= */
#voice-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elevated);
}

.voice-tiles-grid {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  align-content: start;
}

.voice-tile {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  aspect-ratio: 16 / 10;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.voice-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #101012;
}
.voice-tile.no-video video { display: none; }
.voice-tile .tile-media-slot { position: absolute; inset: 0; }
.voice-tile .tile-media-slot video { width: 100%; height: 100%; object-fit: cover; background: #101012; }

.tile-expand-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: rgba(20,20,22,.55);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .12s ease;
}
.voice-tile:hover .tile-expand-btn { opacity: 1; }

/* Театральный (полноэкранный) режим: одна развёрнутая плитка сверху,
   остальные участники — горизонтальная полоска снизу для контекста. */
.voice-tiles-grid.theater-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.voice-tiles-grid.theater-mode .voice-tile.is-focused {
  flex: 1;
  min-height: 0;
  width: 100%;
  aspect-ratio: auto;
  cursor: zoom-out;
}
.voice-tiles-grid.theater-mode .voice-tile.is-focused .tile-expand-btn { opacity: 1; }
.tile-strip {
  display: flex;
  gap: 8px;
  height: 92px;
  flex-shrink: 0;
  overflow-x: auto;
}
.tile-strip .voice-tile {
  width: 150px;
  height: 92px;
  flex-shrink: 0;
  aspect-ratio: auto;
}

.voice-tile .tile-name {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 11.5px;
  color: #fff;
  background: rgba(20,20,22,.5);
  padding: 2px 8px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.voice-tile .tile-name .mic-off { color: var(--danger); }
.voice-tile.speaking { border-color: #6fae7a; box-shadow: 0 0 0 1px #6fae7a; }
.voice-tile .tile-screen-badge {
  position: absolute; top: 8px; left: 10px;
  font-size: 10px; background: rgba(20,20,22,.55); color:#fff;
  padding: 2px 6px; border-radius: 5px;
}

.voice-controls-bar {
  height: 68px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-panel);
}
.vc-control-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  color: var(--text);
}
.vc-control-btn:hover { background: var(--bg-hover); }
.vc-control-btn.toggled-off { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.vc-control-btn.leave-btn { background: var(--danger); color: #fff; border-color: transparent; }
.vc-control-btn.leave-btn:hover { opacity: .88; }

/* ================= DEVICE SETTINGS ================= */
.settings-select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 12.5px; color: var(--text-muted); }
.switch { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer; transition: .15s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px;
  background: #d4d4d9; border-radius: 50%; transition: .15s;
}
.switch input:checked + .slider { background: #5a9e6b; }
.switch input:checked + .slider::before { transform: translateX(15px); }

/* ================= ROLES MODAL ================= */
.roles-modal { width: 100%; }
.role-list-row { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border-soft); }
.role-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.role-list-row .rname { flex: 1; font-size: 13px; }
.role-list-row .redit { font-size: 11px; color: var(--text-muted); cursor: pointer; }
.role-list-row .redit:hover { color: var(--text); text-decoration: underline; }
.perm-checkbox-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12.5px; }
.perm-checkbox-row label { cursor: pointer; }
.roles-modal .field { margin-bottom: 16px; }
.roles-modal .field:last-of-type { margin-bottom: 10px; }

/* member context popover */
.member-row { position: relative; }
.member-row .member-kebab { margin-left: auto; color: var(--text-faint); font-size: 13px; padding: 2px 4px; }
.member-row .member-kebab:hover { color: var(--text); }
.member-popover {
  position: absolute; right: 4px; top: 100%; z-index: 20;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px; min-width: 170px; box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.member-popover .mp-item { padding: 6px 8px; border-radius: 5px; font-size: 12px; }
.member-popover .mp-item:hover { background: var(--bg-hover); }
.member-popover .mp-item.danger { color: var(--danger); }
.member-popover .mp-role-toggle { display: flex; align-items: center; gap: 6px; }
