/* ===========================
   WHATSAPP-STYLE CHAT - style.css
   =========================== */

/* Segoe UI é nativa no Windows/Android — sem necessidade de importar do Google Fonts */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary:       #111b21;
  --bg-secondary:     #202c33;
  --bg-panel:         #2a3942;
  --bg-message-out:   #005c4b;
  --bg-message-in:    #202c33;
  --bg-input:         #2a3942;
  --bg-hover:         #2a3942;
  --bg-active:        #2a3942;
  --bg-search:        #111b21;

  --text-primary:     #e9edef;
  --text-secondary:   #8696a0;
  --text-muted:       #667781;
  --text-link:        #53bdeb;

  --accent:           #00a884;
  --accent-hover:     #02c49b;

  --border:           #222d34;
  --scrollbar:        #374045;

  --bubble-radius:    7.5px;
  --font:             'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html, body {
  height: 100%;
  /* dvh = dynamic viewport height — desconta teclado virtual no mobile */
  height: 100dvh;
  background-color: var(--bg-primary);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-primary);
  overflow: hidden;
}

/* safe-area preenchida pelo próprio input-area via padding */

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* ===========================
   LAYOUT
   =========================== */
.chat-container {
  display: flex;
  height: 100vh;
  height: 100dvh; /* desconta teclado virtual */
  width: 100vw;
  overflow: hidden;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  width: 360px;
  min-width: 300px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  /* safe-area-inset-top: respeita notch e barra de status no PWA */
  padding-top: max(10px, calc(10px + env(safe-area-inset-top)));
  background-color: var(--bg-panel);
  min-height: 59px;
  height: calc(59px + env(safe-area-inset-top));
  flex-shrink: 0;
}

.sidebar-header strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header strong::before {
  content: '';
  display: inline-block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #128c7e);
  flex-shrink: 0;
}

.sidebar-header a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--border);
}

.sidebar-header a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Barra de busca */
.sidebar-search {
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  background: var(--bg-search);
  border: none;
  border-radius: 8px;
  padding: 8px 14px 8px 36px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238696a0' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.868-3.833zm-5.242 1.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search input:focus { background-color: var(--bg-input); }

/* Lista de conversas */
.conversations-list {
  overflow-y: auto;
  flex: 1;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  min-height: 72px;
}

.chat-item:hover { background-color: var(--bg-hover); }
.chat-item.active { background-color: var(--bg-active); }

.chat-item-avatar {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  background: linear-gradient(135deg, #374045, #4a5568);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  overflow: hidden;
}

.chat-item-avatar.group {
  background: linear-gradient(135deg, #2c4458, #3a5568);
}

.chat-item-body {
  flex: 1;
  min-width: 0;
}

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.chat-name {
  font-size: 0.97rem;
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.chat-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 6px;
}

.last-message {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   CHAT AREA
   =========================== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
  /* Garante que a cor do painel preenche até a home bar */
  padding-bottom: env(safe-area-inset-bottom);
  background-image: none;
}

/* Restaura fundo apenas na área de mensagens */
.chat-area .messages {
  background-color: var(--bg-primary);
  overflow-x: hidden;   /* impede menu de contexto de vazar lateralmente */
}

/* Padrão de fundo estilo WA */
.chat-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='300' height='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='60' height='60' patternUnits='userSpaceOnUse'%3E%3Cpath d='M30 5 L5 55 L55 55 Z' fill='none' stroke='%23ffffff06' stroke-width='0.5'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='300' height='300' fill='url(%23p)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Header do chat */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, calc(10px + env(safe-area-inset-top)));
  background-color: var(--bg-panel);
  min-height: 59px;
  height: calc(59px + env(safe-area-inset-top));
  flex-shrink: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #374045, #4a5568);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  text-transform: uppercase;
}

.chat-header-info {
  flex: 1;
}

.chat-header-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.chat-header-status {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.chat-header-empty {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Área de mensagens */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8% 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  z-index: 1;
}

/* Placeholder sem conversa */
.messages-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1;
  color: var(--text-secondary);
  text-align: center;
}

.messages-placeholder-icon {
  width: 200px;
  height: 200px;
  opacity: 0.12;
}

.messages-placeholder h3 {
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--text-primary);
}

.messages-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
}

/* Bolhas de mensagem */
.message-wrapper {
  display: flex;
  margin-bottom: 1px;
}

.message-wrapper.out {
  justify-content: flex-end;
  padding-right: 4px;   /* afasta bolha da borda direita — menu de contexto fica dentro */
}

.message-wrapper.in {
  padding-left: 4px;
}

.message-wrapper.in {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 65%;
  min-width: 80px;
  padding: 6px 10px 8px;
  border-radius: var(--bubble-radius);
  position: relative;
  word-break: break-word;
  line-height: 1.4;
  font-size: 0.92rem;
  box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
}

.message-wrapper.out .message-bubble {
  background-color: var(--bg-message-out);
  border-top-right-radius: 2px;
  color: var(--text-primary);
}

.message-wrapper.in .message-bubble {
  background-color: var(--bg-message-in);
  border-top-left-radius: 2px;
  color: var(--text-primary);
}

/* Rabo da bolha (out) */
.message-wrapper.out .message-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid var(--bg-message-out);
  border-right: 8px solid transparent;
}

/* Rabo da bolha (in) */
.message-wrapper.in .message-bubble::after {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid var(--bg-message-in);
  border-left: 8px solid transparent;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  float: right;
  margin-left: 8px;
}

.message-time {
  font-size: 0.67rem;
  color: var(--text-muted);
  line-height: 1;
}

