/* ============================================================
   多媒体值班排班系统 · 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(139, 92, 246, 0.16);
  --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(124, 58, 237, 0.10);
  --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; }

/* ============================================================
   亮色主题组件补丁：暗色规则里硬编码的颜色不随 token 翻面，
   逐个在这里覆盖。只影响亮色，暗色主题的规则一律不动。
   ============================================================ */
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.78); }
[data-theme="light"] .alert {
  background: rgba(224, 72, 94, 0.08);
  border-color: rgba(224, 72, 94, 0.35);
  color: #a02538;
}
[data-theme="light"] .notice {
  background: rgba(10, 168, 143, 0.08);
  border-color: rgba(10, 168, 143, 0.3);
  color: #076e5d;
}
[data-theme="light"] .grid td.on-leave .tag {
  background: rgba(224, 72, 94, 0.12);
  color: #b93046;
}
[data-theme="light"] button.leave { border-color: var(--border); }
[data-theme="light"] button.leave.active {
  background: rgba(224, 72, 94, 0.12);
  color: #b93046;
}
[data-theme="light"] button.leave.active:hover { color: var(--danger); }
[data-theme="light"] table.list th { background: rgba(0, 0, 0, 0.03); }
[data-theme="light"] table.list td { border-bottom-color: rgba(0, 0, 0, 0.07); }
[data-theme="light"] .grid td.busy {
  border-color: rgba(124, 58, 237, 0.35);
}
[data-theme="light"] .grid td.busy .course { color: var(--text); }
.grid td.cell.online { background: rgba(139, 92, 246, 0.07); }
[data-theme="light"] .grid td.cell.online { background: rgba(124, 58, 237, 0.05); }
[data-theme="light"] .grid-mobile .m-cell { border-bottom-color: rgba(0, 0, 0, 0.07); }
[data-theme="light"] .duty {
  background: rgba(78, 107, 255, 0.12);
  color: #3a55e0;
}
[data-theme="light"] .leave-list { color: #b93046; }
[data-theme="light"] .free { color: #087f6b; }
[data-theme="light"] .tag-accent {
  color: #087f6b;
  border-color: rgba(10, 168, 143, 0.35);
}
[data-theme="light"] .tag-now { color: #087f6b; }
[data-theme="light"] .holiday-chip { color: #b93046; }
[data-theme="light"] .param-summary { background: rgba(0, 0, 0, 0.03); }

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;
  /* nav 紧跟在品牌后面；整条右侧留白由 .top-actions 的 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);
}
/* 主题开关 + 用户名 + 退出：一整簇钉在顶栏最右 */
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  /* 把这一簇推到最右边。左侧品牌和链接组不动，所以桌面/手机都不会被挤乱 */
  margin-left: auto;
}

/* ---------- 布局 ---------- */
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:disabled, .button-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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 列较宽：任何宽度下超出都可横向滑动，不把页面顶出横向滚动条。
   不把 thead/tbody 拆成两张 display:table 的表——拆开后两张表各算各的列宽，
   表头（没设宽度、又被 min-width:100% 拉散）和钉了宽度的格子必然错位；
   保持一张真表格，同列表头与格子共享列宽，由表格布局算法天然对齐。 */
.grid.overview {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 手机课表（按天堆叠卡片），桌面隐藏，手机显示 */
.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 .dnum,
.grid-mobile .dnum {
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  opacity: .62;
  letter-spacing: 0;
}
/* 手机卡片头是 flex 容器，日号直接放进去会被当成独立格子而换行，
   所以模板外面包了一层 .dh-week，让它跟在星期后面 */
.grid-mobile .day-head .dh-week { display: inline-flex; align-items: baseline; gap: 6px; }
.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(139, 92, 246, 0.10); }
.grid-mobile .m-cell.online { background: rgba(139, 92, 246, 0.05); }
.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(139, 92, 246, 0.45);
}
.grid td.busy .course {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  /* 紫底上课程名用纯白（暗色）；亮色由下方覆盖回正文色 */
  color: #fff;
}
.grid td.busy .room { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
/* 线上课格子：不算占用（可排班/可请假），课程名弱化显示 */
.grid td.cell .online-course { color: var(--text-dim); font-weight: 600; }
.grid-mobile .online-course { color: var(--text-dim); }

.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); }
/* 空缺待排：有人空闲但没人值班 → 橙色底 + 橙色实线框，一眼锁定还没排人的空档 */
.grid td.has-free:not(.has-duty) {
  background: rgba(255, 196, 102, 0.18);
  border: 1.5px solid rgba(255, 196, 102, 0.85);
}
[data-theme="light"] .grid td.has-free:not(.has-duty) {
  background: rgba(255, 196, 102, 0.30);
  border-color: rgba(217, 154, 31, 0.85);
}
.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; }
/* 暗色下空闲名单用更深的青绿，避免亮青刺眼（亮色主题本来就是深青，不受影响） */
[data-theme="dark"] .free { color: #28b39e; }
.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);
}
.tag-now { background: rgba(56, 224, 200, 0.15); 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; }

