:root {
    --primary: #1A73E8; --primary-dark: #1557B0; --bg-main: #F5F7FA;
    --bg-white: #FFFFFF; --sidebar-bg: #1E293B; --sidebar-hover: #334155;
    --text-primary: #1E293B; --text-secondary: #64748B;
    --border-color: #E2E8F0; --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07); --radius: 8px;
    --transition: all 0.2s ease;
}
body { font-family: 'Microsoft YaHei', '微软雅黑', sans-serif; background: var(--bg-main); color: var(--text-primary); margin: 0; line-height: 1.6; }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); }
.login-container { width: 100%; max-width: 420px; }
.login-card { background: var(--bg-white); border-radius: 12px; padding: 40px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { width: 64px; height: 64px; background: linear-gradient(135deg, var(--primary), #0D47A1); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.login-logo i { font-size: 32px; color: white; }
.login-header h1 { font-size: 22px; font-weight: 600; }
.login-form .btn-primary { background: linear-gradient(135deg, var(--primary), #0D47A1); border: none; padding: 12px; font-weight: 500; }
.login-form .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,115,232,0.4); }
.login-footer { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 13px; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--bg-white); color: var(--text-primary); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: var(--transition); border-right: 1px solid var(--border-color); }
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-logo span, .sidebar.collapsed .nav-item span, .sidebar.collapsed .nav-section-title, .sidebar.collapsed .user-details { display: none; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border-color); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; }
.sidebar-logo i { font-size: 24px; color: var(--primary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { padding: 0 12px; margin-bottom: 8px; }
.nav-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); padding: 8px 12px 4px; display: block; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text-secondary); text-decoration: none; border-radius: 6px; transition: var(--transition); font-size: 14px; }
.nav-item:hover { background: var(--bg-main); color: var(--text-primary); }
.nav-item.active { background: var(--primary); color: white; }
.nav-item i { font-size: 18px; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-color); }
.user-info-mini { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #3B82F6); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; color: white; }
.user-name { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-secondary); }
.main-content { flex: 1; margin-left: 250px; transition: var(--transition); min-height: 100vh; }
.sidebar.collapsed ~ .main-content { margin-left: 64px; }
.top-bar { background: var(--bg-white); border-bottom: 1px solid var(--border-color); padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { background: none; border: none; font-size: 20px; color: var(--text-secondary); cursor: pointer; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }
.current-project-badge { font-size: 13px; color: var(--text-secondary); background: var(--bg-main); padding: 4px 12px; border-radius: 20px; }
.content-area { padding: 24px; }

/* Common */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card { background: var(--bg-white); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 22px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-icon-lg { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; margin: 0 auto; }
.card { border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--bg-white); }
.card-header { background: transparent; border-bottom: 1px solid var(--border-color); padding: 16px 20px; }
.card-body { padding: 20px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }

/* Project Grid */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card-wrapper { position: relative; }
.project-card-link { text-decoration: none; color: inherit; display: block; }
.project-card { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition); }
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-2px); }
.project-card-icon { width: 48px; height: 48px; background: linear-gradient(135deg, var(--primary), #3B82F6); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 22px; flex-shrink: 0; }
.project-card-body { flex: 1; min-width: 0; }
.project-card-body h6 { margin-bottom: 4px; font-weight: 600; }
.project-card-arrow { color: var(--text-secondary); font-size: 18px; }
.project-card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: var(--transition); }
.project-card-wrapper:hover .project-card-actions { opacity: 1; }

/* Dataset */
.dataset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dataset-card { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 20px; transition: var(--transition); position: relative; }
.dataset-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.dataset-card-header { display: flex; align-items: center; gap: 12px; }
.dataset-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-size: 18px; }
.dataset-card-actions { position: absolute; top: 8px; right: 8px; opacity: 0; transition: var(--transition); }
.dataset-card:hover .dataset-card-actions { opacity: 1; }

/* Dataset category icons (dynamic color by group index) */
.dataset-icon-0 { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.dataset-icon-1 { background: linear-gradient(135deg, #F43F5E, #FB7185); }
.dataset-icon-2 { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.dataset-icon-3 { background: linear-gradient(135deg, #10B981, #34D399); }
.dataset-icon-4 { background: linear-gradient(135deg, #3B82F6, #60A5FA); }
.dataset-icon-5 { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.dataset-icon-6 { background: linear-gradient(135deg, #EC4899, #F472B6); }
.dataset-icon-7 { background: linear-gradient(135deg, #6B7280, #9CA3AF); }

/* Category section */
.category-section { }
.category-section-header { padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.category-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: white; font-size: 14px; }
.category-badge-0 { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.category-badge-1 { background: linear-gradient(135deg, #F43F5E, #FB7185); }
.category-badge-2 { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.category-badge-3 { background: linear-gradient(135deg, #10B981, #34D399); }
.category-badge-4 { background: linear-gradient(135deg, #3B82F6, #60A5FA); }
.category-badge-5 { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.category-badge-6 { background: linear-gradient(135deg, #EC4899, #F472B6); }
.category-badge-7 { background: linear-gradient(135deg, #6B7280, #9CA3AF); }

/* Template */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.template-card { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 20px; transition: var(--transition); }
.template-card:hover { box-shadow: var(--shadow-md); }
.template-card-header { display: flex; justify-content: space-between; align-items: center; }
.template-type-badge { color: white; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.prompt-preview { font-style: italic; line-height: 1.4; }
.template-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.prompt-editor { font-family: 'SF Mono', 'Monaco', 'Menlo', monospace; font-size: 13px; line-height: 1.6; }

/* Report */
.filter-tabs { display: flex; gap: 4px; background: var(--bg-white); padding: 4px; border-radius: var(--radius); border: 1px solid var(--border-color); width: fit-content; }
.filter-tab { padding: 6px 16px; border-radius: 6px; text-decoration: none; color: var(--text-secondary); font-size: 14px; transition: var(--transition); }
.filter-tab.active { background: var(--primary); color: white; }
.report-list { display: flex; flex-direction: column; gap: 8px; }
.report-item { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition); }
.report-id { flex-shrink: 0; }
.report-item:hover { box-shadow: var(--shadow-sm); }
.report-item-main { flex: 1; min-width: 0; }
.report-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.report-content { font-size: 15px; line-height: 1.8; }
.report-content h2 { font-size: 18px; margin-top: 24px; margin-bottom: 12px; }
.report-content h3 { font-size: 16px; margin-top: 16px; }

/* Template/Dataset select cards */
.template-select-card .form-check-input, .dataset-select-card .form-check-input { display: none; }
.template-select-card .form-check-input:checked + label .card, .dataset-select-card .form-check-input:checked + label .card { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,115,232,0.2); }

/* User avatar */
.user-avatar-sm { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), #3B82F6); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 12px; }

/* Breadcrumb */
.breadcrumb-custom a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-custom a:hover { color: var(--primary); }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; margin: 0 8px; color: var(--text-secondary); }

/* Table */
.table > :not(caption) > * > * { padding: 12px 16px; }
.table thead th { font-weight: 500; font-size: 13px; color: var(--text-secondary); border-bottom-width: 1px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .sidebar-logo span, .sidebar .nav-item span, .sidebar .nav-section-title, .sidebar .user-details { display: none; }
    .main-content { margin-left: 64px; }
    .stats-grid { grid-template-columns: 1fr; }
    .project-grid, .dataset-grid, .template-grid { grid-template-columns: 1fr; }
}