/* Ticks de leitura */
.message-ticks {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.message-ticks.read { color: #53bdeb; }

/* Remetente em grupos */
.message-sender {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 2px;
}

/* Separador de data */
.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0 8px;
  z-index: 1;
}

.date-separator span {
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 7.5px;
  box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
}

/* ===========================
   INPUT AREA
   =========================== */
.input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--bg-panel);
  z-index: 1;
  position: relative;
}

.input-area input[type="text"] {
  flex: 1;
  background: var(--bg-input);
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: background 0.15s;
  height: 42px;
}

.input-area input[type="text"]::placeholder { color: var(--text-muted); }
.input-area input[type="text"]:focus { background-color: var(--bg-search); }

.input-area button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background-color: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  font-size: 0.9rem;
}

.input-area button:hover {
  background-color: var(--accent-hover);
  transform: scale(1.05);
}

.input-area button:active { transform: scale(0.96); }

/* Ícone SVG do botão enviar */
.input-area button svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* ===========================
   LOGIN PAGE
   =========================== */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--bg-primary);
  overflow: auto;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
}

.login-card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--accent), #128c7e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo svg {
  width: 44px;
  height: 44px;
  fill: #fff;
}

.login-card h2 {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-card p.subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-form .form-group {
  margin-bottom: 16px;
  text-align: left;
}

.login-form label {
  display: block;
  font-size: .78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* Wrapper com ícone */
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* Ícone à esquerda */
.input-icon {
  position: absolute;
  left: 13px;
  color: var(--text-muted);
  font-size: .85rem;
  pointer-events: none;
  z-index: 1;
}

/* Base — todos os inputs do login com mesmo visual */
.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;          /* padrão igual ao campo nome */
  color: var(--text-primary);
  font-size: .95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, background .15s;
  height: 46px;
}

/* Com ícone à esquerda — adiciona padding-left */
.input-icon-wrapper input[type="email"],
.input-icon-wrapper input[type="password"],
.input-icon-wrapper input[type="text"] {
  padding-left: 38px;
}

/* Com botão olho à direita — adiciona padding-right */
.input-icon-wrapper input[type="password"] {
  padding-right: 44px;
}

.login-form input::placeholder { color: var(--text-muted); }

.login-form input:focus {
  border-color: var(--accent);
  background: var(--bg-search);
}

/* Botão mostrar/ocultar senha */
.btn-toggle-senha {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .88rem;
  padding: 6px;
  transition: color .15s;
  line-height: 1;
}
.btn-toggle-senha:hover { color: var(--text-primary); }

.login-form .btn-login {
  width: 100%;
  padding: 13px;
  background-color: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.login-form .btn-login:hover { background-color: var(--accent-hover); }
.login-form .btn-login:active { transform: scale(0.98); }

.login-footer {
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===========================
   RESPONSIVO
   =========================== */

/* Botão voltar oculto no desktop */
.btn-back-mobile { display: none; }

/* Tabs de navegação ocultas no desktop */
.sidebar-tabs { display: none; }

/* ===========================
   MOBILE — WhatsApp behavior
   =========================== */
@media (max-width: 768px) {

  /* Container empilha as duas telas lado a lado (sliding panels) */
  .chat-container {
    flex-direction: row;
    width: 200vw;
    transform: translateX(0);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* desconta teclado virtual */
  }

  /* Quando uma conversa está aberta, desliza para o chat */
  .chat-container.chat-open {
    transform: translateX(-100vw);
  }

  /* Sidebar ocupa tela inteira */
  .sidebar {
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: none;
  }

  /* Chat ocupa tela inteira */
  .chat-area {
    width: 100vw;
    min-width: 100vw;
    flex-shrink: 0;
  }

  /* Botão voltar no header (só mobile) */
  .btn-back-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none; border: none;
    color: var(--text-secondary);
    cursor: pointer; font-size: 1.1rem;
    border-radius: 50%;
    margin-right: 4px;
    transition: background .15s;
    flex-shrink: 0;
  }
  .btn-back-mobile:hover { background: var(--bg-hover); }

  /* Padding das mensagens */
  .messages { padding: 10px 3% 16px; }

  /* Bolhas mais largas no mobile */
  .message-bubble {
    max-width: 85%;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* Audio player 100% da bolha no mobile */
  .audio-player audio {
    width: 100%;
    max-width: 100%;
    min-width: 180px;
  }

  /* Afasta bolhas das bordas laterais no mobile */
  /* Evita que menu de contexto do audio vaze para fora da tela */
  .message-wrapper.out { padding-right: 8px; }
  .message-wrapper.in  { padding-left:  8px; }

  /* Limita largura máxima das bolhas no mobile */
  .message-bubble { max-width: 80%; }

  /* Input area — padding correto com safe-area no mobile */
  .input-area {
    padding: 6px 8px;
    padding-bottom: max(6px, calc(6px + env(safe-area-inset-bottom)));
    background-color: var(--bg-panel);
  }

  /* chat-area preenche safe-area com cor do painel */
  .chat-area {
    padding-bottom: 0;
  }

  /* Seções do sidebar: lista de grupos com scroll livre */
  .conversations-list { max-height: unset; }

  /* Modal de criar grupo ocupa tela inteira */
  .modal-box {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    margin: 0;
  }

  .modal-overlay { align-items: flex-end; }

  /* Painel de membros — sheet que sobe de baixo no mobile */
  .members-panel {
    width: 100vw;
    max-width: 100vw;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    height: 85dvh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(0,0,0,.4);
    animation: slideUp .25s ease;
  }

  .members-panel-header {
    border-radius: 16px 16px 0 0;
    padding-top: 14px;
  }

  /* Alça visual no topo do sheet */
  .members-panel-header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 10px;
  }

  .members-panel-body {
    padding-bottom: max(16px, calc(16px + env(safe-area-inset-bottom)));
  }

  /* ---- Painel de membros — usabilidade mobile ---- */

  /* Header: mais respiro, botão fechar com área de toque adequada */
  .members-panel-header {
    padding: 16px 12px 14px 16px;
    font-size: 1rem;
    min-height: 52px;
  }

  .members-panel-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
  }

  /* Labels de seção: mais legíveis */
  .members-label {
    font-size: .78rem;
    padding: 8px 16px 10px;
    letter-spacing: .6px;
  }

  /* Linha de membro: altura confortável para toque (~52px) */
  .member-row {
    padding: 10px 14px;
    min-height: 52px;
    gap: 12px;
  }

  /* Avatar maior para leitura rápida */
  .member-row-avatar {
    width: 42px;
    height: 42px;
    font-size: .92rem;
  }

  /* Nome: fonte ligeiramente maior */
  .member-row-name {
    font-size: .92rem;
  }

  /* Botões de ação: área de toque 44×44px (guideline Apple/Google) */
  .member-remove-btn,
  .member-add-btn {
    width: 40px;
    height: 40px;
    font-size: .85rem;
    flex-shrink: 0;
  }

  /* Botão excluir grupo: mais destaque e safe-area no bottom */
  .btn-delete-group {
    width: calc(100% - 28px);
    margin: 14px 14px 0;
    padding: 14px;
    font-size: .92rem;
    border-radius: 10px;
    font-weight: 600;
  }

  /* Audio bar */
  .audio-recording-bar { padding: 8px 10px; }

  /* Sections do sidebar sem altura fixa */
  .sidebar-section { flex: unset; }

  /* ---- Tabs de navegação mobile ---- */
  .sidebar-tabs {
    display: flex;
    flex-shrink: 0;
    background-color: var(--bg-panel);
    border-bottom: 2px solid var(--border);
  }

  .sidebar-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    letter-spacing: .03em;
  }

  .sidebar-tab i {
    font-size: 1.15rem;
  }

  .sidebar-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }

  .sidebar-tab .badge-tab {
    position: absolute;
    top: 6px;
    right: calc(50% - 22px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
  }

  .sidebar-tab { position: relative; }

  /* Seções ocultas quando não é a aba ativa */
  .sidebar-section.tab-hidden {
    display: none;
  }

  /* Seção visível ocupa o espaço restante e scrolla */
  .sidebar-section:not(.tab-hidden) {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .sidebar-section:not(.tab-hidden) .conversations-list {
    flex: 1;
    overflow-y: auto;
  }

  /* Oculta os headers de seção no mobile (a tab já indica) */
  .sidebar-section .sidebar-section-header {
    display: none;
  }

  /* Mas mantém o botão criar grupo acessível: reposicionar no header da sidebar */
  .sidebar-tab-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: background .15s;
  }

  .sidebar-tab-create-btn:hover { background: var(--bg-hover); }
}

