/* Elite: tema escuro com detalhe dourado */

:root {
  --bg-0: #0d0e10;
  --bg-1: #131417;
  --bg-2: #18191d;
  --bg-3: #202227;
  --bg-4: #292c32;
  --line: #24262b;
  --line-2: #33363d;
  --text: #ecebe6;
  --text-2: #b4b1a9;
  --text-3: #7d7a73;
  --gold: #d6a84c;
  --gold-strong: #e8bd62;
  --gold-ink: #1b1508;
  --gold-soft: rgba(214, 168, 76, 0.13);
  --danger: #e0574f;
  --danger-soft: rgba(224, 87, 79, 0.12);
  --ok: #3dba84;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --header-h: 52px;
  /* Espaço: base 4. Junto = 4–8, grupo = 12–16, entre grupos = 20–24, seção = 32 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  /* Movimento: --ease para estados; --ease-out (desacelera forte) para o que chega na tela */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-2);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--gold-strong); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: rgba(214, 168, 76, 0.35); }
html { scrollbar-color: var(--line-2) transparent; }
* { scrollbar-width: thin; }
input, textarea, [contenteditable="true"] { caret-color: var(--gold); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-0); padding: 1px 5px; border-radius: 4px; }

.ic { flex: none; display: block; }
.brand-mark { width: 40px; height: 40px; fill: var(--gold); flex: none; }

/* ---------- Botões e campos ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--bg-3); color: var(--text);
  font-weight: 600; font-size: 14.5px; text-decoration: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--bg-4); }
.btn:disabled { opacity: 0.55; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-primary:hover:not(:disabled) { background: var(--gold-strong); border-color: var(--gold-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; }

.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-2);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--bg-3); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; }
.icon-btn[aria-pressed="true"] { color: var(--danger); }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field > span { font-size: 12.5px; font-weight: 650; letter-spacing: 0.02em; color: var(--text-2); }
.field small, .hint { font-size: 12.5px; color: var(--text-3); margin: 0; }
.field-row { display: flex; gap: 12px; }
.field-narrow { flex: 0 0 96px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--bg-0); border: 1px solid var(--line-2); border-radius: var(--radius);
  outline: none; transition: border-color 0.15s var(--ease);
}
.field input:hover, .field select:hover { border-color: #43464e; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
/* Preenchimento automático do navegador sem o fundo azul claro */
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); caret-color: var(--text); box-shadow: 0 0 0 100px var(--bg-0) inset; }
.field input:-webkit-autofill:focus { box-shadow: 0 0 0 100px var(--bg-0) inset, 0 0 0 3px var(--gold-soft); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.fieldset legend { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; padding: 0; }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--danger-soft); color: #f2a19b; font-size: 13.5px; }

/* ---------- Login / instalador ---------- */

.auth-page { background: var(--bg-0); }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(400px, 100%);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, var(--shadow);
}
.auth-card-wide { width: min(560px, 100%); }
.auth-card .form { gap: var(--sp-4); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-brand h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.auth-lead { color: var(--text-2); margin: 6px 0 20px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: var(--sp-4) 0 var(--sp-5); background: var(--bg-0); border-radius: var(--radius); }
.tabs button { min-height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-weight: 600; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--bg-3); color: var(--text); }

/* ---------- Estrutura do app ---------- */

.app-page { overflow: hidden; }
.app {
  --rail-w: 72px;
  position: relative;
  display: grid;
  grid-template-columns: calc(var(--rail-w) + var(--sidebar-w, 252px)) minmax(0, 1fr) var(--members-w, 244px);
  height: 100dvh;
}

/* Alças para ajustar a largura da barra de salas e da lista de membros */
.resize-handle {
  position: absolute; top: 0; bottom: 0; z-index: 5;
  width: 9px; cursor: col-resize; touch-action: none;
}
.resize-handle::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px;
  background: transparent; transition: background-color 0.15s var(--ease), width 0.15s var(--ease);
}
.resize-handle:hover::after, .resize-handle.dragging::after { background: var(--gold); width: 2px; }
.resize-handle:focus-visible { outline: none; }
.resize-handle:focus-visible::after { background: var(--gold); width: 3px; }
.resize-sidebar { left: calc(var(--rail-w) + var(--sidebar-w, 252px) - 5px); }
.resize-members { right: calc(var(--members-w, 244px) - 5px); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe, body.resizing video { pointer-events: none; }
.boot {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  background: var(--bg-0); color: var(--text-3);
}
.boot p { margin: 0; }

/* Coluna da esquerda: barra de ícones + barra lateral, com o cartão do usuário embaixo das duas */
.nav {
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0; border-right: 1px solid var(--line);
  /* atrás do cartão, cada coluna continua com a sua cor */
  background: linear-gradient(to right, var(--bg-0) var(--rail-w), var(--bg-1) var(--rail-w));
}

/* Barra de ícones: mensagens diretas e o grupo */
.rail {
  grid-column: 1; grid-row: 1; min-height: 0; overflow-y: auto; scrollbar-width: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0;
}
.rail-item { position: relative; display: flex; justify-content: center; width: 100%; }
.rail-pill {
  position: absolute; left: 0; top: 50%; width: 4px; height: 8px; margin-top: -4px;
  border-radius: 0 4px 4px 0; background: var(--text); transform: scale(0);
  transition: transform 0.15s var(--ease), height 0.15s var(--ease), margin-top 0.15s var(--ease);
}
.rail-item.unread .rail-pill { transform: none; }
.rail-item:hover .rail-pill { transform: none; height: 20px; margin-top: -10px; }
.rail-item.active .rail-pill { transform: none; height: 40px; margin-top: -20px; }
.rail-btn {
  width: 48px; height: 48px; display: grid; place-items: center; padding: 0; overflow: hidden;
  border: 0; border-radius: 50%; background: var(--bg-3); color: var(--text-2);
  transition: border-radius 0.15s var(--ease), background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.rail-btn:hover, .rail-item.active .rail-btn { border-radius: 14px; }
.rail-dm:hover, .rail-item.active .rail-dm { background: var(--gold); color: var(--gold-ink); }
.rail-group:hover, .rail-item.active .rail-group { background: var(--bg-4); }
.rail-btn img { width: 100%; height: 100%; object-fit: cover; }
.rail-btn .brand-mark { width: 28px; height: 28px; }
.rail-sep { width: 32px; height: 2px; flex: none; border-radius: 1px; background: var(--line-2); }
.rail-badge {
  position: absolute; right: 8px; bottom: -3px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 3px var(--bg-0); pointer-events: none;
}

/* Barra lateral */
.sidebar { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg-1); border-left: 1px solid var(--line); }
.group-header {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 0 12px 0 14px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; font-weight: 700; font-size: 15.5px;
  transition: background-color 0.15s var(--ease);
}
.group-header:hover, .group-header[aria-expanded="true"] { background: var(--bg-3); }
.group-header .brand-mark { width: 22px; height: 22px; }
.group-header .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-header .ic { color: var(--text-3); }

.channel-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 8px 16px; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 8px 6px; margin: 0;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3);
}
.channel {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 34px; padding: 0 8px; margin: 1px 0;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--text-3); text-decoration: none; text-align: left; font-weight: 500;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.channel .ic { color: var(--text-3); }
.channel .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel:hover { background: var(--bg-3); color: var(--text-2); }
.channel[aria-current="true"] { background: var(--bg-4); color: var(--text); }
.channel[aria-current="true"] .ic { color: var(--gold); }
.channel.unread { color: var(--text); font-weight: 650; }
.channel .lock { color: var(--text-3); opacity: 0.8; }

