/* ============================================
   线上评审系统 - 主样式表
   ============================================ */

/* --- CSS 变量 (主题) --- */
:root {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1d29;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --primary: #4f6ef7;
    --primary-hover: #3b5de7;
    --primary-light: #eef1ff;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0f1119;
    --bg-card: #1a1d29;
    --bg-sidebar: #0d0f16;
    --text: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --primary: #6b8aff;
    --primary-hover: #5a7af0;
    --primary-light: #1e2440;
    --success: #34d399;
    --success-light: #064e3b;
    --warning: #fbbf24;
    --warning-light: #78350f;
    --danger: #f87171;
    --danger-light: #7f1d1d;
    --border: #2d3148;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Login Page --- */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
[data-theme="dark"] .login-page { background: linear-gradient(135deg, #1a1d29 0%, #2d1b4e 100%); }

.login-container { width: 100%; max-width: 420px; }
.login-card {
    background: var(--bg-card); border-radius: 20px; padding: 40px;
    box-shadow: var(--shadow-lg); transition: background 0.3s;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-icon {
    width: 64px; height: 64px; margin: 0 auto 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    color: white;
}
.login-icon svg { width: 36px; height: 36px; }
.login-header h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 20px; }
.login-footer { text-align: center; margin-top: 24px; color: var(--text-muted); font-size: 13px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; color: var(--text); }
.input-wrapper { position: relative; }
.input-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; color: var(--text-muted);
}
.input-wrapper input { padding-left: 40px !important; }

input[type="text"], input[type="password"], input[type="file"],
textarea, select {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px;
    background: var(--bg-card); color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.15);
}
textarea { resize: vertical; min-height: 80px; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all var(--transition); text-decoration: none; gap: 8px;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; padding: 10px 20px; border-radius: var(--radius-sm); background: var(--border); color: var(--text-muted); font-size: 14px; }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-size: 14px; font-weight: 500;
}
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }

/* --- App Layout --- */
.app-layout { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
    width: 260px; background: var(--bg-sidebar); color: #e5e7eb;
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
    bottom: 0; z-index: 100; transition: transform 0.3s;
}
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.sidebar-logo svg { width: 28px; height: 28px; color: var(--primary); }
.sidebar-logo-img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px;
    color: #9ca3af; font-size: 14px; transition: all var(--transition);
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #e5e7eb; text-decoration: none; }
.nav-item.active { background: rgba(79,110,247,0.15); color: var(--primary); border-left-color: var(--primary); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 16px; color: #fff;
}
.user-name { font-size: 14px; font-weight: 500; color: #e5e7eb; }
.user-role { font-size: 12px; color: #9ca3af; }
.theme-toggle {
    background: rgba(255,255,255,0.1); border: none; color: #e5e7eb;
    width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover { background: rgba(255,255,255,0.2); }
.logout-btn { display: block; text-align: center; padding: 8px; color: #9ca3af; font-size: 13px; border-radius: 6px; }
.logout-btn:hover { color: #f87171; background: rgba(239,68,68,0.1); text-decoration: none; }

/* --- Main Content --- */
.main-content {
    margin-left: 260px; flex: 1; padding: 32px; max-width: calc(100vw - 260px);
}
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.content-header h2 { font-size: 24px; font-weight: 700; }
.text-muted { color: var(--text-muted); font-size: 14px; }

/* --- Stats Grid --- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* --- Section --- */
.section { background: var(--bg-card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.section h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

/* --- Data Table --- */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    text-align: left; padding: 12px 16px; background: var(--bg);
    color: var(--text-secondary); font-weight: 600; font-size: 13px;
    white-space: nowrap;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: var(--primary-light); }
.data-table .actions { display: flex; gap: 6px; white-space: nowrap; }

/* --- Progress Bar --- */
.progress-bar {
    height: 6px; background: var(--border); border-radius: 3px;
    overflow: hidden; min-width: 80px;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 3px; transition: width 0.5s ease;
}
.progress-text { font-size: 12px; color: var(--text-muted); display: block; margin-top: 4px; }

/* --- Empty State --- */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* --- Upload Area --- */
.upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 48px; text-align: center; transition: all var(--transition);
    cursor: pointer;
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--primary); background: var(--primary-light); }
.upload-icon svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 12px; }
.upload-area h3 { margin-bottom: 8px; }
.file-info {
    margin-top: 12px; padding: 12px; background: var(--primary-light);
    border-radius: var(--radius-sm); font-size: 14px;
}
.upload-progress { margin-top: 12px; text-align: left; }

/* --- Batch List --- */
.batch-list { display: flex; flex-direction: column; gap: 12px; }
.batch-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px; background: var(--bg); border-radius: var(--radius-sm);
    border: 1px solid var(--border); transition: all var(--transition);
}
.batch-card:hover { border-color: var(--primary); }
.batch-info h4 { font-size: 16px; margin-bottom: 4px; }
.batch-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.batch-actions { display: flex; gap: 8px; }

/* --- Form Row --- */
.form-row { display: flex; gap: 16px; align-items: flex-end; }
.flex-1 { flex: 1; }
.form-submit { flex-shrink: 0; }

/* --- Badge --- */
.badge {
    display: inline-block; padding: 2px 10px; background: var(--primary-light);
    color: var(--primary); border-radius: 12px; font-size: 12px; font-weight: 500;
}

/* --- Field Grid --- */
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 20px; }
.field-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
    font-size: 14px;
}
.field-item:hover { border-color: var(--primary); }
.field-item.checked { border-color: var(--primary); background: var(--primary-light); }
.field-item.field-privacy { opacity: 0.7; }
.field-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.field-name { flex: 1; font-size: 13px; }
.type-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px;
    font-weight: 600; text-transform: uppercase;
}
.type-badge.text { background: #e5e7eb; color: #6b7280; }
.type-badge.image { background: #dbeafe; color: #2563eb; }
.type-badge.video { background: #fce7f3; color: #db2777; }
.type-badge.pdf { background: #fee2e2; color: #dc2626; }
.type-badge.file { background: #fef3c7; color: #d97706; }
.privacy-tag {
    font-size: 10px; padding: 1px 6px; background: var(--warning-light);
    color: var(--warning); border-radius: 4px;
}
.field-type-legend { display: flex; gap: 20px; margin-bottom: 16px; font-size: 13px; color: var(--text-secondary); }
.legend-item { display: flex; align-items: center; gap: 6px; }

/* --- Form Actions --- */
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* --- Preview Card --- */
.preview-card {
    background: var(--bg); border-radius: var(--radius-sm);
    padding: 16px; margin-bottom: 12px; border: 1px solid var(--border);
}
.preview-header { font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.preview-field { font-size: 13px; }
.preview-label { display: block; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.preview-value { color: var(--text); }
.preview-thumb { max-width: 100%; max-height: 120px; border-radius: 6px; object-fit: cover; }

/* --- Works List --- */
.works-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.work-card {
    display: block; background: var(--bg-card); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; transition: all var(--transition);
    border: 2px solid transparent; color: var(--text);
}
.work-card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.work-card.reviewed { border-color: var(--success); }
.work-number {
    padding: 8px 14px; background: var(--bg); font-size: 12px;
    color: var(--text-secondary); font-weight: 600;
}
.work-preview {
    height: 160px; background: var(--bg); display: flex;
    align-items: center; justify-content: center; overflow: hidden;
}
.work-thumb { width: 100%; height: 100%; object-fit: cover; }
.no-thumb {
    color: var(--text-muted); font-size: 13px;
}
.work-media-icon {
    width: 60px; height: 60px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
}
.video-icon { background: #fce7f3; color: #db2777; }
.video-icon svg { width: 32px; height: 32px; }
.pdf-icon { background: #fee2e2; color: #dc2626; }
.pdf-icon svg { width: 32px; height: 32px; }
.work-info { padding: 14px; }
.work-title { font-size: 14px; font-weight: 500; margin-bottom: 8px; line-height: 1.4; }
.work-status { font-size: 13px; }

/* --- Grade Badge --- */
.grade-badge {
    display: inline-block; padding: 2px 10px; border-radius: 6px;
    font-size: 14px; font-weight: 700;
}
.grade-a { background: var(--success-light); color: var(--success); }
.grade-b { background: #dbeafe; color: #2563eb; }
.grade-c { background: var(--warning-light); color: var(--warning); }
.grade-d { background: var(--danger-light); color: var(--danger); }
.status-pending { color: var(--text-muted); }

/* --- Pagination --- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.page-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px; font-size: 14px;
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
    transition: all var(--transition);
}
.page-link:hover { border-color: var(--primary); text-decoration: none; }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- Batch Tabs --- */
.batch-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px;
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
    transition: all var(--transition); display: flex; gap: 8px; align-items: center;
}
.tab:hover { border-color: var(--primary); text-decoration: none; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-badge {
    background: rgba(255,255,255,0.2); padding: 1px 8px;
    border-radius: 10px; font-size: 12px;
}
.tab.active .tab-badge { background: rgba(255,255,255,0.3); }

/* --- Review Page --- */
.review-page .main-content { padding: 20px; }
.review-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 16px; background: var(--bg-card);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 24px; position: sticky; top: 20px; z-index: 10;
}
.review-position { font-weight: 600; font-size: 15px; }
.review-content { display: flex; flex-direction: column; gap: 24px; }

/* --- Media Section --- */
.media-section, .info-section, .review-form-section {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
.media-section h3, .info-section h3, .review-form-section h3 {
    font-size: 18px; font-weight: 600; margin-bottom: 16px;
}
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.media-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.media-label {
    padding: 8px 14px; background: var(--bg); font-size: 12px;
    color: var(--text-secondary); font-weight: 500;
}
.media-image-wrapper {
    position: relative; cursor: pointer; overflow: hidden;
    background: #000; min-height: 200px; display: flex; align-items: center; justify-content: center;
}
.media-image-wrapper img {
    max-width: 100%; max-height: 400px; object-fit: contain;
    transition: transform 0.3s ease;
}
.media-image-wrapper:hover img { transform: scale(1.03); }
.media-zoom-hint {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px;
    border-radius: 4px; font-size: 12px; opacity: 0; transition: opacity 0.2s;
}
.media-image-wrapper:hover .media-zoom-hint { opacity: 1; }
.media-error {
    padding: 32px; color: var(--text-muted); text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.media-error svg { opacity: 0.5; }
.media-error p { font-size: 14px; }
.media-video-wrapper { padding: 0; }
.media-video { width: 100%; display: block; max-height: 400px; background: #000; }

/* --- PDF Viewer (iframe + fallback) --- */
.media-pdf-wrapper {
    display: flex; flex-direction: column; min-height: 500px;
}
.media-pdf-viewer {
    flex: 1; position: relative; min-height: 400px;
    background: #f5f5f5;
}
[data-theme="dark"] .media-pdf-viewer { background: #1e1e1e; }
.media-pdf-iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border: none;
}
.media-pdf-fallback {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: none; align-items: center; justify-content: center;
    flex-direction: column; gap: 12px;
}
.media-pdf-fallback.show { display: flex; }
.media-pdf-hint {
    font-size: 13px; color: var(--text-muted);
}
.media-pdf-actions {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--bg); border-top: 1px solid var(--border);
    gap: 10px; flex-wrap: wrap;
}
.media-pdf-actions .media-card-name {
    font-size: 13px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- Media Card (new robust layout) --- */
.media-card-wrapper {
    display: flex; flex-direction: column; align-items: center;
    padding: 24px 20px 16px; gap: 12px;
}
.media-card-icon {
    width: 80px; height: 80px; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
}
.media-card-icon svg { width: 36px; height: 36px; }
.media-card-icon.pdf-card { background: #fee2e2; color: #dc2626; }
.media-card-icon.file-card { background: #fef3c7; color: #d97706; }
.media-card-icon.unknown-card { background: #e5e7eb; color: #6b7280; }
.media-card-ext {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.media-card-name {
    font-size: 13px; color: var(--text-secondary); text-align: center;
    word-break: break-all; max-width: 100%;
}
.media-card-btn {
    margin-top: 4px;
}
.pdf-open-btn { margin: 8px; }
.file-download-link {
    display: flex; align-items: center; gap: 8px; padding: 16px;
    color: var(--primary); font-size: 14px;
}
.file-download-link svg { width: 20px; height: 20px; }

/* --- Info Grid --- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.info-item { padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm); }
.info-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.info-value { font-size: 14px; font-weight: 500; }

/* --- Grade Selector --- */
.grade-buttons { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.grade-btn {
    display: flex; flex-direction: column; align-items: center;
    padding: 16px 24px; border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    transition: all var(--transition); min-width: 100px;
    position: relative;
}
.grade-btn:hover { border-color: var(--primary); }
.grade-btn:has(input:checked) { border-color: var(--grade-color, var(--primary)); background: color-mix(in srgb, var(--grade-color, var(--primary)) 10%, transparent); }
.grade-btn input[type="radio"] { position: absolute; opacity: 0; width: 100%; height: 100%; top: 0; left: 0; cursor: pointer; }
.grade-label { font-size: 28px; font-weight: 800; color: var(--grade-color, var(--text)); }
.grade-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* --- Grade Settings Page --- */
.grade-settings-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; gap: 16px;
}
.grade-settings-header h3 { margin-bottom: 6px; }
.grade-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.grade-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); transition: all var(--transition);
}
.grade-row:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.grade-drag-handle {
    cursor: grab; color: var(--text-muted); padding: 4px;
    display: flex; align-items: center; user-select: none;
}
.grade-drag-handle:active { cursor: grabbing; }
.grade-row-preview {
    width: 50px; height: 50px; border-radius: 10px;
    background: var(--grade-color); display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.grade-row-key { font-size: 22px; font-weight: 800; color: #fff; }
.grade-row-fields { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.grade-field { min-width: 100px; flex: 1; }
.grade-field label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.grade-field input[type="text"] { padding: 6px 10px; font-size: 13px; }
.grade-field-color { min-width: 60px; flex: 0 0 auto; }
.grade-field-color input[type="color"] {
    width: 44px; height: 32px; padding: 2px; border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; background: var(--bg-card);
}
.grade-row-delete {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 6px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center;
}
.grade-row-delete:hover { color: var(--danger); background: var(--danger-light); }
.grade-preview-section {
    padding: 20px; background: var(--bg); border-radius: var(--radius-sm);
    border: 1px dashed var(--border); margin-bottom: 20px;
}
.grade-preview-section h4 { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }

/* --- Template Grid --- */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.template-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
    font-family: inherit; font-size: inherit; color: var(--text);
}
.template-card:hover { border-color: var(--primary); background: var(--primary-light); }
.template-name { font-weight: 600; font-size: 14px; }
.template-desc { font-size: 12px; color: var(--text-secondary); }

/* --- Lightbox --- */
.lightbox {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 9999;
    align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 90%; max-height: 85vh; object-fit: contain; }
.lightbox-close {
    position: absolute; top: 20px; right: 30px; color: #fff;
    font-size: 40px; cursor: pointer; z-index: 10; line-height: 1;
}
.lightbox-nav { position: absolute; top: 50%; width: 100%; display: flex; justify-content: space-between; }
.lightbox-prev, .lightbox-next {
    color: #fff; font-size: 32px; padding: 20px; cursor: pointer; user-select: none;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-3 { grid-template-columns: repeat(2, 1fr); }
    .media-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; max-width: 100%; padding: 16px; }
    .stats-grid, .stats-3 { grid-template-columns: 1fr; }
    .review-nav { flex-wrap: wrap; }
    .form-row { flex-direction: column; }
    .batch-card { flex-direction: column; gap: 12px; }
    .grade-buttons { justify-content: center; }
}

/* --- COS 状态指示 --- */
.cos-status { font-size: 13px; padding: 10px 14px; border-radius: var(--radius-sm); }
.cos-status-ok {
    display: flex; align-items: center; gap: 8px;
    color: var(--success); background: color-mix(in srgb, var(--success) 8%, transparent);
    padding: 10px 14px; border-radius: var(--radius-sm);
}
.cos-status-warn {
    display: flex; align-items: center; gap: 8px;
    color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, transparent);
    padding: 10px 14px; border-radius: var(--radius-sm);
}
.required { color: var(--danger); }

/* ============ 页面过渡加载层（毛玻璃卡片风格） ============ */
.page-loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center;
    background: rgba(15, 17, 25, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.page-loading-overlay.active {
    opacity: 1; pointer-events: all;
}
/* 毛玻璃卡片 */
.page-loading-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 24px;
    padding: 44px 52px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}
[data-theme="dark"] .page-loading-card {
    background: rgba(30, 33, 50, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15);
}
/* 卡片缩放动画 */
.page-loading-card.popping {
    animation: cardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.page-loading-spinner {
    width: 44px; height: 44px; margin: 0 auto 20px;
    border: 3px solid rgba(79, 110, 247, 0.12);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.page-loading-icon {
    width: 56px; height: 56px; margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--success-light);
    color: var(--success);
    display: none; align-items: center;
    justify-content: center;
    animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-loading-icon svg {
    width: 30px; height: 30px;
}
@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.page-loading-text {
    font-size: 16px; font-weight: 600; color: var(--text);
    line-height: 1.5;
    letter-spacing: -0.01em;
}
[data-theme="dark"] .page-loading-text {
    color: #e5e7eb;
}
.page-loading-sub {
    font-size: 13px; color: var(--text-muted);
    margin-top: 6px;
}

/* 页面初次加载淡入 */
body.page-enter {
    opacity: 0;
    transition: opacity 0.3s ease;
}
body.page-enter-ready {
    opacity: 1;
}