/* ===========================
   COMPLEMENTOS — message.php
   =========================== */

/* Anexo de arquivo */
.file-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-link);
  font-size: .82rem;
  text-decoration: none;
  padding: 4px 0;
  margin-bottom: 4px;
}

.file-attachment:hover { text-decoration: underline; }

/* Esconde horário quando há arquivo (noTime) */
.noTime { display: none; }

/* Opacidade para msgs de outros quando só há 1 user */
.message-wrapper.in[style*="opacity"] .message-bubble {
  opacity: .45;
}

/* ===========================
   MESSAGE OPTIONS — WhatsApp style
   =========================== */

/* Container do menu — flutua sobre as mensagens */
.msg-options-menu {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 210px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
  z-index: 100;
  overflow: hidden;
}

/* Item do menu */
.msg-options-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  font-size: .9rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .12s;
}

.msg-options-item i {
  width: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: .85rem;
}

.msg-options-item:hover {
  background: var(--bg-hover);
}

/* Item destrutivo */
.msg-options-item.danger {
  color: #f25f5c;
  border-top: 1px solid var(--border);
}

.msg-options-item.danger i {
  color: #f25f5c;
}

.msg-options-item.danger:hover {
  background: rgba(242,95,92,.08);
}

/* Texto de confirmação */
.msg-options-confirm-text {
  padding: 14px 18px 6px;
  font-size: .88rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

/* Botões de confirmação */
.msg-btn-cancel,
.msg-btn-confirm {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 7px;
  font-size: .85rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.msg-btn-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.msg-btn-cancel:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.msg-btn-confirm {
  background: #f25f5c;
  color: #fff;
}

.msg-btn-confirm:hover {
  background: #e04e4b;
}

.msg-btn-cancel:active,
.msg-btn-confirm:active {
  transform: scale(.97);
}

/* Animações herdadas do sistema original */
.animated { animation-duration: .25s; }
.fadeInRight { animation-name: fadeInRight; }
.fadeOutRight { animation-name: fadeOutRight; }

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ===========================
   BOTÕES ÍCONE (clipe, mic)
   =========================== */
.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
  font-size: .95rem;
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Microfone — vermelho ao gravar */
.btn-mic.recording {
  background: #f25f5c;
  color: #fff;
  border-color: #f25f5c;
  animation: micPulse 1s infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242,95,92,.5); }
  50%       { box-shadow: 0 0 0 8px rgba(242,95,92,0); }
}

/* ===========================
   BARRA DE GRAVAÇÃO DE ÁUDIO
   =========================== */
/* audioRecorderUI agora é inline dentro da .input-area */
#audioRecorderUI {
  display: none; /* sobrescrito para flex pelo JS */
  align-items: center;
  gap: 10px;
  flex: 1;
}

