/* Identidade visual DiscMotiva - base do ReadyRoom (Bootstrap 5 dark + Inter)
   com paleta própria, camada de motion design e shell de chat estilo Discord
   (rail + canais + chat + membros). Ver DOCUMENTACAO_TECNICA.md. */

:root {
    --dm-primary: #007BBB;
    --dm-primary-rgb: 0, 123, 187;
    --dm-secondary: #0B2545;
    --dm-secondary-rgb: 11, 37, 69;
    --dm-accent: #22D3EE;
    --dm-accent-rgb: 34, 211, 238;
    --dm-success: #1F9D55;

    /* Cor de texto/realces translúcidos. É branco no escuro (nada muda) e vira
       escuro no tema claro - por isso os rgba(...) do CSS usam esta variável. */
    --dm-fg-rgb: 255, 255, 255;

    /* Fundo da página: gradiente COMPLEMENTAR ao tema (não sólido). Cada tema o
       redefine com o próprio tom; as duas luzes de accent ficam por cima (body). */
    --dm-bg: radial-gradient(circle at 50% -12%, #131a26, #0d111a 62%);

    /* Superfícies do shell de chat (mais escuro -> mais claro) */
    --dm-rail: #0a101c;
    --dm-col: #101827;
    --dm-main: #141c2b;
    --dm-raised: #1c2536;

    --dm-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dm-ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Temas (paleta trocável no perfil) --------------------------------
   Cada tema sobrescreve só o trio primary/secondary/accent (+ rgb) sobre o mesmo
   shell escuro. Como botões, gradientes, foco e até o brilho do fundo referenciam
   essas variáveis, trocar aqui muda o app inteiro. Seleciona-se por [data-theme]
   em QUALQUER elemento: o <html> recebe o tema global; cada miniatura do perfil
   recebe o seu, então mostra a própria paleta independente do tema ativo. */
[data-theme="padrao"] {
    --dm-primary: #007BBB; --dm-primary-rgb: 0, 123, 187;
    --dm-secondary: #0B2545; --dm-secondary-rgb: 11, 37, 69;
    --dm-accent: #22D3EE; --dm-accent-rgb: 34, 211, 238;
    --dm-bg: radial-gradient(circle at 50% -12%, #131a26, #0d111a 62%);
}
[data-theme="ametista"] {
    --dm-primary: #7C3AED; --dm-primary-rgb: 124, 58, 237;
    --dm-secondary: #2E1065; --dm-secondary-rgb: 46, 16, 101;
    --dm-accent: #C084FC; --dm-accent-rgb: 192, 132, 252;
    --dm-bg: radial-gradient(circle at 50% -12%, #17102a, #0d0a16 62%);
}
[data-theme="esmeralda"] {
    --dm-primary: #059669; --dm-primary-rgb: 5, 150, 105;
    --dm-secondary: #064E3B; --dm-secondary-rgb: 6, 78, 59;
    --dm-accent: #34D399; --dm-accent-rgb: 52, 211, 153;
    --dm-bg: radial-gradient(circle at 50% -12%, #0c1c16, #07110c 62%);
}
[data-theme="por-do-sol"] {
    --dm-primary: #EA580C; --dm-primary-rgb: 234, 88, 12;
    --dm-secondary: #4A1D05; --dm-secondary-rgb: 74, 29, 5;
    --dm-accent: #FBBF24; --dm-accent-rgb: 251, 191, 36;
    --dm-bg: radial-gradient(circle at 50% -12%, #1e140b, #110b05 62%);
}
[data-theme="framboesa"] {
    --dm-primary: #DB2777; --dm-primary-rgb: 219, 39, 119;
    --dm-secondary: #500724; --dm-secondary-rgb: 80, 7, 36;
    --dm-accent: #F472B6; --dm-accent-rgb: 244, 114, 182;
    --dm-bg: radial-gradient(circle at 50% -12%, #1f0f18, #11080d 62%);
}
[data-theme="grafite"] {
    --dm-primary: #64748B; --dm-primary-rgb: 100, 116, 139;
    --dm-secondary: #1E293B; --dm-secondary-rgb: 30, 41, 59;
    --dm-accent: #94A3B8; --dm-accent-rgb: 148, 163, 184;
    --dm-bg: radial-gradient(circle at 50% -12%, #161b24, #0c0f15 62%);
}

/* Tema CLARO: inverte a cor de texto (--dm-fg-rgb vira escuro), clareia as
   superfícies do shell e o fundo. O <html> também recebe data-bs-theme="light"
   (script no <head>), então os componentes do Bootstrap acompanham. */
[data-theme="claro"] {
    --dm-fg-rgb: 28, 37, 54;
    --dm-primary: #0369A1; --dm-primary-rgb: 3, 105, 161;
    --dm-secondary: #0B2545; --dm-secondary-rgb: 11, 37, 69;
    --dm-accent: #0891B2; --dm-accent-rgb: 8, 145, 178;
    --dm-bg: radial-gradient(circle at 50% -12%, #f4f8fd, #e7eef7 70%);
    --dm-rail: #dce4ef;
    --dm-col: #e9eff6;
    --dm-main: #f5f8fc;
    --dm-raised: #ffffff;
}

/* ---------- Seletor de temas + miniaturas (perfil) ---------- */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 0.8rem; }
.theme-card {
    display: flex; flex-direction: column; gap: 0.5rem; padding: 0.5rem; cursor: pointer; text-align: left;
    background: rgba(var(--dm-fg-rgb), 0.03); border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    border-radius: 12px; transition: border-color 0.15s var(--dm-ease), transform 0.15s var(--dm-ease);
}
.theme-card:hover { transform: translateY(-2px); border-color: rgba(var(--dm-fg-rgb), 0.28); }
.theme-card.active { border-color: var(--dm-accent); box-shadow: 0 0 0 1px var(--dm-accent); }
.theme-card-name { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; font-weight: 600; padding: 0 0.15rem; }
.theme-card-check { color: var(--dm-accent); opacity: 0; transition: opacity 0.15s; }
.theme-card.active .theme-card-check { opacity: 1; }

/* Miniatura = mini-app na paleta do PRÓPRIO card ([data-theme] no elemento). */
.theme-preview {
    height: 84px; border-radius: 8px; overflow: hidden; display: flex;
    background:
        radial-gradient(circle at 12% 0%, rgba(var(--dm-primary-rgb), 0.30), transparent 55%),
        radial-gradient(circle at 92% 115%, rgba(var(--dm-accent-rgb), 0.22), transparent 55%),
        var(--dm-bg);
}
.tp-rail { width: 22px; background: var(--dm-rail); display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 6px; }
.tp-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(var(--dm-fg-rgb), 0.16); }
.tp-dot.on { border-radius: 30%; background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent)); }
.tp-main { flex: 1; padding: 7px 8px; display: flex; flex-direction: column; gap: 5px; }
.tp-head { height: 8px; width: 62%; border-radius: 3px; background: linear-gradient(90deg, var(--dm-primary), var(--dm-secondary)); }
.tp-msg { height: 6px; border-radius: 3px; background: rgba(var(--dm-fg-rgb), 0.14); }
.tp-msg.short { width: 45%; }
.tp-msg.me { width: 68%; align-self: flex-end; background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent)); }
.tp-btn { margin-top: auto; height: 10px; width: 42px; border-radius: 4px; align-self: flex-start; background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent)); }

* {
    scrollbar-color: rgba(var(--dm-primary-rgb), 0.5) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(var(--dm-primary-rgb), 0.45);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--dm-primary-rgb), 0.7);
    background-clip: padding-box;
}

body {
    font-family: "Inter", system-ui, sans-serif;
    background:
        radial-gradient(circle at 15% 0%, rgba(var(--dm-primary-rgb), 0.12), transparent 46%),
        radial-gradient(circle at 85% 100%, rgba(var(--dm-accent-rgb), 0.10), transparent 46%),
        var(--dm-bg);
    background-attachment: fixed;
    animation: bodyFadeIn 0.4s var(--dm-ease) both;
}

@keyframes bodyFadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.55s var(--dm-ease) both; }

/* ---------- Avatares (chat, membros, painel do usuário) ---------- */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: hsl(var(--hue, 205) 55% 42%);
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    transition: transform 0.2s var(--dm-ease-snap);
}

.avatar:hover { transform: scale(1.08); }
.avatar-sm { width: 30px; height: 30px; font-size: 0.66rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar-spacer { width: 38px; flex-shrink: 0; }

/* Avatar renderizado como <img> (foto de perfil) - cobre o círculo */
img.avatar { object-fit: cover; background: #0d1420; }

/* ---------- Tela de login ---------- */

.auth-shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
    animation: blobFloat 16s ease-in-out infinite alternate;
}

.auth-blob-1 {
    width: 420px; height: 420px; top: -120px; left: -100px;
    background: radial-gradient(circle, var(--dm-primary), transparent 70%);
    animation-duration: 18s;
}

.auth-blob-2 {
    width: 380px; height: 380px; bottom: -140px; right: -100px;
    background: radial-gradient(circle, var(--dm-accent), transparent 70%);
    animation-duration: 22s;
    animation-delay: -4s;
}

.auth-blob-3 {
    width: 280px; height: 280px; bottom: 10%; left: 8%;
    background: radial-gradient(circle, var(--dm-secondary), transparent 70%);
    animation-duration: 14s;
    animation-delay: -8s;
    opacity: 0.4;
}

@keyframes blobFloat {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(30px, -20px) scale(1.08); }
    100% { transform: translate(-20px, 25px) scale(0.96); }
}

.card-auth {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    background: rgba(23, 28, 37, 0.72) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.06) !important;
}

/* ---------- Login: foco minimal (sem card) ---------- */

/* Coluna central sem card: a marca e os campos sobre o fundo do app. */
.auth-focus {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.auth-focus-head {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.6rem;
}
.auth-focus-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; margin: 0.35rem 0 0; }
.auth-focus-sub { color: rgba(var(--dm-fg-rgb), 0.6); font-size: 0.85rem; margin: 0; max-width: 32ch; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; }
.auth-label { font-size: 0.8rem; font-weight: 600; color: rgba(var(--dm-fg-rgb), 0.75); }
.auth-err { font-size: 0.78rem; color: #ff9c9c; }

.auth-pass { position: relative; display: block; }
.auth-pass .form-control { padding-right: 2.7rem; }
.auth-pass-toggle {
    position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
    width: 2rem; height: 2rem; border: none; background: none; cursor: pointer;
    color: rgba(var(--dm-fg-rgb), 0.5); border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.15s var(--dm-ease), background 0.15s var(--dm-ease);
}
.auth-pass-toggle:hover { color: #fff; background: rgba(var(--dm-fg-rgb), 0.08); }
.auth-pass-toggle.on { color: var(--dm-accent); }

.auth-caps { font-size: 0.76rem; color: #ffcf7a; }
.auth-caps[hidden] { display: none; }

.auth-submit { margin-top: 0.4rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.auth-submit.is-loading { opacity: 0.9; pointer-events: none; }
.auth-spin {
    display: none; width: 1rem; height: 1rem; border-radius: 50%;
    border: 2px solid rgba(var(--dm-fg-rgb), 0.5); border-top-color: #fff;
    animation: authSpin 0.6s linear infinite;
}
.auth-submit.is-loading .auth-spin { display: inline-block; }
@keyframes authSpin { to { transform: rotate(360deg); } }


/* ---------- Marca ---------- */

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 0 0 0 rgba(var(--dm-primary-rgb), 0.55);
    animation: brandPulse 3.2s ease-in-out infinite;
}

.brand-mark-lg { width: 44px; height: 44px; font-size: 1.05rem; border-radius: 12px; }
.brand-mark-xl { width: 72px; height: 72px; font-size: 1.6rem; border-radius: 20px; }

@keyframes brandPulse {
    0%   { box-shadow: 0 0 0 0 rgba(var(--dm-primary-rgb), 0.45); }
    70%  { box-shadow: 0 0 0 10px rgba(var(--dm-primary-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--dm-primary-rgb), 0); }
}

.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dm-success);
    box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.6);
    animation: onlinePulse 2.2s ease-in-out infinite;
}

@keyframes onlinePulse {
    0%   { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(31, 157, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0); }
}

/* ---------- Botões e formulários ---------- */

.btn {
    transition: transform 0.15s var(--dm-ease-snap), box-shadow 0.25s var(--dm-ease), filter 0.2s var(--dm-ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--dm-primary), #0091d6);
    border-color: var(--dm-primary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0091d6, var(--dm-accent));
    border-color: var(--dm-accent);
    box-shadow: 0 6px 18px -6px rgba(var(--dm-primary-rgb), 0.6);
}

.btn-send.is-sending { animation: sendPulse 0.3s var(--dm-ease-snap); }

@keyframes sendPulse {
    0% { transform: scale(1); } 50% { transform: scale(0.9); } 100% { transform: scale(1); }
}

.form-control, .form-select {
    transition: border-color 0.2s var(--dm-ease), box-shadow 0.2s var(--dm-ease), background-color 0.2s var(--dm-ease);
}

.form-control:focus, .form-select:focus {
    border-color: var(--dm-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--dm-primary-rgb), 0.22);
}

/* ================================================================
   SHELL DE CHAT (estilo Discord): rail | canais | chat | membros
   ================================================================ */

body.chat-shell {
    overflow: hidden;
    animation: none;
}

.chat-app {
    position: relative;
    display: grid;
    grid-template-columns: var(--rail-w, 72px) var(--chan-w, 240px) 1fr 240px;
    height: 100vh;
    height: 100dvh;  /* mobile: desconta a barra do navegador (evita corte/scroll) */
    animation: bodyFadeIn 0.35s var(--dm-ease) both;
}
/* Home (listagem geral): sem a coluna de canais - só rail | conteúdo | membros.
   3 faixas (a coluna oculta sai do grid), então o conteúdo herda o 1fr. */
.chat-app.no-channel-col { grid-template-columns: var(--rail-w, 72px) 1fr 240px; }
.chat-app.no-channel-col .channel-col,
.chat-app.no-channel-col .chan-resizer { display: none; }

/* ---------- Coluna 1: rail ---------- */

.rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
    background: var(--dm-rail);
    /* A rail INTEIRA não rola: quem rola é só a faixa dos servidores, senão em
       produção (muitos servidores) os botões de baixo - acesso/permissões,
       auditoria, sair - eram empurrados para fora da tela. */
    overflow: hidden;
    min-height: 0;
}
.rail > * { flex-shrink: 0; }

/* Faixa rolável: os servidores e o "+". Come a sobra de altura (flex:1), então
   é ela que empurra o rodapé para baixo (antes isso era papel de um spacer). */
.rail-scroll {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;   /* rolar até o fim não arrasta a página */
    scrollbar-width: none;          /* Firefox: sem barra visível */
}
.rail-scroll::-webkit-scrollbar { width: 0; height: 0; }  /* WebKit: idem */
.rail-scroll > * { flex-shrink: 0; }

/* Rodapé fixo da rail: sempre visível, não importa quantos servidores existam. */
.rail-foot {
    flex-shrink: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Perfil no rodapé da rail: o avatar É o botão (mesmo círculo de 46px dos
   vizinhos). O nome e o papel, que antes ficavam no cartão do rodapé da coluna
   de canais, agora vivem no title - a rail é estreita demais para texto. */
.rail-me {
    position: relative;
    overflow: visible;      /* o pip de "online" fica FORA do círculo */
    padding: 0;
    background: none;       /* quem pinta é a foto/iniciais */
    /* Borda: separa o avatar do fundo da rail (foto escura encostava no preto).
       Com box-sizing:border-box o botão continua com 46px - quem cede 2px de
       cada lado é a foto/iniciais lá dentro. */
    border: 2px solid rgba(var(--dm-fg-rgb), 0.22);
    transition: border-color 0.2s var(--dm-ease),
                border-radius 0.25s var(--dm-ease),
                transform 0.2s var(--dm-ease-snap);
}
.rail-me:hover { border-color: rgba(var(--dm-fg-rgb), 0.55); }
.rail-me.active { border-color: var(--dm-accent); }
.rail-me-img,
.rail-me-iniciais {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;   /* o clique cai sempre no <a> */
}
.rail-me-iniciais {
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--hue, 205) 55% 38%);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
/* Pip de presença, encostado na borda do avatar e recortado do fundo da rail. */
.rail-me-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--dm-success);
    border: 3px solid var(--dm-rail);
    pointer-events: none;
}
.rail-me:hover,
.rail-me.active { border-radius: 30%; }
.rail-me:hover .rail-me-img,
.rail-me:hover .rail-me-iniciais,
.rail-me.active .rail-me-img,
.rail-me.active .rail-me-iniciais { border-radius: 30%; }

