/* ===== Smart Chatbot / 智能客服 (紧凑版) ===== */
#cb-panel[hidden]{display:none!important}
#cb-fab{
    position:fixed;right:44px;bottom:112px;width:52px;height:52px;border-radius:50%;
    background:#4945FF;color:#fff;border:none;cursor:pointer;
    box-shadow:0 4px 14px rgba(73,69,255,.45);z-index:10020;
    display:flex;align-items:center;justify-content:center;transition:transform .15s}
#cb-fab:hover{transform:scale(1.08)}
#cb-fab .cb-fab-text{position:absolute;top:-28px;left:50%;transform:translateX(-50%);background:#1f2937;color:#fff;font-size:11px;padding:3px 8px;border-radius:8px;white-space:nowrap;display:none}
#cb-fab:hover .cb-fab-text{display:block}

#cb-panel{position:fixed;right:44px;bottom:180px;width:352px;max-width:calc(100vw - 20px);height:680px;max-height:calc(100vh - 148px);background:#fff;border-radius:16px;box-shadow:0 24px 60px rgba(15,23,42,.30);z-index:10021;display:flex;flex-direction:column;overflow:hidden;font-family:-apple-system,"Microsoft YaHei",sans-serif}
.cb-head{background:linear-gradient(135deg,#5b57ff 0%,#4945FF 100%);color:#fff;padding:13px 16px;display:flex;align-items:center;justify-content:space-between}
.cb-head strong{font-size:15px;font-weight:600;letter-spacing:.3px}
.cb-head span{font-size:12px;opacity:.95}
#cb-close{background:none;border:none;color:#fff;font-size:18px;cursor:pointer;line-height:1;padding:2px 4px}

.cb-body{flex:1;overflow-y:auto;padding:14px 16px;scroll-behavior:smooth}
.cb-chips{display:flex;gap:5px;padding:2px;flex-wrap:wrap;max-height:56px;overflow:hidden}
.cb-chip{background:#f0f0ff;color:#3734d9;border:1px solid #dcdaf7;border-radius:999px;font-size:11px;padding:3px 10px;cursor:pointer;transition:background .15s;white-space:nowrap;max-width:130px;overflow:hidden;text-overflow:ellipsis}
.cb-chip:hover{background:#e4e3fb}

.cb-row{display:flex;margin-bottom:9px}
.cb-row.user{justify-content:flex-end}
.cb-bubble{max-width:85%;padding:10px 13px;border-radius:15px;font-size:13px;line-height:1.6;word-break:break-word;white-space:pre-wrap}
.cb-row.bot .cb-bubble{background:#f1f5f9;color:#1f2937;border-top-left-radius:4px}
.cb-row.user .cb-bubble{background:linear-gradient(135deg,#5b57ff,#4945FF);color:#fff;border-top-right-radius:4px}
.cb-typing .cb-bubble{display:inline-flex;gap:4px;align-items:center;padding:8px 10px}
.cb-typing .cb-bubble span{width:5px;height:5px;background:#a5b4fc;border-radius:50%;display:inline-block;animation:cbb 1s infinite}
.cb-typing .cb-bubble span:nth-child(2){animation-delay:.15s}
.cb-typing .cb-bubble span:nth-child(3){animation-delay:.3s}
@keyframes cbb{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-4px)}}

.cb-foot{border-top:1px solid #e5e7eb;padding:11px 12px;background:#fff;overflow-y:auto;max-height:48%;flex-shrink:0}
.cb-inputrow{display:flex;gap:9px}
#cb-img{width:36px;height:36px;flex:0 0 36px;border:none;background:#eef2ff;color:#3734d9;border-radius:10px;cursor:pointer;font-size:15px;display:flex;align-items:center;justify-content:center}
#cb-img:hover{background:#e0e7ff}
#cb-input{flex:1;border:1px solid #d1d5db;border-radius:10px;padding:9px 12px;font-size:13px;outline:none}
#cb-input:focus{border-color:#4945FF}
#cb-send{width:36px;height:36px;border:none;background:linear-gradient(135deg,#5b57ff,#4945FF);color:#fff;border-radius:10px;cursor:pointer;font-size:15px}
#cb-send:disabled{background:#b9b5f5;cursor:default}
.cb-img-preview{display:flex;align-items:center;gap:6px;margin-top:5px;padding:4px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;position:relative}
.cb-img-preview img{max-width:90px;max-height:90px;border-radius:5px;border:1px solid #d1d5db}
.cb-img-remove{position:absolute;top:3px;right:3px;width:18px;height:18px;border:none;background:#ef4444;color:#fff;border-radius:50%;cursor:pointer;font-size:12px;line-height:1}
.cb-bubble-img{display:block;max-width:180px;max-height:180px;border-radius:7px;margin-bottom:3px;border:1px solid #e5e7eb}
#cb-lead-btn{width:100%;margin-top:6px;padding:5px;background:#fff;color:#3734d9;border:1px dashed #4945FF;border-radius:7px;cursor:pointer;font-size:11px}
#cb-lead-btn:hover{background:#f0f0ff}
#cb-lead-btn.cb-lead-open{background:#f0f0ff;border-style:solid}
.cb-leadform{margin-top:5px;padding:7px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px}
.cb-leadform input{width:100%;box-sizing:border-box;margin-bottom:5px;padding:5px 7px;border:1px solid #d1d5db;border-radius:6px;font-size:12px;outline:none}
.cb-leadform input:focus{border-color:#4945FF}
.cb-leadform textarea{width:100%;box-sizing:border-box;min-height:52px;padding:5px 7px;border:1px solid #d1d5db;border-radius:6px;font-size:12px;resize:vertical;outline:none}
.cb-leadform textarea:focus{border-color:#4945FF}
.cb-lead-btns{display:flex;gap:6px;margin-top:5px}
.cb-lead-btns .cb-submit{flex:1;padding:6px;background:#4945FF;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:11px}
.cb-lead-btns .cb-submit:disabled{background:#b9b5f5;cursor:default}
.cb-lead-cancel{flex:0 0 60px;padding:6px;background:#fff;color:#6b7280;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-size:11px}
.cb-lead-cancel:hover{background:#f3f4f6}

@media (max-width:767px){
    #cb-fab{right:15px;bottom:84px;width:48px;height:48px}
    #cb-panel{right:0;left:0;bottom:0;width:100%;height:80vh;max-height:80vh;border-radius:12px 12px 0 0}
}

/* 悬浮球对话气球：首次停留超过10秒后弹出 */
#cb-fab-bubble{position:absolute;bottom:calc(100% + 14px);right:-14px;width:178px;max-width:178px;background:#1f2937;color:#fff;font-size:12px;line-height:1.45;padding:9px 12px;border-radius:12px;box-shadow:0 6px 18px rgba(15,23,42,.28);opacity:0;transform:translateY(8px) scale(.85);transform-origin:bottom right;pointer-events:none;z-index:10030}
#cb-fab-bubble.show{opacity:1;transform:translateY(0) scale(1);animation:cbfbb .5s cubic-bezier(.34,1.56,.64,1)}
#cb-fab-bubble.show::after{content:'';position:absolute;bottom:-6px;right:20px;width:12px;height:12px;background:#1f2937;transform:rotate(45deg);border-radius:2px}
@keyframes cbfbb{0%{opacity:0;transform:translateY(8px) scale(.8)}100%{opacity:1;transform:translateY(0) scale(1)}}
#cb-fab.bob{animation:cbfba 1.8s ease-in-out infinite}
@keyframes cbfba{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
