/* ============================================================
   作业闯关系统 · 移动端优先扁平设计（v5）
   风格：H5 手机适配 / 扁平化 / 干净简约
   主色：珊瑚红 #FF6B6B   辅色：青绿 #10B981
   背景：#F5F7FA   卡片：#FFFFFF
   ============================================================ */

/* ---- 设计令牌 :root (亮色) ---- */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --text: #1f2937;
  --text-soft: #4b5563;
  --text-muted: #9ca3af;

  --primary: #FF6B6B;
  --primary-dark: #EE5253;
  --primary-light: #FFE8E8;
  --primary-soft: #FFE8E8;
  --primary-grad: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
  --primary-rgb: 255,107,107;

  --success: #10B981;
  --success-bg: #D1FAE5;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --info: #3B82F6;
  --info-bg: #DBEAFE;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;
  --radius-pill: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --nav-height: 64px;
  --bottom-nav-height: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(.16, 1, .3, 1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

/* ---- 暗色 ---- */
[data-theme="dark"] {
  --bg: #111827;
  --surface: #1f2937;
  --surface-2: #374151;
  --border: #374151;
  --border-strong: #4b5563;

  --text: #f9fafb;
  --text-soft: #d1d5db;
  --text-muted: #6b7280;

  --primary: #FF8E8E;
  --primary-dark: #FF6B6B;
  --primary-light: rgba(255, 107, 107, 0.15);
  --primary-soft: rgba(255, 107, 107, 0.15);
  --primary-rgb: 255,142,142;

  --success-bg: rgba(16, 185, 129, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info-bg: rgba(59, 130, 246, 0.15);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* 暗色外观由后台「整站风格」中的暗色皮肤（暗夜蓝 / 墨黑金 / 极光紫）统一控制，
   不再跟随系统偏好，确保管理员设定的整站风格对所有用户一致生效。 */

/* ---- 重置 ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
/* 仅对非表单元素显示 focus outline，避免移动端输入框聚焦时产生额外渲染层导致模糊 */
:focus-visible:not(input):not(textarea):not(select) { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
img { max-width: 100%; display: block; }
::selection { background: var(--primary-light); color: var(--primary-dark); }

/* ---- 布局容器 ---- */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}
main {
  padding-top: 15px !important;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
  min-height: calc(100dvh - var(--nav-height) - var(--safe-top));
}
main:has(.admin-layout) { padding: 0; min-height: auto; }

/* ---- 顶部导航 ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--nav-height) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="dark"] .navbar { background: rgba(31, 41, 55, 0.95); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex: 1.5;
}
.brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-grad);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  flex: none;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.brand .logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* 品牌文字区域（主标题 + 副标题） */
.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 44px; /* 与 logo 同高 */
  gap: 2px;
  line-height: 1.1;
}
.brand-title {
  flex: 1.5;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
  color: var(--text);
  white-space: nowrap;
}
.brand-title:only-child {
  flex: none;
  height: 100%;
}
.brand-subtitle {
  flex: 1;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  color: var(--text-soft);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.nav-links a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-links a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 18px;
  color: var(--text-soft);
  border-radius: 50%;
  transition: all .15s var(--ease);
}
.bell:hover { background: var(--bg); color: var(--primary); transform: scale(1.05); }
.bell .dot {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

/* ---- 底部 Tab（固定贴底） ---- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.bottom-nav a {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 600;
  min-height: 52px;
  transition: color .15s var(--ease), background-color .15s var(--ease);
  text-decoration: none;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav .nav-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 22px;
  border-radius: 22px;
  transition: color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}
.bottom-nav a.active .nav-label {
  color: var(--primary);
}
.bottom-nav a.active .nav-label::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}
/* 紧贴“通知”文字，作为角标的定位参照 */
.bottom-nav .nav-text {
  position: relative;
  display: inline-block;
  line-height: 1;
}
.bottom-nav .dot {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  line-height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  transform: translate(50%, -50%);
  z-index: 1;
}

/* ---- 卡片 ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: all .2s var(--ease);
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card.interactive { cursor: pointer; }
.card.interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.card.empty {
  text-align: center;
  padding: 40px 16px;
}
.card.empty .ico { font-size: 48px; margin-bottom: 12px; }
.card.empty h2 { margin: 0 0 8px; font-size: 18px; }
.card.empty p { margin: 0; font-size: 14px; }

/* app-body 内部卡片 —— 在列表中做无装饰清理 */
.app-body .card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 16px; }
.app-body .card.empty { padding: 40px 16px; }

/* ---- 系统公告 ---- */
.announcement-bar { padding: 14px 16px; margin-bottom: 16px; }
.announcement-title { font-weight: 700; color: var(--primary-dark); font-size: 15px; }
.announcement-close {
  width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent;
  color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.announcement-close:hover { background: var(--bg); color: var(--text); }
.announcement-list { display: flex; flex-direction: column; gap: 10px; }
.announcement-item {
  padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
}
.announcement-item__title { font-weight: 600; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.announcement-item__time { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.announcement-item__content { font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.announcement-item__content p { margin: 0 0 6px; }
.announcement-item__content p:last-child { margin-bottom: 0; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; gap: 12px; }
.grid-3, .grid-4 { grid-template-columns: 1fr; gap: 12px; }

/* ---- 文字 ---- */
h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.3; font-weight: 700; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
.page-title { font-size: 18px; font-weight: 700; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s var(--ease);
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  min-width: 48px;
}
.btn:hover { background: var(--bg); color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); transition-duration: .08s; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary-grad); color: #fff; border: none; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; color: #fff; border-color: #059669; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg); border-color: var(--border); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

/* 返回按钮（二级按钮样式，箭头 + 文字） */
.btn-back {
  display: inline-flex;
  gap: 8px;
  padding: 0 16px;
  height: 36px;
  color: #fff;
  font-weight: 600;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 2px 6px rgba(var(--primary-rgb), .18);
}
.btn-back:hover {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(var(--primary-rgb), .28);
}
.btn-back-icon {
  flex: none;
  transition: transform .15s var(--ease);
}
.btn-back:hover .btn-back-icon {
  transform: translateX(-2px);
}

/* 未勾选时点击提交按钮，勾选框抖动提示 */
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.checkbox.shake { animation: shakeX .4s ease; border-color: var(--danger); color: var(--danger); }
.upload-card.shake { animation: shakeX .4s ease; border-color: var(--danger); }
.btn-block { width: 100%; }

/* ---- 表单 ---- */
.field { margin-bottom: 16px; }
label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-soft);
}
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: all .15s var(--ease);
  appearance: none;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
textarea { min-height: 120px; padding: 12px 16px; resize: vertical; line-height: 1.6; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.checkbox, .radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-soft);
  min-height: 48px;
  cursor: pointer;
  font-size: 14px;
}
.checkbox input, .radio input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; border-radius: 4px; }
.help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.required::after { content: ' *'; color: var(--danger); }

/* ---- 徽章 ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.pending { background: var(--primary-light); color: var(--primary-dark); }
.badge.submitted { background: var(--warning-bg); color: #B45309; }
.badge.approved { background: var(--success-bg); color: #047857; }
.badge.rejected { background: var(--danger-bg); color: #B91C1C; }
.badge.role { background: var(--bg); color: var(--text-soft); border-color: var(--border); }
.badge.backend { background: var(--primary-light); color: var(--primary-dark); }
.badge.gray { background: var(--bg); color: var(--text-muted); border-color: var(--border); }
.badge.info { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }
[data-theme="dark"] .badge.info { background: #1E3A8A; color: #93C5FD; border-color: #1E40AF; }
.badge.type-theory { background: #E0E7FF; color: #4338CA; }
.badge.type-practice { background: var(--success-bg); color: #047857; }
.badge.type-exam { background: var(--warning-bg); color: #B45309; }
.badge.type-project { background: #FCE7F3; color: #BE185D; }
[data-theme="dark"] .badge.type-theory { background: #312E81; color: #C7D2FE; }
[data-theme="dark"] .badge.type-practice { background: #064E3B; color: #6EE7B7; }
[data-theme="dark"] .badge.type-exam { background: #451A03; color: #FCD34D; }
[data-theme="dark"] .badge.type-project { background: #500724; color: #F9A8D4; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 0; }
.checks .checkbox { min-height: auto; font-size: 13px; }

/* ---- 表格 ---- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--text-soft); position: sticky; top: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--bg); }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}
.table-wrap .table { min-width: 640px; }
.table-wrap .table th:first-child, .table-wrap .table td:first-child { padding-left: 16px; }
.table-wrap .table th:last-child, .table-wrap .table td:last-child { padding-right: 16px; }

/* ---- Flash / Toast ---- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  text-align: center;
}
.flash.success { background: var(--success-bg); color: #047857; border-color: rgba(16, 185, 129, 0.2); }
.flash.error { background: var(--danger-bg); color: #B91C1C; border-color: rgba(239, 68, 68, 0.2); }
.flash.info { background: var(--info-bg); color: #1D4ED8; border-color: rgba(59, 130, 246, 0.2); }
.flash-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + 20px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.flash--toast {
  pointer-events: auto;
  width: 100%;
  margin: 0;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 1px solid var(--border);
  animation: toastIn .3s var(--ease) both;
  border-radius: var(--radius-lg);
}
.flash--toast.fade-out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

/* ---- 弹窗 ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.show { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); }
.modal-card, .modal-dialog {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .3s var(--ease) both;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-header h3 { font-size: 18px; font-weight: 700; margin: 0; }
.modal-body { color: var(--text-soft); margin-bottom: 16px; line-height: 1.6; font-size: 14px; }
.modal-footer { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg);
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-soft);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: all .15s var(--ease);
}
.modal-close:hover { background: var(--primary-light); color: var(--primary); transform: rotate(90deg); }

/* ---- 进度 ---- */
.progress { height: 8px; border-radius: var(--radius-full); background: var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary-grad); border-radius: var(--radius-full); transition: width .5s var(--ease); }
.progress-wrap { height: 8px; border-radius: var(--radius-full); background: var(--border); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); background: var(--primary-grad); transition: width .5s var(--ease); }
.empty { text-align: center; padding: 40px 16px; }
.empty .ico { font-size: 48px; margin-bottom: 12px; }
.empty h2 { margin: 8px 0 4px; font-size: 18px; }
.empty p { font-size: 14px; }

