/* ============================================================
   多媒体值班排班系统 · UI v2.1（暗色玻璃拟态 + 丰富动效）
   v2.1: 移动端适配 — 表格收进横向滚动容器、窄屏隐去次要列、断点 820px
   设计 token 见 ne.pen
   ============================================================ */

:root {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-solid: #121832;
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf7;
  --text-dim: #8b93b0;
  --primary: #6c8cff;
  --primary-strong: #4e6bff;
  --accent: #38e0c8;
  --danger: #ff6b81;
  --warn: #ffc466;
  --ok: #4ade80;

  --busy-cell: rgba(255, 255, 255, 0.05);
  --leave-cell: rgba(255, 107, 129, 0.16);
  --leave-border: #ff6b81;
  --free-cell: rgba(56, 224, 200, 0.07);

  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-cell: 10px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(108, 140, 255, 0.45), 0 8px 24px rgba(78, 107, 255, 0.25);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 160ms;
  --dur: 320ms;

  --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* ============================================================
   亮色主题：覆盖暗色 token
   ============================================================ */
[data-theme="light"] {
  --bg: #f2f4f8;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.10);
  --text: #1a2032;
  --text-dim: #5a6379;
  --primary: #4e6bff;
  --primary-strong: #3a55e0;
  --accent: #0aa88f;
  --danger: #e0485e;
  --warn: #d99a1f;
  --ok: #22a352;

  --busy-cell: rgba(0, 0, 0, 0.04);
  --leave-cell: rgba(224, 72, 94, 0.10);
  --leave-border: #e0485e;
  --free-cell: rgba(10, 168, 143, 0.08);
  --input-bg: #ffffff;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 0 1px rgba(78, 107, 255, 0.3), 0 4px 16px rgba(78, 107, 255, 0.15);
}

[data-theme="light"] body {
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(78, 107, 255, 0.06), transparent 60%),
    radial-gradient(700px 420px at 90% 0%, rgba(10, 168, 143, 0.05), transparent 60%),
    var(--bg);
}

/* 主题切换按钮（右上角） */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 6px 10px;
  min-height: 32px;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.theme-toggle:hover { color: var(--text); border-color: var(--primary); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

* { box-sizing: border-box; }

html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(78, 107, 255, 0.18), transparent 60%),
    radial-gradient(700px 420px at 90% 0%, rgba(56, 224, 200, 0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(255, 107, 129, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- 页面进入动画 ---------- */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: none; }
}
main > * { animation: pageIn 0.42s var(--ease) both; }
main > *:nth-child(2) { animation-delay: 0.05s; }
main > *:nth-child(3) { animation-delay: 0.1s; }
main > *:nth-child(4) { animation-delay: 0.15s; }
main > *:nth-child(5) { animation-delay: 0.2s; }
main > *:nth-child(6) { animation-delay: 0.25s; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
  padding: 0 24px;
  background: rgba(11, 16, 32, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.topbar nav a {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.topbar nav a:hover { color: var(--text); background: var(--surface); }
.topbar nav a.active { color: var(--text); }
.topbar nav a.active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  animation: navUnderline 0.32s var(--ease);
}
@keyframes navUnderline { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.who {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- 布局 ---------- */
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
main.wide { max-width: 1200px; }

h1 { font-size: 28px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; margin: 36px 0 12px; }
h2.card-title { margin: 0 0 12px; font-size: 16px; }

a { color: var(--primary); }
.hint { color: var(--text-dim); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  margin: 16px 0;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { transform: translateY(-2px); }

/* ---------- 表单 ---------- */
label {
  display: block;
  margin: 14px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}
input, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg, rgba(0, 0, 0, 0.25));
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}
input::placeholder { color: var(--text-dim); opacity: 0.5; }

/* ---------- 按钮 ---------- */
button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 120ms var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur-fast);
}
button::before, .button-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease);
}
button:hover::before, .button-link:hover::before { transform: translateX(100%); }
button:hover, .button-link:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
button:active, .button-link:active { transform: scale(0.96); }

button.ghost, .ghost.button-link {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
}
button.ghost:hover { color: var(--text); border-color: var(--primary); box-shadow: none; }

button.link {
  background: none;
  border: none;
  padding: 8px 14px;
  min-height: 0;
  color: var(--text-dim);
  font-weight: 500;
}
button.link:hover { color: var(--danger); box-shadow: none; }

form.inline { display: inline-flex; gap: 6px; align-items: center; }
form.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
form.stack label { margin: 12px 0; }

