/* ===== AI 客服聊天浮窗 (2026-08-07) ===== */
.cw-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FF9900;
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform .2s ease, background .2s ease;
}
.cw-button:hover { transform: scale(1.08); background: #e68a00; }
.cw-button .cw-badge {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    background: #d0021b;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
    display: none;
}

.cw-window {
    position: fixed;
    right: 22px;
    bottom: 90px;
    z-index: 9999;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,.28);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.cw-window.open { display: flex; }

.cw-head {
    background: linear-gradient(135deg, #232F3E, #37475A);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.cw-head .cw-logo {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.35);
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.cw-head .cw-logo img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.cw-head .cw-titles { flex: 1; min-width: 0; }
.cw-head .cw-title { font-size: 14px; font-weight: 600; line-height: 1.2; }
.cw-head .cw-sub { font-size: 11px; opacity: .85; }
.cw-head .cw-mode-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #067D62;
    flex-shrink: 0;
}
.cw-head .cw-mode-badge.agent { background: #d0021b; }
.cw-close {
    background: none; border: none;
    color: #fff; font-size: 20px;
    cursor: pointer; padding: 2px 6px;
    opacity: .8; flex-shrink: 0;
}
.cw-close:hover { opacity: 1; }

.cw-product-context {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff7e6;
    border-bottom: 1px solid #ffe1a8;
    font-size: 12px;
    color: #593c00;
    flex-shrink: 0;
}
.cw-product-context img {
    width: 36px; height: 36px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.cw-product-context .cw-pt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cw-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f5f6f7;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cw-msg {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}
.cw-msg.user {
    align-self: flex-end;
    background: #FF9900;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.cw-msg.ai, .cw-msg.agent {
    align-self: flex-start;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e3e6e8;
    border-bottom-left-radius: 4px;
}
.cw-msg.typing { color: #999; font-style: italic; letter-spacing: 1px; }
.cw-time {
    font-size: 10px;
    color: #999;
    margin-top: 3px;
    text-align: right;
}

.cw-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e3e6e8;
    flex-shrink: 0;
    background: #fff;
}
.cw-input-row textarea {
    flex: 1;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13.5px;
    resize: none;
    height: 40px;
    line-height: 1.4;
    outline: none;
    font-family: inherit;
}
.cw-input-row textarea:focus { border-color: #FF9900; box-shadow: 0 0 0 2px rgba(255,153,0,.15); }
.cw-send {
    width: 44px;
    border: none;
    border-radius: 8px;
    background: #FF9900;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.cw-send:hover { background: #e68a00; }
.cw-send:disabled { background: #ccc; cursor: not-allowed; }

/* ===== 送检清单工具条 ===== */
.cw-tools {
    display: flex;
    padding: 6px 14px 0;
    background: #fff;
    flex-shrink: 0;
}
.cw-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #FF9900;
    background: #fff7e6;
    color: #b26a00;
    cursor: pointer;
    transition: all .15s;
}
.cw-tool-btn:hover { background: #ffe9bd; }
.cw-tool-btn.submitted {
    border-color: #d5d9d9;
    background: #f5f6f7;
    color: #067D62;
    cursor: default;
}
.cw-tool-btn.wechat {
    border-color: #07C160;
    background: #e9f9f0;
    color: #07C160;
}
.cw-tool-btn.wechat:hover { background: #d4f3e2; }
.cw-head .cw-logo { cursor: pointer; }

/* ===== 微信二维码弹层 ===== */
.cw-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}
.cw-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}
.cw-modal-card {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    width: 264px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}
.cw-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.cw-modal-close:hover { color: #333; }
.cw-modal-qr {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #eef1f3;
}
.cw-modal-title {
    margin-top: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #232F3E;
}
.cw-modal-sub {
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

/* ===== 送检清单表单 ===== */
.cw-lead-form {
    padding: 12px 14px 10px;
    background: #fff;
    border-top: 1px solid #f0f2f2;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cw-lf-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #232F3E;
}
.cw-lf-input {
    width: 100%;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}
.cw-lf-input:focus { border-color: #FF9900; box-shadow: 0 0 0 2px rgba(255,153,0,.15); }
.cw-lf-area {
    width: 100%;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}
.cw-lf-area:focus { border-color: #FF9900; box-shadow: 0 0 0 2px rgba(255,153,0,.15); }
.cw-lf-actions { display: flex; gap: 8px; }
.cw-lf-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #d5d9d9;
    background: #fff;
    color: #232F3E;
    cursor: pointer;
    transition: all .15s;
}
.cw-lf-btn:hover { background: #f7f8f8; }
.cw-lf-btn.primary {
    background: #FF9900;
    border-color: #FF9900;
    color: #fff;
}
.cw-lf-btn.primary:hover { background: #e68a00; }
.cw-lf-btn:disabled { background: #ccc; border-color: #ccc; cursor: not-allowed; }
.cw-lf-tip {
    font-size: 12px;
    color: #d0021b;
    min-height: 14px;
}

@media (max-width: 480px) {
    .cw-window {
        right: 12px; left: 12px;
        width: auto;
        bottom: 80px;
        height: calc(100vh - 100px);
    }
}
