/* 顾客端客服聊天 - 移动优先，兼容小程序 web-view */

/* 默认左下；拖动后改为 left/top 定位，位置本地记住 */
.customer-chat-fab {
    position: fixed;
    left: 14px;
    right: auto;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
    z-index: 220;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: 50%;
    background: #fff;
    color: #ff6b6b;
    box-shadow: 0 4px 14px rgba(40, 24, 12, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    padding: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.customer-chat-fab:active,
.customer-chat-fab.dragging {
    cursor: grabbing;
    transform: scale(1.05);
    background: #fff7f3;
    box-shadow: 0 6px 18px rgba(40, 24, 12, 0.18);
}

.customer-chat-fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.customer-chat-fab-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.customer-chat-fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 0 0 2px #fff;
}

.customer-chat-panel {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: #f6f3ef;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.customer-chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    background: linear-gradient(120deg, #ff8a5c, #ff6b6b);
    color: #fff;
}

.customer-chat-back,
.customer-chat-close,
.customer-chat-header-btn {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.customer-chat-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.customer-chat-header-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    opacity: 0.95;
}

.customer-chat-header-btn:active {
    background: rgba(255, 255, 255, 0.18);
}

.customer-chat-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-chat-body,
.customer-chat-room {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.customer-chat-offline-tip {
    flex-shrink: 0;
    margin: 0;
    padding: 8px 14px;
    font-size: 12px;
    line-height: 1.4;
    color: #9a3412;
    background: #fff7ed;
    border-bottom: 1px solid #ffedd5;
    text-align: center;
}

.customer-chat-hint {
    padding: 14px 16px 6px;
    color: #8a8178;
    font-size: 13px;
    line-height: 1.55;
}

.customer-chat-hint strong {
    color: #c2410c;
    font-weight: 700;
}

.customer-chat-section-title {
    padding: 10px 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #9a9188;
    letter-spacing: 0.02em;
}

.customer-chat-contact-phone {
    font-size: 12px;
    color: #6b5b4d;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.customer-chat-staff-list {
    padding: 8px 12px 20px;
    overflow: auto;
}

.customer-chat-staff-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 14px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(60, 40, 20, 0.06);
}

.customer-chat-staff-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffe0c8;
    color: #c2410c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    position: relative;
    flex-shrink: 0;
}

.customer-chat-staff-avatar .chat-avatar-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    z-index: 0;
    display: block;
}

.customer-chat-staff-avatar .chat-avatar-fallback {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.customer-chat-staff-avatar .customer-chat-dot {
    z-index: 2;
}

.customer-chat-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #c4b5a5;
    border: 2px solid #fff;
    box-sizing: border-box;
}

.customer-chat-dot.online {
    background: #16a34a;
}

.customer-chat-staff-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customer-chat-staff-name {
    font-size: 15px;
    color: #2b2118;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.customer-chat-role-tag {
    font-style: normal;
    font-size: 10px;
    font-weight: 600;
    color: #c2410c;
    background: #ffe8d4;
    border-radius: 999px;
    padding: 1px 6px;
}

.customer-chat-role-tag.admin {
    color: #1d4ed8;
    background: #dbeafe;
}

.customer-chat-staff-online {
    font-size: 12px;
    color: #16a34a;
}

.customer-chat-empty {
    padding: 40px 16px;
    text-align: center;
    color: #9a9188;
    font-size: 14px;
    line-height: 1.6;
}

.customer-chat-empty span {
    font-size: 12px;
    color: #b0a79e;
}

.customer-chat-offline-tip {
    padding: 4px 4px 12px;
    font-size: 13px;
    color: #8a8178;
    line-height: 1.5;
}

.customer-chat-contact-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(60, 40, 20, 0.06);
    box-sizing: border-box;
}

.customer-chat-contact-item .customer-chat-staff-meta {
    flex: 1;
    min-width: 0;
}

.customer-chat-contact-item .customer-chat-contact-phone {
    color: #8a8178;
}

.customer-chat-contact-item.is-online .customer-chat-contact-phone {
    color: #16a34a;
}

.customer-chat-contact-actions {
    flex-shrink: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.customer-chat-action-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 32px;
    min-width: 72px;
    padding: 0 12px;
    border-radius: 999px;
    border: none;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.customer-chat-chat-btn {
    position: relative;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffd7b8;
}

.customer-chat-btn-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}

