* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at 0% 0%, #e7fff8, #f4f9ff 50%, #e8f3ff 100%);
    color: #063b3b;
}

.chat-container {
    display: flex;
    height: 100vh;
}

/* 侧边栏（dashscop 风格） */
.chat-sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid rgba(0, 143, 119, 0.15);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(9, 92, 75, 0.06);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 143, 119, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.sidebar-header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #146961;
}

/* 会话列表右侧：查询未读消息按钮与未读角标（仅坐席模式显示） */
.sidebar-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.thread-header-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thread-status-filters {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.thread-filter-btn {
    padding: 6px 12px;
    font-size: 12px;
    color: #00a283;
    background: rgba(231, 255, 248, 0.35);
    border: 1px solid rgba(0, 143, 119, 0.22);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.thread-filter-btn:hover {
    background: rgba(231, 255, 248, 0.55);
}

.thread-filter-btn.active {
    background: rgba(14, 168, 118, 0.15);
    border-color: #0ea876;
    color: #0a8f63;
}

.thread-unread-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-query-unread {
    padding: 6px 10px;
    font-size: 12px;
    color: #00a283;
    background: rgba(231, 255, 248, 0.35);
    border: 1px solid rgba(0, 143, 119, 0.22);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-query-unread.active {
    background: rgba(0, 162, 131, 0.15);
    border-color: rgba(0, 143, 119, 0.22);
    color: #058f6a;
}

.btn-query-unread:hover {
    background: rgba(231, 255, 248, 0.5);
    color: #058f6a;
}

.unread-count-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #e74c3c;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 未处理消息列表弹层（方案 A） */
.unread-list-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unread-list-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.unread-list-panel {
    position: relative;
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(9, 92, 75, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(18px);
}

.unread-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.unread-list-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.btn-close-unread-list {
    padding: 4px 8px;
    font-size: 20px;
    line-height: 1;
    color: #666;
    background: none;
    border: none;
    cursor: pointer;
}

.btn-close-unread-list:hover {
    color: #333;
}

.unread-list-body {
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}

.unread-list-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.unread-list-item:hover {
    background: #f8f9fa;
}

.unread-list-item-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.unread-list-item-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.unread-list-item-count {
    color: #e74c3c;
}

.unread-list-empty {
    padding: 24px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.btn-new-chat {
    padding: 6px 12px;
    background: linear-gradient(180deg, #07c28a, #06a87a);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(7, 194, 138, 0.35);
}

.btn-new-chat:hover {
    background: linear-gradient(180deg, #06a87a, #058f6a);
    box-shadow: 0 2px 10px rgba(7, 194, 138, 0.4);
}

.thread-list {
    flex: 1;
    overflow-y: auto;
}

/* 会话列表搜索框 */
.thread-search {
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 143, 119, 0.12);
    background: rgba(255, 255, 255, 0.9);
}

.thread-search-input {
    width: 100%;
    border: 1px solid rgba(0, 143, 119, 0.18);
    background: #fff;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    color: #333;
    outline: none;
}

.thread-search-input:focus {
    border-color: #00a283;
    box-shadow: 0 0 0 3px rgba(0, 162, 131, 0.12);
}

.thread-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    background: #ffffff;
    /* 仅对 hover 保留微过渡；active 状态切换不做过渡，避免点击时出现闪烁感 */
    transition: background 0.15s;
}

.thread-item:hover {
    background: #f8f9fa;
}

.thread-item.active {
    background: rgba(14, 168, 118, 0.12);
    border-left: 3px solid #0ea876;
    transition: none; /* 选中/取消选中瞬间切换，无过渡 */
}

.thread-item-title {
    font-weight: 500;
    margin: 0;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.thread-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.thread-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #e6fff9, #32c6a0);
    box-shadow: 0 0 12px rgba(50, 198, 160, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.thread-item-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================
   客户会话页面 - 手机端适配
   仅在 body.customer-mode 下生效
   ========================= */
@media (max-width: 768px) {
    /* 客户模式：允许页面整体滚动，避免 100vh 在手机上被地址栏压缩导致内容被裁掉 */
    body.customer-mode {
        min-height: 100vh;
        height: auto;
        overflow-y: auto;
    }

    body.customer-mode .chat-container {
        flex-direction: column;
        min-height: 100vh;
        height: auto;
    }

    /* 客户模式本身已隐藏侧边栏，这里确保在小屏幕下主区域占满宽度 */
    body.customer-mode .chat-main {
        flex: 1;
        width: 100%;
    }

    body.customer-mode .chat-header {
        padding: 12px 16px;
    }

    body.customer-mode .chat-messages {
        padding: 10px 8px;
        /* 预留底部空间，避免消息被固定输入区遮挡（略大于底部输入区整体高度） */
        padding-bottom: 160px;
        box-sizing: border-box;
        overflow-y: auto;
    }

    body.customer-mode .chat-input-area {
        padding: 8px 10px 10px;
        border-top: 1px solid rgba(0, 143, 119, 0.15);
        /* 客户会话页面：输入区整块固定在页面底部 */
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.96);
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    }

    body.customer-mode .chat-input-row {
        align-items: flex-end;
        gap: 8px;
    }

    body.customer-mode #messageInput {
        /* iOS/微信内置浏览器：输入框字号 <16px 会触发整页自动放大，这里统一调到 16px 避免页面缩放 */
        font-size: 16px;
        line-height: 1.4;
        max-height: 120px; /* 多行输入时限制高度，避免遮挡 */
    }

    body.customer-mode .btn-send-mini {
        padding: 6px 10px;
        font-size: 14px;
    }

    body.customer-mode .chat-scene-tags {
        padding: 6px 4px 4px;
        gap: 4px;
    }

    /* 客户会话页面（移动端）图片缩小为原来的约 30% 宽度（在此前基础上再缩小 50%） */
    body.customer-mode .message-image {
        max-width: 30%;
        width: 30%;
        height: auto;
    }

    /* 客户会话页面（移动端）两边气泡整体放宽一些（覆盖全局 60% 限制） */
    body.customer-mode .message-content {
        max-width: 80%;
    }
}

.thread-item-avatar-text {
    font-size: 14px;
    font-weight: 600;
    color: #063b3b;
}

/* 会话列表项：客户ID（坐席/管理端展示） */
.thread-item-customer-id {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    overflow: hidden;
}
.thread-item-customer-id-val {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.btn-copy-customer-id {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.btn-copy-customer-id svg {
    width: 13px;
    height: 13px;
}
.btn-copy-customer-id:hover {
    color: #0ea876;
    background: rgba(14,168,118,0.08);
}
.btn-copy-customer-id--copied {
    font-size: 11px;
    color: #0ea876 !important;
    width: auto !important;
    padding: 0 4px !important;
}

/* 时间与状态同一行：时间在左，状态在右 */
.thread-item-time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
}

.thread-item-time {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

.thread-item-time-row .thread-item-preview {
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
    margin-top: 0;
}

.thread-item-preview {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-item-time-row .thread-item-time {
    margin-top: 0;
}

.thread-unread-badge {
    min-width: 18px;
    padding: 0 6px;
    height: 18px;
    border-radius: 9px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    text-align: center;
    line-height: 18px;
    font-weight: 600;
}

/* 主聊天区（dashscop 风格） */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.7);
}

/* 坐席页：消息区左侧 + 常用语右侧 */
.chat-main-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.chat-main-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-main-right {
    width: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fafcfb;
    border-left: 1px solid rgba(14, 168, 118, 0.12);
}

.quick-phrase-sidebar {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 12px;
}

.quick-phrase-sidebar-collapsed-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 10px;
    border: 1px solid rgba(0, 143, 119, 0.15);
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    background: rgba(231, 255, 248, 0.35);
    color: #146961;
    font-weight: 600;
}

.quick-phrase-sidebar-collapsed-header:hover {
    background: rgba(231, 255, 248, 0.55);
}

.quick-phrase-sidebar-title {
    white-space: nowrap;
}

.quick-phrase-sidebar-caret {
    font-size: 14px;
    color: #058f6a;
}

.quick-phrase-sidebar-close-btn {
    border: none;
    background: #ff4d4f;
    color: #fff;
    border-radius: 10px;
    padding: 2px 10px;
    font-size: 12px;
    cursor: pointer;
}

.quick-phrase-sidebar-close-btn:hover {
    background: #ff7875;
}

.quick-phrase-sidebar-open-btn {
    position: fixed;
    right: 12px;
    top: 45%;
    transform: translateY(-50%);
    z-index: 2001;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid #ff4d4f;
    background: #fff;
    color: #ff4d4f;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(255, 77, 79, 0.18);
}

.quick-phrase-sidebar-open-btn:hover {
    background: #ff4d4f;
    color: #fff;
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(14, 168, 118, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(9, 60, 40, 0.06);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/* 状态徽章：进行中=绿色，已关闭=灰色（会话列表与聊天头部共用） */
.status-badge {
    padding: 2px 8px;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
}
.status-badge-open,
.status-badge.status-badge-open {
    background: #0ea876;
}
.status-badge-closed,
.status-badge.status-badge-closed {
    background: #9e9e9e;
}
.thread-item-preview .status-badge {
    margin-left: 2px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

.btn-icon:hover {
    color: #333;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7fbf9;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}
.empty-state-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 24px; }
.empty-state-icon { font-size: 2.4em; opacity: .4; }
.empty-state-title { font-size: 15px; font-weight: 600; color: #8aa; }
.empty-state-hint { font-size: 13px; color: #aaa; line-height: 1.5; }

/* 会话已自动关闭：内层单列纵向排布，避免多段落在 flex 下横向排列导致排版错乱 */
.empty-state-closed {
    flex-direction: column;
}
.empty-state-closed-inner {
    text-align: center;
    max-width: 320px;
    padding: 20px;
}
.empty-state-closed-title {
    font-size: 16px;
    margin: 0 0 10px 0;
    color: #666;
}
.empty-state-closed-desc {
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
    color: #999;
}
.empty-state-closed-desc + .empty-state-closed-desc {
    margin-top: 10px;
}

/* 重新开始会话按钮 */
.btn-restart-session {
    margin-top: 20px;
    padding: 10px 24px;
    font-size: 14px;
    color: #fff;
    background: linear-gradient(180deg, #07c28a, #06a87a);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(7, 194, 138, 0.35);
    transition: transform 0.15s, box-shadow 0.2s;
}
.btn-restart-session:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7, 194, 138, 0.4);
}

.message-item {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-item.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #e6fff9, #32c6a0);
    color: #063b3b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 0 12px rgba(50, 198, 160, 0.4);
}

.message-avatar .message-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-item.own .message-avatar {
    background: #27ae60;
}

/* 对方消息气泡（客户会话中为智能客服/人工客服回复，坐席会话中为客户消息） */
.message-content {
    max-width: 60%;
    background: #ffffff;
    color: #202124;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    position: relative;
}

.message-item.own .message-content {
    background: rgba(14, 168, 118, 0.18);
    color: #0b2e25;
    border-radius: 12px 12px 4px 12px;
    border: 1px solid rgba(14, 168, 118, 0.25);
}
/* 自己发送的气泡右侧小尾巴 */
.message-item.own .message-content::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 14px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid rgba(14, 168, 118, 0.25);
}

.message-text {
    margin: 0;
    word-wrap: break-word;
    line-height: 1.5;
    overflow: hidden;
    /* 保留换行：后端/ MCP 返回的 \n 在页面显示为换行 */
    white-space: pre-line;
}

/* 撤回消息占位样式 */
.message-revoked {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
}

.message-item:not(.own) .message-revoked {
    color: #999;
}

/* 系统通知消息：居中显示，不显示头像/气泡；时间在提示文案下方 */
.message-item.message-system-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 16px 6px;
    margin: 2px 0;
}
.message-system-notice-text {
    font-size: 12px;
    color: #999;
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 10px;
    border-radius: 10px;
    text-align: center;
}
.message-system-notice-time {
    font-size: 11px;
    color: #bbb;
    text-align: center;
    line-height: 1.2;
}

/* 无在线坐席转留言提示：相对普通系统条加大、加粗 */
.message-item.message-system-notice.message-system-notice--no-agent {
    padding: 8px 12px;
}
.message-system-notice--no-agent .message-system-notice-text {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    max-width: min(92vw, 440px);
    line-height: 1.55;
    padding: 10px 14px;
}

/* ===== 邀请评价卡片 ===== */
.message-invite-rating-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 16px;
    margin: 4px 0;
}
.invite-rating-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 20px 14px;
    width: min(320px, 88vw);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.invite-rating-icon { font-size: 22px; line-height: 1; }
.invite-rating-title { font-size: 14px; font-weight: 700; color: #1a2332; }
.invite-rating-desc { font-size: 12.5px; color: #666; text-align: center; line-height: 1.5; }
.invite-rating-faces {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    justify-content: center;
}
.invite-face-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 14px;
    padding: 12px 10px 10px;
    cursor: pointer;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
    line-height: 1;
    min-width: 78px;
    font-size: 34px;
    border: 2px solid transparent;
}
.invite-face-btn span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
}
.invite-face-btn:active { transform: scale(.95); }

/* 满意（绿）— 默认就是绿底色 */
.invite-face-btn[data-score="3"] {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, .22);
}
.invite-face-btn[data-score="3"] span { color: #047857; }
.invite-face-btn[data-score="3"].selected {
    border-color: #047857;
    box-shadow: 0 6px 18px rgba(16, 185, 129, .45);
}
/* 一般（黄）— 默认就是黄底色 */
.invite-face-btn[data-score="2"] {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, .22);
}
.invite-face-btn[data-score="2"] span { color: #b45309; }
.invite-face-btn[data-score="2"].selected {
    border-color: #b45309;
    box-shadow: 0 6px 18px rgba(245, 158, 11, .45);
}
/* 不满意（红）— 默认就是红底色 */
.invite-face-btn[data-score="1"] {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, .22);
}
.invite-face-btn[data-score="1"] span { color: #b91c1c; }
.invite-face-btn[data-score="1"].selected {
    border-color: #b91c1c;
    box-shadow: 0 6px 18px rgba(239, 68, 68, .45);
}

.invite-face-btn.selected { transform: translateY(-2px); }
.invite-rating-card--done { padding: 18px 20px; }
.invite-rating-done {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #0ea876;
    font-weight: 600;
}
.invite-rating-time {
    font-size: 11px;
    color: #bbb;
    margin-top: 4px;
}
/* 邀请评价按钮：工具栏中带文字胶囊，与 btn-tool-note 并排 */
.btn-invite-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #d97706;
    background: #fef9ee;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.btn-invite-rating:hover { background: #fef3c7; border-color: #f59e0b; }
.btn-invite-rating:disabled { opacity: 0.5; cursor: default; }

/* 赠送优惠券按钮：与服务评价模版消息 API 配套，坐席手动触发 */
.btn-gift-coupon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.btn-gift-coupon:hover { background: #fee2e2; border-color: #f87171; }
.btn-gift-coupon:disabled { opacity: 0.5; cursor: default; }

/* 撤回按钮样式（仅坐席端自己消息显示） */
.message-revoke-btn {
    margin-left: 8px;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    background: transparent;
    color: #333;
    cursor: pointer;
    vertical-align: middle;
}

/* 客户会话页：顶部「查看更多历史消息」按钮样式 */
.chat-load-more-history {
    text-align: center;
    padding: 6px 0;
    font-size: 13px;
    color: #0a7f66;
    cursor: pointer;
}
.chat-load-more-history:hover {
    color: #065845;
}

.message-item:not(.own) .message-revoke-btn {
    border-color: #ccc;
    color: #666;
}

.message-item.own .message-revoke-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.message-revoke-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.message-item:not(.own) .message-revoke-btn:hover {
    background: #f0f0f0;
}

.message-image {
    max-width: 220px;
    max-height: 220px;
    display: block;
    border-radius: 8px;
    cursor: pointer;
}

.message-image:hover {
    opacity: 0.9;
}

.message-video {
    max-width: 220px;
    max-height: 220px;
    display: block;
    border-radius: 8px;
    background: #000;
}

/* 坐席会话：Excel / PDF / Word 等附件链接 */
.message-file-link {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
    color: #1a73e8;
    text-decoration: underline;
    font-size: 14px;
    line-height: 1.4;
}

.message-file-link:hover {
    color: #1557b0;
}

/* 图片查看弹层：会话中点击图片查看大图（支持放大/缩小/滚轮缩放） */
.image-viewer-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.image-viewer-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: min(96vw, 1200px);
    max-height: 96vh;
    width: 100%;
}

.image-viewer-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    opacity: 0.9;
}

.image-viewer-close:hover {
    opacity: 1;
}

.image-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 48px 12px 8px;
    flex-shrink: 0;
}

.image-viewer-zoom-btn {
    min-width: 40px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.image-viewer-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.image-viewer-zoom-reset {
    font-size: 13px;
    min-width: 52px;
}

.image-viewer-zoom-label {
    min-width: 52px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    user-select: none;
}

.image-viewer-stage {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 24px;
    -webkit-overflow-scrolling: touch;
}

.image-viewer-img {
    max-width: 90vw;
    max-height: min(78vh, 900px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    transform-origin: center center;
    transition: transform 0.12s ease-out;
    cursor: grab;
}

.image-viewer-img:active {
    cursor: grabbing;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.message-item.own .message-time {
    color: rgba(0, 0, 0, 0.55);
}

/* 客服端：智能客服消息标签，与客户消息区分 */
.message-sender-label {
    display: block;
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.message-from-robot .message-sender-label {
    color: #16a085;
}

.message-sender-label--faq {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #2980b9 !important;
}
.sender-label-logo {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

/* AI助手头像：圆角方形，与logo设计一致 */
.message-avatar-img.message-avatar-ai {
    border-radius: 30%;
    background: transparent;
}

/* 输入区域 */
.chat-input-area {
    position: relative;
    border-top: 1px solid rgba(14, 168, 118, 0.15);
    background: #ffffff;
    padding: 12px 16px 14px;
}

/* 结束会话按钮（客户模式，与表情/图片同一行右侧） */
.btn-end-session {
    padding: 8px 16px;
    font-size: 14px;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}
.btn-end-session:hover {
    background: #eee;
    color: #333;
    border-color: #ccc;
}

/* 已关闭会话提示条（坐席模式） */
.chat-closed-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f5f5f5;
    border-top: 1px solid #e8e8e8;
    color: #888;
    font-size: 13px;
}
.btn-reopen-thread {
    padding: 4px 14px;
    font-size: 12px;
    color: #0ea876;
    background: #fff;
    border: 1px solid #0ea876;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-reopen-thread:hover {
    background: #0ea876;
    color: #fff;
}

/* 新建会话按钮（坐席侧边栏顶部） */
.btn-new-thread {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(135deg, #0ea876, #07c28a);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(14,168,118,.25);
    transition: box-shadow .2s;
}
.btn-new-thread:hover {
    background: linear-gradient(135deg, #0a8f63, #06a87a);
    box-shadow: 0 3px 8px rgba(14,168,118,.4);
}

/* 常用语折叠切换按钮 */
.quick-phrase-toggle-btn {
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.quick-phrase-toggle-btn:hover { color: #0ea876; background: rgba(14,168,118,.08); }

/* 常用语面板折叠：右侧栏收窄，显示竖排展开条 */
.chat-main-right.collapsed {
    width: 28px;
    min-width: 28px;
}

/* 折叠态竖排展开条 */
.quick-phrase-expand-bar {
    width: 28px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    color: #0ea876;
    font-size: 12px;
    font-weight: 600;
    background: #f0faf6;
    border-left: 1px solid rgba(14,168,118,.15);
    transition: background .15s;
    user-select: none;
}
.quick-phrase-expand-bar:hover {
    background: #e0f5ed;
}
.quick-phrase-expand-caret {
    margin-top: 4px;
    font-size: 10px;
    color: #0ea876;
}

/* 服务评价弹层（结束会话或主动点击服务评价时弹出） */
.evaluation-modal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
}

.evaluation-modal-content {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 40px;
    background: linear-gradient(to bottom, #fff7df, #ffffff);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 16px 20px 18px;
}

.evaluation-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.evaluation-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.evaluation-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
}

.evaluation-modal-close:hover {
    color: #666;
}

.evaluation-modal-faces {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.evaluation-face {
    position: relative;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    flex: 1;
    padding: 12px 6px 10px;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, border-color .2s;
}

.evaluation-face .face-icon {
    display: block;
    font-size: 30px;
    margin-bottom: 6px;
    line-height: 1;
}

.evaluation-face .face-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
}

.evaluation-face:active { transform: scale(.95); }

/* 满意（绿） */
.evaluation-face[data-score="3"] {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, .25);
}
.evaluation-face[data-score="3"] .face-text { color: #047857; }
.evaluation-face[data-score="3"].selected {
    border-color: #047857;
    box-shadow: 0 8px 22px rgba(16, 185, 129, .5);
}
/* 一般（黄） */
.evaluation-face[data-score="2"] {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, .25);
}
.evaluation-face[data-score="2"] .face-text { color: #b45309; }
.evaluation-face[data-score="2"].selected {
    border-color: #b45309;
    box-shadow: 0 8px 22px rgba(245, 158, 11, .5);
}
/* 不满意（红） */
.evaluation-face[data-score="1"] {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, .25);
}
.evaluation-face[data-score="1"] .face-text { color: #b91c1c; }
.evaluation-face[data-score="1"].selected {
    border-color: #b91c1c;
    box-shadow: 0 8px 22px rgba(239, 68, 68, .5);
}

.evaluation-face.selected { transform: translateY(-3px); }
.evaluation-face.selected .face-icon { transform: scale(1.15); }
.evaluation-face.selected .face-text { font-weight: 800; }

.evaluation-modal-actions {
    margin-top: 16px;
    text-align: center;
}

.evaluation-modal-actions .btn-submit-evaluation {
    padding: 8px 32px;
    background: #ff7a45;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.evaluation-modal-actions .btn-submit-evaluation:hover {
    background: #ff6a33;
}

/* 旧版工具栏仅坐席模式使用，客户模式下通过 JS 隐藏 */
.input-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}

/* 结束会话放在工具栏同一行右侧 */
.chat-end-session-row {
    margin-left: auto;
}

.btn-tool {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    color: #666;
}

.btn-tool:hover {
    color: #333;
}

.btn-tool-plus {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s ease;
}
.btn-tool-plus.open {
    transform: rotate(45deg);
}

/* 坐席端「常用语」按钮：红色描边胶囊样式（类似“服务评价”按钮） */
.btn-tool-quickphrase {
    font-size: 13px;
    padding: 4px 14px;
    margin-left: 4px;
    border-radius: 999px;
    border: 1px solid #ff4d4f;
    background: #fff5f5;
    color: #ff4d4f;
}
.btn-tool-quickphrase:hover {
    background: #ff4d4f;
    border-color: #ff4d4f;
    color: #fff;
}

/* 坐席端「客户备注」按钮：浅蓝描边胶囊 */
.btn-tool-note {
    font-size: 13px;
    padding: 4px 14px;
    margin-left: 4px;
    border-radius: 999px;
    border: 1px solid rgba(14,168,118,.4);
    background: rgba(14,168,118,.06);
    color: #0ea876;
}
.btn-tool-note:hover {
    background: #0ea876;
    border-color: #0ea876;
    color: #fff;
}

.input-box {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

body:not(.customer-mode) #messageInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    max-height: 240px;
    font-family: inherit;
}

#messageInput:focus {
    outline: none;
    border-color: #0ea876;
    box-shadow: 0 0 0 3px rgba(14, 168, 118, 0.1);
}

/* 客户模式输入框不显示焦点外圈（避免移动端出现浅色描边） */
body.customer-mode #messageInput:focus {
    border-color: transparent;
    box-shadow: none;
}

/* 拖拽图片到输入框时的高亮效果（客服会话） */
#messageInput.image-drop-active {
    border-color: rgba(0, 162, 131, 0.9);
    box-shadow: 0 0 0 2px rgba(0, 162, 131, 0.15);
}

.btn-send {
    padding: 10px 20px;
    background: linear-gradient(180deg, #07c28a, #06a87a);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-send:hover {
    background: linear-gradient(180deg, #06a87a, #058f6a);
}

.btn-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 客户模式右侧小发送按钮 */
.btn-send-mini {
    padding: 6px 10px;
    background: #ff4d4f;
    color: #fff;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.btn-send-mini:hover {
    background: #e53935;
}

/* 客户模式：场景标签行 */
.chat-scene-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    overflow-x: auto;
}

.scene-tag {
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid #ff4d4f;
    background: #fff5f5;
    color: #ff4d4f;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.scene-tag:hover {
    background: #ffecec;
}

/* 客户模式：输入行（输入框 + 表情 + 功能入口） */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border-radius: 20px;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    margin-top: 4px;
}

.chat-input-row .input-main {
    flex: 1;
}

.chat-input-row #messageInput {
    border: none;
    outline: none;
    resize: none;
    width: 100%;
    font-size: 14px;
    max-height: 240px;
    min-height: 24px;
    font-family: inherit;
}

/* 客户会话（customer-mode）输入框保持原大小 */
body.customer-mode .chat-input-row #messageInput {
    max-height: 120px;
}

.chat-input-row .input-right-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 客户模式：功能面板 */
.chat-feature-panel {
    margin-top: 8px;
    padding: 8px 4px 0;
    background: #fafafa;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
}

.feature-item {
    background: none;
    border: none;
    text-align: center;
    cursor: pointer;
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 4px;
    font-size: 22px;
}

.feature-text {
    font-size: 12px;
    color: #555;
}

/* 方案 A：消息处理中提示条（输入框上方） */
.message-processing-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    font-size: 13px;
    color: #004085;
}
.message-processing-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #b8daff;
    border-top-color: #00a283;
    border-radius: 50%;
    animation: message-processing-spin 0.8s linear infinite;
}
@keyframes message-processing-spin {
    to { transform: rotate(360deg); }
}
.message-processing-text {
    flex: 1;
}

/* 表情选择面板：全部表情下拉 */
.emoji-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0;
    display: none;
    flex-direction: column;
    max-width: 320px;
    max-height: 220px;
    z-index: 20;
}
.chat-input-area .chat-input-row ~ .emoji-panel.emoji-panel-dropdown {
    position: relative;
    bottom: auto;
    left: auto;
    max-width: none;
    margin-top: 8px;
    border: 1px solid #eee;
}
.emoji-panel-title {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}
.emoji-panel-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.emoji-item {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px;
}

.emoji-item:hover {
    transform: scale(1.1);
}

.quick-phrase-panel {
    background: #fafcfb;
    border: 1px solid rgba(14, 168, 118, 0.12);
    box-shadow: none;
    border-radius: 8px;
    padding: 0;
    display: none;
    flex-direction: column;
    width: 100%;
    flex: 1;
    height: 100%;
    max-height: none;
    z-index: 1;
    position: relative;
    min-height: 0;
}
.quick-phrase-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(14, 168, 118, 0.12);
    font-size: 14px;
    font-weight: 600;
    color: #0b2e25;
}
.quick-phrase-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.quick-phrase-title {
    margin-right: 0;
    white-space: nowrap;
}
.quick-phrase-search {
    flex: 1;
    margin-right: 0;
    min-width: 0;
}
.quick-phrase-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.quick-phrase-group-entry-btn {
    background: rgba(14,168,118,.12);
    color: #0ea876;
    border: 1px solid rgba(14,168,118,.35);
    box-shadow: none;
}
.quick-phrase-group-entry-btn:hover {
    background: rgba(14,168,118,.2);
    color: #0a8f63;
}
.quick-phrase-search-input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid #e0e0e0;
    padding: 4px 10px;
    font-size: 12px;
    box-sizing: border-box;
}
.quick-phrase-search-input::placeholder {
    color: #bbb;
}
.quick-phrase-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.quick-phrase-add-btn {
    border: none;
    background: linear-gradient(135deg, #0ea876, #07c28a);
    color: #fff;
    border-radius: 12px;
    padding: 3px 11px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(14,168,118,.25);
    transition: box-shadow .2s;
}
.quick-phrase-add-btn:hover {
    background: linear-gradient(135deg, #0a8f63, #06a87a);
    box-shadow: 0 3px 8px rgba(14,168,118,.4);
}
.quick-phrase-close-btn {
    border: none;
    background: transparent;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}
.quick-phrase-close-btn:hover {
    color: #666;
}
.quick-phrase-list {
    padding: 8px 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* 关键：防止父容器把高度撑开导致无法滚动 */
}
.quick-phrase-item {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 10px;
    border: 1px solid rgba(0, 143, 119, 0.12);
    border-radius: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.92);
    transition: background 0.15s, border-color 0.15s;
}

.quick-phrase-item:hover {
    background: #ffffff;
    border-color: rgba(0, 143, 119, 0.25);
}
.quick-phrase-image-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 0;
    flex-shrink: 0;
    cursor: pointer;
    border: 1px solid #eee;
    background: #fafafa;
}
.quick-phrase-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.quick-phrase-content {
    flex: 1;
    color: #333;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.quick-phrase-main {
    font-size: 13px;
    line-height: 1.45;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    user-select: none;
}

