/* ========== 全局样式 ========== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ========== 暗色主题（默认） ========== */
:root, [data-theme="dark"] {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --success: #10B981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --danger: #EF4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --warning: #F59E0B;
    --info: #3B82F6;

    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(30, 41, 59, 0.6);
    --bg-hover: rgba(99, 102, 241, 0.05);

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --border: rgba(148, 163, 184, 0.1);
    --border-hover: rgba(148, 163, 184, 0.2);

    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 20px var(--primary-glow);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 亮色主题 ========== */
[data-theme="light"] {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-glow: rgba(79, 70, 229, 0.2);
    --success: #059669;
    --success-glow: rgba(5, 150, 105, 0.15);
    --danger: #DC2626;
    --danger-glow: rgba(220, 38, 38, 0.15);

    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-hover: rgba(79, 70, 229, 0.04);

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    --border: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.15);

    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.06);
    --shadow-glow: 0 0 15px var(--primary-glow);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

body::before {
    content: "";
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
    animation: bgFloat 25s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

[data-theme="light"] body::before {
    background: radial-gradient(circle at 20% 80%, rgba(79, 70, 229, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(5, 150, 105, 0.03) 0%, transparent 50%);
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(1deg); }
    66% { transform: translate(-20px, 20px) rotate(-1deg); }
}

.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* ========== 布局 ========== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.logo {
    padding: 0 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon { font-size: 32px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.logo h1 {
    font-size: 18px; font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #818CF8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

nav { flex: 1; padding: 20px 16px; overflow-y: auto; overflow-x: hidden; min-height: 0; }
nav::-webkit-scrollbar { width: 4px; }
nav::-webkit-scrollbar-track { background: transparent; }
nav::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }
nav::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: var(--transition);
    font-size: 14px; font-weight: 500;
    position: relative; overflow: hidden;
    white-space: nowrap;
}

.nav-item::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); transform: translateX(4px); }
.nav-item.active { background: rgba(99, 102, 241, 0.12); color: var(--primary); }
.nav-item.active::before { transform: scaleY(1); }

.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 16px 24px; text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.theme-toggle {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    font-size: 18px;
}
.theme-toggle:hover { background: var(--primary); border-color: var(--primary); transform: rotate(20deg); }

.version-badge {
    display: inline-block; padding: 2px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
    background: rgba(99, 102, 241, 0.15); color: var(--primary);
}

.sidebar-footer small kbd {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    font-size: 11px; background: var(--bg-tertiary);
    border: 1px solid var(--border); font-family: inherit;
}

