.float-widget,
.float-widget * {
  box-sizing: border-box;
}

.float-widget {
  --float-chat-page: #f7f8fa;
  --float-chat-panel: #fff;
  --float-chat-blue: #3c5cb3;
  --float-chat-user-bubble: #e3edfb;
  --float-chat-text: #666;
  --float-chat-muted: #aeaeae;
  --float-chat-line: #f0f0f0;
  --float-chat-green: #0aca00;
  --float-dock-width: 88px;
  --float-dock-toggle-width: 34px;
  --float-dock-collapsed-right: 0px;
  --float-dock-right: calc(var(--float-dock-collapsed-right) + var(--float-dock-toggle-width));
  --float-dock-label-size: 14px;
  color: var(--float-chat-text);
  font-family: "Alibaba PuHuiTi 2.0", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.float-widget.is-scroll-gated:not(.is-scroll-visible) .float-tools,
.float-widget.is-scroll-gated:not(.is-scroll-visible) .float-dock-toggle,
.float-widget.is-scroll-gated:not(.is-scroll-visible) .float-chat-panel {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.float-widget button,
.float-widget textarea {
  font-family: inherit;
}

.float-tools {
  position: fixed;
  z-index: 1000;
  top: 10px;
  right: var(--float-dock-right);
  width: var(--float-dock-width);
  height: 371px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--float-chat-panel);
  box-shadow: 0 2px 12px rgba(31, 35, 41, .1);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.4, 0, .2, 1), visibility 220ms ease;
}

.float-widget.is-dock-collapsed .float-tools {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 40px));
}

.float-dock-toggle {
  position: fixed;
  z-index: 1002;
  top: 141px;
  right: 0;
  display: grid;
  width: var(--float-dock-toggle-width);
  height: 34px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  mix-blend-mode: difference;
  transition: right 220ms cubic-bezier(.4, 0, .2, 1), opacity 160ms ease;
}

.float-widget.is-dock-collapsed .float-dock-toggle {
  right: var(--float-dock-collapsed-right);
}

.float-dock-toggle:hover {
  background: transparent;
}

.float-dock-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.float-dock-toggle::before {
  width: 8px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  content: "";
  transform: translateX(-1px) rotate(-45deg);
  transition: transform 220ms ease;
}

.float-widget.is-dock-collapsed .float-dock-toggle::before {
  transform: translateX(1px) rotate(135deg);
}

.float-dock-action {
  display: flex;
  width: 100%;
  height: 65px;
  margin: 0;
  padding: 9px 0 7px;
  cursor: pointer;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
  border: 0;
  background: transparent;
  color: #666;
  font-size: var(--float-dock-label-size);
  line-height: 20px;
  text-align: center;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.float-dock-action:hover,
.float-dock-action:focus-visible {
  outline: none;
  background: #f8faff;
  color: var(--float-chat-blue);
}

.float-dock-action img {
  display: block;
  object-fit: contain;
}

.float-dock-action-online img {
  width: 24px;
  height: 24px;
}

.float-dock-action-contact img {
  width: 28px;
  height: 28px;
}

.float-dock-action-video-demo img {
  width: 28px;
  height: 28px;
}

.float-dock-action-top {
  padding: 4px 0 7px;
}

.float-dock-action-top img {
  width: 34px;
  height: 34px;
}

.float-dock-divider {
  width: 46px;
  height: 0;
  margin: 0 auto;
  border-top: 1px dashed #d8d8d8;
}

.float-dock-qr {
  display: flex;
  height: 108px;
  padding: 8px 0 7px;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
  color: #666;
  font-size: var(--float-dock-label-size);
  line-height: 20px;
  text-align: center;
}

.float-dock-action > span,
.float-dock-qr > span {
  font-size: var(--float-dock-label-size);
  font-weight: 400;
}

.float-dock-qr img {
  display: block;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  object-fit: contain;
  image-rendering: auto;
}

.float-chat-panel {
  position: fixed;
  z-index: 1001;
  right: 10px;
  bottom: 8px;
  display: flex;
  width: 330px;
  height: 420px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid #eee;
  border-radius: 10px;
  background: var(--float-chat-page);
  box-shadow: 0 2px 12px rgba(31, 35, 41, .08);
  transform-origin: right bottom;
  transition: right 220ms cubic-bezier(.4, 0, .2, 1), opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.float-chat-panel.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.985);
}