.quick-phrase-sub {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    background: rgba(24, 144, 255, 0.06);
    border: 1px solid rgba(24, 144, 255, 0.18);
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-phrase-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: flex-end;
}
.quick-phrase-btn {
    border: none;
    background: #f5f5f5;
    color: #333;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.quick-phrase-btn-primary {
    background: #1890ff;
    color: #fff;
}
.quick-phrase-btn-danger {
    background: #ff4d4f;
    color: #fff;
}
.quick-phrase-btn:hover {
    opacity: 0.9;
}
.quick-phrase-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 20px 24px;
    text-align: center;
    font-size: 13px;
    color: #bbb;
    line-height: 1.6;
}
.quick-phrase-empty-icon {
    font-size: 2em;
    opacity: .35;
    line-height: 1;
}
.quick-phrase-empty-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #9ab;
}
.quick-phrase-empty-hint {
    font-size: 12px;
    color: #bbb;
}

/* 常用语：分组树形列表（参考快捷回复侧栏样式） */
.quick-phrase-tree {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}
.quick-phrase-tree-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background .12s;
}
.quick-phrase-tree-node:hover {
    background: rgba(14, 168, 118, .06);
}
.quick-phrase-tree-group {
    padding-left: 6px;
    font-weight: 600;
    font-size: 12.5px;
    color: #555;
    letter-spacing: .02em;
}
.quick-phrase-tree-caret {
    display: inline-block;
    width: 14px;
    font-size: 11px;
    color: #999;
    transition: transform .15s;
}
.quick-phrase-tree-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quick-phrase-tree-leaf {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px 5px 24px;
    border-radius: 6px;
    transition: background .12s;
}
.quick-phrase-tree-leaf:hover {
    background: rgba(14, 168, 118, .07);
}
.quick-phrase-tree-thumb.quick-phrase-image-thumb {
    margin-top: 2px;
}
.quick-phrase-tree-leaf-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}
/* 行尾操作：不抢双击发送区域，点击时阻止冒泡 */
.quick-phrase-tree-actions {
    flex-shrink: 0;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 1px;
    opacity: 0;
    transition: opacity .12s;
}
.quick-phrase-tree-leaf:hover .quick-phrase-tree-actions {
    opacity: 1;
}
.quick-phrase-tree-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.35);
    border-radius: 5px;
    line-height: 0;
    transition: background .12s, color .12s;
}
.quick-phrase-tree-icon-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: rgba(0, 0, 0, 0.75);
}
.quick-phrase-tree-icon-btn.quick-phrase-tree-del-icon:hover {
    color: #e53935;
    background: rgba(229, 57, 53, .1);
}
.quick-phrase-tree-icon-btn svg {
    display: block;
}
.quick-phrase-tree-link {
    display: block;
    color: #0ea876;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    font-size: 13px;
}
.quick-phrase-tree-link:hover {
    color: #0a8f63;
}
.quick-phrase-tree-sub {
    margin-top: 2px;
    font-size: 11.5px;
    color: rgba(0, 0, 0, .45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quick-phrase-tree-empty-leaf {
    padding: 4px 0 6px 26px;
    font-size: 12px;
    color: #bbb;
}

/* 常用语：一条明细 + 下方可折叠详情 */
.quick-phrase-tree-item {
    margin-bottom: 2px;
}
.quick-phrase-tree-detail-panel {
    margin: 0 8px 8px 22px;
    padding: 10px 12px;
    background: #f7f9fc;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}
.quick-phrase-tree-detail-content {
    max-width: 100%;
    word-break: break-word;
}
.quick-phrase-tree-detail-empty {
    color: #999;
    font-size: 12px;
}
.quick-phrase-tree-detail-content + .quick-phrase-tree-detail-img-wrap {
    margin-top: 8px;
}
.quick-phrase-tree-detail-img-wrap {
    margin-top: 0;
}
.quick-phrase-tree-detail-img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    cursor: zoom-in;
    vertical-align: top;
}

.quick-phrase-group-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 13px;
    box-sizing: border-box;
    background: #fff;
}
.quick-phrase-required {
    color: #ff4d4f;
}
.quick-phrase-group-modal-box {
    max-width: 480px;
    width: 90vw;
}
.quick-phrase-group-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.quick-phrase-group-new-input {
    flex: 1;
    min-width: 120px;
}
.quick-phrase-group-manage-list {
    max-height: 40vh;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 0 10px;
}
.quick-phrase-group-manage-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
}
.quick-phrase-group-manage-row:last-child {
    border-bottom: none;
}
.quick-phrase-group-manage-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 常用语弹框 */
.quick-phrase-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.quick-phrase-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}
.quick-phrase-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
    width: 720px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.quick-phrase-modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #063d34 0%, #0a5548 50%, #0ea876 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.quick-phrase-modal-title {
    font-size: 16px;
    font-weight: 600;
}
.quick-phrase-modal-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}
.quick-phrase-modal-body {
    padding: 16px 20px 8px;
    overflow-y: auto;
}
.quick-phrase-label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
}
.quick-phrase-textarea {
    width: 100%;
    min-height: 120px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}
