/* WhatsApp do Aconchego no Backoffice (09/10/2026, Julio/Yves).
 *
 * A tela é página do app (o protótipo da Bia é servido sem alteração), então
 * a base é o CSS do grupo (static/mindhub/mindhub.css, classes mh-*).
 * Aqui só entram:
 *   1. as CORES e FONTES do protótipo do Aconchego por cima dos tokens mh-*
 *      (vinho, creme e o amarelo "sol") — a tela parece o Backoffice;
 *   2. o que é só desta tela: lista de conversas, balões e a nota interna.
 * Claro/escuro segue a escolha do botão do Backoffice (aconchego-tema).
 */

body.aco-wa {
  --mh-marca: #b8211b;
  --mh-marca-forte: #8f1c17;
  --mh-marca-clara: #e86a5f;
  --mh-marca-suave: rgba(184, 33, 27, 0.12);
  --mh-fonte-titulo: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mh-fonte: "Instrument Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --aco-sol: #fbb52a;
  --aco-sol-tinta: #5a1410;
  --aco-chat: #f3e9df;
  --aco-balao-loja: #ffffff;
  --aco-balao-cliente: #fbe2dc;
  --aco-nota: #fdefcf;
  --aco-nota-borda: #e8c77a;
}

:root[data-tema="claro"] body.aco-wa {
  --mh-fundo: #faf5ef;
  --mh-superficie: #ffffff;
  --mh-elevado: #f6ece2;
  --mh-borda: #ecdcd0;
  --mh-borda-forte: #dcc6b6;
  --mh-texto: #2b1411;
  --mh-texto-suave: #6a4840;
  --mh-texto-fraco: #9a7d73;
}

:root[data-tema="escuro"] body.aco-wa {
  --mh-marca: #ee5a4f;
  --mh-marca-forte: #d24a40;
  --mh-marca-clara: #f58c83;
  --mh-marca-suave: rgba(238, 90, 79, 0.16);
  --mh-fundo: #160c0a;
  --mh-superficie: #211311;
  --mh-elevado: #2c1a17;
  --mh-borda: #382320;
  --mh-borda-forte: #4a2f2a;
  --mh-texto: #f8ece4;
  --mh-texto-suave: #d2b6ab;
  --mh-texto-fraco: #9c8178;
  --aco-sol-tinta: #4a0f0b;
  --aco-chat: #1c100e;
  --aco-balao-loja: #2c1a17;
  --aco-balao-cliente: #45201b;
  --aco-nota: #3d2c12;
  --aco-nota-borda: #6b5222;
}

.aco-voltar { font-size: var(--mh-t-sm); color: var(--mh-texto-suave); }
/* Linha de cima: voltar à esquerda, "Sair da conta" sempre à direita
   (30/11/2026, Yves: "entra com a conta e não tem como sair"). */
.aco-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.aco-sair {
  margin-left: auto; font-size: var(--mh-t-sm); font-weight: 600; color: var(--mh-texto);
  text-decoration: none; border: 1px solid var(--mh-borda); border-radius: 8px; padding: 6px 12px;
}
.aco-sair:hover { border-color: var(--mh-texto-suave); }
/* O `.mh-pagina select {width:100%}` do grupo ganha do `.mh-campo--auto`;
   na barra de filtros e no topo do "testar" o campo fica do tamanho dele. */
.aco-wa .mh-barra select,
.aco-wa .mh-barra input.mh-campo--auto { width: auto; }
.aco-faixa {
  height: 4px;
  background: linear-gradient(90deg, var(--mh-marca-forte), var(--mh-marca) 70%, var(--aco-sol));
  border-radius: var(--mh-raio-cheio);
  margin-bottom: var(--mh-e-4);
}

/* ---- Caixa: lista + conversa ------------------------------------------- */
.aco-caixa {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: var(--mh-e-4);
  align-items: start;
}
.aco-teste { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); }
@media (max-width: 860px) {
  .aco-caixa, .aco-teste { grid-template-columns: 1fr; }
}

