.twl {
  --twl-verde: #075e54;
  --twl-verde-esc: #054d44;
  --twl-campo: #e6fde6;
  --twl-fundo: #ece5dd;
  --twl-texto: #1f2a28;
  --twl-erro: #b3261e;
  --twl-mx: 20px;   /* margem horizontal (vem das configurações) */
  --twl-my: 20px;   /* margem vertical */
  --twl-size: 72px; /* tamanho do botão */
  --twl-gap: calc(var(--twl-size) + 8px);  /* botão + espaço até a caixa */
  position: fixed;
  width: var(--twl-size); height: var(--twl-size);
  z-index: 99999;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  color: var(--twl-texto);
}
.twl *, .twl *::before, .twl *::after { box-sizing: border-box; }

.twl-fab {
  width: var(--twl-size); height: var(--twl-size); border-radius: 50%;
  border: 0; cursor: pointer;
  background: #25d366; color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(7, 94, 84, .35);
  transition: transform .15s ease;
}
.twl-fab:hover { transform: scale(1.06); }
.twl-fab svg { width: 32px; height: 32px; }

.twl-box {
  position: fixed;
  width: min(380px, calc(100vw - 2 * var(--twl-mx)));
  max-height: calc(100vh - var(--twl-my) - var(--twl-gap) - 16px);
  display: flex; flex-direction: column;
  border-radius: 10px; overflow: hidden;
  background: var(--twl-fundo);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  animation: twl-in .18s ease-out;
}
.twl-box[hidden] { display: none; }
@keyframes twl-in { from { opacity: 0; } to { opacity: 1; } }

