.chr-ai-root { font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.chr-ai-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 99980;
  width: 58px; height: 58px; border: 0; border-radius: 14px;
  padding: 0; overflow: hidden;
  background: #fff; cursor: pointer;
  box-shadow: 0 8px 24px rgba(44, 62, 80, 0.35);
  display: flex; align-items: center; justify-content: center;
}
.chr-ai-fab:hover { transform: translateY(-1px); }
.chr-ai-fab img { width: 58px; height: 58px; object-fit: cover; display: block; }
.chr-ai-fab-dot {
  position: absolute; top: 8px; right: 8px; width: 10px; height: 10px;
  background: #22c55e; border: 2px solid #fff; border-radius: 50%;
}
.chr-ai-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 99990;
  width: 380px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.22);
  display: none; flex-direction: column;
}
.chr-ai-root.is-open .chr-ai-panel { display: flex; }
.chr-ai-head {
  background: #2c3e50; color: #fff; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.chr-ai-avatar {
  width: 38px; height: 38px; border-radius: 10px; background: #fff;
  overflow: hidden; flex: 0 0 auto;
}
.chr-ai-avatar img { width: 38px; height: 38px; object-fit: cover; display: block; }
.chr-ai-head-text { flex: 1; min-width: 0; }
.chr-ai-head-text strong { display: block; font-size: 14px; line-height: 1.2; }
.chr-ai-head-text span { display: block; font-size: 11px; opacity: 0.82; }
.chr-ai-head-actions { display: flex; gap: 6px; }
.chr-ai-iconbtn {
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,0.12); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chr-ai-iconbtn:hover { background: rgba(255,255,255,0.22); }
.chr-ai-iconbtn svg { width: 16px; height: 16px; }
.chr-ai-wxbtn {
  padding: 0; overflow: hidden; background: transparent;
  border-radius: 8px;
}
.chr-ai-wxbtn:hover { background: transparent; transform: scale(1.06); }
.chr-ai-wxbtn img { width: 32px; height: 32px; display: block; border-radius: 8px; }
.chr-ai-body { flex: 1; overflow: auto; background: #f4f6f8; padding: 12px; }
.chr-ai-msg { display: flex; margin-bottom: 10px; }
.chr-ai-msg.user { justify-content: flex-end; }
.chr-ai-bubble {
  max-width: 86%; padding: 9px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.chr-ai-msg.assistant .chr-ai-bubble { background: #fff; color: #1f2937; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.chr-ai-msg.user .chr-ai-bubble { background: #2c3e50; color: #fff; border-bottom-right-radius: 4px; }
.chr-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chr-ai-chip {
  border: 1px solid #d1d5db; background: #fff; color: #334155;
  border-radius: 999px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.chr-ai-chip:hover { border-color: #e85d04; color: #e85d04; }
.chr-ai-typing { font-size: 12px; color: #64748b; padding: 0 4px 8px; display: none; }
.chr-ai-foot { border-top: 1px solid #e5e7eb; background: #fff; padding: 10px; }
.chr-ai-input-row { display: flex; gap: 8px; }
.chr-ai-input-row textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 90px;
  border: 1px solid #d1d5db; border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px;
}
.chr-ai-send {
  border: 0; border-radius: 10px; background: #e85d04; color: #fff;
  padding: 0 14px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.chr-ai-send:disabled { opacity: 0.55; cursor: wait; }
.chr-ai-subactions { display: flex; gap: 8px; margin-top: 8px; }
.chr-ai-linkbtn {
  flex: 1; border: 1px solid #d1d5db; background: #fff; border-radius: 8px;
  padding: 7px 8px; font-size: 12px; cursor: pointer; color: #334155;
}
.chr-ai-linkbtn.wx { border-color: #07C160; color: #059669; }
.chr-ai-overlay {
  display: none; position: absolute; inset: 0; background: #fff;
  flex-direction: column; z-index: 2;
}
.chr-ai-overlay.is-on { display: flex; }
.chr-ai-overlay-head {
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e5e7eb; font-weight: 600; color: #2c3e50;
}
.chr-ai-overlay-body { padding: 16px; overflow: auto; font-size: 13.5px; color: #334155; line-height: 1.6; }
.chr-ai-qr { display: block; width: 180px; height: 180px; margin: 8px auto 12px; border-radius: 10px; }
.chr-ai-overlay-body label { display: block; font-size: 12px; color: #64748b; margin: 8px 0 4px; }
.chr-ai-overlay-body input, .chr-ai-overlay-body textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px;
  font: inherit; font-size: 13px;
}
.chr-ai-overlay-body button.primary {
  width: 100%; margin-top: 12px; border: 0; border-radius: 10px;
  background: #e85d04; color: #fff; padding: 10px; font-weight: 600; cursor: pointer;
}
.chr-ai-copy {
  display: block; width: 100%; margin: 8px 0 0; border: 1px dashed #07C160;
  background: #f0fdf4; color: #047857; border-radius: 8px; padding: 8px; cursor: pointer; font-weight: 600;
}
.chr-ai-err { color: #b91c1c; font-size: 12px; margin-top: 8px; }
#back-to-top {
  right: 20px !important;
  bottom: 92px !important;
  z-index: 99970;
}
body.chr-ai-open #back-to-top { display: none !important; }
@media (max-width: 576px) {
  .chr-ai-panel { right: 8px; left: 8px; width: auto; bottom: 80px; height: min(70vh, 560px); }
  .chr-ai-fab { right: 14px; bottom: 14px; }
  #back-to-top { right: 14px !important; bottom: 84px !important; }
}