.customer-chat-chat-btn:active {
    background: #ffe8d4;
}

.customer-chat-chat-btn.is-disabled {
    background: #f3f0ec;
    color: #a3988d;
    border-color: #e8e0d6;
    cursor: not-allowed;
}

.customer-chat-dial-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

.customer-chat-dial-btn:active {
    opacity: 0.9;
}

.customer-chat-msgs {
    flex: 1;
    overflow: auto;
    padding: 12px 8px 8px;
    -webkit-overflow-scrolling: touch;
}

.customer-chat-emotion-wrap {
    height: min(42vh, 320px);
    max-height: min(42vh, 320px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #f7f7f7;
    border-top: 1px solid #ebebeb;
}

.customer-chat-footer {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #efe6dc;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 微信式引用条（输入框上方） */
.chat-quote-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 0;
    background: #fff;
}

.chat-quote-bar-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f0ea;
    border-radius: 8px;
    padding: 8px 10px;
}

.chat-quote-bar-line {
    width: 3px;
    align-self: stretch;
    border-radius: 2px;
    background: #c4b5a5;
    flex-shrink: 0;
}

.chat-quote-bar-text {
    flex: 1;
    min-width: 0;
}

.chat-quote-bar-name {
    font-size: 12px;
    color: #8a8178;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-quote-bar-preview {
    font-size: 13px;
    color: #5c534a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-quote-bar-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8e0d6;
}

.chat-quote-bar-close {
    border: none;
    background: transparent;
    color: #a3988d;
    font-size: 22px;
    line-height: 1;
    width: 28px;
    height: 28px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

/* 气泡内引用块 */
.chat-quote {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid rgba(0, 0, 0, 0.18);
    cursor: pointer;
    max-width: 100%;
    box-sizing: border-box;
}

.chat-msg-row.self .chat-quote {
    background: rgba(0, 0, 0, 0.06);
    border-left-color: rgba(180, 100, 40, 0.35);
}

.chat-quote-body {
    flex: 1;
    min-width: 0;
}

.chat-quote-name {
    font-size: 12px;
    color: #8a8178;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-quote-preview {
    font-size: 12px;
    color: #6b6258;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-quote-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8e0d6;
}

.chat-msg-row.is-voice .chat-quote {
    margin: 0 0 6px;
    max-width: 220px;
}

.chat-msg-quote-flash {
    animation: chatQuoteFlash 1.2s ease;
}

@keyframes chatQuoteFlash {
    0%, 100% {
        background: transparent;
    }
    20%, 55% {
        background: rgba(255, 180, 100, 0.28);
    }
}

.customer-chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px 10px;
}

.customer-chat-tool {
    border: none;
    background: #f5efe8;
    color: #6b5b4d;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    line-height: 0;
}

.customer-chat-tool:active,
.customer-chat-tool.recording {
    background: #fee2e2;
    color: #e11d48;
}

.customer-chat-tool svg {
    display: block;
}

.customer-chat-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    max-height: 132px; /* 与商家端/微信一致：约 5 行封顶，再多框内滑动 */
    height: 40px;
    overflow-y: hidden;
    resize: none;
    border: 1px solid #eadfce;
    border-radius: 12px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.35;
    background: #faf7f3;
    box-sizing: border-box;
}

.customer-chat-send {
    border: none;
    border-radius: 12px;
    height: 40px;
    padding: 0 14px;
    background: linear-gradient(135deg, #ff8a5c, #ff6b6b);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.customer-chat-record-tip {
    position: absolute;
    left: 50%;
    bottom: 120px;
    transform: translateX(-50%);
    background: rgba(40, 30, 20, 0.82);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    z-index: 2;
}

/* 通用消息气泡 — 微信式：贴左/贴右，行宽随内容（勿拉近全宽） */
.chat-msg-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    width: fit-content;
    max-width: 78%;
    box-sizing: border-box;
}

.chat-msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: #ffe0c8;
    color: #c2410c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    padding: 0;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.chat-msg-avatar .chat-avatar-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
    pointer-events: none;
}

.chat-msg-avatar .chat-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.chat-msg-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: min(280px, calc(100vw - 100px));
}

