:root {
  --vkcl-chat-accent: #0f8a83;
  --vkcl-chat-accent-dark: #0a5c73;
  --vkcl-chat-ink: #172033;
  --vkcl-chat-muted: #5d6878;
  --vkcl-chat-border: #dce5ef;
  --vkcl-chat-surface: #ffffff;
  --vkcl-chat-soft: #f4f8fb;
  --vkcl-chat-shadow: 0 22px 70px rgba(15, 30, 55, 0.22);
}

.vkcl-chatbot,
.vkcl-chatbot * {
  box-sizing: border-box;
}

.vkcl-chatbot {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  color: var(--vkcl-chat-ink);
  font-family: Arial, Helvetica, sans-serif;
}

.vkcl-chatbot__launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vkcl-chat-accent), var(--vkcl-chat-accent-dark));
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(10, 92, 115, 0.32);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.vkcl-chatbot__launcher:hover,
.vkcl-chatbot__launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 46px rgba(10, 92, 115, 0.38);
  outline: none;
}

.vkcl-chatbot__launcher svg {
  width: 28px;
  height: 28px;
}

.vkcl-chatbot__panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(390px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid rgba(220, 229, 239, 0.92);
  border-radius: 16px;
  background: var(--vkcl-chat-surface);
  box-shadow: var(--vkcl-chat-shadow);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease, transform 170ms ease;
}

.vkcl-chatbot.is-open .vkcl-chatbot__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.vkcl-chatbot.is-open .vkcl-chatbot__launcher {
  display: none;
}

.vkcl-chatbot__header {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #0f8a83, #125f92);
  color: #ffffff;
}

.vkcl-chatbot__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 800;
}

.vkcl-chatbot__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.vkcl-chatbot__status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.9;
}

.vkcl-chatbot__status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #62e3a4;
}

.vkcl-chatbot__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
}

.vkcl-chatbot__close:hover,
.vkcl-chatbot__close:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  outline: none;
}

.vkcl-chatbot__messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px 16px;
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 138, 131, 0.08), transparent 30%),
    var(--vkcl-chat-soft);
}

.vkcl-chatbot__message {
  display: grid;
  gap: 8px;
  max-width: 88%;
  animation: vkcl-chat-message 170ms ease both;
}

.vkcl-chatbot__message--bot {
  align-self: flex-start;
}

.vkcl-chatbot__message--user {
  align-self: flex-end;
}

.vkcl-chatbot__bubble {
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}

.vkcl-chatbot__message--bot .vkcl-chatbot__bubble {
  border: 1px solid var(--vkcl-chat-border);
  border-bottom-left-radius: 5px;
  background: #ffffff;
}

.vkcl-chatbot__message--user .vkcl-chatbot__bubble {
  border-bottom-right-radius: 5px;
  background: #125f92;
  color: #ffffff;
}

.vkcl-chatbot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vkcl-chatbot__action {
  min-height: 34px;
  border: 1px solid rgba(15, 138, 131, 0.24);
  border-radius: 999px;
  background: #ffffff;
  color: #0a5c73;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 11px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.vkcl-chatbot__action:hover,
.vkcl-chatbot__action:focus-visible {
  border-color: var(--vkcl-chat-accent);
  background: #eaf7f5;
  color: #074d49;
  outline: none;
}

.vkcl-chatbot__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 13px;
  border-top: 1px solid var(--vkcl-chat-border);
  background: #ffffff;
}

.vkcl-chatbot__input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--vkcl-chat-border);
  border-radius: 999px;
  color: var(--vkcl-chat-ink);
  font: inherit;
  font-size: 14px;
  padding: 0 15px;
}

.vkcl-chatbot__input:focus {
  border-color: var(--vkcl-chat-accent);
  outline: 3px solid rgba(15, 138, 131, 0.14);
}

.vkcl-chatbot__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--vkcl-chat-accent);
  color: #ffffff;
  cursor: pointer;
}

.vkcl-chatbot__send:hover,
.vkcl-chatbot__send:focus-visible {
  background: var(--vkcl-chat-accent-dark);
  outline: none;
}

.vkcl-chatbot__send svg,
.vkcl-chatbot__close svg {
  width: 18px;
  height: 18px;
}

.vkcl-chatbot__typing {
  display: inline-flex;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--vkcl-chat-border);
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: #ffffff;
}

.vkcl-chatbot__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa7b6;
  animation: vkcl-chat-typing 900ms infinite ease-in-out;
}

.vkcl-chatbot__typing span:nth-child(2) {
  animation-delay: 120ms;
}

.vkcl-chatbot__typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes vkcl-chat-message {
  from {
    transform: translateY(4px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes vkcl-chat-typing {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 520px) {
  .vkcl-chatbot {
    right: 14px;
    bottom: 14px;
  }

  .vkcl-chatbot__panel {
    right: -2px;
    bottom: 72px;
    width: calc(100vw - 24px);
    height: min(640px, calc(100vh - 96px));
    border-radius: 14px;
  }

  .vkcl-chatbot__message {
    max-width: 94%;
  }
}
