/* ===== 解码中文化基因文献智能引擎 - 现代敦煌主题 ===== */

/* ---------- 设计令牌 ---------- */
:root {
    --bg: #DFCBA9;
    --bg-light: #EDE0C8;
    --bg-dark: #D4BE96;
    --red: #924139;
    --red-dark: #7A3530;
    --red-light: #B85A50;
    --brown: #6c3413;
    --brown-text: #5a3d1e;
    --brown-light: #ac825f;
    --teal: #70948E;
    --teal-dark: #5a7d77;
    --gold: #BFA07C;
    --white: #fff;
    --black: #2c1810;

    --glass-bg: rgba(237, 224, 200, 0.65);
    --glass-border: rgba(191, 160, 124, 0.35);
    --glass-shadow: 0 8px 32px rgba(108, 52, 19, 0.10);
    --shadow-sm: 0 2px 8px rgba(108, 52, 19, 0.08);
    --shadow-hover: 0 12px 40px rgba(108, 52, 19, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-serif: "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--brown-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }

img { max-width: 100%; height: auto; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brown-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brown); }

/* ---------- 动态背景 ---------- */
.animated-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, #DFCBA9 0%, #D4BE96 25%, #EDE0C8 50%, #DFCBA9 75%, #D4BE96 100%);
    background-size: 400% 400%;
    animation: subtleGradient 20s ease infinite;
}
.animated-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/static/images/texture.png') repeat;
    opacity: 0.03;
    pointer-events: none;
}

@keyframes subtleGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ---------- 导航栏 ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(223, 203, 169, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 1px 8px rgba(108, 52, 19, 0.06);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    height: 32px;
    width: auto;
    border-radius: 4px;
}

.navbar-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 700;
    color: var(--brown);
    letter-spacing: 1px;
}

.navbar-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--brown-text);
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.4);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-ok { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.dot-warn { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.dot-error { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ---------- Tab 导航栏 ---------- */
.tab-bar {
    position: sticky;
    top: 56px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 16px;
    height: 48px;
    background: rgba(237, 224, 200, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    overflow-x: auto;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    background: none;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--brown-text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.25s var(--ease);
    white-space: nowrap;
    position: relative;
}
.tab-btn:hover {
    background: rgba(146, 65, 57, 0.08);
    color: var(--red);
}
.tab-btn.active {
    color: var(--red);
    font-weight: 600;
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    right: 20%;
    height: 2.5px;
    background: var(--red);
    border-radius: 2px;
}
.tab-btn svg { opacity: 0.6; }
.tab-btn.active svg { opacity: 1; stroke: var(--red); }

.tab-badge {
    font-size: 11px;
    background: var(--red);
    color: var(--white);
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* ---------- 主内容区 ---------- */
.main-content {
    padding: 120px 24px 40px;
    max-width: 1280px;
    margin: 0 auto;
}

.tab-panel { display: none; animation: fadeIn 0.35s var(--ease); }
.tab-panel.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--brown);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

/* ---------- 玻璃态卡片 ---------- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    padding: 20px;
    transition: all 0.3s var(--ease);
}
.glass-card:hover {
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 600;
    color: var(--brown);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- KPI 卡片行 ---------- */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.3s var(--ease);
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-icon svg { stroke: var(--white); }
.kpi-icon-total { background: linear-gradient(135deg, var(--red), var(--red-light)); }
.kpi-icon-today { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); }
.kpi-icon-week { background: linear-gradient(135deg, var(--gold), var(--brown-light)); }
.kpi-icon-rate { background: linear-gradient(135deg, #70948E, #5a7d77); }
.kpi-icon-status { background: linear-gradient(135deg, var(--brown), var(--brown-light)); }

.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--brown-light); margin-bottom: 4px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--brown); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value-sm { font-size: 16px; }
.kpi-sub { font-size: 11px; color: var(--brown-light); margin-top: 2px; }

/* ---------- 图表区域 ---------- */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}
.chart-card-wide { margin-bottom: 16px; }

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--brown);
    margin-bottom: 10px;
}

.chart-box { width: 100%; height: 260px; }
.chart-box-tall { height: 300px; }

