.cm-chatbot {
  --cm-chat-bg: #0a0a0a;
  --cm-chat-panel: #15171b;
  --cm-chat-panel-soft: #20232a;
  --cm-chat-text: #f3f4f6;
  --cm-chat-muted: #b7bec9;
  --cm-chat-accent: #dc2626;
  --cm-chat-accent-strong: #ef4444;
  --cm-chat-blue: #3b82f6;
  --cm-chat-border: rgba(239, 68, 68, 0.42);
  --cm-chat-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 120;
  color: var(--cm-chat-text);
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  pointer-events: none;
}

.cm-chatbot,
.cm-chatbot *,
.cm-chatbot *::before,
.cm-chatbot *::after {
  box-sizing: border-box;
}

.cm-chatbot [hidden] {
  display: none !important;
}

.cm-chatbot button,
.cm-chatbot textarea,
.cm-chatbot a {
  font: inherit;
}

.cm-chatbot button,
.cm-chatbot a,
.cm-chatbot textarea,
.cm-chatbot__panel {
  pointer-events: auto;
}

.cm-chatbot button {
  border: 0;
}

.cm-chatbot__launcher {
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  overflow: visible;
  color: var(--cm-chat-text);
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.2), rgba(10, 10, 10, 0.94) 70%);
  border: 2px solid var(--cm-chat-border);
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.cm-chatbot__launcher::after {
  position: absolute;
  inset: -5px;
  content: "";
  border: 1px solid rgba(59, 130, 246, 0.38);
  border-radius: inherit;
  pointer-events: none;
}

.cm-chatbot__launcher:hover {
  border-color: var(--cm-chat-accent-strong);
  transform: translateY(-2px);
}

.cm-chatbot__launcher-canvas {
  display: block;
  width: 82px;
  height: 82px;
}

.cm-chatbot__mascot-fallback {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(145deg, #dc2626, #3b82f6);
  border-radius: 50%;
}

.cm-chatbot__hint {
  position: absolute;
  right: 76px;
  bottom: 68px;
  display: flex;
  width: max-content;
  max-width: min(275px, calc(100vw - 118px));
  gap: 8px;
  align-items: center;
  padding: 10px 10px 10px 14px;
  color: var(--cm-chat-text);
  background: rgba(21, 23, 27, 0.98);
  border: 1px solid var(--cm-chat-border);
  border-radius: 12px;
  box-shadow: var(--cm-chat-shadow);
  pointer-events: auto;
  animation: cm-chatbot-hint-in 220ms ease-out both;
}

.cm-chatbot__hint-dismiss,
.cm-chatbot__icon-button {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--cm-chat-text);
  background: transparent;
  border-radius: 9px;
  cursor: pointer;
}

.cm-chatbot__hint-dismiss {
  flex-basis: 32px;
  width: 32px;
  height: 32px;
  font-size: 21px;
}

