/* ==================== 基础样式 ==================== */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --tm-color: #ef4444;
    --jd-color: #3b82f6;
    
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.1);
    
    --sidebar-width: 240px;
    --toolbar-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 布局 ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    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 var(--border);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
}

.logo {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    font-size: 18px;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.version {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* 工具栏 */
.toolbar {
    height: var(--toolbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.toolbar-left h2 {
    font-size: 18px;
    font-weight: 600;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.selector-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-group label {
    font-size: 13px;
    color: var(--text-secondary);
}

.select-input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    min-width: 120px;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
}

.data-badge {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-dark);
    padding: 4px 10px;
    border-radius: 4px;
}

/* 页面内容 */
.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: 12px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== 雷达图网格 ==================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-dot.tm {
    background: var(--tm-color);
}

.legend-dot.jd {
    background: var(--jd-color);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chart-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.chart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
}

.chart-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.chart-badge.tm {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.chart-badge.jd {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.chart-body {
    padding: 16px;
    height: 240px;
}

.chart-scores {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 0 16px 16px;
}

.score-item {
    text-align: center;
    padding: 8px 4px;
    background: var(--bg-dark);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}

.score-item:hover {
    background: var(--bg-hover);
}

.score-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.score-value {
    font-size: 16px;
    font-weight: 700;
}

.score-value.green { color: var(--success); }
.score-value.orange { color: var(--warning); }
.score-value.red { color: var(--danger); }

.score-max {
    font-size: 10px;
    color: var(--text-muted);
}

/* ==================== 排名表格 ==================== */
.table-container {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th {
    background: var(--bg-dark);
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ranking-table td {
    padding: 14px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.ranking-table tr:hover td {
    background: var(--bg-hover);
}

.ranking-table tr:last-child td {
    border-bottom: none;
}

.rank-medal {
    font-size: 20px;
}

.rank-num {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ==================== 评价列表 ==================== */
.eval-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-hover);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.eval-content {
    display: grid;
    gap: 12px;
}

.eval-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    transition: transform 0.2s;
}

.eval-card:hover {
    transform: translateX(4px);
}

.eval-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.eval-waiter {
    font-weight: 600;
    color: var(--text-primary);
}

.eval-time {
    font-size: 12px;
    color: var(--text-muted);
}

.eval-score {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.eval-score.bad {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.eval-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==================== 工具提示 ==================== */
.tooltip {
    position: fixed;
    z-index: 9999;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 360px;
    line-height: 1.7;
    white-space: pre-line;
    pointer-events: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.15s;
    display: none;
}

.tooltip.show {
    display: block;
    opacity: 1;
}

.tooltip-title {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 14px;
}

/* ==================== 加载状态 ==================== */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }
}

/* ==================== 聊天记录样式 ==================== */
.chat-body {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.3);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.chat-msg.customer {
    align-items: flex-start;
    align-self: flex-start;
}

.chat-msg.agent {
    align-items: flex-end;
    align-self: flex-end;
}

.chat-role {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-msg.customer .chat-role {
    color: var(--danger);
}

.chat-msg.agent .chat-role {
    color: var(--primary);
    text-align: right;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9em;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg.customer .chat-bubble {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.chat-msg.agent .chat-bubble {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.chat-bubble img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 4px;
    cursor: pointer;
}

.chat-bubble video {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 4px;
}

.chat-bubble a {
    color: var(--primary);
    text-decoration: none;
}

.chat-bubble a:hover {
    text-decoration: underline;
}

/* 评价卡片展开状态 */
.eval-card.open {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}

.eval-card.open .expand-icon {
    transform: rotate(180deg);
}

/* ==================== 点评样式 ==================== */
.comment-section {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.2);
}

.comment-section .section-title {
    font-size: 0.9em;
    color: var(--warning);
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comment-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.comment-input-wrap input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9em;
    transition: all 0.2s;
}

.comment-input-wrap input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.comment-input-wrap input:first-child {
    max-width: 120px;
}

.comment-input-wrap input:nth-child(2) {
    flex: 1;
}

.comment-input-wrap button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.comment-input-wrap button:hover {
    background: var(--primary-dark);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    padding: 12px 14px;
    position: relative;
}

.comment-text {
    color: var(--text-primary);
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 6px;
}

.comment-time {
    font-size: 0.75em;
    color: var(--text-muted);
}

.comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.c-del {
    font-size: 0.75em;
    color: var(--danger);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.c-del:hover {
    opacity: 1;
}

/* 已点评标志 */
.comment-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
}

/* 内联标签页样式 */
.eval-tabs-inline {
    display: inline-flex;
    gap: 4px;
    margin-left: 16px;
}

.tab-btn-inline {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn-inline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn-inline.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 左右分栏布局 */
.eval-content-wrap {
    display: flex;
    gap: 0;
    min-height: 300px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
    padding: 16px;
    border-right: 1px solid var(--border);
}

/* 自定义滚动条 */
.chat-messages::-webkit-scrollbar,
.comment-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.comment-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.comment-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.comment-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.comment-section {
    width: 320px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: rgba(15, 23, 42, 0.2);
}

.comment-section .section-title {
    font-size: 0.9em;
    color: var(--warning);
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comment-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.comment-input-wrap input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9em;
    transition: all 0.2s;
}

.comment-input-wrap input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.comment-input-wrap button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.comment-input-wrap button:hover {
    background: var(--primary-dark);
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==================== 数据趋势页 ==================== */
.trend-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.trend-tab {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    background: var(--bg-card);
    font-size: 13px;
    transition: all 0.2s;
    cursor: pointer;
}
.trend-tab:hover, .trend-tab.active {
    background: var(--primary);
    color: #fff;
}
.store-tab {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    background: var(--bg-card);
    font-size: 13px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid var(--border);
}
.store-tab:hover, .store-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.trend-section {
    display: none;
}
.trend-section.active {
    display: block;
}
.chart-box {
    position: relative;
    height: 220px;
}
@media (max-width: 768px) {
    .chart-box { height: 180px; }
    .trend-nav { gap: 6px; }
    .trend-tab { padding: 6px 12px; font-size: 12px; }
}

.chart-header h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==================== 综合查询模块 ==================== */
.query-panel { margin: 16px 0; }
.query-cols { display: flex; gap: 16px; flex-wrap: wrap; }
.query-col {
    flex: 1 1 320px; min-width: 280px;
    background: var(--bg-dark); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}
.query-col-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.query-tabs { display: flex; gap: 8px; }
.query-tab {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-card); color: var(--text-secondary);
    cursor: pointer; font-size: 13px; transition: all .15s;
}
.query-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.query-input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg-card); color: var(--text-primary);
    font-size: 14px; outline: none;
}
.query-input:focus { border-color: var(--primary); }
.query-btn {
    align-self: flex-start; padding: 9px 22px; border: none; border-radius: 8px;
    background: var(--primary); color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .15s;
}
.query-btn:hover { background: var(--primary-dark); }
.query-btn:disabled { opacity: .6; cursor: not-allowed; }
.query-result {
    margin-top: 4px; min-height: 60px; padding: 12px;
    border: 1px dashed var(--border); border-radius: 8px;
    background: rgba(15,23,42,.5); font-size: 13px; line-height: 1.6;
    white-space: normal; word-break: break-all;
}
.query-msg { white-space: pre-wrap; }
.query-msg.loading { color: var(--text-secondary); }
.query-msg.warn { color: var(--warning); }
.query-msg.error { color: var(--danger); }
.query-msg.success { color: var(--text-primary); }

/* ==================== 综合查询 · 左右双栏并排公共群 ==================== */
.query-dual-container {
    display: flex;
    gap: 0;
    height: calc(100vh - 260px);
    min-height: 420px;
    margin: 0 0 16px 0;
}
.query-chat-panel:first-child {
    border-radius: 12px 0 0 12px;
    border-right: 0;
}
.query-chat-panel:last-child {
    border-radius: 0 12px 12px 0;
}
.query-chat-panel {
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.query-nick-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 12px 0;
}
.query-nick-bar label { font-size: 13px; color: var(--text-secondary); }
.query-nick-bar input {
    background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-primary);
    padding: 7px 12px; border-radius: 8px; font-size: 13px; width: 160px; outline: none;
}
.query-nick-bar input:focus { border-color: var(--primary); }
.query-chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(139,92,246,.12));
    gap: 12px; flex-wrap: wrap;
}
.query-chat-title { display: flex; flex-direction: column; gap: 2px; }
.qct-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.qct-sub { font-size: 11px; color: var(--text-muted); }
.query-chat-messages {
    flex: 1; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    background: rgba(15, 23, 42, 0.35);
}
.query-chat-messages::-webkit-scrollbar { width: 6px; }
.query-chat-messages::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); border-radius: 3px; }
.message { display: flex; flex-direction: column; max-width: 92%; }
.message.user { align-self: flex-end; align-items: flex-end; }
.message.system { align-self: flex-start; align-items: flex-start; }
.message-bubble {
    padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
    word-break: break-word; white-space: pre-wrap;
}
.message.user .message-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.message.system .message-bubble { background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-primary); border-bottom-left-radius: 4px; }
.message-sender { font-size: 11px; color: var(--text-secondary); margin-bottom: 2px; }
.message-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.message-actions { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.message-actions button {
    padding: 4px 10px; border-radius: 6px; border: 1px solid var(--warning);
    background: rgba(245,158,11,.12); color: var(--warning); font-size: 11px; cursor: pointer;
}
.message-actions button:hover { background: rgba(245,158,11,.22); }
.query-chat-input {
    display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border);
    background: var(--bg-card); align-items: flex-end;
}
.query-chat-input textarea {
    flex: 1; resize: none; min-height: 36px; max-height: 120px;
    background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-primary);
    border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.4; outline: none;
    font-family: inherit;
}
.query-chat-input textarea:focus { border-color: var(--primary); }
.query-chat-input button {
    padding: 0 16px; height: 36px; border: none; border-radius: 8px;
    background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.query-chat-input button:hover { background: var(--primary-dark); }
.query-chat-input button:disabled { opacity: .6; cursor: not-allowed; }
.query-empty-tip { color: var(--text-muted); font-size: 12px; text-align: center; margin: auto; line-height: 1.6; }

/* ===== 群内搜索 ===== */
.query-search-toggle {
    flex: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-dark); color: var(--text-secondary);
    font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.query-search-toggle:hover { border-color: var(--primary); color: var(--text-primary); }
.query-search-bar {
    display: flex; gap: 6px; align-items: center;
    padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--bg-card);
}
.query-search-bar input {
    flex: 1; min-width: 0;
    background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-primary);
    border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none;
}
.query-search-bar input:focus { border-color: var(--primary); }
.query-search-bar .qsb-go {
    padding: 0 14px; height: 32px; border: none; border-radius: 8px; cursor: pointer;
    background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
}
.query-search-bar .qsb-go:hover { background: var(--primary-dark); }
.query-search-bar .qsb-close {
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 13px;
    border: 1px solid var(--border); background: var(--bg-dark); color: var(--text-muted);
}
.query-search-bar .qsb-close:hover { color: var(--text-primary); border-color: var(--primary); }
.query-search-results {
    flex: 1; overflow-y: auto; padding: 10px 12px;
    background: rgba(15, 23, 42, 0.35);
}
.query-search-results::-webkit-scrollbar { width: 6px; }
.query-search-results::-webkit-scrollbar-thumb { background: rgba(148,163,184,.3); border-radius: 3px; }
.qsr-head {
    font-size: 12px; color: var(--text-secondary); padding: 2px 2px 8px 2px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.qsr-head b { color: var(--primary); }
.qsr-item {
    padding: 8px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 6px;
    background: var(--bg-dark); border: 1px solid var(--border);
}
.qsr-item:hover { border-color: var(--primary); background: rgba(59,130,246,.08); }
.qsr-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.qsr-sender { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.qsr-time { font-size: 10px; color: var(--text-muted); }
.qsr-snippet { font-size: 12px; color: var(--text-primary); line-height: 1.5; word-break: break-all; }
.qsr-snippet mark, .qsr-ctx-content mark {
    background: rgba(245,158,11,.35); color: #fbbf24; border-radius: 3px; padding: 0 2px;
}
.qsr-status { color: var(--text-muted); font-size: 12px; text-align: center; padding: 18px 0; }
.qsr-status.qsr-error { color: var(--danger, #ef4444); }
.qsr-status.qsr-end { padding: 10px 0; }
.qsr-more {
    display: block; width: 100%; padding: 8px 0; margin: 4px 0 8px 0;
    border: 1px dashed var(--border); border-radius: 8px; cursor: pointer;
    background: transparent; color: var(--text-secondary); font-size: 12px;
}
.qsr-more:hover { border-color: var(--primary); color: var(--text-primary); }
.qsr-more:disabled { opacity: .6; cursor: wait; }
.qsr-back {
    padding: 3px 10px; border-radius: 6px; cursor: pointer; font-size: 11px;
    border: 1px solid var(--border); background: var(--bg-dark); color: var(--text-secondary);
}
.qsr-back:hover { border-color: var(--primary); color: var(--text-primary); }
.qsr-ctx-msg {
    padding: 7px 10px; border-radius: 8px; margin-bottom: 6px;
    background: var(--bg-dark); border: 1px solid var(--border);
}
.qsr-ctx-target { border-color: var(--warning); background: rgba(245,158,11,.10); }
.qsr-ctx-content { font-size: 12px; color: var(--text-primary); line-height: 1.5; word-break: break-word; }
/* 定位闪烁高亮 */
.message.msg-flash .message-bubble {
    animation: msgFlash 1.2s ease-in-out 2;
}
@keyframes msgFlash {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px rgba(245,158,11,.65); }
}
@media (max-width: 900px) {
    .query-dual-container { flex-direction: column; height: auto; }
    .query-chat-panel { flex: none; height: calc(50vh - 120px); min-height: 300px; }
    .query-chat-panel:first-child, .query-chat-panel:last-child { border-radius: 12px; border: 1px solid var(--border); }
}
