/* ============================================================
   在线客服悬浮窗 · 明亮现代风
   ============================================================ */
.cw{position:fixed;right:24px;bottom:24px;z-index:9999;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}
.cw button{font-family:inherit;cursor:pointer}
.cw svg{width:20px;height:20px}

/* 启动按钮：蓝色圆形 + 对话气泡图标 */
.cw-launcher{
  position:relative;width:56px;height:56px;border:none;border-radius:50%;
  background:#2563eb;color:#fff;display:flex;align-items:center;justify-content:center;
  box-shadow:0 8px 24px rgba(37,99,235,.28);transition:transform .25s,box-shadow .25s;
}
.cw-launcher:hover{transform:translateY(-3px);box-shadow:0 12px 30px rgba(37,99,235,.34)}
.cw-launcher.hidden-x{opacity:0;transform:scale(.7);pointer-events:none}
.cw-launcher-icon{display:flex}
.cw-launcher-icon svg{width:26px;height:26px}
.cw-badge{
  position:absolute;top:-3px;right:-3px;min-width:19px;height:19px;padding:0 5px;
  border-radius:10px;background:#ef4444;color:#fff;
  font-size:10px;font-weight:800;display:flex;align-items:center;justify-content:center;border:2px solid #fff;
}
.cw-tip{
  position:absolute;right:66px;top:50%;transform:translateY(-50%);
  background:#fff;color:#334155;font-size:11px;font-weight:600;
  padding:8px 12px;border-radius:7px;white-space:nowrap;opacity:0;pointer-events:none;transition:.2s;
  border:1px solid #e5e9f0;box-shadow:0 6px 20px rgba(15,23,42,.1);
}
.cw-launcher:hover .cw-tip{opacity:1;transform:translateY(-50%)}
.cw-tip::after{content:"";position:absolute;right:-5px;top:50%;margin-top:-4px;border:4px solid transparent;border-left-color:#e5e9f0;border-right:0}

/* 聊天面板 */
.cw-panel{
  position:absolute;right:0;bottom:72px;width:372px;height:548px;max-height:calc(100vh - 110px);
  background:#fff;border-radius:14px;
  box-shadow:0 24px 60px rgba(15,23,42,.16),0 0 0 1px rgba(15,23,42,.04);
  display:flex;flex-direction:column;overflow:hidden;
  opacity:0;transform:translateY(16px) scale(.98);transform-origin:bottom right;
  pointer-events:none;transition:opacity .25s,transform .25s;
  border:1px solid #e5e9f0;
}
.cw-panel.open{opacity:1;transform:none;pointer-events:auto}
.cw-head{
  height:66px;flex-shrink:0;background:#fff;color:#0f172a;
  display:flex;align-items:center;justify-content:space-between;padding:0 16px;
  border-bottom:1px solid #e5e9f0;
}
.cw-agent{display:flex;align-items:center;gap:11px}
.cw-avatar{
  width:38px;height:38px;border-radius:50%;background:#eff6ff;border:1px solid #bfdbfe;
  display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px;color:#2563eb;
}
.cw-agent b{font-size:13.5px;display:block}
.cw-agent small{font-size:10.5px;color:#64748b;display:flex;align-items:center;gap:5px;margin-top:2px}
.cw-dot{width:6px;height:6px;border-radius:50%;background:#16a34a;display:inline-block}
.cw-head-actions{display:flex;gap:2px}
.cw-head-actions button{width:32px;height:32px;border:none;background:transparent;color:#94a3b8;border-radius:7px;display:flex;align-items:center;justify-content:center;transition:.2s}
.cw-head-actions button:hover{background:#f1f5f9;color:#334155}
.cw-head-actions button svg{width:16px;height:16px}

/* 消息区 */
.cw-body{flex:1;min-height:0;overflow-y:auto;padding:18px 16px;background:#f8fafc}
.cw-body::-webkit-scrollbar{width:5px}.cw-body::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:3px}
.cw-system{text-align:center;font-size:10.5px;color:#94a3b8;margin:2px 0 16px}
.cw-msg{margin-bottom:14px;display:flex;flex-direction:column;opacity:0;transform:translateY(6px);animation:cwIn .3s forwards}
@keyframes cwIn{to{opacity:1;transform:none}}
.cw-msg.mine{align-items:flex-end}
.cw-msg.theirs{align-items:flex-start}
.cw-bubble{max-width:80%;padding:10px 13px;border-radius:12px;font-size:13px;line-height:1.65;word-break:break-word}
.cw-msg.theirs .cw-bubble{background:#fff;color:#334155;border:1px solid #e5e9f0;border-top-left-radius:3px;box-shadow:0 1px 2px rgba(15,23,42,.03)}
.cw-msg.mine .cw-bubble{background:#2563eb;color:#fff;border-top-right-radius:3px;font-weight:500}
.cw-bubble img{max-width:100%;max-height:180px;border-radius:8px;display:block}
.cw-bubble video{max-width:100%;max-height:200px;border-radius:8px;display:block}
.cw-time{font-size:9.5px;color:#94a3b8;margin-top:4px;padding:0 2px}

/* 快捷问题 */
.cw-quick{padding:0 14px 10px;display:flex;gap:6px;flex-wrap:wrap;background:#f8fafc;border-top:1px solid #eef1f6}
.cw-quick button{
  font-size:11px;padding:6px 10px;border:1px solid #e2e8f0;background:#fff;color:#475569;
  border-radius:100px;transition:.2s;
}
.cw-quick button:hover{border-color:#bfdbfe;color:#2563eb;background:#eff6ff}

/* 工具栏 */
.cw-toolbar{display:flex;align-items:center;gap:4px;padding:6px 12px;border-top:1px solid #e5e9f0;position:relative;background:#fff}
.cw-toolbar>button{width:34px;height:34px;border:none;background:transparent;color:#94a3b8;border-radius:7px;display:flex;align-items:center;justify-content:center;transition:.2s}
.cw-toolbar>button:hover{background:#eff6ff;color:#2563eb}
.cw-toolbar>button svg{width:18px;height:18px}
.cw-emoji-panel{
  position:absolute;bottom:46px;left:12px;width:288px;max-height:190px;overflow-y:auto;
  background:#fff;border:1px solid #e5e9f0;border-radius:10px;box-shadow:0 12px 40px rgba(15,23,42,.14);
  padding:8px;display:none;grid-template-columns:repeat(8,1fr);gap:2px;
}
.cw-emoji-panel::-webkit-scrollbar{width:5px}.cw-emoji-panel::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:3px}
.cw-emoji-panel.show{display:grid}
.cw-emoji-panel button{border:none;background:transparent;font-size:18px;padding:5px;border-radius:5px;line-height:1}
.cw-emoji-panel button:hover{background:#eff6ff}

/* 输入区 */
.cw-input{display:flex;align-items:center;gap:8px;padding:8px 12px 12px;border-top:1px solid #e5e9f0;background:#fff}
.cw-input input{
  flex:1;min-width:0;padding:10px 13px;border:1px solid #d9e0ea;border-radius:8px;outline:none;
  font-size:13px;background:#fff;color:#0f172a;transition:.2s;
}
.cw-input input::placeholder{color:#94a3b8}
.cw-input input:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.cw-input button{
  width:40px;height:40px;flex-shrink:0;border:none;border-radius:8px;background:#2563eb;color:#fff;
  display:flex;align-items:center;justify-content:center;transition:.2s;
}
.cw-input button:hover{background:#1d4ed8}
.cw-input button svg{width:17px;height:17px}

/* 移动端 */
@media(max-width:480px){
  .cw{right:14px;bottom:14px}
  .cw-panel{width:calc(100vw - 28px);height:70vh;right:0}
}