.chat-msg-sender {
    font-size: 11px;
    color: #a3988d;
    margin-bottom: 3px;
    padding: 0 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-msg-role-tag {
    display: inline-block;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    background: #fff7ed;
    color: #c2410c;
}

.chat-msg-role-tag.customer {
    background: #ecfdf5;
    color: #047857;
}

.chat-msg-role-tag.staff {
    background: #fff7ed;
    color: #c2410c;
}

.chat-msg-row.self {
    margin-left: auto;
    margin-right: 0;
}

.chat-msg-row.self .chat-msg-main {
    align-items: flex-end;
}

.chat-msg-row.self .chat-msg-sender {
    justify-content: flex-end;
}

.chat-msg-row.peer {
    margin-left: 0;
    margin-right: auto;
}

.chat-msg-row.peer .chat-msg-main {
    align-items: flex-start;
}

.chat-msg-row.is-call .chat-msg-sender {
    display: none;
}

/* 点击头像：简单资料卡 */
.chat-profile-mask {
    position: fixed;
    inset: 0;
    z-index: 4600;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 18, 28, 0.48);
    padding: 24px 16px;
    box-sizing: border-box;
}

.chat-profile-mask.show {
    display: flex;
}

.chat-profile-card {
    position: relative;
    width: min(320px, 100%);
    background: #fff;
    border-radius: 16px;
    padding: 28px 20px 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
    text-align: center;
}

.chat-profile-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.chat-profile-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 10px;
    background: #ffe0c8;
    color: #c2410c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    overflow: hidden;
    position: relative;
}

.chat-profile-avatar .chat-avatar-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.chat-profile-avatar .chat-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-profile-name {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

.chat-profile-role {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #c2410c;
    background: #fff7ed;
    border-radius: 999px;
    padding: 2px 10px;
    margin-bottom: 14px;
}

.chat-profile-role.customer {
    color: #047857;
    background: #ecfdf5;
}

.chat-profile-role.staff {
    color: #1d4ed8;
    background: #dbeafe;
}

.chat-profile-rows {
    text-align: left;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}

.chat-profile-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 2px;
    font-size: 13px;
}

.chat-profile-row span {
    color: #94a3b8;
    flex-shrink: 0;
}

.chat-profile-row em {
    font-style: normal;
    color: #334155;
    text-align: right;
    word-break: break-all;
}

.chat-profile-row em.online {
    color: #16a34a;
}

.chat-profile-row em.offline {
    color: #94a3b8;
}

.chat-profile-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    padding: 8px 0 4px;
}

.chat-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    word-break: break-word;
}

.chat-msg-row.self .chat-bubble {
    background: #ffe2c8;
}

.chat-bubble-text {
    font-size: 15px;
    line-height: 1.45;
    color: #2b2118;
}

.chat-msg-time-divider {
    width: 100%;
    max-width: 100%;
    text-align: center;
    margin: 16px 0 12px;
    clear: both;
}

.chat-msg-time-divider span {
    display: inline-block;
    font-size: 12px;
    color: #b2b2b2;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: 0.02em;
    /* 微信：纯文字居中，无底色胶囊 */
    background: none;
    padding: 0;
    border-radius: 0;
}

.chat-msg-time {
    display: none; /* 旧样式：时间改到消息上方居中 */
}

.chat-msg-system {
    text-align: center;
    margin: 10px 0;
}

.chat-msg-system span {
    display: inline-block;
    background: rgba(0, 0, 0, 0.06);
    color: #8a8178;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
}

.chat-msg-image {
    max-width: 160px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    cursor: zoom-in;
    background: #f0ebe4;
}

/* 语音气泡：微信风格，时长秒数在外侧 */
.chat-voice-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