/* ---------- 仪表盘底部 ---------- */
.dashboard-bottom {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
}

.health-card { }
.health-items { display: flex; flex-direction: column; gap: 12px; }
.health-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}
.health-item:last-child { border-bottom: none; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.health-label { font-size: 13px; color: var(--brown-text); flex: 1; }
.health-val { font-size: 12px; color: var(--brown-light); }

/* ---------- 数据表格 ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--brown);
    border-bottom: 2px solid var(--glass-border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(191, 160, 124, 0.15);
    color: var(--brown-text);
}
.data-table tbody tr:hover {
    background: rgba(146, 65, 57, 0.04);
}
.data-table .empty-cell {
    text-align: center;
    color: var(--brown-light);
    padding: 32px;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.status-pending { background: #FFF3CD; color: #856404; }
.status-ai_analyzed { background: #D1ECF1; color: #0C5460; }
.status-approved { background: #D4EDDA; color: #155724; }
.status-rejected { background: #F8D7DA; color: #721C24; }
.status-done { background: #D4EDDA; color: #155724; }
.status-running { background: #CCE5FF; color: #004085; }
.status-error { background: #F8D7DA; color: #721C24; }

/* ---------- 搜索页 ---------- */
.search-header {
    margin-bottom: 24px;
}

.search-bar-wrap {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.search-input-main {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.6);
    font-size: 15px;
    color: var(--brown-text);
    outline: none;
    transition: all 0.25s var(--ease);
}
.search-input-main:focus {
    border-color: var(--red);
    background: rgba(255,255,255,0.9);
    box-shadow: 0 0 0 3px rgba(146, 65, 57, 0.12);
}
.search-input-main::placeholder { color: var(--brown-light); }

.search-btn {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: var(--radius-lg);
}

.filter-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select, .filter-input {
    padding: 7px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.5);
    font-size: 13px;
    color: var(--brown-text);
    outline: none;
    transition: border-color 0.2s;
}
.filter-select:focus, .filter-input:focus {
    border-color: var(--red);
}

.results-count {
    font-size: 13px;
    color: var(--brown-light);
    margin-left: auto;
}

/* 结果网格 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.result-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}
.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.result-card-img {
    position: relative;
    height: 180px;
    background: var(--bg-dark);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.result-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.result-card-img .no-img {
    font-size: 48px;
    opacity: 0.15;
}
.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--white);
    background: var(--red);
}
.card-review-badge {
    position: absolute;
    top: 8px;
    left: 8px;
}

.result-card-body {
    padding: 12px 14px;
}
.result-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--brown);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}
.result-card-meta {
    font-size: 12px;
    color: var(--brown-light);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.result-card-foot {
    font-size: 11px;
    color: var(--brown-light);
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
}
.page-btn {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.4);
    font-size: 13px;
    color: var(--brown-text);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.page-btn:hover { background: rgba(146, 65, 57, 0.1); color: var(--red); }
.page-btn.active { background: var(--red); color: var(--white); border-color: var(--red); }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- 采集页 ---------- */
.source-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.source-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    position: relative;
}
.source-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.source-card.selected { border-color: var(--red); background: rgba(146, 65, 57, 0.06); }

.source-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--glass-border);
    color: var(--white);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.source-card.selected .source-check { background: var(--red); }

.source-name { font-weight: 600; color: var(--brown); margin-bottom: 4px; font-size: 15px; }
.source-url { font-size: 12px; color: var(--brown-light); margin-bottom: 8px; }
.source-count { font-size: 13px; color: var(--teal); font-weight: 600; }

/* 采集控制 */
.crawl-controls { margin-bottom: 20px; }
.control-row { margin-bottom: 14px; }
.control-row label { display: block; font-size: 13px; color: var(--brown-text); margin-bottom: 6px; font-weight: 500; }

.ctrl-input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.5);
    font-size: 14px;
    color: var(--brown-text);
    outline: none;
    transition: border-color 0.2s;
}
.ctrl-input:focus { border-color: var(--red); }

.crawl-progress { margin-bottom: 20px; }
.progress-bar-wrap {
    height: 8px;
    background: rgba(191, 160, 124, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--red), var(--red-light));
    border-radius: 4px;
    transition: width 0.5s var(--ease);
}
.progress-text { font-size: 13px; color: var(--brown-text); margin-bottom: 10px; }
.crawl-log {
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    font-family: "SF Mono", "Fira Code", monospace;
    color: var(--brown-light);
    line-height: 1.8;
}

/* ---------- 审核漏斗 ---------- */
.funnel-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.funnel-stage { text-align: center; flex: 1; max-width: 200px; }
.funnel-bar {
    height: 64px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.3s var(--ease);
}
.funnel-pending .funnel-bar { background: linear-gradient(135deg, var(--gold), var(--brown-light)); color: var(--white); }
.funnel-analyzed .funnel-bar { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: var(--white); }
.funnel-approved .funnel-bar { background: linear-gradient(135deg, #70948E, #5a7d77); color: var(--white); }
.funnel-rejected .funnel-bar { background: none; }
.funnel-bar-red { background: linear-gradient(135deg, var(--red), var(--red-dark)) !important; color: var(--white) !important; }

.funnel-num { font-size: 24px; font-weight: 700; }
.funnel-label { font-size: 13px; color: var(--brown-text); font-weight: 500; }
.funnel-arrow { font-size: 20px; color: var(--brown-light); flex-shrink: 0; }

/* 审核工具栏 */
.review-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.review-toolbar .filter-input { flex: 1; min-width: 150px; }

/* 审核操作按钮 */
.action-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.action-btn-approve { background: #D4EDDA; color: #155724; }
.action-btn-approve:hover { background: #28a745; color: var(--white); }
.action-btn-reject { background: #F8D7DA; color: #721C24; }
.action-btn-reject:hover { background: #dc3545; color: var(--white); }
.action-btn-view { background: #D1ECF1; color: #0C5460; }
.action-btn-view:hover { background: #17a2b8; color: var(--white); }

/* ---------- AI 页面 ---------- */
.ai-config-card { margin-bottom: 20px; }
.ai-config-body { overflow: hidden; transition: max-height 0.3s var(--ease); }
.ai-config-body.collapsed { max-height: 0 !important; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.collapse-icon { font-size: 12px; transition: transform 0.3s; }
.collapse-icon.up { transform: rotate(180deg); }

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.config-field label {
    display: block;
    font-size: 12px;
    color: var(--brown-light);
    margin-bottom: 4px;
    font-weight: 500;
}
.config-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.config-status {
    font-size: 13px;
    color: var(--teal);
}

/* AI 功能卡片 */
.ai-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.ai-feature-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 24px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}
.ai-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--red);
}

.ai-feature-icon { font-size: 36px; margin-bottom: 10px; }
.ai-feature-title { font-size: 14px; font-weight: 600; color: var(--brown); margin-bottom: 6px; }
.ai-feature-desc { font-size: 12px; color: var(--brown-light); line-height: 1.5; }

/* AI 对话 */
.ai-chat-card { }
.ai-chat-body {
    max-height: 420px;
    min-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding: 8px 0;
}

.ai-welcome-msg {
    background: rgba(255,255,255,0.5);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--brown-text);
    line-height: 1.7;
}
.ai-welcome-msg ul { padding-left: 20px; margin-top: 6px; }
.ai-welcome-msg li { margin-bottom: 4px; }

.ai-suggestions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.ai-suggest-btn {
    padding: 6px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: rgba(255,255,255,0.5);
    font-size: 12px;
    color: var(--brown-text);
    cursor: pointer;
    transition: all 0.2s;
}
.ai-suggest-btn:hover { border-color: var(--red); color: var(--red); background: rgba(146,65,57,0.06); }

.chat-msg {
    display: flex;
    margin-bottom: 12px;
    gap: 8px;
    animation: fadeIn 0.3s var(--ease);
}
.chat-msg-user { flex-direction: row-reverse; }
.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.chat-msg-user .chat-msg-avatar { background: var(--red); color: var(--white); }
.chat-msg-bot .chat-msg-avatar { background: var(--teal); color: var(--white); }

.chat-msg-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
}
.chat-msg-user .chat-msg-content {
    background: var(--red);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.chat-msg-bot .chat-msg-content {
    background: rgba(255,255,255,0.7);
    color: var(--brown-text);
    border-bottom-left-radius: 4px;
}
.chat-msg-bot .chat-msg-content p { margin-bottom: 8px; }
.chat-msg-bot .chat-msg-content p:last-child { margin-bottom: 0; }
.chat-msg-bot .chat-msg-content ul, .chat-msg-bot .chat-msg-content ol { padding-left: 18px; margin-bottom: 8px; }
.chat-msg-bot .chat-msg-content code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 3px; font-size: 13px; }

.chat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.5);
    border-radius: var(--radius-md);
    border-bottom-left-radius: 4px;
    max-width: 60px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brown-light);
    animation: typingPulse 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

.ai-chat-footer {
    display: flex;
    gap: 8px;
}
.ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.5);
    font-size: 14px;
    color: var(--brown-text);
    outline: none;
    transition: border-color 0.2s;
}
.ai-chat-input:focus { border-color: var(--red); }