.aco-lista { display: grid; gap: var(--mh-e-2); max-height: 70vh; overflow-y: auto; }
.aco-item {
  all: unset;
  box-sizing: border-box;
  display: grid;
  gap: 2px;
  padding: var(--mh-e-3);
  border: 1px solid var(--mh-borda);
  border-radius: var(--mh-raio);
  background: var(--mh-superficie);
  cursor: pointer;
}
.aco-item:hover { border-color: var(--mh-borda-forte); }
.aco-item:focus-visible { outline: 2px solid var(--mh-marca); outline-offset: 1px; }
.aco-item.ativa { border-color: var(--mh-marca); background: var(--mh-marca-suave); }
.aco-item-nome { font-weight: var(--mh-peso-forte); display: flex; gap: var(--mh-e-2); align-items: center; }
.aco-item-previa { font-size: var(--mh-t-sm); color: var(--mh-texto-suave);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aco-nao-lidas {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: var(--mh-raio-cheio);
  background: var(--aco-sol); color: var(--aco-sol-tinta);
  font-size: var(--mh-t-xs); font-weight: var(--mh-peso-forte); text-align: center; line-height: 20px;
}

/* ---- Chat --------------------------------------------------------------- */
.aco-chat {
  display: flex;
  flex-direction: column;
  gap: var(--mh-e-1);
  height: 56vh;
  min-height: 320px;
  overflow-y: auto;
  padding: var(--mh-e-3);
  background: var(--aco-chat);
  border: 1px solid var(--mh-borda);
  border-radius: var(--mh-raio);
}
.aco-msg {
  max-width: 82%;
  padding: 6px 10px 7px;
  border-radius: var(--mh-raio-sm);
  box-shadow: var(--mh-sombra-sm);
  font-size: var(--mh-t-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
/* Caixa do atendente: o cliente à esquerda, a casa à direita. */
.aco-msg--cliente { align-self: flex-start; background: var(--aco-balao-loja); }
.aco-msg--loja { align-self: flex-end; background: var(--aco-balao-cliente); }
/* No celular do "testar o bot" é o contrário: quem escreve é o cliente. */
.aco-chat--celular .aco-msg--cliente { align-self: flex-end; background: var(--aco-balao-cliente); }
.aco-chat--celular .aco-msg--loja { align-self: flex-start; background: var(--aco-balao-loja); }
.aco-msg-quem { display: block; font-size: var(--mh-t-xs); font-weight: var(--mh-peso-forte);
  color: var(--mh-texto-suave); margin-bottom: 2px; white-space: normal; }
.aco-msg-quem--equipe { color: var(--mh-marca); }
.aco-msg-hora { display: block; text-align: right; font-size: 11px; color: var(--mh-texto-fraco);
  margin-top: 2px; white-space: normal; }
.aco-msg-falhou { color: var(--mh-erro-fg); }
.aco-sistema {
  align-self: center;
  margin: var(--mh-e-1) 0;
  padding: 3px 10px;
  border-radius: var(--mh-raio-sm);
  background: var(--aco-nota);
  color: var(--mh-texto-suave);
  font-size: var(--mh-t-xs);
  text-align: center;
}
.aco-digitando { align-self: flex-start; font-style: italic; color: var(--mh-texto-suave);
  font-size: var(--mh-t-sm); }

.aco-celular-topo {
  display: flex; align-items: center; gap: var(--mh-e-2);
  padding: var(--mh-e-2) var(--mh-e-3);
  background: var(--mh-marca-forte); color: #fff6ec;
  border-radius: var(--mh-raio) var(--mh-raio) 0 0;
}
.aco-celular-topo + .aco-chat { border-radius: 0 0 var(--mh-raio) var(--mh-raio); border-top: 0; }
.aco-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--aco-sol); color: var(--aco-sol-tinta); font-weight: var(--mh-peso-forte);
}

.aco-nota {
  background: var(--aco-nota);
  border: 1px solid var(--aco-nota-borda);
  border-radius: var(--mh-raio);
  padding: var(--mh-e-3);
  font-size: var(--mh-t-sm);
  display: grid;
  gap: var(--mh-e-1);
}
.aco-escrever { display: grid; gap: var(--mh-e-2); margin-top: var(--mh-e-3); }
.aco-escrever .mh-linha { flex-wrap: nowrap; }
.aco-escrever .aco-cresce { flex: 1 1 auto; min-width: 0; width: auto; }
.aco-roteiros { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--mh-e-2); }
.aco-roteiros .mh-btn { justify-content: flex-start; white-space: normal; text-align: left; }
.aco-alerta { color: var(--mh-erro-fg); font-size: var(--mh-t-sm); }

/* ---- Conteúdo: formulários em lista ------------------------------------ */
.aco-bloco { display: grid; gap: var(--mh-e-3); }
.aco-linha-form {
  display: grid;
  gap: var(--mh-e-2);
  padding: var(--mh-e-3);
  border: 1px solid var(--mh-borda);
  border-radius: var(--mh-raio);
  background: var(--mh-superficie);
}
.aco-linha-form .errorlist, .aco-bloco > .errorlist { color: var(--mh-erro-fg); margin: 0; padding-left: 18px;
  font-size: var(--mh-t-sm); }
/* Uma pergunta frequente por linha: pergunta | resposta | ordem | ativa | apagar. */
.aco-linha-faq { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 80px auto auto; align-items: start; }
.aco-linha-faq .helptext { display: none; }
@media (max-width: 860px) { .aco-linha-faq { grid-template-columns: 1fr; } }
.aco-campos-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--mh-e-2); }
.aco-salvar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: var(--mh-e-2);
  padding: var(--mh-e-3) 0;
  background: var(--mh-fundo);
}
.aco-lista-simples { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.aco-codigo {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: var(--mh-t-sm);
  background: var(--mh-elevado);
  padding: 2px 6px;
  border-radius: var(--mh-raio-sm);
  overflow-wrap: anywhere;
}

/* ---- Reservas pelo robô (19/11/2026, Bia) ------------------------------- */
.aco-dias { display: flex; gap: var(--mh-e-2); overflow-x: auto; padding-bottom: var(--mh-e-2);
  margin-bottom: var(--mh-e-4); scroll-snap-type: x proximity; }
.aco-dia { flex: 0 0 auto; display: grid; gap: 2px; min-width: 104px; padding: var(--mh-e-2) var(--mh-e-3);
  border: 1px solid var(--mh-borda); border-radius: var(--mh-raio); background: var(--mh-superficie);
  color: inherit; text-decoration: none; scroll-snap-align: start; }
.aco-dia:hover { text-decoration: none; background: var(--mh-elevado); }
.aco-dia.ativo { border-color: var(--mh-marca, currentColor); box-shadow: inset 0 0 0 1px var(--mh-marca, currentColor); }
.aco-dia-nome { font-size: var(--mh-t-sm); color: var(--mh-texto-suave); }
.aco-dia strong { font-size: 1.25rem; }
.aco-reservas { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--mh-e-2); }
.aco-reserva { display: grid; gap: var(--mh-e-2); padding: var(--mh-e-3); border: 1px solid var(--mh-borda);
  border-radius: var(--mh-raio); background: var(--mh-superficie); }
.aco-reserva-topo { display: flex; align-items: center; gap: var(--mh-e-2); flex-wrap: wrap; }
.aco-reserva form { margin: 0; }
.aco-reserva-topo .aco-cresce { flex: 1 1 auto; min-width: 0; }
