/* ==========================================================================
   在线客服 · 用户端悬浮组件（墨韵金主题）
   ========================================================================== */

.cs-w-fab {
    position: fixed;
    right: 16px;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid rgba(169, 131, 74, .35);
    background: linear-gradient(160deg, #b8935a, #8a6a37);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px -8px rgba(90, 68, 34, .65);
    cursor: pointer;
    z-index: 99000;
    font-size: 13px;
    letter-spacing: 1px;
    transition: transform .18s ease, box-shadow .18s ease;
    /* 拖动手势：不触发页面滚动/长按菜单/文字选择 */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    cursor: grab;
}

.cs-w-fab:active {
    transform: scale(.94);
}

/* 拖动中：取消缩放与过渡，避免跟手卡顿 */
.cs-w-fab.cs-w-dragging,
.cs-w-fab.cs-w-dragging:active {
    transform: none;
    transition: none;
    cursor: grabbing;
    box-shadow: 0 10px 26px -10px rgba(90, 68, 34, .8);
}

.cs-w-fab .cs-w-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #a5342b;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.cs-w-panel {
    position: fixed;
    right: 16px;
    bottom: calc(142px + env(safe-area-inset-bottom, 0px));
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 520px;
    max-height: calc(100vh - 200px);
    background: #fffdf8;
    border: 1px solid #e2d9c9;
    border-radius: 14px;
    box-shadow: 0 20px 50px -22px rgba(27, 25, 22, .45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99001;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    transform: translateY(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.cs-w-panel.on {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cs-w-hd {
    padding: 12px 14px;
    background: linear-gradient(160deg, #fdf8ee, #f6eddc);
    border-bottom: 1px solid #eee6d8;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.cs-w-hd .cs-w-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(160deg, #c9a96a, #a9834a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex: 0 0 30px;
}

.cs-w-hd .cs-w-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1b1916;
    line-height: 1.3;
}

.cs-w-hd .cs-w-sub {
    font-size: 11px;
    color: #8b8478;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.cs-w-hd .cs-w-sub > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-w-hd > div:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.cs-w-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9c9488;
    display: inline-block;
}

.cs-w-dot.on {
    background: #2f6b58;
    box-shadow: 0 0 0 2px rgba(47, 107, 88, .16);
}

.cs-w-x {
    margin-left: auto;
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: #8b8478;
    cursor: pointer;
    padding: 2px 4px;
}

.cs-w-flow {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f7f2e9;
    -webkit-overflow-scrolling: touch;
}

.cs-w-tip {
    text-align: center;
    font-size: 11px;
    color: #9c9488;
    margin: 6px 0 10px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 每日欢迎语：卡片式提示，保留原文换行，提高可读性 */
.cs-w-tip-welcome {
    text-align: left;
    font-size: 12.5px;
    color: #6b6355;
    margin: 8px 0 12px;
    line-height: 1.75;
    background: #fffdf8;
    border: 1px solid #ece0cb;
    border-radius: 10px;
    padding: 9px 11px;
    box-shadow: 0 1px 2px rgba(120, 96, 60, .06);
}

.cs-w-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.cs-w-row.me {
    flex-direction: row-reverse;
}

.cs-w-row .cs-w-a {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: #ece3d2;
    color: #7a6a4c;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-w-row.me .cs-w-a {
    background: #dfe9e3;
    color: #2f6b58;
}

.cs-w-bub {
    max-width: 74%;
    background: #fff;
    border: 1px solid #eee6d8;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.6;
    color: #262320;
    word-break: break-word;
    white-space: pre-wrap;
}

.cs-w-row.me .cs-w-bub {
    background: #eef6f1;
    border-color: #d6e6dc;
}

.cs-w-bub img {
    display: block;
    max-width: 100%;
    max-height: 190px;
    border-radius: 6px;
    cursor: zoom-in;
}

.cs-w-time {
    font-size: 10px;
    color: #9c9488;
    margin-top: 3px;
}

.cs-w-sys {
    text-align: center;
    font-size: 11px;
    color: #9c9488;
    margin: 6px 0;
}

.cs-w-more {
    text-align: center;
    font-size: 11.5px;
    color: #8b8478;
    padding: 4px 0 8px;
    cursor: pointer;
}

.cs-w-ft {
    border-top: 1px solid #eee6d8;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #fffdf8;
    flex: 0 0 auto;
}

.cs-w-inrow {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.cs-w-inrow textarea {
    flex: 1;
    min-height: 38px;
    max-height: 96px;
    padding: 8px 10px;
    border: 1px solid #e2d9c9;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    background: #fff;
    color: #1b1916;
    line-height: 1.5;
}

.cs-w-inrow textarea:focus {
    border-color: #c9a96a;
}

.cs-w-btn {
    border: 1px solid #e2d9c9;
    background: #fff;
    border-radius: 10px;
    height: 38px;
    min-width: 38px;
    padding: 0 12px;
    font-size: 13px;
    color: #5c564c;
    cursor: pointer;
}

.cs-w-btn.send {
    background: linear-gradient(160deg, #b8935a, #8a6a37);
    border-color: #8a6a37;
    color: #fff;
}

.cs-w-btn:disabled {
    opacity: .55;
}

.cs-w-closed {
    font-size: 11.5px;
    color: #a5342b;
    padding: 0 2px 6px;
}

.cs-w-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 15, .86);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99002;
    padding: 20px;
}

.cs-w-lightbox.on {
    display: flex;
}

.cs-w-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

@media (max-width: 560px) {
    .cs-w-panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 78vh;
        max-height: 78vh;
        border-radius: 14px 14px 0 0;
    }

    .cs-w-fab {
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        width: 48px;
        height: 48px;
    }
}
