.yyy-ai {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #111827;
}

.yyy-ai * {
  box-sizing: border-box;
}

.yyy-ai__button {
  position: relative;
  z-index: 4;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(37, 99, 235, .82);
  border-radius: 8px;
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
}

.yyy-ai__button::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(147, 197, 253, .72);
  border-radius: 6px;
  pointer-events: none;
}

.yyy-ai__button-icon {
  width: 45px;
  height: 45px;
  display: block;
  position: relative;
  z-index: 1;
}

.yyy-ai__button-text {
  display: none;
}

.yyy-ai__overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
  background: rgba(2, 6, 23, .5);
}

.yyy-ai__panel {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 64px;
  width: min(390px, calc(100vw - 28px));
  height: min(680px, calc(100vh - 112px));
  min-height: 520px;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, .12);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
  overflow: hidden;
  display: none;
}

.yyy-ai--open .yyy-ai__panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.yyy-ai--open .yyy-ai__overlay {
  display: block;
}

.yyy-ai__header {
  padding: 14px 15px;
  background: #111827;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.yyy-ai__title {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 650;
}

.yyy-ai__subtitle {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, .72);
  margin-top: 2px;
}

.yyy-ai__iconbtn {
  appearance: none;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 7px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.yyy-ai__messages {
  background: #f8fafc;
  padding: 14px;
  overflow-y: auto;
}

.yyy-ai__msg {
  width: fit-content;
  max-width: 92%;
  margin: 0 0 11px;
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.yyy-ai__msg--assistant {
  margin-right: auto;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, .32);
}

.yyy-ai__msg--user {
  margin-left: auto;
  background: #2563eb;
  color: #fff;
}

.yyy-ai__typing {
  max-width: 86%;
  margin: 0 0 11px;
  padding: 10px 11px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, .32);
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.yyy-ai__typing-dots {
  display: inline-flex;
  gap: 3px;
}

.yyy-ai__typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2563eb;
  opacity: .35;
  animation: yyy-ai-pulse 1.05s infinite ease-in-out;
}

.yyy-ai__typing-dots i:nth-child(2) {
  animation-delay: .16s;
}

.yyy-ai__typing-dots i:nth-child(3) {
  animation-delay: .32s;
}

@keyframes yyy-ai-pulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: .32;
  }
  40% {
    transform: translateY(-3px);
    opacity: .95;
  }
}

.yyy-ai__sources {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.yyy-ai__source {
  position: relative;
  display: block;
  min-height: 72px;
  padding: 10px 11px 10px 50px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  border: 1px solid rgba(37, 99, 235, .28);
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  color: #0f172a;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
}

.yyy-ai__source em {
  position: absolute;
  left: 9px;
  top: 10px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 22px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-style: normal;
  font-weight: 750;
}

.yyy-ai__source strong {
  display: block;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 3px;
}

.yyy-ai__source span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-top: 3px;
}

.yyy-ai__chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.yyy-ai__chip {
  border: 1px solid rgba(37, 99, 235, .24);
  background: #eff6ff;
  color: #1d4ed8;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, .06);
}

.yyy-ai__chip--case {
  background: #ecfdf5;
  border-color: rgba(5, 150, 105, .28);
  color: #047857;
}

.yyy-ai__chip--doc {
  background: #f5f3ff;
  border-color: rgba(124, 58, 237, .24);
  color: #6d28d9;
}

.yyy-ai__chip--contact {
  background: #fff7ed;
  border-color: rgba(234, 88, 12, .25);
  color: #c2410c;
}

.yyy-ai__footer {
  padding: 10px;
  border-top: 1px solid rgba(148, 163, 184, .24);
  background: #fff;
}

.yyy-ai__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.yyy-ai__input {
  width: 100%;
  border: 1px solid rgba(100, 116, 139, .35);
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
}

.yyy-ai__send {
  min-width: 68px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.yyy-ai__hint {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
  margin: 8px 2px 0;
}

.yyy-ai__toast {
  display: none;
  margin-top: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
}

.yyy-ai__contact-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items: center;
  max-width: 92%;
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
  border: 1px solid rgba(37, 99, 235, .32);
  box-shadow: 0 10px 26px rgba(37, 99, 235, .08);
}

.yyy-ai__qr {
  width: 86px;
  height: 86px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, .28);
  object-fit: cover;
}

.yyy-ai__contact-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.yyy-ai__contact-copy strong {
  font-size: 13px;
  line-height: 1.35;
  color: #0f172a;
}

.yyy-ai__contact-copy span {
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
}

.yyy-ai__contact-copy a {
  font-size: 12px;
  color: #1d4ed8;
  text-decoration: none;
}

.yyy-ai--busy .yyy-ai__send {
  opacity: .7;
  cursor: wait;
}

.yyy-ai-highlight {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 4px;
  border-radius: 8px;
}

@media (max-width: 520px) {
  .yyy-ai {
    right: 14px;
    bottom: 22px;
  }

  .yyy-ai__panel {
    right: -4px;
    bottom: 64px;
    width: calc(100vw - 20px);
    height: min(650px, calc(100vh - 96px));
    min-height: 0;
  }
}

@media (max-width: 979px) {
  body .float-service {
    position: fixed !important;
    right: 14px !important;
    bottom: 86px !important;
    z-index: 99998 !important;
    display: block !important;
  }

  body .float-service-btn {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: #fff;
    background: #2f70ed;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
    cursor: pointer;
  }

  body .float-service-popup {
    position: absolute;
    right: 0;
    bottom: 62px;
    width: min(260px, calc(100vw - 28px));
    padding: 16px;
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    box-shadow: 0 20px 55px rgba(15, 23, 42, .18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all .18s ease;
  }

  body .float-service-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  body .float-service-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #0b1220;
    font-weight: 800;
  }

  body .float-service-qrcode img {
    width: 150px;
    height: 150px;
    margin: 0 auto 8px;
  }

  body .float-service-qrcode p,
  body .float-service-phone-label {
    color: #667085;
    font-size: 13px;
    text-align: center;
    margin: 0;
  }

  body .float-service-phone {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    text-align: center;
  }

  body .float-service-phone-number {
    color: #2f70ed;
    font-weight: 800;
  }
}