/* Ponto vermelho pulsante */
.audio-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f25f5c;
  flex-shrink: 0;
  animation: recBlink .9s infinite;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .2; }
}

/* Timer */
.audio-rec-timer {
  font-size: .85rem;
  color: #f25f5c;
  font-weight: 600;
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}

/* Onda animada */
.audio-rec-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.audio-rec-wave span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  animation: wave .7s infinite ease-in-out alternate;
}

.audio-rec-wave span:nth-child(1) { height: 8px;  animation-delay: 0s;    }
.audio-rec-wave span:nth-child(2) { height: 18px; animation-delay: .1s;   }
.audio-rec-wave span:nth-child(3) { height: 26px; animation-delay: .2s;   }
.audio-rec-wave span:nth-child(4) { height: 18px; animation-delay: .3s;   }
.audio-rec-wave span:nth-child(5) { height: 8px;  animation-delay: .4s;   }

@keyframes wave {
  from { transform: scaleY(.4); }
  to   { transform: scaleY(1);  }
}

/* Botões cancelar / enviar */
.audio-rec-cancel,
.audio-rec-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}

.audio-rec-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.audio-rec-cancel:hover { background: var(--bg-hover); color: var(--text-primary); }

.audio-rec-send {
  background: var(--accent);
  color: #fff;
}

.audio-rec-send:hover { background: var(--accent-hover); }
.audio-rec-cancel:active,
.audio-rec-send:active { transform: scale(.93); }

/* ===========================
   PLAYER DE ÁUDIO NAS BOLHAS
   =========================== */
.audio-player {
  display: block;
  padding: 4px 0 6px;
  width: 100%;
  /* Garante que não ultrapassa a bolha */
  overflow: hidden;
}

.audio-player audio {
  width: 100%;
  max-width: 100%;       /* nunca ultrapassa o container */
  min-width: 0;          /* permite encolher em telas pequenas */
  height: 32px;
  border-radius: 20px;
  outline: none;
  display: block;
  filter: invert(1) hue-rotate(100deg) brightness(.85);
}

/* ===========================
   AUDIO PLAYER — ajuste bolha
   =========================== */
.audio-player audio {
  width: 100%;
  max-width: 260px;
  height: 36px;
  border-radius: 20px;
  outline: none;
  display: block;
  /* Tema escuro nativo no Chrome/Edge */
  color-scheme: dark;
}

/* Remove o filtro invert anterior que distorcia as cores */
.audio-player audio {
  filter: none;
}

/* ===========================
   FANCYBOX — fix tema escuro
   =========================== */

/* Fundo do overlay */
.fancybox-bg {
  background: #000 !important;
}

/* Container principal não herda o reset do chat */
.fancybox-container *,
.fancybox-container *::before,
.fancybox-container *::after {
  box-sizing: border-box;
}

/* Garante que a imagem fique centralizada e não quebre */
.fancybox-image {
  border-radius: 4px;
  max-height: 90vh !important;
  max-width: 90vw  !important;
  object-fit: contain !important;
}

/* Barra de ferramentas (botões fechar, zoom, etc.) */
.fancybox-toolbar {
  background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent) !important;
}

.fancybox-button {
  background: transparent !important;
  color: #fff !important;
}

.fancybox-button:hover {
  background: rgba(255,255,255,.1) !important;
}

/* Caption / legenda */
.fancybox-caption {
  background: linear-gradient(to top, rgba(0,0,0,.6), transparent) !important;
  color: #e9edef !important;
}

/* Setas de navegação */
.fancybox-navigation .fancybox-button {
  opacity: .8;
}

.fancybox-navigation .fancybox-button:hover {
  opacity: 1;
}

/* Remove qualquer overflow herdado do chat-area que cortava o lightbox */
body.fancybox-active .chat-area,
body.fancybox-active .chat-container {
  overflow: visible !important;
}

body.compensate-for-scrollbar {
  margin-right: 0 !important;
}

/* ===========================
   INPUT AREA — WhatsApp layout
   =========================== */

/* Sobrescreve o layout anterior */
.input-area {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background-color: var(--bg-panel);
  position: relative;
  z-index: 1;
}

/* Input ocupa todo o espaço central */
.input-area #divMessage {
  flex: 1;
}

.input-area input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: none;
  border-radius: 22px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: .95rem;
  font-family: var(--font);
  outline: none;
  height: 44px;
  transition: background .15s;
}

.input-area input[type="text"]:focus {
  background: var(--bg-search);
}

/* Botão direito (mic ou enviar) */
.btn-right {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  transition: background .15s, transform .1s;
}

.btn-right.btn-mic {
  background: transparent;
  color: var(--text-secondary);
}

.btn-right.btn-mic:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-right.btn-mic.recording {
  background: #f25f5c;
  color: #fff;
  animation: micPulse 1s infinite;
}

.btn-right.btn-send-msg {
  background: var(--accent);
  color: #fff;
  animation: popIn .15s ease;
}

.btn-right.btn-send-msg:hover {
  background: var(--accent-hover);
}

.btn-right.btn-send-msg svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.btn-right:active {
  transform: scale(.92);
}

