.xg-ai-chat-active .xg-chat-card,
.xg-ai-chat-active .xg-chat-launcher {
  display: none !important;
}

.xg-ai-chat,
.xg-ai-chat * {
  box-sizing: border-box;
}

.xg-ai-chat {
  position: fixed;
  z-index: 99999;
  right: 22px;
  bottom: 20px;
  color: #0d1b2a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.xg-ai-chat button,
.xg-ai-chat textarea {
  font: inherit;
}

.xg-ai-chat__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 17px 8px 9px;
  color: #fff;
  background: #e4392f;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(7, 18, 30, .28);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.xg-ai-chat__launcher:hover,
.xg-ai-chat__launcher:focus-visible {
  background: #bd271f;
  box-shadow: 0 18px 44px rgba(7, 18, 30, .33);
  outline: 0;
  transform: translateY(-2px);
}

.xg-ai-chat__launcher-icon {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
}

.xg-ai-chat__launcher-icon svg {
  width: 20px;
  height: 20px;
}

.xg-ai-chat__launcher-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

.xg-ai-chat__launcher-copy small {
  color: rgba(255, 255, 255, .72);
  font-size: .57rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.xg-ai-chat__launcher-copy strong {
  color: #fff;
  font-size: .77rem;
  font-weight: 850;
}

.xg-ai-chat__panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(386px, calc(100vw - 30px));
  overflow: hidden;
  color: #0d1b2a;
  background: #f7fafc;
  border: 1px solid rgba(13, 27, 42, .12);
  border-radius: 18px;
  box-shadow: 0 26px 75px rgba(7, 18, 30, .31);
  transform: translateY(13px) scale(.98);
  transform-origin: right bottom;
  transition: opacity .2s ease, transform .2s ease;
}

.xg-ai-chat.is-open .xg-ai-chat__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.xg-ai-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 13px 15px;
  color: #fff;
  background: linear-gradient(126deg, #07121e, #172b3d);
}

.xg-ai-chat__identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xg-ai-chat__avatar {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  color: #fff;
  background: #e4392f;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 50%;
  box-shadow: inset 0 1px rgba(255, 255, 255, .24);
  font-size: .85rem;
  font-weight: 900;
}

.xg-ai-chat__identity div {
  display: grid;
  gap: 2px;
}

.xg-ai-chat__identity span:not(.xg-ai-chat__avatar) {
  color: rgba(255, 255, 255, .63);
  font-size: .57rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.xg-ai-chat__identity strong {
  color: #fff;
  font-size: .93rem;
  letter-spacing: -.015em;
}

.xg-ai-chat__close {
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, .86);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.43rem;
  line-height: 1;
}

.xg-ai-chat__close:hover,
.xg-ai-chat__close:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .11);
  outline: 0;
}

.xg-ai-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(405px, 50vh);
  min-height: 152px;
  padding: 16px 14px 13px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.xg-ai-chat__message {
  max-width: 88%;
  padding: 11px 12px;
  border-radius: 13px;
  font-size: .85rem;
  line-height: 1.5;
}

.xg-ai-chat__message p {
  margin: 0;
}

.xg-ai-chat__message--assistant {
  align-self: flex-start;
  color: #273647;
  background: #eaf0f4;
  border-bottom-left-radius: 3px;
}

.xg-ai-chat__message--user {
  align-self: flex-end;
  color: #fff;
  background: #0d1b2a;
  border-bottom-right-radius: 3px;
}

.xg-ai-chat__message--error {
  color: #8b271f;
  background: #fff1f0;
}

.xg-ai-chat__message-note {
  margin-top: 6px !important;
  color: #607184;
  font-size: .72rem;
  line-height: 1.4;
}

.xg-ai-chat__suggestions {
  display: flex;
  gap: 7px;
  padding: 0 14px 13px;
  overflow-x: auto;
}

.xg-ai-chat__suggestions button {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #324356;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, .14);
  border-radius: 999px;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
}

.xg-ai-chat__suggestions button:hover,
.xg-ai-chat__suggestions button:focus-visible {
  color: #fff;
  background: #0d1b2a;
  border-color: #0d1b2a;
  outline: 0;
}

.xg-ai-chat__form {
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 11px 12px;
  background: #fff;
  border-top: 1px solid rgba(13, 27, 42, .1);
}

.xg-ai-chat__form textarea {
  display: block;
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 94px;
  padding: 10px 11px;
  resize: none;
  color: #0d1b2a;
  background: #f5f8fa;
  border: 1px solid rgba(13, 27, 42, .14);
  border-radius: 10px;
  font-size: .8rem;
  line-height: 1.35;
}

.xg-ai-chat__form textarea:focus {
  background: #fff;
  border-color: #e4392f;
  box-shadow: 0 0 0 3px rgba(228, 57, 47, .11);
  outline: 0;
}

.xg-ai-chat__form textarea::placeholder {
  color: #7e8d9b;
}

.xg-ai-chat__form button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  color: #fff;
  background: #e4392f;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.xg-ai-chat__form button:hover,
.xg-ai-chat__form button:focus-visible {
  background: #bd271f;
  outline: 0;
}

.xg-ai-chat__form button svg {
  width: 17px;
  height: 17px;
}

.xg-ai-chat__form.is-sending button {
  opacity: .58;
  pointer-events: none;
}

.xg-ai-chat__footer {
  padding: 0 14px 13px;
  color: #71808d;
  background: #fff;
  font-size: .64rem;
  line-height: 1.45;
}

.xg-ai-chat__footer a {
  color: #b9221a;
  font-weight: 800;
}

.xg-ai-chat__typing {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 39px;
}

.xg-ai-chat__typing span {
  width: 6px;
  height: 6px;
  background: #788998;
  border-radius: 50%;
  animation: xg-ai-chat-bounce 1s infinite ease-in-out;
}

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

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

@keyframes xg-ai-chat-bounce {
  0%, 100% { opacity: .4; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 600px) {
  .xg-ai-chat {
    right: 13px;
    bottom: 13px;
  }

  .xg-ai-chat__panel {
    right: -2px;
    bottom: 67px;
    width: min(386px, calc(100vw - 24px));
  }

  .xg-ai-chat__launcher {
    min-height: 53px;
    padding-right: 14px;
  }

  .xg-ai-chat__launcher-copy strong {
    font-size: .73rem;
  }

  .xg-ai-chat__messages {
    max-height: min(390px, 52vh);
  }
}