/* ---------- 提示条 ---------- */
.alert, .notice {
  border-radius: var(--radius-btn);
  padding: 14px 18px;
  margin: 14px 0;
  border: 1px solid;
  animation: alertIn 0.4s var(--ease);
}
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.alert {
  background: rgba(255, 107, 129, 0.1);
  border-color: rgba(255, 107, 129, 0.35);
  color: #ffb3c0;
}
.notice {
  background: rgba(56, 224, 200, 0.08);
  border-color: rgba(56, 224, 200, 0.3);
  color: #9df0e2;
}
.facts { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }

/* ---------- 周切换条 ---------- */
.weekbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  flex-wrap: wrap;
}
.weekbar a {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  transition: all var(--dur-fast) var(--ease);
}
.weekbar a:hover {
  color: var(--text);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.weekbar strong { font-size: 16px; }
.weekbar .disabled { opacity: 0.35; pointer-events: none; }
.weekbar .spacer { flex: 1; }

/* ---------- 课表网格 ---------- */
.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  margin: 12px 0 24px;
}
/* overview 网格 8 列较宽：任何宽度下超出都可横向滑动，不把页面顶出横向滚动条 */
.grid.overview {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.grid.overview thead, .grid.overview tbody { display: table; min-width: 100%; }

/* 手机课表（按天堆叠卡片），桌面隐藏，手机显示 */
.grid-mobile { display: none; }
.grid-mobile .day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-cell);
  margin-bottom: 10px;
  overflow: hidden;
}
.grid-mobile .day-card.today { border-color: rgba(56,224,200,.45); box-shadow: 0 0 0 1px rgba(56,224,200,.2); }
.grid-mobile .day-head {
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid-mobile .day-head .today-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.grid-mobile .day-slots { display: flex; flex-direction: column; }
.grid-mobile .m-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  min-height: 44px;
}
.grid-mobile .m-cell:last-child { border-bottom: none; }
.grid-mobile .m-slot {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text-dim);
  min-width: 36px;
  flex-shrink: 0;
}
.grid-mobile .m-cell.busy { background: rgba(108,140,255,.08); }
.grid-mobile .m-cell.on-leave { background: rgba(255,107,129,.07); }
.grid-mobile .m-course { font-size: 13px; color: var(--text); flex: 1; line-height: 1.3; }
.grid-mobile .m-room { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.grid-mobile .m-cell form { margin-left: auto; flex-shrink: 0; }
.grid-mobile .m-cell button.leave {
  font-size: 12px;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 8px;
}
.grid th, .grid td {
  border-radius: var(--radius-cell);
  padding: 10px;
  vertical-align: top;
  font-size: 13px;
}
.grid thead th {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dim);
}
.grid th.slot, .grid th.slot-head {
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text-dim);
  width: 64px;
}

@keyframes cellPop {
  0%   { opacity: 0; transform: scale(0.86); }
  60%  { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}
.grid td.cell {
  min-width: 110px;
  height: 84px;
  background: var(--surface);
  border: 1px solid var(--border);
  animation: cellPop 0.36s var(--ease) both;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast), border-color var(--dur-fast);
}
.grid tbody tr:nth-child(1) td { animation-delay: 0.02s; }
.grid tbody tr:nth-child(2) td { animation-delay: 0.06s; }
.grid tbody tr:nth-child(3) td { animation-delay: 0.10s; }
.grid tbody tr:nth-child(4) td { animation-delay: 0.14s; }
.grid tbody tr:nth-child(5) td { animation-delay: 0.18s; }
.grid tbody tr:nth-child(6) td { animation-delay: 0.22s; }
.grid td.cell:hover { transform: translateY(-2px); border-color: rgba(108, 140, 255, 0.4); }

.grid td.busy {
  background: var(--busy-cell);
  border-color: rgba(255, 255, 255, 0.06);
}
.grid td.busy .course {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
}
.grid td.busy .room { color: var(--text-dim); font-size: 12px; margin-top: 4px; }

.grid td.on-leave {
  background: var(--leave-cell);
  border-color: var(--leave-border);
  animation: cellPop 0.36s var(--ease) both, leavePulse 2.4s ease-in-out infinite;
}
@keyframes leavePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 129, 0.25); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 107, 129, 0.06); }
}
.grid td.on-leave .tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 107, 129, 0.25);
  color: #ffb3c0;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