/* Mensagens diretas */
.channel.dm { gap: 10px; min-height: 40px; }
.channel.dm .avatar .presence { width: 11px; height: 11px; border-width: 2.5px; }
.channel.dm:hover .avatar .presence { border-color: var(--bg-3); }
.channel.dm[aria-current="true"] .avatar .presence { border-color: var(--bg-4); }
.dm-gone { font-size: 11.5px; color: var(--text-3); }
.dm-empty { margin: 0; padding: 2px 8px 8px; font-size: 12.5px; color: var(--text-3); }
.dm-title {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  margin-left: -6px; padding: 4px 8px 4px 6px;
  border: 0; border-radius: 8px; background: transparent; color: inherit;
}
.dm-title:hover { background: var(--bg-3); }
.dm-title .avatar .presence { border-color: var(--bg-2); width: 11px; height: 11px; border-width: 2.5px; }
.dm-title:hover .avatar .presence { border-color: var(--bg-3); }
.welcome > .avatar { margin-bottom: var(--sp-4); }

/* Cartão de baixo da barra lateral: chamada (quando está numa) + usuário */
.dock {
  grid-column: 1 / -1; grid-row: 2; position: relative; z-index: 1; margin: 0 8px 8px;
  background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius-lg);
  container-type: inline-size;
}

/* Painel do usuário */
.user-panel { display: flex; align-items: center; gap: 2px; padding: 6px; }
.user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding-left: 2px; }
.user-chip .names { min-width: 0; line-height: 1.25; }
.user-chip .display { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .handle { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .handle.in-voice { display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.user-chip .handle.in-voice .ic { flex: none; color: var(--ok); }
.user-chip .handle.in-voice span { overflow: hidden; text-overflow: ellipsis; }

/* Mic e fone: botão + setinha de aparelhos, numa peça só (vermelha quando desligado) */
.split { display: inline-flex; flex: none; border-radius: 6px; color: var(--text-2); }
.split > button {
  height: 32px; display: inline-grid; place-items: center; padding: 0;
  border: 0; background: transparent; color: inherit;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.split-main { width: 28px; border-radius: 6px 0 0 6px; }
.split-more { width: 14px; border-radius: 0 6px 6px 0; }
.split > button:hover { background: var(--bg-3); color: var(--text); }
.split.toggled { background: var(--danger-soft); color: var(--danger); }
.split.toggled > button:hover { background: rgba(224, 87, 79, 0.2); color: #f2a19b; }
.user-gear { width: 28px; }
.device-menu { max-width: 320px; }

/* Barra estreita: a setinha some para o nome caber */
@container (max-width: 215px) {
  .split-more { display: none; }
  .split-main { border-radius: 6px; }
}

/* Avatar */
.avatar {
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 13px; line-height: 1; user-select: none;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .presence {
  position: absolute; right: -2px; bottom: -2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #5b5953; border: 3px solid var(--bg-1);
}
.user-panel .avatar .presence { border-color: var(--bg-0); }
.avatar .presence.on { background: var(--ok); }

/* Área central */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-2); }
.chat-header {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 16px; border-bottom: 1px solid var(--line);
}
.chat-header .ic { color: var(--text-3); }
.chat-header h1 { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; }
.chat-header .topic {
  flex: 1; min-width: 0; margin-left: 4px; padding-left: 12px;
  border-left: 1px solid var(--line-2);
  color: var(--text-3); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-header .spacer { flex: 1; }
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.messages .fill { flex: 1; }
.welcome { padding: 32px 20px 24px; }
.welcome-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: var(--sp-4);
  background: var(--bg-4); color: var(--gold);
}
.welcome h2 { margin: 0 0 6px; font-size: 26px; font-weight: 750; letter-spacing: -0.01em; }
.welcome p { margin: 0; color: var(--text-2); max-width: 60ch; }

.empty-main { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px; color: var(--text-3); text-align: center; }
.empty-main h2 { margin: 0; color: var(--text); font-size: 18px; }

/* Lista de membros */
.members { min-height: 0; overflow-y: auto; padding: 0 var(--sp-2) var(--sp-4); background: var(--bg-1); border-left: 1px solid var(--line); }
.members-head {
  position: sticky; top: 0; z-index: 1;
  height: var(--header-h); display: flex; align-items: center;
  margin: 0 calc(-1 * var(--sp-2)) var(--sp-1); padding: 0 var(--sp-4);
  background: var(--bg-1); border-bottom: 1px solid var(--line);
}
.members-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.members-head + .section-title { padding-top: var(--sp-3); }
.member {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 42px; padding: 4px 8px;
  border: 0; border-radius: 6px; background: transparent; text-align: left;
  transition: background-color 0.12s var(--ease);
}
.member:hover { background: var(--bg-3); }
.member .names { min-width: 0; line-height: 1.2; }
.member .display { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .owner-badge { color: var(--gold); margin-left: 4px; vertical-align: -2px; display: inline-block; }
.member.offline { opacity: 0.42; }
.member.offline:hover { opacity: 0.75; }

/* ---------- Menus e modais ---------- */

.menu {
  position: fixed; z-index: 60; min-width: 220px; padding: 6px;
  background: var(--bg-0); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 36px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-2);
  text-align: left; font-size: 14px; font-weight: 550;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--gold-soft); color: var(--gold-strong); outline: none; }
.menu-item.danger { color: #f2a19b; }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger-soft); color: #f7b8b3; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line-2); }
.menu-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item[aria-expanded="true"] { background: var(--gold-soft); color: var(--gold-strong); }
.menu-item:disabled { opacity: 0.45; }
.ctx-menu { min-width: 200px; max-width: 280px; max-height: calc(100dvh - 16px); overflow-y: auto; }
/* Caixa de marcar dos itens de cargo */
.menu-check {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--line-2); color: transparent;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease);
}
.menu-item[aria-checked="true"] .menu-check { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.menu-check .ic { stroke-width: 3; }

.modal {
  width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: var(--bg-2); color: var(--text); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.62); }
.modal-inner { display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4) var(--sp-2) var(--sp-5); }
.modal-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; }
.modal-body { padding: 8px 20px 4px; display: flex; flex-direction: column; gap: 16px; }
.modal-body > p { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.modal[open] { animation: modal-in var(--t-base) var(--ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.modal[open]::backdrop { animation: fade-in var(--t-base) linear; }
@keyframes fade-in { from { opacity: 0; } }

.invite-box { display: flex; flex-direction: column; gap: 10px; }
.invite-code {
  padding: 16px; border-radius: var(--radius); border: 1px dashed var(--line-2);
  background: var(--bg-0); color: var(--gold-strong);
  font: 700 26px/1 var(--mono); letter-spacing: 0.14em; text-align: center; user-select: all;
}
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--bg-0); color: var(--text-2); font-size: 13.5px; }

.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: var(--radius); background: var(--bg-4); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; animation: toast-in 240ms var(--ease-out); }
.toast.leaving { animation: toast-out var(--t-fast) ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
.toast.error { background: #3a1d1b; border-color: #5c2a27; color: #f7c0bb; }

.only-mobile { display: none; }
.scrim { display: none; }

/* ---------- Chat ---------- */

.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--gold-strong); font: inherit; }
.link-btn:hover { text-decoration: underline; }
.auth-foot { margin: var(--sp-5) 0 0; font-size: 13.5px; color: var(--text-3); text-align: center; }
.auth-action { margin-top: var(--sp-5); }
.auth-lead strong { color: var(--text); }

