.rentgo-ai-chat {
  --rg-chat-yellow: #ffd400;
  --rg-chat-black: #111111;
  --rg-chat-ink: #171717;
  --rg-chat-muted: #6d7280;
  --rg-chat-line: #e9ebef;
  --rg-chat-soft: #f6f7f9;
  --rg-chat-white: #ffffff;
  --rg-chat-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  bottom: max(24px, env(safe-area-inset-bottom));
  color: var(--rg-chat-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: fixed;
  right: 24px;
  z-index: 9999;
}

.rentgo-ai-chat--left {
  left: 24px;
  right: auto;
}

.rentgo-ai-chat *,
.rentgo-ai-chat *::before,
.rentgo-ai-chat *::after {
  box-sizing: border-box;
}

.rentgo-ai-chat button,
.rentgo-ai-chat input,
.rentgo-ai-chat textarea {
  font-family: inherit !important;
}

.rentgo-ai-chat button {
  -webkit-appearance: none !important;
  appearance: none !important;
  text-decoration: none !important;
}

body.rentgo-chat-open {
  overflow: hidden !important;
  position: fixed;
  touch-action: none;
  width: 100%;
}

.rentgo-ai-chat__button {
  -webkit-appearance: none;
  appearance: none;
  align-items: center;
  background: linear-gradient(135deg, #ffe45c, var(--rg-chat-yellow)) !important;
  border: 2px solid rgba(17, 17, 17, 0.92) !important;
  border-radius: 999px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22), 0 0 0 7px rgba(255, 212, 0, 0.22);
  color: var(--rg-chat-black) !important;
  -webkit-text-fill-color: var(--rg-chat-black) !important;
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 850;
  gap: 10px;
  min-height: 62px;
  padding: 0 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rentgo-ai-chat__button:hover,
.rentgo-ai-chat__button:focus-visible {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26), 0 0 0 8px rgba(255, 212, 0, 0.27);
  outline: none;
  transform: translateY(-2px);
}

.rentgo-ai-chat__button-icon {
  background: var(--rg-chat-black);
  border-radius: 50%;
  display: inline-block;
  height: 24px;
  position: relative;
  width: 24px;
}

.rentgo-ai-chat__button-icon::before {
  background: var(--rg-chat-yellow);
  border-radius: 2px;
  content: "";
  height: 3px;
  left: 6px;
  position: absolute;
  top: 8px;
  width: 12px;
  box-shadow: 0 5px 0 var(--rg-chat-yellow);
}

.rentgo-ai-chat__button-text {
  color: var(--rg-chat-black) !important;
  line-height: 1;
  white-space: nowrap;
}

.rentgo-ai-chat__popup {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 22px;
  bottom: 82px;
  box-shadow: var(--rg-chat-shadow);
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100vh - 120px));
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  right: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
  width: min(410px, calc(100vw - 32px));
}

