/* Пара к кнопке #top: та же палитра и вес, «наверх» уезжает влево. */
body.has-bot-widget #top {
  right: 84px;
  bottom: 20px;
}

.bot-widget {
  --bw-navy: #1e3468;
  --bw-cyan: #0787bf;
  --bw-bar: #96b9ed;
  --bw-bg: #fff;
  --bw-page: #f3f3f3;
  --bw-text: #222229;
  --bw-muted: #6c757d;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  font-family: "Regular", sans-serif;
  color: var(--bw-text);
}

.bot-widget-toggle {
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50px;
  background: var(--bw-navy);
  color: #fff;
  opacity: 0.9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease 0s;
}

.bot-widget-toggle:hover,
.bot-widget-toggle:focus {
  background: var(--bw-cyan);
  opacity: 1;
  outline: none;
}

.bot-widget-toggle i {
  font-size: 20px;
}

.bot-widget-panel {
  display: none;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 40px));
  background: var(--bw-bg);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.bot-widget.is-open .bot-widget-panel {
  display: flex;
}

.bot-widget.is-open .bot-widget-toggle {
  display: none;
}

.bot-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  background: var(--bw-navy);
  color: #fff;
}

.bot-widget-title {
  font-family: "Bold", sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bot-widget-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bot-widget-header button {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: "Regular", sans-serif;
  font-size: 12px;
  padding: 4px 6px;
  transition: background 0.3s ease 0s;
}

.bot-widget-header button:hover,
.bot-widget-header button:focus {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.bot-widget-accent {
  height: 3px;
  background: var(--bw-bar);
}

.bot-widget-tape {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bw-page);
}

.bot-widget-msg {
  max-width: 90%;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.bot-widget-msg a {
  color: var(--bw-cyan);
}

.bot-widget-msg a:hover {
  color: var(--bw-navy);
}

.bot-widget-msg--visitor {
  align-self: flex-end;
  background: var(--bw-navy);
  color: #fff;
}

.bot-widget-msg--visitor a {
  color: #cfefff;
}

.bot-widget-msg--bot {
  align-self: flex-start;
  background: #fff;
  border-left: 3px solid var(--bw-navy);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.06);
}

.bot-widget-msg--system {
  align-self: stretch;
  max-width: 100%;
  background: #fff8eb;
  border-left: 3px solid #c9a227;
  color: #5c4400;
  font-size: 13px;
}

.bot-widget-msg--wait {
  align-self: flex-start;
  background: #fff;
  color: var(--bw-muted);
  font-style: italic;
  border-left: 3px solid var(--bw-bar);
}

.bot-widget-retry {
  display: inline-block;
  margin-top: 8px;
  border: 0;
  background: var(--bw-navy);
  color: #fff;
  padding: 6px 12px;
  cursor: pointer;
  font-family: "Bold", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  transition: background 0.3s ease 0s;
}

.bot-widget-retry:hover,
.bot-widget-retry:focus {
  background: var(--bw-cyan);
  outline: none;
}

.bot-widget-footer {
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid #e6e8eb;
}

.bot-widget-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.bot-widget-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  border: 1px solid #ced4da;
  border-radius: 0;
  padding: 8px 10px;
  font-family: "Regular", sans-serif;
  font-size: 14px;
  line-height: 1.35;
  color: var(--bw-text);
}

.bot-widget-input:focus {
  border-color: var(--bw-cyan);
  outline: none;
}

.bot-widget-send {
  border: 0;
  border-radius: 0;
  background: var(--bw-navy);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-family: "Bold", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  transition: background 0.3s ease 0s;
}

.bot-widget-send:hover,
.bot-widget-send:focus {
  background: var(--bw-cyan);
  outline: none;
}

.bot-widget-legal {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--bw-muted);
}

.bot-widget-legal a {
  color: var(--bw-navy);
}

.bot-widget-legal a:hover {
  color: var(--bw-cyan);
}

.bot-widget-recaptcha {
  margin-top: 6px;
}

/* Бейдж v3 пересекается с кнопкой чата. Скрывать можно, если есть текст Google в футере. */
body.has-bot-widget .grecaptcha-badge {
  visibility: hidden;
}

@media (max-width: 767.98px) {
  body.has-bot-widget #top {
    right: 20px;
    bottom: 84px;
  }

  .bot-widget {
    right: 0;
    bottom: 0;
  }

  .bot-widget.is-open {
    inset: 0;
  }

  .bot-widget.is-open .bot-widget-panel {
    width: 100%;
    height: 100%;
  }

  .bot-widget:not(.is-open) {
    right: 16px;
    bottom: 16px;
  }
}