/* ---- 管理布局 ---- */
.admin-layout { display: block; min-height: 100dvh; }
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  z-index: 110;
  transform: translateX(-100%);
  transition: transform .3s var(--ease);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar.open { transform: translateX(0); }
.sidebar .brand { margin-bottom: 20px; padding: 0 8px; font-size: 16px; flex: none; }
.sidebar .brand .logo { width: 42px; height: 42px; }
.side-group {
  font-size: 11px;
  color: var(--text-muted);
  margin: 20px 12px 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 15px;
  min-height: 48px;
  transition: all .15s var(--ease);
}
.sidebar a:hover { background: var(--bg); color: var(--text); text-decoration: none; transform: translateX(2px); }
.sidebar a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.sidebar a { position: relative; }
.admin-main { padding: 16px; min-width: 0; background: var(--bg); min-height: 100dvh; }
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 40;
}
.side-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
}
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

/* ---- 工具类 ---- */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.flex-1 { flex: 1; min-width: 0; }
.right { text-align: right; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.split { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hide-mobile { display: none !important; }
.hide-desktop { display: inherit; }

/* ---- 个人中心 ---- */
.profile-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--primary-grad);
  color: #fff;
  padding: 24px 16px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.profile-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,0.25), transparent 60%);
  pointer-events: none;
}
.profile-card--id { padding: 32px 16px; }
.profile-id-label { display: block; font-size: 13px; opacity: 0.9; position: relative; z-index: 1; }
.profile-id { font-size: 36px; font-weight: 700; line-height: 1.1; margin-top: 6px; position: relative; z-index: 1; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.profile-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 8px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.profile-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; }
.profile-stat .num { font-size: 22px; font-weight: 700; line-height: 1; color: var(--primary); }
.profile-stat .lbl { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }

/* ---- 手风琴 ---- */
.acc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.acc summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  font-weight: 600;
  font-size: 15px;
  min-height: 56px;
  transition: background .15s;
}
.acc summary:hover { background: var(--bg); }
.acc summary::-webkit-details-marker { display: none; }
.acc-ic { font-size: 20px; }
.acc-title { flex: 1; }
.acc-arrow {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform .2s;
}
.acc[open] .acc-arrow { transform: rotate(-135deg); }
.acc-body { padding: 16px 16px 16px; border-top: 1px solid var(--border); }

/* 与 accordion 视觉一致的链接入口（如个人中心的“我的作业”） */
.acc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  font-weight: 600;
  font-size: 15px;
  min-height: 56px;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.acc-row:hover { background: var(--bg); text-decoration: none; }
.acc-row .acc-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.acc-row .acc-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ---- App 列表行 ---- */
.app-list { display: flex; flex-direction: column; }
.app-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.app-row:last-child { border-bottom: none; }
.app-ic {
  font-size: 18px;
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  color: var(--primary-dark);
}
.app-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-title { font-weight: 600; font-size: 15px; }
.app-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.app-input { width: 100%; }
.app-row--input { flex-wrap: wrap; align-items: flex-start; }
.app-row--input .app-body { flex: 1 1 0; min-width: 0; }
.app-row--input .app-input { width: calc(100% - 52px); margin-left: 52px; margin-top: 8px; }

