:root {
  --rail: #1e1f22;
  --sidebar: #2b2d31;
  --chat: #313338;
  --rodape: #232428;
  --hover: #35373c;
  --ativo: #404249;
  --msg-hover: #2e3035;
  --input: #383a40;
  --texto: #dbdee1;
  --forte: #f2f3f5;
  --texto-2: #949ba4;
  --texto-3: #80848e;
  --acento: #5865f2;
  --acento-hover: #4752c4;
  --verde: #23a55a;
  --vermelho: #da373c;
  --borda: #1f2023;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--chat);
  color: var(--texto);
  font: 15px/1.375 "gg sans", "Noto Sans", "Segoe UI", system-ui, sans-serif;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

.ic { width: 20px; height: 20px; flex: none; display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

input, select {
  font: inherit;
  color: var(--texto);
  background: #1e1f22;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  outline: none;
  width: 100%;
}

/* ---------- login ---------- */
#login {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(ellipse at 20% 10%, #5865f255 0, transparent 50%),
    radial-gradient(ellipse at 80% 90%, #23a55a33 0, transparent 50%),
    #1e1f22;
}

.cartao {
  width: min(480px, 100%);
  background: var(--chat);
  padding: 32px;
  border-radius: 8px;
  display: grid;
  gap: 18px;
  box-shadow: 0 8px 24px #0006;
}
.cartao h1 { margin: 0; font-size: 24px; text-align: center; color: var(--forte); }
.cartao .sub { margin: -14px 0 4px; text-align: center; color: var(--texto-2); }
.cartao label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #b5bac1;
}
.req { color: var(--vermelho); }

.btn-primario {
  background: var(--acento);
  color: #fff;
  border-radius: 4px;
  padding: 11px;
  font-weight: 600;
  transition: background .15s;
}
.btn-primario:hover { background: var(--acento-hover); }
.btn-link { color: #00a8fc; font-size: 14px; justify-self: center; }
.btn-link:hover { text-decoration: underline; }
.abas-login { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--input); border-radius: 8px; }
.abas-login button { padding: 8px; border-radius: 6px; font-weight: 600; color: var(--texto-2); }
.abas-login button.ativa { background: var(--ativo); color: var(--forte); }
.abas-login button:hover:not(.ativa) { color: var(--texto); }
.dica-login { margin: -8px 0 0; font-size: 12px; color: var(--texto-2); }
#erro-login { margin: -6px 0 0; min-height: 1.2em; color: #fa777c; text-align: center; font-size: 14px; }

/* ---------- layout ---------- */
#app {
  height: 100%;
  display: grid;
  grid-template-columns: 72px 240px 1fr;
}

/* barra de servidores */
#rail {
  background: var(--rail);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.rail-item { position: relative; width: 100%; display: flex; justify-content: center; }
.pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 40px;
  margin-top: -20px;
  border-radius: 0 4px 4px 0;
  background: var(--forte);
}
.icone-servidor {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--acento), #9b59f5);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.rail-sep { width: 32px; height: 2px; background: #35363c; border-radius: 1px; }
.rail-botao {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--chat);
  color: var(--verde);
  display: grid;
  place-items: center;
  transition: border-radius .15s, background .15s, color .15s;
}
.rail-botao:hover { border-radius: 16px; background: var(--vermelho); color: #fff; }

/* barra de canais */
#sidebar {
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.servidor-cab {
  height: 48px;
  flex: none;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--forte);
  box-shadow: 0 1px 0 #0003, 0 2px 0 #0000000d;
}
.servidor-cab .ic { width: 18px; height: 18px; }

.lista-canais { flex: 1; overflow-y: auto; padding: 8px 8px 8px 8px; }
.lista-canais ul { list-style: none; margin: 0; padding: 0; }

.categoria {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 16px 0 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--texto-2);
  cursor: pointer;
  user-select: none;
}
.categoria:hover { color: var(--texto); }
.categoria .ic { width: 12px; height: 12px; transition: transform .15s; }
.categoria.recolhida .ic { transform: rotate(-90deg); }

.canal {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  margin: 1px 0;
  border-radius: 4px;
  color: var(--texto-2);
  cursor: pointer;
  user-select: none;
}
.canal .ic { color: var(--texto-3); }
.canal:hover { background: var(--hover); color: var(--texto); }
.canal.ativo { background: var(--ativo); color: var(--forte); }
.canal.nao-lido { color: var(--forte); font-weight: 600; }
.canal { position: relative; }
.canal.nao-lido::before {
  content: "";
  position: absolute;
  left: -8px;
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--forte);
}

.membros-voz { padding: 0 0 4px 30px !important; }
.usuario-voz {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--texto-2);
}
.usuario-voz:hover { background: var(--hover); color: var(--texto); }
.usuario-voz .nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-voz .ic { width: 16px; height: 16px; color: var(--texto-3); }
.usuario-voz .ic.vermelho { color: var(--vermelho); }

