/* BATE-PAPO-FASE1, deploy A (dono, 25/11/2026): tela Conversas do painel do computador (public/conversas.js). So leitura + anotacoes.
   Usa as variaveis do painel (--surface, --border, --accent, --sage...). 3 colunas no computador; abaixo de 900 px uma coluna por vez. */
#tab-conversas .cv{display:grid;grid-template-columns:320px minmax(0,1fr) 320px;gap:16px;height:calc(100vh - 210px);min-height:520px}
#tab-conversas .cv-col{background:var(--surface);border:1px solid var(--border);border-radius:14px;display:flex;flex-direction:column;min-height:0;overflow:hidden}
#tab-conversas .cv-cab{padding:14px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px}
#tab-conversas .cv-cab h3{font-size:15px;margin:0;font-weight:600}
#tab-conversas .cv-sub{font-size:12px;color:var(--text-muted)}
#tab-conversas .cv-rolar{overflow-y:auto;flex:1;min-height:0}
#tab-conversas .cv-item{display:block;width:100%;text-align:left;background:none;border:0;border-bottom:1px solid var(--border);padding:12px 16px;color:var(--text);cursor:pointer;font:inherit}
#tab-conversas .cv-item:hover{background:var(--surface-2)}
#tab-conversas .cv-item.ativo{background:var(--surface-2);box-shadow:inset 3px 0 0 var(--accent)}
#tab-conversas .cv-l1{display:flex;justify-content:space-between;gap:8px;align-items:baseline}
#tab-conversas .cv-nome{font-weight:600;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#tab-conversas .cv-hora{font-size:11.5px;color:var(--text-muted);white-space:nowrap}
#tab-conversas .cv-l2{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-top:4px}
#tab-conversas .cv-prev{font-size:13px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#tab-conversas .cv-nl{background:var(--accent);color:#13211e;font-size:11px;font-weight:700;border-radius:10px;padding:1px 7px;min-width:18px;text-align:center}
#tab-conversas .cv-etapa{display:inline-block;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;border:1px solid var(--border);border-radius:10px;padding:1px 8px;margin-top:6px;color:var(--text-muted)}
#tab-conversas .cv-etapa.e-novo{color:var(--accent);border-color:var(--accent)}
#tab-conversas .cv-etapa.e-agendou,#tab-conversas .cv-etapa.e-compareceu{color:var(--sage);border-color:var(--sage)}
#tab-conversas .cv-etapa.e-sumiu{color:var(--error);border-color:var(--error)}
#tab-conversas .cv-msgs{padding:16px;display:flex;flex-direction:column;gap:8px}
#tab-conversas .cv-b{max-width:78%;padding:8px 12px;border-radius:12px;font-size:14px;line-height:1.45;white-space:pre-wrap;word-wrap:break-word;overflow-wrap:anywhere}
#tab-conversas .cv-b.entrou{align-self:flex-start;background:var(--surface-2);border:1px solid var(--border)}
#tab-conversas .cv-b.saiu{align-self:flex-end;background:#24433a}
#tab-conversas .cv-b .cv-quem{display:block;font-size:11px;color:var(--text-muted);margin-top:4px;text-align:right}
#tab-conversas .cv-dia{align-self:center;font-size:11.5px;color:var(--text-muted);margin:6px 0}
#tab-conversas .cv-vazio{padding:28px 18px;color:var(--text-muted);font-size:14px;line-height:1.5;text-align:center}
#tab-conversas .cv-mais{margin:12px auto;display:block}
#tab-conversas .cv-ficha{padding:16px;font-size:14px}
#tab-conversas .cv-ficha h4{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-muted);margin:18px 0 8px;font-weight:600}
#tab-conversas .cv-ficha h4:first-child{margin-top:0}
#tab-conversas .cv-nums{display:grid;grid-template-columns:1fr 1fr;gap:8px}
#tab-conversas .cv-num{border:1px solid var(--border);border-radius:10px;padding:8px 10px}
#tab-conversas .cv-num b{display:block;font-size:17px}
#tab-conversas .cv-num span{font-size:11.5px;color:var(--text-muted)}
#tab-conversas .cv-hist{list-style:none;margin:0;padding:0}
#tab-conversas .cv-hist li{border-bottom:1px solid var(--border);padding:7px 0;font-size:13px}
#tab-conversas .cv-hist li span{color:var(--text-muted);font-size:12px}
#tab-conversas .cv-an{border:1px solid var(--border);border-radius:10px;padding:8px 10px;margin-bottom:8px;font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}
#tab-conversas .cv-an small{display:flex;justify-content:space-between;color:var(--text-muted);margin-top:4px;gap:8px}
#tab-conversas .cv-an button{background:none;border:0;color:var(--text-muted);cursor:pointer;text-decoration:underline;font-size:12px;padding:0}
#tab-conversas textarea.cv-nova{width:100%;min-height:64px;resize:vertical;font-size:14px}
#tab-conversas .cv-acoes{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
#tab-conversas .cv-voltar{display:none}
@media (max-width:1280px){
  #tab-conversas .cv{grid-template-columns:280px minmax(0,1fr);height:auto}
  #tab-conversas .cv-listacol,#tab-conversas .cv-conversa{height:calc(100vh - 210px);min-height:480px}
  #tab-conversas .cv-fichacol{grid-column:1/-1}
  #tab-conversas .cv-fichacol .cv-rolar{overflow:visible}
}
@media (max-width:900px){
  #tab-conversas .cv{grid-template-columns:1fr;height:auto}
  #tab-conversas .cv-col{max-height:calc(100vh - 160px)}
  #tab-conversas .cv[data-vista="lista"] .cv-conversa,#tab-conversas .cv[data-vista="lista"] .cv-fichacol{display:none}
  #tab-conversas .cv[data-vista="conversa"] .cv-listacol{display:none}
  #tab-conversas .cv-voltar{display:inline-block}
}
/* CONVERSAS-AO-VIVO: numero de conversas nao lidas no item Conversas do menu */
.nav-item[data-tab="conversas"] .cv-badge{display:inline-block;margin-left:8px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--accent);color:#13211e;font-size:11px;font-weight:700;line-height:18px;text-align:center;vertical-align:middle}
.nav-item[data-tab="conversas"] .cv-badge[hidden]{display:none}
/* AJUSTES-CONVERSAS-2511 item 4: Assumir / Devolver a IA */
#tab-conversas .cv-ia{margin-top:8px}
#tab-conversas .cv-ia-st{font-weight:600;font-size:13px;margin-right:8px}
#tab-conversas .cv-ia-st.e-atendendo{color:var(--sage)}
#tab-conversas .cv-ia-st.e-assumiu,#tab-conversas .cv-ia-st.e-pausada{color:var(--accent)}
/* CONVERSAS-TELA-2511 item 3 */
#tab-conversas .cv-naoresp{background:none;border:0;color:var(--text-muted);font-size:12px;text-decoration:underline;cursor:pointer;white-space:nowrap;align-self:flex-start}
/* CONVERSAS-TELA-2511 item 4: ficha conforme o cliente */
#tab-conversas .cv-ag-grande{width:100%;padding:12px 16px;font-size:15px;font-weight:600;margin-top:10px}
#tab-conversas .cv-ag-link{background:none;border:0;padding:6px 0;color:var(--text-muted);font-size:13px;text-decoration:underline;cursor:pointer}
#tab-conversas .cv-resumo{margin-top:10px;padding:10px 12px;border:1px solid var(--accent);border-radius:10px;font-weight:600;font-size:14px}
#tab-conversas .cv-hora-escolhida{outline:2px solid var(--accent);outline-offset:1px}
#tab-conversas .cv-prox b{display:block;margin-bottom:4px}
/* CONVERSAS-TELA-2511 itens 1 e 2: caixa de escrever */
#tab-conversas .cv-caixa{border-top:1px solid var(--border);padding:10px 12px;background:var(--surface)}
#tab-conversas .cv-caixa textarea{width:100%;min-height:52px;resize:vertical;font-size:14px;box-sizing:border-box}
#tab-conversas .cv-caixa .cv-acoes{align-items:center}
/* CORRIGE-ENVIAR-2511: WhatsApp desconectado */
#tab-conversas .cv-desc{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;border:1px solid var(--accent);background:rgba(253,127,79,.10);border-radius:10px;padding:8px 10px;margin-bottom:8px;font-size:13.5px}
#tab-conversas .cv-desc[hidden]{display:none}
#tab-conversas .cv-caixa button:disabled{opacity:.5;cursor:not-allowed}
#tab-conversas #cvRRBox{margin-top:8px;max-height:260px;overflow:auto}
