/**
 * 前台在线客服窗口 · 微信风格（与后台 admin cs-wechat-skin 对齐）
 * 作用域：仅 #cs-chat-window-modern.cs-wechat-skin 内，不影响其它页面气泡
 *
 * 外框视觉参考 Calendly 预约页中间卡片：浅灰 1px 实线边、大圆角、分层柔阴影 + 顶边内高光细线
 * （见 https://calendly.com/ 类页面的嵌入卡片）
 *
 * 字体：与全站一致使用 var(--font-sans)（阿里妈妈方圆体优先）；字阶仍在本文件内用 !important 压住 Master 的 13px span 等。
 */
#cs-chat-window-modern.cs-wechat-skin {
    /* 会话区与整窗底：纯白（与顶栏、输入区一致） */
    --wx-bg: #ffffff;
    --wx-panel: #ffffff;
    --wx-green: #95ec69;
    --wx-green-tail: #8ad862;
    --wx-brand: #07c160;
    --wx-brand-hover: #06ad56;
    --wx-line: #e3e3e3;
    --wx-text: #191919;
    --wx-sub: #8e8e93;
    --wx-link: #576b95;
    /* Calendly 式卡片描边（slate-200 系） */
    --wx-frame-border: #d4d4d8;
    --wx-frame-ring: rgba(15, 23, 42, 0.06);
    /* 输入区 */
    --wx-composer-card-bg: #ffffff;
    --wx-composer-card-border: rgba(0, 0, 0, 0.08);
    /* 与输入区同色，避免底栏一块灰 */
    --wx-composer-toolbar-bg: #ffffff;
    --wx-composer-toolbar-line: transparent;
    --wx-composer-text: #191919;
    --wx-composer-muted: #3c3c43;
    --wx-composer-placeholder: #aeaeb2;
    --wx-send-idle-bg: #e5e5ea;
    --wx-send-idle-text: #8e8e93;
    background: var(--wx-bg) !important;
    border-radius: 12px !important;
    /* 外框：实线边 + 极细外环 + 内顶高光 + 柔和多层投影（接近 Calendly 中间卡片层次） */
    border: 1px solid var(--wx-frame-border) !important;
    box-shadow:
        0 0 0 1px var(--wx-frame-ring),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.92),
        0 1px 2px rgba(15, 23, 42, 0.05),
        0 8px 24px rgba(15, 23, 42, 0.08),
        0 20px 48px rgba(15, 23, 42, 0.07) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* optimizeLegibility 可能触发字距/栅格二次排版，与动画叠加时像字体「抖」 */
    text-rendering: auto;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0;
    font-synthesis: none;
}

/* 与全站同源字体（:root --font-sans）；统一 normal 字重轴，避免与正文策略冲突 */
#cs-chat-window-modern.cs-wechat-skin,
#cs-chat-window-modern.cs-wechat-skin * {
    font-family: var(--font-sans) !important;
    font-variation-settings: normal !important;
    font-synthesis: none;
}

