/* ===========================================================
 * A pele do Bad News.
 *
 * O app.css define a estrutura — o que é coluna, o que rola, o que some no
 * celular. Este arquivo vem depois e define a aparência: cores, tamanhos de
 * letra, cantos, a coluna de servidores. Mexer no visual é mexer só aqui.
 *
 * A referência é a organização de um cliente de chat de voz com servidores:
 * planos quase pretos separados por linhas finas (coluna e canais no tom mais
 * fundo, conversa um tom acima), cantos de 8 a 12 px e destaque em
 * azul-violeta. Cores e medidas seguem essa referência de perto; o código é
 * nosso, e ícones, sons, fontes e ilustrações são do próprio Bad News ou de
 * conjuntos livres — nada disso vem de outro produto.
 * =========================================================== */

:root {
  /* Três planos, do mais fundo ao mais próximo. */
  --surface-0: #121214;   /* coluna de servidores, faixa de cima */
  --surface-1: #121214;   /* canais */
  --surface-2: #1a1a1e;   /* conversa e membros */
  --surface-3: #222327;   /* campo de mensagem, cartões */
  --surface-4: #2c2d32;   /* elevado: passar o mouse sobre um cartão */
  --painel: #202024;      /* rodapé da barra lateral: usuário e voz */
  --menu-bg: #28282d;     /* menus de contexto e avisos */

  --overlay-soft: rgba(151, 151, 159, .12);
  --overlay-mid: rgba(151, 151, 159, .20);
  --overlay-strong: rgba(151, 151, 159, .28);
  --msg-hover: rgba(151, 151, 159, .06);

  --text-1: #efeff1;
  --text-2: #abacb2;
  --text-3: #96979e;
  --canal: #81828a;       /* nome de canal e de categoria em repouso */
  --line-0: rgba(151, 151, 159, .04);
  --text-max: #fbfbfb;
  --titulo: #fbfbfb;
  --link: #4d96ee;

  --line: rgba(151, 151, 159, .12);
  --line-2: rgba(151, 151, 159, .20);
  --line-3: #5f606a;

  --accent: #5865f2;
  --accent-hi: #798df9;
  --accent-lo: #4752c4;
  --accent-ghost: rgba(88, 101, 242, .24);

  --live: #da3e44;
  --live-ghost: rgba(218, 62, 68, .15);
  --ok: #3d9e60;
  --ok-ghost: rgba(61, 158, 96, .15);
  --warn: #f0b232;
  --warn-ghost: rgba(240, 178, 50, .10);

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* A linha sob os cabeçalhos é um traço fino, da cor das outras divisas. */
  --lift-1: 0 1px 0 rgba(151, 151, 159, .12);
  --lift-2: 0 4px 4px rgba(0, 0, 0, .16);
  --lift-3: 0 8px 16px rgba(0, 0, 0, .24);

  --rail-w: 72px;
  --sidebar-w: 303px;
  --members-w: 264px;
  --bar-h: 48px;

  --font: "gg sans", "Noto Sans", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  --surface-0: #f3f3f4;
  --surface-1: #f3f3f4;
  --surface-2: #fbfbfb;
  --surface-3: #ffffff;
  --surface-4: #e8e8ea;
  --painel: #ffffff;
  --menu-bg: #ffffff;

  --overlay-soft: rgba(151, 151, 159, .12);
  --overlay-mid: rgba(151, 151, 159, .24);
  --overlay-strong: rgba(151, 151, 159, .32);
  --msg-hover: rgba(151, 151, 159, .08);

  --text-1: #2e2e34;
  --text-2: #595a63;
  --text-3: #6c6d76;
  --canal: #666770;
  --line-0: rgba(151, 151, 159, .20);
  --text-max: #28282d;
  --titulo: #28282d;
  --link: #006dd4;

  --line: rgba(151, 151, 159, .28);
  --line-2: rgba(151, 151, 159, .40);
  --line-3: #8b8c94;

  --accent-hi: #525fe0;
  --accent-ghost: rgba(88, 101, 242, .15);
  --lift-1: 0 1px 0 rgba(151, 151, 159, .28);
  --lift-2: 0 4px 4px rgba(0, 0, 0, .08);
  --lift-3: 0 8px 16px rgba(0, 0, 0, .16);
  --live: #d6363f;
  --ok: #269153;
}

/* ===================== base ===================== */