/* 对方语音未听：微信同款红点 */
.chat-voice-unread {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fa5151;
    flex-shrink: 0;
    align-self: center;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.chat-voice-sec {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: #8a8178;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    min-width: 1.2em;
}

.chat-voice-bubble {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fff;
    color: #2b2118;
    cursor: pointer;
    box-sizing: border-box;
    justify-content: flex-start;
}

.chat-msg-row.self .chat-voice-bubble {
    background: #ffe2c8;
    color: #2b2118;
    justify-content: flex-end;
    flex-direction: row;
}

.chat-msg-row.peer .chat-voice-bubble {
    justify-content: flex-start;
}

.chat-voice-speaker {
    display: inline-flex;
    line-height: 0;
    flex-shrink: 0;
}

.chat-msg-row.self .chat-voice-speaker {
    transform: scaleX(-1);
}

.chat-voice-bars {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 16px;
    flex: 1;
    min-width: 28px;
}

.chat-voice-bars i {
    display: block;
    width: 3px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.55;
}

.chat-voice-bars i:nth-child(1) {
    height: 7px;
}

.chat-voice-bars i:nth-child(2) {
    height: 12px;
}

.chat-voice-bars i:nth-child(3) {
    height: 9px;
}

.chat-voice-bars i:nth-child(4) {
    height: 15px;
}

.chat-voice-bubble.playing .chat-voice-bars i {
    animation: chatVoicePlayBar 0.85s ease-in-out infinite;
    opacity: 0.9;
}

.chat-voice-bubble.playing .chat-voice-bars i:nth-child(2) {
    animation-delay: 0.12s;
}

.chat-voice-bubble.playing .chat-voice-bars i:nth-child(3) {
    animation-delay: 0.24s;
}

.chat-voice-bubble.playing .chat-voice-bars i:nth-child(4) {
    animation-delay: 0.36s;
}

@keyframes chatVoicePlayBar {
    0%, 100% {
        transform: scaleY(0.45);
    }
    50% {
        transform: scaleY(1);
    }
}

.chat-msg-row.is-voice {
    max-width: 78%;
}

.chat-voice-record-mask {
    position: fixed;
    inset: 0;
    z-index: 4500;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(20, 16, 12, 0.45);
    pointer-events: none;
}

.chat-voice-record-mask.show {
    display: flex;
}

.chat-voice-record-card {
    min-width: 168px;
    padding: 22px 26px 18px;
    border-radius: 18px;
    background: rgba(46, 196, 112, 0.95);
    color: #fff;
    text-align: center;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.chat-voice-record-mask.cancel .chat-voice-record-card {
    background: rgba(225, 29, 72, 0.95);
}

.chat-voice-wave {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 36px;
    margin-bottom: 12px;
}

.chat-voice-wave i {
    display: block;
    width: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    animation: chatVoiceWave 0.9s ease-in-out infinite;
}

.chat-voice-wave i:nth-child(1) {
    height: 10px;
    animation-delay: 0s;
}

.chat-voice-wave i:nth-child(2) {
    height: 18px;
    animation-delay: 0.1s;
}

.chat-voice-wave i:nth-child(3) {
    height: 28px;
    animation-delay: 0.18s;
}

.chat-voice-wave i:nth-child(4) {
    height: 16px;
    animation-delay: 0.05s;
}

.chat-voice-wave i:nth-child(5) {
    height: 30px;
    animation-delay: 0.22s;
}

.chat-voice-wave i:nth-child(6) {
    height: 14px;
    animation-delay: 0.12s;
}

.chat-voice-wave i:nth-child(7) {
    height: 22px;
    animation-delay: 0.28s;
}

@keyframes chatVoiceWave {
    0%, 100% {
        transform: scaleY(0.55);
        opacity: 0.75;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.chat-voice-record-status {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.chat-voice-record-hint {
    font-size: 12px;
    opacity: 0.92;
}

.chat-msg-action-mask {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chat-msg-action-sheet {
    width: min(420px, 100%);
    background: #f6f3ef;
    border-radius: 16px 16px 0 0;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.chat-msg-action-btn {
    width: 100%;
    border: none;
    background: #fff;
    color: #2b2118;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
}

.chat-msg-action-btn.danger {
    color: #e11d48;
}

.chat-msg-action-btn.cancel {
    background: #efe8e0;
    font-weight: 500;
    color: #6b5b4d;
}

.emoji-normal {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.emoji-small {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.chat-emotion-panel {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px 2px;
    padding: 12px 8px 18px;
}

.chat-emotion-item {
    border: none;
    background: transparent;
    padding: 10px 4px;
    cursor: pointer;
    border-radius: 8px;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-emotion-item:active,
.chat-emotion-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.chat-emotion-item img {
    width: 36px;
    height: 36px;
    display: block;
}

.chat-image-preview-mask {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-image-preview-mask.show {
    display: flex;
}

.chat-image-preview-mask img {
    max-width: 94vw;
    max-height: 88vh;
    object-fit: contain;
}

.chat-image-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
}

/* WebRTC overlay — 来电/呼叫/通话中 */
.chat-rtc-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: #0b0f16;
    display: none;
}

.chat-rtc-overlay.show {
    display: block;
}

.chat-rtc-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0b0f16;
}

.chat-rtc-remote {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0b0f16;
    z-index: 0;
    pointer-events: none;
}

.chat-rtc-local {
    position: absolute;
    right: 14px;
    top: calc(14px + env(safe-area-inset-top, 0px));
    width: 108px;
    height: 152px;
    object-fit: cover;
    border-radius: 14px;
    background: #2a2f3a;
    border: 2px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 5;
    pointer-events: auto;
    touch-action: none;
    cursor: grab;
}

/*
 * 系统播放三角：CSS 能藏则藏（WebKit 私有伪类 IDE 可能报黄，可忽略）
 */
/*noinspection CssInvalidPseudoSelector,CssUnusedSymbol*/
.chat-rtc-remote::-webkit-media-controls,
.chat-rtc-local::-webkit-media-controls,
.chat-rtc-remote::-webkit-media-controls-enclosure,
.chat-rtc-local::-webkit-media-controls-enclosure,
.chat-rtc-remote::-webkit-media-controls-panel,
.chat-rtc-local::-webkit-media-controls-panel,
.chat-rtc-remote::-webkit-media-controls-start-playback-button,
.chat-rtc-local::-webkit-media-controls-start-playback-button,
.chat-rtc-remote::-webkit-media-controls-overlay-play-button,
.chat-rtc-local::-webkit-media-controls-overlay-play-button {
    display: none !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
    -webkit-appearance: none !important;
}

/* 100% 不透明底板：盖在远端 video 上面，系统三角再画也看不见 */
.chat-rtc-plate {
    display: none;
    position: absolute;
    inset: 0;
    background: #0b0f16;
    z-index: 1;
    pointer-events: none;
}

.chat-rtc-backdrop {
    display: none;
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 55% at 50% 18%, rgba(255, 156, 110, 0.34), transparent 58%),
    radial-gradient(ellipse 70% 50% at 80% 80%, rgba(88, 120, 255, 0.16), transparent 55%),
    linear-gradient(168deg, #1a2233 0%, #121820 42%, #0b0f16 100%);
    z-index: 2;
    pointer-events: none;
}

/*
 * 无对方画面（呼叫中 / 未出帧 / 对方关摄像头 / 纯语音）：
 * 1) 远端 video 缩到 2px 角上继续出声（勿 display:none，否则 WebView 停播）
 * 2) 全屏纯色底板 + 通话背景把头像盖上 → 系统三角没有面积可露
 */
.chat-rtc-overlay.rtc-cover-remote .chat-rtc-remote {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    width: 2px !important;
    height: 2px !important;
    max-width: 2px !important;
    max-height: 2px !important;
    opacity: 0.01 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.chat-rtc-overlay.rtc-cover-remote .chat-rtc-plate,
.chat-rtc-overlay.rtc-cover-remote .chat-rtc-backdrop {
    display: block !important;
}

/* 兼容旧 class：同样走盖板逻辑 */
.chat-rtc-overlay.incoming .chat-rtc-remote,
.chat-rtc-overlay.calling .chat-rtc-remote,
.chat-rtc-overlay.no-remote .chat-rtc-remote,
.chat-rtc-overlay.audio-only .chat-rtc-remote,
.chat-rtc-overlay.voice-mode .chat-rtc-remote,
.chat-rtc-overlay.peer-cam-off .chat-rtc-remote {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    width: 2px !important;
    height: 2px !important;
    opacity: 0.01 !important;
    pointer-events: none !important;
}

.chat-rtc-overlay.audio-only .chat-rtc-local,
.chat-rtc-overlay.voice-mode .chat-rtc-local,
.chat-rtc-overlay.cam-off .chat-rtc-local,
.chat-rtc-overlay.incoming .chat-rtc-local {
    display: none !important;
}

.chat-rtc-overlay.incoming .chat-rtc-plate,
.chat-rtc-overlay.calling .chat-rtc-plate,
.chat-rtc-overlay.no-remote .chat-rtc-plate,
.chat-rtc-overlay.audio-only .chat-rtc-plate,
.chat-rtc-overlay.voice-mode .chat-rtc-plate,
.chat-rtc-overlay.peer-cam-off .chat-rtc-plate,
.chat-rtc-overlay.incoming .chat-rtc-backdrop,
.chat-rtc-overlay.calling .chat-rtc-backdrop,
.chat-rtc-overlay.no-remote .chat-rtc-backdrop,
.chat-rtc-overlay.audio-only .chat-rtc-backdrop,
.chat-rtc-overlay.voice-mode .chat-rtc-backdrop,
.chat-rtc-overlay.peer-cam-off .chat-rtc-backdrop {
    display: block !important;
}

/* 点击小窗切换：自己全屏，对方进小窗 */
.chat-rtc-overlay.swapped:not(.rtc-cover-remote) .chat-rtc-local {
    inset: 0;
    width: 100%;
    height: 100%;
    right: auto;
    top: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 0;
    pointer-events: none;
    cursor: default;
}

.chat-rtc-overlay.swapped:not(.rtc-cover-remote) .chat-rtc-remote {
    inset: auto;
    right: 14px;
    top: calc(14px + env(safe-area-inset-top, 0px));
    width: 108px;
    height: 152px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 5;
    pointer-events: auto;
    touch-action: none;
    cursor: grab;
}

.chat-rtc-local.dragging,
.chat-rtc-overlay.swapped .chat-rtc-remote.dragging {
    cursor: grabbing;
    opacity: 0.92;
}

.chat-rtc-topbar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 6;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: start;
    justify-items: center;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 0;
    pointer-events: none;
    box-sizing: border-box;
}

/* 缩小通话：类似微信收起 */
.chat-rtc-minimize {
    justify-self: start;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    -webkit-tap-highlight-color: transparent;
}

.chat-rtc-minimize:active {
    transform: scale(0.94);
}

.chat-rtc-topbar-spacer {
    width: 40px;
    height: 40px;
    pointer-events: none;
}

/* 监控录像风格：左上角码率/分辨率/延迟水印 */
.chat-rtc-hud {
    position: absolute;
    left: 12px;
    top: calc(10px + env(safe-area-inset-top, 0px));
    z-index: 7;
    max-width: min(92vw, 520px);
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: rgba(180, 255, 170, 0.92);
    font-family: "Consolas", "Courier New", "SF Mono", Menlo, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.4;
    white-space: normal;
    word-break: break-all;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.85), 0 1px 3px rgba(0, 0, 0, 0.75);
    pointer-events: none;
    user-select: none;
}

.chat-rtc-topbar .chat-rtc-timer {
    margin-top: 0;
    min-width: 72px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.chat-rtc-timer {
    font-variant-numeric: tabular-nums;
}

.chat-rtc-info {
    position: absolute;
    left: 0;
    right: 0;
    top: 18%;
    text-align: center;
    color: #fff;
    pointer-events: none;
    z-index: 3;
    padding: 0 28px;
}

.chat-rtc-avatar {
    position: relative;
    width: 108px;
    height: 108px;
    margin: 0 auto 22px;
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-rtc-avatar-disk {
    position: relative;
    z-index: 1;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffb089 0%, #f97316 48%, #ea580c 100%);
    border: 3px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
    color: #fff;
    overflow: hidden;
}

.chat-rtc-avatar-text {
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-rtc-avatar-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 176, 137, 0.55);
    animation: chatRtcPulse 2.2s ease-out infinite;
    pointer-events: none;
}

.chat-rtc-avatar-pulse.delay {
    animation-delay: 1.1s;
}

@keyframes chatRtcPulse {
    0% {
        transform: scale(0.92);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

.chat-rtc-overlay.incoming .chat-rtc-avatar,
.chat-rtc-overlay.calling .chat-rtc-avatar,
.chat-rtc-overlay.no-remote .chat-rtc-avatar,
.chat-rtc-overlay.audio-only .chat-rtc-avatar,
.chat-rtc-overlay.peer-cam-off .chat-rtc-avatar,
.chat-rtc-overlay.rtc-cover-remote .chat-rtc-avatar {
    display: flex;
}

.chat-rtc-avatar-voice,
.chat-rtc-avatar-video {
    display: none;
}

.chat-rtc-overlay.audio-only .chat-rtc-avatar-text {
    display: none;
}

.chat-rtc-overlay.audio-only .chat-rtc-avatar-voice {
    display: block;
}

.chat-rtc-overlay.audio-only .chat-rtc-avatar-disk {
    background: linear-gradient(145deg, #7dd3fc 0%, #38bdf8 45%, #0284c7 100%);
}

.chat-rtc-title {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.chat-rtc-status {
    margin-top: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.04em;
}

.chat-rtc-overlay.calling .chat-rtc-status {
    animation: chatRtcStatusBlink 1.6s ease-in-out infinite;
}

@keyframes chatRtcStatusBlink {
    0%, 100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

.chat-rtc-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 18px 22px;
    z-index: 6;
    /* 给按钮下方文字标签留空，避免贴底被裁切 */
    padding: 0 16px calc(28px + env(safe-area-inset-bottom, 0px) + 22px);
    pointer-events: none;
    box-sizing: border-box;
}

.chat-rtc-btn,
.chat-rtc-fab {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.chat-rtc-btn span,
.chat-rtc-fab-label {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0.9;
    pointer-events: none;
}

.chat-rtc-accept {
    background: linear-gradient(145deg, #4ade80, #16a34a);
    font-size: 15px;
    font-weight: 600;
}

.chat-rtc-reject,
.chat-rtc-hangup {
    background: linear-gradient(145deg, #fb7185, #e11d48);
    font-size: 15px;
    font-weight: 600;
}

.chat-rtc-toggle,
.chat-rtc-cam,
.chat-rtc-mic {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

.chat-rtc-toggle.off,
.chat-rtc-overlay.cam-off .chat-rtc-cam,
.chat-rtc-overlay.mic-off .chat-rtc-mic {
    background: rgba(255, 255, 255, 0.32);
}

.chat-rtc-cam .ico-cam-off,
.chat-rtc-mic .ico-mic-off {
    display: none;
}

.chat-rtc-overlay.cam-off .chat-rtc-cam .ico-cam-on {
    display: none;
}

.chat-rtc-overlay.cam-off .chat-rtc-cam .ico-cam-off {
    display: block;
}

.chat-rtc-overlay.mic-off .chat-rtc-mic .ico-mic-on {
    display: none;
}

.chat-rtc-overlay.mic-off .chat-rtc-mic .ico-mic-off {
    display: block;
}

.chat-rtc-overlay.in-call .chat-rtc-info .chat-rtc-title,
.chat-rtc-overlay.in-call .chat-rtc-info .chat-rtc-status {
    display: none;
}

/* 通话中已有对方画面时隐藏头像；呼叫中 / 等待远端 仍显示 */
.chat-rtc-overlay.in-call:not(.calling):not(.no-remote):not(.audio-only):not(.peer-cam-off) .chat-rtc-avatar {
    display: none;
}

.chat-rtc-overlay.in-call .chat-rtc-topbar .chat-rtc-timer {
    display: block;
}

/* ========== 通话浮窗（窗口化）：底层页面可操作 ========== */
.chat-rtc-float-chrome {
    display: none;
}

.chat-rtc-overlay.floated {
    inset: auto;
    left: auto;
    top: auto;
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    width: 118px;
    height: 176px;
    background: transparent;
    pointer-events: none;
    border-radius: 18px;
    overflow: visible;
    z-index: 4200;
}

.chat-rtc-overlay.floated .chat-rtc-stage {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;
    touch-action: none;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42), 0 0 0 1.5px rgba(255, 255, 255, 0.22);
    background: #121820;
}

.chat-rtc-overlay.floated .chat-rtc-actions,
.chat-rtc-overlay.floated .chat-rtc-info,
.chat-rtc-overlay.floated .chat-rtc-hud,
.chat-rtc-overlay.floated .chat-rtc-minimize,
.chat-rtc-overlay.floated .chat-rtc-topbar,
.chat-rtc-overlay.floated .chat-rtc-backdrop,
.chat-rtc-overlay.floated .chat-rtc-plate {
    display: none !important;
}

.chat-rtc-overlay.floated .chat-rtc-float-chrome {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 8px 10px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.72) 100%);
    pointer-events: none;
    box-sizing: border-box;
}

.chat-rtc-float-tip {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.chat-rtc-float-hangup {
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6b6b, #e11d48);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.45);
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.chat-rtc-float-hangup:active {
    transform: scale(0.94);
}

.chat-rtc-float-hangup svg {
    display: block;
}

/* 浮窗：显示当前「小窗」那一路；另一路缩到 2px 保活（勿 display:none） */
.chat-rtc-overlay.floated:not(.swapped) .chat-rtc-local,
.chat-rtc-overlay.floated.swapped:not(.rtc-cover-remote) .chat-rtc-remote,
.chat-rtc-overlay.floated.swapped:not(.audio-only) .chat-rtc-remote {
    position: absolute !important;
    inset: 0 !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    z-index: 4 !important;
    pointer-events: none !important;
    cursor: default !important;
    object-fit: cover !important;
}

.chat-rtc-overlay.floated:not(.swapped) .chat-rtc-remote,
.chat-rtc-overlay.floated.swapped .chat-rtc-local {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    width: 2px !important;
    height: 2px !important;
    max-width: 2px !important;
    max-height: 2px !important;
    opacity: 0.01 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

/* 语音 / 无画面浮窗：居中头像 */
.chat-rtc-overlay.floated.audio-only .chat-rtc-info,
.chat-rtc-overlay.floated.rtc-cover-remote .chat-rtc-info,
.chat-rtc-overlay.floated.peer-cam-off:not(.swapped) .chat-rtc-info,
.chat-rtc-overlay.floated.no-remote .chat-rtc-info,
.chat-rtc-overlay.floated.cam-off:not(.swapped) .chat-rtc-info,
.chat-rtc-overlay.floated.swapped.peer-cam-off .chat-rtc-info {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    inset: 0;
    top: 0;
    padding: 0 8px 28px;
    z-index: 5;
}

.chat-rtc-overlay.floated.audio-only .chat-rtc-avatar,
.chat-rtc-overlay.floated.rtc-cover-remote .chat-rtc-avatar,
.chat-rtc-overlay.floated.peer-cam-off:not(.swapped) .chat-rtc-avatar,
.chat-rtc-overlay.floated.no-remote .chat-rtc-avatar,
.chat-rtc-overlay.floated.cam-off:not(.swapped) .chat-rtc-avatar,
.chat-rtc-overlay.floated.swapped.peer-cam-off .chat-rtc-avatar {
    display: flex !important;
    width: 64px;
    height: 64px;
    margin: 0 auto 8px;
}

.chat-rtc-overlay.floated .chat-rtc-avatar-disk {
    width: 56px;
    height: 56px;
    border-width: 2px;
}

.chat-rtc-overlay.floated .chat-rtc-avatar-text {
    font-size: 24px;
}

.chat-rtc-overlay.floated .chat-rtc-avatar-pulse {
    display: none;
}

.chat-rtc-overlay.floated .chat-rtc-title {
    display: none !important;
}

.chat-rtc-overlay.floated .chat-rtc-status {
    display: none !important;
}

.chat-rtc-overlay.floated.dragging-float .chat-rtc-stage {
    opacity: 0.94;
    cursor: grabbing;
}

.chat-rtc-fab.chat-rtc-flip,
.chat-rtc-fab.chat-rtc-quality {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

.chat-rtc-quality-text {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.1;
}

.chat-rtc-quality-panel {
    position: absolute;
    left: 50%;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 6;
    display: none;
    flex-direction: column;
    gap: 0;
    min-width: 168px;
    background: rgba(28, 28, 30, 0.92);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.chat-rtc-quality-opt {
    appearance: none;
    border: none;
    background: transparent;
    color: #fff;
    text-align: left;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.chat-rtc-quality-opt + .chat-rtc-quality-opt {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-rtc-quality-opt span {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
}

.chat-rtc-quality-opt.active {
    color: #7dd3fc;
}

.chat-rtc-quality-opt:active {
    background: rgba(255, 255, 255, 0.08);
}

.chat-msg-system-wrap {
    clear: both;
    width: 100%;
}

/* 通话记录：微信左右单层气泡（不要嵌套胶囊） */
.chat-bubble-call {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 14px !important;
    min-height: 40px;
    box-sizing: border-box;
}

.chat-bubble-call .chat-call-text {
    font-size: 15px;
    line-height: 1.3;
    white-space: nowrap;
}

.chat-bubble-call .chat-call-ico {
    flex-shrink: 0;
    opacity: 0.88;
}

.chat-msg-row.is-call .chat-msg-sender {
    display: none;
}

.chat-msg-call,
.chat-msg-call span,
.chat-msg-call-sep,
.chat-msg-call-time {
    /* 旧居中胶囊样式废弃，保留选择器避免残留 */
}

@media (min-width: 768px) {
    .customer-chat-panel {
        inset: auto;
        right: 24px;
        bottom: 24px;
        width: 380px;
        height: min(720px, 86vh);
        border-radius: 18px;
        overflow: hidden;
        box-shadow: 0 18px 50px rgba(40, 20, 10, 0.28);
    }

    .customer-chat-fab {
        left: auto;
        right: 24px;
        bottom: 24px;
    }
}