.float-chat-header {
  display: flex;
  min-height: 52px;
  padding: 0 16px;
  align-items: center;
  flex: 0 0 52px;
  border-bottom: 1px solid var(--float-chat-line);
  background: var(--float-chat-panel);
}

.float-chat-title {
  margin: 0;
  color: #111;
  font-size: 15px;
  font-weight: 600;
  line-height: 21px;
}

.float-chat-status {
  display: inline-flex;
  margin-left: auto;
  align-items: center;
  gap: 4px;
  color: #666;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.float-chat-status::before {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--float-chat-green);
  content: "";
}

.float-chat-status.is-connecting::before {
  background: #faad14;
}

.float-chat-status.is-offline::before {
  background: #a8abb2;
}

.float-chat-status.is-error::before {
  background: #f56c6c;
}

.float-chat-close {
  display: grid;
  width: 24px;
  height: 28px;
  margin: 0 0 0 16px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.float-chat-close:hover,
.float-chat-close:focus-visible {
  outline: none;
  background: #f5f6f8;
}

.float-chat-close img {
  display: block;
  width: 12px;
  height: 12px;
}

.float-chat-body {
  display: flex;
  min-height: 0;
  padding: 14px 14px 10px;
  flex: 1;
  flex-direction: column;
}

.float-chat-messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d9dce3 transparent;
}

.float-chat-message {
  display: flex;
  width: 100%;
  align-items: center;
}

.float-chat-message + .float-chat-message {
  margin-top: 14px;
}

.float-chat-message-user {
  justify-content: flex-end;
}

.float-chat-avatar {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
}

.float-chat-avatar-agent {
  margin-right: 7px;
  object-fit: cover;
  object-position: center 25%;
  background: #edf1f6;
}

.float-chat-avatar-user {
  margin-left: 7px;
}

