/* ==================== 基础变量 ==================== */
:root {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --header-height: 60px;
    --sidebar-width: 300px;
    --right-panel-width: 340px;
    
    /* 场景颜色 */
    --scenario-pre-sale: #3b82f6;
    --scenario-after-sale: #f59e0b;
    --scenario-logistics: #10b981;
    --scenario-complaint: #ef4444;
    --scenario-order: #8b5cf6;
    --scenario-product: #06b6d4;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* ==================== 顶部导航 ==================== */
.header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.logo i {
    font-size: 24px;
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.status-indicator.online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-item strong {
    color: var(--text-primary);
    font-size: 16px;
    margin-left: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.platform-filters {
    display: flex;
    gap: 8px;
}

.platform-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.platform-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.platform-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    position: relative;
}

.user-menu:hover {
    background: var(--bg-secondary);
}

.user-menu.active .dropdown-menu {
    display: block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item.logout {
    color: var(--danger-color);
    border-top: 1px solid var(--border-color);
}

.dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ==================== 主体布局 ==================== */
.main-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* ==================== 左侧边栏 ==================== */
.sidebar-left {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.search-box {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.search-box i {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary-color);
}

/* 列表类型切换 */
.list-type-tabs {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
}

.type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.type-btn:hover {
    background: var(--bg-secondary);
}

.type-btn.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.type-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 场景筛选 */
.scenario-filters {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.filter-title {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scenario-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.scenario-btn {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.scenario-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.scenario-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 会话标签 */
.session-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    border-radius: 9px;
    margin-left: 4px;
}

/* 会话列表 */
.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* 列表项通用样式 */
.list-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.list-item:hover {
    background: var(--bg-secondary);
}

.list-item.active {
    background: rgba(79, 70, 229, 0.06);
    border-color: rgba(79, 70, 229, 0.2);
}

/* 会话类型标记 */
.list-item.type-session {
    border-left: 3px solid var(--info-color);
}

.list-item.type-ticket {
    border-left: 3px solid var(--warning-color);
}

.list-item.type-customer {
    border-left: 3px solid var(--success-color);
}

/* 场景标记 */
.list-item.scenario-complaint {
    background: rgba(239, 68, 68, 0.03);
}

.list-item.scenario-complaint.active {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

.avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.avatar-wrap .avatar {
    width: 44px;
    height: 44px;
}

.type-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: white;
    border: 2px solid white;
}

.type-icon.session {
    background: var(--info-color);
}

.type-icon.ticket {
    background: var(--warning-color);
}

.type-icon.customer {
    background: var(--success-color);
}

.platform-icon {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    border: 2px solid white;
}

.platform-icon.taobao {
    background: #ff5000;
}

.platform-icon.jd {
    background: #e4393c;
}

.platform-icon.pdd {
    background: #e02e24;
}

.list-content {
    flex: 1;
    min-width: 0;
}

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

.list-name {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.list-name .vip-badge {
    font-size: 9px;
    padding: 1px 5px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-radius: 4px;
}

.list-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

.list-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.list-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.unread-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-tag.ai {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.status-tag.manual {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-tag.waiting {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-tag.resolved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.scenario-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.scenario-tag.pre_sale {
    background: rgba(59, 130, 246, 0.1);
    color: var(--scenario-pre-sale);
}

.scenario-tag.after_sale {
    background: rgba(245, 158, 11, 0.1);
    color: var(--scenario-after-sale);
}

.scenario-tag.logistics {
    background: rgba(16, 185, 129, 0.1);
    color: var(--scenario-logistics);
}

.scenario-tag.complaint {
    background: rgba(239, 68, 68, 0.1);
    color: var(--scenario-complaint);
}

.scenario-tag.order {
    background: rgba(139, 92, 246, 0.1);
    color: var(--scenario-order);
}

.scenario-tag.product {
    background: rgba(6, 182, 212, 0.1);
    color: var(--scenario-product);
}

.ai-confidence {
    font-size: 10px;
    padding: 1px 5px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border-radius: 4px;
    margin-left: auto;
}

.waiting-time {
    font-size: 10px;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 3px;
}

.ticket-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.ticket-id {
    color: var(--text-tertiary);
}

.priority-tag {
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
}

.priority-tag.high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.priority-tag.normal {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* ==================== 聊天区域 ==================== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.chat-header {
    background: var(--bg-primary);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.customer-info .avatar {
    width: 44px;
    height: 44px;
}

.customer-info .info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.name-row .name {
    font-size: 16px;
    font-weight: 600;
}

.tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.tag.vip {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.platform-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

.platform-tag.taobao {
    background: rgba(255, 80, 0, 0.1);
    color: #ff5000;
}

.platform-tag.jd {
    background: rgba(228, 57, 60, 0.1);
    color: #e4393c;
}

.platform-tag.pdd {
    background: rgba(224, 46, 36, 0.1);
    color: #e02e24;
}

.scenario-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
}

.meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.meta .divide {
    margin: 0 6px;
    color: var(--border-color);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* AI 辅助栏 */
.ai-assist-bar {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.05), rgba(99, 102, 241, 0.08));
    border-bottom: 1px solid rgba(79, 70, 229, 0.1);
    padding: 12px 20px;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.ai-confidence {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 10px;
}

.ai-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--primary-light);
}

.suggestion-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ai-suggestion button {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-use {
    background: var(--primary-color);
    color: white;
    border: none;
}

.btn-use:hover {
    background: var(--primary-dark);
}

.btn-ignore {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ignore:hover {
    background: var(--border-color);
}

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

.message-group {
    margin-bottom: 20px;
}

.message-time {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.message.incoming {
    justify-content: flex-start;
}

.message.outgoing {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
}

.message-content {
    max-width: 65%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.message.incoming .message-bubble {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message.outgoing .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message.outgoing .message-meta {
    justify-content: flex-end;
}

.read-status {
    color: var(--success-color);
}

/* 系统消息 */
.system-message {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.system-message-content {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 12px;
}

.system-message-content.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.system-message-content.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* 订单卡片 */
.order-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.order-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
}

.order-card-no {
    color: var(--text-tertiary);
}

.order-card-status {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.order-card-status.shipped {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.order-card-status.delivered {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.order-card-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.order-card-product {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.order-card-product img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.order-card-product .info {
    flex: 1;
}

.order-card-product .name {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.order-card-product .spec {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.order-card-product .price {
    font-size: 14px;
    font-weight: 600;
    color: var(--danger-color);
}

.order-card-shipping {
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-secondary);
}

.order-card-shipping .company {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.order-card-shipping .tracking {
    color: var(--text-tertiary);
}

.order-card-shipping .eta {
    color: var(--success-color);
    margin-top: 4px;
}

/* 退款卡片 */
.refund-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 8px;
}

.refund-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--success-color);
}

.refund-card-body {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.refund-card-body .amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--success-color);
}

/* 工卡片片 */
.ticket-card {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 8px;
}

.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ticket-card-id {
    font-size: 13px;
    font-weight: 600;
    color: var(--warning-color);
}

.ticket-card-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* 输入区域 */
.chat-input-area {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

.input-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.tool-btn {
    padding: 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 14px;
}

.tool-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
}

.input-box {
    position: relative;
}

.input-box textarea {
    width: 100%;
    padding: 12px 100px 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
}

.input-box textarea:focus {
    border-color: var(--primary-color);
}

.input-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.shortcut-hint {
    font-size: 11px;
    color: var(--text-tertiary);
}

.btn-send {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-send:hover {
    background: var(--primary-dark);
}

.quick-reply-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.quick-reply-bar .label {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.quick-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    overflow-x: auto;
}

.quick-tag {
    padding: 5px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.quick-tag:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==================== 右侧面板 ==================== */
.sidebar-right {
    width: var(--right-panel-width);
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.panel-tabs .tab-btn {
    flex: 1;
    padding: 14px;
}

.panel-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.panel-content.active {
    display: block;
}

/* 客户资料面板 */
.customer-profile .profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.large-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vip-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-radius: 10px;
}

.profile-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.profile-tags .tag {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary-color);
}

.info-section {
    margin-bottom: 24px;
}

.info-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.info-section h4 i {
    color: var(--primary-color);
    font-size: 14px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-list .info-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.info-list .info-item .label {
    color: var(--text-secondary);
}

.info-list .info-item .value {
    color: var(--text-primary);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-grid .info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-grid .info-item .label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.info-grid .info-item .value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.info-grid .info-item .value.highlight {
    color: var(--danger-color);
    font-size: 16px;
}

.recent-orders {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.recent-item:hover {
    background: var(--bg-tertiary);
}

.recent-item img {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.recent-item .item-info {
    flex: 1;
}

.recent-item .name {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.recent-item .meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.history-item .date {
    color: var(--text-tertiary);
    min-width: 40px;
}

.history-item .type {
    flex: 1;
    color: var(--text-primary);
}

.history-item .status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

.history-item .status.resolved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

/* 订单面板 */
.order-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.order-search input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
}

.order-search button {
    padding: 10px 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.order-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
}

.order-no {
    color: var(--text-secondary);
}

.order-status {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
}

.order-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.order-status.shipped {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.order-status.delivered {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.order-product {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.order-product img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.order-product .info {
    flex: 1;
}

.order-product .name {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.order-product .spec {
    font-size: 12px;
    color: var(--text-tertiary);
}

.order-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.order-total {
    font-size: 13px;
}

.order-total .amount {
    font-weight: 600;
    color: var(--danger-color);
    font-size: 15px;
}

.order-actions {
    display: flex;
    gap: 8px;
}

.order-actions button {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-view:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-track {
    background: var(--primary-color);
    border: none;
    color: white;
}

.btn-track:hover {
    background: var(--primary-dark);
}

/* 知识库面板 */
.kb-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.kb-search input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
}

.kb-search button {
    padding: 10px 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.kb-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.kb-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kb-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.kb-item:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.kb-item .question {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.kb-item .answer {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kb-item .meta {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* 历史时间线 */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
}

.timeline-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.timeline-content {
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.timeline-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.timeline-desc {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 90%;
    max-height: 85vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

.modal.modal-large .modal-content {
    width: 700px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-group label .required {
    color: var(--danger-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.agent-item:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
}

.agent-item.selected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.agent-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.agent-info {
    flex: 1;
}

.agent-info .name {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

.agent-info .role {
    font-size: 12px;
    color: var(--text-secondary);
}

.agent-item .status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.agent-item .status.online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.agent-item .status.busy {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.transfer-history {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
}

.transfer-history i {
    color: var(--info-color);
    margin-right: 6px;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-upload {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.file-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.modal-footer button {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: var(--bg-secondary);
}

.btn-confirm {
    background: var(--primary-color);
    border: none;
    color: white;
}

.btn-confirm:hover {
    background: var(--primary-dark);
}

/* 订单详情弹窗 */
.order-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.order-detail-status {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-flow {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.status-step .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
}

.status-step.active .dot {
    background: var(--success-color);
}

.status-step.completed .dot {
    background: var(--success-color);
}

.status-step .label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.status-step.active .label {
    color: var(--success-color);
    font-weight: 500;
}

.order-detail-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.order-detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.order-detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.product-detail {
    display: flex;
    gap: 16px;
}

.product-detail img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.product-detail .info {
    flex: 1;
}

.product-detail .name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.product-detail .spec {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.product-detail .price {
    font-size: 16px;
    font-weight: 600;
    color: var(--danger-color);
}

.product-detail .price .quantity {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: normal;
}

.pricing-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.pricing-row .label {
    color: var(--text-secondary);
}

.pricing-row.total {
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 15px;
    font-weight: 600;
}

.pricing-row.total .value {
    color: var(--danger-color);
}

.shipping-detail {
    font-size: 13px;
    line-height: 1.8;
}

.shipping-detail .company {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.timeline-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item-detail {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.timeline-item-detail .time {
    width: 80px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.timeline-item-detail .content {
    flex: 1;
}

.timeline-item-detail .status {
    font-weight: 500;
    color: var(--text-primary);
}

.timeline-item-detail .desc {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 2px;
}

/* 知识库详情 */
.kb-detail-header {
    margin-bottom: 16px;
}

.kb-detail-question {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.kb-detail-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kb-detail-tag {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    color: var(--text-secondary);
}

.kb-detail-content {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.kb-detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 12px;
}

.kb-detail-meta .meta-item {
    display: flex;
    justify-content: space-between;
}

.kb-detail-meta .label {
    color: var(--text-secondary);
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ==================== 响应式 ==================== */
@media (max-width: 1400px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar-left {
        display: none;
    }
}