/* 气泡正文：Master 给 span 固定 13px，必须在 .cs-message-content 及其后代上强制 15px */
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content * {
    font-size: 15px !important;
    line-height: 1.5 !important;
    font-weight: 400 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content strong,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content b {
    font-weight: 600 !important;
}

/* 引用条（与 .cs-message-content 同级，需单独字阶） */
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-reply-quote {
    font-size: 13px !important;
    line-height: 1.45 !important;
    font-weight: 400 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-reply-sender {
    font-size: 12px !important;
    font-weight: 600 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-reply-time {
    font-size: 11px !important;
    font-weight: 400 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-reply-jump {
    font-size: 11px !important;
    font-weight: 400 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-reply-content,
#cs-chat-window-modern.cs-wechat-skin .cs-message-reply-content * {
    font-size: 12px !important;
    line-height: 1.4 !important;
    font-weight: 400 !important;
}

/* 音频/文件附件文案 */
#cs-chat-window-modern.cs-wechat-skin .cs-audio-name,
#cs-chat-window-modern.cs-wechat-skin .cs-file-name {
    font-size: 14px !important;
    font-weight: 500 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-audio-size,
#cs-chat-window-modern.cs-wechat-skin .cs-file-size {
    font-size: 11px !important;
    font-weight: 400 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-audio-icon {
    font-size: 18px !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-loading-text {
    font-size: 13px !important;
    font-weight: 400 !important;
}

/* 顶部标题栏：深色混合渐变（明亮/暗黑统一，聊天区仍保持浅色/深色各自主题） */
#cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern {
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate !important;
    background: linear-gradient(125deg, #070b14 0%, #0f172a 38%, #111827 100%) !important;
    color: #f0f9ff !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.22) !important;
    border-radius: 12px 12px 0 0 !important;
    box-shadow:
        0 4px 28px rgba(6, 182, 212, 0.18),
        0 8px 32px rgba(99, 102, 241, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    padding: 13px 16px !important;
    min-height: 52px !important;
    box-sizing: border-box !important;
    align-items: center !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern::before {
    display: block !important;
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    opacity: 1 !important;
    border-radius: inherit !important;
    pointer-events: none !important;
    z-index: 0 !important;
    background:
        radial-gradient(ellipse 90% 140% at 8% 45%, rgba(6, 182, 212, 0.55) 0%, transparent 58%),
        radial-gradient(ellipse 75% 110% at 92% 18%, rgba(129, 140, 248, 0.48) 0%, transparent 52%),
        radial-gradient(ellipse 65% 95% at 55% 110%, rgba(20, 184, 166, 0.38) 0%, transparent 48%),
        linear-gradient(108deg,
            rgba(14, 165, 233, 0.32) 0%,
            rgba(59, 130, 246, 0.22) 28%,
            rgba(139, 92, 246, 0.28) 52%,
            rgba(6, 182, 212, 0.24) 78%,
            rgba(16, 185, 129, 0.16) 100%) !important;
    mix-blend-mode: screen !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none !important;
    z-index: 0 !important;
    border-radius: inherit !important;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.02) 38%,
        rgba(0, 0, 0, 0.12) 100%) !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern > * {
    position: relative !important;
    z-index: 1 !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-service-name {
    color: #f0f9ff !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    letter-spacing: -0.02em !important;
    line-height: 1.25 !important;
    text-shadow: 0 0 18px rgba(56, 189, 248, 0.35) !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(125, 211, 252, 0.35) !important;
    box-shadow:
        0 0 14px rgba(6, 182, 212, 0.28),
        0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-expand-btn,
#cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn,
#cs-chat-window-modern.cs-wechat-skin .chat-close-btn {
    color: #f0f9ff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-expand-btn svg,
#cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn svg,
#cs-chat-window-modern.cs-wechat-skin .chat-close-btn svg {
    stroke: rgba(240, 249, 255, 0.95) !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-expand-btn:hover,
#cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn:hover,
#cs-chat-window-modern.cs-wechat-skin .chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(125, 211, 252, 0.35) !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2) !important;
    color: #fff !important;
    transform: none !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-expand-btn:hover svg,
#cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn:hover svg,
#cs-chat-window-modern.cs-wechat-skin .chat-close-btn:hover svg {
    stroke: currentColor !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-back-btn {
    color: #f0f9ff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(125, 211, 252, 0.35) !important;
    color: #fff !important;
}

/* 消息区：父列 + 滚动区均强制纯白，避免缝露灰底或与输入区色差 */
#cs-chat-window-modern.cs-wechat-skin .cs-chat-main-column {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern {
    background: #ffffff !important;
    background-color: #ffffff !important;
    padding: 16px 14px 20px !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern::-webkit-scrollbar {
    width: 6px !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern::-webkit-scrollbar-track {
    background: transparent !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.14) !important;
    border-radius: 100px !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.22) !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern .cs-message-modern {
    margin: 0 0 14px 0 !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern .cs-message-modern:last-child {
    margin-bottom: 4px !important;
}

/* 用户气泡：微信绿 + 深色字 */
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-user {
    background: var(--wx-green) !important;
    background-image: none !important;
    color: var(--wx-text) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    border-radius: 8px !important;
    padding: 10px 13px !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-user::before {
    border-left-color: var(--wx-green-tail) !important;
}

#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-header,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-time,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-header * {
    color: #999 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
}

#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-content,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .message-text,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-content * {
    color: var(--wx-text) !important;
}

/* 客服侧白气泡 */
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-agent {
    background: #ffffff !important;
    color: var(--wx-text) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    border-radius: 8px !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 10px 13px !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-agent::before {
    border-right-color: #ffffff !important;
}

#cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-header,
#cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-time,
#cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-header * {
    color: #999 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
}

/* 头像：用户浅蓝方角、客服保持橙色系略弱化 */
#cs-chat-window-modern.cs-wechat-skin .cs-message-modern.user .cs-message-avatar-modern {
    background: linear-gradient(180deg, #d4e3ff 0%, #9ec0f5 100%) !important;
    color: #2c4a7c !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-modern.agent .cs-message-avatar-modern {
    border-radius: 6px !important;
    box-shadow: none !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

/* 底部输入区 */
#cs-chat-window-modern.cs-wechat-skin #cs-input-area-modern {
    background: var(--wx-bg) !important;
    border-top: none !important;
    box-shadow: none !important;
    border-radius: 0 0 12px 12px !important;
    padding: 8px 12px 10px !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-header-left {
    gap: 11px !important;
    align-items: center !important;
}

/* 单圆角卡片：上白多行输入 + 下浅灰工具条 */
#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--wx-composer-card-bg) !important;
    border: 1px solid var(--wx-composer-card-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer:focus-within {
    border-color: rgba(7, 193, 96, 0.45) !important;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 0 0 2px rgba(7, 193, 96, 0.12) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-top {
    width: 100% !important;
    min-width: 0 !important;
    background: #ffffff !important;
    padding: 6px 10px 6px !important;
}

/* 与微信一致：左侧文字 + 右侧附件条同一行，不因附件增高输入白区 */
#cs-chat-window-modern.cs-wechat-skin .cs-composer-inline-row {
    align-items: flex-start !important;
    min-height: 44px !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-input-wrapper--wechat-pc {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    position: relative !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 4px 8px 6px 10px !important;
    box-sizing: border-box !important;
    background: var(--wx-composer-toolbar-bg) !important;
    border-top: none !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer .chat-send-btn {
    margin-left: auto !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-file-btn {
    width: 32px !important;
    height: 32px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    color: var(--wx-composer-muted) !important;
    box-shadow: none !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-file-btn svg {
    stroke: currentColor !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-file-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #111 !important;
}

/* 底栏「记录」：不再绝对定位在输入框内 */
#cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-history-btn {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    left: auto !important;
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
    color: var(--wx-composer-muted) !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-history-btn svg {
    stroke: currentColor !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-history-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #111 !important;
}

/* 多行输入：可编辑区与文字、内联附件同一流 */
#cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern.cs-composer-editable,
#cs-chat-window-modern.cs-wechat-skin .chat-input-wrapper--wechat-pc textarea {
    display: block !important;
    width: 100% !important;
    min-height: 44px !important;
    max-height: 100px !important;
    height: auto !important;
    padding: 4px 2px 6px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--wx-composer-text) !important;
    box-shadow: none !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    letter-spacing: -0.01em !important;
    outline: none !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    position: relative !important;
    caret-color: var(--wx-brand) !important;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-composer-inline-row #cs-message-input-modern,
#cs-chat-window-modern.cs-wechat-skin .cs-composer-inline-row textarea {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern:focus,
#cs-chat-window-modern.cs-wechat-skin .chat-input-wrapper--wechat-pc textarea:focus {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* 占位：无文字且无附件时显示（绝对定位，避免与输入光标重叠导致竖线不显示） */
#cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern.cs-composer-editable.is-empty:before {
    content: attr(data-placeholder) !important;
    color: var(--wx-composer-placeholder) !important;
    font-size: 14px !important;
    font-weight: 300 !important;
    letter-spacing: 0.01em !important;
    pointer-events: none !important;
    position: absolute !important;
    left: 2px !important;
    top: 4px !important;
    right: 2px !important;
}

/* 无内容可发：发送灰；有字或有附件 .cs-composer-send-ready → 绿 */
#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer:not(.cs-composer-send-ready) .chat-send-btn {
    background: var(--wx-send-idle-bg) !important;
    color: var(--wx-send-idle-text) !important;
    cursor: default !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer.cs-composer-send-ready .chat-send-btn {
    background: var(--wx-brand) !important;
    color: #ffffff !important;
    cursor: pointer !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-send-btn {
    height: 28px !important;
    min-width: 52px !important;
    padding: 0 11px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    border: none !important;
    box-shadow: none !important;
    flex-shrink: 0 !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer:not(.cs-composer-send-ready) .chat-send-btn:hover {
    background: var(--wx-send-idle-bg) !important;
    color: var(--wx-send-idle-text) !important;
    filter: none !important;
}

#cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer.cs-composer-send-ready .chat-send-btn:hover {
    background: var(--wx-brand-hover) !important;
    color: #fff !important;
    filter: none !important;
    transform: none !important;
}

/* :has 不支持时仍可用绿按钮（降级） */
@supports not selector(:has(*)) {
    #cs-chat-window-modern.cs-wechat-skin .chat-send-btn {
        background: var(--wx-brand) !important;
        color: #fff !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }
}

/* 新消息提示（贴在消息区底、输入框上方，不压输入区） */
#cs-chat-window-modern.cs-wechat-skin .cs-chat-main-column .cs-new-message-tip {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: var(--wx-brand) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
    border-radius: 20px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    bottom: 8px !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-new-message-tip:hover {
    background: #f7f7f7 !important;
    border-color: var(--wx-brand) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-new-message-tip svg,
#cs-chat-window-modern.cs-wechat-skin .cs-new-message-count {
    color: var(--wx-brand) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-new-message-tip.cs-scroll-to-bottom-only svg {
    animation: none !important;
}

/* 拖拽上传层 */
#cs-chat-window-modern.cs-wechat-skin #cs-drag-overlay {
    background: linear-gradient(135deg, rgba(7, 193, 96, 0.95), rgba(5, 150, 105, 0.95)) !important;
}

/* 回复预览条 */
#cs-chat-window-modern.cs-wechat-skin .cs-reply-preview {
    background: #e8f5e9 !important;
    border: 1px solid rgba(7, 193, 96, 0.22) !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-reply-label {
    color: var(--wx-brand) !important;
}

/* 文件预览：右侧横向条，与输入同一行 */
#cs-chat-window-modern.cs-wechat-skin #cs-file-preview.cs-file-preview-inline {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: var(--wx-text) !important;
}

#cs-chat-window-modern.cs-wechat-skin #cs-file-preview.cs-file-preview-inline .cs-wx-inline-thumb {
    background: rgba(0, 0, 0, 0.06) !important;
}

/* 绿气泡内音频/附件卡片白底（与后台一致） */
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-waveform-attachment,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-audio-attachment,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-file-attachment {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-audio-name,
#cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-file-name {
    color: #333 !important;
}

/* 同一条消息内多个附件：纵向间距（与 chat.css 一致，避免被其它规则覆盖） */
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-waveform-attachment + .cs-waveform-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-waveform-attachment + .cs-image-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-waveform-attachment + .cs-attachment-container,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-image-attachment + .cs-waveform-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-image-attachment + .cs-image-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-image-attachment + .cs-attachment-container,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-attachment-container + .cs-waveform-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-attachment-container + .cs-image-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-attachment-container + .cs-attachment-container {
    margin-top: 18px !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content + .cs-waveform-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content + .cs-image-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-content + .cs-attachment-container,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-reply-quote + .cs-waveform-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-reply-quote + .cs-image-attachment,
#cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern .cs-message-reply-quote + .cs-attachment-container {
    margin-top: 14px !important;
}

/* 长会话：仅加载最近一批时的提示条（与后台文案一致） */
#cs-chat-window-modern.cs-wechat-skin #cs-messages-modern .cs-messages-truncated-banner {
    flex-shrink: 0 !important;
    margin: 0 0 12px 0 !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    background: rgba(7, 193, 96, 0.08) !important;
    border: 1px solid rgba(7, 193, 96, 0.22) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    color: var(--wx-text) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-messages-truncated-text {
    flex: 1 !important;
    min-width: 0 !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-messages-load-older-btn {
    flex-shrink: 0 !important;
    padding: 7px 12px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    background: var(--wx-brand) !important;
    color: #fff !important;
    transition: background 0.15s ease !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-messages-load-older-btn:hover {
    background: var(--wx-brand-hover) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-messages-load-older-btn:disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
}

/* 消息时间与昵称：统一次级灰（盖掉 chat.css 的 font-weight:500） */
#cs-chat-window-modern.cs-wechat-skin .cs-message-header,
#cs-chat-window-modern.cs-wechat-skin .cs-message-time {
    font-size: 11px !important;
    font-weight: 400 !important;
    letter-spacing: 0.02em !important;
}

/* 聊天记录侧栏 */
#cs-chat-window-modern.cs-wechat-skin .cs-history-sidebar {
    border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-history-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    padding: 16px 18px !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-history-title {
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em !important;
    color: var(--wx-text) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-filter-btn:hover {
    border-color: var(--wx-brand) !important;
    color: var(--wx-brand) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-filter-btn.active {
    background: rgba(7, 193, 96, 0.14) !important;
    border-color: var(--wx-brand) !important;
    color: var(--wx-brand) !important;
}

/* 右键菜单 */
#cs-chat-window-modern.cs-wechat-skin .cs-context-menu {
    border-radius: 10px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    padding: 8px !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-context-menu-item {
    border-radius: 6px !important;
    font-size: 14px !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-context-menu-item:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

#cs-chat-window-modern.cs-wechat-skin .cs-context-menu-divider {
    background: rgba(0, 0, 0, 0.06) !important;
}

/* ========== 全站暗黑模式：微信皮肤客服窗（深色 UI，与 chat.css 在线客服暗黑一致） ========== */
body.dark-mode #cs-chat-window-modern.cs-wechat-skin {
    --wx-bg: #131520;
    --wx-panel: #1a1d2e;
    --wx-green: #5cbf6a;
    --wx-green-tail: #4a9d55;
    --wx-brand: #0f766e;
    --wx-brand-hover: #2dd4bf;
    --wx-line: rgba(255, 255, 255, 0.08);
    --wx-text: #e2e8f0;
    --wx-sub: #94a3b8;
    --wx-link: #7dd3fc;
    --wx-frame-border: rgba(255, 255, 255, 0.12);
    --wx-composer-card-bg: #1e2330;
    --wx-composer-card-border: rgba(255, 255, 255, 0.1);
    --wx-composer-toolbar-bg: #1a1f2e;
    --wx-composer-text: #e2e8f0;
    --wx-composer-muted: #94a3b8;
    --wx-composer-placeholder: #64748b;
    --wx-send-idle-bg: #2d3548;
    --wx-send-idle-text: #64748b;
    background: var(--wx-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.04),
        0 8px 28px rgba(0, 0, 0, 0.45),
        0 20px 48px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern {
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate !important;
    background: linear-gradient(125deg, #070b14 0%, #0f172a 38%, #111827 100%) !important;
    color: #f0f9ff !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.22) !important;
    box-shadow:
        0 4px 28px rgba(6, 182, 212, 0.18),
        0 8px 32px rgba(99, 102, 241, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* 混合渐变光晕层（青 + 蓝 + 紫，screen 叠加） */
body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern::before {
    display: block !important;
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    opacity: 1 !important;
    border-radius: inherit !important;
    pointer-events: none !important;
    z-index: 0 !important;
    background:
        radial-gradient(ellipse 90% 140% at 8% 45%, rgba(6, 182, 212, 0.55) 0%, transparent 58%),
        radial-gradient(ellipse 75% 110% at 92% 18%, rgba(129, 140, 248, 0.48) 0%, transparent 52%),
        radial-gradient(ellipse 65% 95% at 55% 110%, rgba(20, 184, 166, 0.38) 0%, transparent 48%),
        linear-gradient(108deg,
            rgba(14, 165, 233, 0.32) 0%,
            rgba(59, 130, 246, 0.22) 28%,
            rgba(139, 92, 246, 0.28) 52%,
            rgba(6, 182, 212, 0.24) 78%,
            rgba(16, 185, 129, 0.16) 100%) !important;
    mix-blend-mode: screen !important;
}

/* 顶部高光 + 底部暗角，增强层次 */
body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none !important;
    z-index: 0 !important;
    border-radius: inherit !important;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.02) 38%,
        rgba(0, 0, 0, 0.12) 100%) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-chat-header-modern > * {
    position: relative !important;
    z-index: 1 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-service-name {
    color: #f0f9ff !important;
    text-shadow: 0 0 18px rgba(56, 189, 248, 0.35) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-avatar {
    border-color: rgba(125, 211, 252, 0.35) !important;
    box-shadow:
        0 0 14px rgba(6, 182, 212, 0.28),
        0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-expand-btn,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-close-btn {
    color: #f0f9ff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-expand-btn svg,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn svg,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-close-btn svg {
    stroke: rgba(240, 249, 255, 0.95) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-expand-btn:hover,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-newtab-btn:hover,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(125, 211, 252, 0.35) !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2) !important;
    color: #fff !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-back-btn {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-back-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-chat-main-column {
    background: var(--wx-bg) !important;
    background-color: var(--wx-bg) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-messages-modern {
    background: var(--wx-bg) !important;
    background-color: var(--wx-bg) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-messages-modern::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-messages-modern::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-time-divider {
    color: #ffffff !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-time-divider::before,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-time-divider::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-agent {
    background: #252b3d !important;
    color: var(--wx-text) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-agent::before {
    border-right-color: #252b3d !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-header,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-time,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-header * {
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 400 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-content,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .message-text,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-message-content * {
    color: #e2e8f0 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-user {
    background: linear-gradient(180deg, #5cbf6a 0%, #4caf60 100%) !important;
    color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-message-bubble-modern.bubble-user::before {
    border-left-color: #4a9d55 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-header,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-time,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-header * {
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 400 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-content,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .message-text,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-message-content * {
    color: #0f172a !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-waveform-attachment,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-audio-attachment,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-file-attachment {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-audio-name,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-user .cs-file-name {
    color: #1e293b !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-waveform-attachment,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-audio-attachment,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-file-attachment {
    background: #1e2433 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-audio-name,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .bubble-agent .cs-file-name {
    color: #e2e8f0 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-input-area-modern {
    background: var(--wx-bg) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-input-wrapper--wechat-pc textarea {
    background: transparent !important;
    color: var(--wx-composer-text) !important;
    border: none !important;
    caret-color: var(--wx-brand) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern.cs-composer-editable.is-empty:before {
    color: var(--wx-composer-placeholder) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-input-row.cs-wechat-composer {
    background: var(--wx-composer-card-bg) !important;
    border-color: var(--wx-composer-card-border) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-top {
    background: var(--wx-composer-card-bg) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar {
    background: #1a1f2e00 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-file-btn {
    color: var(--wx-composer-muted) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .chat-file-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #e2e8f0 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-history-btn {
    color: var(--wx-composer-muted) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-history-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #e2e8f0 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-chat-main-column .cs-new-message-tip {
    background: #252b3d !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--wx-brand) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-new-message-tip:hover {
    background: #2d3548 !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-messages-modern .cs-messages-truncated-banner {
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: rgba(52, 211, 153, 0.28) !important;
    color: var(--wx-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-reply-preview {
    background: rgba(30, 58, 138, 0.35) !important;
    border-color: rgba(96, 165, 250, 0.35) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-reply-label {
    color: #7dd3fc !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-sidebar {
    background: #151922 !important;
    border-left-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.45) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-header {
    background: #1e2330 !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-title {
    color: var(--wx-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-close-btn {
    color: var(--wx-sub) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-context-menu {
    background: #1e2330 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-context-menu-item {
    color: var(--wx-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-context-menu-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-context-menu-divider {
    background: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-file-preview.cs-file-preview-inline {
    color: var(--wx-composer-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-file-preview.cs-file-preview-inline .cs-wx-inline-thumb {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-drag-overlay {
    background: linear-gradient(135deg, rgba(5, 100, 70, 0.96), rgba(4, 80, 56, 0.96)) !important;
}

/* 侧栏：筛选 / 搜索 / 日历（chat.css 未逐项覆盖时避免仍呈浅灰底） */
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-filters {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    background: transparent !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-filter-btn {
    background: #252b3d !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--wx-sub) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-filter-btn:hover {
    border-color: var(--wx-brand) !important;
    color: var(--wx-brand) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-search {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-search input {
    color: var(--wx-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-search input::placeholder {
    color: var(--wx-composer-placeholder) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-date {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-date-display {
    background: #252b3d !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--wx-sub) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-calendar-btn {
    border-color: rgba(255, 255, 255, 0.1) !important;
    background: #252b3d !important;
    color: var(--wx-sub) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-calendar-panel {
    background: #1e2330 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-calendar-month,
body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-calendar-weekdays div {
    color: var(--wx-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-calendar-day {
    color: var(--wx-text) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-empty p {
    color: var(--wx-sub) !important;
}

body.dark-mode #cs-chat-window-modern.cs-wechat-skin .cs-history-close-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--wx-text) !important;
}

/* 移动端：抵消 chat.css 里输入区浅底 */
@media (max-width: 768px) {
    body.dark-mode #cs-chat-window-modern.cs-wechat-skin #cs-input-area-modern {
        background: var(--wx-bg) !important;
        border-top-color: rgba(255, 255, 255, 0.08) !important;
    }
}

/* 覆盖 chat.css 移动端把输入框压成 36px 高 — 微信卡片需多行 */
@media (max-width: 768px) {
    #cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern.cs-composer-editable,
    #cs-chat-window-modern.cs-wechat-skin .chat-input-wrapper--wechat-pc textarea {
        font-size: 15px !important;
    }

    #cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern {
        height: auto !important;
        min-height: 44px !important;
        max-height: 100px !important;
        border-radius: 0 !important;
        padding: 8px 4px 4px !important;
    }

    #cs-chat-window-modern.cs-wechat-skin #cs-message-input-modern.cs-composer-editable.is-empty:before {
        font-size: 15px !important;
    }

    #cs-chat-window-modern.cs-wechat-skin .chat-input-wrapper--wechat-pc {
        max-width: none !important;
    }

    /* 底栏：附件 / 记录 / 发送 同一水平线（抵消 chat.css 里 history 的绝对定位旧逻辑） */
    #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar {
        align-items: center !important;
    }

    #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-history-btn {
        position: relative !important;
        right: auto !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }

    #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-history-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-file-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-file-btn svg {
        width: 20px !important;
        height: 20px !important;
    }

    #cs-chat-window-modern.cs-wechat-skin .cs-wechat-composer-toolbar .chat-send-btn {
        height: 36px !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 14px !important;
        box-sizing: border-box !important;
        align-self: center !important;
    }
}