.badge-vivo {
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--vermelho);
  color: #fff;
  line-height: 16px;
}

/* avatares */
.avatar {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  transition: box-shadow .1s;
}
.avatar.falando { box-shadow: 0 0 0 2px var(--verde); }
.avatar .status-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--verde);
  border: 3px solid var(--status-borda, var(--sidebar));
}

/* painel "voz conectada" */
#painel-voz {
  background: var(--rodape);
  border-bottom: 1px solid #2e2f34;
  padding: 8px;
}
.linha-voz { display: flex; align-items: center; gap: 8px; padding: 0 0 8px 4px; }
.info-voz { flex: 1; display: grid; min-width: 0; font-size: 13px; }
.info-voz .conectado { display: flex; align-items: center; gap: 4px; color: var(--verde); font-weight: 600; font-size: 14px; }
.info-voz .conectado .ic { width: 16px; height: 16px; }
#nome-canal-voz { color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.botoes-voz { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.botoes-voz button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border-radius: 4px;
  background: #2b2d31;
  font-size: 14px;
  color: var(--texto);
}
.botoes-voz button:hover { background: var(--hover); }
.botoes-voz button.ligado { background: var(--verde); color: #fff; }
.botoes-voz .ic { width: 18px; height: 18px; }

/* painel do usuário */
.painel-usuario {
  height: 52px;
  flex: none;
  background: var(--rodape);
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  --status-borda: var(--rodape);
}
.eu {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 4px;
}
.eu:hover { background: var(--hover); }
.eu .avatar { width: 32px; height: 32px; font-size: 14px; }
.eu-txt { display: grid; min-width: 0; line-height: 1.2; }
#meu-nome { font-size: 14px; font-weight: 600; color: var(--forte); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eu-txt .status { font-size: 12px; color: var(--texto-2); }

.btn-icone {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #b5bac1;
}
.btn-icone:hover { background: var(--hover); color: var(--texto); }
.btn-icone.desligado { color: var(--vermelho); }
.btn-sair-voz.btn-icone { color: var(--texto); }
.btn-sair-voz.btn-icone:hover { color: var(--vermelho); }

/* ---------- área principal ---------- */
main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat); }

.topo {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 16px;
  box-shadow: 0 1px 0 #0003, 0 2px 0 #0000000d;
  z-index: 1;
}
#icone-canal { color: var(--texto-3); }
#icone-canal .ic { width: 24px; height: 24px; }
#titulo-canal { font-weight: 600; color: var(--forte); white-space: nowrap; }
#topico {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--texto-2);
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid #3f4147;
}
#topico:empty { border: 0; }
.topo-acoes { display: flex; gap: 8px; }
#btn-membros.ativo { color: var(--forte); }
#btn-menu { display: none; font-size: 20px; }

.corpo { flex: 1; display: flex; min-height: 0; }

/* chat */
#view-texto { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#mensagens { flex: 1; overflow-y: auto; padding: 16px 0 8px; }

.boas-vindas { padding: 16px 16px 8px; }
.boas-vindas .bola {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #41434a;
  display: grid;
  place-items: center;
  color: var(--forte);
}
.boas-vindas .bola .ic { width: 40px; height: 40px; }
.boas-vindas h2 { margin: 8px 0 4px; font-size: 32px; color: var(--forte); }
.boas-vindas p { margin: 0; color: var(--texto-2); }

.divisor-data {
  display: flex;
  align-items: center;
  margin: 24px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-2);
}
.divisor-data::before, .divisor-data::after { content: ""; flex: 1; height: 1px; background: #3f4147; }
.divisor-data span { padding: 0 6px; }

.msg {
  position: relative;
  padding: 2px 48px 2px 72px;
  min-height: 22px;
}
.msg:hover { background: var(--msg-hover); }
.msg.inicio { margin-top: 17px; min-height: 44px; }
.msg .avatar {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 40px;
  height: 40px;
  font-size: 16px;
}
.msg .cabecalho { display: flex; gap: 8px; align-items: baseline; }
.msg .autor { font-weight: 500; color: var(--forte); }
.msg .hora { font-size: 12px; color: var(--texto-2); }
.msg .hora-lateral {
  position: absolute;
  left: 0;
  width: 64px;
  text-align: right;
  font-size: 11px;
  line-height: 22px;
  color: var(--texto-2);
  opacity: 0;
}
.msg:hover .hora-lateral { opacity: 1; }
.linha { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--texto); }
.linha a { color: #00a8fc; text-decoration: none; }
.linha a:hover { text-decoration: underline; }
.linha img.preview {
  display: block;
  max-width: min(400px, 100%);
  max-height: 300px;
  border-radius: 8px;
  margin: 4px 0;
  cursor: zoom-in;
}

#form-msg { padding: 0 16px; flex: none; }
.caixa-msg {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--input);
  border-radius: 8px;
  padding: 0 16px 0 12px;
}
.caixa-msg .mais { color: #b5bac1; background: none; border: 0; padding: 0; display: flex; cursor: pointer; }
.caixa-msg .mais:hover { color: #dbdee1; }
.caixa-msg .mais .ic { width: 24px; height: 24px; }
#input-msg { background: transparent; padding: 11px 8px; }
#input-msg::placeholder { color: #6d6f78; }
#digitando { height: 24px; font-size: 13px; line-height: 24px; color: var(--texto); padding-left: 4px; }
#digitando b { font-weight: 700; }

/* lista de membros */
#membros {
  width: 240px;
  flex: none;
  background: var(--sidebar);
  overflow-y: auto;
  padding: 8px 8px 16px;
}
#membros h3 {
  margin: 16px 8px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--texto-2);
}
#online { list-style: none; margin: 0; padding: 0; }
.membro {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 8px;
  border-radius: 4px;
  color: var(--texto-2);
}
.membro:hover { background: var(--hover); color: var(--texto); }
.membro .avatar { width: 32px; height: 32px; font-size: 14px; }
.membro .nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.membro .atividade { display: block; font-size: 12px; font-weight: 400; color: var(--texto-2); }