/* 账号设置中邮箱/手机：图标+标签+输入框一行展示 */
.app-row--inline {
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
}
.app-row--inline .app-body {
  flex: 0 0 auto;
  min-width: 0;
}
.app-row--inline .app-input {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.app-row--inline .app-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---- iOS 开关 ---- */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  transition: all .25s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 锁定态：开关禁灰 + 鼠标禁用 */
.switch--locked { cursor: not-allowed; opacity: .85; }
.switch--locked .slider { cursor: not-allowed; background: var(--primary); }
.switch--locked .slider::before { box-shadow: 0 1px 2px rgba(0,0,0,0.12); }

/* ---- 作业卡片 ---- */
.hw-list { display: flex; flex-direction: column; gap: 12px; }
.hw-card { display: flex; flex-direction: column; gap: 12px; }
.hw-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hw-card-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; line-height: 1.3; }
.hw-card-meta { font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 12px; }
.hw-grade-push { margin-left: auto; }
.hw-card-progress { margin: 4px 0; }
.hw-progress-label, .hw-progress-pct { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.hw-card-stats { font-size: 13px; color: var(--text-soft); gap: 12px; }
.hw-card-btn { margin-top: 4px; }
/* 评级：前缀与字母同字号、同色、同字重（无背景色胶囊） */
.hw-grade-label {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.5px;
  cursor: help;
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
/* 字母本体继承前缀的字形与颜色，仅作语义分组 */
.hw-grade { font: inherit; color: inherit; }
/* 评级着色（5 档：a/b/c/d/f；修饰类挂在 label 上，前缀与字母同色） */
.hw-grade--a { color: #f59e0b; } /* 金黄 */
.hw-grade--b { color: #3b82f6; } /* 蓝色 */
.hw-grade--c { color: #64748b; } /* 灰色 */
.hw-grade--d { color: #ea580c; } /* 橙色 */
.hw-grade--f { color: #dc2626; } /* 红色 */
.hw-detail-card--clickable { cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.hw-detail-card--clickable:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.hw-detail-card--clickable:active { transform: translateY(1px); }

/* ---- Dashboard 头部 ---- */
.dash-header { margin-bottom: 16px; }
.dash-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dash-title-text { font-size: 18px; font-weight: 700; }
.dash-subtitle { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.dash-link { font-size: 13px; font-weight: 600; color: var(--primary); transition: color .15s; }
.dash-link:hover { color: var(--primary-dark); }

/* ---- 教程预告时间轴 ---- */
.course-timeline { margin-top: 16px; margin-bottom: 12px; }
.timeline-title { font-size: 16px; font-weight: 700; }
.timeline-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.timeline-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.timeline-list { position: relative; padding-left: 18px; }
.timeline-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}
.timeline-item { position: relative; display: flex; gap: 12px; padding: 8px 0; transition: all .2s var(--ease); }
.timeline-item:hover { transform: translateX(4px); }
.timeline-item:first-child { padding-top: 0; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--surface);
  margin-top: 3px;
  z-index: 1;
  transition: all .2s;
}
.timeline-item--active .timeline-dot { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.timeline-item--upcoming .timeline-dot { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-bg); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.timeline-time { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; white-space: nowrap; }
.timeline-course-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-muted); margin: 0 0 6px; }
.timeline-revenue { color: var(--success); font-weight: 600; margin: 0 0 6px; }
.timeline-desc { font-size: 13px; color: var(--text-soft); margin: 0; }
/* 立即报名按钮：绿色描边小 pill（恢复之前的正确样式） */
.course-signup-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--success);
  color: var(--success);
  background: var(--success-bg);
  cursor: pointer;
  font-family: inherit;
  min-height: 28px;
  transition: all .2s var(--ease);
}
.course-signup-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
.course-signup-pill:hover { background: var(--success); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.course-signup-pill:hover .dot { background: #fff; }
.course-signup-pill:active { transform: scale(0.97); }
/* 未开始：橙色变体，保持与其他状态视觉一致 */
.course-signup-pill--upcoming { border-color: var(--warning); color: var(--warning); background: var(--warning-bg); }
.course-signup-pill--upcoming .dot { background: var(--warning); }
.course-signup-pill--upcoming:hover { background: var(--warning); color: #fff; }
.course-signup-pill--upcoming:hover .dot { background: #fff; }

/* ---- 教程预告独立页 ---- */
.course-card-list { display: flex; flex-direction: column; gap: 12px; }
.course-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all .2s var(--ease);
  /* 上下两行：head 行 + 标题/元数据/描述；状态与按钮在 head 行右侧并排 */
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.course-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.course-card--active { border-left: 3px solid var(--success); }
.course-card--upcoming { border-left: 3px solid var(--warning); }

/* 状态徽标（圆点 + 文字，无胶囊背景） */
.course-card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  border: none;
}
.course-card-status--active   { color: var(--success); }
.course-card-status--upcoming { color: var(--warning); }
.course-card-status--ended    { color: var(--text-muted); }
.course-card-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.course-card-status--active .status-dot   { background: var(--success); }
.course-card-status--upcoming .status-dot { background: var(--warning); }
.course-card-status--ended .status-dot    { background: var(--text-muted); }
.course-card-status .status-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

/* head 行右侧：状态徽标 + 报名按钮（如果存在），并排显示 */
.course-card-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 右侧内容 */
.course-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.course-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.course-card-date { font-size: 14px; font-weight: 600; color: var(--text-muted); line-height: 1.4; }
.course-card .course-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 1px; line-height: 1.45; }
.course-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.course-card-revenue { color: var(--success); font-weight: 600; }
.course-card-desc { font-size: 13px; color: var(--text-soft); margin: 0; line-height: 1.55; }

/* ---- 通知列表 ---- */
.notification-list { display: flex; flex-direction: column; gap: 12px; }
.notification-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.notification-item:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.notification-item--unread { border-left: 3px solid var(--primary); }
.notification-item--announcement { border-left: 3px solid #FF6B6B; background: linear-gradient(90deg, rgba(255,107,107,0.06), var(--surface)); }
[data-theme="dark"] .notification-item--announcement { border-left-color: #FF8E8E; background: linear-gradient(90deg, rgba(255,107,107,0.10), var(--surface)); }

.notification-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  position: relative;
}
.notification-card--clickable { cursor: pointer; }
.notification-card--clickable:active { background: var(--surface-2); }

.notification-card__icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-top: 2px;
}
.notification-item--announcement .notification-card__icon { background: var(--danger-bg); color: var(--danger); }
.notification-item--unread .notification-card__icon { box-shadow: 0 0 0 2px var(--primary); }

.notification-card__body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 36px;
}
.notification-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.notification-card__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
}
.notification-item--unread .notification-card__title { color: var(--text); }
.notification-card__message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.notification-card__time {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.notification-card__delete {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.notification-card__delete:hover { background: var(--danger-bg); color: var(--danger); }
.notification-card__delete:active { transform: scale(0.92); }

/* 删除动效 */
.notification-item.is-removing {
  transform: translateX(-110%);
  opacity: 0;
  transition: transform .35s var(--ease), opacity .25s var(--ease);
}
.notification-item.is-deleting {
  pointer-events: none;
  opacity: .6;
}

/* ---- 公告 ---- */
.announcement-form { margin-bottom: 16px; }
.announcement-list { display: flex; flex-direction: column; gap: 12px; }
.announcement-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.announcement-item h4 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.announcement-item .meta { font-size: 12px; color: var(--text-muted); }
.announcement-delete { display: inline; }
.announcement-delete .btn-sm { height: 32px; padding: 0 12px; }

/* ---- 关卡编辑 ---- */
.stage-list-wrap { margin-top: 16px; }
.stage-list { display: flex; flex-direction: column; gap: 12px; }
.stage-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.stage-num { font-weight: 700; color: var(--primary); font-size: 18px; }
.stage-field { display: flex; flex-direction: column; gap: 4px; }
.stage-field label { margin: 0; font-size: 12px; }
.stage-actions { display: flex; gap: 8px; align-items: center; }
.stage-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.stage-remove:hover { color: var(--danger); background: var(--danger-bg); }

/* ---- KPI 卡片 ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  align-items: stretch;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-sm);
  min-height: 120px;
  justify-content: center;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: none;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.kpi-body { min-width: 0; }
.kpi-num { font-size: 22px; font-weight: 700; line-height: 1; color: var(--text); }
.kpi-lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 6px; }
.kpi-blue .kpi-icon { background: linear-gradient(135deg, #3B82F6, #60A5FA); }
.kpi-purple .kpi-icon { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.kpi-orange .kpi-icon { background: linear-gradient(135deg, #F97316, #FB923C); }
.kpi-green .kpi-icon { background: linear-gradient(135deg, #10B981, #34D399); }
.kpi-teal .kpi-icon { background: linear-gradient(135deg, #14B8A6, #2DD4BF); }
.kpi-red .kpi-icon { background: linear-gradient(135deg, #EF4444, #F87171); }

/* KPI 奇数个时最后一张占满一行，避免孤行（仅手机 2 列） */
@media (max-width: 639px) {
  .kpi-grid > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---- Sheet Modal (底部弹起) ---- */
.sheet-modal { position: fixed; inset: 0; z-index: 300; display: none; }
.sheet-modal.open { display: flex; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); animation: fadeIn .2s; }
.sheet-panel {
  position: relative;
  margin-top: auto;
  width: 100%;
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 20px calc(20px + var(--safe-bottom));
  box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  animation: slideUp .35s var(--ease) both;
}
.sheet-handle { width: 40px; height: 4px; border-radius: var(--radius-full); background: var(--border-strong); margin: 8px auto 14px; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-title { font-size: 18px; font-weight: 700; margin: 0; }
.sheet-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: all .15s;
}
.sheet-close:hover { background: var(--primary-light); color: var(--primary); transform: rotate(90deg); }
.sheet-body { overflow-y: auto; color: var(--text-soft); line-height: 1.7; font-size: 14px; padding-right: 4px; max-height: 58vh; }
.sheet-body h4 { margin: 14px 0 6px; color: var(--text); }
.sheet-footer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---- 人员选择器 ---- */
.staff-picker { position: relative; }
.staff-picker__search { width: 100%; }
.staff-picker__options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
}
.staff-picker__options.show { display: block; }
.staff-picker__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.staff-picker__option:last-child { border-bottom: none; }
.staff-picker__option:hover, .staff-picker__option.active { background: var(--primary-light); color: var(--primary-dark); }
.staff-picker__option--empty { color: var(--text-muted); cursor: default; }
.staff-picker__option--empty:hover { background: transparent; }
.staff-picker__role { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.staff-picker__selected { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.staff-picker__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}
.staff-picker__tag button { background: transparent; border: none; color: var(--primary-dark); font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1; }
.staff-picker__single {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  min-height: 48px;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.staff-picker__single:hover { border-color: var(--border-strong); }
.staff-picker__single.empty { color: var(--text-muted); }

/* ---- 用户搜索 ---- */
.user-search { position: relative; }
.user-search__input { width: 100%; }
.user-search__results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow: auto;
  display: none;
}
.user-search__results:has(.user-search__item), .user-search__results:has(.user-search__empty) { display: block; }
.user-search__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background .15s;
}
.user-search__item:last-child { border-bottom: none; }
.user-search__item:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; }
.user-search__empty { padding: 12px; color: var(--text-muted); font-size: 13px; }
.user-search__selected { display: flex; flex-wrap: wrap; gap: 8px; }
.user-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.user-tag button { background: transparent; border: none; color: var(--primary-dark); cursor: pointer; font-size: 14px; }

/* ---- 拖拽 ---- */
[data-sortable] tr { cursor: grab; }
[data-sortable] tr.dragging { opacity: .5; background: var(--primary-light); }
[data-sortable] tr.drag-over { border-top: 2px solid var(--primary); }
.drag-handle { display: inline-block; margin-right: 4px; color: var(--text-muted); cursor: grab; user-select: none; }
.drag-handle:active { cursor: grabbing; }

/* ---- 分配工作台 ---- */
.assign-workbench__header { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.assign-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.assign-panel > h4 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.assign-template-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  max-height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  background: var(--surface);
}
.assign-template-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background .15s;
}
.assign-template-item:hover { background: var(--primary-light); }
.assign-workbench { }
.assign-template__check {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  display: grid;
  place-items: center;
  transition: all .15s;
  background: var(--surface);
}
.assign-template-item input { position: absolute; opacity: 0; }
.assign-template-item input:checked + .assign-template__check {
  background: var(--primary);
  border-color: var(--primary);
}
.assign-template-item input:checked + .assign-template__check::after {
  content: '';
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translateY(-1px);
}
.assign-template-item:has(input:checked) { background: var(--primary-light); }
.assign-template__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.assign-template__title { font-size: 14px; font-weight: 500; color: var(--text); }
.assign-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---- 分页 ---- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 14px;
  transition: all .15s;
}
.pagination a:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; border-color: var(--primary); }
.pagination .current { background: var(--primary-grad); color: #fff; border: none; box-shadow: var(--shadow-md); }

/* ---- 审核队列标签 ---- */
.review-tabs { display: flex; gap: 8px; }
.review-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  text-decoration: none;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.review-tab:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.review-tab.active { background: var(--primary-light); color: var(--primary-dark); }
.review-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ---- 主题切换 ---- */
.nav-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  margin-left: auto;
  transition: all .15s;
}
.nav-burger:hover { background: var(--bg); border-color: var(--border-strong); }
.nav-burger.active { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }

/* ---- 移动端菜单 ---- */
.mobile-menu {
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  z-index: 45;
  background: var(--surface);
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
}
.mobile-menu.open { display: flex; animation: fadeIn .2s; }
.mobile-menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  min-height: 52px;
  transition: all .15s;
}
.mobile-menu a:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; transform: translateX(4px); }

