/* ============================================================
   博士苑 (PhD Garden) - AI学术研究全流程平台
   样式表 · 基于 ARS v3.9.0 设计语言
   ============================================================ */

/* ==================== CSS Variables ==================== */
:root {
    /* 主色调 */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;  /* indigo */
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* 功能色 */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    /* 中性色 */
    --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-width: 280px;
    --nav-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);

    /* 字体 */
    --font-serif: 'Noto Serif SC', 'Georgia', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-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(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); text-decoration: underline; }

/* ==================== Top Navigation ==================== */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--gray-200);
    z-index: 1000;
}

.nav-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    font-size: 28px;
}
.logo-text {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
}
.logo-subtitle {
    font-size: 11px;
    color: var(--gray-400);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--gray-300);
}

.nav-links {
    display: flex;
    gap: 4px;
}
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}
.nav-link:hover { color: var(--primary-600); background: var(--primary-50); text-decoration: none; }
.nav-link.active { color: var(--primary-700); background: var(--primary-100); }

.nav-actions {
    display: flex;
    gap: 10px;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary-600); color: white; border-color: var(--primary-600); }
.btn-primary:hover { background: var(--primary-700); box-shadow: var(--shadow-md), 0 0 0 3px var(--primary-100); }
.btn-outline { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { border-color: var(--primary-300); color: var(--primary-700); background: var(--primary-50); }
.btn-glass { background: rgba(255,255,255,0.7); backdrop-filter: blur(10px); color: var(--gray-700); border-color: var(--gray-200); }
.btn-glass:hover { background: white; border-color: var(--gray-300); }

.btn-lg { padding: 12px 28px; font-size: 16px; border-radius: var(--radius-md); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-icon { font-size: 1.1em; }

/* ==================== Hero Section ==================== */
.hero {
    position: relative;
    min-height: 520px;
    padding: calc(var(--nav-height) + 60px) 24px 60px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4338ca 60%, #6366f1 100%);
    z-index: 0;
}
.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.3; }
    25% { transform: translateY(-30px) translateX(15px); opacity: 0.6; }
    50% { transform: translateY(-15px) translateX(-10px); opacity: 0.35; }
    75% { transform: translateY(-40px) translateX(20px); opacity: 0.5; }
}

.particle { animation: float ease-in-out infinite; }

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    margin-bottom: 24px;
    letter-spacing: 0.3px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 48px;
    font-weight: 700;
    color: white;
    line-height: 1.25;
    margin-bottom: 20px;
}
.gradient-text {
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 16px;
    line-height: 1.75;
    color: rgba(255,255,255,0.78);
    margin-bottom: 32px;
}
.hero-desc a { color: #fbbf24; }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 36px;
    margin-bottom: 36px;
}
.stat-item {
    text-align: center;
}
.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: white;
}
.stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
}
.btn-primary.btn-lg .btn-icon { font-size: 18px; }
.btn-glass.btn-lg { 
    color: rgba(255,255,255,0.9); 
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
}
.btn-glass.btn-lg:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.4);
    color: white;
}

/* ==================== Main Layout ==================== */
.main-container {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    gap: 24px;
    min-height: calc(100vh - 120px);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    position: sticky;
    top: calc(var(--nav-height) + 24px);
    height: fit-content;
    max-height: calc(100vh - var(--nav-height) - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar.collollapsed { width: 56px; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--gray-100);
}
.sidebar-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}
.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
}
.sidebar-toggle:hover { color: var(--gray-600); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.nav-section {
    margin-bottom: 8px;
}
.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-item.active {
    background: var(--primary-50);
    color: var(--primary-700);
    font-weight: 600;
}
.nav-icon { font-size: 18px; width: 22px; text-align: center; }
.nav-text { flex: 1; }
.nav-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 999px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

/* 侧边栏 - 文献语料库区域 */
.corpus-sidebar-section {
    background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 14px;
}
.corpus-sidebar-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-700);
}
.corpus-count {
    margin-left: auto;
    background: var(--primary-100);
    color: var(--primary-700);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
.corpus-manage-btn {
    width: 100%;
    font-size: 12px;
    padding: 6px 0;
}

/* 文献选择弹窗 - 选项卡 */
.corpus-choice-options label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}
.corpus-choice-options label:hover {
    border-color: var(--primary-300);
    background: #f8f9ff;
}
.corpus-choice-options label:has(input:checked) {
    border-color: var(--primary-500);
    background: linear-gradient(135deg, #f0f4ff, #eef2ff);
}
.corpus-choice-options input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--primary-600);
    flex-shrink: 0;
}
.corpus-choice-card > span:first-of-type {
    display: block;
    font-size: 14px;
    color: var(--gray-800);
    margin-bottom: 2px;
}
.corpus-choice-card small {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.4;
}
.progress-card {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 14px;
}
.progress-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 8px;
    font-weight: 500;
}
.progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.progress-text {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 6px;
    text-align: right;
}

