/* T_ROOM - T_CHAT estilo Discord (19/10): menções, tópicos, eventos (js/tchat-discord.js).
   Carregado com o T_CHAT (TM_ADIADOS.conversas). Usa os tokens do style.css; nada aqui muda o que já existia. */

/* ---------------------------------------------------------------- menções */
.td-men { color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.td-men.eu { color: var(--on-aviso); background: color-mix(in srgb, var(--warn) 85%, transparent); }
.wz-m:has(.td-men.eu) .wz-b { box-shadow: inset 3px 0 0 var(--warn), 0 1px 1.5px rgba(0, 0, 0, .22); }
.td-marca-men { font-style: normal; min-width: 20px; height: 20px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--warn); color: var(--on-aviso); font-size: 12px; font-weight: 800; flex: none; }
.wz-filtros button .wz-nl { min-width: 18px; height: 18px; font-size: 10.5px; margin-left: 4px; }
.td-men-topo { display: flex; justify-content: flex-end; padding: 4px 14px; }
.td-men-item.nova { background: color-mix(in srgb, var(--warn) 7%, transparent); }
.td-men-onde { color: var(--muted); font-weight: 500; font-size: 12px; }
.td-sug .td-sug-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.td-sug .td-sug-l b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-sug .td-sug-l small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.td-sug-av { width: 26px; height: 26px; font-size: 11px; flex: none; }
.td-sug-todos { display: grid; place-items: center; background: var(--warn); color: var(--on-aviso); }
.td-sug-todos svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- eventos */
.wz-anx-ic.laranja { background: var(--anx-laranja); }
.td-ev { display: grid; gap: 8px; min-width: min(300px, 70vw); padding: 2px 0; }
.td-ev-cab { display: flex; align-items: flex-start; gap: 10px; }
.td-ev-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--anx-laranja) 22%, transparent); color: var(--anx-laranja-claro); flex: none; }
.td-ev-ic svg { width: 20px; height: 20px; }
.td-ev-tit { display: grid; gap: 1px; min-width: 0; flex: 1; }
.td-ev-tit b { font-size: 15px; overflow-wrap: anywhere; }
.td-ev-tit small { color: var(--text-soft); font-size: 13px; }
.td-ev-tit small::first-letter { text-transform: uppercase; }
.td-ev-tag { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-4); color: var(--text-soft); white-space: nowrap; }
.td-ev-tag.vivo { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok-text); }
.td-ev-tag.perigo { background: var(--danger-soft); color: var(--danger-text); }
.td-ev.cancelado .td-ev-tit b { text-decoration: line-through; opacity: .7; }
.td-ev-local { display: flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 13px; }
.td-ev-local svg { width: 15px; height: 15px; flex: none; }
.td-ev-desc { color: var(--text-soft); font-size: 13.5px; overflow-wrap: anywhere; }
.td-ev-quem { display: flex; align-items: center; gap: 8px; }
.td-ev-quem small { color: var(--muted); font-size: 12.5px; }
.td-ev-avs { display: flex; }
.td-ev-av { width: 22px; height: 22px; font-size: 10px; margin-left: -6px; box-shadow: 0 0 0 2px var(--wz-dele); }
.td-ev-avs .td-ev-av:first-child { margin-left: 0; }
.td-ev-bts { display: flex; gap: 6px; flex-wrap: wrap; }
.td-ev-bts button { flex: 1 1 0; min-height: var(--h-btn); border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 8px; white-space: nowrap; }
.td-ev-bts button:hover { background: var(--surface-3); }
.td-ev-bts button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.td-ev-canal { justify-content: center; }
.td-ev-adm { display: flex; gap: 14px; }
.td-ev-adm .perigo { color: var(--danger-text); }
.td-dlg-linha { display: grid; grid-template-columns: 1fr 140px; gap: 10px; }
.td-dlg .wz-dlg-campo select, .td-dlg .wz-dlg-campo textarea, .td-dlg .wz-dlg-campo input[type=datetime-local] { width: 100%; }
.td-ev-sw { margin: 4px 0 8px; }
.td-ev-lista { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; margin: 6px 0 4px; }
.td-ev-li { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.td-ev-li:hover { background: var(--surface-2); }
.td-ev-li > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.td-ev-li small { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- tópicos */
.td-top-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 4px; padding: 5px 10px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); color: var(--text-soft); font: inherit; font-size: 12.5px; cursor: pointer; }
.td-top-chip:hover { background: var(--surface-3); }
.td-top-chip svg { width: 15px; height: 15px; flex: none; color: var(--accent-text); }
.td-top-chip b { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.td-top-chip small { color: var(--muted); white-space: nowrap; }
.td-top-chip.nova { border-color: var(--accent); }
.wz-m.minha .td-top-chip { align-self: flex-end; }
.td-top-cab { gap: 6px; }
.td-top-tit { display: grid; flex: 1; min-width: 0; }
.td-top-tit b { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-top-tit b svg { width: 16px; height: 16px; flex: none; color: var(--accent-text); }
.td-top-tit small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-top-cab .wz-ic.on { color: var(--accent-text); }
.td-top-msgs { padding: 10px 12px 14px; background: var(--wz-bg); }
.td-top-msgs .wz-m { max-width: 92%; }
.td-top-raiz { padding-bottom: 6px; border-bottom: 1px dashed var(--border-2); margin-bottom: 4px; }
.td-top-raiz .wz-m { max-width: 100%; }
.td-top-compor { flex: none; }
.td-top-compor textarea { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; resize: none; padding: 10px 12px 10px 0; max-height: 140px; outline: none; }
.td-topo-bt svg { width: 20px; height: 20px; }

@media (max-width: 560px) {
  .td-dlg-linha { grid-template-columns: 1fr; }
  .td-top-chip b { max-width: 140px; }
}

/* ---------------------------------------------------------------- o grupo como servidor (js/tchat-servidor.js) */
.ts-cargo { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: var(--cor); background: color-mix(in srgb, var(--cor) 18%, transparent); white-space: nowrap; margin-left: 4px; }
.ts-sil { font-style: normal; color: var(--warn); margin-left: 4px; display: inline-flex; vertical-align: -3px; }
.ts-sil svg { width: 15px; height: 15px; }
.ts-mod-bt { flex: none; }
.ts-bola { width: 12px; height: 12px; border-radius: 50%; background: var(--cor); flex: none; display: inline-block; }
.ts-bloq { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.ts-bloq svg { width: 16px; height: 16px; }
.ts-lento { display: flex; align-items: center; gap: 6px; padding: 4px 14px; font-size: 12.5px; color: var(--text-soft); background: var(--surface-2); border-top: 1px solid var(--border); }
.ts-lento svg { width: 14px; height: 14px; }
.ts-dlg.ts-largo { width: min(620px, calc(100vw - 32px)); }
.td-dlg .modal-inner > *, .ts-dlg .modal-inner > *, .te-dlg .modal-inner > *, .tc-dlg .modal-inner > * { min-width: 0; }
.ts-dlg .modal-head h2 { display: flex; align-items: center; gap: 8px; }
.ts-dlg .modal-head h2 svg { width: 20px; height: 20px; }
.ts-abas { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.ts-corpo { display: grid; gap: 10px; max-height: 58vh; overflow-y: auto; padding-right: 2px; }
.ts-cargos { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ts-cargos li { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.ts-cargos li > span { display: grid; flex: 1; min-width: 0; }
.ts-cargos li small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px; }
.ts-perm { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; cursor: pointer; min-height: 40px; }
.ts-cores { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.ts-cores label { cursor: pointer; }
.ts-cores input { position: absolute; opacity: 0; pointer-events: none; }
.ts-cores i { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; }
.ts-cores input:checked + i { border-color: var(--text); }
.ts-cores input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.ts-sec { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.ts-sec > b { display: flex; align-items: center; gap: 6px; }
.ts-sec > b svg { width: 16px; height: 16px; }
.ts-sec > small { color: var(--muted); font-size: 12.5px; }
.ts-sec textarea, .ts-corpo textarea { width: 100%; resize: vertical; }
.ts-linha-bt { display: flex; gap: 8px; align-items: center; }
.ts-conv { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1px solid var(--border); }
.ts-conv > span { display: grid; flex: 1; min-width: 0; }
.ts-conv small { color: var(--muted); font-size: 12px; }
.ts-link { display: flex; gap: 8px; margin: 6px 0; }
.ts-link input { flex: 1; min-width: 0; }
.ts-convites { margin-top: 6px; }
.ts-regras { white-space: normal; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); max-height: 50vh; overflow-y: auto; line-height: 1.5; }
.ts-reg { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 55vh; overflow-y: auto; }
.ts-reg li { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.ts-reg small { color: var(--muted); font-size: 12px; }
.ts-reg em { color: var(--text-soft); font-style: normal; }
.ts-conv-cartao { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.ts-conv-cartao > span:last-child { display: grid; }
.ts-conv-cartao small { color: var(--muted); }
.ts-conv-av { width: 48px; height: 48px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.ts-conv-av svg { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- enquetes, figurinhas, emojis (js/tchat-enquetes.js) */
.te-enq { display: grid; gap: 6px; min-width: min(300px, 70vw); }
.te-cab { display: flex; align-items: flex-start; gap: 8px; }
.te-cab svg { width: 18px; height: 18px; color: var(--accent-text); flex: none; margin-top: 2px; }
.te-cab b { font-size: 15px; overflow-wrap: anywhere; }
.te-sub { color: var(--muted); font-size: 12.5px; }
.te-ops { display: grid; gap: 6px; }
.te-op { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; min-height: var(--h-item); padding: 4px 10px; border: 1px solid var(--border-2); border-radius: var(--r-btn); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.te-op:disabled { cursor: default; }
.te-op.on { border-color: var(--accent); }
.te-barra { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); transition: width .3s ease; pointer-events: none; }
.te-marca, .te-txt, .te-op small { position: relative; }
.te-txt { flex: 1; overflow-wrap: anywhere; }
.te-op small { color: var(--text-soft); font-size: 12.5px; white-space: nowrap; }
.te-op-ed { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.te-op-ed input { flex: 1; min-width: 0; }
.te-sw { margin: 8px 0; }
.te-fig { display: block; max-width: 160px; max-height: 160px; object-fit: contain; }
.wz-b:has(> .te-fig) { background: transparent; box-shadow: none; padding: 0; }
.te-emo { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; }
.wz-txt.grande .te-emo { width: 40px; height: 40px; }
.te-pop { width: min(340px, calc(100vw - 16px)); }
.te-grade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px; max-height: 240px; overflow-y: auto; }
.te-grade.emo { grid-template-columns: repeat(7, 1fr); }
.te-grade button { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--surface); cursor: pointer; padding: 4px; display: grid; place-items: center; min-height: 40px; }
.te-grade button:hover { background: var(--surface-3); }
.te-grade img { max-width: 100%; max-height: 100%; object-fit: contain; }
.te-lista { display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; }
.te-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; background: var(--surface-2); }
.te-item img { width: 40px; height: 40px; object-fit: contain; }
.te-item > span { display: grid; flex: 1; }
.te-item small { color: var(--muted); font-size: 12px; }
@media (max-width: 560px) {
  .ts-reg li { grid-template-columns: 1fr; gap: 2px; }
  .ts-perms { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- canais do grupo (js/tchat-canais.js) */
.tc-barra { display: flex; gap: 4px; padding: 6px 10px; overflow-x: auto; scrollbar-width: none; background: var(--surface); border-bottom: 1px solid var(--border); }
.tc-canal { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: var(--h-btn); padding: 4px 12px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tc-canal:hover { background: var(--surface-3); }
.tc-canal.on { background: var(--accent-soft); color: var(--accent-text); }
.tc-canal .wz-nl { min-width: 18px; height: 18px; font-size: 10.5px; }
.tc-voz { color: var(--ok-text); }
.tc-mais { padding: 4px 8px; }
.tc-mais svg { width: 16px; height: 16px; }
.tc-lista { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; }
.tc-lista li { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.tc-lista .wz-vazio { display: block; }
.tc-somod { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.tc-lista [data-tc-sobe] svg { transform: rotate(-90deg); }

/* celular: alvo de toque de 44 px (WCAG 2.5.5, regra do projeto) */
@media (max-width: 600px) {
  .tc-mais { justify-content: center; }
}

/* ---------------------------------------------------------------- gaveta do T_CHAT (ao lado, fixada, folha no celular; 20/10)
   O cabeçalho é montado em js/navegacao.js: aqui só o desenho. Título e "ao lado" numa linha só (o subtítulo cede lugar e
   termina em "…"), botões alinhados e do tamanho certo, chips que cabem, rolagem estável e abre/fecha suave. */
.tchat-gaveta { transition: transform .18s cubic-bezier(.2, .8, .2, 1), opacity .16s ease-out; opacity: 0; box-shadow: -14px 0 40px rgba(0, 0, 0, .28); }
.tchat-gaveta.aberta { opacity: 1; }
.tchat-gaveta.fixa { box-shadow: none; }
.tg-topo { position: relative; height: 56px; gap: 10px; padding: 0 8px 0 14px; min-width: 0; background: color-mix(in srgb, var(--bg-2) 82%, var(--c-chat) 4%); }
.tg-topo .tg-ic { flex: none; width: 32px; height: 32px; border-radius: 10px; }
.tg-topo .tg-ic svg { width: 18px; height: 18px; }
.tg-topo .tg-nome { flex: none; font-size: 16px; line-height: 1; letter-spacing: .01em; white-space: nowrap; }
.tg-topo .tg-dica { flex: 1 1 0; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; line-height: 1; padding-top: 2px; }
.tg-topo .icon-btn { flex: none; border-radius: var(--r-btn); display: inline-grid; place-items: center; padding: 0; color: var(--text-soft); transition: background .15s, color .15s, transform .12s; }
.tg-topo .icon-btn svg { width: 18px; height: 18px; }
.tg-topo .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.tg-topo .icon-btn:active { transform: scale(.93); }
.tg-topo .icon-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--c-chat) 18%, transparent); color: var(--c-chat); }
.tg-topo .icon-btn[data-tg="fechar"]:hover { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger-text, var(--danger)); }
.tchat-gaveta .wz-lista-rol { scrollbar-gutter: stable; overscroll-behavior: contain; overflow-anchor: none; scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
.tchat-gaveta .wz-msgs { overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
.tchat-gaveta .wz-eu { padding: 10px 12px 10px 14px; }
.tchat-gaveta .wz-busca { margin: 10px 12px 4px; }
.tchat-gaveta .wz-filtros { gap: 4px; padding: 6px 12px 8px; scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(to right, var(--preto) calc(100% - 22px), transparent); mask-image: linear-gradient(to right, var(--preto) calc(100% - 22px), transparent); }
.tchat-gaveta .wz-filtros button { scroll-snap-align: start; }
.tchat-gaveta .wz-filtros button:last-child { margin-right: 14px; }
.tchat-gaveta .wz-filtros button .wz-nl { display: inline-grid; place-items: center; vertical-align: 1px; }
.tchat-gaveta .wz-sec { padding: 14px 14px 5px; font-size: 11px; letter-spacing: .07em; }
.tchat-gaveta .wz-vazio { display: grid; justify-items: center; gap: 4px; padding: 26px 24px; color: var(--muted); font-size: 13px; line-height: 1.5; text-wrap: balance; }
.tchat-gaveta .wz-vazio::before { content: ""; width: 44px; height: 44px; margin-bottom: 8px; background: var(--c-chat); opacity: .8;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20.5l1.5-4.6A8 8 0 1 1 21 12z'/%3E%3Cpath d='M9 11h6M9 14h3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20.5l1.5-4.6A8 8 0 1 1 21 12z'/%3E%3Cpath d='M9 11h6M9 14h3.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.tchat-gaveta .tg-erro { text-align: center; text-wrap: balance; }
@media (max-width: 380px) { .tg-topo .tg-dica { display: none; } }
@media (pointer: coarse) {
}
/* celular: folha que sobe por baixo (sobra uma fresta da sala em cima), com a alça no topo */
@media (max-width: 700px) {
  .tchat-gaveta { top: max(10px, env(safe-area-inset-top)); width: 100vw; border-left: 0; border-top: 1px solid var(--border-2); border-radius: 18px 18px 0 0; transform: translateY(104%); box-shadow: 0 -10px 40px rgba(0, 0, 0, .4); overflow: hidden; }
  .tchat-gaveta.aberta { transform: none; }
  .tg-topo { height: 60px; padding-top: 6px; }
  .tg-topo::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--border-2); }
  .tg-corpo { padding-bottom: env(safe-area-inset-bottom); }
}
@media (prefers-reduced-motion: reduce) { .tchat-gaveta, .tg-topo .icon-btn, .tchat-gaveta .wz-filtros button { transition: none; } }
