.capacita-custom-chat {
  position: fixed;
  right: 22px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  z-index: 2147483010;
  width: auto;
  display: grid;
  justify-items: end;
  color: #24141a;
  font-family: var(--font-body, "Trebuchet MS", sans-serif);
  pointer-events: none;
}

.capacita-custom-chat * {
  box-sizing: border-box;
}

.capacita-custom-chat__launcher {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: #006b5f;
  color: #fff;
  box-shadow: 0 18px 42px rgba(0, 107, 95, 0.32);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.capacita-custom-chat__launcher:hover {
  background: #007f70;
  box-shadow: 0 22px 52px rgba(0, 107, 95, 0.38);
  transform: translateY(-2px);
}

.capacita-custom-chat__launcher:focus-visible {
  outline: 3px solid rgba(250, 203, 75, 0.72);
  outline-offset: 4px;
}

body.has-whatsapp-float .capacita-custom-chat {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
}

body.has-mobile-cta.has-whatsapp-float .capacita-custom-chat {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 164px);
}

.capacita-custom-chat__mark {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.capacita-custom-chat__mark svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.capacita-custom-chat__panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(430px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(143, 33, 72, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(36, 20, 26, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.capacita-custom-chat.is-open .capacita-custom-chat__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.capacita-custom-chat.is-open .capacita-custom-chat__launcher {
  opacity: 0;
  pointer-events: none;
}

.capacita-custom-chat__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 12px;
  padding: 18px;
  background: #f7eee4;
  border-bottom: 1px solid rgba(143, 33, 72, 0.12);
}

.capacita-custom-chat__header h2,
.capacita-custom-chat__header p {
  margin: 0;
}

.capacita-custom-chat__header h2 {
  margin-top: 5px;
  color: #24141a;
  font-size: 1.1rem;
  line-height: 1.15;
}

.capacita-custom-chat__header p {
  margin-top: 5px;
  color: #66555c;
  font-size: 0.9rem;
  line-height: 1.35;
}

.capacita-custom-chat__close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(36, 20, 26, 0.12);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.capacita-custom-chat__messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 15px;
  overflow: auto;
  background: #fffdfa;
}

.capacita-custom-chat__message {
  max-width: 86%;
  display: grid;
  gap: 4px;
}

.capacita-custom-chat__message small {
  color: #7c6b72;
  font-size: 0.74rem;
}

.capacita-custom-chat__message p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.36;
}

.capacita-custom-chat__message.is-agent p {
  background: #f7eee4;
  color: #24141a;
}

.capacita-custom-chat__message.is-visitor {
  justify-self: end;
}

.capacita-custom-chat__message.is-visitor small {
  text-align: right;
}

.capacita-custom-chat__message.is-visitor p {
  background: #8f2148;
  color: #fff;
}

.capacita-custom-chat__form {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(143, 33, 72, 0.12);
  background: #fff;
}

.capacita-custom-chat__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.capacita-custom-chat__contact-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.capacita-custom-chat:not(.is-after-hours) .capacita-custom-chat__contact-fields {
  display: none;
}

.capacita-custom-chat__field {
  display: grid;
  gap: 4px;
}

.capacita-custom-chat__field label {
  color: #66555c;
  font-size: 0.78rem;
  font-weight: 800;
}

.capacita-custom-chat__form input,
.capacita-custom-chat__form textarea {
  width: 100%;
  border: 1px solid rgba(36, 20, 26, 0.16);
  border-radius: 8px;
  padding: 10px;
  color: #24141a;
  font: inherit;
}

.capacita-custom-chat__form textarea {
  min-height: 74px;
  resize: vertical;
}

.capacita-custom-chat__form button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #006b5f;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.capacita-custom-chat__form.is-sending button {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 720px) {
  .capacita-custom-chat {
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    left: 10px;
    width: auto;
  }

  body.has-whatsapp-float .capacita-custom-chat {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  }

  body.has-mobile-cta.has-whatsapp-float .capacita-custom-chat {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 156px);
  }

  .capacita-custom-chat__panel {
    position: fixed;
    inset: calc(env(safe-area-inset-top, 0px) + 10px) 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
    width: auto;
    max-height: none;
  }

  .capacita-custom-chat__contact-fields {
    grid-template-columns: 1fr;
  }
}