.twl-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--twl-verde); color: #fff;
}
.twl-head strong { display: block; font-size: 17px; line-height: 1.2; }
.twl-head small { opacity: .85; font-size: 13px; }
.twl-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #c0392b; color: #fff; font-size: 18px;
}
.twl-avatar-img { background: #fff; overflow: hidden; }
.twl-avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.twl-close {
  margin-left: auto; background: none; border: 0; color: #fff;
  font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px;
}

.twl-body {
  padding: 14px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.twl-bubble {
  background: #fff; border-radius: 8px; padding: 10px 12px;
  margin-bottom: 4px; line-height: 1.4; max-width: 90%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.twl-body input, .twl-body textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid transparent; border-radius: 6px;
  background: var(--twl-campo); color: var(--twl-texto);
  font: inherit;
}
.twl-body textarea { resize: vertical; min-height: 90px; }
.twl-body input:focus, .twl-body textarea:focus {
  outline: none; border-color: var(--twl-verde); box-shadow: 0 0 0 2px rgba(7, 94, 84, .2);
}
.twl .iti { width: 100%; }
.twl .iti__country-list { z-index: 100000; }

.twl-hp { position: absolute !important; left: -9999px !important; opacity: 0; height: 0; }
.twl-erro { color: var(--twl-erro); font-size: 13px; margin: 0; min-height: 0; }
.twl-erro:empty { display: none; }
.twl-lgpd { font-size: 12px; margin: 0; opacity: .8; line-height: 1.4; }
.twl-lgpd a { color: var(--twl-verde); }

.twl-send {
  align-self: flex-end; border: 0; cursor: pointer;
  background: var(--twl-verde); color: #fff;
  padding: 10px 18px; border-radius: 6px; font: inherit; font-weight: 600;
}
.twl-send:hover { background: var(--twl-verde-esc); }
.twl-send:focus-visible, .twl-fab:focus-visible, .twl-close:focus-visible {
  outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--twl-verde);
}

@media (prefers-reduced-motion: reduce) {
  .twl-box { animation: none; }
  .twl-fab { transition: none; }
}

/* ---------------------------------------------------------------
 * Blindagem contra estilos do tema/Elementor (botões e campos globais)
 * ------------------------------------------------------------- */
.twl button.twl-fab,
.twl button.twl-close,
.twl button.twl-send {
  border: 0 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  box-shadow: none;
  margin: 0;
}
.twl button.twl-fab {
  width: var(--twl-size) !important; height: var(--twl-size) !important; padding: 0 !important;
  border-radius: 50% !important;
  background: #25d366 !important; color: #fff !important;
  box-shadow: 0 6px 18px rgba(7, 94, 84, .35);
}
.twl button.twl-close {
  width: 32px !important; height: 32px !important; padding: 4px !important;
  margin-left: auto !important;
  background: transparent !important; color: #fff !important;
  border-radius: 50% !important;
  display: grid !important; place-items: center;
}
.twl button.twl-close svg { width: 22px; height: 22px; display: block; }
.twl button.twl-close:hover { background: rgba(255, 255, 255, .15) !important; }
.twl button.twl-send {
  padding: 10px 18px !important;
  border-radius: 6px !important;
  background: var(--twl-verde) !important; color: #fff !important;
  font-family: inherit !important; font-size: 15px !important; font-weight: 600 !important;
  line-height: 1.3 !important;
}
.twl button.twl-send:hover, .twl button.twl-send:focus { background: var(--twl-verde-esc) !important; color: #fff !important; }
.twl .twl-body input, .twl .twl-body textarea {
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  background: var(--twl-campo) !important;
  color: var(--twl-texto) !important;
  box-shadow: none !important;
}
.twl .twl-body input:focus, .twl .twl-body textarea:focus {
  border-color: var(--twl-verde) !important;
  box-shadow: 0 0 0 2px rgba(7, 94, 84, .2) !important;
}

/* Ícone personalizado no botão flutuante: a imagem é o botão */
.twl button.twl-fab.twl-fab-img { background: transparent !important; overflow: hidden; }
.twl button.twl-fab.twl-fab-img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* ---------------------------------------------------------------
 * Posicionamento (classes vindas das configurações)
 * Sem transform no .twl, para a caixa (position: fixed) usar a tela como referência.
 * ------------------------------------------------------------- */
/* Botão: horizontal */
.twl.twl-h-left   { left: var(--twl-mx); }
.twl.twl-h-right  { right: var(--twl-mx); }
.twl.twl-h-center { left: 0; right: 0; margin-left: auto; margin-right: auto; }
/* Botão: vertical */
.twl.twl-v-bottom { bottom: calc(var(--twl-my) + env(safe-area-inset-bottom, 0px)); }
.twl.twl-v-top    { top: calc(var(--twl-my) + env(safe-area-inset-top, 0px)); }
.twl.twl-v-middle { top: 0; bottom: 0; margin-top: auto; margin-bottom: auto; }

/* Caixa: vertical — abre acima (fundo), abaixo (topo) ou centralizada (meio) */
.twl-v-bottom .twl-box { bottom: calc(var(--twl-my) + var(--twl-gap) + env(safe-area-inset-bottom, 0px)); }
.twl-v-top .twl-box    { top: calc(var(--twl-my) + var(--twl-gap) + env(safe-area-inset-top, 0px)); }
.twl-v-middle .twl-box { top: 0; bottom: 0; margin-top: auto; margin-bottom: auto; height: fit-content; max-height: calc(100vh - 32px); }

/* Caixa: horizontal — alinha com a mesma margem do botão */
.twl-h-left .twl-box   { left: var(--twl-mx); }
.twl-h-right .twl-box  { right: var(--twl-mx); }
.twl-h-center .twl-box { left: 0; right: 0; margin-left: auto; margin-right: auto; }
/* No meio da tela e de lado: a caixa abre ao lado do botão */
.twl-v-middle.twl-h-left .twl-box  { left: calc(var(--twl-mx) + var(--twl-gap)); }
.twl-v-middle.twl-h-right .twl-box { right: calc(var(--twl-mx) + var(--twl-gap)); }

/* Celular: caixa ocupa a largura útil */
@media (max-width: 480px) {
  .twl .twl-box { left: 12px; right: 12px; width: auto; margin-left: 0; margin-right: 0; }
}
