/* Widget do chat. Prefixo cw- para não colidir com o site. */
.cw-abrir {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--destaque, #8a5a2b);
  color: #fff;
  font: 600 15px/1 system-ui, sans-serif;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
  cursor: pointer;
}
.cw-abrir[hidden] {
  display: none;
}

.cw-painel {
  position: fixed;
  z-index: 60;
  right: 16px;
  bottom: 16px;
  width: min(400px, calc(100vw - 32px));
  height: min(640px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  background: var(--superficie, #fff);
  border: 1px solid var(--borda, #e7e3dc);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.22);
  overflow: hidden;
  font: 15px/1.45 system-ui, sans-serif;
  color: var(--texto, #1f1d1a);
}
.cw-painel[hidden] {
  display: none;
}
@media (max-width: 480px) {
  .cw-painel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
}
/* Tela larga: coluna fixa à direita, ao lado da página (que ganha margem em global.css) */
@media (min-width: 1200px) {
  .cw-painel {
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--chat-doca, 400px);
    height: auto;
    border-width: 0 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }
}

.cw-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--destaque, #8a5a2b);
  color: #fff;
}
.cw-topo div {
  display: flex;
  flex-direction: column;
}
.cw-topo small {
  opacity: 0.85;
}
.cw-fechar {
  border: 0;
  background: none;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.cw-lista {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--fundo, #fbfaf8);
}

.cw-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
}
.cw-msg p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cw-msg--cliente {
  align-self: flex-end;
  background: var(--destaque, #8a5a2b);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cw-msg--assistente {
  align-self: flex-start;
  background: var(--superficie, #fff);
  border: 1px solid var(--borda, #e7e3dc);
  border-bottom-left-radius: 4px;
}
.cw-msg__foto {
  max-width: 180px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.cw-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.cw-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--borda, #e7e3dc);
  border-radius: 10px;
  background: var(--fundo, #fbfaf8);
  color: inherit;
  text-decoration: none;
}
.cw-card img,
.cw-card__sem-foto {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  background: #f1eee9;
}
.cw-card__sem-foto {
  background: #f1eee9 url(../sem-foto.svg) center / cover no-repeat;
}
.cw-card__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cw-card__nome {
  font-size: 13px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cw-card__preco {
  font-weight: 700;
}
.cw-card__disp {
  font-size: 12px;
  color: var(--ok, #2f7a4a);
}
.cw-card__disp.cw-esgotado {
  color: var(--alerta, #a23b2a);
}

.cw-whatsapp {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--whatsapp, #1f9e55);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.cw-digitando {
  display: flex;
  gap: 4px;
  padding: 14px;
}
.cw-digitando span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mudo, #6b665e);
  animation: cw-pulo 1s infinite ease-in-out;
}
.cw-digitando span:nth-child(2) {
  animation-delay: 0.15s;
}
.cw-digitando span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes cw-pulo {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .cw-digitando span {
    animation: none;
  }
}

.cw-previa {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
}
.cw-previa[hidden] {
  display: none;
}
.cw-previa img {
  height: 56px;
  border-radius: 8px;
}

.cw-form {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--borda, #e7e3dc);
}
.cw-campo {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--borda, #e7e3dc);
  border-radius: 18px;
  font: inherit;
  background: var(--fundo, #fbfaf8);
  color: inherit;
}
.cw-icone,
.cw-enviar {
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 18px;
  cursor: pointer;
}
.cw-enviar {
  background: var(--destaque, #8a5a2b);
  color: #fff;
}
.cw-enviar:disabled {
  opacity: 0.5;
}

.cw-aviso {
  margin: 0;
  padding: 0 12px 10px;
  font-size: 11px;
  color: var(--mudo, #6b665e);
}
.cw-aviso a {
  color: var(--whatsapp, #1f9e55);
  font-weight: 600;
}