/* Workspace (right side) */
.workspace {
    flex: 1;
    min-width: 0;
}

.module-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}
.module-panel.active { display: block; }

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

.panel-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.panel-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.panel-title-row h2 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.panel-icon { font-size: 26px; }
.version-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 999px;
}
.panel-desc {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.65;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-100);
}

/* ==================== Pipeline Flow ==================== */
.pipeline-flow {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.flow-stage {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stage-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 10px 10px;
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    background: white;
    cursor: pointer;
    transition: all 0.25s;
    min-width: 80px;
    position: relative;
}
.stage-node:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.stage-node.selected {
    border-color: var(--primary-500);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.stage-node.running {
    border-color: var(--warning);
    background: var(--warning-bg);
    animation: pulse 1.5s ease infinite;
}
.stage-node.completed {
    border-color: var(--success);
    background: var(--success-bg);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

.stage-num {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stage-node.completed .stage-num,
.stage-node.running .stage-num {
    background: var(--primary-600);
    color: white;
}

.stage-icon { font-size: 22px; }
.stage-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-500);
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
}
.stage-node.selected .stage-name { color: var(--primary-700); }
.stage-node.completed .stage-name { color: var(--success); }

.stage-arrow {
    font-size: 16px;
    color: var(--gray-300);
    font-weight: bold;
    padding: 0 2px;
}
.stage-arrow.mandatory {
    color: var(--warning);
    font-size: 14px;
}

/* Stage-specific colors */
.stage-research { border-top: 3px solid #8b5cf6; }
.stage-plan { border-top: 3px solid #3b82f6; }
.stage-integrity { border-top: 3px solid #f59e0b; }
.stage-review { border-top: 3px solid #ef4444; }
.stage-revise { border-top: 3px solid #f97316; }
.stage-format { border-top: 3px solid #06b6d4; }
.stage-summary { border-top: 3px solid #10b981; }

/* ==================== Control Panel ==================== */
.control-panel {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.control-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
    padding-bottom: 0;
}
.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--gray-800); }
.tab-btn.active {
    color: var(--primary-700);
    font-weight: 600;
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-600);
    border-radius: 2px 2px 0 0;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* Form elements */
.input-group { margin-bottom: 18px; }
.input-group > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.input-group input[type="text"],
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--gray-800);
    background: white;
    transition: all 0.2s;
    outline: none;
}
.input-group textarea { resize: vertical; min-height: 80px; }
.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.form-col label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.form-col select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    cursor: pointer;
    outline: none;
}
.form-col select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Toggles */
.feature-toggles, .writing-toggles, .review-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.toggle-item input[type="checkbox"] { display: none; }

.toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--gray-300);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}
.toggle-item input:checked + .toggle-switch { background: var(--primary-500); }
.toggle-item input:checked + .toggle-switch::after { transform: translateX(18px); }
.toggle-item input:disabled + .toggle-switch { opacity: 0.6; cursor: not-allowed; }

.toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}
.toggle-item small {
    font-size: 12px;
    color: var(--gray-400);
    display: block;
    margin-left: 50px;
}

.checkbox-item {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-600);
}

