/* 智能客服弹窗样式 (PC + 移动自适应) */
#kefuWidget * { box-sizing: border-box; margin: 0; padding: 0; }
#kefuWidget {
    position: fixed; right: 20px; bottom: 20px; z-index: 99999;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}
/* 悬浮球 */
#kefuBall {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #54b758;
    color: #fff;
    cursor: pointer;
    text-align: center;
    line-height: 60px;
    box-shadow: 0 4px 14px rgba(30,78,121,.45);
    /* font-size: 16px; */
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform .2s;
}
#kefuBall:hover { transform: scale(1.06); }
#kefuBall .kdot { font-size: 24px; line-height: 26px; display: none !important; }
#kefuBall .ktxt {font-size: 14px;line-height: 16px;width: 2.2em;letter-spacing:1px; text-align:center;}
#kefuBall .kbadge {
    position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; line-height: 18px;
    background: #f5222d; border-radius: 9px; font-size: 11px; text-align: center;
    padding: 0 4px; display: none;
}
/* 聊天窗 */
#kefuPanel {
    position: fixed; right: 20px; bottom: 90px; width: 360px; height: 520px;
    background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18);
    overflow: hidden; display: none; flex-direction: column;
    border: 1px solid #e3e8ef;
}
#kefuPanel.open { display: flex; }
/* 头部 */
#kefuHead {
    background: #54b758;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
}
#kefuHead .ht { flex: 1; }
#kefuHead .ht b { font-size: 16px; display: block; }
#kefuHead .ht span { font-size: 12px; opacity: .85; }
#kefuHead .close { cursor: pointer; font-size: 20px; opacity: .85; padding: 0 4px; }
#kefuHead .close:hover { opacity: 1; }
/* 消息区 */
#kefuMsg {
    flex: 1; overflow-y: auto; padding: 14px; background: #f5f7fa;
    display: flex; flex-direction: column; gap: 12px;
}
.kefu-row { display: flex; align-items: flex-end; gap: 8px; }
.kefu-row.user { justify-content: flex-end; }
.kefu-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff;
    overflow: hidden;
}
.kefu-row .kefu-avatar { background: #54b758; }
.kefu-row.user .kefu-avatar {background: #54b758;order: 2;}
/* 客服图片头像容器: 清背景色 */
.kefu-row .kefu-avatar.img-box { background: transparent; }
.kefu-avatar-img {
    width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%;
}
.kefu-bubble {
    max-width: 74%; padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.5;
    word-break: break-word; white-space: pre-wrap;
}
.kefu-row .kefu-bubble {background: #fff;border: 1px solid #e3e8ef;border-top-left-radius: 3px;border-radius: 5px;padding: 5px 8px !important;}
.kefu-row.user .kefu-bubble {background: #54b758;color: #fff;border-radius: 5px;padding: 5px 8px !important;border-top-right-radius: 3px;}
.kefu-typing { color: #999; font-size: 13px; padding: 4px 0; }
/* 快捷问题 */
#kefuQuick { padding: 10px 14px 8px; display: flex; flex-wrap: wrap; gap: 6px; }
#kefuQuick .q {
    border: 1px solid #cfe0f2;
    color: #54b758;
    background: #f4f8fc;
    border-radius: 14px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
}
#kefuQuick .q:hover { background: #e4eef8; }
/* 输入区 */
#kefuInput { border-top: 1px solid #eef1f5; padding: 10px 12px; background: #fff; }
#kefuInput textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: none;
    height: 60px;
    padding: 12px 10px;
    font-size: 14px;
    outline: none;
}
#kefuInput textarea:focus { border-color: #54b758; }
#kefuInputBar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
#kefuInputBar .tip { font-size: 12px; color: #999; }
#kefuSend {
    background: #54b758;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 18px;
    font-size: 14px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 16px;
    cursor: pointer;
}
#kefuSend:hover { background: #43a147; }
#kefuSend:disabled { background: #babfc3; cursor: not-allowed; }
#kefuTransferBtn {
    background: #fff;
    color: #54b758;
    border: 1px solid #54b758;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 16px;
    cursor: pointer;
    margin-right: 6px;
}
#kefuTransferBtn:hover { background: #eef5fb; }
/* ========== 移动端 ========== */
@media (max-width: 640px) {
    #kefuWidget { right: 12px; bottom: 12px; }
    #kefuBall { width: 52px; height: 52px; line-height: 52px; }
    #kefuPanel {
        right: 0; bottom: 0; width: 100%; height: 100%;
        border-radius: 0; height: 100vh; border: none;
    }
}