/* ---- 协议弹窗居中 ---- */
.sheet-modal--center { align-items: center; justify-content: center; padding: 16px; }
.sheet-modal--center .sheet-panel { margin: 0; width: min(92vw, 460px); max-height: 80vh; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.sheet-modal--center .sheet-handle { display: none; }
.sheet-modal--center .sheet-body { max-height: 54vh; }

/* ---- 视图杂项 / 补全遗漏类 ---- */
.hero { margin-bottom: 16px; }
.hero h1 { margin: 0 0 6px; }
.hero p { margin: 0; font-size: 14px; }

.danger { color: var(--danger); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span:last-child { color: var(--text); font-weight: 500; }

.page-header { margin-bottom: 16px; }
.page-header .breadcrumb { margin-top: 6px; }

.notification-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notification-head strong { font-size: 15px; font-weight: 600; }
.notification-head .row { flex-wrap: nowrap; }

.empty-row td { padding: 24px; text-align: center; }

.course-signup-btn { /* 与 course-signup-pill 等价 */ }

.hw-card-title-wrap { flex: 1; min-width: 0; }
.hw-card-status { flex: none; display: flex; align-items: center; gap: 8px; }
.hw-card-foot { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.rich { line-height: 1.8; color: var(--text-soft); overflow-x: hidden; margin-bottom: 0; }
.rich p { margin: 0 0 12px; }
.rich img { max-width: 100%; height: auto; border-radius: var(--radius-md); margin: 8px 0; display: block; }
.rich iframe, .rich video { max-width: 100%; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius-md); margin: 4px 0; display: block; }
.rich ul, .rich ol { padding-left: 20px; margin: 8px 0; }
.rich h1, .rich h2, .rich h3, .rich h4 { margin: 16px 0 8px; color: var(--text); }

/* ====== Quill 富文本编辑器适配 ====== */
#tutorialEditor { background: var(--surface); }
#tutorialEditor .ql-toolbar.ql-snow { border-color: var(--border) !important; border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--surface-2); }
#tutorialEditor .ql-container.ql-snow { border-color: var(--border) !important; border-radius: 0 0 var(--radius-md) var(--radius-md); font-size: 14px; color: var(--text); }
#tutorialEditor .ql-editor { min-height: 180px; padding: 12px 16px; line-height: 1.7; }
#tutorialEditor .ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; left: 16px; }
[data-theme="dark"] #tutorialEditor .ql-toolbar.ql-snow,
[data-theme="dark"] #tutorialEditor .ql-container.ql-snow { border-color: var(--border-strong) !important; }

/* 底部版权富文本编辑器 */
#footerCopyrightEditor { background: var(--surface); }
#footerCopyrightEditor .ql-toolbar.ql-snow { border-color: var(--border) !important; border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--surface-2); }
#footerCopyrightEditor .ql-container.ql-snow { border-color: var(--border) !important; border-radius: 0 0 var(--radius-md) var(--radius-md); font-size: 14px; color: var(--text); }
#footerCopyrightEditor .ql-editor { min-height: 120px; padding: 12px 16px; line-height: 1.7; }
#footerCopyrightEditor .ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; left: 16px; }
[data-theme="dark"] #footerCopyrightEditor .ql-toolbar.ql-snow,
[data-theme="dark"] #footerCopyrightEditor .ql-container.ql-snow { border-color: var(--border-strong) !important; }

/* 前台页脚版权富文本 */
.footer-copyright { line-height: 1.7; }
.footer-copyright p { margin: 0 0 4px; }
.footer-copyright a { color: var(--primary); text-decoration: none; }
.footer-copyright img { max-height: 22px; vertical-align: middle; margin: 0 4px; border-radius: 4px; }
.footer-copyright:empty { display: none; }

.row-select { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

.sort-order-num { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.dup-ip { background: rgba(239, 68, 68, 0.05); }
.dup-ip:hover { background: rgba(239, 68, 68, 0.08) !important; }
[data-theme="dark"] .dup-ip { background: rgba(239, 68, 68, 0.08); }

.modal-ok { background: var(--primary-grad); color: #fff; border: none; }
.modal-ok:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* 关卡要求卡片 */
.stage-progress-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.stage-hint-label { color: var(--text-soft); font-weight: 600; }
.stage-hint-value { color: var(--primary); font-weight: 700; }

.stage-requirement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.stage-requirement-card.current { /* border-left removed */ }
.stage-req-head { margin-bottom: 12px; }
.stage-req-num {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}
.stage-req-title { display: block; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.stage-req-desc { display: block; font-size: 13px; color: var(--text-soft); }
.stage-req-video { margin: 12px 0; }
.stage-media {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 0;
}
.stage-req-video video.stage-media { aspect-ratio: 16 / 9; background: #000; }
.stage-req-content { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.stage-req-content.empty { color: var(--text-muted); font-style: italic; border-top: none; padding-top: 0; }

.stage-locked-hint {
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: #B45309;
  text-align: center;
}
.stage-locked-hint p { margin: 0; }
[data-theme="dark"] .stage-locked-hint { background: rgba(245, 158, 11, 0.1); color: #FCD34D; }

/* ===== 闯关进度条 ===== */
.stage-progress-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.stage-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stage-progress-label { font-size: 13px; font-weight: 700; color: var(--text); }
.stage-progress-text { font-size: 12px; font-weight: 600; color: var(--primary); }
.stage-progress-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.stage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 999px;
  transition: width .4s var(--ease);
}

/* ===== 大气上传卡片 ===== */
.hidden { display: none !important; }
.upload-card {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .25s var(--ease);
  margin-bottom: 16px;
}
.upload-card:hover,
.upload-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.12);
}
.upload-card.has-file {
  border-style: solid;
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.04);
}
.upload-icon {
  font-size: 44px;
  margin-bottom: 10px;
  filter: grayscale(0.3);
  transition: transform .25s var(--ease);
}
.upload-card:hover .upload-icon { transform: scale(1.15) translateY(-4px); }
.upload-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.upload-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 6px;
}
.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}
.upload-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}
.upload-preview.hidden { display: none; }
.upload-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg, #f5f7fa);
  border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb);
}
.upload-file-item__thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.upload-file-item__icon { font-size: 20px; flex-shrink: 0; }
.upload-file-item__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}
.upload-file-item__rm {
  flex-shrink: 0;
  padding: 2px 6px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
}