.content {
    flex: 1; margin-left: var(--sidebar-width);
    padding: 32px 40px; max-width: 1400px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.mobile-menu-btn {
    display: none; position: fixed;
    top: 16px; left: 16px; z-index: 200;
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-size: 20px; cursor: pointer; transition: var(--transition);
}
.mobile-menu-btn:hover { background: var(--primary); border-color: var(--primary); }

/* ========== 视图 ========== */
.view { display: none; }
.view.active { display: block; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.view-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.view-header h2 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.view-header p { color: var(--text-secondary); font-size: 14px; }

/* ========== 快捷统计条 ========== */
.quick-stats {
    display: flex; align-items: center; gap: 20px;
    padding: 14px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.qs-item { display: flex; align-items: center; gap: 8px; }
.qs-value { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.qs-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.qs-divider { width: 1px; height: 28px; background: var(--border); }
.qs-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.qs-dot.qs-p0 { background: #EF4444; }
.qs-dot.qs-p1 { background: #F97316; }
.qs-dot.qs-p2 { background: #EAB308; }
.qs-dot.qs-p3 { background: #22C55E; }

/* ========== 按钮 ========== */
.btn {
    padding: 12px 24px; border: none;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; position: relative; overflow: hidden;
    font-family: inherit;
}
.btn-gradient { background: linear-gradient(135deg, var(--primary), #818CF8); color: #fff; box-shadow: 0 4px 15px var(--primary-glow); }
.btn-gradient:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--primary-glow); }
.btn-gradient:active { transform: translateY(0); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-icon {
    width: 36px; height: 36px; padding: 0;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 16px;
    cursor: pointer; transition: var(--transition);
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.view-mode-toggle { display: flex; gap: 4px; }

/* ========== 搜索框 ========== */
.search-box { position: relative; }
.search-box input {
    padding: 10px 16px 10px 38px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 13px;
    width: 220px; transition: var(--transition); font-family: inherit;
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); width: 280px; }
.search-box input::placeholder { color: var(--text-muted); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: 0.5; }

/* ========== 上传双栏布局 ========== */
.upload-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.upload-card { border-radius: var(--radius); padding: 28px; position: relative; }

.upload-left .upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 28px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.upload-left .upload-area:hover, .upload-left .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

.upload-icon-wrapper { position: relative; display: inline-block; margin-bottom: 12px; }
.upload-icon { font-size: 48px; position: relative; z-index: 1; }
.upload-pulse {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 70px; height: 70px;
    border-radius: 50%; background: var(--primary-glow);
    animation: uploadPulse 2s ease-in-out infinite;
}
@keyframes uploadPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

.upload-text { font-size: 16px; margin-bottom: 4px; font-weight: 600; }
.upload-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }

/* 格式标签 */
.format-tags {
    display: flex; gap: 8px; align-items: center;
    margin-top: 16px; flex-wrap: wrap;
}
.ftag {
    padding: 3px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.3px;
}
.ftag-md { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.ftag-docx { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.ftag-json { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.ftag-txt { background: rgba(148, 163, 184, 0.15); color: #94A3B8; }
.ftag-pdf { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.ftag-xlsx { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.ftag-csv { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.ftag-size { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* 上传进度条 */
.upload-progress { margin-top: 16px; }
.progress-bar {
    width: 100%; height: 6px;
    background: var(--bg-tertiary); border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--primary), #818CF8);
    border-radius: 3px;
    transition: width 0.3s ease;
    animation: progressGlow 1.5s ease-in-out infinite;
}
@keyframes progressGlow {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 8px var(--primary-glow); }
}
.progress-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: block; }

/* 右栏粘贴区 */
.upload-right { display: flex; flex-direction: column; }
.upload-right-header h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.upload-right-form { flex: 1; display: flex; flex-direction: column; }
.form-group-grow { flex: 1; }
.form-group-grow textarea { height: 100%; min-height: 120px; resize: vertical; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-weight: 600; margin-bottom: 8px;
    font-size: 13px; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 16px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px; color: var(--text-primary);
    font-family: inherit; transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-group select option { background: var(--bg-secondary); color: var(--text-primary); }
.form-group small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 48px; }
.toggle-password {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 18px;
    padding: 4px 8px; border-radius: 4px; transition: var(--transition);
}
.toggle-password:hover { background: rgba(255,255,255,0.1); }

.range-wrapper { display: flex; align-items: center; gap: 12px; }
.range-wrapper input[type="range"] { flex: 1; accent-color: var(--primary); }
.range-value { font-size: 14px; font-weight: 700; color: var(--primary); min-width: 32px; }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.checkbox-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer; transition: var(--transition);
    font-weight: 500; font-size: 13px;
}
.checkbox-item:hover { border-color: var(--primary); background: var(--bg-hover); }
.checkbox-item input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ========== 文档列表 ========== */
.section { margin-top: 40px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section h3 { font-size: 18px; font-weight: 600; }
.section-actions { display: flex; gap: 8px; }

.documents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }

.doc-card {
    background: var(--bg-glass); backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; transition: var(--transition);
    position: relative; overflow: hidden;
}
.doc-card::before {
    content: ""; position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), #818CF8);
    opacity: 0; transition: var(--transition);
}
.doc-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.doc-card:hover::before { opacity: 1; }

.doc-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.doc-card-header h4 { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

.doc-badge {
    padding: 3px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.doc-badge.markdown { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.doc-badge.docx { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.doc-badge.openapi { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.doc-badge.text { background: rgba(148, 163, 184, 0.15); color: #94A3B8; }
.doc-badge.pdf { background: rgba(239, 68, 68, 0.15); color: #F87171; }

.doc-preview {
    color: var(--text-secondary); font-size: 13px;
    margin-bottom: 14px; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}
.doc-meta { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 12px; margin-bottom: 14px; }
.doc-actions { display: flex; gap: 8px; }

/* ========== 统计卡片 ========== */
.stats-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { border-radius: var(--radius); padding: 20px; text-align: center; transition: var(--transition); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.stat-value {
    font-size: 32px; font-weight: 800; margin-bottom: 4px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-card.stat-p0 .stat-value { background: linear-gradient(135deg, #EF4444, #F87171); -webkit-background-clip: text; background-clip: text; }
.stat-card.stat-p1 .stat-value { background: linear-gradient(135deg, #F97316, #FB923C); -webkit-background-clip: text; background-clip: text; }
.stat-card.stat-p2 .stat-value { background: linear-gradient(135deg, #EAB308, #FDE047); -webkit-background-clip: text; background-clip: text; }
.stat-card.stat-p3 .stat-value { background: linear-gradient(135deg, #22C55E, #4ADE80); -webkit-background-clip: text; background-clip: text; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ========== 工具栏 ========== */
.toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-radius: var(--radius);
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.toolbar-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.filter-select {
    padding: 10px 14px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px; color: var(--text-primary);
    font-family: inherit; cursor: pointer; transition: var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--primary); }
.filter-select option { background: var(--bg-secondary); color: var(--text-primary); }

/* ========== 导出下拉 ========== */
.export-dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; right: 0; top: 100%;
    margin-top: 4px; min-width: 180px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    z-index: 50; overflow: hidden;
}
.dropdown-menu.show { display: block; animation: fadeIn 0.2s ease; }
.dropdown-menu a {
    display: block; padding: 10px 16px;
    color: var(--text-primary); text-decoration: none;
    font-size: 13px; transition: var(--transition);
}
.dropdown-menu a:hover { background: var(--bg-hover); }

/* ========== 表格 ========== */
.table-container { border-radius: var(--radius); overflow-x: auto; margin-bottom: 20px; }
.tc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tc-table th {
    background: var(--bg-tertiary); padding: 14px 16px;
    text-align: left; font-weight: 700; font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.8px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap; position: sticky; top: 0; z-index: 10;
}
.tc-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tc-table tr { transition: var(--transition); }
.tc-table tbody tr:hover { background: var(--bg-hover); }
.tc-table .checkbox-col { width: 40px; text-align: center; }
.tc-table .checkbox-col input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

.priority-badge {
    display: inline-block; padding: 3px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 800; text-align: center; letter-spacing: 0.5px;
}
.priority-badge.P0 { background: rgba(239, 68, 68, 0.2); color: #F87171; }
.priority-badge.P1 { background: rgba(249, 115, 22, 0.2); color: #FB923C; }
.priority-badge.P2 { background: rgba(234, 179, 8, 0.2); color: #FDE047; }
.priority-badge.P3 { background: rgba(34, 197, 94, 0.2); color: #4ADE80; }

.type-badge {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 11px; background: rgba(99, 102, 241, 0.15); color: #818CF8;
    white-space: nowrap; font-weight: 600;
}

.tc-steps { white-space: pre-line; max-width: 280px; font-size: 12px; line-height: 1.7; color: var(--text-secondary); }
.tc-actions { display: flex; gap: 6px; }
.tc-actions .btn { padding: 6px 10px; font-size: 14px; border-radius: var(--radius-xs); }

/* ========== 卡片视图 ========== */
.tc-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; padding: 16px; }
.tc-card-item {
    background: var(--bg-glass); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    transition: var(--transition); position: relative;
}
.tc-card-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.tc-card-item .tc-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tc-card-item .tc-card-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; line-height: 1.5; }
.tc-card-item .tc-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tc-card-item .tc-card-section { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.6; }
.tc-card-item .tc-card-section strong { color: var(--text-primary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 2px; }
.tc-card-item .tc-card-actions {
    display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid var(--border);
}

/* ========== 优先级选项弹窗 ========== */
.priority-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.radio-card {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; background: var(--bg-tertiary);
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition); font-size: 13px;
}
.radio-card:hover { border-color: var(--primary); background: var(--bg-hover); }
.radio-card.selected { border-color: var(--primary); background: rgba(99, 102, 241, 0.1); }

/* ========== 分页 ========== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; }
.pagination .page-btn {
    padding: 8px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-xs); background: var(--bg-glass);
    color: var(--text-secondary); font-size: 13px;
    cursor: pointer; transition: var(--transition); font-family: inherit;
}
.pagination .page-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination .page-info { color: var(--text-muted); font-size: 13px; margin: 0 8px; }

/* ========== 设置页面 ========== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { border-radius: var(--radius); padding: 28px; }
.settings-card h4 { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--text-secondary); }
.settings-actions { display: flex; flex-direction: column; gap: 12px; justify-content: flex-end; }

/* ========== 数据概览 ========== */
.stats-dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dashboard-card {
    background: var(--bg-glass); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
}
.dashboard-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text-secondary); }
.dashboard-list { list-style: none; }
.dashboard-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.dashboard-list li:last-child { border-bottom: none; }
.count-badge {
    padding: 2px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 700;
    background: rgba(99, 102, 241, 0.15); color: var(--primary);
}

/* ========== 弹窗 ========== */
.modal {
    display: none; position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000; align-items: center; justify-content: center;
}
.modal.show { display: flex; animation: modalFadeIn 0.3s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content {
    position: relative; z-index: 1;
    width: 90%; max-width: 520px; max-height: 90vh;
    border-radius: var(--radius); overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}
.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }
@keyframes modalSlideIn { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px 28px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: var(--bg-tertiary); color: var(--text-secondary);
    font-size: 20px; cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-body { padding: 24px 28px; }
.modal-footer { padding: 16px 28px 24px; display: flex; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--border); }

.gen-doc-name { padding: 12px 16px; background: var(--bg-tertiary); border-radius: var(--radius-xs); margin-bottom: 20px; font-size: 14px; }
.gen-doc-name .label { color: var(--text-muted); }

/* ========== 文档预览 ========== */
.doc-preview-meta { padding: 12px; background: var(--bg-tertiary); border-radius: var(--radius-xs); margin-bottom: 16px; font-size: 13px; color: var(--text-secondary); }
.doc-preview-content {
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px; line-height: 1.8;
    max-height: 500px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
    color: var(--text-primary);
}

/* ========== 快捷键 ========== */
.shortcut-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.shortcut-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: var(--bg-tertiary); border-radius: var(--radius-xs); font-size: 13px;
}
.shortcut-item kbd {
    display: inline-block; padding: 3px 8px; border-radius: 4px;
    font-size: 12px; background: var(--bg-secondary);
    border: 1px solid var(--border); font-family: inherit;
    font-weight: 600; margin: 0 2px;
}
.shortcut-item span { color: var(--text-secondary); }

/* ========== 状态区域 ========== */
.status-area {
    padding: 16px; border-radius: var(--radius-sm); margin-top: 16px;
    font-size: 14px; display: none; animation: fadeIn 0.3s ease;
}
.status-area.show { display: block; }
.status-area.loading { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.2); color: #93C5FD; }
.status-area.success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: #6EE7B7; }
.status-area.error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #FCA5A5; }

.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.8s linear infinite;
    vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Toast ========== */
.toast {
    position: fixed; top: 24px; right: 24px;
    padding: 14px 24px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
    z-index: 2000; transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px); max-width: 400px;
}
.toast.show { transform: translateX(0); }
.toast.info { background: rgba(59, 130, 246, 0.9); color: #fff; }
.toast.success { background: rgba(16, 185, 129, 0.9); color: #fff; }
.toast.error { background: rgba(239, 68, 68, 0.9); color: #fff; }
.toast.warning { background: rgba(245, 158, 11, 0.9); color: #fff; }

/* ========== 撤销条 ========== */
.undo-bar {
    position: fixed; bottom: -60px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: var(--radius-sm);
    background: var(--bg-secondary); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 2000; display: flex; align-items: center; gap: 16px;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px; color: var(--text-primary);
}
.undo-bar.show { bottom: 24px; }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* ========== Skeleton ========== */
.loading-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; width: 100%; }
.skeleton-card {
    height: 200px; border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-glass) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .stats-cards { grid-template-columns: repeat(3, 1fr); }
    .documents-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    .stats-dashboard, .settings-grid { grid-template-columns: 1fr; }
    .upload-dual { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 10px 0 30px rgba(0,0,0,0.5); }
    .content { margin-left: 0; padding: 80px 16px 32px; }
    .view-header { flex-direction: column; }
    .view-header h2 { font-size: 22px; }
    .header-actions { width: 100%; }
    .search-box input { width: 100%; }
    .search-box input:focus { width: 100%; }
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { flex-wrap: wrap; }
    .filter-select { flex: 1; min-width: 0; }
    .form-row { flex-direction: column; gap: 0; }
    .documents-grid { grid-template-columns: 1fr; }
    .modal-content { width: 95%; margin: 16px; }
    .tc-cards-grid { grid-template-columns: 1fr; }
    .quick-stats { gap: 12px; padding: 12px 16px; }
    .qs-value { font-size: 18px; }
}

@media (max-width: 480px) {
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 24px; }
    .upload-area { padding: 28px; }
    .upload-icon { font-size: 40px; }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: var(--primary); color: #fff; }

/* ========== 新增样式：Prompt模板、导入文件、搜索高亮 ========== */

.prompt-template-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.prompt-preview {
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.upload-area-sm {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area-sm:hover,
.upload-area-sm.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

.upload-area-sm a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.template-item:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.template-item-info {
    flex: 1;
    min-width: 0;
}

.template-item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-item-name .default-badge {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.template-item-preview {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 600px;
}

.template-item-actions {
    display: flex;
    gap: 6px;
    margin-left: 16px;
}

.loading-text {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* 搜索高亮 */
.search-highlight {
    background: rgba(250, 204, 21, 0.25);
    color: var(--text-primary);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* 回收站全选 */
.trash-checkbox-col input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ========== v3.3: Toast Container (堆叠式) ========== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    pointer-events: none;
}

.toast-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    border: 1px solid;
}
.toast-item.show { transform: translateX(0); }
.toast-item.fade-out { opacity: 0; transform: translateX(120%); }

.toast-item.toast-success { background: rgba(16, 185, 129, 0.92); color: #fff; border-color: rgba(16, 185, 129, 0.5); }
.toast-item.toast-error { background: rgba(239, 68, 68, 0.92); color: #fff; border-color: rgba(239, 68, 68, 0.5); }
.toast-item.toast-warning { background: rgba(245, 158, 11, 0.92); color: #fff; border-color: rgba(245, 158, 11, 0.5); }
.toast-item.toast-info { background: rgba(59, 130, 246, 0.92); color: #fff; border-color: rgba(59, 130, 246, 0.5); }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
    background: none; border: none; color: rgba(255,255,255,0.7);
    font-size: 18px; cursor: pointer; padding: 0 2px;
    flex-shrink: 0; transition: color 0.2s;
    line-height: 1;
}
.toast-close:hover { color: #fff; }

/* ========== v3.3: Command Palette ========== */
.command-palette-modal .modal-backdrop { background: rgba(0,0,0,0.4); }

.cmd-palette {
    position: relative; z-index: 1;
    width: 90%; max-width: 560px;
    border-radius: var(--radius);
    overflow: hidden;
    animation: modalSlideIn 0.2s ease;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.cmd-palette-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.cmd-palette-icon { font-size: 18px; opacity: 0.5; flex-shrink: 0; }
.cmd-palette-header input {
    flex: 1; border: none; background: transparent;
    font-size: 16px; color: var(--text-primary);
    outline: none; font-family: inherit;
}
.cmd-palette-header input::placeholder { color: var(--text-muted); }
.cmd-palette-header kbd {
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; background: var(--bg-tertiary);
    border: 1px solid var(--border); color: var(--text-muted);
    font-family: inherit;
}

.cmd-list {
    overflow-y: auto;
    max-height: 400px;
    padding: 8px;
}

.cmd-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
}
.cmd-item:hover,
.cmd-item.active {
    background: var(--bg-hover);
}
.cmd-item.active {
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--primary);
}
.cmd-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.cmd-name { flex: 1; color: var(--text-primary); }
.cmd-shortcut {
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; background: var(--bg-tertiary);
    border: 1px solid var(--border); color: var(--text-muted);
    white-space: nowrap;
}

.cmd-palette-footer {
    display: flex; gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
}
.cmd-palette-footer kbd {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    font-size: 10px; background: var(--bg-tertiary);
    border: 1px solid var(--border); font-family: inherit;
}

/* ========== v3.3: Inline Editing ========== */
.editable-cell {
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}
.editable-cell:hover {
    background: var(--bg-hover);
}
.editable-cell:hover::after {
    content: '✏️';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 11px;
    opacity: 0.6;
    pointer-events: none;
}
.inline-edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-xs);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
    resize: vertical;
    min-width: 100px;
}
.inline-edit-input:focus {
    border-color: var(--primary);
}
.edit-saved {
    animation: editFlash 0.6s ease;
}
@keyframes editFlash {
    0%, 100% { background: transparent; }
    30% { background: rgba(16, 185, 129, 0.15); }
}

/* ========== v3.3: History Panel ========== */
.history-panel {
    position: fixed;
    top: 0; right: 0;
    width: 420px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.history-panel.open {
    transform: translateX(0);
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.history-panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.history-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.history-version {
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.history-version.latest {
    border-color: var(--primary);
    border-left: 3px solid var(--primary);
}
.history-version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.history-timestamp {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.history-badge-latest {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}
.history-change {
    margin-bottom: 8px;
}
.history-field {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}
.history-diff {
    font-size: 12px;
    line-height: 1.6;
}
.history-diff del {
    color: #EF4444;
    text-decoration: line-through;
    background: rgba(239, 68, 68, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
}
.history-diff ins {
    color: #10B981;
    text-decoration: none;
    background: rgba(16, 185, 129, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ========== v3.3: Dashboard Bar Chart ========== */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bar-label {
    min-width: 80px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    flex-shrink: 0;
}
.bar-track {
    flex: 1;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xs);
    overflow: hidden;
    position: relative;
}
.bar-fill {
    height: 100%;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    min-width: 36px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stat mini cards */
.stat-mini-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.stat-mini {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    position: relative;
    transition: var(--transition);
}
.stat-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-mini-icon {
    font-size: 24px;
    margin-bottom: 6px;
}
.stat-mini-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}
.stat-mini-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.stat-trend {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    font-weight: 700;
}
.trend-up { color: #10B981; }
.trend-down { color: #EF4444; }

/* ========== v3.3: Floating Action Button ========== */
.fab-command {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #818CF8);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    z-index: 500;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab-command:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* ========== v3.4: Drop Zone ========== */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
    box-shadow: 0 0 20px var(--primary-glow);
}
.drop-zone .drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-zone .drop-text { color: var(--text-secondary); }

.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.file-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin: 4px 0;
    font-size: 13px;
    animation: chipIn 0.2s ease;
}
.file-list-item .file-icon { font-size: 18px; flex-shrink: 0; }
.file-list-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text-primary); }
.file-list-item .file-size { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.file-list-item .file-remove {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    font-size: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0 4px;
}
.file-list-item .file-remove:hover { opacity: 1; color: var(--danger); }
.file-list-item .file-progress {
    width: 60px; height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.file-list-item .file-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Global drag overlay */
.global-drop-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    pointer-events: none;
}
.global-drop-overlay.visible {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}
.global-drop-overlay .drop-overlay-content {
    text-align: center;
    padding: 60px;
    border: 3px dashed var(--primary);
    border-radius: 24px;
    background: rgba(99, 102, 241, 0.05);
    max-width: 500px;
    width: 80%;
}
.global-drop-overlay .drop-overlay-icon { font-size: 72px; margin-bottom: 16px; }
.global-drop-overlay .drop-overlay-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.global-drop-overlay .drop-overlay-files { color: var(--text-secondary); font-size: 14px; margin-top: 12px; }

/* ========== v3.4: Filter Chips ========== */
.filter-chips-container {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 0 0 12px 0;
    flex-wrap: wrap;
}
.filter-chips-container.has-chips { display: flex; }
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    animation: chipIn 0.2s ease;
    white-space: nowrap;
}
.filter-chip.chip-priority { background: rgba(239, 68, 68, 0.8); }
.filter-chip.chip-type { background: rgba(99, 102, 241, 0.8); }
.filter-chip.chip-document { background: rgba(16, 185, 129, 0.8); }
.filter-chip.chip-search { background: rgba(245, 158, 11, 0.8); }
.filter-chip .chip-label { font-weight: 400; opacity: 0.8; }
.filter-chip .chip-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;
    line-height: 1;
    transition: opacity 0.2s;
    margin-left: 2px;
}
.filter-chip .chip-remove:hover { opacity: 1; }
@keyframes chipIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
.chip-clear-all {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.chip-clear-all:hover { border-color: var(--danger); color: var(--danger); }
.filter-count-badge {
    display: none;
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    line-height: 18px;
    padding: 0 4px;
}
.nav-item.has-filter .filter-count-badge { display: block; }

/* ========== v3.4: Enhanced Empty States ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}
.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state .empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.empty-state .empty-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 300px;
    line-height: 1.6;
}
.empty-state .empty-action {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #818CF8);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.empty-state .empty-action:hover { transform: translateY(-2px); box-shadow: 0 4px 15px var(--primary-glow); }
.empty-state p { font-size: 15px; }

/* ========== v3.4: Skeleton Loading (Enhanced) ========== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}
.skeleton-row {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.skeleton-cell {
    height: 16px;
    border-radius: 4px;
}
.skeleton-stat-card {
    height: 100px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-glass) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-toolbar {
    height: 52px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-glass) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 20px;
}
.skeleton-table-container {
    border-radius: var(--radius);
    overflow: hidden;
}

/* ========== v3.4: Sidebar Active State Enhancement ========== */
.nav-item {
    position: relative;
    overflow: hidden;
}
.nav-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.12), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    border-radius: var(--radius-sm);
}
.nav-item.active::after {
    opacity: 1;
}
.nav-item.active {
    animation: sidebarActive 0.3s ease;
}
@keyframes sidebarActive {
    from { transform: translateX(-4px); opacity: 0.7; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== v3.4: View Transitions ========== */
.view {
    display: none;
    animation: viewFadeIn 0.35s ease;
}
.view.active { display: block; }
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sidebar collapse animation on mobile */
@media (max-width: 768px) {
    .sidebar {
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* ========== v3.4: Auto-save draft indicator ========== */
.draft-indicator {
    font-size: 11px;
    color: var(--success);
    opacity: 0;
    transition: opacity 0.3s;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
}
.draft-indicator.show { opacity: 1; }

/* ========== v3.4: Generating Lock ========== */
.sidebar.generating {
    position: relative;
}
.sidebar.generating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(var(--accent-rgb, 99, 102, 241), 0.03) 10px,
        rgba(var(--accent-rgb, 99, 102, 241), 0.03) 20px
    );
    pointer-events: none;
    z-index: 1;
    animation: genStripe 2s linear infinite;
}
@keyframes genStripe {
    0% { background-position: 0 0; }
    100% { background-position: 28px 0; }
}
.sidebar.generating .nav-item[disabled] {
    pointer-events: none;
    opacity: 0.4;
}

/* ========== v4.0: Execution Dashboard ========== */
.dash-top-row {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.dash-donut-card {
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
}
.dash-donut-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}
.dash-donut-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.dash-donut {
    width: 160px;
    height: 160px;
}
.dash-donut-value {
    font-size: 22px;
    font-weight: 800;
    fill: var(--text-primary);
}
.dash-donut-label {
    font-size: 11px;
    fill: var(--text-secondary);
}
.dash-donut-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}
.dash-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.dash-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dash-legend-dot.pass { background: var(--success); }
.dash-legend-dot.fail { background: var(--danger); }
.dash-legend-dot.total { background: var(--text-secondary); }
.dash-trend-card {
    padding: 24px;
    border-radius: var(--radius);
}
.dash-trend-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}
.dash-bars-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 180px;
    padding: 0 8px;
}
.dash-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.dash-bar-stack {
    flex: 1;
    width: 100%;
    max-width: 48px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    min-height: 0;
}
.dash-bar-seg {
    width: 100%;
    min-height: 0;
    transition: height 0.5s ease;
}
.dash-bar-seg.pass { background: var(--success); }
.dash-bar-seg.fail { background: var(--danger); }
.dash-bar-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
}
.dash-bar-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.dash-bar-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}
.dash-recent-card {
    padding: 24px;
    border-radius: var(--radius);
}
.dash-recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.dash-recent-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}
.dash-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

@media (max-width: 900px) {
    .dash-top-row { grid-template-columns: 1fr; }
    .dash-donut-card { display: flex; flex-direction: column; align-items: center; }
}

/* ========== v3.5: Executor (Playwright Automation) ========== */
.exec-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.exec-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s;
}
.exec-result-card.passed { border-left: 4px solid var(--success); }
.exec-result-card.failed { border-left: 4px solid var(--danger); }
.exec-result-card.running { border-left: 4px solid var(--accent); animation: pulseBorder 1.5s infinite; }
@keyframes pulseBorder {
    0%, 100% { border-left-color: var(--accent); }
    50% { border-left-color: transparent; }
}
.exec-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.exec-result-header h4 {
    margin: 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.exec-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.exec-status-badge.pass { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.exec-status-badge.fail { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.exec-status-badge.running { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.exec-status-badge.pending { background: rgba(156, 163, 175, 0.15); color: var(--text-secondary); }
.exec-result-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.exec-result-meta span { display: flex; align-items: center; gap: 4px; }
.exec-result-message {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.exec-result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.exec-screenshot-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    margin-top: 8px;
}
.exec-screenshot-thumb {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.exec-screenshot-thumb:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

/* Executor testcase selection */
.exec-tc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
}
.exec-tc-row:hover { background: var(--bg-hover); }
.exec-tc-row:last-child { border-bottom: none; }
.exec-tc-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.exec-tc-info { flex: 1; min-width: 0; }
.exec-tc-info .tc-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.exec-tc-info .tc-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* v3.5: Print Styles */
@media print {
    .toast-container,
    .toast,
    .command-palette-modal,
    .history-panel,
    .fab-command,
    .mobile-menu-btn,
    .sidebar,
    .undo-bar { display: none !important; }
    .content { margin-left: 0 !important; padding: 0 !important; }
}

/* ========== 登录/注册页面 ========== */
.auth-page {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 9999;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
}
.auth-logo {
    margin-bottom: 32px;
}
.auth-logo .logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}
.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}
.auth-card .form-group {
    text-align: left;
    margin-bottom: 16px;
}
.auth-card .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.auth-card .form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.auth-card .form-group input:focus {
    border-color: var(--primary);
}
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}
.auth-switch {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}

/* ========== 用户信息栏 ========== */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.user-avatar {
    font-size: 18px;
}
.user-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}
.btn-logout:hover {
    color: var(--danger);
}