@keyframes popIn {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* ===========================
   CHAT DIRETO (1:1)
   =========================== */

/* Avatar do DM — cor diferente do global */
.dm-avatar {
  background: linear-gradient(135deg, #1a3a4a, #2c5364) !important;
  color: var(--text-primary) !important;
}

/* Badge de mensagem não lida */
.dm-badge {
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: 4px;
}

/* Indicador visual no header quando em DM */
.chat-header .chat-header-status[style*="accent"] {
  font-size: .75rem;
}

/* Botão voltar ao Geral no header */
.chat-header button {
  font-family: var(--font);
}

/* ===========================
   SIDEBAR SECTIONS
   =========================== */
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #128c7e);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

.sidebar-section {
  display: flex; flex-direction: column;
  border-bottom: 1px solid var(--border);
}

.sidebar-section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  font-size: .72rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
}

.btn-new-group {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: .7rem;
  transition: background .15s, transform .1s;
}
.btn-new-group:hover  { background: var(--accent-hover); }
.btn-new-group:active { transform: scale(.9); }

.no-groups-msg {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: .8rem;
  color: var(--text-muted);
}

/* ===========================
   AVATARES GRUPO / HEADER
   =========================== */
.group-avatar {
  background: linear-gradient(135deg, #1a3d5c, #2c6e8a) !important;
}

.group-avatar-header {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-weight: 700; font-size: .95rem;
  background: linear-gradient(135deg, #1a3d5c, #2c6e8a);
  border-radius: 50%;
}

/* ===========================
   MODAL CRIAR GRUPO
   =========================== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.6);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-secondary);
  border-radius: 12px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  overflow: hidden;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: .95rem; font-weight: 600;
  color: var(--text-primary); margin: 0;
}

.modal-close {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: .9rem; padding: 4px 8px;
  border-radius: 6px; transition: background .15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-field { margin-bottom: 16px; }
.modal-field label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .4px;
}
.modal-field input[type=text],
.modal-field input[type=email],
.modal-field input[type=password],
.modal-field select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
  height: 42px;
  /* Remove aparência nativa do select */
  -webkit-appearance: none;
  appearance: none;
}

.modal-field select {
  /* Seta customizada */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238696a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.modal-field select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-field input[type=text]:focus,
.modal-field input[type=email]:focus,
.modal-field input[type=password]:focus,
.modal-field select:focus { border-color: var(--accent); }

.members-list {
  background: var(--bg-input); border-radius: 8px;
  max-height: 200px; overflow-y: auto; padding: 4px 0;
}

.member-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: background .12s; border-radius: 6px;
  user-select: none;
}
.member-option:hover { background: var(--bg-hover); }
.member-option input[type=checkbox] { display: none; }

.member-option-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-panel); display: flex;
  align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--text-secondary);
  flex-shrink: 0;
}
.member-option-name { flex: 1; font-size: .88rem; color: var(--text-primary); }

.member-check {
  color: var(--accent); font-size: .8rem; opacity: 0;
  transition: opacity .15s;
}
.member-option input:checked ~ .member-check { opacity: 1; }
.member-option input:checked ~ .member-option-avatar {
  background: var(--accent); color: #fff;
}

.modal-footer {
  display: flex; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.modal-btn-cancel {
  flex: 1; padding: 10px; border-radius: 8px;
  background: var(--bg-input); border: none;
  color: var(--text-secondary); font-size: .88rem;
  font-family: var(--font); cursor: pointer;
  transition: background .15s;
}
.modal-btn-cancel:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-btn-confirm {
  flex: 1; padding: 10px; border-radius: 8px;
  background: var(--accent); border: none;
  color: #fff; font-size: .88rem; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  transition: background .15s;
}
.modal-btn-confirm:hover { background: var(--accent-hover); }

/* ===========================
   PAINEL DE MEMBROS
   =========================== */
.members-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 280px; background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 200; display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,.3);
}

.members-panel-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  font-size: .92rem; font-weight: 600;
  color: var(--text-primary);
}

.members-panel-close {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: .9rem; padding: 4px 8px; border-radius: 6px;
  transition: background .15s;
}
.members-panel-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.members-panel-body { flex: 1; overflow-y: auto; padding: 12px 0; }

.members-label {
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 16px 8px;
}

.member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; transition: background .12s;
}
.member-row:hover { background: var(--bg-hover); }

.member-row-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #374045, #4a5568);
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700; color: var(--text-secondary);
  flex-shrink: 0;
}
.member-row-name { flex: 1; font-size: .88rem; color: var(--text-primary); }

.member-badge-admin {
  background: var(--accent); color: #fff;
  font-size: .6rem; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; margin-left: 6px;
}

.member-remove-btn, .member-add-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; transition: background .15s;
}
.member-remove-btn       { background: rgba(242,95,92,.1); color: #f25f5c; }
.member-remove-btn:hover { background: rgba(242,95,92,.25); }
.member-remove-btn.danger       { background: rgba(242,95,92,.15); }
.member-remove-btn.danger:hover { background: rgba(242,95,92,.3); }
.member-add-btn       { background: rgba(0,168,132,.1); color: var(--accent); }
.member-add-btn:hover { background: rgba(0,168,132,.25); }

/* Select de permissão por membro */
.member-perm-select {
  font-size: .72rem; padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--border-color); background: var(--bg-input);
  color: var(--text-primary); cursor: pointer; max-width: 155px;
  transition: border-color .15s;
}
.member-perm-select:focus { outline: none; border-color: var(--accent); }