.rentgo-ai-chat.is-open .rentgo-ai-chat__popup {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.rentgo-ai-chat__header {
  align-items: center;
  background: linear-gradient(135deg, #111111, #2d2d2d);
  color: #fff;
  display: flex;
  gap: 12px;
  padding: 18px;
}

.rentgo-ai-chat__avatar,
.rentgo-ai-chat__mini-avatar {
  align-items: center;
  background: var(--rg-chat-yellow);
  border-radius: 50%;
  color: #111;
  display: flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.rentgo-ai-chat__mini-avatar {
  height: 28px;
  width: 28px;
}

.rentgo-ai-chat__heading {
  min-width: 0;
}

.rentgo-ai-chat__title {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.2;
}

.rentgo-ai-chat__subtitle {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.35;
  margin-top: 3px;
}

.rentgo-ai-chat__close {
  background: rgba(255, 255, 255, 0.09);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  height: 34px;
  margin-left: auto;
  position: relative;
  width: 34px;
}

.rentgo-ai-chat__close::before,
.rentgo-ai-chat__close::after {
  background: #fff;
  content: "";
  height: 2px;
  left: 9px;
  position: absolute;
  top: 16px;
  width: 16px;
}

.rentgo-ai-chat__close::before {
  transform: rotate(45deg);
}

.rentgo-ai-chat__close::after {
  transform: rotate(-45deg);
}

.rentgo-ai-chat__messages {
  background: linear-gradient(180deg, #f8f9fb, #ffffff);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 210px;
  overflow-y: auto;
  padding: 16px;
}

.rentgo-ai-chat__message-row {
  display: flex;
  gap: 8px;
  max-width: 100%;
}

.rentgo-ai-chat__message-row--user {
  align-items: flex-end;
  flex-direction: column;
}

.rentgo-ai-chat__message {
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 310px;
  padding: 11px 13px;
}

.rentgo-ai-chat__message--bot {
  background: #fff;
  border: 1px solid var(--rg-chat-line);
  color: var(--rg-chat-ink);
}

.rentgo-ai-chat__message--user {
  background: var(--rg-chat-yellow);
  color: var(--rg-chat-black);
}

.rentgo-ai-chat__time {
  color: var(--rg-chat-muted);
  display: block;
  font-size: 11px;
  margin-top: 4px;
}

.rentgo-ai-chat__quick-replies {
  background: #fff;
  border-top: 1px solid var(--rg-chat-line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
  padding: 12px 14px;
}

.rentgo-ai-chat__quick-replies.is-used {
  display: none;
}

.rentgo-ai-chat__quick,
.rentgo-ai-chat__contact-methods button {
  -webkit-appearance: none;
  appearance: none;
  background: var(--rg-chat-soft);
  border: 1px solid var(--rg-chat-line);
  border-radius: 999px;
  color: var(--rg-chat-ink);
  -webkit-text-fill-color: var(--rg-chat-ink);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  min-height: 36px;
  padding: 0 13px;
  white-space: normal;
  width: 100%;
}

.rentgo-ai-chat__form {
  background: #fff;
  border-top: 1px solid var(--rg-chat-line);
  display: grid;
  gap: 10px;
  padding: 14px;
}

.rentgo-ai-chat__fields {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  max-height: 120px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition: opacity 0.18s ease, max-height 0.22s ease, transform 0.18s ease;
}

.rentgo-ai-chat__fields.is-hiding,
.rentgo-ai-chat__fields[hidden] {
  display: grid;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.rentgo-ai-chat__field {
  display: grid;
  gap: 5px;
}

.rentgo-ai-chat__field span {
  color: var(--rg-chat-muted);
  font-size: 11px;
  font-weight: 800;
}

.rentgo-ai-chat__field input,
.rentgo-ai-chat__composer textarea {
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border: 1px solid var(--rg-chat-line);
  border-radius: 12px;
  color: var(--rg-chat-ink);
  -webkit-text-fill-color: var(--rg-chat-ink);
  font: inherit;
  font-size: 14px;
  min-height: 42px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

.rentgo-ai-chat__field input:focus,
.rentgo-ai-chat__composer textarea:focus {
  border-color: var(--rg-chat-yellow);
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.22);
}


.rentgo-ai-chat__contact-card {
  min-width: 0;
}

.rentgo-ai-chat__contact-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--rg-chat-ink);
  cursor: pointer;
  display: none;
  gap: 10px;
  min-width: 0;
  padding: 0;
  text-align: left;
  width: 100%;
}

.rentgo-ai-chat__contact-toggle-icon {
  align-items: center;
  background: rgba(255, 212, 0, 0.18);
  border: 1px solid rgba(255, 212, 0, 0.42);
  border-radius: 12px;
  color: var(--rg-chat-ink);
  display: inline-flex;
  flex: 0 0 38px;
  font-size: 17px;
  height: 38px;
  justify-content: center;
  -webkit-text-fill-color: var(--rg-chat-ink);
}

.rentgo-ai-chat__contact-toggle-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rentgo-ai-chat__contact-toggle-copy strong {
  color: var(--rg-chat-ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  -webkit-text-fill-color: var(--rg-chat-ink);
}

.rentgo-ai-chat__contact-toggle-copy small {
  color: var(--rg-chat-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.rentgo-ai-chat__contact-toggle-chevron {
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  flex: 0 0 8px;
  height: 8px;
  margin-left: auto;
  margin-right: 3px;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  width: 8px;
}

.rentgo-ai-chat__contact-card.is-expanded .rentgo-ai-chat__contact-toggle-chevron {
  transform: rotate(225deg);
}

.rentgo-ai-chat__contact-confirmation {
  background: linear-gradient(135deg, rgba(255, 212, 0, 0.18), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(255, 212, 0, 0.52);
  border-radius: 14px;
  color: var(--rg-chat-ink);
  display: grid;
  gap: 6px;
  max-height: 140px;
  opacity: 0;
  padding: 12px 13px;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.rentgo-ai-chat__contact-confirmation[hidden] {
  display: none;
}

.rentgo-ai-chat__contact-confirmation.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.rentgo-ai-chat__contact-confirmation-title {
  align-items: center;
  color: #151515;
  display: flex;
  font-size: 14px;
  font-weight: 850;
  gap: 8px;
}

.rentgo-ai-chat__contact-confirmation-title span {
  align-items: center;
  background: #19a55a;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 20px;
  font-size: 13px;
  height: 20px;
  justify-content: center;
  -webkit-text-fill-color: #fff;
  width: 20px;
}

.rentgo-ai-chat__contact-confirmation-row {
  color: var(--rg-chat-muted);
  display: flex;
  font-size: 13px;
  gap: 6px;
  min-width: 0;
}

.rentgo-ai-chat__contact-confirmation-row strong {
  color: var(--rg-chat-ink);
  font-weight: 800;
  overflow-wrap: anywhere;
  -webkit-text-fill-color: var(--rg-chat-ink);
}

.rentgo-ai-chat__composer {
  align-items: flex-end;
  display: flex;
  gap: 8px;
}

.rentgo-ai-chat__composer textarea {
  max-height: 112px;
  min-height: 48px;
  resize: none;
}

.rentgo-ai-chat__submit {
  -webkit-appearance: none;
  appearance: none;
  align-items: center;
  background: var(--rg-chat-yellow);
  border: 0;
  border-radius: 14px;
  color: #111;
  -webkit-text-fill-color: #111;
  cursor: pointer;
  display: flex;
  flex: 0 0 48px;
  font-size: 22px;
  font-weight: 900;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.rentgo-ai-chat__submit:disabled {
  cursor: progress;
  opacity: 0.65;
}

.rentgo-ai-chat__typing {
  align-items: center;
  background: #fff;
  border: 1px solid var(--rg-chat-line);
  border-radius: 16px;
  display: flex;
  gap: 4px;
  height: 38px;
  padding: 0 12px;
}

.rentgo-ai-chat__typing span {
  animation: rentgoTyping 1.2s infinite ease-in-out;
  background: #a8adb8;
  border-radius: 50%;
  height: 6px;
  width: 6px;
}

.rentgo-ai-chat__typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.rentgo-ai-chat__typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.rentgo-ai-chat__contact-methods {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rentgo-ai-chat__contact-methods[hidden] {
  display: none;
}

.rentgo-ai-chat__contact-title {
  color: var(--rg-chat-muted);
  flex-basis: 100%;
  font-size: 12px;
  font-weight: 800;
}

.rentgo-ai-chat__status {
  color: var(--rg-chat-muted);
  font-size: 12px;
  min-height: 16px;
}

.rentgo-ai-chat__status:empty {
  display: none;
  min-height: 0;
}

.rentgo-ai-chat__trap {
  display: none !important;
}

@keyframes rentgoTyping {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-color-scheme: dark) {
  .rentgo-ai-chat {
    --rg-chat-ink: #f4f5f7;
    --rg-chat-muted: #aeb4c0;
    --rg-chat-line: #30333a;
    --rg-chat-soft: #24272d;
    --rg-chat-white: #181a1f;
  }

  .rentgo-ai-chat__popup,
  .rentgo-ai-chat__form,
  .rentgo-ai-chat__quick-replies {
    background: #181a1f;
  }

  .rentgo-ai-chat__messages {
    background: linear-gradient(180deg, #15171b, #181a1f);
  }

  .rentgo-ai-chat__message--bot,
  .rentgo-ai-chat__typing,
  .rentgo-ai-chat__field input,
  .rentgo-ai-chat__composer textarea,
  .rentgo-ai-chat__contact-confirmation {
    background: #202329;
    color: #f4f5f7;
    -webkit-text-fill-color: #f4f5f7;
  }

  .rentgo-ai-chat__contact-confirmation {
    border-color: rgba(255, 212, 0, 0.45);
  }

  .rentgo-ai-chat__contact-confirmation-title,
  .rentgo-ai-chat__contact-confirmation-row strong {
    color: #f4f5f7;
    -webkit-text-fill-color: #f4f5f7;
  }

  .rentgo-ai-chat__quick,
  .rentgo-ai-chat__contact-methods button {
    background: #24272d;
    border-color: #3a3e46;
    color: #f4f5f7;
    -webkit-text-fill-color: #f4f5f7;
  }

  .rentgo-ai-chat__submit {
    background: var(--rg-chat-yellow);
    color: #111;
    -webkit-text-fill-color: #111;
  }

  .rentgo-ai-chat__contact-toggle,
  .rentgo-ai-chat__contact-toggle-copy strong,
  .rentgo-ai-chat__contact-toggle-icon {
    color: #f4f5f7;
    -webkit-text-fill-color: #f4f5f7;
  }

  .rentgo-ai-chat__contact-toggle-icon {
    background: rgba(255, 212, 0, 0.12);
    border-color: rgba(255, 212, 0, 0.34);
  }
}

@media (max-width: 768px) {
  html.rentgo-chat-open,
  body.rentgo-chat-open {
    overscroll-behavior: none;
  }

  .rentgo-ai-chat {
    --rg-mobile-layer: 2147483000;
    bottom: auto;
    left: 0;
    pointer-events: none;
    right: auto;
    top: 0;
    transform: none;
    z-index: var(--rg-mobile-layer);
  }

  .rentgo-ai-chat--left {
    left: 0;
    right: auto;
  }

  .rentgo-ai-chat__button {
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 50%;
    margin-left: 0;
    min-height: 58px;
    padding: 0 18px;
    pointer-events: auto;
    position: fixed;
    right: auto;
    transform: translateX(-50%);
    z-index: var(--rg-mobile-layer);
  }

  .rentgo-ai-chat__button:hover,
  .rentgo-ai-chat__button:focus-visible {
    transform: translateX(-50%) translateY(-2px);
  }

  .rentgo-ai-chat__popup {
    border: 0;
    border-radius: 0;
    bottom: auto;
    display: flex;
    height: var(--rg-visual-viewport-height, 100dvh);
    left: 0;
    max-height: none;
    max-width: none;
    overflow: hidden;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: var(--rg-visual-viewport-offset-top, 0px);
    transform: none;
    width: 100vw;
    z-index: calc(var(--rg-mobile-layer) + 1);
  }

  .rentgo-ai-chat.is-open {
    inset: 0;
    pointer-events: auto;
    transform: none;
    z-index: var(--rg-mobile-layer);
  }

  .rentgo-ai-chat.is-open .rentgo-ai-chat__button {
    opacity: 0;
    pointer-events: none;
  }

  .rentgo-ai-chat.is-open .rentgo-ai-chat__popup {
    pointer-events: auto;
    transform: none;
  }

  .rentgo-ai-chat__header {
    flex: 0 0 auto;
    gap: 9px;
    min-height: 66px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    position: relative;
    z-index: 4;
  }

  .rentgo-ai-chat__avatar {
    font-size: 11px;
    height: 36px;
    width: 36px;
  }

  .rentgo-ai-chat__title {
    font-size: 15px;
  }

  .rentgo-ai-chat__subtitle {
    font-size: 11.5px;
    line-height: 1.25;
    margin-top: 2px;
  }

  .rentgo-ai-chat__close {
    background: rgba(255, 255, 255, 0.13);
    flex: 0 0 44px;
    height: 44px;
    width: 44px;
  }

  .rentgo-ai-chat__close::before,
  .rentgo-ai-chat__close::after {
    left: 12px;
    top: 21px;
    width: 20px;
  }

  .rentgo-ai-chat__messages {
    -webkit-overflow-scrolling: touch;
    flex: 1 1 0;
    gap: 9px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
  }

  .rentgo-ai-chat__message {
    font-size: 13.5px;
    line-height: 1.4;
    max-width: min(82vw, 340px);
    padding: 10px 12px;
  }

  .rentgo-ai-chat__mini-avatar {
    height: 26px;
    width: 26px;
  }

  .rentgo-ai-chat__quick-replies {
    flex: 0 0 auto;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px 12px;
  }

  .rentgo-ai-chat__quick,
  .rentgo-ai-chat__contact-methods button {
    border-radius: 13px;
    font-size: 12px;
    line-height: 1.15;
    min-height: 34px;
    padding: 5px 8px;
  }

  .rentgo-ai-chat__form {
    flex: 0 0 auto;
    gap: 8px;
    padding: 9px 12px max(9px, env(safe-area-inset-bottom));
    position: relative;
  }

  .rentgo-ai-chat__contact-card {
    background: rgba(255, 212, 0, 0.035);
    border: 1px solid rgba(255, 212, 0, 0.26);
    border-radius: 14px;
    padding: 7px 9px;
    transition: border-color 0.18s ease, background 0.18s ease;
  }

  .rentgo-ai-chat__contact-card.is-expanded {
    background: rgba(255, 212, 0, 0.045);
    border-color: rgba(255, 212, 0, 0.48);
  }

  .rentgo-ai-chat__contact-toggle {
    display: flex;
    min-height: 42px;
  }

  .rentgo-ai-chat__contact-card.is-expanded .rentgo-ai-chat__contact-toggle {
    margin-bottom: 8px;
  }

  .rentgo-ai-chat__fields {
    gap: 7px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 90px;
  }

  .rentgo-ai-chat__fields[hidden] {
    display: none;
  }

  .rentgo-ai-chat__field {
    gap: 4px;
  }

  .rentgo-ai-chat__field span {
    font-size: 10.5px;
  }

  .rentgo-ai-chat__field input,
  .rentgo-ai-chat__composer textarea {
    font-size: 16px;
  }

  .rentgo-ai-chat__field input {
    min-height: 40px;
    padding: 8px 10px;
  }

  .rentgo-ai-chat__composer {
    gap: 7px;
  }

  .rentgo-ai-chat__composer textarea {
    max-height: 88px;
    min-height: 46px;
    padding: 10px 11px;
    resize: none;
  }

  .rentgo-ai-chat__submit {
    border-radius: 13px;
    flex-basis: 46px;
    height: 46px;
    width: 46px;
  }

  .rentgo-ai-chat__contact-confirmation {
    max-height: 112px;
    padding: 9px 10px;
  }

  .rentgo-ai-chat__contact-methods {
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rentgo-ai-chat__status {
    min-height: 0;
  }
}

@media (max-width: 360px) {
  .rentgo-ai-chat__quick,
  .rentgo-ai-chat__contact-methods button {
    font-size: 11px;
    padding-inline: 6px;
  }

  .rentgo-ai-chat__contact-toggle-copy small {
    font-size: 10px;
  }
}

/* Stabilization: keep closed chat passive and open chat above page overlays. */
.rentgo-ai-chat.is-closed .rentgo-ai-chat__popup {
  visibility: hidden;
}

.rentgo-ai-chat.is-open {
  z-index: 2147483000;
}

.rentgo-ai-chat.is-open .rentgo-ai-chat__popup {
  visibility: visible;
}