.float-chat-bubble {
  max-width: 220px;
  padding: 8px 9px;
  border-radius: 10px;
  color: var(--float-chat-text);
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.float-chat-message-agent .float-chat-bubble {
  background: var(--float-chat-panel);
}

.float-chat-message-user .float-chat-bubble {
  max-width: 212px;
  background: var(--float-chat-user-bubble);
}

.float-chat-message-system .float-chat-bubble {
  border: 1px solid #f2dfae;
  background: #fffaf0;
  color: #8a6727;
}

.float-chat-message.is-pending .float-chat-bubble {
  opacity: .72;
}

.float-chat-message.is-failed .float-chat-bubble {
  outline: 1px solid rgba(245, 108, 108, .55);
}

.float-chat-message-state {
  display: block;
  margin-top: 3px;
  color: #8f959e;
  font-size: 10px;
  line-height: 14px;
  text-align: right;
}

.float-chat-message.is-failed .float-chat-message-state {
  color: #d94b4b;
}

.float-chat-composer {
  position: relative;
  flex: 0 0 78px;
  margin-top: auto;
  margin-right: -4px;
  margin-left: -4px;
  overflow: hidden;
  border: 1px solid #e9e9e9;
  border-radius: 10px;
  background: var(--float-chat-panel);
}

.float-chat-composer textarea {
  display: block;
  width: 100%;
  height: 100%;
  padding: 9px 13px 31px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #444;
  font-size: 13px;
  line-height: 18px;
}

.float-chat-composer textarea::placeholder {
  color: var(--float-chat-muted);
  opacity: 1;
}

.float-chat-composer textarea:disabled {
  cursor: not-allowed;
  background: #fafafa;
  color: #aaa;
}

.float-chat-send {
  position: absolute;
  right: 7px;
  bottom: 6px;
  min-width: 40px;
  height: 23px;
  margin: 0;
  padding: 0 8px;
  cursor: pointer;
  border: 0;
  border-radius: 4px;
  background: var(--float-chat-blue);
  color: #fff;
  font-size: 11px;
  line-height: 23px;
  transition: background-color 160ms ease, transform 160ms ease;
}

.float-chat-send:hover,
.float-chat-send:focus-visible {
  outline: none;
  background: #304f9e;
}

.float-chat-send:active {
  transform: scale(.97);
}

.float-chat-send:disabled {
  cursor: not-allowed;
  background: #b8c0d3;
  opacity: .8;
  transform: none;
}

html[data-locale="en"] .float-chat-title {
  font-size: 14px;
}

html[data-locale="en"] .float-dock-action > span,
html[data-locale="en"] .float-dock-qr > span {
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

html[data-locale="en"] .float-chat-status {
  font-size: 12px;
}

@media (min-width: 720px) {
  .float-widget {
    --float-dock-collapsed-right: 10px;
  }

  .float-tools {
    top: calc(50% + 135px);
    transform: translateY(-50%);
  }

  .float-chat-panel {
    top: calc(50% + 50px);
    right: calc(var(--float-dock-right) + var(--float-dock-width) + 10px);
    bottom: auto;
    transform: translateY(-50%);
    transform-origin: right center;
  }

  .float-chat-panel.is-hidden {
    transform: translateY(calc(-50% + 12px)) scale(.985);
  }

  .float-widget.is-dock-collapsed .float-chat-panel {
    right: calc(var(--float-dock-collapsed-right) + var(--float-dock-toggle-width) + 10px);
  }

  .float-dock-toggle {
    top: calc(50% + 118px);
    right: 10px;
    transform: none;
  }

  .float-widget.is-dock-collapsed .float-tools {
    transform: translate(calc(100% + 40px), -50%);
  }
}

@media (max-width: 404px) {
  .float-widget {
    --float-dock-collapsed-right: 8px;
  }

  .float-tools {
    right: 6px;
    bottom: 6px;
    transform: scale(.7);
  }

  .float-widget.is-dock-collapsed .float-tools {
    transform: translate(calc(100% + 40px), 0) scale(.7);
  }

  .float-dock-toggle {
    right: 6px;
    bottom: 266px;
    transform: scale(.7);
  }

  .float-widget.is-dock-collapsed .float-dock-toggle {
    right: 6px;
  }

  .float-chat-panel {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .float-chat-body {
    padding-right: 10px;
    padding-left: 10px;
  }

  .float-chat-header {
    padding-right: 10px;
    padding-left: 14px;
  }

  .float-chat-close {
    margin-left: 10px;
  }

  .float-chat-bubble {
    max-width: calc(100vw - 116px);
  }
}

@media (max-width: 768px) {
  .float-tools {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: var(--float-dock-width);
    height: auto;
    transform: scale(.78);
    transform-origin: right bottom;
  }

  .float-widget.is-dock-collapsed .float-tools {
    transform: translate(calc(100% + 40px), 0) scale(.78);
  }

  .float-dock-toggle {
    top: auto;
    right: 10px;
    bottom: 300px;
    transform: scale(.78);
    transform-origin: right bottom;
  }

  .float-widget.is-dock-collapsed .float-dock-toggle {
    right: 10px;
  }

  .float-dock-action {
    height: 58px;
    padding: 6px 0 5px;
  }

  .float-dock-action-online img,
  .float-dock-action-contact img,
  .float-dock-action-video-demo img {
    width: 22px;
    height: 22px;
  }

  .float-dock-action-top img {
    width: 28px;
    height: 28px;
  }

  .float-dock-qr {
    height: 92px;
    padding: 6px 0 5px;
  }

  .float-dock-qr img {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .float-dock-action > span,
  .float-dock-qr > span {
    font-size: 12px;
    line-height: 16px;
  }

  .float-chat-panel {
    right: 10px;
    bottom: 10px;
    transform-origin: right bottom;
  }
}

@media (max-height: 520px) {
  .float-tools {
    top: 10px;
    transform: none;
  }

  .float-chat-panel {
    top: 10px;
    bottom: 10px;
    height: auto;
    transform: none;
    transform-origin: right bottom;
  }

  .float-chat-panel.is-hidden {
    transform: translateY(12px) scale(.985);
  }

  .float-dock-toggle {
    top: 281px;
    transform: none;
  }

  .float-widget.is-dock-collapsed .float-tools {
    transform: translateX(calc(100% + 40px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .float-chat-panel,
  .float-dock-action,
  .float-dock-toggle,
  .float-chat-send {
    transition: none;
  }
}