button.leave {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--surface);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--text-dim);
  opacity: 0.55;
}
td.cell:hover button.leave { opacity: 1; border-color: var(--accent); color: var(--accent); }
button.leave.active {
  opacity: 1;
  background: rgba(255, 107, 129, 0.2);
  border: 1px solid var(--leave-border);
  color: #ffb3c0;
}
button.leave.active:hover { border-color: var(--danger); color: #fff; }

/* ---------- 列表表格 ---------- */
table.list {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
table.list th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
table.list td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}
table.list tbody tr {
  animation: rowIn 0.35s var(--ease) both;
  transition: background var(--dur-fast);
}
table.list tbody tr:nth-child(1) { animation-delay: 0.02s; }
table.list tbody tr:nth-child(2) { animation-delay: 0.05s; }
table.list tbody tr:nth-child(3) { animation-delay: 0.08s; }
table.list tbody tr:nth-child(4) { animation-delay: 0.11s; }
table.list tbody tr:nth-child(5) { animation-delay: 0.14s; }
table.list tbody tr:nth-child(n+6) { animation-delay: 0.17s; }
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: none; }
}
table.list tbody tr:hover { background: rgba(108, 140, 255, 0.07); }
table.list tbody tr:last-child td { border-bottom: none; }
tr.disabled-row { opacity: 0.45; }
td.actions form { margin: 2px 0; }
td.actions select {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
}
td.actions button { min-height: 34px; padding: 7px 14px; font-size: 13px; }

/* ---------- 总览网格 ---------- */
.grid.overview td { min-width: 140px; }
.grid td.has-free { background: var(--free-cell); border-color: rgba(56, 224, 200, 0.25); }
.grid td.has-duty { border-color: var(--primary); }
.duty {
  display: inline-block;
  padding: 2px 10px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: rgba(108, 140, 255, 0.2);
  color: #b7c6ff;
  font-size: 12px;
  font-weight: 600;
}
.free { color: var(--accent); font-size: 13px; font-weight: 500; }
.busy-list, .leave-list { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.muted-label { opacity: 0.7; }
.leave-list { color: #ffb3c0; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.tag-muted { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); }
.tag-accent {
  margin-left: 8px;
  background: rgba(56, 224, 200, 0.15);
  border: 1px solid rgba(56, 224, 200, 0.28);
  color: var(--accent);
}

/* ---------- 统计卡片（超管首页） ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  animation: statIn 0.5s var(--ease) both;
  transition: transform var(--dur) var(--ease), border-color var(--dur);
}
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }
@keyframes statIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.stat-card:hover { transform: translateY(-3px); border-color: rgba(108, 140, 255, 0.4); }
.stat-card .num {
  font-size: 32px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .lbl { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  animation: authIn 0.6s var(--ease) both;
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.auth-card h1 { text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }
.auth-card button[type=submit] { width: 100%; margin-top: 10px; }
.auth-links { text-align: center; margin-top: 18px; font-size: 13px; }

/* ---------- 大按钮（下载/排班） ---------- */
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; align-items: center; }
.cta {
  min-height: 52px;
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 14px;
}
.cta.download {
  background: linear-gradient(135deg, var(--accent), #19b39c);
}

/* ---------- 两栏工作区 ---------- */
.two-col {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 20px;
  align-items: stretch;
}
.two-col .card { margin: 0; }
/* 左右两卡视觉等高：参数卡的按钮贴底，结果卡的表单区吃掉剩余高度 */
.two-col > .card,
.two-col > .col-stack { display: flex; flex-direction: column; }
.two-col > .col-stack > .card { flex: 1; display: flex; flex-direction: column; }
.param-card form.stack { display: flex; flex-direction: column; flex: 1; }
.param-card button[type=submit] { margin-top: auto; }

/* 参数卡顶部的现状小结：填充高度，也让"这周大概什么情况"一眼可见 */
.param-summary {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.param-summary div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}
.param-summary span { color: var(--text-dim); }
.param-summary strong {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

/* 排班结果表格压缩行高，让整张卡的高度和左边的参数卡接近 */
table.list.compact th,
table.list.compact td { padding: 9px 12px; }
table.list.compact tbody td { height: 44px; }
table.list.compact th:nth-child(1),
table.list.compact td:nth-child(1),
table.list.compact th:nth-child(2),
table.list.compact td:nth-child(2) { width: 104px; }
table.list.compact td:nth-child(3) { font-weight: 500; }

/* ---------- 表格分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 4px;
}
.pager button {
  min-height: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.pager button::before { display: none; }   /* 不要父级的高光扫过 */
.pager button:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--primary);
  box-shadow: none;
  transform: translateY(-1px);
}
.pager button:active:not(:disabled) { transform: scale(0.94); }
.pager button.current {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 2px 10px rgba(78, 107, 255, 0.35);
}
.pager button:disabled { opacity: 0.3; cursor: default; }
.pager .pager-arrow { font-size: 16px; line-height: 1; padding: 0; }
.pager-pages { display: inline-flex; gap: 6px; }
.pager-info { margin-left: 8px; font-size: 12px; color: var(--text-dim); }

/* ---------- 周历信息条（第 N 周 = 几月几号 / 跳过哪些节假日） ---------- */
.week-note {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 20px;
  margin: 0 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  animation: riseIn 0.4s var(--ease) backwards;
}
.week-note-main { display: flex; align-items: baseline; gap: 10px; }
.week-note-holidays { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-note-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.week-note-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
}
.holiday-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--danger);
  background: rgba(255, 107, 129, 0.12);
  border: 1px solid rgba(255, 107, 129, 0.3);
  animation: popIn 0.32s var(--ease) backwards;
}
.holiday-chip:nth-child(2) { animation-delay: 0.06s; }
.holiday-chip:nth-child(3) { animation-delay: 0.12s; }
.holiday-chip:nth-child(4) { animation-delay: 0.18s; }