/* Action bar */
.action-bar {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.action-bar .btn { flex: 1; }

/* Mid-entry cards */
.mid-entry-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.entry-card {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.entry-card:hover {
    border-color: var(--primary-300);
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.entry-card.selected {
    border-color: var(--primary-500);
    background: var(--primary-50);
}
.entry-icon { font-size: 36px; margin-bottom: 10px; }
.entry-card h4 { font-size: 16px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; }
.entry-card p { font-size: 13px; color: var(--gray-500); line-height: 1.5; }
.entry-stage {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 999px;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
}
.upload-zone:hover { border-color: var(--primary-400); background: var(--primary-50); }
.upload-zone.drag-over {
    border-color: var(--primary-500);
    background: var(--primary-100);
}
.upload-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.upload-zone p { font-size: 14px; color: var(--gray-600); margin-bottom: 4px; }
.upload-zone small { font-size: 12px; color: var(--gray-400); }

/* Config grid */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.config-item label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}
.config-item input[type="range"] {
    width: 100%;
    accent-color: var(--primary-600);
}
.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}
.style-calibration {
    display: flex;
    align-items: center;
    gap: 10px;
}
.style-calibration small {
    font-size: 12px;
    color: var(--gray-400);
}

/* ==================== Output Area ==================== */
.output-area {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    margin-top: 20px;
    overflow: hidden;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.output-header h3 { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.output-actions { display: flex; gap: 8px; }

.output-log {
    padding: 20px 24px;
    max-height: 480px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.7;
    background: #0f172a;
    color: #e2e8f0;
}

.log-entry {
    padding: 3px 0;
    word-break: break-word;
}
.log-time { color: #64748b; margin-right: 8px; font-size: 12px; }
.log-msg { color: #e2e8f0; }

/* Log entry types */
.log-header { color: #fbbf24; font-weight: 700; font-size: 15px; }
.log-info { color: #94a3b8; }
.log-action { color: #38bdf8; }
.log-success { color: #34d399; }
.log-warning { color: #fbbf24; }
.log-error { color: #f87171; }
.log-mandatory { color: #fb923c; font-weight: 600; }
.log-checkpoint { color: #a78bfa; font-weight: 600; }
.log-stage { color: #c084fc; font-weight: 700; font-size: 14px; }
.log-divider {
    border-bottom: 1px solid #1e293b;
    margin: 8px 0;
    padding: 0 !important;
    height: 0 !important;
}

/* Output content area */
.output-content {
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
}

/* ==================== Mode Cards (Deep Research) ==================== */
.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mode-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 22px;
    cursor: pointer;
    transition: all 0.25s;
}
.mode-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}
.mode-card.featured {
    border-color: var(--primary-500);
    background: linear-gradient(135deg, white, var(--primary-50));
    box-shadow: var(--shadow-md);
}

.mode-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.mode-icon { font-size: 22px; }
.mode-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    flex: 1;
}
.mode-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
}
.mode-tag.recommended { background: #dbeafe; color: #1e40af; }

.mode-card h4 { font-size: 17px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.mode-card p { font-size: 13px; color: var(--gray-500); line-height: 1.55; margin-bottom: 10px; }
.mode-agents {
    font-size: 11px;
    color: var(--primary-600);
    font-weight: 600;
}

/* Agent Grid */
.agent-team-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.agent-grid.compact { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

.agent-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s;
}
.agent-card:hover {
    background: white;
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}
.agent-card.highlight {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: #fcd34d;
}
.agent-avatar { font-size: 28px; margin-bottom: 6px; }
.agent-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.3;
}
.agent-role {
    font-size: 10px;
    color: var(--gray-500);
    margin-top: 2px;
}
.agent-card.more {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--gray-400);
    font-size: 14px;
    background: var(--gray-100);
    border-style: dashed;
}

/* Research Input */
.research-input-area, .review-input-area {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.research-options { margin-bottom: 18px; }
.option-row { margin-bottom: 8px; }

/* Result Document */
.result-document {
    font-size: 14px;
    line-height: 1.75;
}
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--primary-100);
}
.result-header h3 { font-family: var(--font-serif); font-size: 20px; color: var(--gray-900); }
.result-meta { font-size: 12px; color: var(--gray-400); }

.result-section {
    margin-bottom: 20px;
}
.result-section h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}
.result-section ol, .result-section ul {
    padding-left: 20px;
}
.result-section li { margin-bottom: 4px; color: var(--gray-700); }
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.result-table th, .result-table td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--gray-200);
}
.result-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-600);
}

.highlight-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 16px 20px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.highlight-box blockquote {
    font-style: italic;
    color: var(--gray-700);
    margin: 8px 0;
    padding-left: 12px;
    border-left: 2px solid #fcd34d;
}
.highlight-box em { font-size: 12px; color: var(--gray-500); }

/* ==================== Writing Module ==================== */
.writing-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    background: white;
    padding: 12px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.writing-tab {
    padding: 8px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.writing-tab:hover {
    border-color: var(--primary-300);
    color: var(--primary-700);
}
.writing-tab.active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}
.wtab-icon { font-size: 15px; }

/* Writing workspace layout */
.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.ws-input {
    padding: 24px;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    max-height: 600px;
}

.ws-preview {
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
}
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--gray-100);
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}
.preview-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 550px;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--gray-400);
    text-align: center;
}
.placeholder-icon { font-size: 48px; margin-bottom: 12px; }
.preview-placeholder p { font-size: 15px; font-weight: 500; }
.preview-placeholder small { font-size: 12px; }

