/* ============================================================
   员工培训考核系统 - 样式系统
   响应式设计，适配 PC 与移动端
   ============================================================ */

:root {
  /* 主色调 - 专业蓝 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-50: #eff6ff;

  /* 辅助色 */
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;

  /* 中性色 */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* 尺寸 */
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  /* 过渡 */
  --transition: all 0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

/* ============ 通用组件 ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-dark);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--surface-2); color: var(--text-secondary); }
.badge-purple { background: #ede9fe; color: #7c3aed; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}
.form-label .required { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ============ 登录页 ============ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.role-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.role-tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.role-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.demo-hint {
  margin-top: 16px;
  padding: 12px;
  background: var(--primary-50);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.demo-hint strong { color: var(--primary-dark); }

/* ============ 主布局 ============ */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-header .logo-text { font-size: 15px; font-weight: 600; color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}
.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #64748b;
  padding: 12px 12px 6px;
  letter-spacing: 0.5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 17px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; color: #fff; font-weight: 500; }
.sidebar-user .user-role { font-size: 11px; color: #94a3b8; }
.sidebar-user .logout-btn {
  background: transparent;
  color: #94a3b8;
  font-size: 16px;
  padding: 4px;
}
.sidebar-user .logout-btn:hover { color: #fff; }

.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .menu-toggle {
  display: none;
  font-size: 22px;
  background: transparent;
  color: var(--text);
  padding: 4px;
  margin-right: 12px;
}
.topbar .page-title { font-size: 17px; font-weight: 600; }
.topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ============ 页面通用 ============ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 600; }
.page-header .subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar .search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.toolbar .search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.toolbar .search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ============ 表格 ============ */

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--primary-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .actions { display: flex; gap: 6px; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============ 统计卡片 ============ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-card .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-card .stat-icon.cyan { background: var(--info-light); color: var(--info); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ============ 网格卡片 ============ */

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

.material-card, .exam-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.material-card:hover, .exam-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.material-thumb, .exam-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: #fff;
  position: relative;
}
.material-thumb.doc { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.material-thumb.video { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.material-thumb.pdf { background: linear-gradient(135deg, #dc2626, #ef4444); }
.material-thumb.img { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.material-thumb.file { background: linear-gradient(135deg, #475569, #64748b); }
.exam-thumb { background: linear-gradient(135deg, #0f766e, #14b8a6); }

.material-body, .exam-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.material-body h4, .exam-body h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.material-meta, .exam-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.material-desc, .exam-desc { font-size: 13px; color: var(--text-secondary); flex: 1; margin-bottom: 12px; }
.material-actions, .exam-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ============ 模态框 ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}
.modal.modal-lg { max-width: 800px; }
.modal.modal-xl { max-width: 1000px; }
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
  background: transparent;
  font-size: 22px;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

/* ============ 考试界面 ============ */

.exam-container {
  max-width: 860px;
  margin: 0 auto;
}
.exam-topbar {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  position: sticky;
  top: 16px;
  z-index: 40;
  flex-wrap: wrap;
  gap: 10px;
}
.exam-topbar .exam-info h3 { font-size: 16px; }
.exam-topbar .exam-info p { font-size: 12px; color: var(--text-muted); }
.timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary-50);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}
.timer.warning { background: var(--warning-light); color: var(--warning); }
.timer.danger { background: var(--danger-light); color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.7;} }

.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 16px;
}
.question-num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.question-num .q-num { font-size: 13px; font-weight: 600; color: var(--primary); }
.question-num .q-type-badge { font-size: 11px; }
.question-num .q-score { font-size: 12px; color: var(--text-muted); }
.question-text { font-size: 16px; font-weight: 500; margin-bottom: 18px; line-height: 1.7; }

.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.option-item:hover { border-color: var(--primary); background: var(--primary-50); }
.option-item.selected { border-color: var(--primary); background: var(--primary-50); }
.option-item .option-marker {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.option-item.selected .option-marker { border-color: var(--primary); background: var(--primary); color: #fff; }
.option-item.checkbox .option-marker { border-radius: 6px; }
.option-item.checkbox.selected .option-marker::after { content: "✓"; color: #fff; font-size: 16px; }
.option-item .option-text { flex: 1; }

.exam-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
  margin: 16px 0;
}
.q-nav-btn {
  aspect-ratio: 1;
  border: 1px solid var(--border-dark);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.q-nav-btn:hover { border-color: var(--primary); }
.q-nav-btn.answered { background: var(--success); color: #fff; border-color: var(--success); }
.q-nav-btn.current { border-color: var(--primary); border-width: 2px; }
.q-nav-btn.flagged { background: var(--warning); color: #fff; border-color: var(--warning); }

/* ============ 学习界面 ============ */

.learn-viewer {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.viewer-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.viewer-body { padding: 24px; min-height: 400px; }
.viewer-body .file-preview { text-align: center; padding: 40px; }
.viewer-body .file-preview .file-icon { font-size: 64px; margin-bottom: 16px; }

/* ============ Toast 提示 ============ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  border-left: 4px solid var(--primary);
  animation: slideInRight 0.25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast .toast-msg { flex: 1; font-size: 14px; }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============ 图表区 ============ */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px;
}
.chart-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.chart-wrapper { position: relative; height: 260px; }

/* ============ 结果展示 ============ */

.result-hero {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 36px;
  text-align: center;
  margin-bottom: 20px;
}
.result-hero .score-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
  border: 6px solid;
}
.result-hero.pass .score-circle { border-color: var(--success); color: var(--success); background: var(--success-light); }
.result-hero.fail .score-circle { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.result-hero .result-status { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.result-hero.pass .result-status { color: var(--success); }
.result-hero.fail .result-status { color: var(--danger); }
.result-hero .result-meta { color: var(--text-muted); font-size: 14px; }

/* ============ 分类标签 ============ */

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.category-tab {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.category-tab:hover { border-color: var(--primary); }
.category-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============ 移动端遮罩 ============ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ============ 响应式 ============ */

@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .main-area { margin-left: 0; }
  .topbar .menu-toggle { display: block; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 20px; }
  .stat-card .stat-value { font-size: 22px; }
  .modal { max-width: 100%; }
  .chart-grid { grid-template-columns: 1fr; }
  .question-card { padding: 16px; }
  .exam-topbar { padding: 12px; }
  .timer { font-size: 16px; padding: 6px 12px; }
  .page-header h2 { font-size: 18px; }
  .cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search-box { max-width: 100%; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* 隐藏 */
.hidden { display: none !important; }

/* ============ 封面图片 ============ */

.cover-upload-area {
  width: 100%;
  height: 150px;
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
  transition: var(--transition);
}
.cover-upload-area:hover { border-color: var(--primary); background: var(--primary-50); }
.cover-upload-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-upload-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.cover-upload-placeholder .placeholder-icon { font-size: 32px; margin-bottom: 6px; }

.cover-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* 裁剪模态框 */
.crop-modal-body {
  max-height: 500px;
  overflow: hidden;
}
.crop-modal-body img {
  max-width: 100%;
  display: block;
}

/* 资料卡片封面 */
.material-thumb img.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.material-thumb .thumb-default {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}
.material-thumb .thumb-type-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}