/* ---------- 模板文案表单 ---------- */
.text-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 4px 20px;
}
.text-form label { margin: 10px 0; }
.text-form .field-wide { grid-column: 1 / -1; }
.text-form textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
}

/* ---------- 折叠的高级区 ---------- */
.advanced {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.advanced summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
  transition: color 0.2s var(--ease);
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.24s var(--ease);
}
.advanced[open] summary::before { transform: rotate(90deg); }
.advanced summary:hover { color: var(--text); }
.advanced[open] > *:not(summary) { animation: riseIn 0.32s var(--ease) backwards; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .topbar { padding: 0 12px; gap: 8px; flex-wrap: wrap; height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  main { padding: 24px 12px 60px; }
  h1 { font-size: 22px; }

  /* ===== 移动端表格 ===== */
  /* 学生课表：手机端从网格切换为按天堆叠的卡片 */
  .grid-desktop { display: none; }
  .grid-mobile { display: block; }

  /* 其余表格（admin 列表 / overview 网格）收进横向滚动容器 */
  table.list, .grid.overview {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .grid.overview { border-spacing: 4px; font-size: 12px; }
  .grid.overview thead, .grid.overview tbody { display: table; min-width: 100%; }
  table.list thead, table.list tbody { display: table; min-width: 100%; }
  .grid.overview td.cell {
    min-width: 76px;
    max-width: 76px;
    height: 64px;
    padding: 5px;
    white-space: normal;
    font-size: 11px;
  }
  .grid.overview td.cell .course { font-size: 11px; line-height: 1.25; }
  .grid.overview td.cell .room { font-size: 10px; }
  .grid.overview th.slot, .grid.overview th.slot-head {
    width: 40px;
    min-width: 40px;
    font-size: 10px;
    padding: 8px 4px;
    position: sticky;
    left: 0;
    z-index: 2;
  }
  .grid.overview thead th { font-size: 11px; padding: 8px 4px; }
  .grid.overview td.cell button.leave { font-size: 11px; padding: 4px 8px; min-height: 28px; }

  /* 普通列表表 */
  table.list th, table.list td { padding: 7px 9px; font-size: 12px; }
  table.list thead, table.list tbody { display: table; min-width: 100%; }
  td.actions form { display: inline-block; margin: 2px 2px 2px 0; }
  td.actions button, td.actions select { min-height: 32px; font-size: 12px; padding: 5px 10px; }

  .weekbar { gap: 6px; flex-wrap: wrap; }
  .weekbar strong { font-size: 14px; }
  .auth-card { padding: 26px 20px; }

  /* 两栏与文案表单窄屏堆成单栏 */
  .two-col { grid-template-columns: 1fr; }
  .text-form { grid-template-columns: 1fr; }
  .week-note { gap: 12px; padding: 12px 14px; }
  .week-note-main { flex-direction: column; gap: 2px; }
  .pager { gap: 4px; }
  .pager button { min-width: 30px; height: 30px; padding: 0 8px; font-size: 12px; }

  /* 全员总览：网格已可滑动；下方名单表在手机上隐去「周内空档」列（最宽） */
  .hide-sm { display: none; }
}

/* ---------- 无障碍：减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
