/* Rico aos Poucos — Widget de Chat (estilo WhatsApp grupo).
 * Acoplado às sub-abas .rap-chat-* do FII V4 (css/fii-page-v4.css).
 * Renderiza mensagens sequenciais, composer com @ menção, e widget de
 * enquetes embutido. Sub-aba "Tópicos" continua via assets/forum/. */

.rap-cht-loading {
  text-align: center;
  padding: 28px 12px;
  color: var(--v4-text-mute, #94a3b8);
  font-size: 0.86rem;
}

.rap-cht-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--v4-text-mute, #94a3b8);
}
.rap-cht-empty-ico { font-size: 2rem; margin-bottom: 8px; opacity: 0.7; }
.rap-cht-empty p   { margin: 0; font-size: 0.88rem; line-height: 1.5; }

/* ── Login CTA ── */
.rap-cht-login {
  border: 1px dashed rgba(148,163,184,0.30);
  background: rgba(15,23,42,0.45);
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
  margin: 14px 0;
}
.rap-cht-login p { margin: 0 0 10px; color: var(--v4-text-soft, #cbd5e1); font-size: 0.86rem; }
.rap-cht-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #f1f5f9; font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s, filter .15s;
}
.rap-cht-btn:hover { background: rgba(255,255,255,0.12); }
.rap-cht-btn.primary {
  background: linear-gradient(135deg, #25d366, #128c7e);
  border-color: transparent; color: #fff;
}
.rap-cht-btn.primary:hover { filter: brightness(1.10); }
.rap-cht-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── CHAT LIVRE ── */
.rap-cht-stream {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 4px 14px;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(11, 19, 33, 0.55);
  border-radius: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.25) transparent;
}
.rap-cht-stream::-webkit-scrollbar { width: 6px; }
.rap-cht-stream::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.25); border-radius: 4px;
}

.rap-cht-day {
  align-self: center;
  margin: 10px 0 6px;
  padding: 3px 12px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v4-text-mute, #94a3b8);
  background: rgba(30, 41, 59, 0.85);
  border-radius: 999px;
}

