/* 太初智能客服浮窗（嵌入官网） */
:root {
  --taichu-chat-navy: #1570b8;
  --taichu-chat-muted: #66788a;
  --taichu-chat-panel: rgba(255, 255, 255, 0.82);
  --taichu-chat-shadow: 0 14px 36px rgba(17, 49, 79, 0.1);
  --taichu-chat-danger: #d1495b;
  --taichu-chat-success: #117a4f;
}

.taichu-chat-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100010;
  background: rgba(14, 20, 25, 0.22);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.taichu-chat-backdrop.is-open {
  display: block;
}

.taichu-chat-widget {
  position: fixed;
  right: calc(1.8rem + 0.72rem);
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  width: min(392px, calc(100vw - 3.2rem));
  height: min(560px, calc(100vh - 80px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: var(--taichu-chat-panel);
  box-shadow: var(--taichu-chat-shadow);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  z-index: 100011;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.taichu-chat-widget.is-open {
  display: flex !important;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.taichu-chat-widget .chat-close {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(20, 56, 88, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--taichu-chat-muted);
  cursor: pointer;
  padding: 0 10px 0 12px;
  font-size: 12px;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.taichu-chat-widget .chat-close:hover {
  color: var(--taichu-chat-danger);
  border-color: rgba(209, 73, 91, 0.35);
  background: rgba(255, 255, 255, 0.98);
}

.taichu-chat-widget .chat-close-label {
  font-weight: 500;
}

.taichu-chat-widget .chat-close--floating {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
}

.taichu-chat-widget .chat-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 44px 16px 16px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(248, 251, 255, 0.72) 100%);
}

.taichu-chat-widget .message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.taichu-chat-widget .message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 92%;
}

.taichu-chat-widget .message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.taichu-chat-widget .avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.taichu-chat-widget .message.bot .avatar {
  color: #fff;
  background: linear-gradient(135deg, #1f86d1, #1570b8);
}

.taichu-chat-widget .message.user .avatar {
  color: #fff;
  background: #6f9fcc;
}

.taichu-chat-widget .bubble {
  padding: 13px 14px;
  border: 1px solid rgba(20, 56, 88, 0.08);
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.75;
  color: #1b1f23;
  white-space: pre-wrap;
  word-break: break-word;
}

.taichu-chat-widget .message.bot .bubble {
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(20, 56, 88, 0.04);
}

.taichu-chat-widget .message.user .bubble {
  background: linear-gradient(135deg, #2483ca, #1769a8);
  color: #edf5ff;
  border-color: transparent;
}

.taichu-chat-widget .bubble.is-loading {
  color: #677685;
}

.taichu-chat-widget .quick-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.taichu-chat-widget .quick-actions button {
  padding: 8px 12px;
  border: 1px solid rgba(20, 56, 88, 0.1);
  border-radius: 999px;
  background: #ffffff;
  color: #556575;
  font-size: 12px;
  cursor: pointer;
}

.taichu-chat-widget .chat-footer {
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(20, 56, 88, 0.07);
  background: #fbfdff;
}

.taichu-chat-widget .composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.taichu-chat-widget .composer textarea,
.taichu-chat-widget .lead-form input,
.taichu-chat-widget .lead-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(20, 56, 88, 0.12);
  border-radius: 12px;
  background: #fff;
  color: #1b1f23;
  font: inherit;
  outline: none;
  box-sizing: border-box;
}

.taichu-chat-widget .composer textarea {
  min-height: 52px;
  max-height: 132px;
  resize: vertical;
}

.taichu-chat-widget .send-btn,
.taichu-chat-widget .lead-submit,
.taichu-chat-widget .lead-cancel {
  min-width: 80px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.taichu-chat-widget .send-btn,
.taichu-chat-widget .lead-submit {
  background: linear-gradient(135deg, #1f86d1, #1570b8);
  color: #fff;
}

.taichu-chat-widget .send-btn:disabled,
.taichu-chat-widget .lead-submit:disabled {
  opacity: 0.65;
  cursor: default;
}

.taichu-chat-widget .lead-cancel {
  background: #eef5fb;
  color: #35536f;
}

.taichu-chat-widget .footer-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: #61707f;
  font-size: 12px;
}

.taichu-chat-widget .lead-link {
  color: #1570b8;
  text-decoration: none;
  cursor: pointer;
}

.taichu-chat-widget .status-text {
  min-height: 18px;
  margin-top: 8px;
  color: #61707f;
  font-size: 12px;
}

.taichu-chat-widget .status-text.error {
  color: var(--taichu-chat-danger);
}

.taichu-chat-widget .status-text.success {
  color: var(--taichu-chat-success);
}

.taichu-chat-widget .lead-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.98);
  z-index: 5;
}

.taichu-chat-widget .lead-panel.is-open {
  display: flex;
}

.taichu-chat-widget .lead-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(20, 56, 88, 0.07);
  color: var(--taichu-chat-navy);
  font-weight: 600;
}

.taichu-chat-widget .lead-body {
  flex: 1;
  overflow: auto;
  padding: 18px;
}

.taichu-chat-widget .lead-note {
  margin: 0 0 16px;
  color: #5d6d7c;
  font-size: 13px;
  line-height: 1.7;
}

.taichu-chat-widget .lead-form {
  display: grid;
  gap: 12px;
}

.taichu-chat-widget .lead-form textarea {
  min-height: 100px;
  resize: vertical;
}

.taichu-chat-widget .lead-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

footer .side .service-item.taichu-ai-chat-trigger {
  cursor: pointer;
}

footer .side .service-item.taichu-ai-chat-trigger:hover .service-text > span:first-child {
  color: var(--taichu-chat-navy);
}

.taichu-chat-widget .chat-footer {
  flex: 0 0 auto;
}

@media (max-width: 768px) {
  .taichu-chat-widget {
    right: 12px;
    top: auto;
    bottom: 1rem;
    transform: none;
    width: calc(100vw - 24px);
    height: min(620px, calc(100vh - 100px));
  }

  .taichu-chat-widget .chat-close-label {
    display: none;
  }

  .taichu-chat-widget .chat-close {
    padding: 0;
    width: 34px;
  }
}