/* Badge de permissão (leitura para não-admin) */
.member-perm-badge {
  font-size: .68rem; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; letter-spacing: .02em;
}
.perm-func    { background: rgba(0,168,132,.12); color: var(--accent); }
.perm-cliente { background: rgba(242,95,92,.1);  color: #f25f5c; }

.btn-delete-group {
  width: calc(100% - 32px); margin: 16px 16px 0;
  padding: 10px; border-radius: 8px;
  background: rgba(242,95,92,.1); border: 1px solid rgba(242,95,92,.2);
  color: #f25f5c; font-size: .85rem; font-family: var(--font);
  cursor: pointer; transition: background .15s;
}
.btn-delete-group:hover { background: rgba(242,95,92,.2); }

/* ===========================
   LOGIN — mensagens de erro
   =========================== */
.login-erro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .84rem;
  margin-bottom: 20px;
  line-height: 1.4;
  animation: fadeInDown .25s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-erro i {
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.login-erro div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-erro strong {
  font-size: .88rem;
  font-weight: 600;
  display: block;
}

.login-erro span {
  font-size: .8rem;
  opacity: .85;
}

/* Bloqueado — vermelho */
.login-erro.bloqueado {
  background: rgba(242, 95, 92, .12);
  border: 1px solid rgba(242, 95, 92, .3);
  color: #f25f5c;
}

/* Não encontrado — amarelo */
.login-erro.nao_encontrado {
  background: rgba(240, 180, 41, .12);
  border: 1px solid rgba(240, 180, 41, .3);
  color: #f0b429;
}

/* Acesso restrito — laranja */
.login-erro.acesso {
  background: rgba(255, 140, 0, .12);
  border: 1px solid rgba(255, 140, 0, .3);
  color: #ff8c00;
}

/* ===========================
   SIDEBAR HEADER — ícones
   =========================== */
.sidebar-header-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .9rem;
  transition: background .15s, color .15s;
  border: 1px solid transparent;
}
.sidebar-header-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

/* ===========================
   CRUD — layout geral
   =========================== */
.crud-container {
  min-height: 100vh;
  background: var(--bg-primary);
  padding: 24px;
  font-family: var(--font);
  color: var(--text-primary);
  overflow-y: auto;
}

.crud-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.crud-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crud-header h1 i { color: var(--accent); }

.crud-header p {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0;
}

.crud-btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .85rem;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.crud-btn-back:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Alertas */
.crud-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .88rem;
  margin-bottom: 20px;
  animation: fadeInDown .25s ease;
}
.crud-alert.success {
  background: rgba(0,168,132,.12);
  border: 1px solid rgba(0,168,132,.3);
  color: var(--accent);
}
.crud-alert.erro {
  background: rgba(242,95,92,.12);
  border: 1px solid rgba(242,95,92,.3);
  color: #f25f5c;
}

.crud-body { display: flex; flex-direction: column; gap: 20px; }

/* Card */
.crud-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.crud-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.crud-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.crud-card-body { padding: 20px; }

/* Formulário de criação */
.crud-form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.crud-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}
.crud-field-sm  { flex: 0 0 140px; min-width: 120px; }
.crud-field-btn { flex: 0 0 auto; min-width: unset; }

.crud-field label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.crud-field input[type=text],
.crud-field input[type=email],
.crud-field input[type=password],
.crud-field select {
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
  height: 42px;
}
.crud-field input[type=text]:focus,
.crud-field input[type=email]:focus,
.crud-field input[type=password]:focus,
.crud-field select:focus { border-color: var(--accent); }
.crud-field select option { background: var(--bg-secondary); }

.crud-btn-primary {
  height: 42px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: background .15s;
}
.crud-btn-primary:hover { background: var(--accent-hover); }

/* Busca */
.crud-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.crud-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: var(--font);
}
.crud-search input::placeholder { color: var(--text-muted); }

/* Tabela */
.crud-table-wrapper { overflow-x: auto; }