.rap-cht-msg {
  max-width: 88%;
  padding: 7px 11px 4px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.85);
  color: var(--v4-text, #e2e8f0);
  font-size: 0.9rem;
  line-height: 1.42;
  position: relative;
  word-wrap: break-word;
}
.rap-cht-msg.is-own {
  align-self: flex-end;
  background: linear-gradient(135deg, #128c7e, #075e54);
  color: #f0fdf4;
}
.rap-cht-msg.is-team   { background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; }
.rap-cht-msg.is-ai     { background: linear-gradient(135deg, #9333ea, #6b21a8); color: #fff; }

.rap-cht-msg-head {
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rap-cht-msg-author { color: #25d366; }
.rap-cht-msg.is-own .rap-cht-msg-author,
.rap-cht-msg.is-team .rap-cht-msg-author,
.rap-cht-msg.is-ai .rap-cht-msg-author { color: rgba(255,255,255,0.85); }

.rap-cht-badge {
  display: inline-flex; align-items: center;
  padding: 1px 6px; font-size: 0.62rem; font-weight: 700;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  letter-spacing: 0.04em;
}
.rap-cht-msg-body {
  white-space: pre-wrap;
}
.rap-cht-msg-body a {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.rap-cht-msg.is-own .rap-cht-msg-body a { color: #fff; }
.rap-cht-msg-body .rap-cht-mention {
  color: #25d366;
  font-weight: 600;
  text-decoration: none;
  background: rgba(37, 211, 102, 0.10);
  padding: 1px 5px;
  border-radius: 4px;
}
.rap-cht-msg.is-own .rap-cht-mention {
  color: #d1fae5;
  background: rgba(255,255,255,0.18);
}
.rap-cht-msg-foot {
  display: flex; justify-content: flex-end; align-items: center; gap: 6px;
  margin-top: 2px;
  font-size: 0.66rem;
  color: rgba(255,255,255,0.55);
}
.rap-cht-del-btn {
  background: none; border: 0;
  color: rgba(255,255,255,0.45);
  font-size: 0.72rem; cursor: pointer;
  padding: 0;
}
.rap-cht-del-btn:hover { color: #f87171; }

/* Status (relógio enviando / check enviada / ! erro) */
.rap-cht-status {
  font-size: 0.74rem;
  margin-left: 4px;
  opacity: 0.85;
  user-select: none;
}
.rap-cht-status.ok  { color: #d1fae5; }
.rap-cht-status.err {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.50);
  border-radius: 50%;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
  cursor: pointer;
}
.rap-cht-msg.is-sending { opacity: 0.78; }
.rap-cht-msg.is-error   { box-shadow: 0 0 0 1px rgba(239,68,68,0.55) inset; }
.rap-cht-edited {
  font-style: italic;
  opacity: 0.65;
  margin-right: 4px;
}

/* Citação (reply) — barra verde + autor + preview */
.rap-cht-quote {
  display: flex; flex-direction: column;
  padding: 5px 8px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid #25d366;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.3;
}
.rap-cht-quote-author { color: #25d366; font-weight: 600; }
.rap-cht-quote-body   { color: rgba(255,255,255,0.78); }
.rap-cht-msg.is-own .rap-cht-quote { border-left-color: #d1fae5; background: rgba(255,255,255,0.10); }
.rap-cht-msg.is-own .rap-cht-quote-author { color: #d1fae5; }

/* Swipe wrapper + hint atrás */
.rap-cht-msg { position: relative; }
.rap-cht-msg-swipe {
  position: relative;
  z-index: 1;
  background: inherit;        /* mantém a bolha */
  display: block;
}
.rap-cht-msg-swipe-hint {
  position: absolute;
  left: 8px; right: auto;
  top: 50%;
  transform: translateY(-50%);
  color: #25d366;
  opacity: 0;
  z-index: 0;
  transition: opacity .15s, left .15s, right .15s;
  pointer-events: none;
}
.rap-cht-msg.is-swiping .rap-cht-msg-swipe-hint { opacity: 1; }
/* Swipe pra esquerda: ícone migra pro lado direito (do outro lado da bolha) */
.rap-cht-msg.is-swiping-left .rap-cht-msg-swipe-hint {
  left: auto;
  right: 8px;
  transform: translateY(-50%) scaleX(-1);
}
.rap-cht-msg.is-flash {
  animation: rap-cht-flash 1s ease;
}
@keyframes rap-cht-flash {
  0%   { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
  20%  { box-shadow: 0 0 0 6px rgba(37,211,102,0.40); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* Banner sobre composer (reply/edit ativo) */
.rap-cht-compose-banner {
  display: flex; align-items: stretch; gap: 8px;
  padding: 6px 10px;
  margin: 0 0 6px;
  background: rgba(37, 211, 102, 0.10);
  border-left: 3px solid #25d366;
  border-radius: 8px;
  font-size: 0.82rem;
}
.rap-cht-compose-banner[data-banner="edit"] {
  background: rgba(99, 102, 241, 0.12);
  border-left-color: #818cf8;
}
.rap-cht-compose-banner-bar { display: none; } /* legacy */
.rap-cht-compose-banner-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  line-height: 1.25;
  overflow: hidden;
}
.rap-cht-compose-banner-label {
  font-weight: 600;
  color: #d1fae5;
}
.rap-cht-compose-banner[data-banner="edit"] .rap-cht-compose-banner-label { color: #c7d2fe; }
.rap-cht-compose-banner-preview {
  color: rgba(255,255,255,0.65);
  font-size: 0.76rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rap-cht-compose-banner-close {
  background: none; border: 0;
  color: rgba(255,255,255,0.55);
  font-size: 1rem; cursor: pointer;
  padding: 0 4px;
  align-self: center;
}
.rap-cht-compose-banner-close:hover { color: #fff; }

/* Menu de opções da mensagem (long-press / click direito) */
.rap-cht-msgmenu-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9999;
  animation: rap-cht-msgmenu-in .12s ease;
}
@keyframes rap-cht-msgmenu-in {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.35); }
}
/* Menu posicionado pelo JS (positionMsgMenu) ancorado nas coords do click.
   Largura natural do conteúdo, NÃO ocupa a base inteira da tela. */
.rap-cht-msgmenu {
  position: absolute;
  width: max-content;
  min-width: 180px;
  max-width: 260px;
  background: #1f2c33;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.50);
  animation: rap-cht-msgmenu-slide .12s ease;
}
@keyframes rap-cht-msgmenu-slide {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.rap-cht-msgmenu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: #e9edef;
  font-family: inherit; font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.rap-cht-msgmenu-item:hover { background: rgba(255,255,255,0.05); }
.rap-cht-msgmenu-item.is-danger { color: #fca5a5; }
.rap-cht-msgmenu-item.is-danger:hover { background: rgba(239, 68, 68, 0.10); }
.rap-cht-msgmenu-ico { font-size: 1.1rem; }

/* ── Composer (estilo WhatsApp) ──
   Linha base = STICKY (modo V1/V4 inline). No modo sala vira FIXED. */
.rap-cht-composer {
  position: sticky;
  bottom: 0;
  background: rgba(17, 27, 33, 0.98);    /* verde-azulado WhatsApp */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 8px 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
  z-index: 3;
}
.rap-cht-composer-row {
  display: flex; gap: 6px; align-items: flex-end;
}

/* Botão de emoji à esquerda do campo */
.rap-cht-emoji {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #aebac1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.rap-cht-emoji:hover { background: rgba(255,255,255,0.06); color: #fff; }
.rap-cht-emoji svg { width: 22px; height: 22px; }

/* Wrap arredondado em volta do textarea pra parecer "bolha de input".
   IMPORTANTE: o padding vertical vive AQUI, não no textarea — assim o
   scrollHeight do textarea reflete só o conteúdo de texto e o autoGrow
   não dispara crescimento prematuro ao digitar o 1º caractere. */
.rap-cht-textarea-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: #2a3942;
  border-radius: 22px;
  padding: 9px 12px;
  min-height: 40px;
  max-height: 120px;
}
.rap-cht-textarea {
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  color: #e9edef;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  height: 22px;             /* exatamente 1 linha (line-height) */
  min-height: 22px;
  max-height: 102px;
  overflow-y: hidden;
  outline: none;
  box-sizing: border-box;
  width: 100%;
  display: block;
}
.rap-cht-textarea::placeholder { color: #8696a0; }

/* Send: verde sólido tipo WhatsApp + ícone de avião de papel */
.rap-cht-send {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 999px;
  background: #00a884;     /* verde WhatsApp escuro */
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: none;
  transition: background .15s, transform .12s;
}
.rap-cht-send:hover  { background: #06cf9c; }
.rap-cht-send:active { transform: scale(0.94); }
.rap-cht-send:disabled { opacity: 0.45; cursor: not-allowed; }
.rap-cht-send svg { width: 20px; height: 20px; }

/* Picker de emoji */
.rap-cht-emoji-pop {
  position: absolute;
  bottom: 56px;
  left: 6px;
  width: 290px;
  max-width: calc(100% - 12px);
  max-height: 220px;
  overflow-y: auto;
  background: #2a3942;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  z-index: 9;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
/* [hidden] precisa vencer o display:grid acima */
.rap-cht-emoji-pop[hidden] { display: none !important; }
.rap-cht-emoji-item {
  background: transparent; border: 0;
  font-size: 1.25rem;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background .12s;
  line-height: 1;
}
.rap-cht-emoji-item:hover { background: rgba(255,255,255,0.08); }

/* ────────────────────────────────────────────────────────────
   MODO FULLCHAT — aplica o look /sala/ também na aba "Chat" das
   páginas /fiis/{ticker}/ (V1 + V4). Ativado por:
     body.is-aba-discussao   → V1/V4 (setado quando aba Chat ativa)
     [data-chat-mode="sala"] → página dedicada /sala/
   Submenu vira full-width com filete verde, composer fixed bottom.
   ──────────────────────────────────────────────────────────── */

/* Submenu Chat/Tópicos/Enquetes — visual "filete verde" (não pílula).
   POSICIONAMENTO é definido pelo contexto:
     - /sala/ define inline (position fixed top 56)
     - V1/V4 define abaixo (sticky top: --topbar-h + 50px)
   Aqui só os estilos visuais comuns. */
body.is-aba-discussao .rap-chat-tabs,
[data-chat-mode="sala"] .rap-chat-tabs {
  display: flex; gap: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.98);
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
/* V1 (desktop /fiis/{ticker}/) — submenu sticky encosta abaixo da .fii-tabs */
body.is-aba-discussao .rap-chat-tabs {
  position: sticky;
  top: calc(var(--topbar-h, 56px) + 50px);
  margin: 0 0 12px;
  z-index: 10;
}

/* V4 (mobile) — submenu vai pra portal #rap-cht-tabs-portal no body,
   fora do .v4-panes (que tem overflow:hidden + transform e mata sticky).
   Mostra só quando aba "Chat" do nav principal está ativa. */
#rap-cht-tabs-portal {
  display: none;
  position: fixed;
  top: calc(var(--v4-topbar-h, 56px) + var(--v4-tabs-h, 48px));
  left: 0; right: 0;
  z-index: 11;
}
body.fii-v4.is-aba-discussao #rap-cht-tabs-portal { display: block; }
#rap-cht-tabs-portal .rap-chat-tabs {
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

/* Sub-abas Chat/Tópicos/Enquetes foram removidas (2026-06-22) — não há mais
   barra fixa no topo do chat, então o .rap-chat-root NÃO precisa de padding-top
   (senão sobra um vão morto de ~48px acima do chat). */
body.fii-v4.is-aba-discussao .rap-chat-root {
  padding-top: 0;
}

/* Cola o submenu no nav principal (zera margem entre eles e remove
   transforms de ancestrais — necessário pro position:fixed do composer
   funcionar relativo à viewport). */
body.is-aba-discussao .fii-tabs { margin-bottom: 0; }
body.is-aba-discussao .fii-tab-pane[data-tab-pane="discussao"] {
  margin-top: 0;
  animation: none !important;
}
body.is-aba-discussao .rap-chat-tab,
[data-chat-mode="sala"] .rap-chat-tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 11px 8px;
  border-radius: 0;
  background: transparent;
  color: #aebac1;
  font-family: inherit; font-size: 0.86rem; font-weight: 600;
  cursor: pointer;
  transition: color .15s;
  position: relative;
  box-shadow: none;
}
body.is-aba-discussao .rap-chat-tab:hover,
[data-chat-mode="sala"] .rap-chat-tab:hover {
  background: rgba(255,255,255,0.03);
  color: #e9edef;
}
body.is-aba-discussao .rap-chat-tab.is-active,
[data-chat-mode="sala"] .rap-chat-tab.is-active {
  background: transparent !important;
  color: #25d366 !important;
  box-shadow: none !important;
}
body.is-aba-discussao .rap-chat-tab.is-active::after,
[data-chat-mode="sala"] .rap-chat-tab.is-active::after {
  content: '';
  position: absolute; left: 18%; right: 18%; bottom: 0;
  height: 3px;
  background: #25d366;
  border-radius: 2px 2px 0 0;
}

/* Stream sem borda arredondada / fundo opaco, scroll só por dentro */
body.is-aba-discussao .rap-chat-panel[data-chat-panel="chat"] .rap-cht-stream,
[data-chat-mode="sala"] .rap-cht-stream {
  max-height: none;
  border-radius: 0;
  background: transparent;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
[data-chat-mode="sala"] .rap-cht-stream {
  /* topbar 56 + submenu 42 + composer ~64 + folga */
  height: calc(100dvh - 170px);
  padding: 12px 12px 8px;
}

/* MOBILE V4: stream altura calculada (composer mora no portal fixed bottom).
   Sem a barra de sub-abas (removida), recupera os ~48px dela na altura. */
body.fii-v4.is-aba-discussao .rap-chat-panel[data-chat-panel="chat"] .rap-cht-stream {
  height: calc(100dvh - 172px);
  padding: 12px 12px 80px;
}

/* V4 — pane "discussao" zera padding: topbar+tabs+sub-tabs (fixed) ocupam
   o topo, composer-portal ocupa o bottom, e o stream já tem altura
   calculada pra encaixar exatamente nesse vão. O padding-bottom: 96px
   herdado de .v4-pane é folga pro FAB — que NESTA aba está escondido —
   e fazia a página inteira passar da viewport, gerando scroll vertical
   indesejado. Padding-top também some pra deixar o submenu sub-tabs
   (fixed, top: 104px) encostar no conteúdo sem buraco. */
body.fii-v4.is-aba-discussao .v4-pane[data-pane="discussao"] {
  padding-top: 0;
  padding-bottom: 0;
}

/* DESKTOP V1: stream + composer ficam DENTRO de um container do chat.
   Stream limitado em altura com scroll interno; composer logo abaixo,
   no flow normal (NÃO fixed na viewport). [hidden] precisa vencer o
   display:flex — senão o panel continua visível quando outra sub-aba
   está ativa. */
body.is-aba-discussao:not(.fii-v4) .rap-chat-panel[data-chat-panel="chat"]:not([hidden]) {
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  margin: 0;
}
body.is-aba-discussao:not(.fii-v4) .rap-chat-panel[data-chat-panel="chat"][hidden] { display: none !important; }
body.is-aba-discussao:not(.fii-v4) .rap-chat-panel[data-chat-panel="chat"] .rap-cht-stream {
  height: 520px;
  max-height: 60vh;
  padding: 14px 14px 16px;
  background: rgba(11, 19, 33, 0.55);
}

/* Portal #rap-cht-composer-portal — usado SÓ no V4 mobile (escapa o
   transform do #v4-panes). Desktop V1 mantém composer dentro do flow. */
#rap-cht-composer-portal {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 760px;
  z-index: 100;
  padding: 0;
}
#rap-cht-composer-portal.is-visible { display: block; }
#rap-cht-composer-portal .rap-cht-composer {
  position: static;
  background: rgba(17, 27, 33, 0.98);
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.40);
}

/* V1 desktop — composer fica DENTRO do container do chat, não fixed.
   Borda superior sutil pra demarcar do stream acima. */
body.is-aba-discussao:not(.fii-v4) .rap-chat-panel[data-chat-panel="chat"] .rap-cht-composer {
  position: static;
  margin: 0;
  padding: 10px 12px 12px;
  background: rgba(17, 27, 33, 0.98);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
}

/* /sala/ — composer mantém fixed (não usa portal) */
[data-chat-mode="sala"] .rap-cht-composer {
  position: fixed !important;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 760px;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  margin-top: 0;
  z-index: 50;
}
body.fii-v4.is-aba-discussao .rap-cht-mention-popover,
body.fii-v4.is-aba-discussao .rap-cht-emoji-pop,
[data-chat-mode="sala"] .rap-cht-mention-popover,
[data-chat-mode="sala"] .rap-cht-emoji-pop {
  bottom: calc(64px + env(safe-area-inset-bottom));
}

/* ── @ Autocomplete ── */
.rap-cht-mention-popover {
  position: absolute;
  bottom: 56px;
  left: 6px; right: 6px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 12px;
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.40);
}
.rap-cht-mention-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--v4-text, #e2e8f0);
}
.rap-cht-mention-item:hover,
.rap-cht-mention-item.is-active {
  background: rgba(37, 211, 102, 0.18);
}
.rap-cht-mention-kind {
  font-size: 0.68rem;
  color: var(--v4-text-mute, #94a3b8);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── ENQUETES (lista + criação + voto) ── */
[data-rap-polls-mount] {
  padding: 14px 14px 80px;     /* respiro do topo + espaço pro composer fixed do chat */
}
.rap-cht-poll-list {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 12px;
}
.rap-cht-poll-card {
  border: 1px solid rgba(148, 163, 184, 0.20);
  background: rgba(15, 23, 42, 0.55);
  border-radius: 14px;
  padding: 14px;
}
.rap-cht-poll-card[data-open="false"] {
  opacity: 0.75;
}
.rap-cht-poll-q {
  margin: 0 0 4px;
  font-size: 1rem; font-weight: 700;
  color: var(--v4-text, #f1f5f9);
  line-height: 1.35;
}
.rap-cht-poll-meta {
  font-size: 0.74rem;
  color: var(--v4-text-mute, #94a3b8);
  margin-bottom: 10px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.rap-cht-poll-meta .closed {
  color: #f87171;
  font-weight: 600;
}
.rap-cht-poll-desc {
  font-size: 0.86rem;
  color: var(--v4-text-soft, #cbd5e1);
  margin: 0 0 10px;
  line-height: 1.45;
}
.rap-cht-poll-opts { display: flex; flex-direction: column; gap: 6px; }
.rap-cht-poll-opt {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(30, 41, 59, 0.55);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--v4-text, #e2e8f0);
  font-family: inherit;
  text-align: left;
  width: 100%;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.rap-cht-poll-opt:hover {
  border-color: rgba(37, 211, 102, 0.45);
}
.rap-cht-poll-opt[data-voted="true"] {
  border-color: #25d366;
  background: rgba(37, 211, 102, 0.12);
}
.rap-cht-poll-opt-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(37, 211, 102, 0.18);
  z-index: 0;
  transition: width .3s ease;
}
.rap-cht-poll-opt-label {
  flex: 1;
  position: relative; z-index: 1;
}
.rap-cht-poll-opt-pct {
  position: relative; z-index: 1;
  font-size: 0.78rem;
  color: var(--v4-text-mute, #94a3b8);
  font-weight: 600;
}
.rap-cht-poll-opt[data-voted="true"] .rap-cht-poll-opt-pct {
  color: #25d366;
}
.rap-cht-poll-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--v4-text-mute, #94a3b8);
}
.rap-cht-poll-clear {
  background: none; border: 0;
  color: var(--v4-text-mute, #94a3b8);
  text-decoration: underline; cursor: pointer;
  font-size: 0.78rem; font-family: inherit;
}
.rap-cht-poll-clear:hover { color: #f87171; }

.rap-cht-poll-new {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.30);
  border-radius: 14px;
  margin-bottom: 12px;
}
.rap-cht-poll-new summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--v4-text-soft, #cbd5e1);
  font-size: 0.88rem;
  list-style: none;
}
.rap-cht-poll-new summary::-webkit-details-marker { display: none; }
.rap-cht-poll-new summary::before {
  content: "＋ ";
  color: #25d366;
  font-weight: 700;
}
.rap-cht-poll-new[open] summary::before { content: "− "; }
.rap-cht-poll-new input[type="text"],
.rap-cht-poll-new textarea,
.rap-cht-poll-new input[type="datetime-local"] {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.55);
  color: var(--v4-text, #e2e8f0);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}
.rap-cht-poll-new label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.76rem; color: var(--v4-text-mute, #94a3b8);
  font-weight: 600;
}
.rap-cht-poll-opt-input-row {
  display: flex; gap: 6px;
}
.rap-cht-poll-opt-input-row button {
  background: none; border: 0; color: #f87171; cursor: pointer; font-size: 1.1rem;
  padding: 0 4px;
}
.rap-cht-poll-add-opt {
  align-self: flex-start;
  background: none; border: 1px dashed rgba(148,163,184,0.30);
  color: var(--v4-text-soft, #cbd5e1);
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-size: 0.8rem; font-family: inherit;
}
.rap-cht-poll-add-opt:hover { border-color: #25d366; color: #25d366; }
.rap-cht-poll-new-footer {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}

/* ── Toast ── */
.rap-cht-toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #f1f5f9;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  border: 1px solid rgba(148, 163, 184, 0.20);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.40);
  z-index: 9999;
  animation: rap-cht-toast-in .18s ease;
}
.rap-cht-toast.ok  { border-color: #25d366; color: #d1fae5; }
.rap-cht-toast.err { border-color: #f87171; color: #fecaca; }
@keyframes rap-cht-toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* "ver mais" de mensagem cortada (o corte é do contexto: hoje, o card do chat
   na página do fundo). O botão só nasce onde o texto foi cortado de fato. */
.rap-cht-ver-mais {
  display: inline-block;
  margin: 2px 0 0;
  padding: 0;
  background: none;
  border: 0;
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.rap-cht-ver-mais:hover { text-decoration: underline; text-underline-offset: 2px; }
.rap-cht-msg.is-own .rap-cht-ver-mais { color: #d1fae5; }

/* Mensagem escrita sem login: guardada, esperando a pessoa entrar. */
.rap-cht-msg.is-pendente { opacity: 0.75; }
.rap-cht-login-pendente {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-style: solid;
  border-color: rgba(245, 183, 15, 0.45);
  background: rgba(245, 183, 15, 0.08);
  text-align: left;
}
.rap-cht-login-pendente p { margin: 0 0 8px; }
.rap-cht-login-pendente strong { color: #fde68a; }