/* Alças para ajustar a largura das colunas (arrastar). Na borda direita de cada. */
.col-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    transform: translateX(-4px);
    cursor: col-resize;
    z-index: 60;
    background: transparent;
    transition: background-color 0.15s var(--dm-ease);
}
.col-resizer:hover,
.col-resizer.dragging { background: rgba(var(--dm-primary-rgb), 0.5); }
.rail-resizer { left: var(--rail-w, 72px); }
.chan-resizer { left: calc(var(--rail-w, 72px) + var(--chan-w, 240px)); }

.rail-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    transition: border-radius 0.25s var(--dm-ease), transform 0.2s var(--dm-ease-snap), box-shadow 0.25s var(--dm-ease);
    animation: brandPulse 3.2s ease-in-out infinite;
}

.rail-brand:hover {
    border-radius: 30%;
    transform: translateY(-2px);
    color: #fff;
}

/* Logo do site (Meet Motiva) FLUTUANTE no lugar do texto "DM" em TODAS as marcas:
   o botão brand da rail e o componente .brand-mark (login, boas-vindas, listagem
   geral, páginas de convidado). PNG transparente recortado/centrado, exibido
   inteiro (contain) SEM tile/gradiente atrás e SEM o halo do brandPulse — o ícone
   fica solto. Cobre os 3 tamanhos do brand-mark. */
.rail-brand,
.brand-mark {
    background: transparent url("../source/meet-motiva-logo.png") center / contain no-repeat;
    /* Some com o texto "DM" em QUALQUER estado: só color:transparent não basta
       porque o .rail-brand:hover volta color:#fff; font-size:0 garante. */
    color: transparent;
    font-size: 0;
    box-shadow: none;
    animation: none;
}

.rail-sep {
    width: 32px;
    height: 2px;
    border-radius: 2px;
    background: rgba(var(--dm-fg-rgb), 0.08);
}


.rail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--dm-raised);
    color: rgba(var(--dm-fg-rgb), 0.65);
    text-decoration: none;   /* é um <a>: sem isto o "+" do rail-add fica sublinhado */
    transition: border-radius 0.25s var(--dm-ease), background-color 0.25s var(--dm-ease),
                color 0.2s var(--dm-ease), transform 0.2s var(--dm-ease-snap);
}

.rail-btn:hover, .rail-btn.active {
    border-radius: 30%;
    background: var(--dm-primary);
    color: #fff;
    transform: translateY(-2px);
}

.rail-btn-danger:hover {
    background: #b02a37;
}

/* "+" de criar servidor no rail (admin) */
.rail-add {
    font-size: 1.5rem;
    line-height: 1;
    color: #6ee7a8;
    background: transparent;
    box-shadow: inset 0 0 0 1.5px rgba(110, 231, 168, 0.35);
}
.rail-add:hover {
    background: rgba(35, 165, 90, 0.9);
    color: #fff;
    box-shadow: none;
}

.rail-server {
    background: hsl(var(--hue, 205) 45% 32%);
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    position: relative;
}

.rail-server:hover {
    background: hsl(var(--hue, 205) 55% 42%);
}

.rail-server.active {
    border-radius: 30%;
    background: hsl(var(--hue, 205) 60% 46%);
    box-shadow: 0 0 14px -2px hsl(var(--hue, 205) 70% 50% / 0.6);
}

.rail-server.active::before {
    content: "";
    position: absolute;
    left: -13px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: #fff;
    animation: railPip 0.25s var(--dm-ease) both;
}

@keyframes railPip {
    from { height: 0; opacity: 0; }
    to   { height: 60%; opacity: 1; }
}

/* Célula do servidor no rail: o círculo (.rail-server) em cima e o NOME COMPLETO
   embaixo. O nome quebra em várias linhas em vez de ser cortado nas iniciais. */
.rail-server-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    text-decoration: none;
}
.rail-server-name {
    max-width: 66px;
    font-size: 0.66rem;
    line-height: 1.15;
    text-align: center;
    color: rgba(var(--dm-fg-rgb), 0.55);
    word-break: break-word;
    overflow-wrap: anywhere;
    transition: color 0.2s var(--dm-ease);
}
/* Grupo (abinha) da rail: cabeçalho clicável que recolhe os servidores. */
.rail-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.rail-group-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;   /* mesmo ritmo das células soltas na rail (.rail gap) */
}
.rail-group.collapsed .rail-group-body { display: none; }

/* Abinha (categoria) da rail: rótulo curto separando Vendas / Staff. É um botão
   (recolhe o grupo ao clicar), então zera o estilo padrão de <button>. */
.rail-cat {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 2px 0 0;
    padding: 2px 4px;
    background: none;
    border: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s var(--dm-ease);
}
.rail-cat:hover { background: rgba(var(--dm-fg-rgb), 0.06); }
.rail-cat::before,
.rail-cat::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(var(--dm-fg-rgb), 0.10);
}
.rail-cat-caret {
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid rgba(var(--dm-fg-rgb), 0.42);
    transition: transform 0.15s var(--dm-ease);
}
/* Recolhido: o caret aponta para a direita (▸) em vez de para baixo (▾). */
.rail-group.collapsed .rail-cat-caret { transform: rotate(-90deg); }
.rail-cat-name {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(var(--dm-fg-rgb), 0.42);
    white-space: nowrap;
}
.rail-cat:hover .rail-cat-name { color: rgba(var(--dm-fg-rgb), 0.65); }
.rail-cat-empty {
    font-size: 0.7rem;
    color: rgba(var(--dm-fg-rgb), 0.25);
    text-align: center;
    line-height: 1;
    margin-bottom: 2px;
}
/* Passar o mouse em qualquer ponto da célula reage como antes (círculo + nome). */
.rail-server-cell:hover .rail-server { background: hsl(var(--hue, 205) 55% 42%); }
.rail-server-cell:hover .rail-server-name { color: rgba(var(--dm-fg-rgb), 0.85); }
.rail-server-cell.active .rail-server-name { color: #fff; }

/* ---------- Coluna 2: canais ---------- */

.channel-col {
    display: flex;
    flex-direction: column;
    background: var(--dm-col);
    min-width: 0;
    /* Item de grid tem `min-height: auto` por padrão: sem isto a coluna cresce
       junto com a lista (muitas DMs, muita gente em call) e empurra o painel de
       voz e o de perfil para FORA da tela - o body tem overflow:hidden, então
       mutar/ensurdecer/desligar ficavam inalcançáveis. Com min-height:0 a coluna
       fica presa nos 100vh e quem rola é o .channel-col-scroll. Mesma correção
       que .chat-main já tinha. */
    min-height: 0;
    overflow: hidden;
}

.channel-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.channel-col-title { flex: 1; min-width: 0; }
.channel-col-gear {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: rgba(var(--dm-fg-rgb), 0.6);
    transition: background-color 0.15s var(--dm-ease), color 0.15s var(--dm-ease), transform 0.2s var(--dm-ease);
}
.channel-col-gear:hover { background: rgba(var(--dm-fg-rgb), 0.08); color: #fff; transform: rotate(45deg); }

/* Foto do servidor no rail (preenche o botão circular). NÃO usar overflow:hidden
   aqui: ele recortaria o pip de "servidor ativo" (::before, em left:-13px) e o
   .rail-dot de menção, que ficam FORA do círculo. A própria imagem se recorta
   pelo border-radius herdado, então o círculo continua limpo sem cortar o resto. */
.rail-server.has-photo { background: none; }
.rail-server-img {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: inherit;   /* recorta a imagem no formato do botão (círculo/30% ativo) */
    pointer-events: none;     /* o clique cai no <a> do servidor, nunca "preso" na imagem */
}

.channel-col-scroll {
    flex: 1;
    min-height: 0;   /* deixa a lista rolar em vez de empurrar os painéis de baixo */
    overflow-y: auto;
    padding: 12px 8px;
}

/* Painel de voz conectada fica preso no rodapé da coluna e nunca encolhe, então
   os botões de call/áudio nunca se sobrepõem à lista. */
.voice-panel { flex-shrink: 0; }

.channel-col-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(var(--dm-fg-rgb), 0.45);
}

.add-channel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    color: rgba(var(--dm-fg-rgb), 0.55);
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.2s var(--dm-ease), color 0.2s var(--dm-ease), transform 0.15s var(--dm-ease-snap);
}

.add-channel:hover {
    background: rgba(var(--dm-primary-rgb), 0.3);
    color: #fff;
    transform: scale(1.15);
}

.channel-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin: 1px 0;
    border-radius: 8px;
    color: rgba(var(--dm-fg-rgb), 0.6);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.18s var(--dm-ease), color 0.18s var(--dm-ease), transform 0.18s var(--dm-ease);
    animation: fadeInUp 0.35s var(--dm-ease) both;
    animation-delay: calc(var(--i, 0) * 40ms);
}

.channel-link .hash {
    color: rgba(var(--dm-fg-rgb), 0.35);
    font-weight: 600;
}

.channel-link:hover {
    background: rgba(var(--dm-fg-rgb), 0.05);
    color: rgba(var(--dm-fg-rgb), 0.85);
    transform: translateX(2px);
}

.channel-link.active {
    background: rgba(var(--dm-primary-rgb), 0.28);
    color: #fff;
}

.channel-link.active .hash { color: var(--dm-accent); }

.channel-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-cam { color: var(--dm-accent); opacity: 0.8; }

.channel-empty {
    padding: 8px 10px;
    font-size: 0.82rem;
    color: rgba(var(--dm-fg-rgb), 0.4);
}

/* ---------- Canais de voz ---------- */

.voice-channel {
    animation: fadeInUp 0.35s var(--dm-ease) both;
    animation-delay: calc(var(--i, 0) * 40ms);
}

.voice-link { color: rgba(var(--dm-fg-rgb), 0.6); }

.voice-link svg { color: rgba(var(--dm-fg-rgb), 0.35); flex-shrink: 0; }

.voice-link:hover svg { color: var(--dm-accent); }

/* Cronômetro "há quanto tempo a call está rolando", à direita do nome do canal
   de voz na lista. Só aparece quando há gente na sala. */
.voice-timer {
    margin-left: auto;
    padding-left: 6px;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: #23a559;
}