body {
  font-size: 16px;
  line-height: 1.375;
  font-feature-settings: normal;
}
h1, h2, h3, h4 { letter-spacing: 0; }
a { color: var(--link); }
:focus-visible { outline-color: var(--link); }

/* Barras de rolagem finas, que só pesam onde há muito o que rolar. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: #1a1b1e;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #1a1b1e; background-clip: padding-box; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c4c9ce; background-clip: padding-box; }
.messages::-webkit-scrollbar { width: 16px; }
.messages::-webkit-scrollbar-track {
  background: var(--surface-1);
  border: 4px solid var(--surface-2);
  border-radius: 8px;
}
.messages::-webkit-scrollbar-thumb { border: 4px solid var(--surface-2); border-radius: 8px; min-height: 40px; }

/* ===================== botões e campos ===================== */

.btn {
  min-height: 38px;
  padding: 2px 16px;
  border: 0;
  border-radius: var(--r-xs);
  background: #4e5058;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}
.btn:hover { background: #6d6f78; }
.btn-primary { background: var(--accent); box-shadow: none; }
.btn-primary:hover { background: var(--accent-lo); }
.btn-danger { background: #da373c; }
.btn-danger:hover { background: #a12828; filter: none; }
.btn-ghost { background: transparent; color: var(--text-1); box-shadow: inset 0 0 0 1px var(--line-3); }
.btn-ghost:hover { background: var(--overlay-soft); }
.btn-sm { min-height: 32px; padding: 2px 12px; font-size: 14px; }
:root[data-theme="light"] .btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost) { background: #6d6f78; }

.icon-btn { border-radius: var(--r-sm); }
.icon-btn .icone { width: 20px; height: 20px; }

.field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text-2);
  margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  padding: 10px;
  background: var(--surface-0);
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  font-size: 16px;
}
.field input:hover, .field textarea:hover { border-color: transparent; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--link);
  background: var(--surface-0);
}
.select-sm { background: var(--surface-0); border-color: transparent; border-radius: var(--r-sm); }

.switch { width: 40px; height: 24px; background: #80848e; }
.switch::after { top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; }
.switch[aria-pressed="true"] { background: var(--ok); }
.switch[aria-pressed="true"]::after { transform: translateX(16px); }

/* ===================== entrada ===================== */

.auth-screen { background: #404eed; }
.auth-screen::before {
  /* Dentro da tela, e não 20% para fora: o excesso criava barras de rolagem. */
  inset: 0;
  background:
    radial-gradient(40% 46% at 12% 14%, rgba(255, 255, 255, .10), transparent 70%),
    radial-gradient(46% 44% at 90% 92%, rgba(22, 26, 110, .55), transparent 70%);
  filter: blur(10px);
}
.auth-card {
  max-width: 480px;
  padding: 32px;
  background: var(--surface-2);
  border: 0;
  border-radius: var(--r-md);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}
.auth-brand { margin-bottom: 20px; }
.auth-brand h1 { font-size: 24px; font-weight: 600; letter-spacing: 0; color: var(--titulo); }
.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--r-xl);
  background: center / cover no-repeat url("/img/icone.png");
  box-shadow: none;
}
.auth-tabs { background: var(--surface-0); border: 0; border-radius: var(--r-sm); }
.auth-tab.is-active { background: var(--surface-3); box-shadow: none; }
.auth-note { background: var(--surface-1); border: 0; border-left: 4px solid var(--accent); border-radius: var(--r-sm); font-size: 14px; }
.auth-error { color: #fa777c; font-size: 14px; }

/* ===================== coluna de servidores ===================== */

/*
 * A coluna da esquerda. Hoje ela mostra um servidor só — é a âncora visual
 * do aplicativo e o lugar das ações que valem para tudo, como baixar o app.
 */
.rail {
  width: var(--rail-w);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  background: var(--surface-0);
  overflow-y: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item {
  position: relative;
  width: var(--rail-w);
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  text-decoration: none;
}
.rail-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2) center / cover no-repeat;
  color: var(--text-1);
  font-size: 18px;
  font-weight: 500;
  transition: border-radius 150ms ease-out, background-color 150ms ease-out, color 150ms ease-out;
}
.rail-icon .icone { width: 24px; height: 24px; }
.rail-icon.is-logo { background-image: url("/img/icone.png"); }
/* O círculo vira um quadrado de cantos largos: é assim que a coluna diz "este". */
.rail-item:hover .rail-icon, .rail-item.is-active .rail-icon { border-radius: var(--r-xl); }
.rail-item:hover .rail-icon.is-texto, .rail-item.is-active .rail-icon.is-texto { background-color: var(--accent); color: #fff; }
.rail-icon.is-acao { color: var(--ok); }
.rail-item:hover .rail-icon.is-acao { background-color: var(--ok); color: #fff; }
.rail-pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--text-max);
  transform: translateY(-50%);
  transition: height 150ms ease-out;
}
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.is-active .rail-pill { height: 40px; }
.rail-sep { width: 32px; height: 2px; flex: none; border-radius: 1px; background: var(--line); }
.rail-item[hidden] { display: none; }
.rail-fim { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* ===================== barra lateral ===================== */

.server-header {
  padding: 0 12px 0 16px;
  border-bottom: 0;
  box-shadow: var(--lift-1);
  position: relative;
  z-index: 1;
  transition: background-color var(--fast);
}
.server-header:hover { background: var(--overlay-soft); }
.server-header h1 { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--titulo); }

.channel-list { padding: 0 8px 16px; }

.category { margin-top: 0; padding-top: 16px; }
.category:first-child { padding-top: 12px; }
.category-head {
  gap: 2px;
  padding: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.category-head:hover { color: var(--text-1); }
.category-head .chev, .category-head .chev .icone { width: 12px; height: 12px; }
.category-add { width: 18px; height: 18px; border-radius: var(--r-xs); }
.category-add:hover { background: none; }

.channel-row {
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
}
.channel-row:hover { background: var(--overlay-soft); color: var(--text-1); }
.channel-row.is-active { background: var(--overlay-mid); color: var(--text-max); }
/* O canal aberto não ganha barra; a marca fina à esquerda fica só para o não lido. */
.channel-row.is-active::before { display: none; }
.channel-row.has-unread:not(.is-active)::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 8px;
  margin-top: -4px;
  border-radius: 0 4px 4px 0;
  background: var(--text-max);
}
.channel-row.has-unread { font-weight: 500; }
.channel-row .glyph { color: var(--text-3); }
.channel-row .glyph .icone { width: 20px; height: 20px; }
.channel-row .badge { min-width: 16px; height: 16px; padding: 0 4px; font-size: 12px; border-radius: 8px; }
.channel-row .count { font-size: 12px; font-weight: 600; }

.voice-members { padding: 0 0 8px 32px; gap: 0; }
.voice-member { text-align: left; min-height: 32px; padding: 4px 8px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; color: var(--text-3); gap: 8px; }
.voice-member .avatar { width: 24px; height: 24px; font-size: 10px; }
.voice-member.is-speaking .avatar { box-shadow: 0 0 0 2px var(--ok); }
.voice-member.is-speaking .name { color: var(--text-max); }
.voice-member .flags .live {
  padding: 0 6px;
  height: 16px;
  border-radius: 8px;
  background: var(--live);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Voz conectada e usuário: o rodapé fixo da barra, num tom mais fundo. */
.voice-panel {
  margin: 0;
  padding: 8px;
  background: var(--painel);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.voice-panel-status strong { font-size: 14px; font-weight: 600; letter-spacing: 0; line-height: 18px; }
.voice-panel-status small { font-size: 12px; line-height: 16px; }
.quality-dot { box-shadow: none; }
.voice-panel-actions { gap: 8px; margin-top: 8px; }
.voice-panel-actions .btn {
  min-height: 32px;
  padding: 0 6px;
  background: var(--surface-3);
  box-shadow: none;
  color: var(--text-1);
  font-size: 13px;
}
.voice-panel-actions .btn:hover { background: var(--surface-4); }

.user-panel {
  height: 52px;
  padding: 0 8px;
  gap: 0;
  background: var(--painel);
  border-top: 0;
}
.me-card { gap: 8px; padding: 4px; margin-right: 4px; border-radius: var(--r-sm); }
.user-panel .avatar { width: 32px; height: 32px; font-size: 12px; }
.me-text strong { font-size: 14px; font-weight: 600; line-height: 18px; color: var(--titulo); }
.me-text small { font-size: 12px; line-height: 13px; color: var(--text-2); }
.user-panel-actions { gap: 0; }
.user-panel-actions .icon-btn .icone { width: 20px; height: 20px; }

/* ===================== avatares ===================== */

.avatar, .avatar-lg, .msg-gutter .avatar, .msg-reply .avatar { border-radius: 50%; }
.avatar { font-weight: 600; letter-spacing: 0; }
.avatar[data-presence]::after {
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  min-width: 0;
  min-height: 0;
  box-shadow: 0 0 0 3px var(--surface-1);
}
.user-panel .avatar[data-presence]::after { box-shadow: 0 0 0 3px var(--painel); }
/* Ausente é um anel vazado, não um ponto cheio: "não está" em vez de outra cor. */
.avatar[data-presence="offline"]::after {
  background: var(--surface-1);
  box-shadow: inset 0 0 0 2.5px #80848e, 0 0 0 3px var(--surface-1);
}

/* ===================== cabeçalho da conversa ===================== */

.main { border-left: 0; }
.main-header {
  padding: 0 8px 0 16px;
  gap: 8px;
  border-bottom: 0;
  box-shadow: var(--lift-1);
  position: relative;
  z-index: 2;
}
.channel-icon { color: var(--text-3); }
.channel-icon .icone { width: 24px; height: 24px; }
.main-header h2 { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--titulo); }
.channel-topic { font-size: 14px; color: var(--text-2); margin-left: 8px; padding-left: 16px; border-left-color: var(--line); }
.main-header .icon-btn { width: 32px; height: 32px; }
.main-header .icon-btn:hover, .main-header .icon-btn.is-active { background: none; color: var(--text-1); }
.main-header .icon-btn.is-active { color: var(--text-max); }
.main-header .icon-btn .icone { width: 24px; height: 24px; }
.search-wrap input {
  width: 144px;
  height: 24px;
  padding: 0 6px;
  background: var(--surface-0);
  border: 0;
  border-radius: var(--r-sm);
  font-size: 14px;
}
.search-wrap input:focus { width: 240px; background: var(--surface-0); }

/* ===================== mensagens ===================== */

.messages { padding: 0 0 8px; }
.msg { gap: 16px; padding: 2px 48px 2px 16px; }
.msg:hover { background: var(--msg-hover); }
.msg.is-first { margin-top: 17px; }
.msg.is-mention { background: var(--warn-ghost); box-shadow: inset 2px 0 0 var(--warn); }
.msg.is-mention:hover { background: rgba(240, 178, 50, .08); }
.msg-gutter { padding-top: 2px; }
.msg-gutter .avatar { font-size: 15px; cursor: pointer; }
.msg-time-hover { font-size: 11px; padding-top: 4px; }
.msg-head { gap: 8px; margin-bottom: 0; }
.msg-author { font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--titulo); line-height: 22px; }
/* O cargo aparece na lista de membros; na conversa, o nome basta. */
.msg-role { display: none; }
.msg-stamp { font-size: 12px; line-height: 22px; }
.msg-text { font-size: 16px; line-height: 1.375; color: var(--text-1); }
.msg-text code { background: var(--surface-1); border-color: var(--surface-0); font-size: 85%; border-radius: var(--r-sm); }
.msg-text pre { background: var(--surface-1); border-color: var(--surface-0); border-radius: var(--r-sm); font-size: 14px; }
.msg-text blockquote { border-left: 4px solid #4e5058; border-radius: 4px 0 0 4px; }
.msg-text .mention { background: var(--accent-ghost); color: #c9cdfb; font-weight: 500; padding: 0 2px; }
.msg-text .mention:hover { background: var(--accent); color: #fff; }
.msg-text .mention.is-me { background: rgba(240, 178, 50, .16); color: #f0b232; }
:root[data-theme="light"] .msg-text .mention { color: #505cdc; }
.msg-text .spoiler { background: #1e1f22; }

.msg-day { margin: 24px 14px 8px 16px; gap: 4px; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.msg-day::before, .msg-day::after { margin: 0 4px; }
.new-divider { margin: 8px 14px 8px 16px; font-size: 12px; letter-spacing: 0; }

.msg-reply { font-size: 14px; color: var(--text-2); gap: 4px; }
.msg-reply::before { width: 33px; height: 13px; margin-left: -36px; margin-right: 4px; border-color: #4e5058; border-top-left-radius: 6px; }

.msg-files img, .msg-files video { border-radius: var(--r-md); box-shadow: none; }
.file-card { padding: 16px; background: var(--surface-1); border-color: var(--painel); border-radius: var(--r-md); max-width: 432px; }
.file-card:hover { background: var(--surface-1); border-color: var(--line-3); }
.file-card .file-meta strong { color: var(--link); font-size: 16px; font-weight: 400; }

.msg-reactions { gap: 4px; margin-top: 4px; }
.reaction { padding: 2px 6px; background: var(--surface-1); border-color: transparent; border-radius: var(--r-md); font-size: 16px; }
.reaction:hover { background: var(--surface-3); border-color: var(--line-3); }
.reaction .n { font-size: 14px; font-weight: 600; color: var(--text-2); }
.reaction.is-mine { background: rgba(88, 101, 242, .15); border-color: var(--accent); }
.reaction.is-mine .n { color: #dee0fc; }
:root[data-theme="light"] .reaction.is-mine .n { color: var(--accent); }

.msg-tools {
  top: -16px;
  right: 14px;
  padding: 0;
  gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--lift-1);
  overflow: hidden;
}
.msg-tools button { width: 32px; height: 32px; border-radius: 0; }
.msg-tools button:hover { background: var(--overlay-soft); }
.msg-tools .icone { width: 20px; height: 20px; }

.msg-edit textarea { background: var(--surface-3); border: 0; border-radius: var(--r-md); font-size: 16px; }

/* O começo do canal: um emblema redondo e um título que recebe quem chega. */
.msg-empty { padding: 16px 16px 8px; }
.msg-empty .marca { width: 68px; height: 68px; border-radius: 50%; margin-bottom: 8px; background: #41434a; border: 0; color: #fff; }
.msg-empty .marca .icone { width: 42px; height: 42px; }
.msg-empty h3 { font-size: 32px; font-weight: 700; letter-spacing: 0; color: var(--titulo); line-height: 40px; }
.msg-empty p { font-size: 16px; color: var(--text-2); max-width: none; }
:root[data-theme="light"] .msg-empty .marca { background: #6d6f78; }

.jump-latest .btn { border-radius: 12px; min-height: 28px; font-size: 14px; }

/* ===================== campo de mensagem ===================== */

.composer-wrap { padding: 0 16px 24px; }
.typing-bar { height: 24px; font-size: 14px; padding: 0 0 2px; }
.reply-bar {
  padding: 8px 16px;
  background: var(--surface-1);
  border: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  font-size: 14px;
  color: var(--text-2);
}
.attachment-tray { padding: 16px; background: var(--surface-3); border: 0; border-bottom: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0; }
.attachment-chip .thumb { border-radius: var(--r-sm); background: var(--surface-1); box-shadow: none; }
.composer {
  align-items: flex-start;
  gap: 0;
  padding: 0 8px 0 0;
  background: var(--surface-3);
  border: 0;
  border-radius: var(--r-md);
}
.composer:focus-within { border-color: transparent; }
.composer textarea { padding: 11px 0; font-size: 16px; line-height: 22px; min-height: 44px; }
.composer .icon-btn { width: 40px; height: 44px; flex: none; }
.composer .icon-btn:hover { background: none; }
.composer .icon-btn .icone { width: 24px; height: 24px; }
/* O "mais" dentro de um disco: é um botão de ação, não um ícone solto. */
#btn-attach { width: 56px; }
#btn-attach .icone {
  padding: 4px;
  border-radius: 50%;
  background: var(--text-2);
  color: var(--surface-3);
  stroke-width: 3;
  transition: background-color var(--fast);
}
#btn-attach:hover .icone { background: var(--text-1); }
#btn-emoji { color: var(--text-2); }
#btn-emoji:hover { color: var(--warn); }
/* Com teclado, Enter envia. O botão volta nas telas pequenas, onde não há Enter confiável. */
#btn-send { display: none; }
.composer-hint { font-size: 12px; padding: 4px 0 0; }

/* ===================== membros ===================== */

.members { border-left: 0; padding: 0 0 20px 8px; }
.member-group { padding: 24px 8px 4px; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.member-row { min-height: 42px; gap: 12px; padding: 1px 8px; margin: 1px 0; border-radius: var(--r-sm); }
.member-row .avatar { width: 32px; height: 32px; font-size: 12px; }
.member-row .who strong {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  color: var(--text-3);
}
.member-row:hover .who strong { color: var(--text-1); }
.member-row .who strong .nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .who small { font-size: 12px; line-height: 16px; }
.member-row .coroa { flex: none; display: inline-flex; color: var(--warn); }
.member-row .coroa .icone { width: 14px; height: 14px; }
.member-row.is-offline { opacity: .3; }
.member-row.is-offline:hover { opacity: 1; }

/* ===================== sobreposições ===================== */

.modal-root { background: rgba(0, 0, 0, .7); }
.modal { border: 0; border-radius: var(--r-md); box-shadow: 0 0 0 1px rgba(30, 31, 34, .6), 0 2px 10px rgba(0, 0, 0, .2); padding: 24px; }
.modal h2 { font-size: 24px; font-weight: 700; letter-spacing: 0; color: var(--titulo); }
.modal .sub { color: var(--text-2); }
.tabs button { font-size: 16px; font-weight: 500; }
.tabs button.is-active { color: var(--text-max); border-bottom-color: var(--accent); }
.setting-row .info strong { font-size: 16px; font-weight: 500; color: var(--titulo); }
.setting-row .info small { font-size: 14px; color: var(--text-2); }

.context-menu {
  min-width: 188px;
  padding: 6px 8px;
  background: var(--menu-bg);
  border: 0;
  border-radius: var(--r-sm);
  box-shadow: var(--lift-3);
}
.context-menu button {
  min-height: 32px;
  padding: 6px 8px;
  margin: 2px 0;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}
.context-menu button:hover { background: var(--accent); color: #fff; }
.context-menu button.danger { color: var(--live); }
.context-menu button.danger:hover { background: #da373c; color: #fff; }
.context-menu hr { margin: 4px; background: var(--line); border: 0; height: 1px; }
.context-menu .head { padding: 6px 8px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--text-3); }

.toast { background: var(--menu-bg); border: 0; border-radius: var(--r-md); font-size: 14px; }
.emoji-panel { background: var(--surface-1); border: 0; border-radius: var(--r-md); box-shadow: var(--lift-3); }
.emoji-grid button { border-radius: var(--r-sm); }

/* ===================== palco de vídeo ===================== */

.stage { background: #000; border-bottom: 0; }
.tile { background: var(--surface-0); border-radius: var(--r-md); box-shadow: none; }
.tile.is-speaking { box-shadow: inset 0 0 0 2px var(--ok); }

/* ===================== telas pequenas ===================== */

@media (max-width: 780px) {
  /* A barra de canais vira gaveta; a coluna de servidores sairia do lugar com ela. */
  .rail { display: none; }
  .msg { padding-left: 12px; padding-right: 12px; }
  .composer-wrap { padding: 0 8px 12px; }
  #btn-send { display: inline-flex; }
}

/* ---------- aplicativo para Windows: faixa de cima da janela ---------- */
/*
 * No aplicativo a janela não tem a moldura do Windows. Esta faixa ocupa o
 * lugar dela: é por onde a janela é arrastada, e os três botões do sistema
 * ficam sobrepostos no canto direito. A classe is-desktop é posta pelo
 * próprio aplicativo; no navegador nada disto existe.
 */
.barra-janela { display: none; }
html.is-desktop { --barra-janela: 32px; }
html.is-desktop .barra-janela {
  position: fixed;
  z-index: 250;
  top: 0;
  left: 0;
  right: 0;
  height: var(--barra-janela);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-0);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  -webkit-app-region: drag;
}
html.is-desktop .app { height: calc(100dvh - var(--barra-janela)); margin-top: var(--barra-janela); }
/* Tudo que cobre a janela inteira começa abaixo da faixa: um botão debaixo
   dela não receberia o clique, que viraria arrasto da janela. */
html.is-desktop .auth-screen,
html.is-desktop .modal-root,
html.is-desktop .lightbox,
html.is-desktop .recepcao,
html.is-desktop .drop-overlay { top: var(--barra-janela); }
/* Em tela cheia os botões do sistema somem, e a faixa some junto. */
html.is-desktop.janela-cheia { --barra-janela: 0px; }
html.is-desktop.janela-cheia .barra-janela { display: none; }

/* ---------- regiões separadas por linha, não por tom ---------- */
/*
 * Coluna de servidores e lista de canais têm o mesmo tom. O que separa as
 * regiões é um traço fino — e, dentro do aplicativo, o canto arredondado onde
 * a lista de canais encontra a faixa de cima.
 */
.sidebar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
html.is-desktop .sidebar { border-top: 1px solid var(--line); border-top-left-radius: var(--r-md); }
.members { background: var(--surface-2); border-left: 1px solid var(--line); }

/* Ícone de servidor: quadrado de cantos arredondados, 40 px. */
.rail-item { height: 40px; }
.rail-icon,
.rail-item:hover .rail-icon,
.rail-item.is-active .rail-icon { width: 40px; height: 40px; border-radius: var(--r-md); }

/* Campo de mensagem: 56 px de altura, com contorno. */
.composer { border: 1px solid var(--line); border-radius: var(--r-sm); }
.composer:focus-within { border-color: var(--line-2); }
.composer textarea { padding: 16px 0; min-height: 54px; }
.composer .icon-btn { height: 54px; }

.modal { box-shadow: 0 0 0 1px var(--line), var(--lift-3); }
.context-menu { border: 1px solid var(--line); }

/* ---------- lista de canais ---------- */
/* Categoria em letra comum, do tamanho de uma legenda; nada de caixa alta. */
.category-head {
  padding: 0 0 6px;
  color: var(--canal);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0;
  text-transform: none;
}
.channel-row { gap: 8px; margin: 1px 0; padding: 4px 8px; color: var(--canal); line-height: 24px; }
.channel-row .glyph { color: var(--canal); }
.channel-row:hover .glyph, .channel-row.is-active .glyph { color: inherit; }

/* ---------- rodapé: cartão flutuante ---------- */
/*
 * Voz conectada e usuário formam um cartão só, com 8 px de folga, que passa
 * por baixo da coluna de servidores. Por isso a coluna reserva o espaço dele
 * no fim — senão o último botão dela ficaria escondido atrás do cartão.
 */
.voice-panel, .user-panel { margin: 0 8px 0 calc(8px - var(--rail-w)); background: var(--painel); border: 1px solid var(--line-0); }
.user-panel { height: 56px; margin-bottom: 8px; border-radius: var(--r-sm); }
.voice-panel:not([hidden]) { border-bottom: 1px solid var(--line); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.voice-panel:not([hidden]) + .user-panel { border-top: 0; border-radius: 0 0 var(--r-sm) var(--r-sm); }
.user-panel .avatar[data-presence]::after { box-shadow: 0 0 0 3px var(--painel); }
.rail { padding-bottom: 76px; }
.app:has(.voice-panel:not([hidden])) .rail { padding-bottom: 184px; }

/* ---------- conversa ---------- */
.main-header .icon-btn .icone { width: 20px; height: 20px; }
.composer-wrap { padding: 0 8px 8px; }
.composer { border-color: var(--line-0); }
.composer textarea { padding: 17px 0; }

@media (max-width: 780px) {
  /* Sem a coluna de servidores, o cartão fica só dentro da lista. */
  .voice-panel, .user-panel { margin-left: 8px; }
}

/* ---------- aviso de versão nova ---------- */
.btn-atualizar[hidden] { display: none; }
.main-header .icon-btn.btn-atualizar,
.main-header .icon-btn.btn-atualizar:hover { color: var(--ok); }
.main-header .icon-btn.btn-atualizar:hover { background: var(--overlay-soft); }
/* No aplicativo o ícone mora na faixa de cima, ao lado dos botões da janela
   (quem o põe lá é o atualizacao.js). Ele sai da área de arrasto: sem isso o
   clique moveria a janela em vez de atualizar. */
.barra-janela .icon-btn.btn-atualizar {
  position: absolute;
  top: 2px;
  right: 146px;
  width: 28px;
  height: 28px;
  color: var(--ok);
  -webkit-app-region: no-drag;
}
.barra-janela .icon-btn.btn-atualizar:hover { color: var(--ok); background: var(--overlay-soft); }
.barra-janela .icon-btn.btn-atualizar .icone { width: 18px; height: 18px; }

/* ---------- GIFs ---------- */
/* Botão no campo de mensagem: a sigla num selo, do tamanho dos ícones vizinhos. */
.composer .icon-btn.btn-gif[hidden] { display: none; }
.composer .icon-btn.btn-gif span {
  padding: 2px 5px;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
}

/* A gaveta: busca no topo, conteúdo que rola, crédito embaixo. */
.gif-panel {
  position: absolute;
  z-index: 50;
  right: 8px;
  bottom: 72px;
  width: min(498px, calc(100vw - 24px));
  height: min(486px, calc(100dvh - 190px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--lift-3);
}
.gif-topo { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.gif-topo input { flex: 1; min-width: 0; height: 40px; }
.gif-voltar { flex: none; width: 32px; height: 32px; }
.gif-voltar[hidden] { display: none; }
.gif-voltar .icone { transform: rotate(90deg); }
.gif-corpo { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px 16px; scrollbar-gutter: stable; }
.gif-rodape { flex: none; padding: 6px 16px; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-align: right; }
.gif-aviso { margin: 32px 16px; color: var(--text-3); text-align: center; }

.gif-categorias { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gif-categoria {
  position: relative;
  height: 110px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface-4) center / cover no-repeat;
  color: #fff;
  cursor: pointer;
}
/* Véu escuro sobre a prévia, para o nome ler bem em qualquer imagem. */
.gif-categoria::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .45); transition: background-color var(--fast); }
.gif-categoria:hover::before { background: rgba(0, 0, 0, .65); }
.gif-categoria.is-alta { background: var(--accent); }
.gif-categoria span { position: relative; padding: 0 8px; font-size: 16px; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

.gif-colunas { display: flex; gap: 8px; align-items: flex-start; }
.gif-coluna { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.gif-item { display: block; width: 100%; padding: 0; border: 0; border-radius: 5px; overflow: hidden; background: var(--surface-4); cursor: pointer; }
.gif-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-item:hover, .gif-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* GIF dentro da conversa. */
.msg-gif { margin-top: 2px; }
.msg-gif img { display: block; max-width: min(320px, 100%); height: auto; border-radius: var(--r-sm); }

/* ---------- cartão de perfil ---------- */
/* A janela do cartão não tem margem interna: a faixa vai de ponta a ponta. */
.modal.modal-perfil {
  width: min(400px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: var(--r-lg);
}
.perfil { position: relative; background: var(--surface-3); }
.perfil-faixa { height: 140px; background: var(--accent) center / cover no-repeat; }
/* O avatar fica metade sobre a faixa; o anel da cor do cartão o destaca dela. */
.perfil-avatar {
  position: absolute;
  top: 92px;
  left: 16px;
  width: 96px;
  height: 96px;
  font-size: 34px;
  box-shadow: 0 0 0 6px var(--surface-3);
}
.perfil-avatar[data-presence]::after { width: 20px; height: 20px; right: 2px; bottom: 2px; box-shadow: 0 0 0 5px var(--surface-3); }
.perfil-corpo { padding: 60px 16px 16px; }
.perfil-nome { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--titulo); overflow-wrap: anywhere; }
.perfil-nome .coroa { flex: none; display: inline-flex; color: var(--warn); }
.perfil-usuario { margin: 2px 0 0; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.perfil-cargo { margin-left: 8px; padding: 1px 6px; border-radius: var(--r-xs); background: var(--overlay-mid); font-size: 12px; font-weight: 600; }
.perfil-status { margin: 10px 0 0; font-size: 14px; color: var(--text-1); overflow-wrap: anywhere; }
.perfil-bloco { margin-top: 14px; }
.perfil-bloco h3 { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0; color: var(--text-2); }
.perfil-bio, .perfil-data { margin: 0; font-size: 14px; line-height: 1.4; color: var(--text-1); }
.perfil-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.perfil-extra { padding: 0 16px 16px; background: var(--surface-3); }
.perfil-extra .modal-actions { margin-top: 12px; }
/* Dono e administrador veem até quatro botões aqui, que não cabem lado a lado
   na largura do cartão: quebram em linhas e dividem o espaço por igual. */
.perfil-extra .modal-actions { flex-wrap: wrap; gap: 8px; }
.perfil-extra .modal-actions .btn { flex: 1 1 auto; margin: 0; white-space: nowrap; }

/* A prévia dentro de "editar perfil" é o mesmo cartão, emoldurado. */
.perfil-previa { max-width: 400px; margin: 0 auto 18px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }

/* ---------- perfil de entrada da voz ---------- */
.voz-perfis { padding: 12px 0; border-bottom: 1px solid var(--line); }
.voz-perfis .info { margin-bottom: 10px; }
.voz-perfil-texto { display: block; min-height: 2.8em; }
.voz-perfil-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
.voz-perfil {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--overlay-soft);
  color: var(--text-1);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.voz-perfil:hover { background: var(--overlay-mid); }
.voz-perfil[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-ghost); color: var(--text-max); }
/* Os ajustes um a um só aparecem para quem escolheu mexer neles. */
.voz-perfis:not([data-perfil="personalizado"]) + .voz-detalhes { display: none; }

/* ---------- troca do ícone do servidor ---------- */
.icone-troca { display: flex; gap: 20px; align-items: center; margin: 8px 0 4px; }
.icone-previa {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: var(--r-lg);
  background: var(--surface-4) center / cover no-repeat;
  box-shadow: 0 0 0 1px var(--line);
}
.icone-troca-botoes { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.icone-troca-botoes .btn[hidden] { display: none; }
