.rg-site-chat,
.rg-site-chat * {
  box-sizing: border-box;
}

.rg-site-chat {
  bottom: 24px;
  font-family: Arial, sans-serif;
  position: fixed;
  right: 24px;
  z-index: 700;
}

.rg-site-chat__toggle {
  align-items: center;
  background: #ec482f;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(236, 72, 47, .32);
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 0;
  font-weight: 700;
  height: 46px;
  justify-content: center;
  min-width: 46px;
  padding: 0;
  position: relative;
  width: 46px;
}

.rg-site-chat__toggle::before {
  background-color: #fff;
  background-image:
    radial-gradient(circle at 7px 8px, #ec482f 0 1.5px, transparent 1.7px),
    radial-gradient(circle at 12px 8px, #ec482f 0 1.5px, transparent 1.7px),
    radial-gradient(circle at 17px 8px, #ec482f 0 1.5px, transparent 1.7px);
  border: 0;
  border-radius: 7px;
  content: '';
  height: 16px;
  position: absolute;
  width: 24px;
}

.rg-site-chat__toggle::after {
  border-right: 7px solid transparent;
  border-top: 7px solid #fff;
  bottom: 10px;
  content: '';
  height: 0;
  left: 12px;
  position: absolute;
  transform: rotate(8deg);
  width: 0;
}

.rg-site-chat__toggle:focus,
.rg-site-chat__close:focus,
.rg-site-chat__send:focus,
.rg-site-chat__input:focus {
  outline: 3px solid rgba(236, 72, 47, .28);
  outline-offset: 2px;
}

.rg-site-chat__panel {
  background: #fff;
  border: 2px solid #ec482f;
  border-radius: 18px;
  bottom: 58px;
  box-shadow: 0 20px 56px rgba(236, 72, 47, .2);
  display: none;
  height: min(560px, calc(100vh - 120px));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: 360px;
}

.rg-site-chat--open .rg-site-chat__panel {
  display: flex;
  flex-direction: column;
}

.rg-site-chat__header {
  align-items: center;
  background: #ec482f;
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px 14px 12px 18px;
}

.rg-site-chat__header strong,
.rg-site-chat__header span {
  display: block;
}

.rg-site-chat__header strong {
  font-size: 17px;
}

.rg-site-chat__header span {
  font-size: 12px;
  margin-top: 3px;
  opacity: .88;
}

.rg-site-chat__close {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  height: 40px;
  line-height: 36px;
  width: 40px;
}

.rg-site-chat__messages {
  background: #fff5f5;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.rg-site-chat__welcome,
.rg-site-chat__message {
  background: #fff;
  border-radius: 13px 13px 13px 3px;
  box-shadow: 0 1px 3px rgba(18, 23, 31, .08);
  color: #282c32;
  font-size: 14px;
  line-height: 1.42;
  margin: 0 0 10px;
  max-width: 86%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.rg-site-chat__message--visitor {
  background: #ffe5e6;
  border-radius: 13px 13px 3px 13px;
  margin-left: auto;
}

.rg-site-chat__time {
  color: #858b94;
  display: block;
  font-size: 10px;
  margin-top: 4px;
  text-align: right;
}

.rg-site-chat__status {
  color: #6f7680;
  font-size: 12px;
  min-height: 18px;
  padding: 4px 14px 0;
}

.rg-site-chat__status--error {
  color: #ad1016;
}

.rg-site-chat__form {
  align-items: flex-end;
  background: #fff;
  border-top: 1px solid rgba(236, 72, 47, .24);
  display: flex;
  gap: 8px;
  padding: 10px;
}

.rg-site-chat__input {
  border: 1px solid #d7dbe0;
  border-radius: 12px;
  flex: 1;
  font: inherit;
  height: 44px;
  max-height: 132px;
  min-height: 44px;
  overflow-y: hidden;
  padding: 10px 11px;
  resize: none;
}

.rg-site-chat__input:focus {
  border-color: #ec482f;
}

.rg-site-chat__send {
  background: #ec482f;
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  padding: 0 13px;
}

.rg-site-chat__send:disabled,
.rg-site-chat__input:disabled {
  opacity: .58;
}

@media (max-width: 700px) {
  .rg-site-chat {
    bottom: 84px;
    right: 12px;
  }

  .rg-site-chat__toggle {
    height: 44px;
    min-width: 44px;
    width: 44px;
  }

  .rg-site-chat__panel {
    bottom: 54px;
    height: min(520px, calc(100vh - 166px));
    max-width: calc(100vw - 24px);
    width: 350px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rg-site-chat * {
    scroll-behavior: auto !important;
  }
}