/* 提交表单底部安全间距 */
.submit-form { padding-bottom: 8px; }

/* ===== 页面操作栏（返回 + 状态，无卡片容器） ===== */
.page-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
  margin-bottom: 14px;
}
.action-back {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  transition: color .2s ease;
}
.action-back:hover { color: var(--primary); }

/* ===== 提交历史缩略卡片 ===== */
.history-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: all .2s var(--ease);
  cursor: pointer;
}
.history-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.history-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-card__stage {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.history-card__body {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.history-card__file {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
}
.history-card__arrow {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform .25s ease;
}
/* 展开详情 */
.history-card__detail {
  display: none;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}
.history-card.is-expanded .history-card__detail { display: block; }
.history-card.is-expanded .history-card__arrow { transform: rotate(90deg); }
.history-card__detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 0;
  font-size: 13px;
}
.history-card__detail-label {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.history-card__detail-row > span:last-child {
  text-align: right;
  word-break: break-all;
  color: var(--text);
}
.history-card__detail-comment {
  color: var(--text-soft);
}
.history-card__detail-row--link > span:last-child {
  flex: 1;
  text-align: right;
}

/* ---- 图表区域样式 ---- */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  margin-bottom: 20px;
  max-width: 100%;
  box-sizing: border-box;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.chart-card h4 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.chart-wrap {
  position: relative;
  height: 280px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.chart-wrap canvas {
  display: block;
  max-width: 100%;
  height: 100%;
}
/* 扇形图卡片高度略小（饼图不需要太高） */
.chart-row > .chart-card:first-child .chart-wrap {
  height: 240px;
}
.stats-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 20px;
}
.stats-details summary {
  padding: 14px 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
  transition: background .15s;
}
.stats-details summary:hover { background: var(--hover); }
.stats-details[open] summary {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* 富文本编辑器容器（兼容 stage_edit 内联样式） */
.stage-toolbar {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface);
}
.stage-editor-box {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
}
.stage-editor-box .w-e-text-container { min-height: 320px; }
.stage-editor-box .w-e-text-container [data-slate-editor] { padding: 14px; }
.stage-content-hidden { display: none; }

/* 通知表单用户搜索（兼容 notification_form 内联样式） */
.user-results {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
  background: var(--surface);
}
.user-result-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 14px; transition: background .15s; }
.user-result-item:last-child { border-bottom: none; }
.user-result-item:hover { background: var(--surface-2); }
.selected-users { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---- 动画 ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ============================================================
   响应式：手机优先，向上适配平板 / 桌面
   ============================================================ */
@media (min-width: 640px) {
  .container { max-width: 640px; padding: 0 20px; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .profile-stats { grid-template-columns: repeat(3, 1fr); }
  .stage-row { grid-template-columns: 40px 1fr 1fr auto; align-items: flex-end; }
  .stage-num { padding-bottom: 10px; }
  .assign-grid { grid-template-columns: 320px 1fr; }
}

/* ============================================================
   管理后台移动端强化适配（< 860px）
   ============================================================ */
@media (max-width: 859px) {
  /* 侧边栏已全屏滑出，保持原逻辑 */
  .admin-main { padding: 12px; min-height: 100dvh; }

  /* 底部固定 Tab 栏避让：main.container 的 padding-bottom 被 .container 简写覆盖为 0，这里用更高特异性恢复，确保最后内容（含教程预告）不被遮挡 */
  main.container { padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px); }
  /* footer 在 main 外部，需独立避让固定底栏（覆盖内联 padding） */
  footer.container { padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px) !important; }
  .admin-topbar {
    padding: 10px 12px;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
  }
  .admin-topbar .page-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .admin-topbar .row { gap: 8px; flex-wrap: nowrap; min-width: 0; }
  .admin-topbar .bell { flex: none; }
  .admin-topbar .pill { display: none; }

  /* 表单：双列变单列，避免溢出 */
  .split { flex-direction: column; gap: 0; }
  .split > * { width: 100%; min-width: 0; }
  .field { margin-bottom: 14px; }
  .field:last-child { margin-bottom: 0; }
  .field label { font-size: 13px; margin-bottom: 5px; }
  input, select, textarea { font-size: 16px; } /* 防 iOS 缩放 */
  textarea { min-height: 100px; }

  /* 复选框组竖排，避免拥挤 */
  .checks { flex-direction: column; gap: 6px; align-items: flex-start; }
  .checks .checkbox { min-height: 36px; }

  /* 按钮组：自动换行但优先占满 */
  .card .row { gap: 8px; }
  .card .row .btn { flex: 1 1 auto; min-width: 80px; }
  .card .row .btn-sm { flex: 0 0 auto; }

  /* 卡片内边距收紧 */
  .card { padding: 14px; border-radius: 14px; }
  .card h3 { font-size: 15px; margin-bottom: 12px; }

  /* 分页 */
  .pagination { gap: 4px; }
  .pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 8px; font-size: 13px; }

  /* 表格：卡片化响应式 */
  .table-wrap { overflow-x: visible; border-radius: 0; border: none; background: transparent; }
  .table-wrap .table { min-width: 0; }
  .table.responsive,
  .table.responsive thead,
  .table.responsive tbody,
  .table.responsive th,
  .table.responsive td,
  .table.responsive tr { display: block; }
  .table.responsive thead { position: absolute; left: -9999px; }
  .table.responsive tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }
  .table.responsive tbody tr.empty-row { padding: 24px; text-align: center; }
  .table.responsive td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
    font-size: 14px;
  }
  .table.responsive td:last-child { border-bottom: none; }
  .table.responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-soft);
    font-size: 12px;
    text-align: left;
    flex: none;
  }
  .table.responsive td.nowrap { white-space: normal; }
  .table.responsive .btn { margin: 2px 0; }
  .table.responsive form { display: inline; }

  /* 筛选表单竖排 */
  .card.mb.row { flex-direction: column; align-items: stretch !important; gap: 10px; }
  .card.mb.row .field { width: 100%; margin: 0; }
  .card.mb.row .field label { margin-bottom: 4px; }
  .card.mb.row .btn { width: 100%; }
  /* 卡片内操作行（如批量通过/驳回） */
  .card.mb .row { flex-direction: column; align-items: stretch; gap: 8px; }
  .card.mb .row .btn { width: 100%; margin: 0; }
  .card.mb .row input[type="text"] { width: 100% !important; }

  /* 人员选择器全宽 */
  .staff-picker { width: 100%; }
  .staff-picker__options { position: static; box-shadow: none; border: 1px solid var(--border); margin-top: 4px; }
  .staff-picker__selected { flex-wrap: wrap; }

  /* 作业分配工作台 */
  .assign-grid { grid-template-columns: 1fr; gap: 14px; }
  .assign-panel { padding: 12px; }
  .assign-actions {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .assign-actions .btn { width: 100%; }

  /* 关卡编辑 */
  .stage-editor-box { min-height: 240px; }
  .stage-editor-box .w-e-text-container { min-height: 240px; }
  .stage-toolbar { overflow-x: auto; }

  /* 用户管理/模板管理等操作按钮 */
  .page-header .row { flex-direction: column; align-items: stretch; }
  .page-header .btn { width: 100%; }

  /* 富文本编辑器在手机上收缩 */
  .w-e-toolbar { flex-wrap: wrap; }

  /* ---- 数据概览页移动端优化 ---- */
  /* KPI 卡片：更紧凑，横向排列省空间 */
  .kpi-grid { gap: 10px; margin-bottom: 14px; }
  .kpi-card {
    padding: 12px 14px;
    min-height: auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    text-align: left;
  }
  .kpi-icon { width: 40px; height: 40px; font-size: 20px; flex-shrink: 0; }
  .kpi-body { min-width: 0; }
  .kpi-num { font-size: 20px; }
  .kpi-lbl { font-size: 11px; margin-top: 2px; }

  /* 统计页两栏卡片：全宽堆叠 + 内表格优化 */
  .grid-2 > .card { overflow: hidden; }
  .grid-2 .card h3 { font-size: 14px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .grid-2 .table-wrap { max-height: none; }
  .grid-2 .table.responsive tbody tr { padding: 10px 8px; margin-bottom: 6px; border-radius: 10px; }
  .grid-2 .table.responsive td { padding: 5px 0; font-size: 13px; gap: 8px; }
  .grid-2 .table.responsive td::before { font-size: 11px; }

  /* 进度条在响应式表格内自适应 */
  .table.responsive td .progress { width: 100%; min-width: 0; height: 6px; }

  /* 统计页操作栏 */
  .row.between.mb { flex-wrap: wrap; gap: 8px; }
  .row.between.mb h3 { font-size: 15px; }
  .row.between.mb .btn { font-size: 13px; padding: 6px 12px; }

  /* 图表区域：手机端垂直堆叠 */
  .chart-row { grid-template-columns: 1fr; gap: 12px; }
  .chart-card { padding: 14px; }
  .chart-card h4 { font-size: 14px; margin-bottom: 10px; }
  .chart-wrap { height: 220px; }
  .chart-row > .chart-card:first-child .chart-wrap { height: 200px; }
}

@media (min-width: 860px) {
  .container { max-width: 720px; }
  .hide-mobile { display: inherit !important; }
  .hide-desktop { display: none !important; }
  .nav-links { display: flex; }
  .nav-burger { display: none; }
  .mobile-menu.open { display: none; }
  .bottom-nav { display: none; }
  main { padding-bottom: 24px; }

  .admin-layout { display: grid; grid-template-columns: 64px 1fr; }
  .sidebar {
    position: sticky;
    transform: none;
    width: auto;
    border-right: 1px solid var(--border);
    padding: 16px 8px;
    align-items: center;
    overflow-x: hidden;
  }
  /* 收缩态：只显示图标，隐藏文字 */
  .sidebar:not(.is-expanded) .brand span:last-child,
  .sidebar:not(.is-expanded) .side-group,
  .sidebar:not(.is-expanded) a span { display: none; }
  .sidebar:not(.is-expanded) .brand { padding: 0; justify-content: center; margin-bottom: 16px; }
  .sidebar:not(.is-expanded) a { justify-content: center; padding: 12px; border-radius: var(--radius-md); min-width: 48px; }
  .sidebar:not(.is-expanded) a:hover { transform: none; }
  .sidebar:not(.is-expanded) a.active::before { left: 4px; right: 4px; bottom: auto; top: auto; width: auto; height: 3px; border-radius: 3px; }
  /* 展开态 */
  .sidebar.is-expanded { padding: 20px 16px; align-items: stretch; overflow-x: visible; }
  .sidebar.is-expanded .brand span:last-child,
  .sidebar.is-expanded .side-group,
  .sidebar.is-expanded a span { display: inline; }
  .sidebar.is-expanded .brand { padding: 0 8px; justify-content: flex-start; margin-bottom: 20px; }
  .sidebar.is-expanded a { justify-content: flex-start; gap: 12px; padding: 12px; }
  .sidebar.is-expanded a.active::before { left: 0; top: 10px; bottom: 10px; width: 3px; height: auto; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
  /* 展开时切换网格宽度 */
  .admin-layout:has(.sidebar.is-expanded) { grid-template-columns: 260px 1fr; }
  /* 桌面端保留汉堡按钮用于收缩/展开切换 */
  .side-toggle { display: inline-flex; }
  .overlay.show { display: none; }
  .admin-main { padding: 24px; }
  .admin-topbar { margin-bottom: 24px; padding: 16px 20px; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .kpi-card { flex-direction: row; text-align: left; justify-content: flex-start; align-items: center; }

  /* 统计页底部两栏：桌面端并排卡片（强制覆盖） */
  .admin-main > .grid.grid-2,
  .admin-main .grid.grid-2 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
  }
  .admin-main .grid.grid-2 > .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
  }
  .admin-main .grid.grid-2 .card h3 { font-size: 15px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); color: var(--text); }
  .admin-main .grid.grid-2 .table-wrap { max-height: 360px; overflow-y: auto; }
  .table-wrap .table { min-width: auto; }
}

