/* ============================================================
   球刻 · 在线客服挂件（AI 助手 + 转人工）
   与 tokens.css / simple.css 同一套令牌，全部选择器以 .qcs- 前缀，不污染站点样式。
   ============================================================ */

/* ---------- 悬浮入口（避开底部「加微信」条） ---------- */
.qcs-fab{position:fixed;right:16px;bottom:112px;z-index:45;
  display:inline-flex;align-items:center;gap:7px;height:46px;padding:0 16px 0 13px;
  border-radius:var(--r-pill);background:var(--brand);color:#fff;font-size:14px;font-weight:600;
  box-shadow:0 8px 22px rgba(11,107,79,.34);cursor:pointer;border:0;
  -webkit-tap-highlight-color:transparent}
.qcs-fab:active{background:var(--brand-600)}
.qcs-fab svg{width:20px;height:20px;fill:#fff;stroke:none;flex:none}
.qcs-fab .qcs-dot{position:absolute;top:6px;right:9px;width:8px;height:8px;border-radius:50%;
  background:#4ade80;box-shadow:0 0 0 2px var(--brand)}
.qcs-fab.qcs-hide{display:none}

/* ---------- 面板 ---------- */
.qcs-panel{position:fixed;right:16px;bottom:16px;z-index:70;
  width:378px;height:min(586px,calc(100vh - 32px));
  background:var(--surface);border-radius:14px;overflow:hidden;
  box-shadow:0 18px 48px rgba(12,26,20,.26);display:none;flex-direction:column;
  font-family:var(--sans);color:var(--ink)}
.qcs-panel.qcs-on{display:flex}

/* 头部 */
.qcs-hd{flex:none;display:flex;align-items:center;gap:9px;padding:11px 12px;
  background:linear-gradient(135deg,var(--brand-700),var(--brand));color:#fff}
.qcs-hd .qcs-ava{width:32px;height:32px;border-radius:9px;background:#ffffff26;display:grid;place-items:center;
  font-size:13px;font-weight:800;flex:none}
.qcs-hd .qcs-tt{flex:1;min-width:0}
.qcs-hd .qcs-tt b{display:block;font-size:14px;font-weight:700;line-height:1.25}
.qcs-hd .qcs-tt span{display:block;font-size:11px;color:#ffffffc9;margin-top:2px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.qcs-hd .qcs-hb{flex:none;height:28px;padding:0 10px;border-radius:var(--r-pill);
  background:#ffffff26;color:#fff;font-size:12px;font-weight:600;display:inline-flex;align-items:center;gap:4px}
.qcs-hd .qcs-hb:active{background:#ffffff40}
.qcs-hd .qcs-x{flex:none;width:28px;height:28px;border-radius:8px;color:#fff;font-size:17px;line-height:1;
  display:grid;place-items:center}
.qcs-hd .qcs-x:active{background:#ffffff26}

/* 消息区 */
.qcs-bd{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:12px 12px 4px;
  background:var(--surface-2);-webkit-overflow-scrolling:touch}
.qcs-m{display:flex;margin-bottom:10px}
.qcs-m.qcs-me{justify-content:flex-end}
.qcs-b{max-width:82%;padding:9px 11px;border-radius:12px;font-size:13.5px;line-height:1.62;
  white-space:pre-wrap;word-break:break-word}
.qcs-m.qcs-ai .qcs-b{background:var(--surface);border:1px solid var(--line);border-top-left-radius:4px;
  box-shadow:var(--sh-1)}
.qcs-m.qcs-me .qcs-b{background:var(--brand);color:#fff;border-top-right-radius:4px}
.qcs-m.qcs-sys{justify-content:center}
.qcs-m.qcs-sys .qcs-b{background:transparent;color:var(--ink-3);font-size:11.5px;padding:2px 6px;max-width:100%;
  text-align:center;line-height:1.7}
.qcs-b .qcs-strong{color:var(--price);font-weight:700}

/* 打字动画 */
.qcs-typing{display:inline-flex;gap:3px;align-items:center;height:14px}
.qcs-typing i{width:5px;height:5px;border-radius:50%;background:var(--ink-4);animation:qcs-blink 1.1s infinite}
.qcs-typing i:nth-child(2){animation-delay:.16s}
.qcs-typing i:nth-child(3){animation-delay:.32s}
@keyframes qcs-blink{0%,60%,100%{opacity:.28;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}

/* 快捷问 / 内联按钮 */
.qcs-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 12px}
.qcs-chip{height:30px;padding:0 11px;border-radius:var(--r-pill);background:var(--brand-050);
  color:var(--brand);border:1px solid var(--brand-100);font-size:12.5px;font-weight:600}
.qcs-chip:active{background:var(--brand-100)}
.qcs-act{display:inline-flex;align-items:center;gap:5px;margin:6px 0 12px;height:32px;padding:0 13px;
  border-radius:var(--r-pill);background:var(--brand);color:#fff;font-size:12.5px;font-weight:600}
.qcs-act.qcs-ghost{background:var(--surface);color:var(--brand);border:1px solid var(--brand-100)}

/* 底部输入 */
.qcs-ft{flex:none;border-top:1px solid var(--line);background:var(--surface);padding:8px 10px calc(8px + env(safe-area-inset-bottom))}
.qcs-tip{font-size:10.5px;color:var(--ink-4);text-align:center;line-height:1.5;margin-bottom:6px}
.qcs-in{display:flex;align-items:flex-end;gap:8px}
.qcs-in textarea{flex:1;min-height:38px;max-height:96px;padding:9px 11px;border-radius:10px;resize:none;
  background:var(--surface-3);font-size:13.5px;line-height:1.5;border:1px solid transparent;font-family:inherit}
.qcs-in textarea:focus{border-color:var(--brand-100);background:var(--surface)}
.qcs-send{flex:none;width:38px;height:38px;border-radius:10px;background:var(--brand);color:#fff;
  display:grid;place-items:center}
.qcs-send[disabled]{background:var(--ink-4);cursor:not-allowed}
.qcs-send svg{width:19px;height:19px;fill:#fff;stroke:none}
.qcs-stop{flex:none;height:38px;padding:0 12px;border-radius:10px;background:var(--surface-3);
  color:var(--ink-2);font-size:12.5px;font-weight:600}

/* ---------- 转人工层 ---------- */
.qcs-hand{position:absolute;inset:0;z-index:2;background:var(--surface);display:none;flex-direction:column}
.qcs-hand.qcs-on{display:flex}
.qcs-hand .qcs-hb2{flex:none;display:flex;align-items:center;gap:8px;padding:11px 12px;border-bottom:1px solid var(--line)}
.qcs-hand .qcs-hb2 b{flex:1;font-size:14px}
.qcs-hand .qcs-hb2 button{width:28px;height:28px;border-radius:8px;font-size:16px;color:var(--ink-2)}
.qcs-hand .qcs-hc{flex:1;overflow-y:auto;padding:16px 18px 20px;text-align:center}
.qcs-hand img{width:196px;height:196px;border-radius:10px;object-fit:contain;background:var(--surface-3);
  border:1px solid var(--line)}
.qcs-hand h4{font-size:15px;margin:12px 0 4px}
.qcs-hand .qcs-hp{font-size:12px;color:var(--ink-3);line-height:1.7}
.qcs-hand .qcs-tel{display:flex;align-items:center;gap:8px;margin:14px 0 8px;padding:12px;border-radius:11px;
  background:var(--brand-050);border:1px solid var(--brand-100);text-align:left}
.qcs-hand .qcs-tel .qcs-tl{flex:1;min-width:0}
.qcs-hand .qcs-tel b{display:block;font-size:16px;font-weight:700;color:var(--brand);letter-spacing:.02em}
.qcs-hand .qcs-tel span{display:block;font-size:11px;color:var(--ink-3);margin-top:3px}
.qcs-hand .qcs-tel a{flex:none;height:34px;padding:0 13px;border-radius:var(--r-pill);background:var(--brand);
  color:#fff;font-size:13px;font-weight:600;display:inline-flex;align-items:center;gap:4px}
/* 客人自愿留联系方式（选填）+ 同意提示 */
.qcs-hand .qcs-leave{display:flex;gap:8px;margin:14px 0 6px}
.qcs-hand .qcs-leave input{flex:1;min-width:0;height:38px;border-radius:10px;background:var(--surface-3);
  padding:0 11px;font-size:13px;border:1px solid transparent;font-family:inherit}
.qcs-hand .qcs-leave input:focus{border-color:var(--brand-100);background:var(--surface)}
.qcs-hand .qcs-leave input:disabled{color:var(--ink-3)}
.qcs-hand .qcs-leave button{flex:none;height:38px;padding:0 14px;border-radius:10px;background:var(--brand);
  color:#fff;font-size:13px;font-weight:600}
.qcs-hand .qcs-consent{font-size:11px;color:var(--ink-3);line-height:1.7;text-align:left}
.qcs-hand .qcs-leave-ok{margin-top:8px;min-height:16px;font-size:12px;font-weight:600;color:var(--down);text-align:left}
.qcs-hand .qcs-hr{display:flex;gap:8px;margin-top:6px}
.qcs-hand .qcs-hr button{flex:1;height:38px;border-radius:10px;background:var(--surface-3);color:var(--ink-2);
  font-size:13px;font-weight:600}
.qcs-hand .qcs-hr button.qcs-pri{background:var(--brand);color:#fff}
.qcs-hand .qcs-hours{margin-top:14px;font-size:11.5px;color:var(--ink-3);line-height:1.8;
  background:var(--surface-2);border-radius:10px;padding:10px}
.qcs-hand .qcs-ok{display:none;margin-top:12px;font-size:12px;color:var(--down);font-weight:600}

/* ---------- 手机：整屏 ---------- */
@media(max-width:560px){
  .qcs-fab{bottom:104px;right:12px}
  .qcs-panel{left:0;right:0;top:0;bottom:0;width:100%;height:100%;border-radius:0}
  .qcs-hd{padding-top:calc(11px + env(safe-area-inset-top))}
  .qcs-bd{padding:12px 12px 4px}
  .qcs-hand img{width:180px;height:180px}
}
@media(max-width:360px){ .qcs-fab span{display:none} .qcs-fab{padding:0 13px} }
/* 窄屏：头部三个按钮（清空 / 转人工 / ×）要放得下 → 藏头像、按钮收紧 */
@media(max-width:410px){
  .qcs-hd .qcs-ava{display:none}
  .qcs-hd .qcs-hb{padding:0 8px;font-size:11.5px}
  .qcs-hd{padding-left:10px;padding-right:10px}
}
