/* =========================================================
   罗素科技 — 智能客服窗口
   ========================================================= */

.cs-root, .cs-root * { box-sizing: border-box; }

/* ---------- 悬浮按钮 ---------- */
.cs-launcher {
  position: fixed; right: 26px; bottom: 26px; z-index: 940;
  width: 58px; height: 58px; border: 0; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ea580c 55%, #c2410c);
  box-shadow: 0 10px 26px rgba(234, 88, 12, .38), 0 2px 6px rgba(17, 24, 39, .12);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .22s cubic-bezier(.34, 1.4, .64, 1), box-shadow .22s;
  animation: cs-pulse 2.6s ease-out infinite;
}
@keyframes cs-pulse {
  0%   { box-shadow: 0 10px 26px rgba(234,88,12,.38), 0 2px 6px rgba(17,24,39,.12), 0 0 0 0 rgba(249,115,22,.45); }
  70%  { box-shadow: 0 10px 26px rgba(234,88,12,.38), 0 2px 6px rgba(17,24,39,.12), 0 0 0 16px rgba(249,115,22,0); }
  100% { box-shadow: 0 10px 26px rgba(234,88,12,.38), 0 2px 6px rgba(17,24,39,.12), 0 0 0 0 rgba(249,115,22,0); }
}
.cs-launcher.cs-open { animation: none; }
.cs-launcher .cs-launch-txt {
  position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #c2410c; font-size: 12px; font-weight: 700;
  line-height: 1; padding: 5px 12px; border-radius: 999px; white-space: nowrap;
  font-family: inherit; box-shadow: 0 3px 12px rgba(17, 24, 39, .16);
  letter-spacing: .05em;
}
.cs-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 32px rgba(234, 88, 12, .46); }
.cs-launcher:active { transform: scale(.96); }
.cs-launcher svg { width: 27px; height: 27px; fill: #fff; }
.cs-launcher .cs-launch-label {
  position: absolute; right: 70px; top: 50%; transform: translateY(-50%);
  background: #111827; color: #fff; font-size: 13px; line-height: 1;
  padding: 9px 13px; border-radius: 9px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s, right .2s;
  font-family: inherit; box-shadow: 0 6px 18px rgba(17, 24, 39, .22);
}
.cs-launcher .cs-launch-label::after {
  content: ""; position: absolute; right: -4px; top: 50%; margin-top: -4px;
  width: 8px; height: 8px; background: #111827; transform: rotate(45deg);
}
.cs-launcher:hover .cs-launch-label { opacity: 1; right: 74px; }
.cs-launcher .cs-dot {
  position: absolute; top: 2px; right: 2px; width: 13px; height: 13px;
  background: #22c55e; border: 2.5px solid #fff; border-radius: 50%;
}
.cs-launcher.cs-open { transform: rotate(90deg) scale(.92); }
.cs-launcher.cs-open .cs-dot { opacity: 0; }
.cs-root.cs-dim .cs-launcher { opacity: 0; pointer-events: none; }

/* ---------- 面板 ---------- */
.cs-panel {
  position: fixed; right: 26px; bottom: 98px; z-index: 945;
  width: 392px; height: min(640px, calc(100vh - 140px));
  background: #fff; border-radius: 18px; overflow: hidden;
  border: 1px solid #eceff3;
  box-shadow: 0 26px 60px rgba(17, 24, 39, .20), 0 4px 14px rgba(17, 24, 39, .07);
  display: flex; flex-direction: column;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .26s cubic-bezier(.34, 1.3, .64, 1), visibility .22s;
}
.cs-panel.cs-show { opacity: 1; visibility: visible; transform: none; }

/* 头部 */
.cs-head {
  background: linear-gradient(120deg, #1f2937, #111827 70%);
  color: #fff; padding: 15px 16px; display: flex; align-items: center; gap: 11px;
  position: relative; flex: 0 0 auto;
}
.cs-head::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 88% 0%, rgba(234, 88, 12, .40), transparent 62%);
  pointer-events: none;
}
.cs-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(135deg, #fb923c, #ea580c);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; letter-spacing: -.5px; position: relative; z-index: 1;
}
.cs-head-txt { flex: 1; min-width: 0; position: relative; z-index: 1; }
.cs-head-txt b { display: block; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.cs-head-txt span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #9ca3af; margin-top: 1px; }
.cs-head-txt span i { width: 6px; height: 6px; background: #22c55e; border-radius: 50%; display: block; }
.cs-head-btn {
  width: 30px; height: 30px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: #d1d5db; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1;
  transition: background .18s, color .18s;
}
.cs-head-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
/* 清空对话按钮：文字药丸，二次点击确认时变橙 */
.cs-head-btn.cs-clear-btn {
  width: auto; padding: 0 11px; font-size: 12px; font-weight: 600;
  border-radius: 999px; white-space: nowrap; letter-spacing: .2px;
}
.cs-head-btn.cs-clear-btn.cs-clear-armed {
  background: #ea580c; color: #fff; box-shadow: 0 2px 10px rgba(234, 88, 12, .45);
}
.cs-head-btn.cs-clear-btn.cs-clear-armed:hover { background: #dc4a08; }

/* 消息区 */
.cs-body {
  flex: 1; overflow-y: auto; padding: 16px 15px 6px;
  background: #f7f8fa; scroll-behavior: auto;
}
.cs-body::-webkit-scrollbar { width: 6px; }
.cs-body::-webkit-scrollbar-thumb { background: #d9dee5; border-radius: 3px; }
.cs-body::-webkit-scrollbar-thumb:hover { background: #c3cad4; }

.cs-msg { display: flex; margin-bottom: 13px; animation: csIn .26s ease both; }
@keyframes csIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.cs-msg.user { justify-content: flex-end; }
.cs-bubble {
  max-width: 86%; padding: 11px 14px; border-radius: 14px; font-size: 14px;
  line-height: 1.72; color: #374151; background: #fff; word-break: break-word;
  border: 1px solid #edf0f4; box-shadow: 0 1px 3px rgba(17, 24, 39, .04);
}
.cs-msg.bot .cs-bubble { border-bottom-left-radius: 5px; }
.cs-msg.user .cs-bubble {
  background: linear-gradient(135deg, #f97316, #ea580c); color: #fff; border: 0;
  border-bottom-right-radius: 5px; box-shadow: 0 3px 10px rgba(234, 88, 12, .26);
}
.cs-bubble p { margin: 0 0 9px; }
.cs-bubble p:last-child { margin-bottom: 0; }
.cs-bubble ul { margin: 0 0 9px; padding-left: 3px; }
.cs-bubble ul:last-child { margin-bottom: 0; }
.cs-bubble li { position: relative; padding-left: 15px; margin-bottom: 5px; }
.cs-bubble li:last-child { margin-bottom: 0; }
.cs-bubble li::before {
  content: ""; position: absolute; left: 3px; top: .66em;
  width: 5px; height: 5px; border-radius: 50%; background: #fb923c;
}
.cs-bubble strong { color: #111827; font-weight: 700; }
.cs-bubble em { font-style: normal; color: var(--orange, #ea580c); font-weight: 700; }

.cs-title {
  font-size: 13.5px; font-weight: 700; color: #111827;
  padding-left: 9px; border-left: 3px solid #ea580c; margin-bottom: 9px; line-height: 1.5;
}

/* 产品卡 */
.cs-prod {
  display: flex; gap: 11px; padding: 10px; border: 1px solid #edf0f4;
  border-radius: 12px; background: #fff; margin-top: 9px; align-items: center;
  transition: border-color .18s, box-shadow .18s;
}
.cs-prod:hover { border-color: #fed7aa; box-shadow: 0 4px 14px rgba(234, 88, 12, .10); }
.cs-prod-img {
  width: 62px; height: 62px; flex: 0 0 auto; border-radius: 9px;
  background: #f7f8fa; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cs-prod-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cs-prod-txt { flex: 1; min-width: 0; }
.cs-prod-txt .b { display: block; font-size: 11px; color: #9ca3af; letter-spacing: .3px; margin-bottom: 2px; }
.cs-prod-txt .n { display: block; font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 2px; line-height: 1.35; }
.cs-prod-txt .s { display: block; font-size: 12.5px; color: #6b7280; line-height: 1.5; }
.cs-prod-txt .t { display: block; font-size: 12px; color: #9ca3af; margin-top: 4px; }
.cs-prod-go {
  flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: #ea580c;
  white-space: nowrap; padding: 6px 9px; border-radius: 8px; background: #fff7ed;
}
.cs-prod-go:hover { background: #ffedd5; }

/* 富文本卡片内的按钮组 */
.cs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.cs-btn {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600;
  padding: 8px 13px; border-radius: 9px; cursor: pointer; border: 1px solid #e5e7eb;
  background: #fff; color: #374151; font-family: inherit; transition: all .18s;
}
.cs-btn:hover { border-color: #fdba74; color: #ea580c; background: #fff7ed; }
.cs-btn.primary {
  background: linear-gradient(135deg, #f97316, #ea580c); border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px rgba(234, 88, 12, .26);
}
.cs-btn.primary:hover { box-shadow: 0 5px 15px rgba(234, 88, 12, .34); color: #fff; }

/* 快捷问题 chips */
.cs-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.cs-chip {
  font-size: 13px; padding: 7px 12px; border-radius: 20px; cursor: pointer;
  background: #fff; border: 1px solid #e5e7eb; color: #4b5563;
  font-family: inherit; transition: all .18s; text-align: left;
}
.cs-chip:hover { border-color: #fdba74; color: #ea580c; background: #fff7ed; transform: translateY(-1px); }

/* 输入中 */
.cs-typing { display: flex; gap: 4px; padding: 13px 15px; }
.cs-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: #fb923c; display: block;
  animation: csBlink 1.25s infinite ease-in-out both;
}
.cs-typing i:nth-child(2) { animation-delay: .18s; }
.cs-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes csBlink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* 留资表单 */
.cs-lead { background: #fff; border: 1px solid #edf0f4; border-radius: 13px; padding: 13px; margin-top: 4px; }
.cs-lead .h { font-size: 13.5px; font-weight: 700; color: #111827; margin-bottom: 3px; }
.cs-lead .d { font-size: 12.5px; color: #9ca3af; margin-bottom: 11px; line-height: 1.6; }
.cs-field { margin-bottom: 9px; }
.cs-field label { display: block; font-size: 12.5px; color: #6b7280; margin-bottom: 4px; }
.cs-field label b { color: #ea580c; }
.cs-field input, .cs-field textarea {
  width: 100%; font-family: inherit; font-size: 13.5px; color: #111827;
  padding: 9px 11px; border: 1px solid #e5e7eb; border-radius: 9px; background: #fff;
  transition: border-color .18s, box-shadow .18s; resize: vertical;
}
.cs-field input:focus, .cs-field textarea:focus {
  outline: 0; border-color: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, .16);
}
.cs-field input.cs-err { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.cs-lead-tip { font-size: 12.5px; margin-top: 8px; line-height: 1.6; }
.cs-lead-tip.ok { color: #16a34a; }
.cs-lead-tip.bad { color: #dc2626; }

/* 底部输入区 */
.cs-form {
  flex: 0 0 auto; border-top: 1px solid #eef1f5; background: #fff; padding: 10px 12px 11px;
}
.cs-form-row { display: flex; gap: 8px; align-items: flex-end; }
.cs-input {
  flex: 1; font-family: inherit; font-size: 14px; color: #111827; line-height: 1.55;
  border: 1px solid #e5e7eb; border-radius: 11px; padding: 10px 12px; resize: none;
  max-height: 96px; background: #fff; transition: border-color .18s, box-shadow .18s;
}
.cs-input:focus { outline: 0; border-color: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, .16); }
.cs-send {
  flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(135deg, #f97316, #ea580c);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(234, 88, 12, .28); transition: transform .18s, box-shadow .18s;
}
.cs-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(234, 88, 12, .36); }
.cs-send:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.cs-send svg { width: 19px; height: 19px; fill: #fff; }
.cs-foot-note { font-size: 11.5px; color: #b6bdc7; text-align: center; margin-top: 7px; line-height: 1.5; }
.cs-foot-note a { color: #9ca3af; text-decoration: underline; }

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  .cs-launcher { right: 16px; bottom: 30px; width: 54px; height: 54px; }
  .cs-panel {
    right: 0; bottom: 0; left: 0; top: 0; width: auto; height: auto;
    border-radius: 0; max-height: none;
    transform: translateY(100%);
  }
  .cs-panel.cs-show { transform: none; }
  .cs-head { padding-top: 18px; }
  .cs-bubble { max-width: 92%; }
  .cs-launch-label { display: none; }
}

@media print { .cs-root { display: none !important; } }
