@charset "UTF-8";
/* ============================================================
   在线客服：全站唯一的悬浮入口 + 聊天面板
   PC 右侧竖条 / 手机右下角圆钮，面板在手机上全屏（100dvh）
   ============================================================ */

.chat-fab{
  position:fixed;right:10px;top:50%;transform:translateY(-50%);z-index:80;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  width:54px;min-height:62px;padding:8px 4px;border:0;border-radius:9px;
  background:var(--blue);color:#fff;cursor:pointer;
  box-shadow:0 6px 20px rgba(6,74,110,.28);
  transition:background .18s,box-shadow .18s;
}
.chat-fab:hover{background:var(--blue-dark);box-shadow:0 8px 26px rgba(6,74,110,.36)}
.chat-fab:focus-visible{outline:3px solid var(--sky);outline-offset:2px}
.chat-fab svg{flex:0 0 auto}
.chat-fab span{font-size:12px;line-height:1.25;letter-spacing:.5px;text-align:center;max-width:48px}
.chat-dot{position:absolute;top:5px;right:5px;width:10px;height:10px;border-radius:50%;background:#ff4d4f;border:2px solid #fff}
.chat-dot[hidden]{display:none}

.chat-panel{
  position:fixed;right:74px;top:50%;transform:translateY(-50%);z-index:81;
  width:360px;max-width:calc(100vw - 92px);
  height:480px;max-height:calc(100dvh - 40px);
  display:flex;flex-direction:column;overflow:hidden;
  background:#fff;border:1px solid var(--line);border-radius:12px;
  box-shadow:0 16px 48px rgba(6,74,110,.28);
}
.chat-panel[hidden]{display:none}

.chat-hd{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:12px 14px;background:linear-gradient(180deg,var(--blue),var(--blue-dark));color:#fff;
}
.chat-hd-txt{display:flex;flex-direction:column;line-height:1.45;min-width:0}
.chat-hd-txt strong{font-size:15px}
.chat-hd-txt small{font-size:11px;color:rgba(255,255,255,.86)}
.chat-close{
  flex:0 0 auto;width:30px;height:30px;border:0;border-radius:50%;
  background:rgba(255,255,255,.18);color:#fff;font-size:20px;line-height:1;cursor:pointer;
}
.chat-close:hover{background:rgba(255,255,255,.32)}
.chat-close:focus-visible{outline:3px solid #ffd466;outline-offset:2px}

.chat-msgs{
  flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;
  padding:14px;overflow-y:auto;background:#f4f9fc;overscroll-behavior:contain;
}
.chat-msg{display:flex;flex-direction:column;max-width:84%}
.chat-msg .who{font-size:11px;color:var(--muted);margin-bottom:3px}
.chat-msg .bubble{
  padding:9px 12px;border-radius:10px;font-size:14px;line-height:1.65;
  white-space:pre-wrap;word-break:break-word;
  background:#fff;border:1px solid var(--line);color:var(--text);
}
.chat-msg.me{align-self:flex-end}
.chat-msg.me .who{text-align:right}
.chat-msg.me .bubble{background:var(--blue);border-color:var(--blue);color:#fff;border-bottom-right-radius:3px}
.chat-msg.other{align-self:flex-start}
.chat-msg.other .bubble{border-bottom-left-radius:3px}
.chat-msg.ai .bubble{background:#eaf5ff;border-color:#cbe4f6}
.chat-msg.sys{align-self:center;max-width:94%}
.chat-msg.sys .bubble{background:transparent;border:0;color:var(--muted);font-size:12px;text-align:center;padding:2px 6px}
.chat-empty{text-align:center;color:var(--muted);font-size:13px;padding:26px 10px}

.chat-quick{display:flex;gap:6px;flex-wrap:wrap;padding:8px 12px 0;background:#fff}
.chat-quick:empty{display:none}
.chat-quick button{
  border:1px solid var(--line);background:var(--blue-lighter);color:var(--blue);
  border-radius:14px;padding:4px 10px;font-size:12px;cursor:pointer;
}
.chat-quick button:hover{background:var(--blue-light)}
.chat-quick button:focus-visible{outline:2px solid var(--sky);outline-offset:2px}

.chat-input{
  display:flex;align-items:flex-end;gap:8px;
  padding:10px 12px;border-top:1px solid var(--line);background:#fff;
}
.chat-input textarea{
  flex:1;min-width:0;min-height:38px;max-height:92px;resize:none;
  border:1px solid var(--line);border-radius:7px;padding:9px 10px;
  font-size:14px;line-height:1.5;color:var(--text);
}
.chat-input textarea:focus{outline:2px solid var(--sky);outline-offset:0;border-color:var(--blue)}
.chat-input button{
  flex:0 0 auto;height:38px;padding:0 16px;border:0;border-radius:7px;
  background:var(--blue);color:#fff;font-size:14px;cursor:pointer;
}
.chat-input button:hover{background:var(--blue-dark)}
.chat-input button:disabled{opacity:.55;cursor:not-allowed}
.chat-input button:focus-visible{outline:3px solid var(--sky);outline-offset:2px}
.chat-foot{padding:0 12px 9px;background:#fff;color:var(--muted);font-size:11px;text-align:center}

/* 平板 / 手机：入口改成右下角圆形悬浮按钮，始终可见 */
@media (max-width:900px){
  .chat-fab{
    top:auto;bottom:16px;right:14px;transform:none;
    width:56px;height:56px;min-height:0;padding:0;border-radius:50%;
  }
  .chat-fab span{display:none}
  .chat-fab svg{width:26px;height:26px}
  .chat-panel{right:78px}
}
/* 手机：聊天面板全屏，避开 iOS 地址栏与刘海 */
@media (max-width:640px){
  .chat-panel{
    top:0;left:0;right:0;bottom:0;transform:none;
    width:100%;max-width:none;height:100vh;height:100dvh;max-height:none;
    border:0;border-radius:0;
  }
  .chat-hd{padding-top:max(12px,env(safe-area-inset-top))}
  .chat-input{padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .chat-msgs{-webkit-overflow-scrolling:touch}
  .chat-msg{max-width:88%}
}
@media print{
  .chat-fab,.chat-panel{display:none!important}
}
