.chatbot-fab {
  position: fixed;
  right: 24px;
  bottom: 146px;
  z-index: 45;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: var(--white);
  box-shadow: 0 12px 30px rgba(0, 63, 67, .28);
  cursor: pointer;
  font-size: 22px;
}

.chatbot-panel {
  position: fixed;
  right: 24px;
  bottom: 212px;
  z-index: 46;
  width: min(390px, calc(100vw - 32px));
  max-height: min(650px, calc(100dvh - 110px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 22px 60px rgba(0, 42, 48, .2);
}

.chatbot-panel.is-positioned {
  right: auto;
  bottom: auto;
  transform: none;
}

.chatbot-panel[hidden],
.chatbot-compose[hidden],
.chatbot-contact-form[hidden],
.chatbot-fab[hidden] {
  display: none;
}

.chatbot-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--brand);
  color: var(--white);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.chatbot-panel.is-dragging .chatbot-panel__header {
  cursor: grabbing;
}

.chatbot-panel__header div,
.chatbot-panel__header span {
  display: block;
}

.chatbot-panel__header span {
  font-size: 12px;
  opacity: .82;
}

.chatbot-panel__close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 26px;
  cursor: pointer;
  touch-action: manipulation;
}

.chatbot-messages {
  min-height: 210px;
  padding: 16px;
  overflow-y: auto;
  background: var(--soft);
}

.chatbot-msg {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 10px;
  padding: 9px 11px;
  border-radius: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.chatbot-msg--bot,
.chatbot-msg--typing {
  border: 1px solid var(--line);
  background: var(--white);
}

.chatbot-msg--user {
  margin-left: auto;
  background: var(--brand);
  color: var(--white);
}

.chatbot-msg--typing {
  color: var(--muted);
  font-style: italic;
}

.chatbot-msg a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chatbot-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.chatbot-compose textarea,
.chatbot-contact-form input,
.chatbot-contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  resize: vertical;
}

.chatbot-compose button,
.chatbot-contact-form button {
  border: 0;
  border-radius: 7px;
  padding: 9px 13px;
  background: var(--brand);
  color: var(--white);
  font-weight: 750;
  cursor: pointer;
}

.chatbot-compose button:disabled,
.chatbot-contact-form button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.chatbot-contact-form {
  padding: 14px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: var(--white);
}

.chatbot-contact-form p {
  margin: 0 0 10px;
  font-size: 14px;
}

.chatbot-contact-form label {
  display: block;
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.chatbot-contact-form label span {
  color: var(--muted);
  font-weight: 400;
}

.chatbot-contact-form input,
.chatbot-contact-form textarea {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 400;
}

.chatbot-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.chatbot-form-status {
  min-height: 22px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 13px;
}

@media (max-width: 1024px) {
  .chatbot-panel {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(390px, calc(100vw - 24px));
    max-height: min(650px, calc(100dvh - 24px));
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 680px) {
  .chatbot-fab {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(96px, calc(76px + env(safe-area-inset-bottom)));
  }

  .chatbot-panel,
  .chatbot-panel.is-positioned {
    top: var(--chatbot-vv-top, 0);
    left: var(--chatbot-vv-left, 0);
    right: auto;
    bottom: auto;
    width: var(--chatbot-vv-width, 100vw);
    height: var(--chatbot-vv-height, 100dvh);
    max-height: none;
    border: 0;
    border-radius: 0;
    transform: none;
  }

  .chatbot-panel__header {
    flex: 0 0 auto;
    padding-top: max(14px, env(safe-area-inset-top));
    cursor: default;
    touch-action: auto;
  }

  .chatbot-messages {
    min-height: 0;
    flex: 1 1 auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .chatbot-compose {
    flex: 0 0 auto;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .chatbot-compose textarea,
  .chatbot-contact-form input,
  .chatbot-contact-form textarea {
    font-size: 16px;
  }
}