.crud-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.crud-table thead tr {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.crud-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

.crud-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.crud-table tbody tr:last-child td { border-bottom: none; }
.crud-table tbody tr:hover { background: var(--bg-hover); }

.crud-td-id {
  color: var(--text-muted);
  font-size: .8rem;
  width: 40px;
}

/* Linha bloqueada / deletada */
.row-bloqueado td { opacity: .6; }
.row-deletado td  { opacity: .45; text-decoration: line-through; }

/* Célula de usuário */
.crud-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crud-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #128c7e);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* Badges */
.crud-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
}
.crud-badge.admin    { background: rgba(0,168,132,.15); color: var(--accent); }
.crud-badge.user     { background: rgba(134,150,160,.12); color: var(--text-secondary); }
.crud-badge.ativo    { background: rgba(0,168,132,.12); color: var(--accent); }
.crud-badge.bloqueado{ background: rgba(242,95,92,.12);  color: #f25f5c; }
.crud-badge.me       { background: rgba(83,189,235,.12); color: #53bdeb; }

/* Indicador online */
.crud-online-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.crud-online-dot.online  { background: var(--accent); }
.crud-online-dot.offline { background: var(--text-muted); }

/* Ações */
.crud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crud-btn-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .8rem;
  text-decoration: none;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.crud-btn-icon:active { transform: scale(.92); }

.crud-btn-icon.edit    { background: rgba(83,189,235,.12);  color: #53bdeb; }
.crud-btn-icon.edit:hover { background: rgba(83,189,235,.25); }
.crud-btn-icon.delete  { background: rgba(242,95,92,.12);   color: #f25f5c; }
.crud-btn-icon.delete:hover { background: rgba(242,95,92,.25); }
.crud-btn-icon.restore { background: rgba(240,180,41,.12);  color: #f0b429; }
.crud-btn-icon.restore:hover { background: rgba(240,180,41,.25); }

/* Responsivo CRUD */
@media (max-width: 768px) {

  /* Container */
  .crud-container {
    padding: 0;
    overflow-y: auto;
    height: 100dvh;
  }

  /* Header */
  .crud-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 16px 12px;
    gap: 10px;
    padding-top: max(16px, calc(16px + env(safe-area-inset-top)));
  }

  .crud-header h1 { font-size: 1rem; }
  .crud-header p  { font-size: .78rem; }

  .crud-btn-back {
    width: 100%;
    justify-content: center;
    padding: 10px;
  }

  /* Alertas */
  .crud-alert { font-size: .82rem; padding: 10px 12px; }

  /* Body */
  .crud-body { gap: 0; }

  /* Card */
  .crud-card { border-radius: 0; border-left: none; border-right: none; margin-bottom: 8px; }
  .crud-card-header { padding: 12px 16px; font-size: .85rem; }

  /* Formulário — empilha os campos */
  .crud-card-body { padding: 14px 16px; }
  .crud-form-row  { flex-direction: column; gap: 10px; }
  .crud-field,
  .crud-field-sm  { flex: 1 1 100%; min-width: unset; }
  .crud-field-btn { width: 100%; }
  .crud-btn-primary { width: 100%; justify-content: center; height: 46px; font-size: .92rem; }

  /* Busca */
  .crud-search { padding: 10px 16px; }

  /* Tabela — esconde colunas menos importantes */
  .crud-table th,
  .crud-table td { padding: 10px 10px; font-size: .82rem; }

  /* Esconde: Online, ID */
  .crud-table th:nth-child(1),
  .crud-table td:nth-child(1),
  .crud-table th:nth-child(5),
  .crud-table td:nth-child(5) { display: none; }

  /* Nome — célula mais compacta */
  .crud-user-cell { gap: 8px; }
  .crud-avatar    { width: 28px; height: 28px; font-size: .72rem; }

  /* Badges menores */
  .crud-badge { font-size: .68rem; padding: 2px 7px; }

  /* Ações — botões maiores para toque */
  .crud-actions { gap: 8px; }
  .crud-btn-icon { width: 36px; height: 36px; border-radius: 10px; font-size: .85rem; }

  /* Modal fullscreen no mobile */
  .modal-overlay { align-items: flex-end; }

  .modal-box {
    width: 100vw;
    max-width: 100vw;
    border-radius: 16px 16px 0 0;
    animation: slideUp .25s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }

  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .modal-header  { padding: 14px 16px; }
  .modal-body    { padding: 16px; max-height: 60vh; overflow-y: auto; }
  .modal-footer  { padding: 12px 16px; padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom))); }

  .modal-field input[type=text],
  .modal-field input[type=email],
  .modal-field input[type=password],
  .modal-field select { height: 46px; font-size: .92rem; }

  .modal-btn-cancel,
  .modal-btn-confirm { padding: 12px; font-size: .9rem; }

}

/* ===========================
   PRESENÇA ONLINE / OFFLINE
   =========================== */

/* Bolinha de status no avatar */
.presence-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  flex-shrink: 0;
}

.presence-dot.online  { background: var(--accent); }
.presence-dot.offline { background: var(--text-muted); }

/* Avatar offline — mais apagado */
.offline-avatar {
  opacity: .55;
  background: linear-gradient(135deg, #2a3942, #374045) !important;
}

/* Item offline — sem cursor pointer e levemente apagado */
.chat-item.user-offline {
  cursor: default !important;
  opacity: .7;
}

.chat-item.user-offline:hover {
  background: transparent !important;
}

/* ===========================
   BADGE DE MENSAGENS NÃO LIDAS
   =========================== */
.badge-count {
  display: none; /* exibido via JS quando count > 0 */
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: auto;
  line-height: 1;
  /* Sem animation padrão — animação só via .badge-pop */
}

/* Animação aplicada só quando o número aumenta */
.badge-count.badge-pop {
  animation: badgePop .3s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes badgePop {
  0%   { transform: scale(0);    opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* ===========================
   LOGIN — etapa 2 (avatar)
   =========================== */
.login-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-input);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.login-user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #128c7e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.login-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.login-user-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-user-email {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Link trocar conta */
.login-trocar-conta {
  font-size: .82rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}
.login-trocar-conta:hover {
  color: var(--accent);
}

/* ===========================
   MODAL PREVIEW ANEXO
   =========================== */
.modal-preview-box {
  max-width: 480px;
  width: 100%;
  background: #1a2730;
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
}

/* Área de preview da imagem */
.preview-img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1418;
  min-height: 280px;
  max-height: 55dvh;
  overflow: hidden;
  position: relative;
}

.preview-img-wrapper #previewImg {
  max-width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  display: block;
}

/* Preview de arquivo não-imagem */
.preview-file {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.preview-file-icon {
  font-size: 3.5rem;
}

.preview-file span {
  font-size: .85rem;
  color: var(--text-secondary);
  word-break: break-all;
  max-width: 280px;
}

/* Barra de legenda + botão enviar */
.preview-caption-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
}

.preview-caption-bar input {
  flex: 1;
  background: var(--bg-input);
  border: none;
  border-radius: 22px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: .92rem;
  font-family: var(--font);
  outline: none;
  height: 42px;
}

.preview-caption-bar input::placeholder { color: var(--text-muted); }

.preview-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}

.preview-send-btn:hover  { background: var(--accent-hover); }
.preview-send-btn:active { transform: scale(.93); }

.preview-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Mobile */
@media (max-width: 768px) {
  .modal-preview-box {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    max-height: 100dvh;
    height: 100dvh;
  }

  .preview-img-wrapper {
    flex: 1;
    max-height: unset;
  }
}

/* ===========================
   IMAGEM COM LEGENDA (caption)
   =========================== */
.message-bubble img {
  border-radius: 6px;
  max-width: 100%;
  display: block;
  margin-bottom: 4px;
}

/* Legenda abaixo da imagem — espaçamento visual */
.message-bubble .file-caption {
  font-size: .88rem;
  color: var(--text-primary);
  margin-top: 4px;
  line-height: 1.4;
  word-break: break-word;
}

/* ===========================
   EMOJI PICKER
   =========================== */
