:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-bg: #eef2ff;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-w: 240px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans CJK SC", "Noto Color Emoji", sans-serif; background: var(--gray-50); color: var(--gray-800); min-height: 100vh; display: flex; }
a { color: var(--primary); text-decoration: none; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--gray-900); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header h1 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.sidebar-header .logo { width: 32px; height: 32px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.sidebar-header .ver { font-size: 11px; color: var(--gray-400); font-weight: 400; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 12px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; color: var(--gray-400); font-size: 14px; transition: all .15s; cursor: pointer; margin-bottom: 2px; }
.sidebar-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,.1); margin: 8px 12px; }

/* 二级折叠菜单 */
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-title { display: flex !important; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; color: var(--gray-400); font-size: 14px; cursor: pointer; transition: all .15s; user-select: none; }
.sidebar-group-title:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-group-title .group-arrow { margin-left: auto; font-size: 10px; transition: transform .2s; }
.sidebar-group.open .sidebar-group-title .group-arrow { transform: rotate(180deg); }
.sidebar-group-items { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.sidebar-group.open .sidebar-group-items { max-height: none; }
.sidebar-group-items a { padding-left: 36px !important; font-size: 13px !important; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.api-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 6px; font-size: 12px; color: var(--gray-400); }
.api-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.api-status .dot.on { background: var(--success); }
.api-status .dot.off { background: var(--danger); }
.btn-dl { display: block; text-align: center; padding: 10px 16px; margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-radius: 8px;
    font-size: 13px; font-weight: 600; text-decoration: none; transition: opacity .2s; }
.btn-dl:hover { opacity: .85; color: #fff; }

/* Main */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; }
.topbar h2 { font-size: 18px; font-weight: 600; }
.page { display: none; padding: 24px; flex: 1; }
.page.active { display: block; }

/* Cards */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.stat-card .num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-outline { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Forms */
input, textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; font-family: inherit; transition: border-color .15s; }
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Upload Zone */
.upload-zone { border: 2px dashed var(--gray-300); border-radius: 12px; padding: 48px 24px; text-align: center; cursor: pointer; transition: all .2s; background: var(--gray-50); }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-bg); }
.upload-zone .icon { font-size: 48px; margin-bottom: 12px; }
.upload-zone p { color: var(--gray-500); font-size: 14px; }
.upload-zone .sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
th { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: var(--gray-50); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* Analysis Result */
.result-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.score-section { display: flex; align-items: center; gap: 20px; padding: 24px; border-bottom: 1px solid var(--gray-100); }
.score-circle { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; flex-shrink: 0; }
.score-circle.good { background: var(--success-bg); color: var(--success); border: 3px solid var(--success); }
.score-circle.warn { background: var(--warning-bg); color: var(--warning); border: 3px solid var(--warning); }
.score-circle.bad { background: var(--danger-bg); color: var(--danger); border: 3px solid var(--danger); }
.score-info h4 { font-size: 15px; margin-bottom: 4px; }
.score-info p { font-size: 13px; color: var(--gray-500); }

.msg-item { padding: 16px 24px; border-bottom: 1px solid var(--gray-50); }
.msg-item:last-child { border-bottom: none; }
.msg-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.msg-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.msg-badge.pass { background: var(--success-bg); color: var(--success); }
.msg-badge.fail { background: var(--danger-bg); color: var(--danger); }
.msg-content { background: var(--gray-50); padding: 12px 16px; border-radius: 6px; font-size: 13px; color: var(--gray-700); margin-bottom: 8px; border-left: 3px solid var(--gray-300); }
.msg-analysis { font-size: 13px; color: var(--gray-600); }
.msg-suggestion { margin-top: 8px; padding: 10px 14px; background: var(--primary-bg); border-radius: 6px; font-size: 13px; color: var(--primary); border-left: 3px solid var(--primary); }

/* Tags */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-green { background: #d1fae5; color: #065f46; }
.tag-red { background: #fee2e2; color: #991b1b; }

/* Issues & Highlights */
.issue-list, .highlight-list { list-style: none; padding: 0; }
.issue-list li, .highlight-list li { padding: 8px 12px; margin-bottom: 4px; border-radius: 6px; font-size: 13px; }
.issue-list li { background: var(--danger-bg); color: #991b1b; }
.highlight-list li { background: var(--success-bg); color: #065f46; }

/* Loading */
.loading { text-align: center; padding: 48px; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 9999; animation: slideIn .3s ease; box-shadow: var(--shadow-lg); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h1 span, .sidebar-nav a span, .sidebar-footer .api-status span, .sidebar-header .ver { display: none; }
    .main { margin-left: 60px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Note box */
.note-box { padding: 12px 16px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; font-size: 13px; color: #1e40af; margin-top: 16px; display: flex; align-items: flex-start; gap: 8px; }

/* AI Polish Result */
.polish-card { background: #f8fafc; border: 1px solid var(--gray-200); border-radius: 8px; padding: 16px; margin-top: 12px; }
.polish-card h4 { font-size: 14px; margin-bottom: 8px; color: var(--gray-700); }
.polish-card .content { font-size: 13px; line-height: 1.7; color: var(--gray-600); white-space: pre-wrap; }
.polish-card .actions { margin-top: 12px; display: flex; gap: 8px; }

/* Confirm Dialog */
.dialog-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.dialog-box { background: #fff; border-radius: 12px; padding: 24px; max-width: 500px; width: 90%; box-shadow: var(--shadow-lg); }
.dialog-box h4 { margin-bottom: 12px; }
.dialog-box .content { font-size: 13px; line-height: 1.6; color: var(--gray-600); max-height: 300px; overflow-y: auto; white-space: pre-wrap; margin-bottom: 16px; }
.dialog-box .actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-box textarea { margin-bottom: 12px; }
.note-box .icon { font-size: 16px; flex-shrink: 0; }

/* ========== 对话式训练界面 ========== */
.train-welcome { text-align: center; padding: 40px 20px; }
.train-welcome-icon { font-size: 56px; margin-bottom: 16px; }
.train-welcome h3 { font-size: 20px; margin-bottom: 8px; }
.train-welcome p { font-size: 14px; color: var(--gray-500); line-height: 1.8; margin-bottom: 20px; }
.train-quick-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* 聊天消息 */
.train-msg { display: flex; gap: 10px; margin-bottom: 20px; animation: fadeIn .3s; }
.train-msg.user { flex-direction: row-reverse; }
.train-msg .avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.train-msg.ai .avatar { background: var(--primary-bg); }
.train-msg.user .avatar { background: var(--gray-200); }
.train-msg .bubble { max-width: 75%; padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.7; }
.train-msg.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.train-msg.ai .bubble { background: var(--gray-100); color: var(--gray-800); border-bottom-left-radius: 4px; white-space: pre-wrap; }
.train-msg.ai .bubble.streaming { border-left: 2px solid var(--primary); }

/* 消息中的文件附件 */
.train-msg .attachments { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.train-msg .attachments .file-tag { display: flex; align-items: center; gap: 4px; padding: 4px 10px; background: rgba(255,255,255,0.2); border-radius: 6px; font-size: 11px; }
.train-msg.user .attachments .file-tag { background: rgba(255,255,255,0.2); }
.train-msg.ai .attachments .file-tag { background: var(--gray-200); }

/* 消息中的操作按钮 */
.train-msg .msg-actions { display: flex; gap: 6px; margin-top: 8px; }
.train-msg.ai .msg-actions .btn { font-size: 11px; }

/* 输入区域 */
.train-input-area { border-top: 1px solid var(--gray-200); background: #fff; padding: 12px 16px; border-radius: 0 0 var(--radius) var(--radius); }
.train-input-row { display: flex; align-items: flex-end; gap: 8px; }
.train-input-btn { width: 36px; height: 36px; border: none; background: var(--gray-100); border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: background .15s; flex-shrink: 0; }
.train-input-btn:hover { background: var(--gray-200); }
.train-input-row textarea { flex: 1; padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: 20px; font-size: 14px; resize: none; max-height: 120px; min-height: 40px; line-height: 1.4; font-family: inherit; }
.train-input-row textarea:focus { outline: none; border-color: var(--primary); }
.train-send-btn { width: 60px; height: 36px; border: none; background: var(--primary); color: #fff; border-radius: 18px; cursor: pointer; font-size: 13px; font-weight: 500; flex-shrink: 0; transition: opacity .15s; }
.train-send-btn:hover { opacity: .9; }
.train-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 文件预览 */
.train-file-preview { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.train-file-preview .file-chip { display: flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--primary-bg); border-radius: 12px; font-size: 12px; color: var(--primary); }
.train-file-preview .file-chip .remove { cursor: pointer; font-weight: bold; margin-left: 4px; opacity: .6; }
.train-file-preview .file-chip .remove:hover { opacity: 1; }
.train-file-preview .file-chip img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }

/* AI 思考动画 */
.thinking-dots { display: inline-flex; gap: 4px; padding: 8px 0; }
.thinking-dots span { width: 6px; height: 6px; background: var(--gray-400); border-radius: 50%; animation: bounce 1.4s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: .2s; }
.thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 上下文提示条 */
#trainContextBar { background: var(--gray-50); border-radius: 6px; padding: 4px 10px; margin-bottom: 4px; }

/* 消息重发按钮 */
.train-msg.user .bubble-wrapper { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-actions-user { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.train-msg.user:hover .msg-actions-user { opacity: 1; }
.btn-resend { background: none; border: 1px solid var(--gray-300); border-radius: 12px; padding: 2px 10px; font-size: 11px; color: var(--gray-500); cursor: pointer; transition: all .15s; }
.btn-resend:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }

/* 知识库文件名链接 */
.knowledge-link { color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 500; }
.knowledge-link:hover { text-decoration: underline; }

/* 可点击的文件标签 */
.file-tag.clickable { cursor: pointer; transition: all .15s; }
.file-tag.clickable:hover { opacity: .8; transform: scale(1.02); }

/* 内容查看弹窗 */
.content-dialog-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 10000; display: flex; align-items: center; justify-content: center; animation: fadeIn .2s; }
.content-dialog-box { background: #fff; border-radius: 12px; width: 90%; max-width: 700px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.content-dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.content-dialog-header h4 { font-size: 15px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80%; }
.content-dialog-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-400); padding: 4px 8px; border-radius: 4px; }
.content-dialog-close:hover { background: var(--gray-100); color: var(--gray-700); }
.content-dialog-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* ========== 知识编辑器 ========== */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); }
.tab-btn { padding: 8px 20px; border: none; background: none; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; position: relative; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--gray-800); }

/* 主布局 */
.knowledge-layout { display: flex; gap: 0; height: calc(100vh - 180px); background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }

/* 左侧分类侧边栏 */
.knowledge-sidebar { width: 220px; flex-shrink: 0; border-right: 1px solid var(--gray-100); display: flex; flex-direction: column; background: var(--gray-50); }
.knowledge-sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--gray-100); }
.knowledge-sidebar-header h4 { font-size: 13px; font-weight: 600; color: var(--gray-600); margin: 0; }
.btn-icon { width: 28px; height: 28px; border: none; background: var(--gray-200); border-radius: 6px; cursor: pointer; font-size: 16px; color: var(--gray-600); display: flex; align-items: center; justify-content: center; transition: all .15s; }
.btn-icon:hover { background: var(--primary); color: #fff; }
.knowledge-cat-list { flex: 1; overflow-y: auto; padding: 8px; }

/* 分类条目 */
.category-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 8px; margin-bottom: 2px; cursor: pointer; font-size: 13px; color: var(--gray-600); transition: all .15s; }
.category-item:hover { background: var(--gray-100); color: var(--gray-800); }
.category-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.category-item .cat-count { font-size: 11px; font-weight: 500; color: var(--gray-400); background: var(--gray-100); padding: 2px 8px; border-radius: 10px; min-width: 24px; text-align: center; }
.category-item.active .cat-count { background: var(--primary-bg); color: var(--primary); }

/* 右侧主区域 */
.knowledge-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 工具栏 */
.knowledge-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--gray-100); background: #fff; }
.knowledge-toolbar-left { display: flex; gap: 8px; align-items: center; }
.knowledge-toolbar-left .btn { font-size: 13px; padding: 7px 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.knowledge-toolbar-right { font-size: 12px; }
.knowledge-count { color: var(--gray-400); }
.knowledge-count strong { color: var(--gray-700); }

/* 规则列表容器 */
.knowledge-rule-list { flex: 1; overflow-y: auto; padding: 16px 20px 20px; background: var(--gray-50); }

/* 规则卡片 */
.rule-card { display: flex; gap: 16px; padding: 18px 20px; margin-bottom: 12px; background: #fff; border: 1px solid var(--gray-100); border-radius: 12px; transition: all .2s ease; position: relative; cursor: default; }
.rule-card:hover { border-color: var(--gray-200); box-shadow: 0 4px 16px rgba(0,0,0,.06); transform: translateY(-1px); }
.rule-card.disabled { opacity: 0.55; }
.rule-card.disabled:hover { opacity: 0.7; }
.rule-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; background: var(--primary-bg); color: var(--primary); }
.rule-card.disabled .rule-card-icon { background: var(--gray-100); color: var(--gray-400); }
.rule-card-body { flex: 1; min-width: 0; }
.rule-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rule-card-title { font-size: 15px; font-weight: 600; color: var(--gray-800); line-height: 1.3; }
.rule-card.disabled .rule-card-title { color: var(--gray-400); text-decoration: line-through; }
.rule-card-preview { font-size: 13px; color: var(--gray-500); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }
.rule-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 状态标签 */
.rule-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.rule-badge.active { background: var(--success-bg); color: #059669; }
.rule-badge.inactive { background: var(--gray-100); color: var(--gray-500); }
.rule-badge-cat { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 6px; font-size: 11px; background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.rule-badge-source { font-size: 11px; color: var(--gray-400); display: flex; align-items: center; gap: 4px; }
.rule-badge-source::before { content: ''; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--gray-300); }

/* 规则卡片操作 */
.rule-card-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }
.rule-card-actions .btn-action { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--gray-400); transition: all .15s; padding: 0; }
.rule-card-actions .btn-action:hover { background: var(--gray-100); color: var(--gray-700); }
.rule-card-actions .btn-action.edit:hover { background: var(--primary-bg); color: var(--primary); }
.rule-card-actions .btn-action.toggle:hover { background: var(--warning-bg); color: var(--warning); }
.rule-card-actions .btn-action.danger:hover { background: var(--danger-bg); color: var(--danger); }
.rule-card-actions .btn-action.test:hover { background: #fef3c7; color: #d97706; }

/* 空状态 */
.knowledge-empty { text-align: center; padding: 60px 20px; }
.knowledge-empty-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 16px; color: var(--gray-400); }
.knowledge-empty h4 { font-size: 15px; color: var(--gray-600); margin-bottom: 6px; }
.knowledge-empty p { font-size: 13px; color: var(--gray-400); }

/* ========== 弹窗 ========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 16px; box-shadow: 0 25px 60px rgba(0,0,0,.18); display: flex; flex-direction: column; position: relative; }
.rule-editor-modal { width: 560px; max-height: 90vh; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--gray-100); }
.modal-header h4 { font-size: 17px; font-weight: 700; margin: 0; color: var(--gray-800); }
.modal-close-btn { width: 32px; height: 32px; border: none; background: var(--gray-100); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--gray-500); transition: all .15s; }
.modal-close-btn:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--gray-100); }

/* 弹窗内表单增强 */
.required-star { color: var(--danger); font-weight: 400; margin-left: 2px; }
.form-input-lg { padding: 10px 14px; font-size: 14px; border-radius: 8px; border: 1px solid var(--gray-200); width: 100%; font-family: inherit; transition: all .15s; }
.form-input-lg:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-input-sm { padding: 7px 10px; font-size: 13px; border-radius: 6px; border: 1px solid var(--gray-200); font-family: inherit; transition: all .15s; }
.form-input-sm:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-bg); }
.form-textarea-lg { padding: 12px 14px; font-size: 13px; border-radius: 8px; border: 1px solid var(--gray-200); width: 100%; resize: vertical; min-height: 120px; font-family: inherit; line-height: 1.6; transition: all .15s; }
.form-textarea-lg:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

/* 分类选择器 */
.category-selector { }
.category-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.category-pill { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 16px; font-size: 12px; cursor: pointer; border: 1.5px solid var(--gray-200); background: #fff; color: var(--gray-600); transition: all .15s; }
.category-pill:hover { border-color: var(--primary); color: var(--primary); }
.category-pill.selected { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); font-weight: 500; }
.category-input-row { display: flex; align-items: center; gap: 8px; }
.category-input-row select { width: 140px; }
.cat-or { font-size: 12px; color: var(--gray-400); }
.btn-ghost { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.btn-ghost:hover { background: var(--primary-bg); }

/* 弹窗按钮 */
.btn-cancel { background: var(--gray-100); color: var(--gray-600); border: none; font-size: 13px; padding: 9px 18px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: all .15s; }
.btn-cancel:hover { background: var(--gray-200); }
.btn-save { font-size: 13px; padding: 9px 20px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* 导出下拉菜单 */
.dropdown-menu { position: absolute; top: 100%; left: 0; margin-top: 4px; background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.1); z-index: 100; min-width: 160px; overflow: hidden; }
.dropdown-menu a { display: block; padding: 8px 16px; font-size: 13px; color: var(--gray-700); text-decoration: none; transition: background .1s; }
.dropdown-menu a:hover { background: var(--gray-50); color: var(--primary); }

/* ========== 转为规则按钮 ========== */
.btn-rule-from-msg { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 2px 8px; font-size: 11px; border: 1px solid var(--primary); border-radius: 4px; background: var(--primary-bg); color: var(--primary); cursor: pointer; font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn-rule-from-msg:hover { background: var(--primary); color: #fff; }

/* ========== 标记误判按钮 ========== */
.btn-misjudge { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; padding: 2px 8px; font-size: 11px; border: 1px solid var(--danger); border-radius: 4px; background: #fff5f5; color: var(--danger); cursor: pointer; font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn-misjudge:hover { background: var(--danger); color: #fff; }

/* 误判反馈弹窗 */
.misjudge-modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.misjudge-modal .modal-box { background: #fff; border-radius: 12px; width: 520px; max-height: 80vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.15); }
.misjudge-modal .modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.misjudge-modal .modal-header h4 { font-size: 15px; font-weight: 600; color: var(--danger); display: flex; align-items: center; gap: 6px; }
.misjudge-modal .modal-body { padding: 16px 20px; }
.misjudge-modal .modal-body .info-row { margin-bottom: 12px; }
.misjudge-modal .modal-body .info-label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; font-weight: 500; }
.misjudge-modal .modal-body .info-value { font-size: 13px; color: var(--gray-800); background: var(--gray-50); padding: 8px 12px; border-radius: 6px; line-height: 1.5; max-height: 120px; overflow-y: auto; }
.misjudge-modal .modal-body textarea { width: 100%; height: 80px; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 13px; resize: vertical; font-family: inherit; }
.misjudge-modal .modal-body textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.misjudge-modal .modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 8px; }

/* ========== 文件知识库 ========== */
.files-page { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.files-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--gray-100); }
.files-header-left h3 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.files-desc { font-size: 12px; color: var(--gray-400); }
.files-header-right { display: flex; gap: 8px; align-items: center; }
.files-table-wrap { overflow-x: auto; }
.files-table { width: 100%; border-collapse: collapse; }
.files-table th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.files-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--gray-100); }
.files-table tr:hover td { background: var(--gray-50); }
.files-table .file-icon-cell { text-align: center; color: var(--gray-400); }
.files-table .file-name-cell { font-weight: 500; color: var(--gray-800); display: flex; align-items: center; gap: 8px; }
.files-table .file-name-cell .file-icon { font-size: 20px; }
.files-table .file-meta { font-size: 12px; color: var(--gray-500); }
.files-table .file-actions { display: flex; gap: 6px; }
.files-table .file-actions .btn { font-size: 12px; padding: 4px 10px; }
.content-dialog-img { text-align: center; margin-bottom: 12px; background: var(--gray-50); border-radius: 8px; padding: 12px; }
.content-dialog-text { font-size: 13px; line-height: 1.8; color: var(--gray-700); white-space: pre-wrap; word-break: break-all; max-height: 50vh; overflow-y: auto; }
.content-dialog-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--gray-200); }

/* ========== 会话质检页面 ========== */
.conv-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: 14px 16px; margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.conv-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(79,70,229,.1); }
.conv-card.selected { border-color: var(--primary); background: var(--primary-bg); }
.conv-card.good { border-left: 3px solid var(--success); }
.conv-card.warn { border-left: 3px solid var(--warning); }
.conv-card.bad { border-left: 3px solid var(--danger); }
.conv-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.conv-score-circle { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; flex-shrink: 0; }
.conv-score-circle.good { background: var(--success-bg); color: var(--success); border: 2px solid var(--success); }
.conv-score-circle.warn { background: var(--warning-bg); color: var(--warning); border: 2px solid var(--warning); }
.conv-score-circle.bad { background: var(--danger-bg); color: var(--danger); border: 2px solid var(--danger); }
.conv-score-circle.pending { background: var(--gray-50); color: var(--gray-400); border: 2px solid var(--gray-300); font-size: 14px; }
.conv-info { flex: 1; min-width: 0; }
.conv-users { font-size: 13px; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { font-size: 11px; color: var(--gray-500); display: flex; gap: 12px; }
.conv-summary { font-size: 11px; color: var(--gray-600); margin-top: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conv-actions { display: flex; gap: 6px; margin-top: 10px; justify-content: flex-end; }

/* 消息详情 */
.detail-header { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); position: sticky; top: 0; background: #fff; z-index: 1; }
.detail-header h4 { margin: 0 0 4px; font-size: 14px; }
.detail-messages { padding: 14px 12px; background: #ededed; }
/* 会话消息 · 微信气泡（客户=白/左，销售=绿/右） */
.chat-row { display: flex; align-items: flex-start; margin-bottom: 14px; }
.chat-row.me { justify-content: flex-end; }
.chat-row.cust { justify-content: flex-start; }
.chat-avatar { width: 36px; height: 36px; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; margin-top: 2px; }
.chat-avatar.cust { background: #c8c8c8; color: #444; margin-right: 10px; }
.chat-avatar.me { background: #4db6ac; color: #fff; margin-left: 10px; }
.chat-bubble-wrap { max-width: 68%; }
.chat-bubble { position: relative; padding: 9px 12px; border-radius: 6px; font-size: 13px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.chat-row.cust .chat-bubble { background: #fff; color: #111; }
.chat-row.me .chat-bubble { background: #95ec69; color: #111; }
.chat-row.cust .chat-bubble::before { content: ""; position: absolute; left: -6px; top: 12px; border: 6px solid transparent; border-right-color: #fff; border-left: 0; }
.chat-row.me .chat-bubble::before { content: ""; position: absolute; right: -6px; top: 12px; border: 6px solid transparent; border-left-color: #95ec69; border-right: 0; }
.chat-media { position: relative; border-radius: 6px; overflow: hidden; }
.chat-time-divider { text-align: center; font-size: 11px; color: #a0a0a0; margin: 12px 0; }

/* 分析结果区域 */
.analysis-stream { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; margin: 12px 16px; padding: 12px 16px; }
.analysis-stream-header { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--primary); }
.analysis-stream-content { font-size: 12px; line-height: 1.6; color: var(--gray-600); white-space: pre-wrap; max-height: 200px; overflow-y: auto; }
.analysis-section { padding: 16px; }
.analysis-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-100); }
.analysis-score-circle { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.analysis-score-circle.good { background: var(--success-bg); color: var(--success); border: 3px solid var(--success); }
.analysis-score-circle.warn { background: var(--warning-bg); color: var(--warning); border: 3px solid var(--warning); }
.analysis-score-circle.bad { background: var(--danger-bg); color: var(--danger); border: 3px solid var(--danger); }
.analysis-summary h4 { font-size: 14px; margin-bottom: 2px; }
.analysis-summary p { font-size: 12px; color: var(--gray-500); }
.analysis-details { margin-bottom: 12px; }
.analysis-item { padding: 12px 14px; border-radius: 6px; margin-bottom: 8px; }
.analysis-item.noncompliant { background: var(--danger-bg); }
.analysis-item.compliant { background: var(--success-bg); }
.analysis-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.analysis-item-content { font-size: 13px; padding: 8px 12px; background: rgba(0,0,0,.04); border-radius: 4px; margin-bottom: 6px; line-height: 1.5; }
.analysis-item-text { font-size: 12px; color: var(--gray-600); line-height: 1.5; }
.analysis-item-suggestion { margin-top: 6px; font-size: 12px; color: var(--primary); background: rgba(79,70,229,.06); padding: 6px 10px; border-radius: 4px; }
.analysis-item-reference { margin-top: 6px; font-size: 12px; color: var(--success-dark, #059669); background: rgba(5,150,105,.08); padding: 8px 10px; border-radius: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.analysis-item-reference .reference-text { flex: 1; line-height: 1.5; }
.analysis-item-reference .copy-btn { flex-shrink: 0; font-size: 11px; padding: 2px 8px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.analysis-issues, .analysis-highlights { margin-top: 12px; }
.analysis-issues h4, .analysis-highlights h4 { font-size: 13px; margin-bottom: 6px; }
.analysis-issues ul, .analysis-highlights ul { list-style: none; padding: 0; }
.analysis-issues li { padding: 4px 10px; background: var(--danger-bg); color: #991b1b; border-radius: 4px; margin-bottom: 4px; font-size: 12px; }
.analysis-highlights li { padding: 4px 10px; background: var(--success-bg); color: #065f46; border-radius: 4px; margin-bottom: 4px; font-size: 12px; }

/* ========== 销售管理 ========== */
.employee-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 6px; margin-bottom: 6px; }
.employee-row:hover { background: var(--gray-50); }
.employee-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.employee-name { font-size: 14px; font-weight: 500; }
.employee-userid { font-size: 12px; color: var(--gray-400); font-family: monospace; }
.employee-actions { display: flex; gap: 6px; }

/* ========== 多模型配置 ========== */
.model-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 8px; transition: all .15s; }
.model-card.active { border-color: var(--primary); background: var(--primary-bg); }
.model-card:hover { border-color: var(--gray-300); }
.model-card .model-icon { font-size: 24px; }
.model-card .model-info { flex: 1; }
.model-card .model-info .name { font-size: 14px; font-weight: 600; }
.model-card .model-info .desc { font-size: 12px; color: var(--gray-500); }
.model-card .model-actions { display: flex; gap: 6px; }
.model-card .model-actions .btn { padding: 4px 10px; font-size: 12px; }
.model-card .active-badge { font-size: 11px; color: var(--primary); font-weight: 600; }

/* 标签筛选 pill */
.tag-filter-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.tag-filter-pill.negative { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.tag-filter-pill.positive { background: #ecfdf5; color: #16a34a; border: 1px solid #bbf7d0; }

/* 评分筛选按钮 */
.score-filter-btn { background: var(--gray-100); border: 1px solid var(--gray-200); color: var(--gray-600); padding: 4px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; transition: all .2s; }
.score-filter-btn:hover { background: var(--gray-200); }
.score-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 紧凑搜索组合：输入框 + 搜索按钮连体 */
.search-group { display: inline-flex; align-items: stretch; border: 1px solid var(--gray-300); border-radius: 8px; overflow: hidden; background: #fff; margin-left: auto; }
.search-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.search-group input { border: none; outline: none; padding: 6px 12px; font-size: 13px; width: 200px; color: var(--gray-700); background: transparent; }
.search-group .search-btn { border: none; background: var(--primary); color: #fff; padding: 0 14px; font-size: 12.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; margin-left: 2px; }
.search-group .search-btn:hover { filter: brightness(.95); }

/* 标签筛选按钮 */
.tag-filter-btn { background: #fff; border: 1px solid var(--gray-200); color: var(--gray-600); padding: 3px 10px; border-radius: 14px; font-size: 12px; cursor: pointer; transition: all .2s; }
.tag-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.tag-filter-btn.active { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.tag-filter-btn.negative { border-color: #fecaca; color: #dc2626; }
.tag-filter-btn.negative.active { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.tag-filter-btn.positive { border-color: #bbf7d0; color: #16a34a; }
.tag-filter-btn.positive.active { background: #ecfdf5; border-color: #22c55e; color: #16a34a; }

/* 会话卡片标签 */
.conv-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.conv-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--gray-100); color: var(--gray-600); }
.conv-tag.negative { background: #fef2f2; color: #dc2626; }
.conv-tag.positive { background: #ecfdf5; color: #16a34a; }

/* 评分圆圈小徽章 */
.conv-score-badge { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex-shrink: 0; }
.conv-score-badge.good { background: var(--success-bg); color: var(--success); border: 2px solid var(--success); }
.conv-score-badge.warn { background: var(--warning-bg); color: var(--warning); border: 2px solid var(--warning); }
.conv-score-badge.bad { background: var(--danger-bg); color: var(--danger); border: 2px solid var(--danger); }
.conv-score-badge:not(.good):not(.warn):not(.bad) { background: var(--gray-50); color: var(--gray-400); border: 2px solid var(--gray-300); font-size: 14px; }

/* 会话状态标签 */
.conv-status { font-size: 11px; padding: 1px 8px; border-radius: 10px; margin-left: 8px; font-weight: 500; }
.conv-status.analyzed { background: var(--success-bg); color: var(--success); }
.conv-status.unanalyzed { background: var(--gray-100); color: var(--gray-500); }
.conv-status.analyzing { background: var(--primary-bg); color: var(--primary); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* 会话卡片元信息行（消息数+合规状态） */
.conv-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; }
.conv-score { font-weight: 600; }
.conv-score.good { color: var(--success); }
.conv-score.warn { color: var(--warning); }
.conv-score.bad { color: var(--danger); }
.conv-msg-count { color: var(--gray-500); }

/* 日期输入框全区域可点击 */
input[type="date"] { position: relative; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.01; cursor: pointer;
}

/* 聊天图片缩略图 */
.chat-img-thumb { max-width: 200px; max-height: 200px; border-radius: 6px; cursor: pointer; transition: opacity .15s; }
.chat-img-thumb:hover { opacity: 0.85; }

/* 图片查看器 */
.image-viewer-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.88); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.image-viewer-close { position: absolute; top: 16px; right: 24px; font-size: 36px; color: #fff; cursor: pointer; z-index: 1; line-height: 1; }
.image-viewer-close:hover { opacity: 0.7; }
.image-viewer-img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.5); }

/* 会话卡片日期信息 */
.conv-dates { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.conv-compliance { color: var(--success); }
.conv-compliance.pending { color: var(--gray-400); }

/* ========== 标签管理页 ========== */
.tag-table { width: 100%; border-collapse: collapse; }
.tag-table th { font-size: 12px; font-weight: 600; color: var(--gray-500); text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--gray-200); }
.tag-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.tag-table tr:hover td { background: var(--gray-50); }
.tag-table tr.tag-disabled td { opacity: 0.5; }
.tag-name-cell { font-weight: 600; }
.tag-type-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.tag-type-badge.negative { background: #fef2f2; color: #dc2626; }
.tag-type-badge.positive { background: #ecfdf5; color: #16a34a; }
.tag-desc-cell { color: var(--gray-500); font-size: 12px; max-width: 300px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--gray-300); border-radius: 22px; transition: .2s; }
.toggle-slider:before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* 登录页 */
.login-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, #1a1a2e, #16213e); z-index: 99999; display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center; }
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-box h2 { font-size: 18px; margin-bottom: 24px; color: var(--gray-800); }
.login-box .form-group { text-align: left; margin-bottom: 16px; }
.login-box .form-group input { padding: 10px 14px; }
/* 通知提醒 - 提醒群管理 */
.ng-card { border: 1px solid var(--border-color,#e5e7eb); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: var(--bg-color,#fff); }
.ng-card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ng-title { display: flex; align-items: center; gap: 10px; }
.ng-name { font-weight: 600; font-size: 15px; }
.ng-count { background: var(--primary-bg,#eef2ff); color: var(--primary,#4f46e5); font-size: 12px; padding: 2px 10px; border-radius: 12px; }
.ng-actions { display: flex; gap: 6px; }
.ng-webhook { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ng-webhook-label { white-space: nowrap; }
.ng-webhook-input { flex: 1; min-width: 200px; font-size: 12px; font-family: monospace; padding: 5px 8px; border: 1px solid var(--border-color,#e5e7eb); border-radius: 6px; background: var(--bg-color,#fff); color: var(--gray-700); outline: none; }
.ng-webhook-input:focus { border-color: var(--primary,#4f46e5); }
/* 负面标签/销售横向平铺（display:inline-block 方案） */
.ng-emp-grid, .ng-tag-grid { font-size: 13px; line-height: 2.2; white-space: normal; }
.ng-tag-item, .ng-emp-pill { display: inline-block; margin-right: 16px; padding: 0; cursor: pointer; }
.ng-tag-item input, .ng-emp-pill input { margin: 0 3px 0 0; vertical-align: middle; }
.ng-emp-pill.ng-disabled { opacity: .55; cursor: not-allowed; }
.ng-emp-name { font-weight: 500; white-space: nowrap; }
.ng-emp-hint { color: var(--gray-400); font-size: 12px; margin-left: 4px; }
.ng-save-tip { margin-top: 8px; font-size: 12px; }

/* 完整聊天记录弹窗 */
.full-conv-box { width: 880px; max-width: 96vw; height: 84vh; max-height: 92vh; }
.full-conv-info { padding: 10px 24px; font-size: 12px; color: var(--gray-500); border-bottom: 1px solid var(--gray-100); }
.full-conv-body { background: #ededed; }
.full-conv-footer { display: none; }
.full-conv-date-divider { text-align: center; font-size: 12px; color: var(--gray-500); background: var(--gray-200); border-radius: 12px; padding: 3px 12px; margin: 14px auto 10px; width: fit-content; }
.full-conv-score { font-weight: 600; }
.full-conv-score.good { color: var(--success); }
.full-conv-score.warn { color: var(--warning); }
.full-conv-score.bad { color: var(--danger); }
/* 聊天搜索 */
.search-mark { background: #fde68a; color: #92400e; padding: 0 2px; border-radius: 3px; }
.conv-hit { font-size: 12px; color: var(--gray-600); margin-top: 4px; line-height: 1.5; }
.conv-hit-who { color: var(--gray-400); margin-right: 2px; }

/* 系统日志悬停明细浮层（群发丢弃内容等） */
.syslog-msg { position: relative; }
.syslog-msg-detail {
    border-bottom: 1px dashed var(--gray-400);
    cursor: help;
}
.syslog-msg-detail::after {
    content: attr(data-detail);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 9999;
    display: none;
    min-width: 260px;
    max-width: min(560px, 80vw);
    padding: 10px 12px;
    background: rgba(28, 30, 36, 0.97);
    color: #f2f3f5;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}
.syslog-msg-detail:hover::after { display: block; }

/* ========== 页内 Tab（单层，不嵌套） ========== */
.page .tabs { display: flex; gap: 6px; background: var(--gray-100); padding: 6px; border-radius: 12px; width: fit-content; max-width: 100%; flex-wrap: wrap; border: 1px solid var(--gray-200); margin-bottom: 18px; }
.page .tab { padding: 8px 18px; border-radius: 9px; background: transparent; border: none; font-size: 13px; font-weight: 500; color: var(--gray-500); cursor: pointer; transition: all .16s ease; }
.page .tab:hover { color: var(--gray-800); }
.page .tab.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.page .tab-pane { display: none; }
.page .tab-pane.active { display: block; }
/* 页内 Tab 下内容与 tab 间距 */
.page .tabs + .tab-pane { padding-top: 0; }

/* ========== 销售管理（重构） ========== */
.page .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }

/* 工具条输入框固定宽度，避免被全局 input/select width:100% 撑满整行 */
.toolbar input.input, .toolbar input[type='text'] { flex: 0 1 280px; width: 280px; min-width: 180px; }
.toolbar select.input { flex: 0 0 130px; width: 130px; min-width: 130px; }
.page .count-tip { font-size: 12.5px; color: var(--gray-400); margin: 0 0 12px; }
.input { height: 34px; padding: 0 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; color: var(--gray-700); background: #fff; outline: none; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
select.input { height: 34px; }
.page .check { width: 16px; height: 16px; accent-color: var(--primary); }
.page table.tag-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.page table.tag-table th { text-align: left; font-weight: 600; color: var(--gray-500); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.page table.tag-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.page table.tag-table td .userid { font-family: monospace; font-size: 12px; color: var(--gray-400); }
.page table.contact-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.page table.contact-table th { text-align: left; font-weight: 600; color: var(--gray-500); font-size: 11.5px; padding: 8px 10px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); position: sticky; top: 0; }
.page table.contact-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.page table.contact-table td.userid { font-family: monospace; font-size: 12px; color: var(--gray-400); }
.group-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--gray-100); border-radius: 8px; margin-bottom: 6px; }
.group-row .name { display: flex; align-items: center; gap: 8px; }
.group-row .name .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.group-row .btn-danger { background: #fff; border: 1px solid #f3c8c8; color: var(--danger); }
.group-row .btn-danger:hover { background: var(--danger); color: #fff; }
.page .emp-sync-row { background: var(--primary-bg); }
.input { height: 34px; padding: 0 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; color: var(--gray-700); background: #fff; outline: none; }
.page .dialog-box .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
select.input { height: 34px; }


/* ============================================================
   待深聊
   ============================================================ */
.deep-row { border:1px solid var(--gray-200); border-radius:10px; padding:12px 14px; margin-bottom:16px; cursor:pointer; background:#fff; transition:all .15s; }
.deep-row:last-child { margin-bottom:0; }
.deep-row:hover { border-color:var(--primary); box-shadow:0 2px 8px rgba(79,70,229,.1); }
.deep-row.selected { border-color:var(--primary); background:var(--primary-bg); box-shadow:0 0 0 2px rgba(79,70,229,.14); }
.deep-who { font-size:13px; font-weight:700; color:var(--gray-800); }
.deep-who-sep { color:var(--gray-400); font-weight:400; }
.deep-tag { display:inline-block; font-size:10.5px; padding:1px 8px; border-radius:10px; background:#f0ebff; color:var(--primary); font-weight:600; margin-left:6px; vertical-align:middle; }
.deep-meta { font-size:11px; color:var(--gray-400); margin:5px 0; }
.deep-hook { font-size:12.5px; color:var(--gray-600); margin:6px 0 0; line-height:1.5; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.deep-moreb { font-size:10.5px; color:var(--gray-400); margin-top:6px; }

.deep-detail { padding:2px; }
.deep-dhead { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:20px; gap:8px; flex-wrap:wrap; }
.deep-dwho { font-size:15px; font-weight:700; color:var(--gray-800); }
.deep-dmeta { font-size:12px; color:var(--gray-500); margin-top:4px; }
.deep-nav { display:flex; align-items:center; gap:6px; }
.deep-nav-btn { border:1px solid var(--gray-200); background:#fff; color:var(--gray-600); width:26px; height:26px; border-radius:8px; cursor:pointer; font-size:14px; line-height:1; }
.deep-nav-btn:disabled { opacity:.4; cursor:not-allowed; }
.deep-nav-cnt { font-size:12px; color:var(--primary); font-weight:700; background:#f0ebff; border-radius:10px; padding:3px 10px; }
.deep-done-btn { background:#e9f9f1; color:#1f7a58; border:none; border-radius:8px; padding:7px 14px; font-size:13px; cursor:pointer; margin-left:6px; }
.deep-done-btn:hover { background:#d2f3e2; }

.deep-chat { background:#ededed; border-radius:12px; padding:16px 16px 8px; margin-bottom:24px; }
.deep-chat-cap { font-size:12px; color:var(--gray-500); margin:0 0 10px; }
.chat-row.cust .chat-bubble.deep-hook-bubble,
.chat-row.me .chat-bubble.deep-hook-bubble { border:2px solid var(--primary); background:#fdfaff; }
.chat-row.cust .chat-bubble.deep-hook-bubble::before { border-right-color:#fdfaff; }
.chat-row.me .chat-bubble.deep-hook-bubble::before { border-left-color:#fdfaff; }
.deep-pin { position:absolute; top:-11px; left:8px; background:var(--primary); color:#fff; font-size:10px; padding:1px 7px; border-radius:8px; white-space:nowrap; }
.deep-nocontext { font-size:12px; color:var(--gray-400); padding:8px 0; }

.deep-guide { border:1px solid var(--gray-200); border-radius:12px; padding:16px 18px; background:#fff; }
.deep-sec { display:flex; gap:12px; padding:12px 0; }
.deep-sec:not(:last-child) { border-bottom:1px solid var(--gray-100); }
.deep-num { width:24px; height:24px; border-radius:8px; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; margin-top:1px; }
.deep-num.n1 { background:#f0a020; }
.deep-num.n2 { background:#2f6bd8; }
.deep-num.n3 { background:var(--primary); }
.deep-body { flex:1; min-width:0; }
.deep-t { font-size:12.5px; font-weight:700; margin-bottom:6px; }
.deep-t.t1 { color:#b26b1a; }
.deep-t.t2 { color:#2f6bd8; }
.deep-t.t3 { color:var(--primary); }
.deep-txt { font-size:13.5px; line-height:1.8; color:var(--gray-700); }
.deep-salesbub { display:inline-block; margin:4px 0 8px; background:#95ec69; color:#111; padding:8px 12px; border-radius:8px; font-size:13px; line-height:1.6; }
.deep-verdict { display:inline-block; margin-top:6px; background:#fdeaea; color:#c0392b; font-size:12px; font-weight:700; padding:3px 10px; border-radius:8px; }
.deep-copy { margin-top:10px; background:#2f6bd8; color:#fff; border:none; border-radius:8px; padding:7px 16px; font-size:13px; cursor:pointer; }
.deep-copy:hover { opacity:.9; }
.deep-dirs { list-style:none; padding:0; margin:0; }
.deep-dirs li { font-size:13px; line-height:1.7; color:var(--gray-600); padding:4px 0 4px 18px; position:relative; }
.deep-dirs li::before { content:"▸"; position:absolute; left:2px; color:var(--primary); }
.deep-btns { display:flex; gap:10px; margin-top:20px; align-items:center; }