.banner {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding: 8px 10px 8px 16px; border-radius: var(--radius);
  background: var(--bg-4); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px;
}
.banner.warn { background: #3a2e14; border-color: #5a4720; color: #f3dca6; padding-right: 16px; }

.channel { position: relative; }
.channel .unread-dot { position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--text); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1;
}

.messages-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; padding-bottom: 12px; overscroll-behavior: contain; }
.messages-top { flex: none; }
.loading-text { margin: 0; padding: 20px; color: var(--text-3); font-size: 14px; text-align: center; }
.msg-list, .msg-pending { flex: none; }

.day-sep { display: flex; align-items: center; gap: 10px; margin: var(--sp-6) var(--sp-4) var(--sp-2); color: var(--text-3); font-size: 12px; font-weight: 650; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.new-sep { display: flex; align-items: center; margin: 10px 16px 2px 16px; color: var(--danger); font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; }
.new-sep::before { content: ""; flex: 1; height: 1px; background: var(--danger); opacity: 0.7; margin-right: 8px; }

.msg {
  position: relative;
  display: grid; grid-template-columns: 56px minmax(0, 1fr);
  padding: 2px 16px 2px 0; margin-top: var(--sp-4);
  transition: background-color 0.1s var(--ease);
}
.msg.grouped { margin-top: 0; }
.msg:hover, .msg:focus-within, .msg.editing { background: rgba(255, 255, 255, 0.025); }
.msg.mentioned { background: rgba(214, 168, 76, 0.07); box-shadow: inset 2px 0 0 var(--gold); }
.msg.mentioned:hover { background: rgba(214, 168, 76, 0.1); }
.msg.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 30% { background: rgba(214, 168, 76, 0.22); } }
.msg.pending { opacity: 0.55; }

