/* Онлайн-консультант */
.chatbot {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 990;
  font-family: 'Inter', sans-serif;
  color: #001233;
}

.chatbot__open {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  background: #1E4995;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 18, 51, .2);
  cursor: pointer;
  transition: .2s background;
}

.chatbot__open:hover {
  background: #DF7A30;
}

.chatbot__window {
  display: none;
  width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 18, 51, .18);
  overflow: hidden;
}

.chatbot--open .chatbot__open {
  display: none;
}

.chatbot--open .chatbot__window {
  display: block;
}

/* Образец аватара для сообщений бота, сам по себе не показывается */
.chatbot > .chatbot__avatar {
  display: none;
}

.chatbot__head {
  position: relative;
  padding: 16px 80px 14px 20px;
  border-bottom: 1px solid #E9EDF5;
}

.chatbot__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.chatbot__subtitle {
  font-size: 13px;
  line-height: 18px;
  color: #5A5C7E;
}

.chatbot__hide,
.chatbot__close {
  position: absolute;
  top: 16px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  color: #001233;
  cursor: pointer;
}

.chatbot__hide {
  right: 48px;
}

.chatbot__hide::before {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 13px;
  height: 2px;
  background: currentColor;
}

.chatbot__close {
  right: 14px;
  font-size: 28px;
  line-height: 28px;
}

.chatbot__hide:hover,
.chatbot__close:hover {
  color: #DF7A30;
}

/* Высота по содержимому: окно растёт с перепиской и дальше прокручивается */
.chatbot__history {
  max-height: min(480px, calc(100vh - 160px));
  overflow-y: auto;
  padding: 16px 16px 8px;
  background: #F6F8FB;
}

.chatbot__msg {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.chatbot__msg--user {
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.chatbot__avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #1E4995;
  color: #fff;
}

.chatbot__msg-body {
  flex: 1;
  min-width: 0;
}

.chatbot__bubble {
  padding: 12px 14px;
  border-radius: 4px 12px 12px 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 18, 51, .06);
  font-size: 14px;
  line-height: 20px;
}

.chatbot__msg--user .chatbot__bubble {
  max-width: 80%;
  border-radius: 12px 4px 12px 12px;
  background: #1E4995;
  color: #fff;
}

.chatbot__time {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #9A9BBE;
}

.chatbot__text {
  margin: 0 0 8px;
}

.chatbot__text:last-child {
  margin-bottom: 0;
}

.chatbot__text a,
.chatbot__agree a {
  color: #1E4995;
  text-decoration: underline;
}

.chatbot__list {
  margin: 0 0 8px;
  padding-left: 18px;
  list-style: disc;
}

.chatbot__note {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #FCEBDD;
}

.chatbot__choice,
.chatbot__menu-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid #C9D3E6;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #1E4995;
  cursor: pointer;
  transition: .2s background, .2s color;
}

.chatbot__choice:hover,
.chatbot__menu-btn:hover {
  border-color: #1E4995;
  background: #1E4995;
  color: #fff;
}

.chatbot__form {
  margin-top: 10px;
}

.chatbot__input {
  display: block;
  width: 100%;
  height: 40px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 1px solid #C8CADB;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: #001233;
}

.chatbot__input:focus {
  outline: none;
  border-color: #1E4995;
}

.chatbot__textarea {
  height: 72px;
  padding: 8px 12px;
  resize: vertical;
}

.chatbot__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.chatbot__submit {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 8px;
  background: #DF7A30;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: .2s background;
}

.chatbot__submit:hover {
  background: #FF994F;
}

.chatbot__submit:disabled {
  opacity: .7;
  cursor: default;
}

.chatbot__agree {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: #5A5C7E;
}

.chatbot__error {
  margin-top: 6px;
  font-size: 13px;
  color: #DF7A30;
}

.chatbot__error:empty {
  display: none;
}

/* На телефоне окно на весь экран, кнопка выше нижней панели браузера */
@media (max-width: 768px) {
  .chatbot {
    right: 12px;
    bottom: 80px;
  }

  .chatbot--open {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10000;
  }

  .chatbot__window {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chatbot__history {
    height: calc(100% - 75px);
    max-height: none;
  }
}