/* Paper preview doc */
.paper-preview-doc {
    font-size: 14px;
    line-height: 1.75;
}
.paper-title-area {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px double var(--gray-300);
}
.paper-title-area h2 {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}
.paper-meta { font-size: 12px; color: var(--gray-500); }
.paper-abstract, .paper-toc, .paper-body { margin-bottom: 18px; }
.paper-abstract h4, .paper-toc h4, .paper-body h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}
.paper-toc ol { padding-left: 20px; }
.paper-toc li { font-size: 13px; color: var(--gray-600); margin-bottom: 3px; }

/* ==================== Review Module ==================== */
.scoring-guide {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.scoring-guide h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 14px;
}
.score-ranges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.score-range {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px;
    border-radius: var(--radius-md);
}
.score-range.accept { background: #ecfdf5; }
.score-range.minor { background: #fffbeb; }
.score-range.major { background: #fef2f2; }
.score-range.reject { background: #fef2f2; border: 1px dashed #fca5a5; }
.score-badge {
    font-size: 18px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 999px;
}
.accept .score-badge { background: #10b981; color: white; }
.minor .score-badge { background: #f59e0b; color: white; }
.major .score-badge { background: #ef4444; color: white; }
.reject .score-badge { background: #991b1b; color: white; }
.score-range span:last-child {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
}

/* Review mode cards */
.review-mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.review-card, .report-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s;
}
.review-card:hover, .report-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.review-card.main {
    border-color: var(--primary-500);
    background: linear-gradient(135deg, white, var(--primary-50));
}

.review-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.review-icon { font-size: 22px; }
.review-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}
.review-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
}
.review-tag.best { background: #dbeafe; color: #1e40af; }

.review-card h4 { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.review-card p { font-size: 13px; color: var(--gray-500); margin-bottom: 10px; line-height: 1.5; }
.report-card h4 { font-size: 15px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.report-card p { font-size: 13px; color: var(--gray-500); line-height: 1.45; }

.review-team {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}
.team-member {
    font-size: 10px;
    padding: 2px 8px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 999px;
    font-weight: 500;
}

/* Review Report */
.review-report {
    padding: 24px;
    max-height: 650px;
    overflow-y: auto;
}
.review-report-doc { font-size: 13.5px; line-height: 1.7; }

.report-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
}
.report-header-bar h3 { font-family: var(--font-serif); font-size: 20px; }

.report-score {
    text-align: center;
    padding: 12px 20px;
    border-radius: var(--radius-md);
}
.report-score.accept { background: #ecfdf5; }
.report-score.minor { background: #fffbeb; }
.report-score.major { background: #fef2f2; }
.report-score.reject { background: #fef2f2; }
.score-num {
    font-size: 36px;
    font-weight: 800;
    display: block;
    line-height: 1;
}
.report-score.accept .score-num { color: #059669; }
.report-score.minor .score-num { color: #d97706; }
.report-score.major .score-num { color: #dc2626; }
.report-score.reject .score-num { color: #991b1b; }
.score-decision {
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}

.report-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 20px;
}

.report-section {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
}
.report-section h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 10px;
}
.decision-accept { color: #059669; font-weight: 700; }
.decision-minor { color: #d97706; font-weight: 700; }
.decision-major { color: #dc2626; font-weight: 700; }
.decision-reject { color: #991b1b; font-weight: 700; }

/* Score breakdown mini bars */
.score-breakdown { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.score-item { display: flex; align-items: center; gap: 8px; }
.score-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    width: 80px;
    flex-shrink: 0;
}
.mini-bar {
    flex: 1;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}
.mini-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: 3px;
    transition: width 0.5s;
}

/* DA section */
.da-section { background: #fffbeb; border-left: 4px solid #f59e0b; }
.da-attacks { display: flex; flex-direction: column; gap: 12px; }
.da-attack {
    background: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #fcd34d;
}
.da-attack strong { font-size: 13px; color: #92400e; }
.da-attack p { font-size: 13px; color: var(--gray-700); margin: 6px 0; font-style: italic; }
.da-score {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 999px;
    display: inline-block;
}

/* Score table */
.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 10px 0;
}
.score-table th, .score-table td {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    text-align: left;
}
.score-table th {
    background: var(--gray-100);
    font-weight: 600;
    font-size: 12px;
}
.total-row { background: var(--primary-50) !important; font-weight: 700; }

/* Revision roadmap */
.revision-roadmap { padding-left: 20px; }
.revision-roadmap li {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.priority-high { background: #fef2f2; border-left: 3px solid #ef4444; }
.priority-med { background: #fffbeb; border-left: 3px solid #f59e0b; }
.priority-low { background: #f0fdf4; border-left: 3px solid #86efac; }

/* ==================== Footer ==================== */
.site-footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    margin-top: 40px;
}
.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.footer-left p { font-size: 13px; color: var(--gray-600); margin-bottom: 4px; }
.footer-attribution { font-size: 12px; color: var(--gray-400); }
.footer-attribution a { color: var(--primary-600); }
.footer-links {
    display: flex;
    gap: 16px;
}
.footer-links a { font-size: 13px; color: var(--gray-500); }

/* ==================== Modal ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}
.modal-lg { max-width: 860px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 0;
}
.modal-header h3 { font-family: var(--font-serif); font-size: 22px; }
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }

.modal-body {
    padding: 24px 28px 28px;
}
.help-section { margin-bottom: 24px; }
.help-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}
.help-section p { font-size: 14px; color: var(--gray-600); line-height: 1.7; }
.help-list { list-style: none; padding: 0; }
.help-list li {
    font-size: 14px;
    color: var(--gray-600);
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
}
.help-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-500);
    font-weight: 700;
}
.help-steps { counter-reset: step-counter; padding-left: 0; list-style: none; }
.help-steps li {
    counter-increment: step-counter;
    padding: 8px 0 8px 32px;
    position: relative;
    font-size: 14px;
    color: var(--gray-600);
}
.help-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    width: 22px;
    height: 22px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.principle-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.principle-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}
.p-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.principle-card h5 { font-size: 13px; font-weight: 700; color: var(--gray-800); margin-bottom: 4px; }
.principle-card p { font-size: 11px; color: var(--gray-500); line-height: 1.5; }

/* ==================== Corpus Manager (文献库管理器) ==================== */
.corpus-modal .modal-content { max-width: 840px; }

.corpus-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 28px 0;
    border-bottom: 1px solid var(--gray-200);
}
.corpus-tab {
    padding: 8px 18px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: all 0.2s;
    position: relative;
    bottom: -1px;
}
.corpus-tab:hover { color: var(--primary-600); }
.corpus-tab.active {
    color: var(--primary-700);
    background: white;
    border-bottom: 2px solid var(--primary-500);
    font-weight: 600;
}

.corus-panel {
    padding: 20px 28px;
}
.corus-panel .help-text {
    font-size: 13px; color: var(--gray-500); margin-bottom: 12px;
}

/* 文件拖拽区 */
.file-drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: var(--gray-50);
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
    border-color: var(--primary-400);
    background: var(--primary-50);
}
.drop-label { display: block; user-select: none; cursor: pointer; }
.drop-icon { font-size: 42px; margin-bottom: 8px; }
.drop-label div:first-of-type { font-size: 15px; color: var(--gray-600); font-weight: 500; }
.drop-label small { font-size: 12px; color: var(--gray-400); }

/* 状态消息 */
.success-banner { display: block; padding: 8px 14px; background: #f0fdf4; color: #166534; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-top: 6px; }
.success-item { padding: 4px 10px; background: #f0fdf4; color: #166534; border-radius: 4px; font-size: 12px; margin-top: 4px; }
.error-item { padding: 4px 10px; background: #fef2f2; color: #991b1b; border-radius: 4px; font-size: 12px; margin-top: 4px; }
.loading { color: var(--primary-600); font-size: 13px; font-weight: 500; }

/* 文献表格 */
.corpus-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.corpus-table th {
    background: var(--gray-50); text-align: left; padding: 8px 12px;
    border-bottom: 2px solid var(--gray-200); font-weight: 600; color: var(--gray-600);
    position: sticky; top: 0; z-index: 1;
}
.corpus-table td {
    padding: 7px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle;
}
.corpus-table tbody tr:hover { background: var(--primary-50); }
.corpus-table .title-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corpus-table .author-cell { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-500); }
.empty-hint { text-align: center; color: var(--gray-400); padding: 32px !important; font-style: italic; }

/* 标签 */
.tag-local { display: inline-block; padding: 1px 8px; font-size: 11px; background: #dbeafe; color: #1e40af; border-radius: 10px; font-weight: 500; }
.tag-online { display: inline-block; padding: 1px 8px; font-size: 11px; background: #f3e8ff; color: #6b21a8; border-radius: 10px; font-weight: 500; }

/* 添加项 */
.corpus-add-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: #f0fdf4; border-radius: var(--radius-sm); margin-top: 8px; font-size: 13px;
}
.corpus-add-item strong { color: var(--gray-800); }
.corpus-add-item small { color: var(--gray-500); }

/* 按钮 */
.btn-icon {
    width: 26px; height: 26px; border: none; background: transparent; color: var(--gray-400);
    cursor: pointer; border-radius: 4px; font-size: 14px; line-height: 26px; text-align: center;
}
.btn-icon:hover { background: #fef2f2; color: #dc2626; }

/* PDF 解析结果项 */
.pdf-item {
    padding: 10px 14px !important;
}
.pdf-item small {
    display: block; margin-top: 4px; color: var(--gray-500); font-size: 11.5px;
    line-height: 1.6;
}

/* 底部操作栏 */
.corpus-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 28px; border-top: 1px solid var(--gray-100);
    background: var(--gray-50); border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* 按钮状态 */
.btn.has-data {
    background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-300);
    font-weight: 600;
}

/* ==================== Toast Notification ==================== */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    max-width: 380px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-info { background: var(--info); color: white; }
.toast-success { background: var(--success); color: white; }
.toast-warning { background: var(--warning); color: #78350f; }
.toast-error { background: var(--danger); color: white; }

/* ==================== Loading Spinner ==================== */
.loading-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Responsive (minimal - PC only per spec) ==================== */
@media (min-width: 1400px) {
    .main-container { padding: 32px 40px; }
}

@media (max-width: 1100px) {
    .workspace-layout { grid-template-columns: 1fr; }
    .ws-input { border-right: none; border-bottom: 1px solid var(--gray-200); }
    .form-row { grid-template-columns: 1fr; }
    .mid-entry-cards { grid-template-columns: 1fr; }
    .config-grid { grid-template-columns: 1fr; }
    .hero-stats { gap: 20px; }
    .principle-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ==================== AI Response Styles ==================== */

/* AI 响应日志条目 - 流式显示 */
.log-ai-response {
    color: #a5b4fc;
    font-size: 13px;
    line-height: 1.7;
    padding: 8px 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--primary-400);
    padding-left: 10px;
    border-radius: 4px;
}

/* 错误消息框 */
.error-message {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid #fecaca;
    text-align: center;
    font-size: 14px;
}
.error-message small {
    display: block;
    margin-top: 8px;
    color: var(--gray-500);
    font-size: 12px;
}

/* 结果文档容器（Markdown渲染后） */
.result-document p {
    margin-bottom: 12px;
    color: var(--gray-700);
}
.result-document h1, .result-document h2, .result-document h3, .result-document h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--gray-900);
}
.result-document h1 { font-size: 22px; border-bottom: 2px solid var(--primary-200); padding-bottom: 8px; }
.result-document h2 { font-size: 18px; border-bottom: 1px solid var(--primary-100); padding-bottom: 6px; }
.result-document h3 { font-size: 16px; }
.result-document h4 { font-size: 15px; }
.result-document ul, .result-document ol {
    padding-left: 24px;
    margin-bottom: 12px;
}
.result-document li { margin-bottom: 6px; }
.result-document blockquote {
    background: var(--primary-50);
    border-left: 4px solid var(--primary-400);
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--gray-600);
    font-style: italic;
}
.result-document pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}
.result-document code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.result-document pre code {
    background: none;
    padding: 0;
}
.result-document hr {
    border: none;
    border-top: 2px dashed var(--gray-200);
    margin: 24px 0;
}
.result-document strong { color: var(--gray-900); }
.result-document table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.result-document th, .result-document td {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    text-align: left;
    font-size: 13px;
}
.result-document th { background: var(--gray-50); font-weight: 600; }

/* 论文预览文档 */
.paper-preview-doc {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.paper-preview-doc .paper-title-area {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}
.paper-preview-doc .paper-title-area h2 {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--gray-900);
    margin-bottom: 8px;
}
.paper-preview-doc .paper-meta { color: var(--gray-500); font-size: 13px; }

/* 审稿报告文档 */
.review-report-doc {
    max-width: 900px;
    margin: 0 auto;
}

/* 导入/导出按钮可见性 */
#sendToWriterBtn,
#sendToRevisionBtn {
    display: none;
}
#sendToWriterBtn.visible,
#sendToRevisionBtn.visible {
    display: inline-flex;
}

/* API 连接状态指示器 */
.api-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--success-bg);
    color: var(--success);
    font-weight: 500;
}
.api-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
