/* ══════════════════════════════════════════════════════════════
   丰实少年积分系统 - 全局样式表 v2
   设计语言：蓝靛渐变 + 冷灰中性色（参考现代管理后台范式）
   PC：左侧侧边栏布局；移动端：顶部品牌栏 + 底部标签栏
   ══════════════════════════════════════════════════════════════ */

:root {
  --primary: #2563eb;
  --primary-deep: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-50: #eff6ff;
  --indigo: #4f46e5;
  --grad: linear-gradient(135deg, #2563eb, #4f46e5);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #0f172a;
  --text-light: #475569;
  --muted: #94a3b8;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-light: #eef2f7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.12);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── 基础重置 ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, system-ui, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--primary-50); }
a { text-decoration: none; color: inherit; }

/* ══════════════════════════ 布局 ══════════════════════════ */
.layout { display: flex; min-height: 100vh; }

/* ── 侧边栏 ── */
.sidebar {
  width: 220px; position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
  background: #fff; border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 800; font-size: 16px; color: var(--text); }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.14); padding: 2px; }
.side-group { font-size: 11px; color: var(--muted); letter-spacing: .08em; padding: 14px 12px 6px; }
.side-menu { display: flex; flex-direction: column; gap: 2px; }
.side-menu a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; color: var(--text-light); transition: background .15s, color .15s;
}
.side-menu a .ic { font-size: 15px; width: 20px; text-align: center; }
.side-menu a:hover { background: var(--primary-50); color: var(--primary-deep); }
.side-menu a.on { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .35); }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px;
  border-radius: 12px; background: #f8fafc; border: 1px solid var(--border-light);
}
.side-user .su-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.su-meta { min-width: 0; }
.su-meta b { color: var(--text); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-meta span { font-size: 11px; color: var(--muted); }
.su-out { font-size: 15px; color: var(--muted); padding: 6px 8px; border-radius: 8px; }
.su-out:hover { background: #fee2e2; color: var(--danger); }

/* ── 主内容区 ── */
.main { flex: 1; margin-left: 220px; width: calc(100% - 220px); min-width: 0; }

/* ══════════════════════════ 移动端双行导航（仅手机显示） ─────── */
.nav { display: none; }
.nav-swipe-tip { display: none; }

/* ══════════════════════════ 容器与卡片 ───────────────────── */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 28px 40px; }
.card {
  background: var(--card-bg); border-radius: var(--radius); padding: 24px 26px;
  margin-bottom: 20px; border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  animation: fadeUp .28s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card h2 {
  font-size: 17px; margin-bottom: 18px; color: var(--primary-deep); font-weight: 700;
  display: flex; align-items: center; position: relative; padding-left: 13px;
}
.card h2::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 18px; border-radius: 2px; background: var(--grad);
}

/* ── 折叠区 ── */
.section-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; -webkit-user-select: none; }
.section-head h2, .section-head h3 { margin: 0 !important; }
.section-head h3 { font-size: 15px; color: var(--text); position: relative; padding-left: 12px; display: flex; align-items: center; }
.section-head h3::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 15px; border-radius: 2px; background: #93c5fd; }
.section-head .arrow { font-size: 13px; color: var(--muted); transition: transform .25s; line-height: 1; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: #f1f5f9; }
.section-head:hover .arrow { background: var(--primary-50); color: var(--primary); }
.section-head.collapsed .arrow { transform: rotate(-90deg); }
.section-body { margin-top: 16px; }

/* ── 提示消息 ── */
.flash { padding: 12px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; border-left: 4px solid transparent; box-shadow: var(--shadow-card); animation: fadeUp .25s ease both; }
.flash.success { background: #ecfdf5; color: #065f46; border-left-color: var(--success); }
.flash.danger  { background: #fef2f2; color: #991b1b; border-left-color: var(--danger); }
.flash.warning { background: #fffbeb; color: #92400e; border-left-color: var(--warning); }
.flash.info    { background: #e0f2fe; color: #075985; border-left-color: #0284c7; }

/* ── 学段提示条 ── */
.semester-tip { margin: 12px 0; padding: 9px 14px; background: var(--primary-50); border: 1px solid #bfdbfe; border-left: 4px solid var(--primary); border-radius: var(--radius-sm); font-size: 13px; color: var(--primary-deep); }

/* ── 内嵌面板 ── */
.panel { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 20px; margin-bottom: 20px; }
.panel h3 { font-size: 15px; margin: 0 0 12px; color: var(--text); position: relative; padding-left: 12px; }
.panel h3::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 15px; border-radius: 2px; background: #93c5fd; }

/* ── 分割线 ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.table-wrap.scroll-y { max-height: 62vh; overflow-y: auto; border: 1px solid var(--border-light); }
.table-wrap.scroll-y thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border-light); font-size: 14px; }
th { background: #f8fafc; color: #475569; font-weight: 600; white-space: nowrap; font-size: 13px; letter-spacing: .02em; }
th a.sort-link { color: #475569; text-decoration: none; }
th a.sort-link:hover { color: var(--primary); }
tbody tr { transition: background .12s; }
tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:hover, tbody tr:nth-child(even):hover { background: var(--primary-50); }
tbody tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: 34px 0; font-size: 14px; }
.empty::before { content: "🗂️"; display: block; font-size: 30px; margin-bottom: 8px; opacity: .55; }

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 18px; height: 40px;
  border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 14px; line-height: 1;
  font-weight: 600; text-decoration: none; vertical-align: middle; white-space: nowrap; font-family: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: transform .12s, box-shadow .15s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); filter: brightness(1.05); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .35); }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(37, 99, 235, .42); }
.btn-success { background: linear-gradient(180deg, #34d399, var(--success)); color: #fff; }
.btn-warning { background: linear-gradient(180deg, #fbbf24, var(--warning)); color: #fff; }
.btn-danger  { background: linear-gradient(180deg, #f87171, var(--danger)); color: #fff; }
.btn-ghost { background: #f1f5f9; color: #334155; box-shadow: inset 0 0 0 1px var(--border); }
.btn-ghost:hover { background: #e2e8f0; filter: none; }
.btn-sm { padding: 0 13px; height: 32px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── 录入页操作按钮：全选单独一行，提交/清空并列等大、加大间距防误触 ── */
.entry-selall { margin-bottom: 10px; font-weight: 600; font-size: 14px; }
.entry-actions { display: flex; gap: 16px; margin-bottom: 12px; }
.entry-actions .btn { flex: 1; }

/* ── 表单 ── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--text-light); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: #fff; color: var(--text); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:hover, .form-group select:hover, .form-group textarea:hover { border-color: #9fb4d8; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); outline: none; box-shadow: var(--ring); }
.form-group input::placeholder { color: #b6bec9; }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; vertical-align: -2px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 200px; }
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range input { flex: 1; min-width: 0; }
.date-range span { color: var(--text-light); flex-shrink: 0; }

/* ── 统计卡片（顶部色条） ── */
.stat-cards { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.stat-card {
  flex: 1; min-width: 160px; background: #fff; border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 20px; text-align: center; position: relative; overflow: hidden;
  box-shadow: var(--shadow-card); transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--accent, var(--primary)); }
.stat-card:nth-child(1) { --accent: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card:nth-child(2) { --accent: linear-gradient(90deg, #94a3b8, #cbd5e1); }
.stat-card:nth-child(3) { --accent: linear-gradient(90deg, #34d399, #6ee7b7); }
.stat-card:nth-child(4) { --accent: linear-gradient(90deg, #fbbf24, #fcd34d); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-bottom: 10px; }
.stat-card .value { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.value.green { color: var(--success); } .value.red { color: var(--danger); }
.value.blue { color: var(--primary); } .value.gray { color: var(--text-light); }

/* ── 排名与分数颜色 ── */
.rank-1 { color: #f59e0b; font-weight: bold; }
.rank-2 { color: #3b82f6; font-weight: bold; }
.rank-3 { color: #3b82f6; font-weight: bold; }
.score-pos { color: var(--success); font-weight: bold; font-variant-numeric: tabular-nums; }
.score-neg { color: var(--danger); font-weight: bold; font-variant-numeric: tabular-nums; }
.score-zero { color: var(--text-light); font-variant-numeric: tabular-nums; }

/* ── 徽章 ── */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-teacher { background: var(--primary-50); color: #1d4ed8; }
.badge-student { background: #d1fae5; color: #047857; }

/* ── 工具栏 ── */
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .form-group { margin: 0; }
a.link-btn { color: var(--primary); text-decoration: none; font-weight: 500; }
a.link-btn:hover { text-decoration: underline; }

/* ── 导出报表网格 ── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.report-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: #fbfcfe; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s, transform .15s; }
.report-item:hover { border-color: #bfdbfe; box-shadow: var(--shadow-card); transform: translateY(-2px); }
.report-item h3 { font-size: 15px; margin-bottom: 12px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.report-item .desc { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.6; }
.report-item form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.report-item form .form-group { margin: 0; }

/* ── 登录页 ── */
.login-box { max-width: 380px; margin: 60px auto; }
.login-box h1 { text-align: center; margin-bottom: 24px; color: var(--primary-deep); font-size: 20px; }
.login-logo { width: 96px; height: 96px; display: block; margin: 0 auto 14px; border-radius: 20px; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18); object-fit: contain; }

/* ── 查询分享卡片 ── */
.share-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.share-card:hover { border-color: #bfdbfe; box-shadow: var(--shadow-card); }

/* ── 微信提示（仅移动端） ── */
.wechat-tip { display: none; margin-bottom: 16px; padding: 10px 14px; background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid var(--warning); border-radius: var(--radius-sm); font-size: 13px; color: #92400e; line-height: 1.6; }

/* ── 导入标签页 ── */
.import-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: #eef1f7; padding: 4px; border-radius: 12px; max-width: 460px; }
.import-tab { flex: 1; border: none; background: transparent; padding: 10px 8px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-light); cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; -webkit-tap-highlight-color: transparent; }
.import-tab.active { background: #fff; color: var(--primary-deep); box-shadow: var(--shadow-card); }
.tab-badge { font-size: 11px; font-weight: 600; background: var(--warning); color: #fff; border-radius: 999px; padding: 1px 7px; }
.import-pane { display: none; }
.import-pane.active { display: block; animation: fadeUp .22s ease both; }

/* ── 粘贴导入 ── */
#pasteArea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; line-height: 1.7; resize: vertical; background: #fff; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
#pasteArea:focus { border-color: var(--primary); outline: none; box-shadow: var(--ring); }
#pasteArea::placeholder { color: #9fb0c7; line-height: 1.8; }
.paste-preview { margin: 4px 0 14px; padding: 12px 14px; background: #fff; border: 1px dashed #93c5fd; border-radius: var(--radius-sm); }
.paste-preview-head { font-size: 14px; margin-bottom: 8px; }
.paste-preview-head b { color: var(--primary); font-size: 16px; }
.paste-dup { color: var(--warning); font-size: 13px; margin-left: 6px; }
.paste-names { display: flex; flex-wrap: wrap; gap: 6px; max-height: 140px; overflow-y: auto; }
.paste-name { background: var(--primary-50); color: var(--primary-deep); border: 1px solid #bfdbfe; border-radius: 999px; padding: 3px 10px; font-size: 13px; white-space: nowrap; }

/* ── 文件查找引导 ── */
.file-guide { margin-top: 12px; padding: 12px 16px; position: relative; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: var(--radius-sm); font-size: 13px; color: #075985; line-height: 1.9; }
.file-guide::before { content: ""; position: absolute; top: -7px; left: 24px; width: 12px; height: 12px; transform: rotate(45deg); background: #f0f9ff; border-left: 1px solid #bae6fd; border-top: 1px solid #bae6fd; }

/* ── 模板下载 ── */
.template-download { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.template-download h3 { font-size: 14px; font-weight: 600; color: var(--text-light); margin-bottom: 10px; }
.template-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.template-hint { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.7; }

/* ── 预警中心 ── */
.alert-loading { text-align: center; color: var(--muted); padding: 20px 0; }
.alert-empty { text-align: center; color: #059669; padding: 28px 0; font-size: 14px; }
.alert-table { border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; }
.alert-row { display: grid; grid-template-columns: 70px 130px 70px 1fr 80px 100px; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--border-light); background: #fff; }
.alert-row:last-child { border-bottom: none; }
.alert-row.red { border-left: 3px solid #ef4444; }
.alert-row.yellow { border-left: 3px solid #f59e0b; }
.alert-row.blue { border-left: 3px solid #3b82f6; }
.alert-head { background: #f8fafc; color: #475569; font-weight: 600; font-size: 12px; border-left: none; }
.g-name { font-weight: 600; }
.g-cls { display: none; font-style: normal; font-weight: 400; color: var(--muted); font-size: 11px; }
.g-class { color: var(--text-light); font-size: 13px; }
.g-reason { color: var(--text-light); font-size: 13px; }
.g-date { color: var(--muted); font-size: 12px; }
.alert-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.alert-badge.red { background: #fee2e2; color: #dc2626; }
.alert-badge.yellow { background: #fef3c7; color: #d97706; }
.alert-badge.blue { background: #dbeafe; color: #2563eb; }

/* 预警详情弹窗 */
.alert-modal { display: none; position: fixed; inset: 0; z-index: 200; }
.alert-modal.show { display: block; }
.alert-modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.alert-modal-body { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow-md); padding: 18px 20px; }
.am-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.am-close { cursor: pointer; font-size: 20px; color: var(--muted); line-height: 1; }
.am-student { font-size: 14px; color: var(--text-light); margin-bottom: 8px; }
.am-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.am-item:last-child { border-bottom: none; }
.am-name { flex: 1; }
.am-count { color: #dc2626; font-weight: 600; white-space: nowrap; }
.am-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.am-empty { text-align: center; color: var(--muted); padding: 20px 0; font-size: 13px; }

/* ── 加载状态 ── */
.loading-overlay { position: fixed; inset: 0; background: rgba(255, 255, 255, 0.7); display: none; align-items: center; justify-content: center; z-index: 9999; }
.loading-overlay.show { display: flex; }
.loading-spinner { width: 40px; height: 40px; border: 4px solid var(--primary-50); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════ PC 端差异化（>768px） ─────────── */
@media (min-width: 769px) {
  .import-tabs, #tab-paste, .file-guide { display: none !important; }
  #tab-file { display: block !important; }
  .mobile-only { display: none !important; }
}

/* ══════════════════════════ 移动端（≤768px） ───────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; width: 100%; }

  /* 统一品牌条：圆形校标 + 标题 + 头像（单行，无旧导航栏） */
  .nav {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--grad); color: #fff; padding: 10px 14px;
    box-shadow: 0 2px 10px rgba(30, 64, 175, 0.28);
  }
  .mh-nav-left { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; min-width: 0; }
  .mh-nav-logo { width: 32px; height: 32px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
  .mh-nav-logo img { width: 26px; height: 26px; object-fit: contain; border-radius: 50%; }
  .mh-nav-title { font-size: clamp(12px, 3.8vw, 14px); font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mh-nav-logout { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.4); color: #fff; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; text-decoration: none; flex-shrink: 0; }
  .mh-nav-logout:active { background: rgba(255,255,255,0.32); }
  @media (max-width: 340px) {
    .mh-nav-logout span { display: none; }
    .mh-nav-logout { padding: 5px 8px; }
  }
  .mh-nav .nav-links, .mh-nav .userinfo, .mh-nav .nav-brand { display: none; }

  /* 滑动提示条 */
  .nav-swipe-tip {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #f1f5f9; color: #94a3b8; font-size: 12px; letter-spacing: .04em;
    padding: 6px 12px; cursor: pointer; user-select: none; -webkit-user-select: none;
    border-bottom: 1px solid var(--border-light);
    opacity: 1; transition: opacity .3s ease;
  }
  .nav-swipe-tip .arr { color: #b6c2d2; font-size: 13px; }
  .nav-swipe-tip .arr-l { animation: nudgeL 1.6s ease-in-out infinite; }
  .nav-swipe-tip .arr-r { animation: nudgeR 1.6s ease-in-out infinite; }
  @keyframes nudgeL { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }
  @keyframes nudgeR { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

  .container { padding: 14px 12px 20px; }
  .card { padding: 16px; border-radius: 12px; }
  .col { min-width: 100%; }
  .row { gap: 12px; }

  .stat-cards { gap: 10px; }
  .stat-card { min-width: 46%; padding: 14px; }
  .stat-card .value { font-size: 24px; }
  .report-grid { grid-template-columns: 1fr; }

  .btn, .btn-sm { min-height: 44px; height: auto; padding: 0 16px; font-size: 15px; }
  .entry-actions { gap: 20px; }
  .entry-actions .btn { font-size: 14px; }
  .form-group input, .form-group select, .form-group textarea { padding: 12px; font-size: 16px; }
  .toolbar { gap: 8px; align-items: stretch; }
  .toolbar .form-group { min-width: 45%; flex: 1 1 auto; }
  .toolbar .btn { flex: 1 1 auto; min-width: 0; }
  .toolbar a.btn { display: inline-flex; }

  .login-box { margin: 30px auto; }
  .wechat-tip { display: block; }

  /* 预警中心：手机端纵向卡片流 */
  .alert-head { display: none; }
  .alert-row { grid-template-columns: 1fr auto; grid-template-areas: "name badge" "reason reason" "date btn"; gap: 6px 10px; padding: 12px; }
  .g-name { grid-area: name; font-size: 15px; }
  .g-badge { grid-area: badge; }
  .g-reason { grid-area: reason; }
  .g-date { grid-area: date; }
  .g-btn { grid-area: btn; }
  .g-class { display: none; }
  .g-cls { display: block; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 560px; width: 100%; }
  th, td { padding: 9px 10px; font-size: 13px; }
}

/* ══════════════════════════ 数据备份与恢复 ───────────────── */
.backup-desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.7; }
.backup-create { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px; background: #f8fafc; border: 1px solid var(--border-light); border-radius: 10px; margin-bottom: 16px; }
.backup-list { display: flex; flex-direction: column; gap: 10px; }
.backup-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-light); border-radius: 10px; background: #fff; transition: border-color .15s; }
.backup-item:hover { border-color: #bfdbfe; }
.bi-info { min-width: 0; }
.bi-time { font-size: 14px; font-weight: 600; color: var(--text); }
.bi-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.bi-remark { font-size: 12px; color: var(--muted); }
.bi-size { font-size: 12px; color: var(--muted); }
.bi-actions { display: flex; gap: 8px; flex-shrink: 0; }
.backup-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 18px; white-space: nowrap; }
.backup-badge.auto { background: #e5e7eb; color: #4b5563; }
.backup-badge.manual { background: #dbeafe; color: #1d4ed8; }
.backup-badge.pre { background: #fef3c7; color: #b45309; }
.backup-badge.scope { background: #ede9fe; color: #6d28d9; }
.backup-scope-fixed { display: inline-flex; align-items: center; min-height: 42px; padding: 0 12px; font-size: 14px; color: #6b7280; background: #f1f5f9; border: 1px solid var(--border-light); border-radius: 8px; }
.backup-empty, .backup-loading { text-align: center; color: var(--muted); padding: 24px 0; font-size: 14px; }
.btn-danger-ghost { color: var(--danger); background: #fff; border: 1px solid #fecaca; }
.btn-danger-ghost:hover { background: #fef2f2; }

/* 恢复确认弹窗 */
.backup-modal { display: none; position: fixed; inset: 0; z-index: 100; }
.backup-modal.show { display: block; }
.backup-modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .4); }
.backup-modal-body { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 92%; max-width: 400px; background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.bm-head { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.bm-close { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.bm-tip { font-size: 13px; color: #6b7280; margin-bottom: 14px; line-height: 1.6; }
.bm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* 轻提示 toast */
.backup-toast { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%) translateY(10px); background: rgba(15, 23, 42, .92); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px; opacity: 0; transition: .3s; z-index: 200; pointer-events: none; max-width: 86%; }
.backup-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.backup-toast.err { background: #dc2626; }

/* 备份模块：移动端适配 */
@media (max-width: 768px) {
  .backup-item { flex-direction: column; align-items: stretch; }
  .bi-actions { justify-content: flex-end; }
  .backup-create { flex-direction: column; align-items: stretch; }
  .backup-create .btn { width: 100%; }
}

/* ══════════════════════════ 移动端功能宫格首页（仅手机显示）══════════════════════ */
.mh-page { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 24px; background: var(--bg); }
.mh-hero { background: linear-gradient(135deg, #1E40AF, #4F46E5); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(30, 64, 175, 0.28); }
.mh-brand { font-size: 17px; font-weight: 700; color: #fff; }
.mh-sem { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 3px; }
.mh-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.22); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; text-decoration: none; flex-shrink: 0; }
.mh-body { padding: 14px 16px; }
.mh-welcome { background: #ECFDF5; border-left: 4px solid #059669; border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mh-welcome > div:first-child { min-width: 0; flex: 1; }
.mh-wt { font-size: 13px; font-weight: 700; color: #065F46; }
.mh-ws { font-size: 12px; color: #047857; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-wc { font-size: 12px; font-weight: 700; color: #059669; white-space: nowrap; flex-shrink: 0; }
.mh-cta { display: flex; align-items: center; justify-content: space-between; background: #1D4ED8; border-radius: 12px; padding: 14px 16px; color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; margin-top: 12px; min-width: 0; overflow: hidden; white-space: nowrap; }
.mh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mh-card { border-radius: 14px; padding: 10px 12px; color: #fff; text-decoration: none; position: relative; display: block; min-width: 0; }
.mh-card .mc-name { font-size: 16px; font-weight: 700; margin: 8px 0 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-card .mc-desc { font-size: 12px; color: rgba(255,255,255,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-card-plain { display: flex; align-items: center; justify-content: center; gap: 6px; }
.mh-card-plain .mc-name { margin: 0; }
.mh-badge { position: absolute; top: 10px; right: 10px; min-width: 18px; height: 18px; border-radius: 9px; background: #FACC15; color: #713F12; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ── 宫格首页底部：班级速览数据卡 ── */
.mh-overview { margin-top: 14px; background: #F8FAFC; border: 1px solid var(--border-light); border-radius: 14px; padding: 12px 14px; }
.mh-overview-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.mh-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mh-ov { text-align: center; }
.mh-ov-mid { border-left: 1px solid var(--border-light); border-right: 1px solid var(--border-light); }
.mh-ov-num { font-size: 20px; font-weight: 700; }
.mh-ov-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }
