/* === 基础变量 === */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* === 导航栏 === */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.logo { font-size: 24px; }

.nav-links { display: flex; gap: 8px; }

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: #eff6ff; color: var(--primary); font-weight: 600; }

/* === 容器 === */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* === 页面 === */
.page { display: none; }
.page.active { display: block; }

/* === 按钮 === */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }

/* === 首页 === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.project-card h3 { font-size: 16px; margin-bottom: 8px; }
.project-card .desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; }
.project-card .meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.project-card .meta .badge {
    padding: 2px 8px;
    border-radius: 4px;
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state.small { padding: 30px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }

/* === 工作台 === */
.workspace-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.workspace-header h2 { flex: 1; }
.workspace-actions { display: flex; gap: 8px; }

/* === 标签页 === */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* === 信息收集面板 === */
.collect-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
}

.collect-progress { margin-bottom: 24px; }

.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 4px;
    transition: width 0.5s ease;
}

#collect-progress-text { font-size: 13px; color: var(--text-secondary); }

.collect-questions { min-height: 200px; }

.question-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
}

.question-card h4 { font-size: 15px; margin-bottom: 4px; }
.question-card .q-hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.question-card textarea, .question-card input, .question-card select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.question-card textarea:focus, .question-card input:focus, .question-card select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.collect-actions { display: flex; gap: 8px; margin-top: 16px; }

/* === 资料库 === */
.materials-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
}

.materials-tabs { display: flex; gap: 4px; margin-bottom: 16px; }

.m-tab {
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.m-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.materials-list { min-height: 200px; margin-bottom: 16px; }

.material-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    transition: all 0.2s;
}

.material-item:hover { border-color: var(--primary); background: #fafbff; }
.material-item .m-icon { font-size: 24px; }
.material-item .m-info { flex: 1; }
.material-item .m-title { font-size: 14px; font-weight: 600; }
.material-item .m-meta { font-size: 12px; color: var(--text-secondary); }

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

/* === 论文预览 === */
.paper-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
}

.paper-versions { margin-bottom: 16px; }
.paper-versions select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.paper-content {
    min-height: 400px;
    padding: 24px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 15px;
    line-height: 1.8;
}

.paper-content h1 { font-size: 22px; margin-bottom: 16px; }
.paper-content h2 { font-size: 18px; margin: 24px 0 12px; color: var(--primary); }
.paper-content h3 { font-size: 16px; margin: 16px 0 8px; }
.paper-content p { margin-bottom: 12px; }
.paper-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.paper-content th, .paper-content td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.paper-content th { background: var(--bg); font-weight: 600; }

.paper-actions { display: flex; gap: 8px; margin-top: 16px; }

/* === 检测报告 === */
.review-panel { }

.scorecard {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.score-item {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.score-item .score-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.score-item .score-value { font-size: 32px; font-weight: 700; }
.score-item .score-bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.score-item .score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }

.score-high { color: var(--success); }
.score-mid { color: var(--warning); }
.score-low { color: var(--danger); }
.bar-high { background: var(--success); }
.bar-mid { background: var(--warning); }
.bar-low { background: var(--danger); }

.total-score {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.total-score .big-score { font-size: 64px; font-weight: 800; color: var(--primary); }
.total-score .score-suffix { font-size: 20px; color: var(--text-secondary); }

.review-details { }

.review-stage {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    overflow: hidden;
}

.review-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.review-stage-header:hover { background: var(--bg); }
.review-stage-header h4 { font-size: 15px; }
.review-stage-header .stage-score { font-weight: 700; font-size: 18px; }
.review-stage-body { padding: 0 20px 16px; display: none; }
.review-stage-body.open { display: block; }

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg);
    font-size: 14px;
}

.check-item:last-child { border-bottom: none; }
.check-pass { color: var(--success); }
.check-fail { color: var(--danger); }
.check-warn { color: var(--warning); }

/* === 头脑风暴 === */
.brainstorm-panel { }

.brainstorm-questions {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.brainstorm-q {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border-left: 4px solid #818cf8;
}

.brainstorm-q h4 { font-size: 14px; margin-bottom: 8px; }
.brainstorm-q textarea {
    width: 100%;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.brainstorm-submit {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
}

.brainstorm-submit h4 { margin-bottom: 12px; }

.brainstorm-submit textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    margin-bottom: 12px;
}

.brainstorm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* === 微信连接页 === */
.connect-panel {
    max-width: 500px;
    margin: 60px auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 40px;
    text-align: center;
}

.connect-panel h2 { margin-bottom: 8px; }
.connect-panel p { color: var(--text-secondary); margin-bottom: 24px; }

.qr-code {
    width: 260px;
    height: 260px;
    margin: 0 auto 24px;
    background: var(--bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
}

.qr-placeholder { text-align: center; color: var(--text-secondary); }
.qr-placeholder p:first-child { font-size: 48px; margin-bottom: 8px; }
.qr-placeholder .hint { font-size: 12px; margin-top: 8px; }

.connect-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--danger); }