@media (min-width: 1024px) {
  .container { max-width: 860px; }
  .admin-layout:has(.sidebar.is-expanded) { grid-template-columns: 280px 1fr; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- 小屏手机精细调整 ---- */
@media (max-width: 360px) {
  .container { padding: 0 12px; }
  .card { padding: 14px; border-radius: 14px; }
  .kpi-card { padding: 14px; min-height: 110px; }
  .kpi-icon { width: 40px; height: 40px; font-size: 20px; }
  .kpi-num { font-size: 20px; }
  .profile-id { font-size: 30px; }
  .bottom-nav a { font-size: 15px; min-height: 48px; }
  .bottom-nav .nav-label { padding: 12px 16px; font-size: 14px; }
  .btn { padding: 0 16px; }
}

/* ============================================================
   整站风格 / 配色方案（后台统一设置，data-skin 注入 <html>）
   亮色皮肤只覆盖品牌色族；暗色皮肤额外依赖 [data-theme="dark"] 提供的深色表面令牌。
   本段置于文件末尾，确保对同特异度的 [data-theme="dark"] 令牌具有更高优先级。
   ============================================================ */
[data-skin="coral"]   { --primary:#FF6B6B; --primary-dark:#EE5253; --primary-light:#FFE8E8; --primary-soft:#FFE8E8; --primary-grad:linear-gradient(135deg,#FF6B6B 0%,#FF8E8E 100%); --primary-rgb:255,107,107; }
[data-skin="ocean"]   { --primary:#3B82F6; --primary-dark:#2563EB; --primary-light:#DBEAFE; --primary-soft:#DBEAFE; --primary-grad:linear-gradient(135deg,#3B82F6 0%,#60A5FA 100%); --primary-rgb:59,130,246; }
[data-skin="forest"]  { --primary:#10B981; --primary-dark:#059669; --primary-light:#D1FAE5; --primary-soft:#D1FAE5; --primary-grad:linear-gradient(135deg,#10B981 0%,#34D399 100%); --primary-rgb:16,185,129; }
[data-skin="royal"]   { --primary:#8B5CF6; --primary-dark:#7C3AED; --primary-light:#EDE9FE; --primary-soft:#EDE9FE; --primary-grad:linear-gradient(135deg,#8B5CF6 0%,#A78BFA 100%); --primary-rgb:139,92,246; }
[data-skin="sunset"]  { --primary:#F97316; --primary-dark:#EA580C; --primary-light:#FFEDD5; --primary-soft:#FFEDD5; --primary-grad:linear-gradient(135deg,#F97316 0%,#FB923C 100%); --primary-rgb:249,115,22; }
[data-skin="teal"]    { --primary:#06B6D4; --primary-dark:#0891B2; --primary-light:#CFFAFE; --primary-soft:#CFFAFE; --primary-grad:linear-gradient(135deg,#06B6D4 0%,#22D3EE 100%); --primary-rgb:6,182,212; }
[data-skin="rose"]    { --primary:#EC4899; --primary-dark:#DB2777; --primary-light:#FCE7F3; --primary-soft:#FCE7F3; --primary-grad:linear-gradient(135deg,#EC4899 0%,#F472B6 100%); --primary-rgb:236,72,153; }

/* 暗色皮肤：覆盖品牌色族（深色表面由同时输出的 data-theme="dark" 提供） */
[data-skin="midnight"] { --primary:#60A5FA; --primary-dark:#3B82F6; --primary-light:rgba(96,165,250,.15); --primary-soft:rgba(96,165,250,.15); --primary-grad:linear-gradient(135deg,#60A5FA 0%,#93C5FD 100%); --primary-rgb:96,165,250; }
[data-skin="noir"]     { --primary:#F59E0B; --primary-dark:#D97706; --primary-light:rgba(245,158,11,.15); --primary-soft:rgba(245,158,11,.15); --primary-grad:linear-gradient(135deg,#F59E0B 0%,#FBBF24 100%); --primary-rgb:245,158,11; }
[data-skin="aurora"]   { --primary:#A78BFA; --primary-dark:#8B5CF6; --primary-light:rgba(167,139,250,.15); --primary-soft:rgba(167,139,250,.15); --primary-grad:linear-gradient(135deg,#A78BFA 0%,#C4B5FD 100%); --primary-rgb:167,139,250; }

/* ============================================================
   后台「整站风格」选择器
   ============================================================ */
.skin-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; margin-top:4px; }
.skin-card {
  cursor:pointer; position:relative;
  border:2px solid var(--border); border-radius:var(--radius-lg);
  overflow:hidden; background:var(--surface);
  transition:all .15s var(--ease); display:block;
}
.skin-card:hover { border-color:var(--primary); transform:translateY(-2px); box-shadow:var(--shadow-md); }
.skin-card.active { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.skin-swatch { display:flex; align-items:center; justify-content:space-between; padding:14px 14px; height:62px; }
.skin-dot { width:18px; height:18px; border-radius:50%; box-shadow:0 0 0 3px rgba(255,255,255,.55); }
.skin-btn { font-size:12px; font-weight:600; padding:4px 10px; border-radius:999px; }
.skin-meta { display:flex; flex-direction:column; gap:2px; padding:10px 12px 12px; }
.skin-name { font-weight:600; color:var(--text); display:flex; align-items:center; gap:6px; }
.skin-tag { font-size:11px; font-weight:600; color:#fff; background:rgba(0,0,0,.45); padding:1px 6px; border-radius:999px; }
.skin-desc { font-size:12px; color:var(--text-soft); line-height:1.4; }

/* ============================================================
   动态效果：主按钮 / 进度条 / 分页 多种动画
   控制开关：<html data-anim="...">（后台「整站风格 → 动态效果」）
   可选值：none | cloud | aurora | particles | wave | neon
   兼容旧值：<html data-anim="1"> 等效于 cloud
   无障碍：仅当用户未开启系统「减弱动态效果」时生效。
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  /* 通用选择器，避免重复列举 */
  [data-anim="cloud"] .btn-primary,
  [data-anim="cloud"] .modal-ok,
  [data-anim="cloud"] .pagination .current,
  [data-anim="cloud"] .progress > span,
  [data-anim="cloud"] .progress-bar,
  [data-anim="1"] .btn-primary,
  [data-anim="1"] .modal-ok,
  [data-anim="1"] .pagination .current,
  [data-anim="1"] .progress > span,
  [data-anim="1"] .progress-bar {
    background-size: 300% 300%;
    animation: gradShift 6s ease infinite;
  }

  /* ---------- aurora：极光色流动 ---------- */
  [data-anim="aurora"] .btn-primary,
  [data-anim="aurora"] .modal-ok,
  [data-anim="aurora"] .pagination .current,
  [data-anim="aurora"] .progress > span,
  [data-anim="aurora"] .progress-bar {
    background: linear-gradient(90deg, #a78bfa, #22d3ee, #f472b6, #a78bfa);
    background-size: 300% 300%;
    animation: auroraShift 5s ease infinite;
  }

  /* ---------- particles：微光粒子扫过 ---------- */
  [data-anim="particles"] .btn-primary,
  [data-anim="particles"] .modal-ok,
  [data-anim="particles"] .pagination .current,
  [data-anim="particles"] .progress > span,
  [data-anim="particles"] .progress-bar {
    position: relative;
    overflow: hidden;
    background-size: 300% 300%;
    animation: gradShift 6s ease infinite;
  }
  [data-anim="particles"] .btn-primary::after,
  [data-anim="particles"] .modal-ok::after,
  [data-anim="particles"] .pagination .current::after,
  [data-anim="particles"] .progress > span::after,
  [data-anim="particles"] .progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.55) 50%, transparent 75%);
    transform: translateX(-100%);
    animation: particleSweep 1.8s ease-in-out infinite;
    pointer-events: none;
  }

  /* ---------- wave：呼吸缩放（增强，幅度更大） ---------- */
  [data-anim="wave"] .btn-primary,
  [data-anim="wave"] .modal-ok,
  [data-anim="wave"] .pagination .current,
  [data-anim="wave"] .progress > span,
  [data-anim="wave"] .progress-bar {
    animation: waveBreatheBtn 2.4s ease-in-out infinite;
  }

  /* ---------- neon：霓虹光晕（增强，光晕更强） ---------- */
  [data-anim="neon"] .btn-primary,
  [data-anim="neon"] .modal-ok,
  [data-anim="neon"] .pagination .current,
  [data-anim="neon"] .progress > span,
  [data-anim="neon"] .progress-bar {
    animation: neonPulseBtn 2s ease-in-out infinite alternate;
    box-shadow: 0 0 0 rgba(255,255,255,0);
  }
}

/* 全局关键帧 */
@keyframes gradShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes auroraShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes particleSweep {
  0%   { transform: translateX(-100%); }
  55%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
@keyframes waveBreatheBtn {
  0%,100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.06); filter: brightness(1.12); }
}
@keyframes neonPulseBtn {
  0%   { filter: brightness(1); box-shadow: 0 0 0 rgba(255,255,255,0); }
  100% { filter: brightness(1.3); box-shadow: 0 0 28px rgba(255,255,255,.55); }
}