.cm-chatbot__panel {
  display: grid;
  width: min(370px, calc(100vw - 24px));
  height: min(500px, 76dvh);
  min-height: min(420px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  grid-template-rows: auto 72px minmax(0, 1fr) auto auto;
  overflow: hidden;
  color: var(--cm-chat-text);
  background: rgba(15, 16, 19, 0.985);
  border: 1px solid var(--cm-chat-border);
  border-radius: 18px;
  box-shadow: var(--cm-chat-shadow);
  animation: cm-chatbot-panel-in 180ms ease-out both;
}

.cm-chatbot__header {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px 16px;
  background: linear-gradient(115deg, rgba(220, 38, 38, 0.16), rgba(59, 130, 246, 0.11));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cm-chatbot__heading-group {
  min-width: 0;
}

.cm-chatbot__title,
.cm-chatbot__subtitle,
.cm-chatbot__footer,
.cm-chatbot__message-text,
.cm-chatbot__choices-label {
  margin: 0;
}

.cm-chatbot__title {
  color: var(--cm-chat-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.cm-chatbot__subtitle {
  margin-top: 2px;
  overflow: hidden;
  color: var(--cm-chat-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-chatbot__header-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
}

.cm-chatbot__icon-button {
  font-size: 21px;
  font-weight: 700;
}

.cm-chatbot__icon-button:hover,
.cm-chatbot__hint-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cm-chatbot__mascot-area {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.16), transparent 62%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cm-chatbot__panel-canvas {
  width: 96px;
  height: 96px;
}

.cm-chatbot__mascot-fallback--panel {
  width: 58px;
  height: 58px;
  font-size: 17px;
}

.cm-chatbot__messages {
  min-height: 0;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(220, 38, 38, 0.55) transparent;
}

.cm-chatbot__message {
  width: fit-content;
  max-width: 90%;
  margin: 0 0 10px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  border-radius: 13px;
}

.cm-chatbot__message--assistant {
  margin-right: auto;
  color: var(--cm-chat-text);
  background: var(--cm-chat-panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.cm-chatbot__message--user {
  margin-left: auto;
  color: #fff;
  background: #9f1d1d;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-bottom-right-radius: 4px;
}

.cm-chatbot__category {
  display: block;
  margin-bottom: 4px;
  color: #a9c7ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.cm-chatbot__message-text {
  color: inherit;
  font-size: 13px;
  line-height: 1.48;
}

.cm-chatbot__quick-questions,
.cm-chatbot__choices {
  display: grid;
  gap: 7px;
  margin: 6px 0 12px;
}

.cm-chatbot__choices {
  margin: 10px 0 0;
}

.cm-chatbot__choices-label {
  color: var(--cm-chat-muted);
  font-size: 11px;
  font-weight: 600;
}

.cm-chatbot__quick-question,
.cm-chatbot__choice {
  min-height: 44px;
  padding: 9px 11px;
  color: #dbeafe;
  text-align: left;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.38) !important;
  border-radius: 10px;
  cursor: pointer;
}

.cm-chatbot__quick-question:hover,
.cm-chatbot__choice:hover {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.78) !important;
}

.cm-chatbot__contact {
  display: inline-flex;
  min-height: 44px;
  margin-top: 10px;
  padding: 9px 13px;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  background: var(--cm-chat-accent);
  border-radius: 10px;
}

.cm-chatbot__contact:hover {
  color: #fff;
  background: var(--cm-chat-accent-strong);
}

.cm-chatbot__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 12px;
  background: var(--cm-chat-panel);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cm-chatbot__input-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cm-chatbot__input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 90px;
  padding: 10px 11px;
  resize: vertical;
  color: var(--cm-chat-text);
  background: #090a0c;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  outline: 0;
}

.cm-chatbot__input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.cm-chatbot__send {
  min-width: 70px;
  min-height: 44px;
  padding: 9px 12px;
  color: #fff;
  font-weight: 700;
  background: var(--cm-chat-accent);
  border-radius: 10px;
  cursor: pointer;
}

.cm-chatbot__send:hover:not(:disabled) {
  background: var(--cm-chat-accent-strong);
}

.cm-chatbot__send:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.cm-chatbot__footer {
  padding: 6px 12px 8px;
  color: var(--cm-chat-muted);
  font-size: 10px;
  text-align: center;
  background: var(--cm-chat-panel);
}

.cm-chatbot :is(button, a, textarea):focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.cm-chatbot__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes cm-chatbot-panel-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cm-chatbot-hint-in {
  from { opacity: 0; transform: translateX(6px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 520px) {
  .cm-chatbot__launcher {
    width: 80px;
    height: 80px;
  }

  .cm-chatbot__launcher-canvas {
    width: 74px;
    height: 74px;
  }

  .cm-chatbot__panel {
    width: calc(100vw - 24px);
    height: min(480px, 74dvh);
    min-height: min(390px, 74dvh);
    grid-template-rows: auto 62px minmax(0, 1fr) auto auto;
  }

  .cm-chatbot__panel-canvas {
    width: 82px;
    height: 82px;
  }

  .cm-chatbot__hint {
    right: 50px;
    bottom: 72px;
  }
}

@media (max-width: 340px) {
  .cm-chatbot__panel {
    width: calc(100vw - 16px);
    min-height: min(380px, 76dvh);
  }

  .cm-chatbot__header {
    padding-left: 12px;
  }

  .cm-chatbot__subtitle {
    max-width: 165px;
  }

  .cm-chatbot__form {
    gap: 6px;
    padding-inline: 8px;
  }

  .cm-chatbot__send {
    min-width: 64px;
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cm-chatbot *,
  .cm-chatbot *::before,
  .cm-chatbot *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }

  .cm-chatbot__launcher:hover {
    transform: none;
  }
}
