/* 站内客服：微信 PC 风格聊天窗 */
.site-float-sidebar__item {
  position: relative;
  border: none;
  font: inherit;
  appearance: none;
}

.site-float-sidebar__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.wx-chat {
  --wx-bg: #f5f5f5;
  --wx-panel: #f5f5f5;
  --wx-msg-bg: #ededed;
  --wx-bubble-in: #fff;
  --wx-bubble-out: #95ec69;
  --wx-text: #191919;
  --wx-muted: #b2b2b2;
  --wx-border: #e7e7e7;
  position: fixed;
  right: 84px;
  bottom: 24px;
  width: min(420px, calc(100vw - 24px));
  height: min(640px, calc(100vh - 40px));
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: var(--wx-panel);
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--wx-text);
}

.wx-chat.d-none {
  display: none !important;
}

.wx-chat__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 14px;
  background: #f5f5f5;
  border-bottom: 1px solid var(--wx-border);
  flex-shrink: 0;
}

.wx-chat__title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.wx-chat__title-actions {
  display: flex;
  gap: 4px;
}

.wx-chat__queue {
  flex-shrink: 0;
  padding: 8px 14px;
  background: #fff8e6;
  border-bottom: 1px solid #f0e0b2;
  color: #8a6116;
  font-size: 12px;
  line-height: 1.45;
}

.wx-chat__queue.d-none {
  display: none !important;
}

.wx-chat__icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wx-chat__icon-btn:hover {
  background: #e8e8e8;
  color: #111;
}

.wx-chat__guest {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem 1.25rem;
  background: var(--wx-msg-bg);
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

.wx-chat__guest-btn {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  background: #07c160;
  color: #fff;
  text-decoration: none;
  font-size: 0.875rem;
}

.wx-chat__guest-btn--ghost {
  background: #fff;
  color: #07c160;
  border: 1px solid #07c160;
}

.wx-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 8px;
  background: var(--wx-msg-bg);
}

.wx-chat__time {
  text-align: center;
  color: var(--wx-muted);
  font-size: 12px;
  margin: 10px 0 14px;
  line-height: 1;
}

.wx-chat__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.wx-chat__row--mine {
  flex-direction: row-reverse;
}

.wx-chat__avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: cover;
  background: #cfcfcf;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

.wx-chat__avatar--support {
  background: linear-gradient(145deg, #07c160, #06ad56);
}

.wx-chat__avatar--user {
  background: linear-gradient(145deg, #576b95, #4a5c84);
}

.wx-chat__bubble {
  max-width: min(260px, calc(100% - 56px));
  padding: 9px 12px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
  box-shadow: none;
}

.wx-chat__row:not(.wx-chat__row--mine) .wx-chat__bubble {
  background: var(--wx-bubble-in);
  color: var(--wx-text);
}

.wx-chat__row--mine .wx-chat__bubble {
  background: var(--wx-bubble-out);
  color: var(--wx-text);
}

.wx-chat__bubble-tag {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #888;
}

.wx-chat__row--mine .wx-chat__bubble-tag {
  color: rgba(0, 0, 0, 0.45);
}

.wx-chat__link {
  color: #056de8;
  text-decoration: underline;
  word-break: break-all;
}

.wx-chat__row--mine .wx-chat__link {
  color: #0b57d0;
}

.wx-chat__composer {
  display: flex;
  flex-direction: column;
  min-height: 160px;
  background: #f5f5f5;
  border-top: 1px solid var(--wx-border);
  flex-shrink: 0;
}

.wx-chat__toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 0;
  color: #646464;
  font-size: 18px;
  user-select: none;
}

.wx-chat__human-btn {
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #333;
  font-size: 12px;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
}

.wx-chat__human-btn:hover {
  border-color: #07c160;
  color: #07c160;
}

.wx-chat__composer textarea {
  flex: 1;
  min-height: 72px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--wx-text);
}

.wx-chat__composer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 14px 12px;
}

.wx-chat__hint {
  font-size: 12px;
  color: var(--wx-muted);
  margin-right: auto;
}

.wx-chat__send {
  min-width: 64px;
  height: 30px;
  padding: 0 14px;
  border: none;
  border-radius: 4px;
  background: #e9e9e9;
  color: #07c160;
  font-size: 13px;
  cursor: pointer;
}

.wx-chat__send:hover {
  background: #dcdcdc;
}

.wx-chat__send:active {
  background: #07c160;
  color: #fff;
}

.wx-chat__empty {
  text-align: center;
  color: var(--wx-muted);
  font-size: 13px;
  padding: 3rem 1rem;
}

@media (max-width: 767.98px) {
  .wx-chat {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 8px;
    height: min(78vh, 640px);
  }
}

/* 兼容旧 class（若残留） */
.support-chat-panel.d-none {
  display: none !important;
}