.quick-phrase-textarea::placeholder {
    color: #b0b0b0;
}
.quick-phrase-image-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 常用语新增：图片拖拽上传高亮 */
#quickPhraseImageDropZone {
    border-radius: 8px;
}

/* 客户备注新增：图片拖拽上传高亮 */
#customerNoteImageDropZone {
    border-radius: 8px;
}

.quick-phrase-dropzone-active {
    background: rgba(231, 255, 248, 0.6);
    outline: 2px dashed rgba(0, 162, 131, 0.9);
    outline-offset: 2px;
}
.quick-phrase-image-input {
    flex: 1;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 8px 10px;
    font-size: 14px;
}
.quick-phrase-image-upload-btn {
    border: none;
    background: linear-gradient(180deg, #07c28a, #06a87a);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.quick-phrase-image-upload-btn:hover {
    background: linear-gradient(180deg, #06a87a, #058f6a);
}
.quick-phrase-image-tip {
    margin-top: 6px;
    font-size: 12px;
    color: #888;
}
.quick-phrase-modal-footer {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
}
.quick-phrase-btn-cancel,
.quick-phrase-btn-save {
    min-width: 80px;
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    font-size: 14px;
    cursor: pointer;
}
.quick-phrase-btn-cancel {
    background: #f5f5f5;
    color: #333;
}
.quick-phrase-btn-save {
    background: linear-gradient(135deg, #0ea876, #07c28a);
    color: #fff;
    box-shadow: 0 2px 8px rgba(14,168,118,.3);
}
.quick-phrase-btn-save:hover {
    background: linear-gradient(135deg, #0a8f63, #06a87a);
    box-shadow: 0 3px 10px rgba(14,168,118,.4);
}

/* 客户备注列表样式复用常用语弹框容器 */
.customer-note-list {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 8px;
}
.customer-note-item {
    padding: 8px 0;
    border-bottom: 1px dashed #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.customer-note-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}
.customer-note-content {
    font-size: 13px;
    color: #333;
    white-space: pre-wrap;
    word-break: break-all;
}
.customer-note-image-thumb {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #fafafa;
    cursor: pointer;
    flex-shrink: 0;
}
.customer-note-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.customer-note-right {
    flex: 1;
}
.customer-note-empty {
    font-size: 13px;
    color: #999;
}
.customer-note-divider {
    margin: 8px 0;
    border-top: 1px dashed #eee;
}
.customer-note-editor {
    margin-top: 4px;
}

/* 加载状态 */
.loading {
    padding: 20px;
    text-align: center;
    color: #999;
}

/* 会话列表空状态 */
.thread-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 20px 32px;
    text-align: center;
    color: #aaa;
    pointer-events: none;
    user-select: none;
}
.thread-list-empty-icon {
    font-size: 2em;
    opacity: .35;
    line-height: 1;
    margin-bottom: 2px;
}
.thread-list-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: #9ab;
}
.thread-list-empty-hint {
    font-size: 12px;
    color: #bbb;
    line-height: 1.6;
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar,
.thread-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.thread-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.thread-list::-webkit-scrollbar-thumb {
    background: rgba(14, 168, 118, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.thread-list::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 168, 118, 0.5);
}

/* 订单申诉弹层 */
.order-appeal-modal .order-appeal-content {
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.order-appeal-total {
    font-weight: normal;
    color: #666;
    margin-left: 6px;
    font-size: 13px;
}
.order-appeal-list {
    overflow-y: auto;
    padding: 12px 0;
    max-height: 60vh;
}
.order-appeal-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid #eee;
}
.order-appeal-card:last-child {
    margin-bottom: 0;
}
.order-appeal-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}
.order-appeal-card-row:last-child {
    margin-bottom: 0;
}
.order-appeal-card-label {
    color: #666;
}
.order-appeal-card-value {
    color: #333;
    font-weight: 500;
}
.order-appeal-card-actions {
    margin-top: 12px;
    text-align: right;
}
.order-appeal-btn {
    padding: 6px 16px;
    background: linear-gradient(180deg, #07c28a, #06a87a);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.order-appeal-btn:hover {
    background: linear-gradient(180deg, #06a87a, #058f6a);
}
.order-appeal-loading,
.order-appeal-empty {
    padding: 24px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
.order-appeal-empty {
    display: block;
}

/* 订单申诉分页 */
.order-appeal-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
}
.order-appeal-page-btn {
    padding: 6px 14px;
    font-size: 13px;
    color: #00a283;
    background: #fff;
    border: 1px solid #00a283;
    border-radius: 6px;
    cursor: pointer;
}
.order-appeal-page-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #07c28a, #06a87a);
    color: #fff;
}
.order-appeal-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.order-appeal-page-info {
    font-size: 13px;
    color: #666;
}