/* ---------- chamada ---------- */
#view-voz { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #000; }

#grid {
  flex: 1;
  min-height: 0;
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* sem ninguém transmitindo: todo mundo em grade */
#palco { display: none; }
#tira {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  align-content: center;
}
#tira .tile.tela { grid-column: 1 / -1; max-height: 72vh; }

/* com destaque: vídeo grande em cima, pessoas numa faixa embaixo */
#grid.foco #palco { display: flex; flex: 1; min-height: 0; }
#grid.foco #tira {
  flex: none;
  height: clamp(72px, 17vh, 150px);
  display: flex;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}
#grid.foco.sem-tira #tira { display: none; }
#palco .tile { flex: 1; aspect-ratio: auto; max-height: none; width: 100%; height: 100%; }
#palco .tile video { object-fit: contain; }
#grid.foco #tira .tile { height: 100%; flex: none; max-height: none; }
#grid.foco #tira .tile .capa .avatar { width: 44px; height: 44px; font-size: 18px; }
#grid.foco #tira .rotulo { left: 4px; bottom: 4px; right: 4px; }
#grid.foco #tira .nome-tile { font-size: 12px; padding: 1px 6px; max-width: 100%; overflow: hidden; white-space: nowrap; }
#grid.foco #tira .rotulo input[type=range], #grid.foco #tira .btn-cheia { display: none; }
.tile { cursor: pointer; }
#btn-tira.desligado { color: var(--texto-2); }

.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--tile-cor, #2b2d31);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  transition: box-shadow .1s;
}
.tile.falando::after { box-shadow: inset 0 0 0 3px var(--verde); }

.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: none;
}
.tile.tela video { object-fit: contain; }
.tile.com-video video { display: block; }
.tile.com-video .capa { display: none; }
.tile video.espelhado { transform: scaleX(-1); }

.tile .capa .avatar { width: 80px; height: 80px; font-size: 32px; box-shadow: none !important; }

.tile:fullscreen { border-radius: 0; max-height: none; }

