/* A tela de conversa do Tok Bot, no desenho do Hanzo (design/hanzo/LEIA-ME.md), por cima da casca da família.

   22/11 (pedido do Paulo: tamanhos, fontes e menu como os do app de referência): medidas de aplicativo. Texto de 14 a
   15 px, títulos de painel em 15 px, botzinhos menores, raios de 10 a 14 px e um fio no lugar do anel. A lista de
   conversas deixou de ser a moldura preta: é um painel claro, como o da conversa, e a escolhida fica em cinza.

   - O painel da conversa é o cartão branco com fio e sombra curta.
   - No alto do painel, o palco: os botzinhos da equipe. Quem está com a vez se mexe e ganha o ponto laranja.
   - A pessoa fala em balão de tinta (preto); o agente, em cinza claro, com o rosto dele ao lado.
   - Os bastidores (a conversa entre os agentes) ficam dentro da resposta, num bloco que abre e fecha.
   O laranja (#ff3700) é só marca: ponto de atividade, traço, ícone. Nunca texto pequeno.
   No celular (até 899 px), todo alvo de toque continua com 44 px. */

:root { --bot-balao: rgb(0 0 0 / 5%); --bot-balao-texto: var(--tok-text); --bot-moldura: #262626; }
[data-tok-theme="dark"] { --bot-balao: rgb(255 255 255 / 9%); --bot-moldura: #141414; }

.bot-conteudo { max-width: none; padding-bottom: 16px; }
.bot {
  display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 12px;
  height: calc(100vh / var(--bot-zoom, 1) - 96px); min-height: 480px;
}

/* ---- a lista de conversas ------------------------------------------------------------------------------------ */
.bot-lista {
  display: flex; flex-direction: column; min-height: 0; border-radius: 14px;
  background: var(--tok-surface); color: var(--tok-text); padding: 12px 8px 8px; box-shadow: var(--tok-sombra);
}
.bot-lista-topo h2 { font-size: 15px; line-height: 20px; margin: 0 0 8px; padding: 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.bot-lista-corpo { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.bot-lista-corpo .tok-carregando, .bot-lista-corpo .bot-lista-vazia { color: var(--tok-text-soft); padding: 4px 8px; font-size: 14px; line-height: 20px; }
.bot-conversas { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bot-conversa {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 5px 8px;
  border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left;
  font: inherit; cursor: pointer; transition: background var(--tok-motion);
}
.bot-conversa:hover { background: var(--hz-suave, rgb(0 0 0 / 5%)); }
.bot-conversa[aria-current="true"] { background: var(--hz-fio, rgb(0 0 0 / 10%)); }
.bot-conversa-bola { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--hz-suave, rgb(0 0 0 / 5%)); color: var(--tok-text); }
/* O boneco de tinta (o Mordomo) sumiria num fundo escuro: no tema escuro a bola é clara. */
[data-tok-theme="dark"] .bot-conversa-bola { background: #ededed; color: #000; }
.bot-conversa-bola svg.tok-icone { width: 16px; height: 16px; }
.bot-conversa-texto { display: grid; min-width: 0; flex: 1; }
.bot-conversa-texto strong { font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-conversa[aria-current="true"] .bot-conversa-texto strong { font-weight: 600; }
.bot-conversa-texto small { font-size: 12px; line-height: 16px; color: var(--tok-text-soft); }
.bot-conversa-ponto { width: 8px; height: 8px; border-radius: 50%; background: #ff3700; flex: none; }
.bot-nova {
  margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; border: 0; border-radius: 999px; background: var(--tok-acento); color: var(--tok-sobre-acento);
  font: 550 14px/20px var(--tok-font-body); letter-spacing: -0.01em; cursor: pointer;
  transition: transform var(--tok-motion);
}
.bot-nova:hover { transform: translateY(-1px); }
.bot-nova .tok-icone { width: 18px; height: 18px; color: #ff3700; }

/* ---- o painel da conversa ------------------------------------------------------------------------------------ */
.bot-painel {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: 14px;
  background: var(--tok-surface); box-shadow: var(--tok-sombra); overflow: hidden;
}
.bot-painel-topo { display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px; }
.bot-avatar-bot { flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.bot-avatar-bot img { width: 30px; height: 30px; border-radius: 10px; }
.bot-painel-titulo { flex: 1; min-width: 0; }
/* O título da conversa em até duas linhas (no celular, numa só ele saía cortado). */
.bot-painel-titulo h2 { font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.bot-painel-sub { margin: 0; font-size: 14px; line-height: 19px; color: var(--tok-text-soft); }
.bot-so-celular { display: none; }
.bot-aviso { padding: var(--tok-e3) var(--tok-e4) 0; }
.bot-aviso .tok-alerta { margin: 0; }

/* o palco: a equipe em fila, cada um com o seu nome */
.bot-palco { display: flex; gap: 2px; padding: 2px 10px 8px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--hz-fio, rgb(0 0 0 / 10%));
  /* a fila rola de lado quando a equipe é grande; a borda direita some aos poucos para dizer que tem mais */
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.bot-palco::-webkit-scrollbar { display: none; }
.bot-palco-agente { position: relative; flex: none; display: grid; justify-items: center; gap: 2px; min-width: 72px; min-height: 60px;
  padding: 6px 4px 5px; border: 0; border-radius: 10px; background: transparent; color: var(--tok-text-soft);
  font: 500 14px/17px var(--tok-font-body); letter-spacing: -0.01em; text-decoration: none; cursor: pointer;
  align-content: start; text-align: center; transition: background var(--tok-motion), color var(--tok-motion); }
/* O palco é menu: 14 px, e o nome que não cabe quebra em duas linhas (nunca reticências, regra da casa). */
.bot-palco-agente span:last-child { max-width: 84px; overflow-wrap: normal; }
.bot-palco-agente:hover { background: var(--hz-suave, rgb(0 0 0 / 5%)); color: var(--tok-text); }
.bot-palco-agente[aria-pressed="true"] { background: var(--hz-fio, rgb(0 0 0 / 10%)); color: var(--tok-text); font-weight: 600; }
.bot-palco-agente[data-ativo] { color: var(--tok-text); }
.bot-palco-agente[data-ativo]::after { content: ""; position: absolute; top: 6px; right: 14px; width: 8px; height: 8px;
  border-radius: 50%; background: #ff3700; box-shadow: 0 0 0 2px var(--tok-surface); animation: bot-pulsa 1.2s ease-in-out infinite; }
@keyframes bot-pulsa { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
.bot-palco-bola { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 1px dashed var(--tok-border); color: #ff3700; }

.bot-mensagens { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 12px;
  display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.bot-mensagens:focus-visible { outline-offset: -3px; }

.bot-msg { display: flex; gap: 10px; align-items: flex-start; max-width: min(720px, 92%); }
.bot-msg-bot { align-self: flex-start; }
.bot-msg-pessoa { align-self: flex-end; flex-direction: row-reverse; align-items: flex-end; }
.bot-msg-rosto { flex: none; width: 30px; height: 30px; display: grid; place-items: center; margin-top: 1px; }
.bot-msg-rosto img { width: 28px; height: 28px; border-radius: 9px; }
.bot-msg-iniciais { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tok-surface); color: var(--tok-text); font: 600 12px/1 var(--tok-font-body);
  box-shadow: 0 0 0 1px var(--hz-fio, rgb(0 0 0 / 10%)); }
.bot-msg-corpo { display: grid; gap: 6px; min-width: 0; justify-items: start; }
.bot-msg-pessoa .bot-msg-corpo { justify-items: end; }
.bot-msg-quem { margin: 0; font-size: 14px; line-height: 19px; color: var(--tok-text-soft); }
.bot-msg-quem strong { color: var(--tok-text); font-weight: 600; }
.bot-balao { padding: 9px 14px; border-radius: 16px; overflow-wrap: anywhere; max-width: 100%; font-size: 15px; line-height: 22px; }
.bot-balao p { margin: 0 0 var(--tok-e2); }
.bot-balao p:last-child, .bot-balao ul:last-child { margin-bottom: 0; }
.bot-balao ul { margin: 0 0 var(--tok-e2); padding-left: 20px; }
.bot-balao li::marker { color: #ff3700; }
.bot-msg-bot .bot-balao { background: var(--bot-balao); color: var(--bot-balao-texto); border-top-left-radius: 6px; }
.bot-msg-pessoa .bot-balao { background: var(--tok-acento); color: var(--tok-sobre-acento); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bot-msg-nota { font-size: 14px; line-height: 20px; color: var(--tok-text-soft); margin: 0; }
.bot-msg-erro .bot-balao { background: var(--tok-erro-bg); color: var(--tok-erro-text); }
.bot-balao-acoes { display: flex; flex-wrap: wrap; gap: var(--tok-e2); }
.bot-balao-acoes .tok-botao { min-height: 32px; padding: 6px 14px; font-size: 14px; }

/* os três pontinhos (o Tok Bot simples, e enquanto a equipe ainda não disse quem está com a vez) */
.bot-digitando { display: inline-flex; gap: 5px; align-items: center; padding: 12px 14px; border-radius: 16px;
  border-top-left-radius: 6px; background: var(--bot-balao); width: fit-content; }
.bot-digitando i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; color: var(--bot-balao-texto);
  opacity: .45; animation: bot-pula 1.2s infinite ease-in-out; }
.bot-digitando i:nth-child(2) { animation-delay: .15s; }
.bot-digitando i:nth-child(3) { animation-delay: .3s; }
@keyframes bot-pula { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: .9; } }

/* "Porteiro está trabalhando…" */
.bot-status { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 3px 12px 3px 4px;
  border-radius: 999px; background: var(--tok-surface); font-size: 14px; line-height: 20px; color: var(--tok-text-soft);
  box-shadow: 0 0 0 1px var(--hz-fio, rgb(0 0 0 / 10%)); }

/* os bastidores: a conversa entre os agentes */
.bot-bastidores { width: min(560px, 100%); border-radius: 12px; background: var(--tok-surface);
  box-shadow: 0 0 0 1px var(--hz-fio, rgb(0 0 0 / 10%)); }
.bot-bastidores summary { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; cursor: pointer;
  list-style: none; border-radius: 12px; }
.bot-bastidores summary::-webkit-details-marker { display: none; }
.bot-bastidores summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--tok-motion); color: var(--tok-text-soft); }
.bot-bastidores[open] summary::after { transform: rotate(225deg) translateY(-2px); }
.bot-bastidores-titulo { font: italic 400 17px/22px var(--hz-serifa, Georgia, serif); color: var(--tok-text); }
.bot-bastidores-conta { font-size: 14px; line-height: 19px; color: var(--tok-text-soft); }
.bot-bastidores-linhas { list-style: none; margin: 0; padding: 2px 12px 10px; display: grid; gap: 8px; }
.bot-fala { display: flex; gap: 8px; align-items: flex-start; }
.bot-fala-rosto { flex: none; width: 24px; height: 24px; display: grid; place-items: center; }
.bot-fala-rosto img { width: 20px; height: 20px; border-radius: 6px; }
.bot-fala strong { display: block; font-size: 14px; line-height: 20px; font-weight: 600; }
.bot-fala p { margin: 0; font-size: 14px; line-height: 20px; color: var(--tok-text-soft); overflow-wrap: anywhere; white-space: pre-line; }
.bot-fala[data-tipo="parecer"] { padding: 8px 10px; border-radius: 10px; background: var(--tok-aviso-bg); }
.bot-fala[data-tipo="parecer"] :is(strong, p) { color: var(--tok-aviso-text); }

/* o cartão de ferramenta: curto, nunca o JSON */
.bot-ferramenta { display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%;
  padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--tok-surface); font-size: 14px; line-height: 20px;
  color: var(--tok-text-soft); box-shadow: 0 0 0 1px var(--hz-fio, rgb(0 0 0 / 10%)); }
.bot-ferramenta img.tok-simbolo { width: 22px; height: 22px; border-radius: 7px; }
.bot-ferramenta strong { color: var(--tok-text); font-weight: 600; }
.bot-ferramenta .bot-ferramenta-marca { width: 16px; height: 16px; flex: none; }
.bot-ferramenta[data-estado="rodando"] .bot-ferramenta-marca { border-radius: 50%; border: 2px solid #ff3700;
  border-right-color: transparent; animation: tok-gira 800ms linear infinite; }
.bot-ferramenta[data-estado="ok"] .bot-ferramenta-marca { color: var(--tok-green); }
.bot-ferramenta[data-estado="erro"] .bot-ferramenta-marca { color: var(--tok-perigo); }
.bot-imagem { border-radius: 12px; max-width: min(420px, 100%); height: auto; box-shadow: 0 0 0 1px var(--hz-fio, rgb(0 0 0 / 10%)); }

/* o cartão de confirmação */
.bot-acao { border-radius: 12px; background: var(--tok-surface); padding: 14px; display: grid; gap: 6px; width: min(420px, 100%);
  box-shadow: 0 0 0 1px var(--hz-divisor, rgb(0 0 0 / 25%)), 0 4px 12px rgb(0 0 0 / 6%); }
.bot-acao-cabeca { display: flex; gap: 10px; align-items: center; }
.bot-acao-cabeca img.tok-simbolo { width: 28px; height: 28px; border-radius: 8px; }
.bot-acao h3 { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; }
.bot-acao-quem { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; line-height: 20px; color: var(--tok-text-soft); }
.bot-acao-detalhe { margin: 0; font-size: 14px; line-height: 20px; color: var(--tok-text-soft); overflow-wrap: anywhere; }
.bot-acao-botoes { display: flex; flex-wrap: wrap; gap: var(--tok-e2); margin-top: var(--tok-e1); }
.bot-acao-botoes .tok-botao { flex: 1 1 120px; }
.bot-acao[data-perigo] .bot-confirmar { background: var(--tok-perigo); color: #fff; }
.bot-acao-resultado { margin: 0; font-size: 14px; line-height: 20px; }

/* o começo (conversa nova) */
.bot-comeco { margin: auto; max-width: 560px; text-align: center; display: grid; gap: 8px; justify-items: center; padding: 8px 0 12px; }
.bot-comeco img.tok-simbolo { width: 56px; height: 56px; }
.bot-comeco .hz-sobrolho { width: min(320px, 100%); font-size: 18px; line-height: 24px; }
.bot-comeco h3 { font-size: 22px; line-height: 28px; letter-spacing: -0.03em; font-weight: 600; margin: 0; }
.bot-comeco p { margin: 0; color: var(--tok-text-soft); max-width: 480px; font-size: 14px; line-height: 21px; }
.bot-sugestoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.bot-sugestao { min-height: 34px; padding: 6px 14px; border-radius: 999px; border: 0;
  background: var(--tok-surface); color: var(--tok-text); font: 500 14px/20px var(--tok-font-body); letter-spacing: -0.01em;
  cursor: pointer; box-shadow: 0 0 0 1px var(--hz-divisor, rgb(0 0 0 / 25%));
  transition: background var(--tok-motion), box-shadow var(--tok-motion); }
.bot-sugestao:hover, .bot-sugestao:focus-visible { background: var(--hz-suave, rgb(0 0 0 / 5%)); box-shadow: 0 0 0 1px var(--tok-text); }
.bot-produtos { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.bot-produto { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 4px;
  min-height: 32px; border-radius: 999px; font-size: 14px; line-height: 20px;
  text-decoration: none; color: var(--tok-text-soft); background: var(--hz-suave, rgb(0 0 0 / 5%)); }
.bot-produto img.tok-simbolo { width: 22px; height: 22px; border-radius: 7px; }
.bot-produto strong { color: var(--tok-text); font-weight: 600; }
a.bot-produto:hover { background: var(--tok-surface); box-shadow: 0 0 0 1px var(--hz-divisor, rgb(0 0 0 / 25%)); }
.bot-selo-demo { font-size: 12px; line-height: 16px; padding: 2px 10px; border-radius: 999px;
  background: #ff3700; color: #000; font-weight: 650; }

/* o campo de escrever */
.bot-escrever { display: flex; align-items: flex-end; gap: 6px; margin: 0 16px 16px;
  padding: 4px 4px 4px 16px; border-radius: 22px; background: var(--tok-surface);
  box-shadow: 0 0 0 1px var(--hz-divisor, rgb(0 0 0 / 25%));
  transition: box-shadow var(--tok-motion); }
.bot-escrever:focus-within { box-shadow: 0 0 0 2px var(--tok-text); }
/* O foco já aparece na pílula inteira (acima); o contorno do campo de dentro (regra geral do hanzo.css) sairia dobrado. */
:root .bot-escrever textarea:focus-visible { outline: none; }
.bot-escrever textarea { flex: 1; min-height: 36px; max-height: 180px; resize: none; border: 0; outline: 0; background: transparent;
  color: var(--tok-text); font: 400 15px/20px var(--tok-font-body); padding: 8px 0; }
.bot-escrever textarea::placeholder { color: var(--tok-text-soft); }
.bot-enviar { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--tok-acento); color: var(--tok-sobre-acento); cursor: pointer;
  transition: transform var(--tok-motion), opacity var(--tok-motion); }
.bot-enviar .tok-icone { width: 18px; height: 18px; }
.bot-enviar:hover { transform: translateY(-1px); }
.bot-enviar:disabled { opacity: .45; cursor: default; transform: none; }
.bot-icone-parar { display: none; }
.bot-enviar[data-parar] { background: #ff3700; color: #000; }
.bot-enviar[data-parar] .bot-icone-parar { display: block; }
.bot-enviar[data-parar] .bot-icone-enviar { display: none; }

/* ---- celular: ou a lista, ou a conversa; alvos de 44 px -------------------------------------------------------- */
@media (max-width: 899px) {
  .bot-conteudo { padding: 0 var(--tok-e3) 0; }
  .bot { display: block; height: auto; min-height: 0; padding: 4px 0; }
  .bot[data-vista="conversa"] .bot-lista { display: none; }
  .bot[data-vista="lista"] .bot-painel { display: none; }
  .bot-so-celular { display: inline-grid; }
  .bot-lista { min-height: 320px; padding: 14px 8px 8px; }
  .bot-lista-corpo { overflow: visible; }
  .bot-conversa { min-height: 56px; }
  /* o botão redondo "+" acima das abas */
  .bot-nova { position: fixed; right: var(--tok-e4); bottom: calc(108px + env(safe-area-inset-bottom)); z-index: 31;
    width: 56px; height: 56px; padding: 0; margin: 0; border-radius: 50%; background: var(--tok-acento); color: var(--tok-sobre-acento);
    box-shadow: 0 6px 16px rgb(0 0 0 / 24%); }
  .bot-nova .tok-icone { width: 22px; height: 22px; }
  .bot-nova span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .bot[data-vista="conversa"] .bot-nova { display: none; }
  /* Como um app: o painel ocupa a altura entre o cabeçalho e as abas, e só as mensagens rolam; o campo fica sempre
     à vista. As abas de baixo têm 14 px e até duas linhas: o painel desconta essa altura. */
  .bot-painel { height: calc(100vh / var(--bot-zoom, 1) - 236px); height: calc(100dvh / var(--bot-zoom, 1) - 236px); min-height: 440px; }
  .bot-painel-topo { padding: 10px 10px 6px; }
  .bot-sub-resto { display: none; }
  /* Com a conversa aberta, o palco dá o lugar às mensagens (ele volta em "Nova conversa", para escolher com quem). */
  .bot[data-aberta] .bot-palco { display: none; }
  .bot-palco { padding: 2px 36px 6px 6px; }
  .bot-palco-agente { min-width: 76px; min-height: 64px; }
  .bot-mensagens { padding: 14px 12px; }
  .bot-msg { max-width: 100%; }
  .bot-balao { font-size: 16px; line-height: 23px; }
  .bot-balao-acoes .tok-botao, .bot-sugestao, .bot-produto, .bot-bastidores summary { min-height: 44px; }
  .bot-escrever { margin: 0 8px 8px; }
  .bot-escrever textarea { min-height: 44px; font-size: 16px; line-height: 22px; padding: 11px 0; }
  .bot-enviar { width: 44px; height: 44px; }
  .bot-comeco h3 { font-size: 20px; line-height: 26px; }
}

/* ---- computador: a tela inteira para a conversa ---------------------------------------------------------------
   22/11 (pedidos do Paulo: "aproveitar ao máximo as telas, sem muitas bordas" e "tem sobras laterais […] não precisa
   ter fundo"): a lista e o painel são uma superfície só, separadas por um fio, encostadas na lateral, no alto e nas
   bordas da janela, sem canto nem contorno. O título da casca sai da vista e o sino, o Aa, o tema e a conta ficam no
   canto de cima, à direita (hanzo.css): o cabeçalho da conversa deixa esse lugar para eles. */
@media (min-width: 900px) {
  .bot { position: relative; grid-template-columns: var(--bot-lista, 272px) minmax(0, 1fr); gap: 0;
    height: calc(100vh / var(--bot-zoom, 1)); min-height: 440px; border-radius: 0;
    background: var(--tok-surface); box-shadow: none; overflow: hidden; }
  .bot-painel-topo { min-height: 58px; padding-right: 200px; }
  .bot-lista { border-radius: 0; box-shadow: none; background: transparent; border-right: 1px solid var(--hz-fio, rgb(0 0 0 / 10%));
    padding: 10px 8px 8px; }
  .bot-painel { border-radius: 0; box-shadow: none; background: transparent; }
}