/* ---------- 选择管理员（首次登录后挑部门） ---------- */
.auth-card-wide { max-width: 520px; }
.admin-picker { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 0; }
.admin-choice { margin: 0; }
.admin-choice button[type=submit] {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 16px;
  text-align: left;
  background: var(--input-bg, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .15s var(--ease);
}
.admin-choice button[type=submit]:hover {
  border-color: var(--accent);
  background: rgba(56, 224, 200, .08);
  transform: translateY(-1px);
}
.ac-name { font-size: 15px; font-weight: 600; }
.ac-meta { font-size: 12px; color: var(--text-dim); }

/* ---------- 大按钮（下载/排班） ---------- */
.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 {
  /* 白字压亮青 (~1.9:1) 两个主题下都看不清，换成深青渐变 (~3–5:1) */
  background: linear-gradient(135deg, #0aa88f, #0b7c69);
}

/* ---------- 两栏工作区 ---------- */
.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); }

/* 我的课表：被排值班的格子（橙色，与全员总览空缺格同系）。
   线下课格不参与（:not(.busy)）：有课的时段排班器本来就不会排人 */
.grid td.on-duty:not(.busy), .grid-mobile .m-cell.on-duty:not(.busy) {
  background: rgba(255, 196, 102, 0.12);
  border-color: rgba(255, 196, 102, 0.55);
}
[data-theme="light"] .grid td.on-duty:not(.busy),
[data-theme="light"] .grid-mobile .m-cell.on-duty:not(.busy) {
  background: rgba(255, 196, 102, 0.22);
  border-color: rgba(217, 154, 31, 0.55);
}
.duty-pill {
  display: inline-block;
  padding: 2px 10px;
  margin-bottom: 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 196, 102, 0.28);
  border: 1px solid rgba(255, 196, 102, 0.8);
  color: #ffce7a;
}
[data-theme="light"] .duty-pill {
  background: rgba(255, 196, 102, 0.38);
  border-color: rgba(217, 154, 31, 0.7);
  color: #7a5200;
}

/* ---------- 周历信息条（第 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; }

/* ---------- 折叠的高级区 ---------- */
.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; }

/* ---------- 总体导出列表：文件名列自适应（仅这张表） ---------- */
.archives-table { table-layout: auto; }
.archives-table td.arc-name {
  word-break: break-all;
  white-space: normal;
  max-width: 420px;
  font-size: 13px;
}

/* ---------- 课表十字对位：悬浮/点选格子高亮向上整列 + 向左整行 ---------- */
.grid td.cell { box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0); }
/* 格子与表头统一 200ms 过渡：十字高亮切换是淡入淡出，不瞬跳 */
.grid td.cell { transition-duration: 200ms; }
.grid thead th, .grid th.slot, .grid th.slot-head {
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease),
              border-color 200ms var(--ease), background-color 200ms var(--ease),
              color 200ms var(--ease);
}
.grid td.hl-up, .grid td.hl-left { box-shadow: inset 0 0 0 999px rgba(108, 140, 255, 0.22); }
[data-theme="light"] .grid td.hl-up,
[data-theme="light"] .grid td.hl-left { box-shadow: inset 0 0 0 999px rgba(78, 107, 255, 0.10); }
.grid td.hl-self {
  /* 悬浮反馈 = 格子整体放大（无投影），盖过邻格 */
  box-shadow: inset 0 0 0 999px rgba(108, 140, 255, 0.32);
  border-color: var(--primary);
  transform: translateY(-4px) scale(1.15);
  position: relative;
  z-index: 5;
}
[data-theme="light"] .grid td.hl-self {
  box-shadow: inset 0 0 0 999px rgba(78, 107, 255, 0.15);
}
.grid th.hl-head {
  transform: translateY(-3px);
  border-color: var(--primary);
  background-color: rgba(108, 140, 255, 0.20);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
[data-theme="light"] .grid th.hl-head { background-color: rgba(78, 107, 255, 0.12); }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .topbar { padding: 0 12px; gap: 8px; flex-wrap: wrap; height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  /* 链接行单独一行内部横向滑动：不把页面撑出横向滚动条，退出/用户名固定右上 */
  .topbar nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { white-space: nowrap; }
  .top-actions { margin-left: auto; gap: 4px; }   /* 主题/用户名/退出钉在第一行最右 */
  /* 窄屏名字过长时省略，别把退出按钮顶出屏幕 */
  .who { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  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; }
  /* overview 保持单张真表格（见桌面端注释），表头与所在列天然对齐 */
  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:5：横向滚动时放大的格子从吸底列下面穿过 */
    z-index: 6;
    /* 吸底列必须用不透明底：半透明会让滑过来的名字透出来叠在节次文字上 */
    background: var(--surface-solid);
  }  .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; }
  .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; }
}

/* ---------- 页脚：作者 GitHub ---------- */
/* 低调地待在内容下面：一条细上边框 + 灰色小字，不抢页面主体 */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  max-width: 1080px;
  margin: 32px auto 0;
  padding: 16px 16px 28px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
}

.site-footer-note {
  opacity: 0.8;
  letter-spacing: 0.2px;
}

/* 做成胶囊徽章：平时低调，hover / 键盘聚焦时亮起来并轻微上浮，
   让人一眼看出这是可点的外链，而不是页脚的一行灰字 */
.site-footer-author {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  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);
}

.site-footer-author:hover,
.site-footer-author:focus-visible {
  color: var(--text);
  border-color: rgba(108, 140, 255, 0.55);
  background: rgba(108, 140, 255, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.site-footer-author svg { flex: none; opacity: 0.9; }
.site-footer-author:hover svg { opacity: 1; }

/* 窄屏竖排：两段挤一行会在中间反复折行 */
@media (max-width: 820px) {
  .site-footer {
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
    padding: 14px 12px 22px;
    font-size: 11px;
  }
}

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