.msg-gutter { display: flex; justify-content: center; padding-top: 2px; }
.msg-hover-time { visibility: hidden; font-size: 11px; color: var(--text-3); line-height: 22px; }
.msg:hover .msg-hover-time, .msg:focus-within .msg-hover-time { visibility: visible; }
.msg-body { min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.msg-author { padding: 0; border: 0; background: none; font: inherit; font-weight: 650; color: var(--text); cursor: pointer; }
.msg-author:hover { text-decoration: underline; }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; height: fit-content; }
.avatar-btn:active { transform: translateY(1px); }
.msg-time { font-size: 12px; color: var(--text-3); }
.msg-content { max-width: 100ch; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; color: #dcdad4; }
.msg-content.jumbo { font-size: 2.6em; line-height: 1.2; }
.msg-content .edited { font-size: 11px; color: var(--text-3); }
.msg-content a { color: #8fb8ff; text-decoration: none; }
.msg-content a:hover { text-decoration: underline; }

.md-code { font-family: var(--mono); font-size: 0.88em; padding: 1px 5px; border-radius: 4px; background: var(--bg-0); border: 1px solid var(--line); }
.md-pre { margin: 6px 0; padding: 10px 12px; max-width: 100%; overflow-x: auto; border-radius: var(--radius); background: var(--bg-0); border: 1px solid var(--line); white-space: pre; }
.md-pre code { font-family: var(--mono); font-size: 13px; line-height: 1.5; background: none; padding: 0; }
.mention { padding: 0 3px; border-radius: 4px; background: rgba(143, 184, 255, 0.14); color: #b7cfff; font-weight: 550; }
.mention.me { background: var(--gold-soft); color: var(--gold-strong); }
.spoiler { border-radius: 4px; background: #3a3c42; color: transparent; cursor: pointer; transition: background-color 0.15s var(--ease); }
.spoiler * { color: transparent !important; background: transparent !important; }
.spoiler:hover { background: #45474e; }
.spoiler.revealed { background: rgba(255, 255, 255, 0.07); color: inherit; cursor: auto; }
.spoiler.revealed * { color: inherit !important; }

.msg-reply {
  grid-column: 2; display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  margin: 0 0 2px; padding: 0; border: 0; background: none; color: var(--text-3); font-size: 13px; text-align: left;
  position: relative;
}
.msg-reply::before {
  content: ""; position: absolute; left: -34px; top: 9px; width: 28px; height: 12px;
  border-left: 2px solid var(--line-2); border-top: 2px solid var(--line-2); border-top-left-radius: 6px;
}
.msg-reply .avatar { font-size: 9px !important; }
.msg-reply-author { font-weight: 650; flex: none; }
.msg-reply-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
button.msg-reply:hover .msg-reply-text { color: var(--text); }
.muted { color: var(--text-3); font-style: italic; }

.msg-attachments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 6px; }
.att-image { padding: 0; border: 0; border-radius: var(--radius); background: var(--bg-3); overflow: hidden; cursor: zoom-in; max-width: 100%; }
.att-image img { display: block; max-width: 100%; height: auto; object-fit: cover; }
.att-file {
  display: flex; align-items: center; gap: 10px; width: min(420px, 100%);
  padding: 10px 8px 10px 12px; border-radius: var(--radius); background: var(--bg-1); border: 1px solid var(--line);
}
.att-file-icon { color: var(--gold); flex: none; }
.att-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-file-name { color: #8fb8ff; text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 550; }
.att-file-name:hover { text-decoration: underline; }
.att-file-size { font-size: 12px; color: var(--text-3); }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px;
  border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-1); color: var(--text-2);
  font-size: 13px; font-weight: 650; transition: border-color 0.12s var(--ease), background-color 0.12s var(--ease);
}
.reaction:hover { border-color: #4a4d55; background: var(--bg-3); }
.reaction.me { border-color: rgba(214, 168, 76, 0.55); background: var(--gold-soft); color: var(--gold-strong); }
.reaction-emoji { font-size: 15px; line-height: 1; }
.reaction-add { opacity: 0; color: var(--text-3); padding: 0 6px; }
.msg:hover .reaction-add, .reaction-add:focus-visible { opacity: 1; }

.msg-toolbar {
  position: absolute; top: -16px; right: 16px; z-index: 2;
  display: none; gap: 2px; padding: 2px;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.msg:hover .msg-toolbar, .msg:focus-within .msg-toolbar, .msg.touch-active .msg-toolbar { display: flex; }
.msg.touch-active { background: rgba(255, 255, 255, 0.04); }
.msg.editing .msg-toolbar, .msg.pending .msg-toolbar { display: none; }
.icon-btn.danger:hover { color: var(--danger); }

.edit-box { margin-top: 2px; }
.edit-input, .composer-input {
  display: block; width: 100%; resize: none; border: 0; outline: none;
  background: transparent; color: var(--text); font: inherit; line-height: 1.45;
}
.edit-input { padding: 10px 12px; border-radius: var(--radius); background: var(--bg-0); border: 1px solid var(--line-2); }
.edit-input:focus { border-color: var(--gold); }
.edit-hint { margin-top: 4px; font-size: 12px; color: var(--text-3); }

.jump-btn {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 0; border-radius: 16px; background: var(--gold); color: var(--gold-ink); font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow);
}

.typing { flex: none; height: 22px; display: flex; align-items: center; gap: 6px; padding: 0 16px; font-size: 12.5px; color: var(--text-2); overflow: hidden; white-space: nowrap; }
.typing strong { color: var(--text); font-weight: 650; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: typing 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }

.composer-host { flex: none; padding: 0 16px 16px; position: relative; }
.composer { position: relative; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line-2); }
.composer:focus-within { border-color: #4a4d55; }
.composer-row { display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.composer-row .icon-btn { width: 36px; height: 36px; }
.composer-input { flex: 1; min-height: 36px; max-height: 40vh; padding: 7px 4px; overflow-y: auto; }
.composer-input::placeholder { color: var(--text-3); }
.send-btn:not(:disabled) { color: var(--gold); }
.send-btn:disabled { opacity: 0.35; }
.composer-blocked { padding: 12px 14px; border-radius: 10px; background: var(--bg-1); border: 1px dashed var(--line-2); color: var(--text-3); font-size: 14px; text-align: center; }

.reply-bar { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--text-2); }
.reply-bar-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-bar-text strong { color: var(--text); }
.reply-bar-snippet { color: var(--text-3); }

.attach-tray { display: flex; gap: 8px; padding: 10px; overflow-x: auto; border-bottom: 1px solid var(--line-2); }
.attach-item {
  position: relative; flex: none; width: 132px; display: flex; flex-direction: column; gap: 4px;
  padding: 6px; border-radius: var(--radius); background: var(--bg-1); border: 1px solid var(--line);
}
.attach-item img, .attach-icon { width: 100%; height: 84px; border-radius: 6px; object-fit: cover; background: var(--bg-0); display: grid; place-items: center; color: var(--gold); }
.attach-name { font-size: 12.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attach-size { font-size: 11.5px; color: var(--text-3); }
.attach-remove {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-4); color: var(--text-2);
}
.attach-remove:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.pending-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--bg-3); font-size: 12.5px; }
.upload-progress { width: min(320px, 100%); height: 4px; margin-top: 6px; border-radius: 2px; background: var(--bg-4); overflow: hidden; }
.upload-bar { width: 0; height: 100%; background: var(--gold); transition: width 0.2s linear; }

.mention-pop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20;
  padding: 6px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.mention-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: none; text-align: left; }
.mention-item.active, .mention-item:hover { background: var(--bg-3); }
.mention-name { font-weight: 600; }
.mention-login { color: var(--text-3); font-size: 13px; }

.drop-hint { position: absolute; inset: 8px; z-index: 30; display: grid; place-items: center; border-radius: var(--radius-lg); border: 2px dashed var(--gold); background: rgba(13, 14, 16, 0.85); color: var(--gold-strong); pointer-events: none; text-align: center; }
.drop-hint p { margin: 8px 0 0; font-weight: 650; }
.main { position: relative; }

.popover { position: fixed; z-index: 70; padding: 8px; border-radius: 10px; background: var(--bg-0); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; }
.emoji-btn { width: 36px; height: 36px; border: 0; border-radius: 6px; background: none; font-size: 21px; line-height: 1; }
.emoji-btn:hover, .emoji-btn:focus-visible { background: var(--bg-3); outline: none; }

.quote { margin: 0; padding: 8px 12px; border: 1px solid var(--line); background: var(--bg-1); border-radius: 6px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: hidden; }

.viewer { max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; padding: 0; border: 0; background: transparent; display: none; }
.viewer[open] { display: grid; grid-template-rows: 1fr auto; place-items: center; }
.viewer::backdrop { background: rgba(0, 0, 0, 0.85); }
.viewer img { max-width: 92vw; max-height: calc(100dvh - 90px); object-fit: contain; border-radius: 6px; cursor: zoom-out; }
.viewer-bar { display: flex; align-items: center; gap: 6px; padding: var(--sp-3) var(--sp-4) var(--sp-5); color: var(--text-2); }
.viewer-name { margin-right: 8px; font-size: 14px; max-width: 40vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Gerenciar: salas, cargos, membros ---------- */

.icon-btn.xs { width: 22px; height: 22px; border-radius: 5px; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-spacer { width: 28px; flex: none; }
.danger-text { color: #f2a19b; }
.btn-ghost.danger-text:hover:not(:disabled) { background: var(--danger-soft); color: #f7b8b3; }
.section-title .icon-btn { color: var(--text-3); margin-right: -4px; }
.section-title .icon-btn:hover { color: var(--text); }

.channel-row { position: relative; }
.channel-row .channel { padding-right: 30px; }
.channel-gear { position: absolute; right: 4px; top: 6px; opacity: 0; }
.channel-row:hover .channel-gear, .channel-row.current .channel-gear, .channel-gear:focus-visible, .channel-gear[aria-expanded="true"] { opacity: 1; }
.voice-person { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }

.member { color: inherit; }

/* Perfil */
.popover.profile-pop { width: 328px; padding: 0; max-height: calc(100dvh - 16px); overflow-y: auto; }
.profile-cta { display: flex; gap: 8px; }
.profile-cta .btn { flex: 1; }
.profile-bio { margin: 0; font-size: 14px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }

/* Nível e insígnias */
.profile-level { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--bg-1); border: 1px solid var(--line); }
.level-head { display: flex; align-items: center; gap: 12px; }
.level-text { min-width: 0; line-height: 1.25; }
.level-name { font-weight: 700; font-size: 15px; }
.level-num { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.level-progress { display: flex; flex-direction: column; gap: 6px; }
.level-bar { height: 6px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.level-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--gold); transition: width 0.4s var(--ease); }
.level-hint { font-size: 12.5px; color: var(--text-3); }
.level-badges { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; justify-items: center; padding-top: 2px; }

.lvl-badge {
  --tier: #c78a54;
  --tier-bg: rgba(199, 138, 84, 0.14);
  flex: none; display: inline-grid; place-items: center;
  border-radius: 30%;
  background: var(--tier-bg);
  box-shadow: inset 0 0 0 1.5px var(--tier);
  color: var(--tier);
}
.lvl-badge svg { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lvl-badge.tier-silver { --tier: #b9c3cf; --tier-bg: rgba(185, 195, 207, 0.13); }
.lvl-badge.tier-gold { --tier: #e2b552; --tier-bg: rgba(226, 181, 82, 0.15); }
/* Elite (16–20): o neon do ícone do grupo, borda magenta e ciano deslocadas */
.lvl-badge.tier-elite {
  --tier: #ff5fa8; --tier-bg: rgba(255, 46, 136, 0.13);
  color: #fff1f8;
  box-shadow: inset 0 0 0 1.5px #ff2e88, -1.5px 0.5px 0 0 rgba(255, 46, 136, 0.55), 1.5px -0.5px 0 0 rgba(46, 230, 255, 0.55);
}
.lvl-badge.locked { --tier: var(--text-3); --tier-bg: transparent; color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line-2); opacity: 0.45; }
.lvl-badge.tier-elite.locked { box-shadow: inset 0 0 0 1px var(--line-2); }
.profile { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4); }
.modal-profile .profile { padding: 4px 0 8px; }
.profile-head { display: flex; align-items: center; gap: var(--sp-3); }
.profile-names { min-width: 0; }
.profile-name { font-size: 18px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.profile-login { color: var(--text-3); font-size: 13.5px; }
.profile-owner { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--gold); font-size: 12.5px; font-weight: 650; }
.profile-meta { margin: 0; font-size: 13px; color: var(--text-3); }
.profile-section h3 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.profile-actions { display: flex; justify-content: flex-start; border-top: 1px solid var(--line); padding-top: 10px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px;
  border-radius: 6px; background: var(--bg-3); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.role-chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--text-3); }
.role-chip-x:hover { background: var(--danger-soft); color: #f7b8b3; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.role-add { height: 26px; padding: 0 8px; border-radius: 6px; border: 1px dashed var(--line-2); background: transparent; color: var(--text-2); font-size: 12.5px; }
.role-add:hover { border-color: var(--gold); color: var(--gold-strong); }

/* Formulários de gerenciamento */
.check-row { display: flex; align-items: center; gap: 10px; min-height: 32px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--gold); flex: none; margin: 0; }
.switch-row { align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-1); border: 1px solid var(--line); }
.switch-row input { margin-top: 2px; }
.switch-row span, .perm-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row small, .perm-row small { color: var(--text-3); font-size: 12.5px; }
.check-list { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: var(--radius); background: var(--bg-1); border: 1px solid var(--line); max-height: 200px; overflow-y: auto; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .ic { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.field .input-icon input { padding-left: 36px; }
.note { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--bg-1); color: var(--text-2); font-size: 13px; }

/* Janela de configurações */
.modal.modal-settings { width: min(920px, calc(100% - 32px)); height: min(680px, calc(100dvh - 32px)); }
.modal-settings .modal-inner { height: 100%; }
.modal-settings .modal-body { flex: 1; min-height: 0; padding: 0; }
.modal-settings .modal-head { border-bottom: 1px solid var(--line); padding-bottom: var(--sp-4); }
.settings { display: grid; grid-template-columns: 190px minmax(0, 1fr); height: 100%; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: 1px solid var(--line); }
.settings-nav button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text-2); text-align: left; font-weight: 600; }
.settings-nav button:hover { background: var(--bg-3); color: var(--text); }
.settings-nav button[aria-selected="true"] { background: var(--bg-4); color: var(--text); }
.settings-panel { min-height: 0; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.panel-title { margin: 0; font-size: 16px; font-weight: 700; }
.panel-title.sub { margin-top: var(--sp-3); padding-top: var(--sp-6); border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.settings-panel .form { gap: var(--sp-5); }
.settings-panel .form > :is(.field, .field-row, .form-error) + div:has(> .btn) { margin-top: calc(var(--sp-2) - var(--sp-5)); }

.roles-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; min-height: 0; }
.roles-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.roles-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-list { display: flex; flex-direction: column; gap: 2px; }
.role-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.role-row.active { background: var(--bg-4); }
.role-row:not(.active):hover { background: var(--bg-3); }
.role-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; border: 0; background: none; text-align: left; font-weight: 600; }
.role-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.role-count { display: inline-flex; align-items: center; gap: 3px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.role-editor { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.role-editor-head { display: flex; flex-direction: column; gap: 6px; }
/* Níveis: nome de cada patente */
.level-table { display: flex; flex-direction: column; gap: 2px; }
.level-row { display: grid; grid-template-columns: 30px 64px minmax(0, 1fr) 92px 28px; align-items: center; gap: 12px; min-height: 46px; padding: 4px 8px; border-radius: var(--radius); }
.level-row:hover { background: var(--bg-1); }
.level-row-num { font-size: 12.5px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.level-row-input input {
  width: 100%; min-height: 36px; padding: 0 10px; font: inherit; color: var(--text);
  background: var(--bg-0); border: 1px solid var(--line-2); border-radius: var(--radius); outline: none;
  transition: border-color 0.15s var(--ease);
}
.level-row-input input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.level-row-input input::placeholder { color: var(--text-3); }
.level-row-xp { font-size: 12.5px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.level-row-undo { display: grid; place-items: center; }
.role-editor-foot { position: sticky; bottom: -24px; display: flex; align-items: center; gap: 8px; padding: 12px 0; background: var(--bg-2); border-top: 1px solid var(--line); }
.role-editor-foot .spacer { flex: 1; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid transparent; outline-offset: 2px; }
.swatch.active { border-color: var(--text); }
.swatch.none { background: linear-gradient(135deg, transparent 45%, var(--danger) 45%, var(--danger) 55%, transparent 55%), var(--bg-3); border-color: var(--line-2); }
.swatch.none.active { border-color: var(--text); }
.swatches input[type="color"] { width: 36px; height: 30px; padding: 0 2px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg-0); cursor: pointer; }
.perm-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.perm-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm-row:last-child { border-bottom: 0; }
.perm-row:hover { background: var(--bg-1); }
.perm-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--gold); flex: none; }
.perm-row.danger strong { color: #f2a19b; }
.perm-row:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }

.member-table, .invite-table { display: flex; flex-direction: column; gap: 2px; }
.member-line, .invite-line { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: var(--radius); background: none; text-align: left; }
button.member-line:hover { background: var(--bg-3); }
.member-line-names, .invite-meta { display: flex; flex-direction: column; min-width: 0; flex: 0 0 200px; line-height: 1.25; }
.invite-meta { flex: 1; }
.member-line-names small, .invite-meta small { color: var(--text-3); font-size: 12.5px; }
.member-line-roles { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.member-line.static .member-line-names { flex: 1; }
.invite-code-sm { font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; color: var(--gold-strong); background: var(--bg-0); padding: 4px 8px; border-radius: 6px; }

@media (max-width: 760px) {
  .settings { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .settings-nav button { flex: none; }
  .settings-panel { padding: var(--sp-4); }
  .roles-layout { grid-template-columns: minmax(0, 1fr); }
  .member-line-names { flex: 1; }
  .member-line-roles { display: none; }
  .level-row { grid-template-columns: 30px minmax(0, 1fr) 28px; }
  .level-row-num, .level-row-xp { display: none; }
  .modal.modal-settings { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

@media (hover: none) {
  .channel-gear { opacity: 1; }
}

/* ---------- Voz ---------- */

.voice-people { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 var(--sp-2) 28px; }
.voice-person {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 30px; padding: 2px 6px; border: 0; border-radius: 6px; background: none;
  color: var(--text-2); font-size: 13.5px; text-align: left;
}
button.voice-person:hover { background: var(--bg-3); color: var(--text); }
.voice-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.voice-flag { display: inline-grid; color: var(--danger); opacity: 0.85; }
.peer-state { display: inline-grid; color: var(--text-3); }
.peer-state.connecting { animation: pulse 1.2s ease-in-out infinite; }
.peer-state.failed { color: var(--danger); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Anel de quem está falando */
.voice-avatar { display: inline-grid; border-radius: 50%; box-shadow: 0 0 0 2px transparent; transition: box-shadow 0.12s var(--ease); }
.voice-avatar.speaking { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--ok); }
.user-panel .voice-avatar.speaking { box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--ok); }
.channel-row.voice-connected > .channel { color: var(--text); }
.channel-row.voice-connected > .channel .ic { color: var(--ok); }

.voice-panel { display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); }
.voice-panel-top { display: flex; align-items: center; gap: 2px; }
.voice-panel-info {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 4px; border: 0; border-radius: 6px; background: none; color: var(--text-3); text-align: left;
}
.voice-panel-info:hover { background: var(--bg-3); }
.voice-panel-info > .ic { flex: none; }
.voice-panel-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.voice-status { font-size: 14px; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.voice-where { font-size: 12.5px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.voice-panel-info.ok > .ic, .voice-panel-info.ok .voice-status { color: var(--ok); }
.voice-panel-info.wait > .ic, .voice-panel-info.wait .voice-status { color: var(--gold-strong); }
.voice-panel-info.bad > .ic, .voice-panel-info.bad .voice-status { color: var(--danger); }
.icon-btn.noise-btn[aria-pressed="true"] { color: var(--text-2); }
.icon-btn.noise-btn[aria-pressed="true"]:hover { color: var(--text); }
.icon-btn.hangup:hover { background: var(--danger-soft); color: var(--danger); }

/* Câmera, tela e gravador */
.voice-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.va-btn {
  height: 34px; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: var(--radius); background: var(--bg-3); color: var(--text);
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.va-btn:hover:not(:disabled) { background: var(--bg-4); }
.va-btn:disabled { opacity: 0.4; }
.va-btn .ic { flex: none; }
.va-btn.on { background: var(--text); color: var(--bg-0); }
.va-btn.on:hover:not(:disabled) { background: #fff; }
.va-btn.sharing { background: var(--ok); color: #06150e; }
.va-btn.sharing:hover:not(:disabled) { background: #48c891; }
.va-btn.recording { background: var(--danger); color: #fff; }
.va-btn.recording:hover:not(:disabled) { background: #c9453e; }
.rec-time { overflow: hidden; white-space: nowrap; }

/* Selo de quem está gravando (barra lateral e quadros da chamada) */
.rec-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 17px; padding: 0 5px; border-radius: 4px;
  background: var(--danger-soft); color: #f2a19b; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; flex: none;
}
.rec-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); animation: pulse 1.6s ease-in-out infinite; }
.tile-label .rec-badge { background: var(--danger); color: #fff; }
.tile-label .rec-badge::before { background: #fff; }

.popover.vol-popover { width: 240px; }
.vol-pop { display: flex; flex-direction: column; gap: 10px; }
.vol-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.vol-value { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }
.vol-pop input[type="range"] { width: 100%; accent-color: var(--gold); }

/* ---------- Chamada: vídeos e tela ---------- */

.main { display: flex; flex-direction: column; }
.view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.voice-cam { display: inline-grid; color: var(--text-3); }
.live-badge {
  display: inline-flex; align-items: center; height: 17px; padding: 0 5px; border-radius: 4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; flex: none;
}

.view-call { background: var(--bg-0); }
.view-call .chat-header { background: var(--bg-2); }
.stage { flex: 1; min-height: 0; padding: 12px; }
.stage.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
}
.stage.focus { display: flex; flex-direction: column; gap: 10px; }
.stage-main { flex: 1; min-height: 0; display: flex; }
.stage-main .tile { flex: 1; }
.stage-strip { flex: none; display: flex; gap: 8px; height: 112px; overflow-x: auto; }
.stage-strip .tile { flex: 0 0 auto; width: 184px; height: 100%; }

.tile {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  border-radius: var(--radius-lg); background: var(--bg-2); border: 1px solid var(--line);
  cursor: pointer; outline-offset: 2px;
  transition: box-shadow 0.12s var(--ease), border-color 0.12s var(--ease);
}
.tile:hover { border-color: var(--line-2); }
.tile.speaking { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok) inset; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile-screen video, .stage-main .tile video { object-fit: contain; }
.tile video.mirror { transform: scaleX(-1); }
.tile-center { position: absolute; inset: 0; display: grid; place-items: center; }
.tile-wait { color: var(--text-3); font-size: 13px; }
.tile-label {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 13px; font-weight: 600;
}
.tile-label .ic { color: #f2a19b; }
.tile-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile.small .tile-label { left: 4px; bottom: 4px; font-size: 11.5px; padding: 2px 6px; }
.tile-btn {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: rgba(0, 0, 0, 0.62); color: #fff; opacity: 0;
  transition: opacity 0.12s var(--ease);
}
.tile:hover .tile-btn, .tile:focus-within .tile-btn, .tile-btn:focus-visible { opacity: 1; }

/* Tela cheia: só o quadro em destaque, sem a faixa de baixo */
.stage.is-fullscreen { padding: 0; background: #000; }
.stage.is-fullscreen .stage-strip { display: none; }
.stage.is-fullscreen .tile { border: 0; border-radius: 0; }
.stage.is-fullscreen .tile-btn { display: none; }

.call-controls {
  flex: none; display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 12px 16px 16px; background: var(--bg-0);
}
.ctrl {
  width: 52px; height: 52px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--bg-3); color: var(--text);
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.ctrl:hover:not(:disabled) { background: var(--bg-4); }
.ctrl.active { background: #3a1d1b; color: #f2a19b; }
.ctrl.sharing { background: var(--ok); color: #06150e; }
.ctrl.on { background: var(--text); color: var(--bg-0); }
.ctrl.on:hover:not(:disabled) { background: #fff; }
.ctrl.danger { background: var(--danger); color: #fff; }
.ctrl.danger:hover { background: #c9453e; }

@media (hover: none) {
  .tile-btn { opacity: 1; }
}

/* ---------- Configurações do usuário e do grupo ---------- */

.group-icon { width: 24px; height: 24px; border-radius: 7px; object-fit: cover; flex: none; }
.photo-row { display: flex; align-items: center; gap: 16px; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-actions .hint { flex-basis: 100%; }
.group-icon-lg { width: 80px; height: 80px; border-radius: 20px; object-fit: cover; flex: none; }
.group-icon-lg.placeholder { display: grid; place-items: center; background: var(--bg-1); border: 1px solid var(--line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.field textarea { min-height: 72px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.field textarea.bio-input { font-family: var(--font); font-size: 14.5px; }
.field-foot { display: flex; justify-content: space-between; gap: 12px; }
.char-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.meter-row { display: flex; align-items: center; gap: 12px; }
.meter { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-0); border: 1px solid var(--line); overflow: hidden; }
.meter-bar { width: 0; height: 100%; background: var(--ok); transition: width 0.06s linear; }
.cam-preview { width: min(320px, 100%); aspect-ratio: 16 / 9; border-radius: var(--radius); background: #000; object-fit: cover; transform: scaleX(-1); }

/* ---------- Mensagens diretas: barra lateral ---------- */

.dm-top { height: var(--header-h); flex: none; display: flex; align-items: center; padding: 0 10px; border-bottom: 1px solid var(--line); }
.dm-find {
  width: 100%; height: 30px; padding: 0 10px; border: 0; border-radius: 6px;
  background: var(--bg-0); color: var(--text-3); font-size: 13px; font-weight: 600; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-find:hover { color: var(--text-2); }
.channel.dm-home { min-height: 42px; gap: 12px; font-weight: 600; }
.channel.dm { min-height: 44px; gap: 12px; }
.dm-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.dm-names .label { flex: none; }
.dm-sub { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.dm-sub span { overflow: hidden; text-overflow: ellipsis; }
.dm-sub.in-voice .ic { flex: none; color: var(--ok); }

/* "Encontre ou comece uma conversa" */
.modal.modal-picker { width: min(480px, calc(100% - 32px)); }
.picker-input {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--bg-0); color: var(--text); font: inherit; outline: none;
}
.picker-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.picker-list { display: flex; flex-direction: column; gap: 2px; max-height: min(360px, 50dvh); overflow-y: auto; }
.picker-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 10px;
  border: 0; border-radius: var(--radius); background: none; color: var(--text-2); text-align: left;
}
.picker-item:hover, .picker-item:focus-visible { background: var(--bg-3); color: var(--text); }
.picker-item > .ic { color: var(--text-3); }
.picker-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.picker-names strong { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-names small { color: var(--text-3); font-size: 12.5px; }
.picker-item .avatar .presence { border-color: var(--bg-2); }
.picker-item:hover .avatar .presence { border-color: var(--bg-3); }

/* ---------- Mensagens diretas: tela "Membros" ---------- */

.view-home { background: var(--bg-2); }
.home-header { gap: 12px; }
.home-header h1 { flex: none; }
.home-sep { width: 4px; height: 4px; flex: none; border-radius: 50%; background: var(--text-3); }
.home-tabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; }
.home-tab {
  height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.home-tab:hover { background: var(--bg-3); color: var(--text); }
.home-tab[aria-selected="true"] { background: var(--bg-4); color: var(--text); }
.home-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 24px; }
.home-search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: var(--radius); background: var(--bg-0); border: 1px solid var(--line-2); color: var(--text-3);
  transition: border-color 0.15s var(--ease);
}
.home-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.home-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.home-count { margin: var(--sp-6) var(--sp-2) var(--sp-2); font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.home-list { display: flex; flex-direction: column; }
.home-row {
  display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 0 10px;
  border-top: 1px solid var(--line); border-radius: var(--radius);
  transition: background-color 0.12s var(--ease);
}
.home-row:hover { background: var(--bg-3); border-top-color: transparent; }
.home-row:hover + .home-row { border-top-color: transparent; }
.home-person {
  flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 12px;
  padding: 0; border: 0; background: none; color: inherit; text-align: left;
}
.home-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.home-names strong { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-names small { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-names small.in-voice { color: var(--ok); }
.home-row .avatar .presence { border-color: var(--bg-2); }
.home-row:hover .avatar .presence { border-color: var(--bg-3); }
.home-action {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--bg-1); color: var(--text-2);
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.home-action:hover { background: var(--bg-0); color: var(--text); }
.home-empty { display: grid; justify-items: center; gap: 12px; padding: 56px 16px; color: var(--text-3); text-align: center; }
.home-empty p { margin: 0; max-width: 42ch; }

/* ---------- Mensagens diretas: "Ativo agora" (coluna da direita) ---------- */

.active-empty { margin: var(--sp-2) 2px 0; padding: var(--sp-4); border-radius: var(--radius-lg); background: var(--bg-2); text-align: center; }
.active-empty strong { display: block; margin-bottom: 4px; }
.active-empty p { margin: 0; font-size: 13px; color: var(--text-3); }
.active-card {
  display: flex; flex-direction: column; gap: 10px; margin: var(--sp-2) 2px 0; padding: var(--sp-3);
  border-radius: var(--radius-lg); background: var(--bg-2); border: 1px solid var(--line);
}
.active-card.mine { border-color: rgba(61, 186, 132, 0.45); }
.active-head { display: flex; align-items: center; gap: 6px; color: var(--text-3); }
.active-name { flex: 1; min-width: 0; color: var(--text); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.active-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.active-people { display: flex; flex-direction: column; gap: 6px; }
.active-person { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--text-2); }
.active-person-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Movimento ---------- */
/* Regra da casa: movimento só explica estado, chegada ou lugar. Rápido (120–240 ms), desacelerando no fim. */

/* Menus e cartões nascem do lado do botão que os abriu */
.menu, .popover { animation: pop-below var(--t-base) var(--ease-out); }
.menu[data-from="above"], .popover[data-from="above"] { animation-name: pop-above; }
.popover[data-from="left"] { animation-name: pop-left; }
.popover[data-from="right"] { animation-name: pop-right; }
@keyframes pop-below { from { opacity: 0; transform: translateY(-4px); } }
@keyframes pop-above { from { opacity: 0; transform: translateY(4px); } }
@keyframes pop-left { from { opacity: 0; transform: translateX(6px); } }
@keyframes pop-right { from { opacity: 0; transform: translateX(-6px); } }

/* Trocar de tela (conversa, chamada, pessoas) e de espaço (conversas, grupo): esmaecimento curto */
.view { animation: fade-in var(--t-base) linear; }
.space-in { animation: space-in 220ms var(--ease-out); }
@keyframes space-in { from { opacity: 0; transform: translateX(-6px); } }

/* Mensagem que chega ao vivo de outra pessoa */
.msg-new { animation: msg-in 260ms var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }

/* Momento principal: entrar na voz. O painel sobe de dentro do cartão do usuário... */
.voice-panel.entering { animation: dock-rise 380ms var(--ease-out) both; }
@keyframes dock-rise {
  from { opacity: 0; transform: translateY(10px); clip-path: inset(100% 0 0 0); }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
}
/* ...as barras de sinal procuram conexão em ciclo e, ao conectar, acendem uma depois da outra */
.voice-panel-info > .ic path { stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.voice-panel-info.wait > .ic path { animation: signal-seek 1.3s var(--ease) infinite; }
.voice-panel-info.just-connected > .ic path { animation: signal-lock 640ms var(--ease-out) both; }
@keyframes signal-seek { 0% { stroke-dashoffset: 1; } 55%, 70% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
@keyframes signal-lock { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* Gravando: o botão respira enquanto a gravação está ligada */
.va-btn.recording .ic { animation: rec-breathe 1.6s ease-in-out infinite; }
@keyframes rec-breathe { 50% { opacity: 0.45; } }

/* ---------- Telas menores ---------- */

@media (max-width: 1024px) {
  .app { grid-template-columns: calc(var(--rail-w) + var(--sidebar-w, 240px)) minmax(0, 1fr); }
  .members, .resize-members { display: none; }
}

@media (max-width: 700px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .resize-handle { display: none; }
  .only-mobile { display: inline-grid; }
  .nav {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: min(372px, 92vw);
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
  }
  .app.drawer-open .nav { transform: none; box-shadow: var(--shadow); }
  .home-body { padding: 12px; }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, 0.55); }
  .field-row { flex-direction: column; }
  .field-narrow { flex: 1; }
  .msg { grid-template-columns: 48px minmax(0, 1fr); padding-right: 8px; }
  .msg-toolbar { right: 8px; }
  .composer-host { padding: 0 8px 8px; }
  .msg-reply::before { display: none; }
  .att-image img { max-width: calc(100vw - 72px); height: auto !important; }
}

/* Telas de toque: a barra de ações aparece com o toque, sem depender de hover */
@media (hover: none) {
  .reaction-add { opacity: 1; }
}

/* Movimento reduzido: nada se desloca; o que chega na tela só esmaece, e mudanças de cor continuam */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-property: color, background-color, border-color, opacity !important;
  }
  .menu, .popover, .modal[open], .toast, .view, .space-in, .msg-new, .voice-panel.entering {
    animation: fade-in var(--t-fast) linear !important;
  }
  .toast.leaving { animation: toast-fade var(--t-fast) linear forwards !important; }
  @keyframes toast-fade { to { opacity: 0; } }
}