.btn-emoji {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  font-size: 1.1rem;
}
.btn-emoji:hover { color: var(--accent) !important; }

.emoji-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 50px;            /* alinha com o botão emoji */
  width: 320px;
  max-height: 380px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInUp .15s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* chat-area não pode cortar o picker */
.chat-area { overflow: visible; }

/* Busca */
.emoji-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.emoji-search-icon { color: var(--text-muted); font-size: .85rem; flex-shrink: 0; }

.emoji-search-bar input {
  flex: 1;
  background: var(--bg-input);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: .85rem;
  font-family: var(--font);
  outline: none;
  height: 32px;
}
.emoji-search-bar input::placeholder { color: var(--text-muted); }

/* Categorias */
.emoji-categories {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.emoji-cat-btn {
  width: 32px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
  opacity: .6;
}

.emoji-cat-btn:hover  { background: var(--bg-hover); opacity: 1; }
.emoji-cat-btn.active { background: var(--bg-panel); opacity: 1; }

/* Grid */
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  padding: 6px;
  overflow-y: auto;
  gap: 2px;
  flex: 1;
}

.emoji-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s, transform .1s;
  line-height: 1;
}

.emoji-btn:hover  { background: var(--bg-hover); transform: scale(1.2); }
.emoji-btn:active { transform: scale(1.05); }

/* Mobile — picker ocupa mais espaço */
@media (max-width: 768px) {
  .emoji-picker {
    width: 100vw;
    left: 0;
    right: 0;
    bottom: calc(100% + 4px);
    border-radius: 12px 12px 0 0;
    max-height: 50dvh;
  }
}


/* ===========================
   LOGIN — Alerta info (código enviado)
   =========================== */
.login-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 168, 132, .12);
  border: 1px solid rgba(0, 168, 132, .3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: .85rem;
  line-height: 1.4;
}

.login-info i { font-size: 1rem; flex-shrink: 0; }

/* ===========================
   LOGIN — Etapa 2: inputs de código
   =========================== */
.codigo-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 4px;
}

.codigo-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: monospace;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, background .15s;
  caret-color: var(--accent);
  padding: 0;
}

.codigo-digit:focus {
  border-color: var(--accent);
  background: var(--bg-search);
}

.codigo-digit:not(:placeholder-shown) {
  border-color: rgba(0, 168, 132, .4);
}

/* Timer / countdown */
.codigo-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  margin: 10px 0 16px;
}

.codigo-timer i { font-size: .78rem; }
.codigo-timer strong { color: var(--text-secondary); }

/* Botão verificar desabilitado */
.btn-login:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}

@media (max-width: 360px) {
  .codigo-digit { width: 38px; height: 46px; font-size: 1.2rem; }
  .codigo-inputs { gap: 5px; }
}

/* ===========================
   AUDIO PLAYER CUSTOMIZADO
   =========================== */
.audio-player.audio-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  width: 100%;
  min-width: 200px;
  max-width: 280px;
  position: relative;
}

/* Botão play/pause */
.audio-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.audio-play-btn:hover  { background: var(--accent-hover); }
.audio-play-btn:active { transform: scale(.92); }

/* Barra de progresso */
.audio-progress-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  min-width: 60px;
}
.audio-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width .1s linear;
  pointer-events: none;
}

/* Tempo */
.audio-time {
  font-size: .72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}

/* Menu ⋮ */
.audio-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.audio-menu-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .12s;
}
.audio-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Dropdown — base */
.audio-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  z-index: 300;
  min-width: 150px;
  overflow: hidden;
  animation: fadeInUp .12s ease;
}
.audio-dropdown.open { display: block; }

/* Dropdown à DIREITA (bolha enviada — .out) — abre para a ESQUERDA */
.audio-dropdown-right {
  right: 0;
  left: auto;
}

/* Dropdown à ESQUERDA (bolha recebida — .in) — abre para a DIREITA */
.audio-dropdown-left {
  left: 0;
  right: auto;
}

/* Items do dropdown */
.audio-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: .85rem;
  color: var(--text-primary);
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font);
  transition: background .1s;
  text-align: left;
}
.audio-dd-item:hover { background: var(--bg-hover); }
.audio-dd-item i { color: var(--text-muted); font-size: .85rem; width: 14px; }

/* ================================================================
   PAINEL DE MEMBROS — DM clicável
   ================================================================ */

/* Agrupa avatar + nome numa área clicável */
.member-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  border-radius: 8px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background .15s;
}
.member-row-clickable {
  cursor: pointer;
}
.member-row-clickable:hover {
  background: var(--bg-hover);
}
.member-row-clickable:active {
  background: var(--bg-active, rgba(255,255,255,.1));
}

/* Área de botões de ação (remove / sair) */
.member-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Badge "você" — mesma aparência do badge do CRUD mas no painel */
.member-badge-you {
  font-size: .67rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: .3px;
}

/* ================================================================
   @MENÇÃO
   ================================================================ */

/* Destaque do @Nome dentro do balão de mensagem */
.mention {
  color: var(--accent);
  font-weight: 600;
  background: rgba(0,168,132,.12);
  border-radius: 4px;
  padding: 0 3px;
}

/* Dropdown de autocomplete — flutua acima do input */
.mention-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-panel, #202c33);
  border: 1px solid var(--border, #2a3942);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  padding: 4px 0;
}

/* Item individual no dropdown */
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: .88rem;
  color: var(--text-primary);
  transition: background .1s;
  border-radius: 0;
}
.mention-item:hover,
.mention-item.mention-selected {
  background: var(--bg-hover, rgba(255,255,255,.05));
}

/* Avatar compacto do item */
.mention-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