.ai-disclaimer {
    font-size: 11px;
    color: var(--brown-light);
    text-align: center;
    margin-top: 8px;
}

/* ---------- 按钮系统 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: var(--red);
    color: var(--white);
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(146,65,57,0.3); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--brown-text);
}
.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 32px; font-size: 15px; width: 100%; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(44, 24, 16, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 24px;
}
.modal-overlay.show { display: flex; }

.modal-box {
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(44, 24, 16, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s var(--ease-bounce);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(20px); } }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--red);
    color: var(--white);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.35); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 14px;
}
.detail-label {
    width: 100px;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--brown);
}
.detail-value {
    flex: 1;
    color: var(--brown-text);
    word-break: break-all;
}

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}
.empty-icon { font-size: 56px; opacity: 0.2; margin-bottom: 12px; }
.empty-text { font-size: 15px; color: var(--brown-light); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 300;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--white);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    animation: toastIn 0.3s var(--ease);
    max-width: 360px;
}
.toast.success { background: var(--teal); }
.toast.error { background: var(--red); }
.toast.info { background: var(--brown); }

@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }

/* ---------- 页脚 ---------- */
.site-footer {
    background: var(--red);
    color: rgba(255,255,255,0.85);
    margin-top: 40px;
}
.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-serif);
    font-size: 14px;
}
.footer-logo { height: 28px; width: auto; border-radius: 4px; opacity: 0.9; }

.footer-center {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.footer-center span { opacity: 0.7; }
.footer-center a { color: rgba(255,255,255,0.9); }
.footer-center a:hover { color: var(--white); text-decoration: underline; }

.footer-right {
    text-align: right;
    font-size: 12px;
    opacity: 0.7;
}

/* ---------- 回到顶部 ---------- */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--red);
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s var(--ease);
    box-shadow: 0 4px 12px rgba(146,65,57,0.3);
}
.scroll-top.show { opacity: 1; transform: none; }
.scroll-top:hover { background: var(--red-dark); transform: translateY(-2px); }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .kpi-row { grid-template-columns: repeat(3, 1fr); }
    .ai-features-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .navbar { padding: 0 14px; }
    .navbar-title { font-size: 14px; }
    .navbar-status { display: none; }

    .tab-bar { justify-content: flex-start; padding: 0 8px; gap: 0; }
    .tab-btn { padding: 8px 12px; font-size: 12px; }
    .tab-btn svg { display: none; }

    .main-content { padding: 116px 14px 24px; }

    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
    .source-grid { grid-template-columns: repeat(2, 1fr); }
    .config-grid { grid-template-columns: 1fr; }
    .ai-features-grid { grid-template-columns: 1fr 1fr; }
    .funnel-wrap { flex-direction: column; }
    .funnel-arrow { transform: rotate(90deg); }

    .results-grid { grid-template-columns: repeat(2, 1fr); }

    .footer-inner { flex-direction: column; text-align: center; }
    .footer-right { text-align: center; }
}

@media (max-width: 480px) {
    .kpi-row { grid-template-columns: 1fr; }
    .source-grid { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    .ai-features-grid { grid-template-columns: 1fr; }
}