.rotulo {
  position: absolute;
  left: 8px;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.rotulo > * { pointer-events: auto; }
.nome-tile {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #000000a0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.nome-tile .ic { width: 14px; height: 14px; color: var(--vermelho); }
.rotulo input[type=range] {
  width: 90px;
  padding: 0;
  background: none;
  accent-color: var(--acento);
  opacity: 0;
  transition: opacity .15s;
}
.btn-cheia {
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #000000a0;
  border-radius: 4px;
  color: #fff;
  opacity: 0;
  transition: opacity .15s;
}
.btn-cheia .ic { width: 16px; height: 16px; }
.tile:hover input[type=range], .tile:hover .btn-cheia { opacity: 1; }

.controles-chamada {
  flex: none;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}
.btn-redondo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2b2d31;
  color: var(--forte);
  transition: background .15s;
}
.btn-redondo .ic { width: 24px; height: 24px; }
.btn-redondo:hover { background: #3a3c42; }
.btn-redondo.ligado { background: var(--forte); color: #000; }
.btn-redondo.desligado { background: var(--forte); color: var(--vermelho); }
.btn-redondo.perigo { background: var(--vermelho); color: #fff; }
.btn-redondo.perigo:hover { background: #a12828; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000000b3;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-caixa {
  width: min(480px, 100%);
  background: var(--chat);
  border-radius: 8px;
  padding: 20px 24px 24px;
  display: grid;
  gap: 18px;
}
.modal-caixa header { display: flex; align-items: center; justify-content: space-between; }
.modal-caixa h2 { margin: 0; font-size: 20px; color: var(--forte); }
.modal-caixa h3 { margin: 0 0 6px; font-size: 16px; color: var(--forte); }
.modal-caixa p { margin: 0 0 6px; font-size: 14px; color: var(--texto-2); }
.modal-caixa label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #b5bac1;
}
.linha-copiar {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: #1e1f22;
  border-radius: 4px;
  text-transform: none;
}
.linha-copiar input { padding: 6px 8px; font-weight: 400; user-select: all; }
.linha-copiar button { flex: none; padding: 6px 18px; }
.linha-copiar button.copiado { background: var(--verde); }
#convite-extra:empty { display: none; }
.modal-caixa .btn-link { justify-self: start; }
.info-tela { margin-left: 6px; font-size: 11px; font-weight: 600; opacity: .75; }
.linha-cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-caixa .dica-cfg { margin: -10px 0 0; font-size: 12px; }

.servidor-cab .btn-icone { width: 28px; height: 28px; }
.servidor-cab .btn-icone .ic { width: 18px; height: 18px; }
.rail-botao.btn-convidar:hover { background: var(--verde); }
.eu { cursor: pointer; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: #111214;
  color: var(--texto);
  padding: 10px 16px;
  border-radius: 6px;
  box-shadow: 0 8px 16px #0006;
  font-size: 14px;
  z-index: 30;
}

/* ---------- telas pequenas ---------- */
@media (max-width: 1000px) {
  #membros { display: none; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  #btn-menu { display: grid; }
  #rail, #sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 5;
    transform: translateX(-312px);
    transition: transform .2s;
  }
  #rail { left: 0; width: 72px; }
  #sidebar { left: 72px; width: min(240px, calc(100vw - 72px)); box-shadow: 8px 0 24px #0008; }
  #app.menu-aberto #rail, #app.menu-aberto #sidebar { transform: none; }
  .rotulo input[type=range], .btn-cheia { opacity: 1 !important; }
  #topico { display: none; }
}

/* ---------- servidor, canais e admin ---------- */
.servidor-cab { gap: 4px; }
#servidor-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icone-servidor { font-size: 15px; letter-spacing: -.02em; background-size: cover; background-position: center; }
.icone-servidor.com-imagem { background-color: transparent; }
.icone-servidor.grande { width: 80px; height: 80px; border-radius: 24px; font-size: 24px; cursor: default; }
.categoria .titulo-cat { flex: 1; }
.btn-add-canal { width: 18px; height: 18px; border-radius: 4px; font-size: 16px; line-height: 1; color: var(--texto-2); }
.btn-add-canal:hover { color: var(--forte); }
.btn-secundario {
  background: #4e5058;
  color: #fff;
  border-radius: 4px;
  padding: 8px 14px;
  font-weight: 500;
  transition: background .15s;
}
.btn-secundario:hover { background: #6d6f78; }
textarea {
  font: inherit;
  color: var(--texto);
  background: #1e1f22;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  outline: none;
  width: 100%;
  resize: vertical;
}

/* foto de perfil no lugar da inicial */
.avatar.com-foto { background-size: cover !important; background-position: center !important; }
.avatar.grande { width: 80px; height: 80px; font-size: 32px; }
.avatar.grande .status-dot { width: 20px; height: 20px; right: 0; bottom: 0; border-width: 5px; }
.coroa { width: 14px !important; height: 14px !important; margin-left: 4px; color: #f0b232; vertical-align: -2px; flex: none; }

/* membros offline */
#titulo-offline { margin-top: 20px; }
.membro.offline { opacity: .45; }
.membro.offline:hover { opacity: 1; }
.membro .nome-linha { display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; }
.usuario-voz { cursor: pointer; }
.msg .autor, .msg > .avatar { cursor: pointer; }
.msg .autor:hover { text-decoration: underline; }

/* ações da mensagem (editar, fixar, apagar) */
.acoes-msg {
  position: absolute;
  top: -14px;
  right: 16px;
  display: none;
  background: var(--chat);
  border: 1px solid var(--borda);
  border-radius: 6px;
  box-shadow: 0 2px 8px #0004;
  overflow: hidden;
}
.msg:hover .acoes-msg { display: flex; }
.acoes-msg button { width: 32px; height: 30px; display: grid; place-items: center; color: var(--texto-2); }
.acoes-msg button:hover { background: var(--hover); color: var(--forte); }
.acoes-msg button[title^="Apagar"]:hover { color: var(--vermelho); }
.acoes-msg .ic { width: 18px; height: 18px; }
.msg.fixada { box-shadow: inset 2px 0 0 #f0b232; }
.editada { font-size: 11px; color: var(--texto-3); white-space: nowrap; }
.editor-msg { padding: 4px 0; }
.editar-msg { background: var(--input); padding: 10px 12px; border-radius: 8px; resize: none; }
.dica-editar { font-size: 12px; color: var(--texto-2); padding-top: 4px; }
.dica-editar b { color: #00a8fc; font-weight: 500; }

/* popovers: mensagens fixadas e cartão de perfil */
.topo { position: relative; }
.popover {
  position: absolute;
  z-index: 15;
  background: #111214;
  border-radius: 8px;
  box-shadow: 0 8px 24px #0008;
  color: var(--texto);
}
#painel-fixadas {
  top: 44px;
  right: 8px;
  width: min(420px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  padding: 0 0 8px;
}
#painel-fixadas h3 { margin: 0; padding: 14px 16px; font-size: 16px; color: var(--forte); box-shadow: 0 1px 0 #0006; position: sticky; top: 0; background: #111214; }
#lista-fixadas { display: grid; gap: 8px; padding: 8px; }
#lista-fixadas .vazio { margin: 16px; text-align: center; color: var(--texto-2); font-size: 14px; }
.fixada-item { background: var(--sidebar); border-radius: 6px; padding: 10px 12px; display: grid; gap: 4px; }
.fixada-item .cabecalho { display: flex; align-items: center; gap: 8px; }
.fixada-item .autor { font-weight: 500; }
.fixada-item .hora { font-size: 12px; color: var(--texto-2); }
.fixada-item .btn-link { justify-self: end; font-size: 13px; }

#cartao-perfil { position: fixed; width: 300px; overflow: hidden; }
.perfil-banner { height: 60px; }
#cartao-perfil > .avatar { position: absolute; top: 16px; left: 16px; border: 6px solid #111214; box-sizing: content-box; }
#cartao-perfil > .avatar .status-dot { border-color: #111214; }
.avatar.sem-status .status-dot { display: none; }
.perfil-corpo { padding: 52px 16px 16px; display: grid; gap: 4px; }
.perfil-corpo h3 { margin: 0; font-size: 20px; color: var(--forte); display: flex; align-items: center; overflow-wrap: anywhere; }
.perfil-corpo h4 { margin: 10px 0 0; font-size: 12px; text-transform: uppercase; color: var(--texto); }
.perfil-status { margin: 0; font-size: 14px; color: var(--texto-2); }
.perfil-bio { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.perfil-acoes { margin-top: 12px; display: flex; gap: 8px; }
.perfil-acoes button { flex: 1; }

/* perfil nas configurações */
.cfg-perfil { display: grid; gap: 14px; padding: 14px; background: #2b2d31; border-radius: 8px; }
.cfg-foto { display: flex; align-items: center; gap: 16px; }
.cfg-foto .avatar { width: 72px; height: 72px; font-size: 28px; }
.cfg-foto-botoes { display: flex; align-items: center; gap: 12px; }
.linha-cor { display: flex; align-items: center; gap: 12px; text-transform: none; }
.linha-cor input[type=color] { width: 56px; height: 36px; padding: 2px; cursor: pointer; }

/* configurações do servidor */
.modal-larga { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-caixa section { display: grid; gap: 8px; }
.srv-topo { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.srv-icone { display: grid; justify-items: center; gap: 4px; }
.srv-icone .btn-link { font-size: 13px; }
.srv-canais, .srv-admins { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.srv-canal { display: flex; align-items: center; gap: 6px; background: #2b2d31; border-radius: 6px; padding: 4px 4px 4px 10px; }
.srv-canal > .ic { width: 18px; height: 18px; color: var(--texto-2); flex: none; }
.srv-canal input { padding: 7px 8px; background: #1e1f22; min-width: 0; }
.srv-canal .srv-topico { flex: 1.4; }
.srv-canal .btn-icone { width: 30px; height: 30px; flex: none; }
.srv-canal .btn-icone:disabled { opacity: .3; cursor: default; }
.srv-canal .btn-icone[title="Apagar canal"]:not(:disabled):hover { color: var(--vermelho); }
.srv-admins label { display: flex; align-items: center; gap: 10px; text-transform: none; font-size: 14px; font-weight: 500; color: var(--texto); cursor: pointer; }
.srv-admins input { width: 16px; height: 16px; accent-color: var(--acento); }
@media (max-width: 560px) {
  .srv-topo { grid-template-columns: 1fr; }
  .srv-canal { flex-wrap: wrap; }
}

/* ---------- menu de cada pessoa na chamada ---------- */
#menu-pessoa {
  position: fixed;
  width: 240px;
  padding: 6px 8px;
  display: grid;
  gap: 2px;
  font-size: 14px;
}
#menu-pessoa hr { width: 100%; border: 0; border-top: 1px solid #ffffff14; margin: 4px 0; }
.menu-titulo { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 600; color: var(--forte); overflow: hidden; }
.menu-titulo span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-slider { display: grid; gap: 4px; padding: 6px 4px; text-transform: none; font-weight: 400; color: var(--texto); }
.menu-linha { display: flex; justify-content: space-between; }
.menu-valor { color: var(--texto-2); font-variant-numeric: tabular-nums; }
.menu-slider input { padding: 0; accent-color: var(--acento); background: none; }
.menu-opcao, .menu-botao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 4px;
  border-radius: 4px;
  text-transform: none;
  font-weight: 400;
  font-size: 14px;
  color: var(--texto);
  cursor: pointer;
  text-align: left;
}
.menu-opcao:hover, .menu-botao:hover { background: var(--acento); color: #fff; }
.menu-opcao small { display: block; font-size: 12px; opacity: .7; }
.menu-opcao input { width: 16px; height: 16px; flex: none; accent-color: var(--acento); }
.usuario-voz.silenciado-pra-mim .nome { text-decoration: line-through; opacity: .6; }

/* ---------- prévia da transmissão ---------- */
#previa-tela {
  position: fixed;
  z-index: 16;
  width: 320px;
  background: #111214;
  border-radius: 8px;
  box-shadow: 0 8px 24px #0008;
  overflow: hidden;
  pointer-events: none;
}
#previa-tela video, #previa-tela img, .previa-vazia {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
}
.previa-vazia { display: grid; place-items: center; font-size: 13px; color: var(--texto-2); }
.previa-rotulo { display: flex; align-items: center; gap: 6px; padding: 8px 10px 0; font-weight: 600; color: var(--forte); font-size: 14px; }
.previa-dica { padding: 2px 10px 10px; font-size: 12px; color: var(--texto-2); }

/* ---------- vários servidores ---------- */
#lista-servidores { display: flex; flex-direction: column; gap: 8px; width: 100%; overflow-y: auto; scrollbar-width: none; }
#rail { overflow: hidden; }
.rail-item .pill { height: 0; margin-top: 0; transition: height .15s, margin-top .15s; }
.rail-item.nao-lido .pill { height: 8px; margin-top: -4px; }
.rail-item:hover .pill { height: 20px; margin-top: -10px; }
.rail-item.ativo .pill { height: 40px; margin-top: -20px; }
.rail-item .icone-servidor { border-radius: 50%; transition: border-radius .15s; }
.rail-item:hover .icone-servidor, .rail-item.ativo .icone-servidor { border-radius: 16px; }
#btn-novo-servidor { font-size: 26px; font-weight: 400; line-height: 1; }
#btn-novo-servidor:hover { background: var(--verde); }

.btn-menu-servidor {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-weight: 600;
  color: var(--forte);
  text-align: left;
  height: 100%;
}
.btn-menu-servidor .ic { width: 16px; height: 16px; flex: none; }
#menu-servidor { position: fixed; padding: 6px 8px; display: grid; gap: 2px; }
.menu-botao.perigo { color: var(--vermelho); }
.menu-botao.perigo:hover { background: var(--vermelho); color: #fff; }
.btn-primario.verde { background: var(--verde); }
.btn-primario.verde:hover { filter: brightness(1.1); }
.btn-perigo { justify-self: start; background: var(--vermelho); color: #fff; border-radius: 4px; padding: 9px 16px; font-weight: 500; }
.btn-perigo:hover { filter: brightness(1.1); }
.bloco-opcao { display: grid; gap: 8px; padding: 14px; background: #2b2d31; border-radius: 8px; }
.bloco-opcao h3 { margin: 0; font-size: 16px; color: var(--forte); }
.bloco-opcao .dica-cfg { margin: 0; }
#convite-codigo { color: var(--forte); user-select: all; }

/* sem nenhum servidor: só a barra da esquerda e a tela de criar/entrar */
#app.sem-servidor #sidebar > :not(.painel-usuario):not(#painel-voz),
#app.sem-servidor main > * { visibility: hidden; }

/* atualização do app pronta (só no app desktop) */
#btn-atualizar { margin-top: auto; background: var(--verde); color: #fff; animation: pulsar 2s ease-in-out infinite; }
#btn-atualizar:hover { border-radius: 16px; background: var(--verde); filter: brightness(1.1); animation: none; }
@keyframes pulsar { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--verde) 25%, transparent); } }

/* ---------- respostas, reações, menções ---------- */
.msg .acoes-msg { z-index: 2; }
.resposta-previa {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  color: var(--texto-2);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}
.resposta-previa::before {
  content: "";
  position: absolute;
  left: -38px;
  top: 9px;
  width: 30px;
  height: 10px;
  border: 2px solid #4e5058;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 6px;
}
.resposta-previa .avatar { position: static; width: 16px; height: 16px; font-size: 9px; flex: none; }
.resposta-previa .autor { font-weight: 500; white-space: nowrap; }
.resposta-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resposta-previa:hover .resposta-texto { color: var(--forte); }
.resposta-apagada { font-style: italic; }
.msg.com-resposta > .avatar { top: 26px; }
.msg.mencionado { background: #f0b2321a; box-shadow: inset 2px 0 0 #f0b232; }
.msg.mencionado:hover { background: #f0b23226; }
.msg.destaque { animation: destaque 2s ease-out; }
@keyframes destaque { from { background: #5865f24d; } to { background: transparent; } }
.mencao {
  background: #5865f24d;
  color: #c9cdfb;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 500;
  cursor: pointer;
}
.mencao:hover { background: var(--acento); color: #fff; }

.reacoes { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.reacao {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  background: #2b2d31;
  border: 1px solid transparent;
  color: var(--texto-2);
  font-size: 14px;
  cursor: pointer;
}
.reacao:hover { border-color: #4e5058; }
.reacao.minha { background: #5865f226; border-color: var(--acento); color: #c9cdfb; }
.reacao-emoji { font-size: 16px; line-height: 1; }
.reacao-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.reacao-add { opacity: 0; padding: 0 6px; }
.reacao-add .ic { width: 16px; height: 16px; }
.msg:hover .reacao-add { opacity: 1; }
#seletor-emoji {
  position: fixed;
  display: grid;
  grid-template-columns: repeat(8, 36px);
  gap: 2px;
  padding: 8px;
}
#seletor-emoji button { width: 36px; height: 36px; border-radius: 6px; font-size: 22px; line-height: 1; cursor: pointer; }
#seletor-emoji button:hover { background: var(--hover); }

#form-msg { position: relative; }
#barra-resposta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2b2d31;
  border-radius: 8px 8px 0 0;
  padding: 4px 8px 4px 16px;
  font-size: 13px;
  color: var(--texto-2);
}
#barra-resposta b { color: var(--forte); }
#barra-resposta .btn-icone { width: 24px; height: 24px; }
#barra-resposta:not([hidden]) + .caixa-msg { border-radius: 0 0 8px 8px; }
#sugestoes-mencao {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(100% + 4px);
  background: #2b2d31;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px #0008;
  z-index: 5;
}
.sugestoes-titulo { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--texto-2); padding: 0 8px 6px; }
.sugestao { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.sugestao.ativa, .sugestao:hover { background: var(--ativo); }
.sugestao .avatar { width: 24px; height: 24px; font-size: 11px; }
.sugestao small { margin-left: auto; color: var(--texto-2); font-size: 12px; }
.avatar-arroba { background: var(--acento); }
.carregando-mais { padding: 16px; text-align: center; font-size: 13px; color: var(--texto-2); }

/* ---------- arquivos ---------- */
.arquivo {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, 100%);
  margin: 4px 0;
  padding: 10px 12px;
  background: #2b2d31;
  border: 1px solid #1f2023;
  border-radius: 8px;
  white-space: normal;
}
.arquivo > .ic { width: 30px; height: 30px; flex: none; color: #b5bac1; }
.arquivo-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arquivo .btn-icone { flex: none; color: var(--texto-2); }
.arquivo .btn-icone:hover { color: var(--forte); }
.arquivo-midia { display: grid; gap: 4px; max-width: min(480px, 100%); }
.arquivo-midia .arquivo { margin: 0; }
.preview-video { width: 100%; max-height: 320px; border-radius: 8px; background: #000; margin-top: 4px; }
.arquivo-midia audio { width: 100%; }

/* ---------- busca ---------- */
.busca {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 160px;
  height: 26px;
  padding: 0 6px;
  border-radius: 4px;
  background: #1e1f22;
  text-transform: none;
  transition: width .15s;
  cursor: text;
}
.busca:focus-within { width: 240px; }
.busca input { background: none; padding: 0; font-size: 14px; min-width: 0; }
.busca .ic { width: 16px; height: 16px; flex: none; color: var(--texto-2); }
#painel-busca {
  top: 44px;
  right: 8px;
  width: min(440px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  padding: 0 0 8px;
}
#painel-busca h3 { margin: 0; padding: 14px 16px; font-size: 15px; color: var(--forte); box-shadow: 0 1px 0 #0006; position: sticky; top: 0; background: #111214; z-index: 1; }
#lista-busca { display: grid; gap: 8px; padding: 8px; }
#lista-busca .vazio { margin: 16px; text-align: center; color: var(--texto-2); font-size: 14px; }
.fixada-item.clicavel { cursor: pointer; }
.fixada-item.clicavel:hover { background: var(--hover); }
.busca-onde { font-size: 12px; font-weight: 600; color: var(--texto-2); }
@media (max-width: 760px) {
  .busca, .busca:focus-within { width: 120px; }
}

/* ---------- status ---------- */
.avatar .status-dot[data-status="ausente"] { background: #f0b232; }
.avatar .status-dot[data-status="ocupado"] { background: var(--vermelho); }
.avatar .status-dot[data-status="invisivel"] { background: #80848e; }
.eu { cursor: pointer; }
#menu-status { position: fixed; width: 260px; padding: 8px; display: grid; gap: 2px; }
#menu-status input { margin-bottom: 6px; font-size: 14px; }
#menu-status hr { width: 100%; border: 0; border-top: 1px solid #ffffff14; margin: 4px 0; }
#menu-status .menu-botao { justify-content: flex-start; }
#menu-status .menu-botao small { display: block; font-size: 12px; opacity: .7; }
#menu-status .menu-botao.ativo { background: var(--ativo); }
.bolinha { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--verde); }
.bolinha[data-status="ausente"] { background: #f0b232; }
.bolinha[data-status="ocupado"] { background: var(--vermelho); }
.bolinha[data-status="invisivel"] { background: #80848e; }
.perfil-status-texto { margin: 4px 0 0; font-size: 14px; color: var(--texto); }

/* ---------- menções / mensagens novas na barra ---------- */
.badge-mencao {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--vermelho);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  flex: none;
}
.canal .badge-mencao { margin-left: auto; }
.rail-item .badge-mencao {
  position: absolute;
  right: 6px;
  bottom: -2px;
  height: 20px;
  min-width: 20px;
  line-height: 14px;
  border: 3px solid var(--rail);
  border-radius: 10px;
  pointer-events: none;
}

/* ---------- mensagens diretas ---------- */
.icone-dm { background: var(--chat); color: var(--texto); }
.icone-dm .ic { width: 24px; height: 24px; }
#btn-dms:hover .icone-dm, #btn-dms.ativo .icone-dm { background: var(--acento); color: #fff; }
.lista-dms { flex: 1; overflow-y: auto; padding: 8px; }
.lista-dms ul { list-style: none; margin: 0; padding: 0; }
.titulo-dms { padding: 12px 8px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--texto-2); }
.canal.dm { height: 42px; gap: 10px; }
.canal.dm .avatar { width: 32px; height: 32px; font-size: 13px; }
.canal.dm > span:not(.avatar):not(.badge-mencao) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dica-dms { margin: 8px; font-size: 13px; color: var(--texto-2); }
.btn-menu-servidor.sem-menu { cursor: default; }
.btn-menu-servidor.sem-menu .ic { display: none; }
.perfil-acoes { flex-wrap: wrap; }

/* ---------- atalhos nas configurações ---------- */
.cfg-secao { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; color: var(--texto-2); }
.btn-tecla {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 4px;
  background: #1e1f22;
  color: var(--forte);
  font: inherit;
  font-size: 14px;
  text-transform: none;
  text-align: left;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-tecla:hover { border-color: #4e5058; }
.btn-tecla.capturando { border-color: var(--vermelho); color: var(--vermelho); }

/* ---------- configurações em abas ---------- */
.modal-config {
  width: min(880px, 100%);
  height: min(660px, calc(100vh - 32px));
  padding: 0;
  gap: 0;
  grid-template-columns: 210px 1fr;
  overflow: hidden;
}
.cfg-abas { background: var(--sidebar); padding: 20px 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.cfg-abas-titulo { padding: 10px 10px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--texto-2); }
.cfg-abas button { text-align: left; padding: 7px 10px; border-radius: 4px; color: var(--texto-2); font-size: 15px; white-space: nowrap; }
.cfg-abas button:hover { background: var(--hover); color: var(--texto); }
.cfg-abas button.ativa { background: var(--ativo); color: var(--forte); }
.cfg-abas button.perigo { color: var(--vermelho); }
.cfg-abas hr { width: 100%; border: 0; border-top: 1px solid #ffffff14; margin: 8px 0; }
.cfg-versao { margin: auto 0 0; padding: 8px 10px 0; font-size: 12px; color: var(--texto-3); }
.cfg-conteudo { padding: 20px 24px 24px; overflow-y: auto; display: grid; align-content: start; gap: 18px; }
.cfg-conteudo section { display: grid; gap: 18px; }
.cfg-versoes { display: grid; gap: 8px; padding: 14px; background: #2b2d31; border-radius: 8px; }
.cfg-versoes div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.cfg-versoes span { color: var(--texto-2); }
.cfg-versoes b { color: var(--forte); font-weight: 600; }
#btn-ver-novidades { justify-self: start; }
@media (max-width: 640px) {
  .modal-config { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 32px); }
  .cfg-abas { flex-direction: row; overflow-x: auto; padding: 8px; }
  .cfg-abas-titulo, .cfg-abas hr, .cfg-versao { display: none; }
}

/* ---------- novidades ---------- */
.modal-novidades { max-height: calc(100vh - 32px); overflow-y: auto; }
#lista-novidades { display: grid; gap: 16px; }
.novidade-versao h3 { margin: 0 0 6px; }
.novidade-versao ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; color: var(--texto); }
#btn-ok-novidades { justify-self: end; padding: 10px 28px; }