/* === 弹窗 === */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); }
.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 { margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* === 响应式 === */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .project-grid { grid-template-columns: 1fr; }
    .workspace-header { flex-direction: column; align-items: flex-start; }
    .workspace-actions { width: 100%; }
    .tabs { gap: 0; }
    .tab { padding: 10px 12px; font-size: 13px; }
    .score-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === 动画 === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

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

.loading { animation: pulse 1.5s infinite; }

/* === 状态面板 === */
.status-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.status-panel h3 { margin-bottom: 16px; }

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.status-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border-radius: 10px;
}

.status-icon.active { background: #fef3c7; }
.status-icon.done { background: #dcfce7; }

.status-label { font-size: 12px; color: var(--text-secondary); }
.status-value { font-size: 18px; font-weight: 700; }

.task-log { }
.task-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.task-log-header h4 { margin: 0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.task-log-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.task-log-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.task-log-item:last-child { border-bottom: none; }
.task-log-time { color: var(--text-secondary); font-size: 12px; white-space: nowrap; min-width: 50px; }
.task-log-icon { font-size: 14px; }
.task-log-msg { flex: 1; }
.task-log-empty { padding: 20px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* === 使用说明页 === */
.guide-content { max-width: 900px; margin: 0 auto; }
.guide-content > h1 { margin-bottom: 32px; }

.guide-section {
    margin-bottom: 40px;
}

.guide-section > h2 {
    font-size: 20px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.guide-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 16px;
}

.guide-card h3 { margin-bottom: 12px; font-size: 16px; }
.guide-card ol, .guide-card ul { padding-left: 20px; }
.guide-card li { margin-bottom: 6px; font-size: 14px; line-height: 1.7; }
.guide-card code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: var(--primary); }

.guide-table-wrap { overflow-x: auto; }
.guide-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.guide-table th {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
}
.guide-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.guide-table tr:hover td { background: #f8fafc; }

/* Stage 卡片 */
.stage-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.stage-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    position: relative;
}

.stage-num {
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.stage-card h4 { margin-bottom: 8px; padding-top: 4px; }
.stage-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* 工作流图 */
.workflow-diagram {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 16px 0;
    flex-wrap: wrap;
}

.wf-step {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-width: 160px;
    flex: 1;
}

.wf-num {
    background: var(--primary);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.wf-content h4 { font-size: 14px; margin-bottom: 4px; }
.wf-content p { font-size: 12px; color: var(--text-secondary); }
.wf-arrow { font-size: 20px; color: var(--primary); font-weight: 700; }

/* 循环图 */
.loop-diagram {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0 16px;
}
.loop-node {
    padding: 6px 12px;
    background: #eff6ff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}
.loop-node.fail { background: #fef3c7; }
.loop-arrow { color: var(--primary); font-weight: 700; }
.loop-note { font-size: 12px; color: var(--text-secondary); }

/* 交叉验证网格 */
.cross-val-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.cv-item {
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* 指令列表 */
.cmd-list { margin-top: 12px; }
.cmd-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bg);
}
.cmd-item:last-child { border-bottom: none; }
.cmd-item code { background: #f1f5f9; padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--primary); min-width: 200px; }
.cmd-item span { font-size: 13px; color: var(--text-secondary); }

/* 架构网格 */
.arch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.arch-item {
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.arch-item h4 { margin-bottom: 8px; }
.arch-item p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* === 任务记录面板 === */
.tasks-panel { }
.tasks-section { margin-bottom: 24px; }
.tasks-section h3 { margin-bottom: 12px; }

.task-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.task-item:last-child { border-bottom: none; }

.task-item .t-icon { font-size: 18px; margin-top: 2px; }
.task-item .t-info { flex: 1; }
.task-item .t-title { font-size: 14px; font-weight: 600; }
.task-item .t-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.task-item .t-time { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.task-item.running { background: #fffbeb; }
.task-item.done { }
.task-empty { padding: 24px; text-align: center; color: var(--text-secondary); font-size: 13px; }