.voice-users {
    padding-left: 34px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-user {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2px 6px;
    border-radius: 6px;
    animation: fadeInUp 0.25s var(--dm-ease) both;
}

.voice-user-name {
    font-size: 0.78rem;
    color: rgba(var(--dm-fg-rgb), 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* Participante moderável (admin): clicável, abre o menu de moderação. */
.voice-user.mod { cursor: pointer; }
.voice-user.mod:hover { background: rgba(var(--dm-fg-rgb), 0.07); }

/* Indicadores de mudo/ensurdecer imposto pelo servidor. */
.voice-user-status {
    display: inline-flex;
    flex-shrink: 0;
    color: #ff6b7a;
}
.voice-user-status.deafened { color: #ff9c4d; }
.voice-user-status.sharing { color: #23a559; }  /* compartilhando a tela (verde) */

.avatar-xs { width: 20px; height: 20px; font-size: 0.5rem; }

/* Retorno visual de quem está falando (estilo Discord): anel verde no avatar,
   tanto na ocupação da barra lateral quanto nos participantes da tela da call,
   e borda verde no tile de vídeo/tela de quem fala. */
.voice-user .avatar,
.stage-member .avatar {
    box-shadow: 0 0 0 0 rgba(35, 165, 89, 0);
    transition: box-shadow 0.12s ease;
}
.voice-user.speaking .avatar,
.stage-member.speaking .avatar {
    box-shadow: 0 0 0 2px #23a559, 0 0 8px 1px rgba(35, 165, 89, 0.6);
}
.video-tile.speaking {
    outline: 3px solid #23a559;
    outline-offset: -3px;
    box-shadow: 0 0 12px 1px rgba(35, 165, 89, 0.5);
}

/* Menu de moderação (administrador) - flutuante, posicionado pelo JS. */
.mod-menu {
    position: fixed;
    z-index: 1200;
    min-width: 190px;
    padding: 6px;
    border-radius: 10px;
    background: #14161d;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
    animation: dm-emoji-in 0.14s var(--dm-ease);
}
.mod-menu-head {
    padding: 6px 10px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(var(--dm-fg-rgb), 0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mod-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: rgba(var(--dm-fg-rgb), 0.85);
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.12s var(--dm-ease), color 0.12s var(--dm-ease);
}
.mod-menu-item:hover { background: rgba(var(--dm-primary-rgb), 0.9); color: #fff; }
.mod-menu-item.danger { color: #ff8896; }
.mod-menu-item.danger:hover { background: rgba(220, 53, 69, 0.85); color: #fff; }
.mod-menu-sep { height: 1px; margin: 5px 4px; background: rgba(var(--dm-fg-rgb), 0.09); }

/* Controle de volume por pessoa (local, "só para mim") dentro do menu. */
.mod-menu-vol { padding: 6px 10px 8px; }
.mod-menu-vol-label {
    font-size: 0.78rem;
    color: rgba(var(--dm-fg-rgb), 0.75);
    margin-bottom: 6px;
}
.mod-menu-vol-slider {
    width: 100%;
    accent-color: var(--dm-primary);
    cursor: pointer;
}

.voice-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(31, 157, 85, 0.12);
    border-top: 1px solid rgba(31, 157, 85, 0.25);
    animation: fadeInUp 0.3s var(--dm-ease) both;
    /* A coluna é redimensionável (chan-resizer): quando fica estreita demais
       para "Voz conectada" + os 5 botões, os botões descem para uma 2ª linha em
       vez de serem cortados na borda. */
    flex-wrap: wrap;
    row-gap: 6px;
}

.voice-panel[hidden] { display: none; }

/* flex-basis pequeno: o texto cede espaço (e trunca) antes de forçar a quebra. */
.voice-panel-info { flex: 1 1 84px; min-width: 0; }

/* Bloco único de controles: quando não cabe ao lado do texto, desce inteiro
   (e centralizado) em vez de partir a fileira de botões no meio. */
.voice-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    row-gap: 6px;
    flex: 0 0 auto;
    margin-left: auto;
    /* O resizer desce até 160px (chat_base.html), largura em que nem os 5
       botões sozinhos cabem numa fileira: aí quebram entre si, em vez de o
       último ("sair da chamada") ser cortado na borda da coluna.
       O max-width é o que faz a quebra interna acontecer: sem ele o grupo
       mantém a largura max-content e vaza para fora da coluna. */
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
    min-width: 0;
}

.voice-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #4ade80;
}

.voice-panel-channel {
    font-size: 0.78rem;
    color: rgba(var(--dm-fg-rgb), 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;        /* nunca encolhe abaixo da área de toque de 30px */
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: rgba(var(--dm-fg-rgb), 0.07);
    color: rgba(var(--dm-fg-rgb), 0.7);
    transition: background-color 0.2s var(--dm-ease), color 0.2s var(--dm-ease), transform 0.15s var(--dm-ease-snap);
}

.voice-btn:hover { background: rgba(var(--dm-fg-rgb), 0.14); color: #fff; transform: translateY(-1px); }

.voice-btn.muted,
.voice-btn.deafened {
    background: rgba(220, 53, 69, 0.25);
    color: #ff8896;
}

/* Mudo/ensurdecer imposto por um administrador: travado (não dá para reativar). */
.voice-btn.server-locked {
    cursor: not-allowed;
    box-shadow: inset 0 0 0 1.5px rgba(255, 107, 122, 0.8);
}

/* Câmera ligada: destaque verde (estado ativo, não de alerta). */
.voice-btn#voice-camera.on {
    background: rgba(35, 165, 90, 0.28);
    color: #6ee7a8;
}

.voice-btn-danger:hover { background: rgba(220, 53, 69, 0.35); color: #ff8896; }

/* Toggle dos ícones (microfone on/off, ensurdecer on/off, câmera on/off) */
.voice-btn .ic-mic-off,
.voice-btn .ic-deaf-on,
.voice-btn .ic-cam-on { display: none; }
.voice-btn.muted .ic-mic-on { display: none; }
.voice-btn.muted .ic-mic-off { display: inline; }
.voice-btn.deafened .ic-deaf-off { display: none; }
.voice-btn.deafened .ic-deaf-on { display: inline; }
.voice-btn#voice-camera.on .ic-cam-off { display: none; }
.voice-btn#voice-camera.on .ic-cam-on { display: inline; }

/* --------------------------------- Grade de vídeo (webcam) --------------- */
/* ---- Tela da chamada (overlay: grade de vídeo/tela + quadro branco) ---- */
.call-stage {
    position: fixed;
    z-index: 1040;
    /* Janela flutuante: tamanho/posição padrão (o JS ajusta e persiste). */
    width: min(920px, 92vw);
    height: min(580px, 82vh);
    left: max(12px, calc(50vw - 460px));
    top: max(12px, calc(50vh - 290px));
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    resize: both;                 /* redimensionável pelo canto inferior direito */
    min-width: 360px;
    min-height: 260px;
    max-width: 98vw;
    max-height: 94vh;
    background: rgba(10, 13, 20, 0.97);
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    animation: dm-stage-in 0.2s var(--dm-ease);
}
.call-stage[hidden] { display: none; }

/* Maximizado: volta a ocupar a tela inteira (botão de maximizar/restaurar). */
.call-stage.maximized {
    inset: 0;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    resize: none;
}

/* Celular: o overlay de chamada vira TELA CHEIA. Flutuar não faz sentido num
   telefone, e a geometria persistida do desktop (inline, aplicada pelo JS) o
   deixava pequeno no meio da tela com o shell aparecendo atrás. O !important
   vence o estilo inline (posição/tamanho salvos) sem precisar mexer no JS. */
@media (max-width: 780px) {
    .call-stage {
        inset: 0 !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        resize: none !important;
    }
    .call-stage-bar { cursor: default; flex-wrap: wrap; }  /* tela cheia: nada a arrastar */
    .stage-record-label { display: none; }      /* "Gravar" vira só o ícone (cabe melhor) */
    .call-stage-title { font-size: 0.9rem; }
    /* Barra compacta: título + ações na 1ª linha; membros numa linha própria com
       rolagem horizontal (em vez de empilharem verticalmente e comerem o vídeo). */
    .stage-bar-actions { order: 2; }
    .stage-members {
        order: 3;
        flex-basis: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .stage-members::-webkit-scrollbar { display: none; }
    .stage-member { flex: none; }
    /* Controles da call: no celular a barra QUEBRA em linhas e os botões de mão
       e chat entram no FLUXO (eram position:absolute nas pontas e, numa tela
       estreita, sobrepunham o cluster central - mute/adicionar). Botões um tico
       menores para caber melhor por linha; respeita a safe-area do iPhone. */
    .call-stage-controls {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 10px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    /* Prefixo .call-stage p/ subir a especificidade (0,3,0) e VENCER a regra base
       `.call-stage-controls .stage-ctrl-{hand,chat} { position:absolute }`, que
       tem a mesma especificidade mas vem DEPOIS no arquivo (senão o static aqui
       era ignorado e mão/chat seguiam absolutos, sobrepondo). Vale p/ a call
       interna E a externa (guest) - as duas usam .call-stage. */
    .call-stage .call-stage-controls .stage-ctrl-hand,
    .call-stage .call-stage-controls .stage-ctrl-chat {
        position: static;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
    }
    .call-stage-controls .stage-ctrl { width: 42px; height: 42px; }
}

/* A barra do topo é a "alça" de arrastar a janela. */
.call-stage-bar { cursor: move; user-select: none; }
.call-stage.maximized .call-stage-bar { cursor: default; }
.stage-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

@keyframes dm-stage-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.call-stage-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    flex-wrap: wrap;
}
.call-stage-title {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}
.call-stage-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Participantes da call dentro da tela (clique p/ moderar, se admin) */
.stage-members {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-left: 6px;
    margin-left: 4px;
    border-left: 1px solid rgba(var(--dm-fg-rgb), 0.12);
}
.stage-member {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 4px;
    border-radius: 999px;
    background: rgba(var(--dm-fg-rgb), 0.06);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    color: rgba(var(--dm-fg-rgb), 0.85);
    font-size: 0.8rem;
}
.stage-member.mod { cursor: pointer; }
.stage-member.mod:hover { background: rgba(var(--dm-primary-rgb), 0.4); border-color: var(--dm-accent); }
.stage-member-name { font-weight: 600; white-space: nowrap; }
.stage-member .voice-user-status { display: inline-flex; }

.stage-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
    border-radius: 8px;
    background: rgba(var(--dm-fg-rgb), 0.06);
    color: rgba(var(--dm-fg-rgb), 0.85);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.16s var(--dm-ease), color 0.16s var(--dm-ease);
}
.stage-tool:hover { background: rgba(var(--dm-primary-rgb), 0.4); color: #fff; }
.stage-tool.on { background: var(--dm-primary); color: #fff; border-color: var(--dm-accent); }
.stage-tool.has-board { border-color: #ffd23f; color: #ffd23f; }
.stage-tool.stage-close { background: transparent; }
.stage-tool.stage-close:hover { background: rgba(242, 63, 66, 0.85); color: #fff; }
.stage-tool.stage-leave {
    background: rgba(242, 63, 66, 0.85);
    border-color: rgba(242, 63, 66, 0.9);
    color: #fff;
}
.stage-tool.stage-leave:hover { background: #f23f42; }
/* Mudo/ensurdecer ativos (vermelho); travado por admin fica sem clique. */
.stage-tool.on-danger {
    background: rgba(242, 63, 66, 0.85);
    border-color: rgba(242, 63, 66, 0.9);
    color: #fff;
}
.stage-tool.on-danger:hover { background: #f23f42; }
.stage-tool.server-locked { opacity: 0.65; cursor: not-allowed; }
.stage-tool[hidden] { display: none; }

.call-stage-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 12px;
    overflow: auto;
}

.video-stage {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-content: flex-start;
    justify-content: center;
}
.video-stage:empty { display: none; }

/* ---- Tela da chamada estilo Discord: grade de participantes + controles ---- */
/* Grade preenche o corpo e centraliza. */
.call-stage-body { align-content: center; }
.video-stage { flex: 1; align-content: center; }

/* Tile de avatar (participante sem câmera): avatar grande centrado + nome. */
.video-tile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 42%, #2b3040, #1c1f2b);
}
.avatar-tile-inner { display: flex; align-items: center; justify-content: center; }
.avatar-tile-img {
    width: 84px;
    height: 84px;
    font-size: 1.9rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.video-tile.speaking .avatar-tile-img {
    box-shadow: 0 0 0 3px #23a559, 0 0 14px 2px rgba(35, 165, 89, 0.6);
}
.video-tile .tile-status {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    padding: 4px;
}
/* Mão levantada no tile (canto superior direito, não colide com o mute). */
.video-tile .tile-hand {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.1rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
    animation: dm-hand-wave 1.2s var(--dm-ease) infinite;
}
/* Indicador ✋ ao lado do nome (lista lateral e chips do topo). */
.voice-user-hand {
    display: inline-flex;
    flex-shrink: 0;
    font-size: 0.95em;
    line-height: 1;
    animation: dm-hand-wave 1.2s var(--dm-ease) infinite;
}
@keyframes dm-hand-wave {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
}

/* Barra de controles embaixo (botões redondos, estilo Discord). */
.call-stage-controls {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.45);
    border-top: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
/* Chat da chamada fica ancorado no canto inferior direito da barra (fora do
   cluster central). Qualificado com o pai p/ vencer o `position:relative` do
   .stage-ctrl que vem depois no arquivo. */
.call-stage-controls .stage-ctrl-chat {
    position: absolute;
    right: 18px;
    bottom: 14px;
    top: auto;
    transform: none;
}
.call-stage-controls .stage-ctrl-chat:active { transform: scale(0.94); }
/* Levantar a mão: canto inferior ESQUERDO, oposto ao chat. */
.call-stage-controls .stage-ctrl-hand {
    position: absolute;
    left: 18px;
    bottom: 14px;
    top: auto;
    transform: none;
}
.call-stage-controls .stage-ctrl-hand:active { transform: scale(0.94); }
.stage-ctrl-hand.on { background: #ffd23f; color: #1c1f2b; }  /* mão levantada */
.stage-ctrl {
    position: relative;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(var(--dm-fg-rgb), 0.1);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.16s var(--dm-ease), transform 0.1s var(--dm-ease);
}
.stage-ctrl:hover { background: rgba(var(--dm-fg-rgb), 0.2); }
.stage-ctrl:active { transform: scale(0.94); }
.stage-ctrl.on { background: #fff; color: #1c1f2b; }            /* câmera/tela ligada */
.stage-ctrl.has-board { background: #ffd23f; color: #1c1f2b; }  /* quadro branco ativo */
.stage-ctrl.on-danger { background: #f23f42; color: #fff; }     /* mudo/surdo ativo */
.stage-ctrl.server-locked { opacity: 0.6; cursor: not-allowed; }
.stage-ctrl.stage-leave { background: #f23f42; color: #fff; }
.stage-ctrl.stage-leave:hover { background: #d5363a; }

/* Badge de mensagens não lidas no botão do chat da chamada. */
.stage-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #f23f42;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(20, 22, 30, 0.9);
}
.stage-badge[hidden] { display: none; }

/* ---- Chat efêmero da sala (estilo Meet): painel deslizante à direita ---- */
.call-stage-body { position: relative; }
.call-chat {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 82%);
    display: flex;
    flex-direction: column;
    background: rgba(20, 22, 30, 0.97);
    border-left: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
    z-index: 5;
}
.call-chat[hidden] { display: none; }
.call-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.call-chat-close {
    border: none;
    background: transparent;
    color: rgba(var(--dm-fg-rgb), 0.7);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
}
.call-chat-close:hover { background: rgba(var(--dm-fg-rgb), 0.12); color: #fff; }
.call-chat-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* Bolhas (mesmo estilo do chat efêmero): a sua msg à direita com gradiente. */
.cc-msg { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.cc-mine { align-self: flex-end; align-items: flex-end; }
.cc-msg-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.cc-mine .cc-msg-head { flex-direction: row-reverse; }
.cc-msg-who { font-weight: 700; font-size: 0.8rem; color: var(--dm-accent, #8ab4f8); }
.cc-mine .cc-msg-who { color: #7ee2a8; }
.cc-msg-time { font-size: 0.68rem; color: rgba(var(--dm-fg-rgb), 0.4); }
.cc-msg-body {
    padding: 7px 11px;
    border-radius: 12px;
    background: rgba(var(--dm-fg-rgb), 0.08);
    font-size: 0.86rem;
    color: rgba(var(--dm-fg-rgb), 0.92);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.cc-mine .cc-msg-body {
    background: linear-gradient(135deg, var(--dm-primary, #5865f2), var(--dm-accent, #8ab4f8));
    color: #fff;
}
/* Anexo: link de download dentro da bolha (espelha o .gchat-file do efêmero). */
.cc-file {
    display: inline-flex; flex-direction: column; gap: 1px;
    padding: 8px 12px; border-radius: 12px; text-decoration: none; max-width: 100%;
    background: rgba(var(--dm-fg-rgb), 0.08); color: #fff;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
}
.cc-file:hover { background: rgba(var(--dm-fg-rgb), 0.14); }
.cc-mine .cc-file {
    background: linear-gradient(135deg, var(--dm-primary, #5865f2), var(--dm-accent, #8ab4f8));
    border: none;
}
.cc-file-name { font-size: 0.85rem; font-weight: 600; word-break: break-word; }
.cc-file-size { font-size: 0.7rem; opacity: 0.7; }
/* Botão de anexar na barra do chat da chamada. */
.cc-attach {
    flex-shrink: 0; width: 38px; border: none; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--dm-fg-rgb), 0.08); color: rgba(var(--dm-fg-rgb), 0.75);
}
.cc-attach:hover { background: rgba(var(--dm-fg-rgb), 0.16); color: #fff; }

/* ---- Cartão de perfil (estilo Discord, na paleta do site) ----------------- */
.avatar-clickable { cursor: pointer; }
.avatar-clickable:hover { filter: brightness(1.08); }
.msg-author[data-user-card] { cursor: pointer; }
.msg-author[data-user-card]:hover { text-decoration: underline; }

.ucard {
    position: fixed; z-index: 1200; width: 300px; max-width: calc(100vw - 16px);
    background: var(--dm-raised); color: #fff;
    border: 1px solid rgba(var(--dm-primary-rgb), 0.18); border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55); overflow: hidden;
    animation: ucard-in 0.12s var(--dm-ease);
}
@keyframes ucard-in { from { opacity: 0; transform: translateY(4px); } }
/* Banner na identidade do site (marinho -> azul), não um tom por usuário. */
.ucard-banner {
    height: 60px;
    background: linear-gradient(135deg, var(--dm-secondary), var(--dm-primary));
}
.ucard-avatar {
    width: 72px; height: 72px; border-radius: 50%; font-size: 1.5rem;
    margin: -40px 0 0 16px; position: relative;
    border: 5px solid var(--dm-raised); box-sizing: content-box;
}
.ucard-avatar.is-online::after {
    content: ""; position: absolute; right: 0; bottom: 2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--dm-success); border: 3px solid var(--dm-raised);
}
.ucard-body { padding: 8px 16px 16px; }
.ucard-name { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.ucard-username { font-size: 0.82rem; color: rgba(var(--dm-fg-rgb), 0.55); margin-bottom: 8px; }
/* Presença nas MESMAS cores da lista de membros. */
.ucard-presence { font-size: 0.78rem; margin-bottom: 12px; color: rgba(var(--dm-fg-rgb), 0.4); }
.ucard-presence.on { color: var(--dm-success); }
.ucard-presence.ausente { color: #f0b23f; }
.ucard-presence.ocupado { color: #f23f42; }
.ucard-fields {
    background: rgba(0, 0, 0, 0.22); border-radius: 8px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
}
.ucard-field { display: flex; flex-direction: column; gap: 1px; }
.ucard-label {
    font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em;
    font-weight: 700; color: rgba(var(--dm-fg-rgb), 0.5);
}
.ucard-value { font-size: 0.85rem; word-break: break-word; }
.ucard-actions { display: flex; gap: 8px; }
.ucard-btn {
    flex: 1; text-align: center; text-decoration: none; padding: 8px 12px;
    border: none; border-radius: 8px; cursor: pointer;
    font: 600 0.82rem "Inter", system-ui, sans-serif;
    background: rgba(var(--dm-fg-rgb), 0.1); color: #fff;
}
.ucard-btn:hover { background: rgba(var(--dm-fg-rgb), 0.18); }
.ucard-btn-primary {
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
}
.ucard-btn-primary:hover { filter: brightness(1.1); }
.ucard-note {
    flex: 1; text-align: center; padding: 8px 12px;
    font-size: 0.78rem; color: rgba(var(--dm-fg-rgb), 0.6);
    background: rgba(var(--dm-fg-rgb), 0.05); border-radius: 8px;
}
/* Aviso do sistema (ex.: bloqueio por spam). */
.cc-notice {
    align-self: center;
    max-width: 92%;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(242, 63, 66, 0.14);
    border: 1px solid rgba(242, 63, 66, 0.35);
    color: #ffb3b9;
    font-size: 0.76rem;
    text-align: center;
}
.call-chat-form input:disabled { opacity: 0.55; cursor: not-allowed; }
.call-chat-form {
    display: flex;
    gap: 6px;
    padding: 8px 10px 4px;
    border-top: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.call-chat-form input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
    background: rgba(var(--dm-fg-rgb), 0.06);
    color: #fff;
    font-size: 0.86rem;
}
.call-chat-form input:focus { outline: none; border-color: var(--dm-accent, #8ab4f8); }
.call-chat-form button {
    flex-shrink: 0;
    width: 38px;
    border: none;
    border-radius: 8px;
    background: var(--dm-primary, #5865f2);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.call-chat-form button:hover { filter: brightness(1.1); }
.call-chat-hint {
    margin: 0;
    padding: 2px 10px 8px;
    font-size: 0.68rem;
    color: rgba(var(--dm-fg-rgb), 0.4);
}

/* Botão de minimizar no topo (continua na call). */
.stage-close-top {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(var(--dm-fg-rgb), 0.08);
    color: rgba(var(--dm-fg-rgb), 0.8);
    cursor: pointer;
}
.stage-close-top:hover { background: rgba(242, 63, 66, 0.85); color: #fff; }

/* ---------- Gravação da reunião (botão + indicador + toast) ---------- */
/* Botão Gravar/Stop no topo direito do palco: destacado (maior que os
   .stage-close-top). REC = círculo; enquanto grava vira quadrado (Stop). */
.stage-record {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(242, 63, 66, 0.55);
    border-radius: 8px;
    background: rgba(242, 63, 66, 0.12);
    color: #ff6b6e;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s var(--dm-ease), color 0.15s var(--dm-ease);
}
.stage-record:hover:not(:disabled) { background: rgba(242, 63, 66, 0.22); }
.stage-record:disabled { opacity: 0.45; cursor: not-allowed; }
.stage-record .ic-stop { display: none; }
.stage-record.recording {
    background: #f23f42;
    border-color: #f23f42;
    color: #fff;
    animation: rec-pulse 1.6s ease-in-out infinite;
}
.stage-record.recording .ic-rec { display: none; }
.stage-record.recording .ic-stop { display: inline; }
/* Cronômetro (mm:ss) enquanto grava: dígitos alinhados, sem "tremer". */
.stage-record.recording .stage-record-label {
    font-variant-numeric: tabular-nums;
    min-width: 3.2em;
    text-align: left;
}

/* Indicador "REC" que TODOS na sala veem enquanto há gravação. */
.stage-rec {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(242, 63, 66, 0.16);
    color: #ff6b6e;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.stage-rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f23f42;
    animation: rec-pulse 1.6s ease-in-out infinite;
}
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
    .stage-record.recording, .stage-rec-dot { animation: none; }
}

/* ---------- Legendas ao vivo na chamada ---------- */
.stage-captions {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 40px));
    z-index: 30;             /* acima do palco, abaixo dos controles/spotlight */
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;    /* não bloqueia clique nos tiles atrás */
}
.stage-captions[hidden] { display: none; }
.caption-line {
    align-self: center;
    max-width: 100%;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.35;
    text-align: center;
}
.caption-line b { color: #7fd1ff; font-weight: 600; }
/* Na sala em tela cheia a barra de controles ocupa o rodapé (no fluxo, ~75px);
   sobe a faixa de legendas para ela não colar/sobrepor os botões. */
.guest-stage .stage-captions { bottom: 90px; }
/* Toggle das legendas no perfil. */
.caption-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.caption-toggle-text { flex: 1; min-width: 0; }

/* Switch liga/desliga: um <input type="checkbox"> nativo por baixo (o JS lê o
   .checked/.disabled como antes), com a pista/bolinha desenhadas por cima. */
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 44px; height: 24px; }
.switch-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track {
    position: absolute; inset: 0; border-radius: 999px;
    background: rgba(var(--dm-fg-rgb), 0.16);
    transition: background 0.18s var(--dm-ease);
}
.switch-thumb {
    position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    transition: transform 0.18s var(--dm-ease-snap);
}
.switch-input:checked ~ .switch-track { background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent)); }
.switch-input:checked ~ .switch-track .switch-thumb { transform: translateX(20px); }
.switch-input:focus-visible ~ .switch-track { box-shadow: 0 0 0 3px rgba(var(--dm-accent-rgb), 0.35); }
.switch-input:disabled { cursor: not-allowed; }
.switch-input:disabled ~ .switch-track { opacity: 0.45; }
/* Botão CC ativo no overlay (mesmo destaque dos outros controles ligados). */
#btn-captions.active { background: var(--dm-primary); color: #fff; }

/* ---------- Modal da senha da sala (trancar / entrar) ---------- */
/* z-index acima do overlay da call (3000), senão sumiria atrás dele. */
.pin-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    animation: bodyFadeIn 0.15s var(--dm-ease) both;
}
.pin-modal[hidden] { display: none; }
.pin-card {
    width: min(380px, calc(100vw - 32px));
    padding: 26px 28px 22px;
    border-radius: 14px;
    background: #1a2233;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    animation: dm-emoji-in 0.18s var(--dm-ease-snap) both;
}
.pin-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 5px; }
.pin-sub {
    margin: 0 0 18px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(var(--dm-fg-rgb), 0.55);
}
.pin-boxes { display: flex; gap: 10px; justify-content: center; }
.pin-box {
    width: 54px;
    height: 62px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.16);
    border-radius: 10px;
    transition: border-color 0.15s var(--dm-ease), box-shadow 0.15s var(--dm-ease);
}
.pin-box:focus {
    outline: none;
    border-color: var(--dm-primary);
    box-shadow: 0 0 0 3px rgba(var(--dm-primary-rgb), 0.25);
}
.pin-erro {
    margin: 12px 0 0;
    font-size: 0.82rem;
    color: #ff8f96;
    text-align: center;
}
.pin-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ---- Ligação direta (toque) ------------------------------------------- */
/* Tela de "chamada recebida": card central acima de tudo (inclusive do overlay
   da call), com avatar pulsando e botões Atender/Recusar. */
.call-incoming {
    position: fixed;
    inset: 0;
    z-index: 4100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    animation: bodyFadeIn 0.15s var(--dm-ease) both;
}
.call-incoming[hidden] { display: none; }
.call-incoming-card {
    width: min(360px, calc(100vw - 32px));
    padding: 28px 26px 22px;
    border-radius: 16px;
    background: #1a2233;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
    animation: dm-emoji-in 0.18s var(--dm-ease-snap) both;
}
.call-incoming-avatar { display: flex; justify-content: center; margin-bottom: 14px; }
.call-incoming-avatar .avatar { animation: callPulse 1.4s ease-in-out infinite; }
.call-incoming-text { display: flex; flex-direction: column; gap: 3px; margin-bottom: 22px; }
.call-incoming-name { font-size: 1.15rem; font-weight: 700; }
.call-incoming-sub { font-size: 0.85rem; color: rgba(var(--dm-fg-rgb), 0.55); }
.call-incoming-actions { display: flex; gap: 16px; justify-content: center; }
.call-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s var(--dm-ease), filter 0.12s var(--dm-ease);
}
.call-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.call-btn-accept { background: #3ba55d; }
.call-btn-accept svg { animation: callWiggle 1s ease-in-out infinite; }
.call-btn-decline { background: #ed4245; }

@keyframes callPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 165, 93, 0.5); }
    50% { box-shadow: 0 0 0 12px rgba(59, 165, 93, 0); }
}
@keyframes callWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-12deg); }
    75% { transform: rotate(12deg); }
}

/* Painel "Chamando…" (quem liga): barra flutuante no rodapé com Cancelar. */
.call-outgoing {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 4100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 16px;
    border-radius: 999px;
    background: #1a2233;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    animation: dm-emoji-in 0.18s var(--dm-ease-snap) both;
}
.call-outgoing[hidden] { display: none; }
.call-outgoing-text { font-size: 0.88rem; }
.call-outgoing-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #3ba55d;
    animation: callPulse 1.4s ease-in-out infinite;
}
.call-outgoing-cancel {
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    background: #ed4245;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.call-outgoing-cancel:hover { filter: brightness(1.1); }

/* Botão "Ligar" no cabeçalho da DM. */
.dm-call-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    background: #3ba55d;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.12s var(--dm-ease);
}
.dm-call-btn:hover { filter: brightness(1.1); }

/* Botão "Ligar" que aparece ao passar o mouse num usuário online. */
.member-call-btn {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(var(--dm-fg-rgb), 0.06);
    color: rgba(var(--dm-fg-rgb), 0.7);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s var(--dm-ease), background 0.12s var(--dm-ease), color 0.12s var(--dm-ease);
}
.member-item:hover .member-call-btn,
.member-call-btn:focus-visible { opacity: 1; }
.member-call-btn:hover { background: #3ba55d; color: #fff; }

/* Menu "adicionar à chamada" reusa .mod-menu; só falta o estado vazio. */
.mod-menu-empty {
    padding: 8px 12px;
    font-size: 0.82rem;
    color: rgba(var(--dm-fg-rgb), 0.5);
}

/* ---- Modal "adicionar à chamada" (busca + multi-seleção) --------------- */
.add-people-modal {
    position: fixed;
    inset: 0;
    z-index: 4100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    animation: bodyFadeIn 0.15s var(--dm-ease) both;
}
.add-people-modal[hidden] { display: none; }
.add-people-card {
    width: min(420px, calc(100vw - 32px));
    padding: 24px 24px 20px;
    border-radius: 16px;
    background: #1a2233;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    animation: dm-emoji-in 0.18s var(--dm-ease-snap) both;
}
.people-search {
    width: 100%;
    margin: 6px 0 12px;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.14);
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    font-size: 0.9rem;
}
.people-search:focus {
    outline: none;
    border-color: var(--dm-primary);
    box-shadow: 0 0 0 3px rgba(var(--dm-primary-rgb), 0.22);
}
.people-list {
    max-height: 46vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.people-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.12s var(--dm-ease);
}
.people-row:hover { background: rgba(var(--dm-fg-rgb), 0.06); }
.people-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--dm-primary); cursor: pointer; }
.people-name { font-size: 0.9rem; }
.people-empty { padding: 16px 8px; text-align: center; font-size: 0.85rem; color: rgba(var(--dm-fg-rgb), 0.5); }

/* ---- Grupos na rail de Conversas + tela do grupo ---------------------- */
/* Avatares empilhados de quem está na call do grupo (estilo Discord), à
   direita do nome na rail. Só aparecem quando há call em andamento. */
.group-call-avatars {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding-left: 6px;
    flex-shrink: 0;
}
.group-call-av {
    box-shadow: 0 0 0 2px var(--dm-col, #1e1f22);
    border-radius: 50%;
}
.group-call-avatars .group-call-av + .group-call-av,
.group-call-bar-avatars .group-call-av + .group-call-av { margin-left: -7px; }
.group-call-more {
    margin-left: 3px;
    font-size: 0.68rem;
    color: rgba(var(--dm-fg-rgb), 0.55);
}
/* Ponto verde de "call ativa" no ícone do grupo. */
.dm-link.dm-group.in-call .dm-group-avatar { position: relative; }
.dm-link.dm-group.in-call .dm-group-avatar::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #23a559;
    box-shadow: 0 0 0 2px var(--dm-col, #1e1f22);
}

/* Barra "N na chamada" no topo da página do grupo (estilo "Join Call"). */
.group-call-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 16px 0;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(35, 165, 89, 0.12);
    border: 1px solid rgba(35, 165, 89, 0.35);
}
.group-call-bar-avatars { display: inline-flex; align-items: center; }
.group-call-bar-text {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: rgba(var(--dm-fg-rgb), 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.group-call-bar-join {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 0;
    border-radius: 8px;
    background: #23a559;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.group-call-bar-join:hover { background: #1f9450; }

.dm-group-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--dm-primary-rgb), 0.85);
    color: #fff;
}
/* Botões do cabeçalho do grupo (adicionar / sair). */
.group-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 9px;
    background: rgba(var(--dm-fg-rgb), 0.06);
    color: rgba(var(--dm-fg-rgb), 0.75);
    cursor: pointer;
    transition: background 0.12s var(--dm-ease), color 0.12s var(--dm-ease);
}
.group-btn:hover { background: rgba(var(--dm-fg-rgb), 0.14); color: #fff; }
.group-leave:hover { background: #ed4245; color: #fff; }

/* Trancar sala: hover neutro (não é ação destrutiva como fechar) e destaque
   âmbar quando a sala está trancada. */
.stage-lock:hover { background: rgba(var(--dm-fg-rgb), 0.16); }
.stage-lock .ic-lock-closed { display: none; }
.stage-lock.is-locked { background: rgba(255, 210, 63, 0.2); color: #ffd23f; }
.stage-lock.is-locked:hover { background: rgba(255, 210, 63, 0.32); }
.stage-lock.is-locked .ic-lock-open { display: none; }
.stage-lock.is-locked .ic-lock-closed { display: inline-block; }
/* Cadeado ao lado do nome do canal de voz trancado, na barra lateral. */
/* Cadeado (SVG) do canal trancado: herda a cor do texto e alinha à direita. */
.voice-lock-mark { margin-left: auto; flex: none; opacity: 0.8; }
.voice-link.is-locked .channel-name { opacity: 0.75; }

.video-tile {
    position: relative;
    width: 340px;
    max-width: 46vw;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #05070c;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* O próprio vídeo (webcam) é espelhado, como se espera de uma webcam. */
.video-tile-local:not(.video-tile-screen) video { transform: scaleX(-1); }

/* Tela compartilhada: mostra inteira (contain) e sem espelhar. */
.video-tile-screen video { object-fit: contain; transform: none; background: #000; }
.video-tile-screen { width: 520px; max-width: 70vw; outline: 2px solid rgba(34, 211, 238, 0.7); outline-offset: -2px; }

.video-tile-local {
    outline: 2px solid rgba(110, 231, 168, 0.7);
    outline-offset: -2px;
}

/* Botão de destaque de cada tile (aparece ao passar o mouse). */
.video-tile-expand {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s var(--dm-ease), background-color 0.15s var(--dm-ease);
}
.video-tile:hover .video-tile-expand { opacity: 1; }
.video-tile-expand:hover { background: rgba(var(--dm-primary-rgb), 0.9); }

/* ---- Destaque (spotlight): uma tela em grande + seletor ---- */
.stage-spotlight {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.stage-spotlight[hidden] { display: none; }

/* Com destaque ativo, a grade e o quadro somem para a tela ganhar todo o espaço. */
.call-stage.spotlight-active #video-stage,
.call-stage.spotlight-active #whiteboard-wrap { display: none; }

.spotlight-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.spotlight-picker {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
}
.spotlight-pick { white-space: nowrap; }
.spotlight-actions { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }

.spotlight-video {
    flex: 1;
    min-height: 0;
    width: 100%;
    border-radius: 12px;
    background: #000;
    object-fit: contain;
}
.spotlight-video.mirror { transform: scaleX(-1); }

/* Em tela cheia, o destaque ocupa a tela toda (barra sobreposta no topo). */
.stage-spotlight:fullscreen { padding: 10px; background: #000; gap: 8px; }
.stage-spotlight:-webkit-full-screen { padding: 10px; background: #000; }

/* ---- Quadro branco ---- */
.whiteboard-wrap {
    flex: 1;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.whiteboard-wrap[hidden] { display: none; }

.wb-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.wb-toolbar input[type="color"] {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.2);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}
.wb-toolbar input[type="range"] { width: 120px; }
.wb-status { color: rgba(var(--dm-fg-rgb), 0.6); font-size: 0.82rem; }
.wb-end, #wb-end { margin-left: auto; }

.whiteboard-canvas-wrap {
    position: relative;   /* âncora da caixa de texto sobreposta */
    flex: 1;
    min-height: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #f7f7f2;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.whiteboard-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;   /* pointer events desenham sem rolar/gestos */
    cursor: default;
}
.whiteboard-canvas.can-draw { cursor: crosshair; }
.whiteboard-canvas.can-draw.erasing { cursor: cell; }
.whiteboard-canvas.can-draw.selecting { cursor: move; }
.whiteboard-canvas.can-draw.texting { cursor: text; }

/* Caixa de texto da ferramenta de texto do quadro */
.wb-text-input {
    position: absolute;
    z-index: 5;
    min-width: 60px;
    padding: 0 2px;
    border: 1px dashed #22d3ee;
    background: rgba(var(--dm-fg-rgb), 0.85);
    font-family: Inter, system-ui, sans-serif;
    font-weight: 600;
    outline: none;
}

/* Botões de ferramenta do quadro (quadrados, só ícone) */
.wb-tool { padding: 7px; }

.wb-requests {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wb-request {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 210, 63, 0.12);
    border: 1px solid rgba(255, 210, 63, 0.4);
}
.wb-request-name { color: #fff; font-size: 0.86rem; margin-right: auto; }

/* Toast dentro da tela da chamada (permissões do quadro etc.) */
.stage-toast-stack {
    position: fixed;
    left: 50%;
    bottom: 6vh;
    transform: translateX(-50%);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.stage-toast {
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(20, 24, 34, 0.96);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
    border-left-width: 4px;
    color: #fff;
    font-size: 0.86rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.2s var(--dm-ease) both;
}
/* Cor por tipo (borda esquerda): sucesso / aviso / erro. */
.stage-toast--ok { border-left-color: var(--dm-success); }
.stage-toast--warn { border-left-color: #e0a53b; }
.stage-toast--err { border-left-color: #dc3545; }

.video-tile-name {
    position: absolute;
    left: 8px;
    bottom: 6px;
    max-width: calc(100% - 16px);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.video-tile-name .tile-icon { vertical-align: -2px; margin-right: 3px; opacity: 0.95; }

/* Modal de confirmação de entrada na voz - autossuficiente (sem bootstrap.Modal) */
.voice-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(3, 7, 14, 0.66);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: overlayIn 0.2s var(--dm-ease) both;
}

.voice-overlay[hidden] { display: none; }

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.voice-dialog {
    width: min(420px, 92vw);
    padding: 28px 24px;
    text-align: center;
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.07);
    border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
    animation: dialogIn 0.28s var(--dm-ease-snap) both;
}

@keyframes dialogIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.voice-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(31, 157, 85, 0.14);
    color: #4ade80;
    box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.5);
    animation: onlinePulse 2.2s ease-in-out infinite;
}

.voice-modal-channel { font-size: 0.95rem; }

.voice-modal-join { min-width: 172px; }

.voice-modal-join-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.voice-modal-join.is-loading .voice-modal-join-label { display: none; }
.voice-modal-join.is-loading .voice-modal-join-spinner { display: inline-block; }

/* ---------- Perfil ---------- */

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    max-width: 760px;
}

.profile-card {
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.05);
    border-radius: 12px;
    padding: 20px;
    animation: fadeInUp 0.35s var(--dm-ease) both;
}
.profile-card-wide { grid-column: 1 / -1; }   /* ocupa a largura toda (ex.: temas) */

/* Minhas Gravações: grade de itens com preview em <video> + ações. */
.rec-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.rec-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(var(--dm-fg-rgb), 0.03);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.06);
    border-radius: 10px;
    padding: 10px;
}
.rec-video {
    width: 100%;
    max-height: 220px;
    background: #000;
    border-radius: 8px;
}
.rec-title { font-weight: 600; font-size: 0.9rem; word-break: break-word; }
.rec-actions { display: flex; gap: 8px; margin-top: 6px; }

/* Conversão WebM->MP4 em andamento: barra de progresso no card da gravação. */
.rec-processing {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    padding: 16px 12px;
    background: rgba(var(--dm-primary-rgb), 0.06);
    border-radius: 8px;
}
.rec-processing-top {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(var(--dm-fg-rgb), 0.82);
}
.rec-processing-label { flex: 1; }
.rec-processing-pct { font-variant-numeric: tabular-nums; font-weight: 700; }
.rec-spin {
    width: 14px; height: 14px; flex: none;
    border: 2px solid rgba(var(--dm-fg-rgb), 0.2);
    border-top-color: var(--dm-accent);
    border-radius: 50%;
    animation: rec-spin 0.8s linear infinite;
}
@keyframes rec-spin { to { transform: rotate(360deg); } }
.rec-progress {
    height: 8px;
    border-radius: 999px;
    background: rgba(var(--dm-fg-rgb), 0.12);
    overflow: hidden;
}
.rec-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--dm-primary), var(--dm-accent));
    transition: width 0.4s var(--dm-ease);
}
/* Sem duração conhecida -> barra indeterminada (varre da esquerda p/ direita). */
.rec-progress.indeterminate .rec-progress-bar {
    width: 40%;
    animation: rec-indeterminate 1.3s var(--dm-ease) infinite;
}
@keyframes rec-indeterminate {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}

/* ---------- Teste de microfone (perfil) ---------- */

/* Barra de nível: fundo fixo, preenchimento que segue o RMS e uma marca
   vertical na posição do limiar de "falando" (a sensibilidade). */
.mic-meter {
    position: relative;
    height: 14px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.mic-meter-fill {
    height: 100%;
    width: 0;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--dm-primary), #4ade80);
    transition: width 60ms linear;
}

/* A marca não deve ser cortada pelo overflow do fill, então fica acima dele. */
.mic-meter-mark {
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: 0;
    width: 2px;
    background: rgba(var(--dm-fg-rgb), 0.85);
    transform: translateX(-1px);
}

/* "Falando": apagado por padrão, acende em verde quando a barra passa da marca. */
.mic-speaking-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: rgba(var(--dm-fg-rgb), 0.35);
    transition: color 0.1s var(--dm-ease);
}
.mic-speaking-dot::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
}
.mic-speaking-dot.on { color: #4ade80; }

.mic-test-sep {
    margin: 16px 0;
    border: 0;
    border-top: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}

/* ---------- Coluna 3: chat ---------- */

.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--dm-main);
    min-width: 0;
    min-height: 0;   /* permite a área de mensagens rolar sem estourar a coluna */
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.3s var(--dm-ease) both;
}

.chat-header .hash {
    font-size: 1.3rem;
    font-weight: 600;
    color: rgba(var(--dm-fg-rgb), 0.35);
}

.chat-header-name { font-weight: 700; }

.chat-header-sep {
    width: 1px;
    height: 20px;
    background: rgba(var(--dm-fg-rgb), 0.12);
    margin: 0 4px;
}

.chat-header-topic {
    font-size: 0.83rem;
    color: rgba(var(--dm-fg-rgb), 0.5);
    min-width: 0;
}

.chat-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(var(--dm-fg-rgb), 0.55);
    transition: background-color 0.2s var(--dm-ease), color 0.2s var(--dm-ease), transform 0.15s var(--dm-ease-snap);
}

.header-btn:hover {
    background: rgba(var(--dm-fg-rgb), 0.07);
    color: #fff;
    transform: translateY(-1px);
}

.header-btn-video:hover { color: var(--dm-accent); }
.header-btn-danger:hover { color: #ff6b6b; background: rgba(220, 53, 69, 0.15); }

.header-btn.dropdown-toggle::after { display: none; }

.chat-scroll {
    flex: 1;
    min-height: 0;   /* rola por dentro em vez de empurrar o composer */
    overflow-y: auto;
    padding: 16px 16px 8px;
    scroll-behavior: smooth;
}

.channel-start {
    padding: 24px 8px 20px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.06);
    animation: fadeInUp 0.45s var(--dm-ease) both;
}

.channel-start-hash {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--dm-raised);
    color: rgba(var(--dm-fg-rgb), 0.6);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.msg {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 3px 8px;
    margin-top: 12px;
    border-radius: 6px;
    transition: background-color 0.15s var(--dm-ease);
    animation: fadeInUp 0.3s var(--dm-ease) both;
    animation-delay: calc(var(--i, 0) * 25ms);
}

.msg.grouped { margin-top: 0; }

.msg:hover { background: rgba(var(--dm-fg-rgb), 0.025); }

/* Ações da mensagem (apagar) - aparecem ao passar o mouse. */
.msg-actions {
    position: absolute;
    top: -10px;
    right: 10px;
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    background: var(--dm-raised, #1b1e26);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s var(--dm-ease);
}
.msg:hover .msg-actions { opacity: 1; pointer-events: auto; }

.msg-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(var(--dm-fg-rgb), 0.6);
    cursor: pointer;
    transition: background-color 0.12s var(--dm-ease), color 0.12s var(--dm-ease);
}
.msg-delete:hover { background: rgba(220, 53, 69, 0.85); color: #fff; }

.msg-in { animation: messageIn 0.32s var(--dm-ease-snap) both; }

@keyframes messageIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-body { min-width: 0; flex: 1; }

.msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.msg-author {
    font-weight: 600;
    color: #e8f4fb;
}

.msg-time {
    font-size: 0.7rem;
    color: rgba(var(--dm-fg-rgb), 0.35);
}

.msg-text {
    font-size: 0.925rem;
    color: rgba(var(--dm-fg-rgb), 0.85);
    word-wrap: break-word;
}

/* ---------- Anexos na timeline ---------- */
.msg-media {
    display: inline-block;
    margin-top: 4px;
    max-width: min(400px, 100%);
    border-radius: 10px;
    overflow: hidden;
    line-height: 0;
    background: rgba(0, 0, 0, 0.2);
    transition: transform 0.15s var(--dm-ease-snap), box-shadow 0.2s var(--dm-ease);
}
.msg-media img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    object-fit: cover;
}
.msg-media:hover { transform: scale(1.01); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.6); }

.msg-file {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding: 10px 14px;
    max-width: 320px;
    border-radius: 10px;
    background: rgba(var(--dm-fg-rgb), 0.06);
    color: rgba(var(--dm-fg-rgb), 0.85);
    text-decoration: none;
    transition: background-color 0.2s var(--dm-ease);
}
.msg-file:hover { background: rgba(var(--dm-fg-rgb), 0.12); color: #fff; }
.msg-file svg { flex-shrink: 0; color: var(--dm-accent); }
.msg-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }

/* ---------- Indicador "digitando..." ---------- */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 24px;
    font-size: 0.78rem;
    color: rgba(var(--dm-fg-rgb), 0.6);
    min-height: 22px;
}

.typing-dots { display: inline-flex; gap: 3px; }

.typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--dm-accent);
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Composer ---------- */

.composer {
    position: relative;
    flex-shrink: 0;   /* nunca encolhe nem some quando o chat cresce (ex: fotos) */
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 16px 20px;
    padding: 6px 6px 6px 14px;
    border-radius: 12px;
    background: var(--dm-raised);
    transition: box-shadow 0.25s var(--dm-ease);
}

.composer:focus-within {
    box-shadow: 0 0 0 2px rgba(var(--dm-primary-rgb), 0.4);
}

.composer-attach {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--dm-fg-rgb), 0.5);
    cursor: pointer;
    transition: color 0.2s var(--dm-ease), transform 0.15s var(--dm-ease-snap);
}

.composer-attach:hover { color: var(--dm-accent); transform: scale(1.12); }

.composer-form {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
}

.composer-input {
    flex: 1;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 0.92rem;
    outline: none;
    padding: 8px 0;
}

.composer-input::placeholder { color: rgba(var(--dm-fg-rgb), 0.35); }

.composer-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--dm-primary), #0091d6);
    color: #fff;
    transition: transform 0.15s var(--dm-ease-snap), box-shadow 0.25s var(--dm-ease), background 0.2s var(--dm-ease);
}

.composer-send:hover {
    background: linear-gradient(135deg, #0091d6, var(--dm-accent));
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -6px rgba(var(--dm-primary-rgb), 0.7);
}

.composer-send:active { transform: scale(0.94); }

/* ---------- Emojis ---------- */
.composer-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: rgba(var(--dm-fg-rgb), 0.5);
    cursor: pointer;
    transition: color 0.2s var(--dm-ease), transform 0.15s var(--dm-ease-snap);
}
.composer-emoji:hover { color: #ffcc4d; transform: scale(1.12); }

.emoji-picker {
    position: absolute;
    right: 6px;
    bottom: calc(100% + 8px);
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    width: 320px;
    max-height: 240px;
    overflow-y: auto;
    padding: 10px;
    border-radius: 12px;
    background: var(--dm-raised, #1b1e26);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    animation: dm-emoji-in 0.16s var(--dm-ease);
}

@keyframes dm-emoji-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.emoji-item {
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 4px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s var(--dm-ease), transform 0.12s var(--dm-ease-snap);
}
.emoji-item:hover { background: rgba(var(--dm-fg-rgb), 0.12); transform: scale(1.18); }

/* ---------- Coluna 4: membros online ---------- */

.members-col {
    background: var(--dm-col);
    overflow-y: auto;
    padding: 16px 12px;
}
/* Os botões de gaveta só existem no responsivo; ver as media queries. */
.members-toggle, .channel-toggle { display: none; }

/* ---- Painel de novidades (modal do primeiro login numa versão) ------------ */
.news-modal {
    position: fixed; inset: 0; z-index: 2000;
    display: grid; place-items: center; padding: 16px;
    background: rgba(3, 7, 15, 0.72); backdrop-filter: blur(4px);
    animation: news-fade 0.18s var(--dm-ease);
}
@keyframes news-fade { from { opacity: 0; } }
.news-card {
    width: min(520px, 100%); max-height: 85vh; display: flex; flex-direction: column;
    background: var(--dm-raised); color: #fff;
    border: 1px solid rgba(var(--dm-primary-rgb), 0.25); border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); overflow: hidden;
    animation: news-pop 0.22s var(--dm-ease-snap);
}
@keyframes news-pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.news-head {
    position: relative; padding: 22px 24px 16px;
    background: linear-gradient(135deg, var(--dm-secondary), var(--dm-primary));
}
.news-eyebrow {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: rgba(var(--dm-fg-rgb), 0.75);
}
.news-title { margin: 4px 0 0; font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.news-close {
    position: absolute; top: 14px; right: 16px; width: 32px; height: 32px;
    border: none; border-radius: 8px; cursor: pointer; font-size: 1.25rem; line-height: 1;
    background: rgba(var(--dm-fg-rgb), 0.15); color: #fff;
}
.news-close:hover { background: rgba(var(--dm-fg-rgb), 0.28); }
.news-body { padding: 18px 24px; overflow-y: auto; }
.news-group + .news-group { margin-top: 18px; }
.news-group-label {
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.05em; margin-bottom: 8px;
}
.news-label-novidade { color: var(--dm-accent); }
.news-label-fix { color: var(--dm-success); }
.news-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.news-list li { font-size: 0.9rem; line-height: 1.45; }
.news-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 24px; border-top: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.news-version { font-size: 0.72rem; color: rgba(var(--dm-fg-rgb), 0.4); }
.news-ok {
    padding: 9px 22px; border: none; border-radius: 10px; cursor: pointer;
    font: 700 0.88rem "Inter", system-ui, sans-serif; color: #fff;
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
}
.news-ok:hover { filter: brightness(1.08); }

/* Admin: cadastro de novidades (lista + formulário). */
.news-admin { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 20px; padding: 18px; max-width: 900px; }
.news-admin-list-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(var(--dm-fg-rgb), 0.45); }
.news-admin-new { color: var(--dm-accent); text-decoration: none; font-weight: 700; }
.news-admin-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #fff; margin-bottom: 4px; background: rgba(var(--dm-fg-rgb), 0.04); }
.news-admin-item:hover { background: rgba(var(--dm-fg-rgb), 0.09); }
.news-admin-item.active { background: rgba(var(--dm-primary-rgb), 0.18); }
.news-admin-item.is-off { opacity: 0.55; }
.news-admin-ver { font-weight: 700; font-size: 0.8rem; }
.news-admin-tit { flex: 1; min-width: 0; font-size: 0.82rem; color: rgba(var(--dm-fg-rgb), 0.7); }
.news-admin-badge { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; background: var(--dm-success); }
.news-admin-empty { padding: 10px 12px; font-size: 0.85rem; color: rgba(var(--dm-fg-rgb), 0.45); }
.news-admin-form { display: flex; flex-direction: column; gap: 14px; }
.news-fld { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; font-weight: 600; color: rgba(var(--dm-fg-rgb), 0.7); }
.news-fld input, .news-fld textarea { padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(var(--dm-fg-rgb), 0.12); background: rgba(var(--dm-fg-rgb), 0.06); color: #fff; font: 400 0.9rem "Inter", system-ui, sans-serif; }
.news-fld input:focus, .news-fld textarea:focus { outline: none; border-color: var(--dm-primary); }
.news-fld input[readonly] { opacity: 0.6; cursor: not-allowed; }
.news-fld textarea { resize: vertical; min-height: 90px; }
.news-hint { font-weight: 400; font-size: 0.72rem; color: rgba(var(--dm-fg-rgb), 0.4); }
.news-check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: rgba(var(--dm-fg-rgb), 0.8); }
.news-admin-save { align-self: flex-start; padding: 10px 26px; border: none; border-radius: 10px; cursor: pointer; font: 700 0.88rem "Inter", system-ui, sans-serif; color: #fff; background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent)); }
.news-admin-save:hover { filter: brightness(1.08); }
@media (max-width: 780px) { .news-admin { grid-template-columns: 1fr; } }

.members-label {
    padding: 0 6px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(var(--dm-fg-rgb), 0.45);
}

/* Campo de busca (filtro de online e de conversas). */
.rail-search {
    display: block;
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    color: #fff;
    background: rgba(var(--dm-fg-rgb), 0.06);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s var(--dm-ease), background-color 0.15s var(--dm-ease);
}
.rail-search::placeholder { color: rgba(var(--dm-fg-rgb), 0.4); }
.rail-search:focus {
    border-color: var(--dm-accent, #8ab4f8);
    background: rgba(var(--dm-fg-rgb), 0.09);
}
.rail-search-empty {
    padding: 4px 12px;
    font-size: 0.78rem;
    color: rgba(var(--dm-fg-rgb), 0.4);
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background-color 0.18s var(--dm-ease), transform 0.18s var(--dm-ease);
    animation: fadeInUp 0.3s var(--dm-ease) both;
    animation-delay: calc(var(--i, 0) * 40ms);
}

.member-item:hover {
    background: rgba(var(--dm-fg-rgb), 0.05);
    transform: translateX(2px);
}

/* Membro clicável -> abre a DM (o item vira um link) */
a.member-dm { text-decoration: none; color: inherit; cursor: pointer; }
a.member-dm:hover .member-name { color: #fff; }

/* Membro bloqueado (operador vendo colega): visível, mas sem ação de conversa. */
.member-item.member-blocked { cursor: default; }
.member-item.member-blocked:hover { transform: none; }

/* Conversa na lista de DMs (avatar + nome) */
.dm-link .avatar-sm { flex-shrink: 0; }
.dm-link .channel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.channel-link.has-unread .channel-name { color: #fff; font-weight: 600; }

.dm-tag {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 6px;
    border-radius: 5px;
    background: #f23f42;
    color: #fff;
}
.dm-dot {
    margin-left: auto;
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f23f42;
}

/* Seção "Solicitações" (DMs pendentes), separada das conversas aceitas. */
.dm-requests-section[hidden] { display: none; }
.dm-req-count {
    flex-shrink: 0;
    min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0;
    background: var(--dm-primary); color: #fff;
}
/* Item de solicitação: leve destaque para pedir atenção. */
.dm-link.dm-request { background: rgba(var(--dm-primary-rgb), 0.06); }
.dm-link.dm-request:hover { background: rgba(var(--dm-primary-rgb), 0.12); }

/* Badge de notificação no botão de DMs do rail */
.rail-dm { position: relative; }
.rail-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #f23f42;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border: 2px solid var(--dm-rail);
}
.rail-badge[hidden] { display: none; }

/* Ponto de menção pendente no botão do servidor (rail) */
.rail-server { position: relative; }
.rail-dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f23f42;
    border: 2px solid var(--dm-rail);
}
.rail-dot[hidden] { display: none; }

/* Badge de menção pendente no canal (sidebar de canais) */
.channel-link.has-mention .channel-name { color: #fff; font-weight: 600; }
.mention-badge {
    margin-left: auto;
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #f23f42;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
}
.mention-badge[hidden] { display: none; }

/* @menção realçada no corpo da mensagem */
.mention {
    color: #c9d2ff;
    background: rgba(var(--dm-primary-rgb), 0.22);
    border-radius: 4px;
    padding: 0 3px;
    font-weight: 600;
}
.mention.is-me {
    color: #fff;
    background: rgba(var(--dm-primary-rgb), 0.55);
}

/* Banner de solicitação de conversa (DM pendente) */
.dm-request-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 10px 16px 0;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(var(--dm-primary-rgb), 0.14);
    border: 1px solid rgba(var(--dm-primary-rgb), 0.35);
}
.dm-request-text { min-width: 0; font-size: 0.9rem; }
.dm-request-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Mensagens efêmeras (retorno de comandos, sussurros) - só você vê */
.msg-ephemeral {
    margin: 4px 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    background: rgba(var(--dm-fg-rgb), 0.04);
    color: rgba(var(--dm-fg-rgb), 0.6);
    border-left: 3px solid rgba(var(--dm-fg-rgb), 0.2);
    animation: fadeInUp 0.25s var(--dm-ease) both;
}
.msg-ephemeral.err { color: #ff8896; border-left-color: #dc3545; }
.msg-ephemeral.ok { color: #6ee7a8; border-left-color: #23a55a; }
.msg-ephemeral.info { color: rgba(var(--dm-fg-rgb), 0.72); }
.msg-ephemeral.whisper { color: #d8b4fe; border-left-color: #9b59f6; font-style: italic; }

/* ---- Autocomplete de comandos/usuários no composer ---- */
.cmd-autocomplete {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 40;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 12px;
    background: var(--dm-raised, #2b2d31);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    animation: fadeInUp 0.14s var(--dm-ease) both;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(var(--dm-fg-rgb), 0.82);
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}
.ac-item.active { background: rgba(var(--dm-primary-rgb), 0.28); color: #fff; }

.ac-cmd { font-weight: 600; color: #fff; }
.ac-desc { color: rgba(var(--dm-fg-rgb), 0.5); font-size: 0.82rem; }

.ac-av {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--dm-primary-rgb), 0.4);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}
.ac-name { font-weight: 500; }
.ac-login { margin-left: auto; color: rgba(var(--dm-fg-rgb), 0.4); font-size: 0.8rem; }

/* ---- Toast flutuante de sussurro recebido (fora de um canal) ---- */
.whisper-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
}
.whisper-toast {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--dm-raised, #2b2d31);
    border-left: 3px solid #9b59f6;
    color: #d8b4fe;
    font-size: 0.88rem;
    font-style: italic;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    animation: fadeInUp 0.2s var(--dm-ease) both;
}

.member-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(var(--dm-fg-rgb), 0.8);
}

.member-role {
    font-size: 0.68rem;
    color: rgba(var(--dm-fg-rgb), 0.4);
    text-transform: capitalize;
}
/* Status manual (/ausente, /ocupado) no lugar do papel. */
.member-role.member-status {
    text-transform: none;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.member-status.ausente { color: #f0b23f; }
.member-status.ocupado { color: #f23f42; }
.member-item.member-away .avatar-sm { opacity: 0.55; }
.member-item.member-away .member-name { color: rgba(var(--dm-fg-rgb), 0.55); }

/* ---------- Painéis centrais (boas-vindas, formulário) ---------- */

.welcome-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    animation: fadeInUp 0.5s var(--dm-ease) both;
}

.form-pane {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}

.form-card {
    width: 100%;
    max-width: 460px;
    padding: 28px;
    border-radius: 14px;
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.05);
}

.content-pane {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    animation: fadeInUp 0.35s var(--dm-ease) both;
}

.audit-row {
    animation: fadeInUp 0.3s var(--dm-ease) both;
    animation-delay: calc(var(--i, 0) * 20ms);
}

.server-hero {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
    border-radius: 22px;
}

/* ---------- Toasts (flash messages) ---------- */

.toast-stack {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: min(440px, calc(100vw - 32px));
}

.toast-stack .alert { animation: fadeInUp 0.3s var(--dm-ease) both; }

/* ---------- Sidebar clássica (páginas fora do chat: auditoria) ---------- */

.app-sidebar {
    background: linear-gradient(165deg, var(--dm-secondary) 0%, #081426 100%);
    border-radius: 16px;
    color: #fff;
    animation: sidebarSlideIn 0.5s var(--dm-ease) both;
}

@keyframes sidebarSlideIn {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

.brand-link { text-decoration: none; color: #fff; }

.app-sidebar .nav-link {
    position: relative;
    color: rgba(var(--dm-fg-rgb), 0.72);
    border-radius: 8px;
    overflow: hidden;
    transition: color 0.2s var(--dm-ease), background-color 0.25s var(--dm-ease), transform 0.2s var(--dm-ease);
}

.app-sidebar .nav-link::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--dm-primary), var(--dm-accent));
    transform: scaleY(0);
    transition: transform 0.25s var(--dm-ease);
    border-radius: 0 3px 3px 0;
}

.app-sidebar .nav-link:hover {
    background-color: rgba(var(--dm-primary-rgb), 0.16);
    color: #fff;
    transform: translateX(2px);
}

.app-sidebar .nav-link.active {
    background-color: rgba(var(--dm-primary-rgb), 0.25);
    color: #fff;
}

.app-sidebar .nav-link.active::before,
.app-sidebar .nav-link:hover::before { transform: scaleY(1); }

.role-badge {
    background: linear-gradient(135deg, rgba(var(--dm-primary-rgb), 0.9), rgba(var(--dm-accent-rgb), 0.85));
    color: #fff;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

#profileDropdown {
    border-radius: 8px;
    padding: 6px 8px;
    transition: background-color 0.2s var(--dm-ease);
}

#profileDropdown:hover { background-color: rgba(var(--dm-fg-rgb), 0.06); }

.dropdown-menu { animation: fadeInUp 0.18s var(--dm-ease) both; }

.main-content {
    animation: fadeInUp 0.4s var(--dm-ease) both;
    animation-delay: 0.05s;
}

.alert { animation: fadeInUp 0.3s var(--dm-ease) both; }

/* ---------- Tabelas (auditoria) ---------- */

.table tbody tr { transition: background-color 0.15s var(--dm-ease); }
.table-hover tbody tr:hover { background-color: rgba(var(--dm-primary-rgb), 0.08); }
.table .badge { transition: transform 0.15s var(--dm-ease); }
.table tbody tr:hover .badge { transform: translateY(-1px); }

/* ---------- Admin: usuários e papéis ---------- */
.admin-user-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.admin-user-id {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    flex: 1 1 220px;
}
.admin-user-name { font-weight: 600; }
.admin-user-meta { font-size: 0.78rem; color: var(--dm-text-muted, rgba(var(--dm-fg-rgb), 0.5)); }
.admin-user-badges { display: flex; align-items: center; gap: 8px; }
.admin-role-badge {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    background: rgba(var(--dm-fg-rgb), 0.08);
    color: rgba(var(--dm-fg-rgb), 0.85);
}
.admin-role-badge.role-administrador { background: rgba(242, 63, 66, 0.22); color: #ff8f96; }
.admin-role-badge.role-gestor { background: rgba(88, 101, 242, 0.24); color: #a9b2ff; }
.admin-role-badge.role-colaborador { background: rgba(35, 165, 89, 0.22); color: #7ee2a8; }
.admin-role-badge.role-visitante { background: rgba(var(--dm-fg-rgb), 0.1); color: rgba(var(--dm-fg-rgb), 0.7); }
.admin-override-tag {
    font-size: 0.7rem;
    color: #ffd23f;
    border: 1px solid rgba(255, 210, 63, 0.4);
    border-radius: 6px;
    padding: 1px 6px;
}
.admin-override-tag.ad { color: rgba(var(--dm-fg-rgb), 0.5); border-color: rgba(var(--dm-fg-rgb), 0.2); }
.admin-revert {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0 0 0 4px;
    font-size: 0.8rem;
    line-height: 1;
    opacity: 0.7;
}
.admin-revert:hover { opacity: 1; color: #ff8f96; }
.admin-user-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.admin-user-form .form-select { width: auto; min-width: 150px; }

/* Busca da aba "Pessoas e papéis". Reusa .rail-search (mesmo campo do filtro de
   online/DMs) com largura maior, já que aqui há espaço. */
.admin-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.admin-search { flex: 1; max-width: 420px; margin: 0; }
.admin-search-count {
    font-size: 0.75rem;
    color: rgba(var(--dm-fg-rgb), 0.45);
    white-space: nowrap;
}
.admin-user-item[hidden] { display: none; }

/* Abas da tela de acesso (/admin/usuarios). O painel ativo é controlado por
   [hidden] no JS (initAdminTabs), não por CSS. */
.admin-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.admin-tab {
    position: relative;
    border: 0;
    background: transparent;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(var(--dm-fg-rgb), 0.55);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: color 0.15s var(--dm-ease), background-color 0.15s var(--dm-ease);
}
.admin-tab:hover { color: rgba(var(--dm-fg-rgb), 0.85); background: rgba(var(--dm-fg-rgb), 0.04); }
.admin-tab.active { color: #fff; }
/* Sublinhado da aba ativa, alinhado com a borda do .admin-tabs. */
.admin-tab.active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--dm-primary);
}
.admin-tab:focus-visible {
    outline: 2px solid var(--dm-primary);
    outline-offset: -2px;
}
/* Sem JS (ou antes de initAdminTabs rodar) os dois painéis aparecem empilhados:
   a tela continua utilizável, só perde a separação em abas. */
.admin-panel[hidden] { display: none; }

/* Aba "Visibilidade de servidores" */
.vis-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.vis-server {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 210px;
}
.vis-server-nome { font-weight: 600; color: rgba(var(--dm-fg-rgb), 0.9); }
.vis-server-tag { font-size: 0.72rem; color: rgba(var(--dm-fg-rgb), 0.4); }
.vis-server-tag.restrito { color: #ffd23f; }
.vis-papeis {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    flex: 1;
    min-width: 220px;
}
.vis-row > .btn { margin-left: auto; }

/* Aba "Organização da rail": as abinhas oferecidas para cada servidor. Mesmo
   ritmo dos checkboxes da visibilidade, só que em rádio (é escolha única). */
.rail-org-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    flex: 1;
    min-width: 220px;
}

/* Criação de papel personalizado, acima da matriz. */
.role-new,
.admin-import {
    background: rgba(var(--dm-fg-rgb), 0.03);
    border: 1px solid var(--line, rgba(var(--dm-fg-rgb), 0.08));
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.admin-import-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.admin-import-file { flex: 1 1 240px; max-width: 340px; }
.admin-import-hint {
    margin: 10px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: rgba(var(--dm-fg-rgb), 0.45);
}
.role-new-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.role-new-nome { flex: 1 1 240px; max-width: 320px; }
.role-new-base {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: rgba(var(--dm-fg-rgb), 0.5);
    white-space: nowrap;
}
.role-new-base .form-select { width: auto; min-width: 150px; }
.role-new-hint {
    margin: 10px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: rgba(var(--dm-fg-rgb), 0.45);
}
/* Marca a coluna de um papel criado no site (vs. os quatro de fábrica). */
.role-custom-tag {
    display: block;
    margin-top: 3px;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ffd23f;
}
.perm-remove {
    color: rgba(var(--dm-fg-rgb), 0.5);
    text-decoration: none;
    padding: 0 4px;
}
.perm-remove:hover:not(:disabled) { color: #ff8f96; text-decoration: underline; }
.perm-remove:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Matriz de permissões por papel (seção de /admin/usuarios) ---------- */

/* A tabela pode ficar mais larga que a coluna principal: rola sozinha em vez
   de empurrar o shell (mesma regra dos blocos largos do chat). */
.perm-table-wrap { overflow-x: auto; }
.perm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.perm-table th,
.perm-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.06);
    text-align: center;
    vertical-align: middle;
}
.perm-table thead th {
    position: sticky;
    top: 0;
    background: #2b2d31;
    color: rgba(var(--dm-fg-rgb), 0.85);
    font-weight: 600;
    white-space: nowrap;
}
.perm-table tbody tr:hover td,
.perm-table tbody tr:hover .perm-label { background: rgba(var(--dm-fg-rgb), 0.03); }
/* Prefixado com .perm-table para vencer o `text-align: center` de `.perm-table th`
   (mesma especificidade não bastaria). */
.perm-table .perm-label {
    text-align: left;
    font-weight: 500;
    color: rgba(var(--dm-fg-rgb), 0.9);
    min-width: 260px;
}
.perm-key {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.68rem;
    color: rgba(var(--dm-fg-rgb), 0.35);
}
.perm-table .perm-group th {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
    color: rgba(var(--dm-fg-rgb), 0.45);
    padding-top: 16px;
    border-bottom: none;
}
/* Coluna do administrador: sempre marcada e desabilitada (trava anti-lockout),
   então fica visualmente apagada para não parecer editável. */
.perm-col-admin { opacity: 0.45; }
.perm-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #5865f2;
    cursor: pointer;
}
.perm-table input[type="checkbox"]:disabled { cursor: not-allowed; }
.perm-actions { white-space: nowrap; padding-top: 14px; }
.perm-reset {
    color: rgba(var(--dm-fg-rgb), 0.5);
    text-decoration: none;
    padding: 0 4px;
}
.perm-reset:hover { color: #ff8f96; text-decoration: underline; }

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {
    /* Membros viram gaveta -> a faixa de 240px SAI do grid (senão vira uma coluna
       fantasma vazia comendo o conteúdo). Precisa cobrir TAMBÉM .no-channel-col:
       ela é mais específica (0,2,0) que só .chat-app (0,1,0) e, sem isto, mantinha
       o grid do desktop na home (rail gorda + 240px fantasma = tela "bugada"). */
    .chat-app { grid-template-columns: var(--rail-w, 72px) var(--chan-w, 240px) 1fr; }
    .chat-app.no-channel-col { grid-template-columns: var(--rail-w, 72px) 1fr; }
    /* Antes a rail direita sumia sem volta (display:none). Agora vira uma GAVETA
       lateral, aberta pelo #members-toggle - some do fluxo mas continua acessível. */
    .members-col {
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 1150;
        width: min(280px, 85vw);
        transform: translateX(100%);
        transition: transform 0.22s var(--dm-ease);
        box-shadow: -10px 0 34px rgba(0, 0, 0, 0.5);
    }
    .members-col.open { transform: none; }
    /* Backdrop compartilhado pelas duas gavetas (canais e membros). */
    .drawer-backdrop { position: fixed; inset: 0; z-index: 1140; background: rgba(0, 0, 0, 0.5); }
    .drawer-backdrop[hidden] { display: none; }
    .members-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        position: fixed; top: 10px; right: 12px; z-index: 60;
        width: 40px; height: 40px; border-radius: 10px;
        border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
        background: var(--dm-raised); color: #fff; cursor: pointer;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    }
    .members-toggle.open { background: var(--dm-primary); border-color: transparent; }
    .temp-room-fab { right: 62px; }  /* abre espaço para o toggle da rail direita */
}

@media (max-width: 780px) {
    /* Canais também viram gaveta -> só rail + conteúdo. Rail fixa em 72px aqui
       (ignora o --rail-w persistido do desktop, que num celular deixaria a rail
       gorda demais). Cobre .no-channel-col pelo mesmo motivo de especificidade. */
    .chat-app,
    .chat-app.no-channel-col { grid-template-columns: 72px 1fr; }
    /* Coluna de canais/conversas também vira GAVETA (antes: display:none). Desliza
       da esquerda, logo à direita do rail (72px), que continua visível. */
    .channel-col {
        display: flex; flex-direction: column;
        position: fixed; top: 0; bottom: 0; left: 72px; z-index: 1150;
        width: min(260px, calc(88vw - 72px));
        transform: translateX(calc(-100% - 72px));
        transition: transform 0.22s var(--dm-ease);
    }
    .channel-col.open { transform: none; box-shadow: 12px 0 34px rgba(0, 0, 0, 0.5); }
    /* Colunas viraram gavetas / rail é fixa: alças de arrastar não fazem sentido no
       touch e, com o --rail-w persistido, cairiam sobre o conteúdo. */
    .chan-resizer, .rail-resizer { display: none; }
    /* Na home (sem coluna de canais) não há o que abrir: some com a gaveta e o botão. */
    .chat-app.no-channel-col .channel-col,
    .chat-app.no-channel-col .channel-toggle { display: none; }
    .channel-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        position: fixed; top: 10px; left: 84px; z-index: 60;
        width: 40px; height: 40px; border-radius: 10px;
        border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
        background: var(--dm-raised); color: #fff; cursor: pointer;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    }
    .channel-toggle.open { background: var(--dm-primary); border-color: transparent; }

    /* Gaveta de canais mais ACESSÍVEL no celular: os links tinham ~34px de altura
       e fonte 0.9rem (apertados pro dedo). Aqui ficam com ~44px (alvo de toque
       confortável), fonte e avatares maiores, e a lista respira mais. */
    .channel-col { width: min(320px, calc(90vw - 72px)); }
    .channel-col-scroll { padding: 10px 10px 16px; }
    .channel-link {
        padding: 11px 12px;      /* ~44px de altura total */
        margin: 2px 0;
        gap: 12px;
        font-size: 1rem;
        border-radius: 10px;
    }
    .channel-link .hash { font-size: 1.15rem; }
    .channel-link .avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
    .channel-col-label { font-size: 0.74rem; padding: 10px 8px 4px; }
    .channel-col-title { font-size: 1.05rem; }
}

/* ---------- Acessibilidade ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---- Composer somente-leitura (sem permissão de escrita) ---- */
.composer-readonly {
    justify-content: center;
    gap: 8px;
    color: rgba(var(--dm-fg-rgb), 0.55);
    font-size: 0.85rem;
    background: rgba(var(--dm-fg-rgb), 0.03);
    cursor: default;
}

/* ---- Página de configuração do servidor ---- */
.config-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.config-card {
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.06);
    border-radius: 14px;
    padding: 18px 20px;
}
.config-photo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.config-photo {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    object-fit: cover;
    flex-shrink: 0;
}
.config-photo-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.6rem;
    color: #fff;
    background: linear-gradient(135deg, hsl(var(--hue, 210), 70%, 45%), hsl(var(--hue, 210), 70%, 30%));
}
.config-photo-form { flex: 1; min-width: 220px; }

.config-channel {
    padding: 14px 0;
    border-top: 1px solid rgba(var(--dm-fg-rgb), 0.06);
}
.config-channel:first-of-type { border-top: 0; }
.config-channel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.config-channel-name { font-weight: 700; }
.config-channel-icon { font-weight: 700; opacity: 0.7; flex-shrink: 0; }
.config-channel-input { max-width: 320px; font-weight: 600; }
.config-channel-actions { margin-top: 10px; }
.config-channel-danger { margin-top: 10px; }
.config-danger-zone { border: 1px solid rgba(220, 53, 69, 0.35); }
.config-perm-grid { display: flex; gap: 32px; flex-wrap: wrap; }
.config-perm-col { display: flex; flex-direction: column; gap: 6px; }
.config-perm-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: rgba(var(--dm-fg-rgb), 0.45);
    margin-bottom: 2px;
}
.config-perm-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    cursor: pointer;
}

/* ---- Páginas de listagem de canais (servidor / geral) ---- */
.listing-pane {
    height: 100%;
    overflow-y: auto;
    padding: 24px 28px;
}
.listing-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.listing-hero-img, .server-hero {
    width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0; object-fit: cover;
}
.avatar.server-hero { font-size: 1.2rem; }
.listing-header-info { min-width: 0; }

.listing-section { margin-bottom: 24px; }
.listing-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: rgba(var(--dm-fg-rgb), 0.45);
    margin-bottom: 10px;
}
.listing-server-icon { width: 20px; height: 20px; border-radius: 6px; object-fit: cover; }
.listing-server-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: hsl(var(--hue, 210) 60% 50%);
}

.listing-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;   /* a ocupação dos canais de voz vai para a linha de baixo */
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 10px;
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.05);
}
.listing-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    color: rgba(var(--dm-fg-rgb), 0.85);
    text-decoration: none;
    font-weight: 600;
}
.listing-link:hover { color: #fff; }
.listing-row:hover { border-color: rgba(var(--dm-primary-rgb), 0.5); }
.listing-row .hash { opacity: 0.6; font-weight: 700; }
.listing-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(var(--dm-primary-rgb), 0.25);
    color: #cfe3ff;
}
.listing-cap {
    font-size: 0.72rem;
    color: rgba(var(--dm-fg-rgb), 0.5);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
}
.listing-row .voice-users { flex-basis: 100%; }
.listing-row .voice-users:empty { display: none; }

/* Listagem geral (admin) no celular: menos padding lateral (28px de cada lado
   comia a largura útil) e itens/cabeçalho um pouco maiores e mais tocáveis. */
@media (max-width: 780px) {
    .listing-pane { padding: 16px 14px; }
    .listing-hero-img, .server-hero { width: 44px; height: 44px; border-radius: 14px; }
    .listing-row { padding: 12px; margin-bottom: 8px; }
    .listing-link { font-size: 1rem; }
}

/* ---- Sala temporária (link externo): botão flutuante + modal -------------- */
/* Só renderizado para "gestor pra cima" (capacidade sala.temporaria). Fica no
   canto superior direito, fixo, fora do fluxo das colunas do shell. */
.temp-room-fab {
    position: fixed;
    top: 14px;
    /* Fora do rail direito (.members-col, 240px): fica logo à esquerda dele.
       Quando o rail some (<=1100px), volta para a beirada (regra no responsivo). */
    right: 258px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px 9px 13px;
    border: 1px solid rgba(var(--dm-accent-rgb), 0.45);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(var(--dm-primary-rgb), 0.95), rgba(var(--dm-accent-rgb), 0.85));
    color: #fff;
    font: 600 0.85rem/1 "Inter", system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.18s var(--dm-ease), box-shadow 0.18s var(--dm-ease), filter 0.18s var(--dm-ease);
}
.temp-room-fab:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45); }
.temp-room-fab:active { transform: translateY(0); }
.temp-room-fab svg { flex: none; }

@media (max-width: 720px) {
    /* No celular o "+" vira um FAB redondo no canto INFERIOR-direito (padrão
       mobile): sai do topo, onde ficava fixo sobrepondo os toggles e o cabeçalho
       do conteúdo. Fica ACIMA do composer (~64px) para não cobrir a barra de
       mensagem, e respeita a safe-area (home indicator do iPhone). */
    .temp-room-fab {
        top: auto;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        right: 16px;
        width: 48px;
        height: 48px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
    .temp-room-fab span { display: none; }   /* vira só o "+" */
    .temp-room-fab svg { width: 20px; height: 20px; }
}

.tr-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(3, 7, 15, 0.62);
    backdrop-filter: blur(3px);
    animation: tr-fade 0.16s var(--dm-ease);
}
.tr-modal[hidden] { display: none; }
@keyframes tr-fade { from { opacity: 0; } to { opacity: 1; } }

.tr-card {
    position: relative;
    width: min(30rem, 100%);
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    border-radius: 16px;
    padding: 1.6rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: tr-pop 0.2s var(--dm-ease-snap);
}
@keyframes tr-pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.tr-close {
    position: absolute; top: 12px; right: 12px;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: none; border-radius: 8px;
    background: transparent; color: rgba(var(--dm-fg-rgb), 0.55);
    font-size: 1rem; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.tr-close:hover { background: rgba(var(--dm-fg-rgb), 0.08); color: #fff; }

.tr-title { margin: 0 0 4px; font-size: 1.2rem; font-weight: 700; color: #fff; }
.tr-sub { margin: 0 0 1.2rem; font-size: 0.85rem; color: rgba(var(--dm-fg-rgb), 0.6); }

.tr-form { display: flex; flex-direction: column; gap: 0.9rem; }
.tr-label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 0.8rem; font-weight: 600; color: rgba(var(--dm-fg-rgb), 0.75);
}
.tr-input {
    padding: 10px 12px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font: 400 0.9rem "Inter", system-ui, sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tr-input:focus {
    outline: none;
    border-color: rgba(var(--dm-accent-rgb), 0.7);
    box-shadow: 0 0 0 3px rgba(var(--dm-accent-rgb), 0.18);
}
.tr-check {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: rgba(var(--dm-fg-rgb), 0.75); cursor: pointer;
}
.tr-check input { width: 16px; height: 16px; accent-color: var(--dm-accent); }

.tr-submit, .tr-copy, .tr-open {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 11px 16px;
    border: none; border-radius: 10px;
    font: 600 0.88rem "Inter", system-ui, sans-serif;
    cursor: pointer; text-decoration: none;
    transition: filter 0.15s, transform 0.15s;
}
.tr-submit {
    margin-top: 4px;
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
    color: #fff;
}
.tr-submit:hover:not(:disabled) { filter: brightness(1.08); }
.tr-submit:disabled { opacity: 0.6; cursor: default; }

.tr-result { margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.8rem; }
.tr-result-actions { display: flex; gap: 8px; }
.tr-copy { flex: 1; background: rgba(var(--dm-accent-rgb), 0.16); color: var(--dm-accent); border: 1px solid rgba(var(--dm-accent-rgb), 0.35); }
.tr-copy:hover { filter: brightness(1.1); }
.tr-open { background: rgba(var(--dm-fg-rgb), 0.08); color: #fff; }
.tr-open:hover { background: rgba(var(--dm-fg-rgb), 0.14); }

.tr-hint { margin: 0; font-size: 0.78rem; color: rgba(var(--dm-accent-rgb), 0.9); }
.tr-error { margin: 0.9rem 0 0; font-size: 0.82rem; color: #ff8896; }
/* Disponibilidade do nome da sala (ao vivo). */
.tr-name-status { font-size: 0.76rem; font-weight: 600; }
.tr-name-status.checking { color: rgba(var(--dm-fg-rgb), 0.55); }
.tr-name-status.ok { color: #6ee7a8; }
.tr-name-status.taken { color: #ff8896; }

/* ---- Convidado/host: TELA CHEIA isolada (sem shell) — reusa a cara da overlay */
.guest-call-body {
    margin: 0;
    height: 100vh;
    background: var(--dm-rail);
    color: #fff;
    font-family: "Inter", system-ui, sans-serif;
    overflow: hidden;
}
/* A .call-stage.maximized já é tela cheia (inset:0); na página do convidado ela
   é o conteúdo inteiro (sem animação de "janela"). */
.guest-stage { animation: none; }

.guest-call-tag {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 2px 8px; border-radius: 999px;
    background: rgba(var(--dm-accent-rgb), 0.16); color: var(--dm-accent);
}
.guest-call-status { font-size: 0.82rem; color: rgba(var(--dm-fg-rgb), 0.6); }
.guest-copy-link {
    padding: 6px 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid rgba(var(--dm-accent-rgb), 0.4);
    background: rgba(var(--dm-accent-rgb), 0.14); color: var(--dm-accent);
    font: 600 0.8rem "Inter", system-ui, sans-serif;
    transition: filter 0.15s;
}
.guest-copy-link:hover { filter: brightness(1.1); }

/* Cadeado (senha da sala) + popover de configuração do PIN (só host). */
.guest-pin-btn { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; }
.guest-pin-btn .ic-lock-closed { display: none; }
.guest-pin-btn.has-pin .ic-lock-open { display: none; }
.guest-pin-btn.has-pin .ic-lock-closed { display: inline; }
.guest-pin-btn.has-pin { border-color: rgba(var(--dm-accent-rgb), 0.75); background: rgba(var(--dm-accent-rgb), 0.24); }
.guest-pin-pop {
    position: absolute; top: 52px; right: 12px; z-index: 40;
    width: 260px; max-width: calc(100vw - 24px);
    background: var(--dm-raised); border: 1px solid rgba(var(--dm-fg-rgb), 0.14);
    border-radius: 12px; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
    padding: 12px;
}
.guest-pin-pop[hidden] { display: none; }
.guest-pin-title { font-weight: 700; font-size: 0.9rem; color: rgba(var(--dm-fg-rgb), 0.95); margin-bottom: 8px; }
.guest-pin-pop input {
    width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.18); background: rgba(var(--dm-fg-rgb), 0.05);
    color: rgba(var(--dm-fg-rgb), 0.95); font: 600 1rem "Inter", system-ui, sans-serif;
    letter-spacing: 0.08em;
}
.guest-pin-pop input:focus { outline: none; border-color: var(--dm-accent); }
.guest-pin-hint { font-size: 0.76rem; color: rgba(var(--dm-fg-rgb), 0.6); margin: 8px 0 10px; line-height: 1.35; }
.guest-pin-acts { display: flex; gap: 8px; justify-content: flex-end; }
.guest-pin-primary, .guest-pin-ghost {
    border-radius: 8px; padding: 7px 14px; font-weight: 700; font-size: 0.82rem; cursor: pointer;
    border: none; transition: filter 0.15s, background-color 0.15s;
}
.guest-pin-primary { background: var(--dm-primary); color: #fff; }
.guest-pin-primary:hover { filter: brightness(1.08); }
.guest-pin-primary:disabled, .guest-pin-ghost:disabled { opacity: 0.6; cursor: default; }
.guest-pin-ghost { background: transparent; color: rgba(var(--dm-fg-rgb), 0.7); border: 1px solid rgba(var(--dm-fg-rgb), 0.15); }
.guest-pin-ghost:hover { background: rgba(242, 63, 66, 0.15); color: #fff; border-color: rgba(242, 63, 66, 0.5); }

/* Sala de espera: spinner enquanto aguarda o anfitrião. */
.gate-spinner {
    width: 32px; height: 32px; margin: 10px auto 0;
    border-radius: 50%;
    border: 3px solid rgba(var(--dm-fg-rgb), 0.15);
    border-top-color: var(--dm-accent);
    animation: gate-spin 0.8s linear infinite;
}
@keyframes gate-spin { to { transform: rotate(360deg); } }

/* Anfitrião: fila de pedidos de entrada (Admitir / Recusar). */
.host-requests {
    position: fixed; top: 66px; left: 18px; z-index: 20;
    display: flex; flex-direction: column; gap: 8px;
    max-width: min(22rem, 90vw);
}
.host-req {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 12px;
    background: var(--dm-raised); border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: tr-pop 0.18s var(--dm-ease-snap);
}
.host-req-name { font-size: 0.85rem; font-weight: 600; margin-right: auto; }
.host-req-ok, .host-req-no {
    padding: 5px 12px; border-radius: 8px; border: none; cursor: pointer;
    font: 600 0.8rem "Inter", system-ui, sans-serif; color: #fff;
}
.host-req-ok { background: var(--dm-success); }
.host-req-no { background: rgba(var(--dm-fg-rgb), 0.14); }
.host-req-ok:hover, .host-req-no:hover { filter: brightness(1.12); }

/* Quadro branco: cobre a grade quando aberto. O canvas sempre renderiza (traços
   remotos entram mesmo fechado e aparecem ao abrir). Fica dentro da .call-stage-
   body (position: relative). */
.guest-wb-wrap {
    position: absolute; inset: 12px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.15s;
    background: #12151d;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    border-radius: 12px; overflow: hidden;
}
.guest-wb-wrap.open { opacity: 1; pointer-events: auto; }
.guest-wb-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.guest-wb-toolbar { position: absolute; top: 10px; right: 10px; }
.guest-wb-tool {
    padding: 6px 14px; border-radius: 8px; border: none; cursor: pointer;
    background: rgba(var(--dm-fg-rgb), 0.12); color: #fff;
    font: 600 0.8rem "Inter", system-ui, sans-serif;
}
.guest-wb-tool:hover { background: rgba(var(--dm-fg-rgb), 0.2); }

/* Badge de mensagens não-lidas no botão de chat. */
.stage-ctrl-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 18px; height: 18px; padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; background: var(--dm-primary); color: #fff;
    font: 700 0.68rem "Inter", system-ui, sans-serif; line-height: 1;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}
.stage-ctrl-badge[hidden] { display: none; }

/* Chat: drawer à direita dentro da .call-stage-body (position: relative). */
.guest-chat-wrap {
    position: absolute; top: 12px; right: 12px; bottom: 12px;
    width: min(22rem, 90vw);
    display: flex; flex-direction: column;
    opacity: 0; transform: translateX(8px); pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    background: #12151d; border: 1px solid rgba(var(--dm-fg-rgb), 0.1);
    border-radius: 12px; overflow: hidden;
}
.guest-chat-wrap.open { opacity: 1; transform: none; pointer-events: auto; }
.guest-chat-head {
    padding: 10px 14px; font: 700 0.9rem "Inter", system-ui, sans-serif;
    border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.guest-chat-msgs {
    flex: 1; overflow-y: auto; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.gchat-msg { display: flex; flex-direction: column; gap: 2px; max-width: 88%; }
.gchat-msg-self { align-self: flex-end; align-items: flex-end; }
.gchat-who { font-size: 0.72rem; color: rgba(var(--dm-fg-rgb), 0.55); font-weight: 600; }
.gchat-text {
    padding: 7px 11px; border-radius: 12px; font-size: 0.86rem; line-height: 1.35;
    background: rgba(var(--dm-fg-rgb), 0.08); color: #fff; word-break: break-word;
}
.gchat-msg-self .gchat-text {
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
}
.guest-chat-form {
    display: flex; gap: 8px; padding: 10px;
    border-top: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.guest-chat-input {
    flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12); background: rgba(var(--dm-fg-rgb), 0.06);
    color: #fff; font: 400 0.86rem "Inter", system-ui, sans-serif;
}
.guest-chat-input:focus { outline: none; border-color: var(--dm-primary); }
.guest-chat-send {
    flex-shrink: 0; width: 40px; border: none; border-radius: 10px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; color: #fff;
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
}
.guest-chat-send:hover { filter: brightness(1.1); }
.guest-chat-attach {
    flex-shrink: 0; width: 40px; border: none; border-radius: 10px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--dm-fg-rgb), 0.08); color: rgba(var(--dm-fg-rgb), 0.75);
}
.guest-chat-attach:hover { background: rgba(var(--dm-fg-rgb), 0.16); color: #fff; }

/* Anexo: link de download dentro da bolha. */
.gchat-file {
    display: inline-flex; flex-direction: column; gap: 1px;
    padding: 8px 12px; border-radius: 12px; text-decoration: none; max-width: 100%;
    background: rgba(var(--dm-fg-rgb), 0.08); color: #fff;
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
}
.gchat-file:hover { background: rgba(var(--dm-fg-rgb), 0.14); }
.gchat-msg-self .gchat-file {
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent)); border: none;
}
.gchat-file-name { font-size: 0.85rem; font-weight: 600; word-break: break-word; }
.gchat-file-size { font-size: 0.7rem; opacity: 0.7; }

.guest-gate {
    position: fixed; inset: 0; z-index: 1050;   /* acima da .call-stage (1040) */
    display: grid; place-items: center;
    background: rgba(3, 7, 15, 0.72); backdrop-filter: blur(4px);
}
.guest-gate[hidden] { display: none; }
.guest-gate-card {
    text-align: center;
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    border-radius: 18px; padding: 2.2rem 2.4rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.guest-gate-title { margin: 1rem 0 4px; font-size: 1.3rem; font-weight: 700; }
.guest-gate-sub { margin: 0 0 1.4rem; color: rgba(var(--dm-fg-rgb), 0.65); font-size: 0.9rem; }
.gc-connect {
    padding: 12px 28px; border: none; border-radius: 12px; cursor: pointer;
    font: 700 0.95rem "Inter", system-ui, sans-serif; color: #fff;
    background: linear-gradient(135deg, var(--dm-primary), var(--dm-accent));
    transition: filter 0.15s;
}
.gc-connect:hover:not(:disabled) { filter: brightness(1.08); }
.gc-connect:disabled { opacity: 0.6; cursor: default; }

.guest-lobby {
    height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1rem;
    text-align: center; color: rgba(var(--dm-fg-rgb), 0.75);
}

/* ---- Painel admin: salas temporárias ------------------------------------- */
.salas-panel { padding: 1rem 1.2rem 2rem; max-width: 1100px; }
.salas-settings { padding-bottom: 1.2rem; border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08); }
.salas-toolbar {
    display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; margin-bottom: 1rem;
}
.salas-note {
    font-size: 0.82rem; color: rgba(var(--dm-fg-rgb), 0.72); max-width: 62ch; line-height: 1.5;
    background: rgba(var(--dm-primary-rgb), 0.12); border: 1px solid rgba(var(--dm-accent-rgb), 0.18);
    padding: 0.6rem 0.8rem; border-radius: 8px;
}
.salas-note strong { color: #fff; }
.salas-toolbar-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.salas-inline { display: inline-flex; gap: 0.35rem; align-items: center; margin: 0; }
.salas-btn {
    font-size: 0.8rem; font-weight: 600; color: #fff; text-decoration: none; cursor: pointer;
    background: rgba(var(--dm-fg-rgb), 0.08); border: 1px solid rgba(var(--dm-fg-rgb), 0.14);
    padding: 0.32rem 0.7rem; border-radius: 6px; white-space: nowrap;
}
.salas-btn:hover { background: rgba(var(--dm-primary-rgb), 0.5); border-color: var(--dm-accent); }
.salas-btn-danger { background: rgba(255, 107, 122, 0.16); border-color: rgba(255, 107, 122, 0.4); }
.salas-btn-danger:hover { background: rgba(255, 107, 122, 0.35); border-color: #ff6b7a; }
.salas-days {
    width: 3.4rem; font-size: 0.8rem; color: #fff; text-align: center;
    background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(var(--dm-fg-rgb), 0.14);
    border-radius: 6px; padding: 0.28rem 0.3rem;
}
.salas-table-wrap { overflow-x: auto; }
.salas-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.salas-table th, .salas-table td {
    text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08);
    vertical-align: top;
}
.salas-table th { color: rgba(var(--dm-fg-rgb), 0.55); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }
.salas-table tr.is-expired { opacity: 0.55; }
.salas-name { font-weight: 600; color: #fff; max-width: 22ch; }
.salas-dim { color: rgba(var(--dm-fg-rgb), 0.5); }
.salas-badges { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.25rem; }
.salas-badge {
    font-size: 0.68rem; font-weight: 600; color: var(--dm-accent);
    background: rgba(var(--dm-accent-rgb), 0.12); border: 1px solid rgba(var(--dm-accent-rgb), 0.3);
    padding: 0.05rem 0.4rem; border-radius: 999px;
}
.salas-badge-off { color: #ff9c9c; background: rgba(255, 107, 122, 0.12); border-color: rgba(255, 107, 122, 0.35); }
.salas-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.salas-empty { color: rgba(var(--dm-fg-rgb), 0.6); padding: 1.5rem 0; }
.salas-occ-val { font-weight: 600; white-space: nowrap; }
.salas-occ-live { color: #23a559; }  /* sala com call rolando agora */
/* Nome da sala clicável (abre o modal de participantes). */
.salas-name-btn {
    background: none; border: none; padding: 0; cursor: pointer; font: inherit;
    font-weight: 600; color: #fff; text-align: left; display: block;
}
.salas-name-btn:hover { color: var(--dm-accent); text-decoration: underline; }
/* Modal "quem está na sala". */
.salas-modal { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; }
.salas-modal[hidden] { display: none; }
.salas-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }
.salas-modal-card {
    position: relative; z-index: 1; width: min(420px, 92vw); max-height: 80vh; overflow: auto;
    background: var(--dm-secondary); border: 1px solid rgba(var(--dm-accent-rgb), 0.25);
    border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.salas-modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
    padding: 0.8rem 1rem; border-bottom: 1px solid rgba(var(--dm-fg-rgb), 0.08);
}
.salas-modal-title { font-weight: 700; color: #fff; }
.salas-modal-close {
    width: 30px; height: 30px; border: none; border-radius: 6px; cursor: pointer;
    background: rgba(var(--dm-fg-rgb), 0.08); color: #fff; font-size: 1.2rem; line-height: 1;
}
.salas-modal-close:hover { background: rgba(var(--dm-fg-rgb), 0.18); }
.salas-modal-body { padding: 0.9rem 1rem; }
.salas-modal-list { margin: 0; padding-left: 1.1rem; color: rgba(var(--dm-fg-rgb), 0.9); display: flex; flex-direction: column; gap: 0.3rem; }
.salas-modal-empty { color: rgba(var(--dm-fg-rgb), 0.6); margin: 0; }

/* ---- Visualizador de anexos (lightbox) -----------------------------------
   Sem card em volta: a mídia flutua sobre o fundo escurecido (estilo Discord).
   Os controles são uma barra flutuante no topo; PDF/texto ganham superfície
   própria (o próprio conteúdo), nunca um box vazio gigante. */
.fv {
    position: fixed; inset: 0; z-index: 1200;
}
.fv[hidden] { display: none; }
.fv-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(3px); }
/* O dialog cobre a tela e é transparente: só serve de contexto para a barra de
   controles, as setas e o palco centralizado. Clicar no vazio fecha (JS). */
.fv-dialog {
    position: absolute; inset: 0; background: none; border: none; box-shadow: none;
    display: flex; align-items: center; justify-content: center;
}
/* Barra de controles flutuante no topo, sobre a mídia. */
.fv-head {
    position: absolute; top: 0; left: 0; right: 0; z-index: 3;
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.7rem 1rem; pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}
.fv-head > * { pointer-events: auto; }  /* controles clicáveis; o resto da barra deixa passar */
.fv-title { font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.fv-count { font-size: 0.8rem; color: rgba(var(--dm-fg-rgb), 0.85); flex-shrink: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.fv-download {
    flex-shrink: 0; font-size: 0.82rem; font-weight: 600; text-decoration: none;
    color: #fff; background: var(--dm-primary); padding: 0.34rem 0.75rem; border-radius: 6px;
}
.fv-download:hover { background: #0091d6; }
.fv-close {
    flex-shrink: 0; width: 34px; height: 34px; border: none; border-radius: 50%; cursor: pointer;
    background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 1.4rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.fv-close:hover { background: rgba(var(--dm-fg-rgb), 0.2); }
/* Palco: centraliza o conteúdo; a moldura HUGA o conteúdo, sem quadrado sobrando. */
.fv-stage {
    position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
    max-width: 96vw; max-height: 100vh;
}
.fv-img {
    display: block; max-width: 96vw; max-height: calc(100vh - 40px);
    object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.fv-media { display: block; max-width: 96vw; max-height: calc(100vh - 40px); border-radius: 4px; }
.fv-media[controls] { width: min(900px, 96vw); }
/* PDF/texto precisam de área de leitura — é o próprio conteúdo que tem tamanho,
   não um dialog vazio. */
.fv-frame {
    width: min(1100px, 96vw); height: calc(100vh - 72px);
    border: none; background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.fv-text {
    box-sizing: border-box; width: min(900px, 96vw); max-height: calc(100vh - 96px); margin: 0; overflow: auto;
    white-space: pre-wrap; word-break: break-word; font-size: 0.82rem; line-height: 1.5;
    color: rgba(var(--dm-fg-rgb), 0.92); background: rgba(11, 37, 69, 0.96);
    border: 1px solid rgba(var(--dm-accent-rgb), 0.2);
    padding: 1rem; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.fv-note {
    position: absolute; top: 3.2rem; left: 50%; transform: translateX(-50%); z-index: 3;
    font-size: 0.75rem; color: #ffd27d; background: rgba(0, 0, 0, 0.72);
    padding: 0.25rem 0.7rem; border-radius: 999px;
}
/* Office (docx/xlsx): frame branco de leitura, como o PDF. */
.fv-office { background: #fff; }
/* Estado de carregando / sem-preview com botão de baixar. */
.fv-fallback {
    display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
    color: rgba(var(--dm-fg-rgb), 0.85); text-align: center; padding: 1.5rem;
}
.fv-fallback-msg { margin: 0; max-width: 32ch; }
/* Setas de navegação da galeria de imagens (sobre o fundo, nas bordas). */
.fv-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 46px; height: 46px; border: none; border-radius: 50%; cursor: pointer;
    background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 1.9rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.fv-nav:hover { background: rgba(var(--dm-primary-rgb), 0.9); }
.fv-nav[hidden] { display: none; }
.fv-prev { left: 0.8rem; }
.fv-next { right: 0.8rem; }
@media (max-width: 640px) {
    .fv-nav { width: 38px; height: 38px; font-size: 1.5rem; }
    .fv-frame { width: 100vw; height: calc(100vh - 64px); border-radius: 0; }
}

/* ---- Tour de primeiro acesso (coach-marks) ------------------------------- */
/* backdrop transparente só captura o clique (bloqueia a página durante o tour);
   o "buraco" iluminado vem do box-shadow gigante no .tour-hole. */
.tour-backdrop { position: fixed; inset: 0; z-index: 2999; background: transparent; }
.tour-hole {
    position: fixed;
    z-index: 3000;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62);
    pointer-events: none;
    transition: left 0.25s var(--dm-ease), top 0.25s var(--dm-ease),
                width 0.25s var(--dm-ease), height 0.25s var(--dm-ease);
}
.tour-card {
    position: fixed;
    z-index: 3001;
    width: 320px;
    max-width: calc(100vw - 20px);
    background: var(--dm-raised);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    padding: 16px 16px 12px;
    transition: left 0.2s var(--dm-ease), top 0.2s var(--dm-ease);
}
.tour-card-title { font-weight: 800; font-size: 1.02rem; color: rgba(var(--dm-fg-rgb), 0.95); margin-bottom: 6px; }
.tour-card-body { font-size: 0.9rem; color: rgba(var(--dm-fg-rgb), 0.78); line-height: 1.45; }
.tour-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.tour-card-prog { font-size: 0.78rem; color: rgba(var(--dm-fg-rgb), 0.5); font-variant-numeric: tabular-nums; }
.tour-card-acts { display: flex; gap: 8px; }
.tour-btn {
    border: none; border-radius: 8px; padding: 8px 14px;
    font-weight: 700; font-size: 0.85rem; cursor: pointer;
    background: var(--dm-primary); color: #fff;
    transition: filter 0.15s var(--dm-ease), background-color 0.15s var(--dm-ease);
}
.tour-btn:hover { filter: brightness(1.08); }
.tour-btn-ghost {
    background: transparent; color: rgba(var(--dm-fg-rgb), 0.7);
    border: 1px solid rgba(var(--dm-fg-rgb), 0.15);
}
.tour-btn-ghost:hover { background: rgba(var(--dm-fg-rgb), 0.06); color: rgba(var(--dm-fg-rgb), 0.95); }
