:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e3e5ea;
  --line-strong: #c9ccd4;
  --text: #1d1f24;
  --muted: #6b7080;
  --accent: #2f6fd0;
  --accent-soft: #e8f0fc;
  --ok: #1d9e75;
  --warn: #b5761a;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 35, .06), 0 8px 24px rgba(20, 24, 35, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

body { min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1 1 auto; }
.err { color: var(--danger); font-size: 12px; min-height: 16px; margin: 6px 0 0; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}
.login-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.login-card .pwd-row { position: relative; display: block; margin-top: 6px; }
.login-card .pwd-row input { margin-top: 0; padding-right: 64px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 4px 9px; font-size: 12px; line-height: 1.2; color: var(--muted);
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
}
.pwd-toggle:hover { background: #f0f1f4; }
.pwd-toggle.on { color: var(--accent); border-color: var(--accent); }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  padding: 6px 12px;
  transition: background .12s, border-color .12s;
}
button:hover { background: #f0f1f4; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #2760b8; }
button.ghost { background: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 9px; font-weight: 600;
}
.brand strong { display: block; font-size: 15px; }
.brand .small { display: block; }

.tabs { display: flex; gap: 2px; }
.tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 12px; border-radius: 8px;
}
.tabs button:hover { background: #f0f1f4; color: var(--text); }
.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.userbox { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.banner { padding: 8px 18px; background: #fff7e6; border-bottom: 1px solid #f0dcae; color: var(--warn); font-size: 13px; }

main { padding: 14px 18px 40px; }
.view { display: block; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.search {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  min-width: 220px;
  background: #fff;
}
select {
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  max-width: 240px;
}
.chk, .inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.inline select { margin-left: 4px; }
/* 个人课表：姓名改为可输入 + 下拉建议 */
#mine-name-wrap { position: relative; }
#mine-name-wrap #mine-name {
  width: 200px; padding: 5px 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--line-strong); border-radius: 8px 0 0 8px; outline: none;
  background: #fff; color: var(--fg);
}
#mine-name-wrap #mine-name:focus { border-color: var(--accent); }
#mine-name-wrap #mine-name::placeholder { color: #b3b9c2; }
#mine-hint:empty { display: none; }

/* 姓名「输入 + 展开按钮」组合：
   原生 <datalist> 只在**输入了字符之后**才给建议，点它自带的箭头不会展开全部候选，
   老师会以为「没有下拉」。这里补一个真正的按钮，点一下列出全部可选姓名。 */
#mine-name-wrap .combo { display: inline-flex; align-items: center; margin-left: 4px; position: relative; }
#mine-name-wrap .combo-btn {
  height: 30px; width: 28px; padding: 0; cursor: pointer;
  border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 8px 8px 0;
  background: #f6f7f9; color: var(--muted); font-size: 12px; line-height: 1;
}
#mine-name-wrap .combo-btn:hover { background: #eceef2; color: var(--fg); }
#mine-name-wrap .combo.open .combo-btn { background: #e8eaee; }
#mine-name-wrap .combo-menu {
  position: absolute; z-index: 40; top: 34px; left: 0; min-width: 200px; max-height: 300px;
  overflow-y: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px;
}
#mine-name-wrap .combo-menu .combo-item {
  padding: 6px 9px; border-radius: 6px; font-size: 13px; cursor: pointer;
  white-space: nowrap; color: var(--fg);
}
#mine-name-wrap .combo-menu .combo-item:hover,
#mine-name-wrap .combo-menu .combo-item.active { background: #eef6f1; color: var(--accent); }
#mine-name-wrap .combo-menu .combo-empty { padding: 8px 9px; font-size: 12px; color: var(--muted); }

.day-tabs { display: flex; gap: 2px; background: #eceef2; padding: 3px; border-radius: 9px; }
.day-tabs button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; color: var(--muted); }
.day-tabs button.active { background: #fff; color: var(--accent); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.legend .lg {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer;
}
.legend .lg.off { opacity: .4; }
.legend .lg i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* ---------- 课表网格 ---------- */
.grid-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

.tt { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tt th, .tt td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; padding: 0; }

.tt thead th {
  position: sticky; top: 0; z-index: 3;
  background: #f0f2f6;
  padding: 7px 8px;
  text-align: center;
  font-weight: 500;
  min-width: 116px;
  border-bottom: 1px solid var(--line-strong);
}
.tt thead th .room { font-size: 13px; }
.tt thead th .meta { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.tt thead th .addr { display: block; font-size: 11px; color: #9aa0ae; font-weight: 400; }

.tt th.slot, .tt td.slot {
  position: sticky; left: 0; z-index: 2;
  background: #f7f8fa;
  min-width: 92px;
  padding: 8px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.tt thead th.corner { left: 0; z-index: 5; text-align: left; min-width: 92px; }

.tt td.cell {
  height: 46px;
  min-width: 116px;
  padding: 4px 7px;
  cursor: pointer;
  transition: box-shadow .1s;
  position: relative;
}
.tt td.cell:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.tt td.cell .c { display: block; font-weight: 500; color: #1d1f24; word-break: break-all; }
.tt td.cell .t { display: block; font-size: 11px; color: #5a6070; margin-top: 1px; }
.tt td.cell.empty .c { color: #c3c6ce; font-weight: 400; }
.tt td.cell.dim { opacity: .22; }
.tt td.cell.hit { box-shadow: inset 0 0 0 2px #f0b429; }
.tt td.cell.flash { animation: flash .9s ease-out; }
@keyframes flash { 0% { background: #fff3c4 !important; } 100% { background: transparent; } }

/* ---------- 搬移 / 交换 ---------- */
.tt td.cell.swap-src {
  box-shadow: inset 0 0 0 3px #f59e0b;
  background-image: linear-gradient(rgba(245, 158, 11, .12), rgba(245, 158, 11, .12));
}
.tt td.cell.swap-src::after {
  content: '源';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 10px;
  line-height: 1.35;
  background: #f59e0b;
  color: #fff;
  padding: 0 3px;
  border-radius: 3px;
  pointer-events: none;
}

/* ---------- 选中态 + 右下角「编辑」按钮 ----------
   单击格子后：td 加 .selected（蓝边）+ 右下角显示「编辑」按钮（hover 即显，强制显示当 .selected）
   再点同一格不会取消失（用户决策）；切换格子 / Esc / 点空白 = 取消 */
.tt td.cell.selected { box-shadow: inset 0 0 0 2px var(--accent, #4f7cff); background: rgba(79,124,255,.04); }
.tt td.cell.selected.empty .c { color: #1d1f24; }
.tt td.cell .cell-edit-btn {
  position: absolute;
  right: 3px; bottom: 2px;
  font-size: 11px; line-height: 1.2;
  padding: 2px 7px;
  border: 1px solid var(--line-strong, #d4d7de);
  border-radius: 4px;
  background: var(--panel, #fff);
  color: var(--text, #1d1f24);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
  z-index: 4;
  user-select: none;
}
.tt td.cell:hover .cell-edit-btn,
.tt td.cell.selected .cell-edit-btn { opacity: 1; }
.tt td.cell .cell-edit-btn:hover {
  background: var(--accent-soft, #e8efff);
  border-color: var(--accent, #4f7cff);
}

.swap-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #fff8e6;
  border: 1px solid #f0d089;
  border-radius: 8px;
  font-size: 12.5px;
  color: #7a5610;
}
.swap-bar b { color: #8a5a00; }

.toast-btn {
  margin-left: 8px;
  padding: 1px 9px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
}

.tt tr.break-row td { background: #fafbfc; color: #a8adba; text-align: center; font-size: 11.5px; padding: 4px; }
/* 日期分隔带：整周「一张表」模式下会有十几条连着出现，做成明显的横线 + 浅底日期名 */
.tt tr.daysep td, .tt tr.daysep th {
  background: #eef0f4;
  font-weight: 500;
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
  position: sticky; left: 0;
}
/* 日期分隔带：每个日期开头一条加粗横线 + 浅底日期名。
   用 row 上的 box-shadow 画粗线，不受 sticky 表头 / collapse 边框的影响。 */
.tt tr.daysep td {
  border-bottom: 1px solid #dfe3e8;
  padding: 6px 10px;
  text-align: center;
  background: linear-gradient(#eef4ec, #e4ece1);
  box-shadow: inset 0 3px 0 0 #9fbb9c;
}
.tt tr.daysep .daysep-name { font-weight: 700; font-size: 13px; color: #1f5a35; letter-spacing: .4px; }
.tt tr.daysep .daysep-term { font-size: 12px; color: var(--muted); margin-left: 8px; }
/* 整周一张表：教室表头允许换行（教室名 + 容纳人数/地址各占一行），列不会被撑得很宽 */
.tt.wrap-head thead th { white-space: normal; min-width: 96px; max-width: 130px; padding: 6px 6px; }
.tt.wrap-head thead th .meta, .tt.wrap-head thead th .addr { display: block; margin: 0; }

/* ---------- 编辑器浮层（抽屉内静态版） ----------
   新方案：#editor 不再浮动定位，而是放进 #edit-drawer 抽屉里。抽屉默认隐藏在右侧外，
   加 .open 后从右滑入到 #view-schedule 内右侧。 */
#view-schedule { position: relative; }                     /* 抽屉 absolute 定位上下文（避免影响其他视图） */
#edit-drawer.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 320px;
  background: var(--panel);
  border-left: 1px solid var(--line-strong);
  box-shadow: -8px 0 24px rgba(0,0,0,.06);
  transform: translateX(100%);
  transition: transform .22s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
#edit-drawer.drawer.open { transform: translateX(0); }
/* 抽屉内嵌套的 popover 改造：去掉 absolute/圆角等浮层样式，跟随抽屉大小 */
#edit-drawer #editor.popover {
  position: static;
  width: auto; border: 0; border-radius: 0; box-shadow: none;
  padding: 18px;
  z-index: auto;
}
#edit-drawer #editor.popover.hidden { display: none; }     /* 二次兜底 */
.popover {
  /* 原浮层样式保留作为"非抽屉场景"的后备（例如未来其他地方用） */
  position: absolute;
  z-index: 60;
  width: 268px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.pop-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 13px; font-weight: 500; }
.popover label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.popover input {
  display: block; width: 100%; margin-top: 4px;
  padding: 7px 9px; border: 1px solid var(--line-strong);
  border-radius: 7px; font: inherit; font-size: 13px; background: #fff; color: var(--text);
}
.popover input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.pop-actions { display: flex; gap: 6px; margin-top: 12px; }

.modal { position: fixed; inset: 0; background: rgba(20,24,35,.34); display: grid; place-items: center; z-index: 80; }
.modal-card { width: 340px; background: #fff; border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.modal-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.modal-card input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }

/* ---------- 使用说明书弹窗 ----------
   弹窗本身占满大半屏，内嵌 iframe 直接渲染说明书 HTML（自带样式，自包含无外链）。
   这样不必离开当前页面，也能随时下载或另开标签页细看 / 打印。 */
#manual-modal { place-items: stretch; padding: 24px; background: rgba(20,24,35,.55); }
.manual-card {
  width: 100%; max-width: 1080px; margin: auto;
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  height: min(880px, calc(100vh - 48px));
}
.manual-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fff;
}
.manual-head h2 { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; }
/* 角色对应多份时才出现页签；只有一份时整条隐藏 */
.manual-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.manual-tabs:empty { display: none; }
.manual-tab {
  padding: 5px 13px; font-size: 13px; font-family: inherit; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px;
  transition: background .12s, color .12s, border-color .12s;
}
.manual-tab:hover { background: #f2f5f3; color: var(--fg); }
.manual-tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.manual-acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }
/* 下载 / 新标签页 用 <a> 承担按钮外观，去掉下划线并对齐 .ghost */
.manual-acts a.ghost {
  display: inline-flex; align-items: center; text-decoration: none;
  padding: 4px 10px; font-size: 12.5px; border-radius: 8px; line-height: 1.6;
}
.manual-body { flex: 1 1 auto; min-height: 0; background: #f7f8fa; }
.manual-body iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
@media (max-width: 640px) {
  #manual-modal { padding: 8px; }
  .manual-card { height: calc(100vh - 16px); }
  .manual-head { padding: 10px 12px; gap: 8px; }
  .manual-head h2 { font-size: 15px; }
  .manual-acts { margin-left: 0; width: 100%; }
}


/* ---------- 分享卡 ---------- */
.share-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.share-card .qr { width: 108px; height: 108px; flex: 0 0 auto; }
.share-card .qr img, .share-card .qr canvas { width: 108px; height: 108px; }
.share-card .info { flex: 1 1 320px; min-width: 260px; }
.share-card .link {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f4f5f8;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  word-break: break-all;
  margin: 6px 0 10px;
}
.share-card .msg { font-size: 12.5px; color: var(--muted); }
.share-card .msg textarea {
  width: 100%; margin-top: 4px; min-height: 62px; resize: vertical;
  font: inherit; font-size: 12.5px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--text);
}

/* ---------- 通用表格 ---------- */
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
table.data thead th { background: #f0f2f6; position: sticky; top: 0; z-index: 2; font-weight: 500; }
table.data tbody tr:nth-child(even) { background: #fafbfc; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.cal-table { table-layout: auto; font-size: 12.5px; }
.cal-table th, .cal-table td { white-space: nowrap; }
.cal-table thead th { font-size: 11.5px; padding: 6px 7px; text-align: center; font-weight: 500; }
.cal-table tbody td { padding: 5px 7px; }
.cal-table tbody td:first-child { font-variant-numeric: tabular-nums; }
.cal-table td.mark { text-align: center; cursor: pointer; user-select: none; width: 46px; min-width: 46px; }
.cal-table td.mark:hover { background: var(--accent-soft); }
.cal-table td.mark.on { background: #dff3ea; color: #0f6e56; font-weight: 600; }
.cal-table td.mark.locked { cursor: default; }
.cal-table td.weekend { background: #fbf6ef; }
.cal-table td.today { box-shadow: inset 0 0 0 2px var(--accent); }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-block; font-size: 11.5px; padding: 1px 7px;
  border-radius: 20px; background: var(--accent-soft); color: var(--accent);
}

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #23262d; color: #fff; padding: 9px 18px; border-radius: 22px;
  font-size: 13px; z-index: 100; box-shadow: var(--shadow);
}
.toast.warn { background: var(--warn); }
.toast.bad { background: var(--danger); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 10px; }
}

/* ---------------- 教室管理 ---------------- */

/* 表头教室名可点 */
th .room.room-editable { cursor: pointer; border-radius: 6px; padding: 1px 5px; margin: -1px -5px; }
th .room.room-editable:hover { background: var(--accent-soft); color: var(--accent); }
th .room.room-editable::after { content: ' ✎'; font-size: 10px; opacity: .45; }

/* 表头就地改名的输入框 */
.room-rename {
  width: 92px; padding: 3px 6px; font: inherit; font-size: 12.5px;
  border: 1px solid var(--accent); border-radius: 6px; text-align: center;
  outline: none; background: #fff;
}

/* 表头右侧「+ 教室」按钮 */
th.th-add-room { padding: 4px 6px; }
.add-room-btn {
  font-size: 12px; padding: 3px 9px; border-radius: 8px; cursor: pointer;
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  font-family: inherit; white-space: nowrap;
}
.add-room-btn:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }

.add-room-btn {
  font-size: 12px; padding: 3px 9px; border-radius: 8px; cursor: pointer;
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  font-family: inherit; white-space: nowrap;
}
.add-room-btn:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }

/* 教室管理弹窗 */
.room-card { width: 520px; max-width: 94vw; }
.room-list { max-height: 46vh; overflow: auto; margin: 12px 0; border-top: 1px solid var(--line); }
.room-row { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); }
#room-list .room-idx { width: 20px; font-size: 12px; color: var(--muted); text-align: center; flex: none; margin: 0; }
#room-list .room-name {
  flex: 1 1 0%; width: auto; min-width: 0; margin: 0;
  padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 7px;
  font: inherit; font-size: 13px;
}
#room-list .room-cap {
  width: 68px; flex: none; margin: 0;
  padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px;
  font: inherit; font-size: 13px;
}
#room-list .room-name:focus, #room-list .room-cap:focus { outline: none; border-color: var(--accent); }
#room-list .mini {
  flex: none; width: 26px; height: 28px; margin: 0; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  font-size: 12px; line-height: 1; font-family: inherit;
}
#room-list .mini:hover { border-color: var(--accent); color: var(--accent); }
#room-list .mini.danger:hover { border-color: var(--danger); color: var(--danger); }
.room-add { display: flex; gap: 6px; align-items: center; }
.room-add input {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; font: inherit; font-size: 13px;
}
.room-add input.cap { flex: none; width: 76px; }
.room-add input:focus { outline: none; border-color: var(--accent); }
.room-add button { flex: none; }

/* 「兼职专用」日期：数据全局共享，但课表总表的日期栏不显示它。
   面板里给一个勾选框，方便把已有日期一键改成 / 取消兼职专用。 */
.day-add-row .day-ptonly-check {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap;
  padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px;
}
.day-add-row .day-ptonly-check:hover { border-color: var(--accent); color: var(--accent); }
.day-add-row .day-ptonly-check input { margin: 0; cursor: pointer; }

#day-list .day-ptonly {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap;
  margin-left: 6px; user-select: none;
}
#day-list .day-ptonly:hover { color: var(--accent); }
#day-list .day-ptonly input { margin: 0; cursor: pointer; }

/* ---------------- 日期列管理 ---------------- */

.day-tabs button { font-family: inherit; cursor: pointer; white-space: nowrap; }
.day-tabs button:hover { color: var(--accent); }

/* 整周 / 日期管理按钮 */
.day-tabs button.day-mgr-btn {
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  margin-left: 4px;
}
.day-tabs button.day-mgr-btn:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }

/* 双击日期标签就地改名 */
.day-rename {
  padding: 5px 9px; font: inherit; font-size: 13px; border: 1px solid var(--accent);
  border-radius: 7px; outline: none; background: #fff; text-align: center; min-width: 70px;
}

/* ---------------- 时段管理 ---------------- */

/* 课表最左列（时间格）可点改名 */
th.slot.slot-editable { cursor: pointer; }
th.slot.slot-editable:hover { background: var(--accent-soft); }
th.slot.slot-editable::after { content: ' ✎'; font-size: 9px; opacity: .4; font-weight: 400; }
td.slot-editable { cursor: pointer; }
td.slot-editable:hover { background: var(--accent-soft); }
td.slot-editable::after { content: ' ✎'; font-size: 9px; opacity: .35; }

/* 时间格就地改名的输入框 */
.slot-rename {
  padding: 3px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--accent); border-radius: 6px; outline: none;
  background: #fff; text-align: center;
}

/* 时段管理弹窗 */
#slot-list .room-idx { width: 20px; font-size: 12px; color: var(--muted); text-align: center; flex: none; margin: 0; }
#slot-list .room-name {
  flex: 1 1 0%; width: auto; min-width: 0; margin: 0;
  padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 7px;
  font: inherit; font-size: 13px;
}
#slot-list .room-name:focus { outline: none; border-color: var(--accent); }
#slot-list .mini {
  flex: none; min-width: 26px; height: 28px; padding: 0 7px; margin: 0; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  font-size: 12px; line-height: 1; font-family: inherit;
}
#slot-list .mini:hover { border-color: var(--accent); color: var(--accent); }
#slot-list .mini.danger:hover { border-color: var(--danger); color: var(--danger); }
#slot-list .mini.warn-on {
  border-color: var(--warn); color: var(--warn); background: #fff8e6; font-weight: 600;
}
#slot-list .mini.warn-on:hover { border-color: var(--warn); color: var(--warn); }

/* ---------------- 角色与权限 ---------------- */

/* 角色说明卡 */
.role-legend {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px;
}
.role-card {
  flex: 1 1 300px; min-width: 240px;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfbfc;
}
.role-chip {
  flex: none; font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; white-space: nowrap;
}
.role-chip.role-principal { background: #efe3ff; color: #6b3fbf; }
.role-chip.role-admin { background: var(--accent-soft); color: var(--accent); }
.role-chip.role-teacher { background: #eceef1; color: #5a6270; }
.role-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 表内角色下拉 */
.role-select {
  font: inherit; font-size: 12.5px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; cursor: pointer;
  outline: none; min-width: 92px;
}
.role-select:focus { border-color: var(--accent); }
select.role-select.role-principal { border-color: #c3a4f0; background: #faf6ff; color: #6b3fbf; font-weight: 600; }
select.role-select.role-admin { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
select.role-select.role-teacher { color: var(--muted); }

/* 表内就地编辑 */
.u-edit {
  cursor: pointer; padding: 2px 6px; margin: -2px -6px; border-radius: 6px;
  border-bottom: 1px dashed transparent;
}
.u-edit:hover { background: var(--accent-soft); color: var(--accent); border-bottom-color: var(--accent); }
.u-edit.u-muted { color: var(--muted); cursor: default; }
.u-edit.u-muted:hover { background: transparent; color: var(--muted); border-bottom-color: transparent; }
.u-edit.warn-text { color: var(--warn); }
.u-inline {
  width: 120px; padding: 4px 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--accent); border-radius: 7px; outline: none; background: #fff;
}
tr.u-me td { background: #fcfaff; }
.u-self { margin-left: 6px; font-size: 11.5px; color: var(--muted); }
.u-ops button { margin-right: 4px; }

/* 账号备注（z56）：空备注显示灰色占位，点一下就地写 */
.u-note-empty { color: #b3b9c2; }
/* 角色只读（管理员）：身份只有校长/超管能改，这里只显示文字 */
.u-role-fixed {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: #f4f5f7; color: var(--muted); font-size: 12.5px;
}
.ue-role-fixed {
  margin: 8px 0; padding: 6px 10px; border-radius: 7px;
  background: #f4f5f7; color: var(--muted); font-size: 12.5px;
}

/* 新增账号弹窗 */
.fld {
  display: block; margin: 11px 0; font-size: 12.5px; color: var(--muted);
}
.fld input, .fld select {
  display: block; width: 100%; margin-top: 5px;
  padding: 8px 10px; font: inherit; font-size: 13.5px; color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 8px; outline: none; background: #fff;
}
.fld input:focus, .fld select:focus { border-color: var(--accent); }

/* ---------------- 课表导入 ---------------- */

.import-card { width: 760px; max-width: 96vw; }
#import-panel textarea {
  width: 100%; box-sizing: border-box; margin: 10px 0 8px;
  padding: 9px 11px; font: 12.5px/1.6 ui-monospace, Consolas, 'Courier New', monospace;
  border: 1px solid var(--line-strong); border-radius: 8px; outline: none;
  background: #fff; resize: vertical; min-height: 120px; color: var(--fg);
}
#import-panel textarea:focus { border-color: var(--accent); }
.imp-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.imp-row .spacer { flex: 1; }

/* 列映射 */
#imp-map { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfbfc; margin: 10px 0; }
.imp-map-title { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.imp-map-row { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.imp-col { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.imp-col select {
  font: inherit; font-size: 12.5px; padding: 4px 7px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: #fff; outline: none; color: var(--fg);
}
.imp-col select:focus { border-color: var(--accent); }

/* 统计与提示 */
#import-panel .imp-stat-line {
  font-size: 13px; padding: 7px 11px; border-radius: 8px; margin: 6px 0; line-height: 1.6;
}
#import-panel .imp-ok { background: var(--accent-soft); color: #0d5c49; }
#import-panel .imp-new { background: #f3eeff; color: #5b3bb0; }
#import-panel .imp-warn { background: #fff6e0; color: #8a6100; }
#import-panel .imp-errs {
  font-size: 12.5px; color: #a33; background: #fdf1f1; border-radius: 8px;
  padding: 8px 11px; margin: 6px 0; line-height: 1.7; max-height: 130px; overflow: auto;
}
#import-panel .imp-errs-title { font-weight: 600; }

/* 模式与执行 */
#import-panel .imp-mode { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
#import-panel .imp-mode .chk { font-size: 13px; }
#import-panel .imp-mode input[type=radio] { accent-color: var(--accent); }

/* 导入面板：压过 .modal-card label/input 的通配样式，恢复表单控件正常布局 */
#import-panel .imp-col { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; }
#import-panel .chk, #import-panel .inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
#import-panel input[type="file"],
#import-panel input[type="radio"],
#import-panel input[type="checkbox"] {
  display: inline-block; width: auto; margin: 0; padding: 0;
  border: none; background: transparent; accent-color: var(--accent);
}
#import-panel input[type="file"][hidden] { display: none !important; }

/* ---------------- 鼠标位置（谁在看哪一格） ----------------
   与上面的 .edit-lock 刻意区分开：
     .edit-lock  橙色虚线框 + "某某 编辑中"  = 真要改这一格（别人不能动）
     .ptr-watch  蓝色细边 + 名字角标          = 鼠标只是停在这儿（不影响任何人）

   角标堆在格子右上角，横向并排；人多时靠 flexwrap 换行，不盖住班级名（班级名在左上）。
   气泡不走自定义 tooltip，直接用 title 属性 —— 移动端长按可看，也不会被层级问题坑到。 */
td.cell.ptr-watch { box-shadow: inset 0 0 0 2px #4f7cff; }
td.cell.ptr-watch.edit-lock { box-shadow: inset 0 0 0 2px #4f7cff, 0 0 0 2px #e8590c; }
.ptr-badges {
  position: absolute; top: 0; right: 0;
  display: flex; flex-wrap: wrap; justify-content: flex-end;
  gap: 2px; padding: 1px 2px;
  max-width: 100%;
  pointer-events: none;
  z-index: 3;
}
.ptr-badge {
  font-size: 10px; line-height: 1.5;
  max-width: 84px;
  padding: 0 5px;
  color: #fff;
  border-radius: 0 0 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
/* 有人看着时鼠标变「眼睛」，一眼区分「只是看」和「正在编辑」 */
td.cell.ptr-watch { cursor: pointer; }

/* 在线名单里也标一下「他正在看哪个格子」 */
.online-item .on-where {
  font-size: 11px; color: #5b6a7d; flex: none;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 跨日期位置提示条：老师在看的日子与当前视图对不上时，用文字兜底说清楚 */
.ptr-day-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 10px; margin: 0 0 8px;
  background: #f2f6ff; border: 1px solid #d8e3ff; border-radius: 8px;
  font-size: 12px;
}
.ptr-day-strip-label { color: #5b6a7d; }
.ptr-day-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  background: #fff; border: 1.5px solid #d8e3ff; color: #1d1f24;
}
.ptr-day-chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ptr-day-chip em { color: #b46b00; font-style: normal; font-size: 11px; }
.ptr-day-chip.off { border-style: dashed; color: #5b6a7d; }

/* ---------------- 在线名单 + 编辑中角标 ---------------- */
#sync-state { cursor: pointer; }
#sync-state:hover { color: var(--accent); }

.online-card { width: 380px; }
#online-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 320px; overflow: auto; }
.online-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--card, #fff); }
.online-item .avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.online-item .on-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-item .role-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #eef2ff; color: #4353b0; flex: none; }
.online-item .role-badge[data-role="principal"] { background: #fff4e0; color: #b46b00; }
.online-item .role-badge[data-role="admin"] { background: #e7f0ff; color: #1c64d9; }
.online-item .role-badge[data-role="teacher"] { background: #f0f3f7; color: #5b6a7d; }
.online-item .dot-on { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; flex: none; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }

/* 有人正在编辑的格子：虚线框 + 名字角标 */
td.cell { position: relative; }
td.cell.edit-lock { outline: 2px dashed #e8590c; outline-offset: -2px; cursor: not-allowed; }
td.cell.edit-lock::after {
  content: attr(data-editby) " 编辑中";
  position: absolute; top: 0; right: 0;
  max-width: 100%;
  font-size: 10px; line-height: 1.5;
  padding: 0 5px;
  background: #e8590c; color: #fff;
  border-radius: 0 0 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
  pointer-events: none;
  z-index: 2;
}

/* 编辑中的格子若同时有人在看，让橙色角标压住蓝色角标（编辑更重要） */
td.cell.edit-lock .ptr-badges { z-index: 1; }

/* 用户管理：删除按钮（红）、编辑弹窗 */
button.danger { color: #d64545; }
button.danger:hover { background: #fdecec; border-color: #d64545; }
.user-edit-card { width: 420px; }
.u-ops button { padding: 2px 8px; font-size: 12px; }

/* 用户管理：密码列（仅校长） */
.pwd-plain { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; letter-spacing: .5px; }
.pwd-toggle { padding: 1px 6px !important; font-size: 11px !important; }

/* 复制当日课表弹窗 */
.copy-card { width: 460px; }
.copy-row { display: flex; align-items: flex-end; gap: 12px; margin: 12px 0; }
.copy-row label { flex: 1; display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 13px; color: #5b6a7d; }
.copy-row select { width: 100%; }
.copy-arrow { font-size: 18px; color: #98a6b5; padding-bottom: 8px; }

/* 多选批量操作 */
td.cell.multi-sel { outline: 2px solid #4f7cff; outline-offset: -2px; background: rgba(79, 124, 255, .1); cursor: pointer; }
td.cell.multi-sel:hover { background: rgba(79, 124, 255, .18); }
#btn-multi.active { background: #e8efff; border-color: #4f7cff; color: #2b5fd9; }
.move-pending td.cell:not(.empty):hover, .move-pending td.cell:hover { outline: 2px dashed #4f7cff; outline-offset: -2px; cursor: crosshair; }

/* 批量修改字段弹窗：压过 .modal-card label/input 的通配样式 */
#multi-edit-panel .modal-card { width: 520px; }
.me-grid { display: grid; grid-template-columns: 48px 1fr 1fr; gap: 8px; align-items: center; margin: 14px 0 10px; }
.me-grid .me-cap { font-size: 13px; font-weight: 600; color: #334155; }
.me-grid .me-h { font-size: 12px; color: #98a6b5; text-align: left; }
.me-grid input { display: block; width: 100%; margin: 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }
#me-info { min-height: 18px; }
#me-run:disabled { opacity: .5; cursor: not-allowed; }

/* 查找替换弹窗 */
#replace-panel .modal-card { width: 520px; }
.rp-scope-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.rp-scope-row select { flex: 1; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; background: #fff; }
#rp-info { min-height: 18px; }
#rp-run:disabled { opacity: .5; cursor: not-allowed; }

/* 顶部系统名称：校长可点击改名 */
#term-label.term-editable { cursor: pointer; border-radius: 6px; padding: 1px 6px; margin: -1px -6px; }
#term-label.term-editable:hover { background: var(--accent-soft); color: var(--accent); }
#term-label.term-editable::after { content: ' ✎'; font-size: 11px; opacity: .45; }
#term-label .term-rename { width: 260px; max-width: 46vw; font: inherit; font-weight: 700; padding: 2px 6px; border: 1px solid var(--accent); border-radius: 6px; }

/* 学生报名：行编辑 */
tr.en-row { cursor: pointer; }
tr.en-row:hover td { background: var(--accent-soft); }
/* 刚新增/刚导入的报名行：短暂高亮一下，一眼看到「它就是刚才那条」 */
.enroll-table tbody tr.en-flash td {
  animation: enFlash 2.6s ease-out forwards;
}
@keyframes enFlash {
  0%, 45% { background: #ffe9a8; }
  100% { background: transparent; }
}
.en-op-col { width: 72px; text-align: center; white-space: nowrap; }
.en-op-col .mini { padding: 2px 10px !important; font-size: 12px !important; }
#enroll-edit-panel .modal-card { width: 380px; }
#enroll-edit-panel .pop-actions .spacer { flex: 1; }

/* 调整记录 + 星号格子 */
.logs-card { width: 560px; }
#logs-list { max-height: 420px; overflow: auto; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.log-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; font-size: 13px; }
.log-time { color: #8a97a6; flex: none; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.log-user { font-weight: 600; flex: none; color: #2b5fd9; }
.log-action { word-break: break-all; }
td.cell .c.masked, td.cell.masked-cell { color: #98a6b5; }
td.cell.masked-cell { text-align: center; }
td.cell.masked-cell .c { color: #b3bfcc; letter-spacing: 2px; }

/* ---------- 个人课表：隐藏全空的行/列 ---------- */
.mine-empty-hint {
  margin: 18px auto 6px; padding: 14px 18px; max-width: 380px;
  border: 1px dashed var(--line-strong, #d7dbe3); border-radius: 12px;
  background: #fafbfc; color: #7d8794; font-size: 13.5px; text-align: center;
}

/* ---------- 课表查询：独立工作表 ---------- */
.query-toolbar {
  padding: 9px 14px;
  border: 1px solid #c9dcf5;
  border-radius: 10px;
  background: linear-gradient(180deg, #f3f8ff, #eef4fd);
}
.qt-title { font-size: 13.5px; color: var(--accent, #2c6ecb); white-space: nowrap; padding-right: 2px; }
.query-toolbar .q-item { display: inline-flex; align-items: center; gap: 6px; }
.query-toolbar .q-cap { font-size: 13px; color: var(--muted, #7d8794); white-space: nowrap; }
.query-toolbar .q-cls { min-width: 160px; }
.query-toolbar .q-kw { min-width: 160px; }
.query-toolbar .q-expr-item { flex: 1 1 380px; min-width: 320px; }
.query-count {
  font-size: 13px; font-weight: 500; color: var(--accent, #2c6ecb);
  padding: 3px 10px; border-radius: 20px; background: #eaf1fc; white-space: nowrap;
}
.query-count.muted { color: #97a1ad; font-weight: 400; background: #eef0f3; }
.query-count.zero { color: #b0553a; background: #fdeeea; }

/* 表达式输入框：等宽字体，占满剩余空间 */
.query-toolbar .q-expr {
  flex: 1 1 280px; min-width: 260px;
  padding: 6px 10px; border: 1px solid var(--line-strong, #d7dbe3); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
  background: #fff;
}
.query-toolbar .q-expr:focus { outline: none; border-color: var(--accent, #2c6ecb); box-shadow: 0 0 0 2px rgba(44,110,203,.12); }
/* 表达式错误提示（工具栏下方的独立块） */
#q-expr-err { display: none; margin: 6px 2px 0; font-size: 12.5px; color: #b0553a; }
#q-expr-err.on { display: block; }

/* 查询结果：按课表总表网格展示，未命中格空白 */
.query-result { margin-top: 12px; }
.query-result .mine-empty-hint { margin-top: 0; }



/* ---------- 查询结果分享落地页（免登录 /q/<token>） ---------- */
#sharepage { min-height: 100vh; }
#sharepage .topbar { position: sticky; top: 0; z-index: 10; }
#sharepage .brand .muted { display: block; line-height: 1.4; }
.sp-head:empty { display: none; }
.sp-cond {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px;
}
.sp-cond .q-cap { font-size: 13px; color: var(--muted, #7d8794); white-space: nowrap; }
.sp-cond strong { font-size: 14px; }

/* ---------------- 学生报名：表格与导入面板 ---------------- */
.enroll-table td:nth-child(1) { width: 56px; }
/* 列宽按 z53 的列序重新分配（教师姓名插在学生姓名之后）：
   # / 班级名称 / 班型 / 学生姓名 / 教师姓名 / 报名状态 / 跟踪人 (+ 操作)
   前 4 列给百分比，其余几列由各自的 .en-xxx-col 定固定宽。 */
.enroll-table td:nth-child(2) { width: 22%; }
.enroll-table td:nth-child(3) { width: 14%; }
.enroll-table td:nth-child(4) { width: 13%; }
.enroll-table tbody tr:hover { background: var(--accent-soft); }
/* 报名状态：行内下拉，只给「未填 / 在读 / 试听」 */
.en-status-col { width: 108px; }
.en-status-sel {
  width: 96px; padding: 3px 6px; font: inherit; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--muted);
}
.en-status-sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(13,110,60,.12); }
.en-status-sel.is-reading { border-color: #0d6e3c; background: #eef8f1; color: #0d6e3c; font-weight: 600; }
.en-status-sel.is-trial { border-color: #d08a1a; background: #fff7e8; color: #9a6200; font-weight: 600; }
/* 教师姓名：从课表算出的只读列（紧跟在「学生姓名」后面）。
   视觉上明显区别于「跟踪人」那个可编辑输入框 —— 这里是纯展示，点不动。 */
/* 教师姓名：与「跟踪人」一样是可编辑的行内输入框（手填一位老师） */
.en-teacher-col { width: 150px; max-width: 150px; }
.en-teacher-empty { color: #b6bfb6; }
.en-teacher-input {
  width: 100%; box-sizing: border-box; padding: 3px 6px; font: inherit; font-size: 13px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--fg);
}
.enroll-table tbody tr:hover .en-teacher-input { border-color: var(--line); }
.en-teacher-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px rgba(13,110,60,.12); }
.en-teacher-input::placeholder { color: #b6bfb6; }

/* 跟踪人：行内输入框，平时无框，聚焦才显形 */
.en-tracker-col { width: 130px; }
.en-tracker-input {
  width: 100%; box-sizing: border-box; padding: 3px 6px; font: inherit; font-size: 13px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--fg);
}
.enroll-table tbody tr:hover .en-tracker-input { border-color: var(--line); }
.en-tracker-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px rgba(13,110,60,.12); }
.en-tracker-input::placeholder { color: #b6bfb6; }

/* 老师端：班级/班型/学生姓名是管理侧字段，编辑时置灰只读，避免误改 */
#enroll-edit-panel input.locked {
  background: #f4f6f4; color: var(--muted); cursor: not-allowed;
  border-color: var(--line);
}
#enroll-edit-panel input.locked:focus { border-color: var(--line); box-shadow: none; }

/* 导入面板复用 #import-panel 的观感（选择器独立，避免相互影响） */
#enroll-import-panel textarea {
  width: 100%; box-sizing: border-box; margin: 10px 0 8px;
  padding: 9px 11px; font: 12.5px/1.6 ui-monospace, Consolas, 'Courier New', monospace;
  border: 1px solid var(--line-strong); border-radius: 8px; outline: none;
  background: #fff; resize: vertical; min-height: 120px; color: var(--fg);
}
#enroll-import-panel textarea:focus { border-color: var(--accent); }
#enroll-import-panel .imp-map-cols { display: flex; flex-wrap: wrap; gap: 8px 14px; }
#enroll-import-panel #en-imp-map { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfbfc; margin: 10px 0; }
#enroll-import-panel .imp-map-row { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 8px; }
#enroll-import-panel .imp-map-label { font-size: 12.5px; color: var(--muted); }
#enroll-import-panel .imp-map-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
#enroll-import-panel .imp-map-head { font-size: 12px; color: var(--muted); }
#enroll-import-panel .imp-map-sel {
  font: inherit; font-size: 12.5px; padding: 4px 7px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: #fff; outline: none; color: var(--fg);
}
#enroll-import-panel .imp-map-sel:focus { border-color: var(--accent); }
#enroll-import-panel .imp-ok {
  font-size: 13px; padding: 7px 11px; border-radius: 8px; margin: 6px 0;
  background: var(--accent-soft); color: #0d5c49;
}
#enroll-import-panel .imp-preview { margin-top: 6px; }
#enroll-import-panel .imp-empty { color: #b0b6bf; }
#enroll-import-panel .imp-mode { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
#enroll-import-panel .imp-mode .chk,
#enroll-import-panel .chk { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
#enroll-import-panel input[type="file"],
#enroll-import-panel input[type="radio"] {
  display: inline-block; width: auto; margin: 0; padding: 0;
  border: none; background: transparent; accent-color: var(--accent);
}
#enroll-import-panel input[type="file"][hidden] { display: none !important; }
#enroll-import-panel .err { color: #a33; font-size: 12.5px; margin: 8px 0 0; }
#enroll-import-panel .err.hidden { display: none; }
/* 底部提交栏：始终可见，主按钮固定在右下角 */
#enroll-import-panel .pop-actions {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 12px 0 0;
  border-top: 1px solid var(--line, #e6e8ec);
  position: sticky; bottom: 0;
  background: #fff; z-index: 2;
}
#enroll-import-panel .pop-actions .spacer { flex: 1; }
#enroll-import-panel #en-imp-run { min-width: 132px; }
#enroll-import-panel #en-imp-run:disabled { opacity: .5; cursor: not-allowed; }
#enroll-import-panel .imp-mode { padding: 8px 0 0; }

/* ---- 导入类弹窗：卡片限高 + 内容区滚动 + 底部操作栏常驻可见 ----
   否则预览表格渲染后卡片会超出视口，底部的「确认导入」被顶到屏幕外 */
#import-panel.modal,
#enroll-import-panel.modal {
  place-items: center; padding: 24px 16px; box-sizing: border-box; overflow: auto;
}
#import-panel .import-card,
#enroll-import-panel .import-card {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px); box-sizing: border-box;
  overflow: hidden; padding: 0;
}
/* 卡片里的所有直接子元素放进可滚动区，唯一点击栏固定在底部 */
#import-panel .import-card > *:not(.pop-actions),
#enroll-import-panel .import-card > *:not(.pop-actions) { flex: 0 0 auto; }
#import-panel .import-card > .imp-body,
#enroll-import-panel .import-card > .imp-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 22px 22px 0;
}
#import-panel .import-card > .pop-actions,
#enroll-import-panel .import-card > .pop-actions {
  flex: 0 0 auto; margin: 0; padding: 12px 22px 18px;
  border-top: 1px solid var(--line, #e6e8ec);
  position: static; background: #fff;
}
/* 预览表格在窄屏也能横向滚动，不撑破卡片 */
#import-panel .import-card .imp-preview,
#enroll-import-panel .import-card .imp-preview { width: 100%; }

/* ---------------- 兼职老师课表 ---------------- */
.pt-table { border-collapse: separate; border-spacing: 0; background: #fff; min-width: 50%; }

/* 免登录兼职课表分享页（/p/<token>）：只读展示，让表格自然撑开、可横向滚动 */
.pt-share-scroll { overflow: auto; max-height: none; }
.pt-share-scroll .pt-table { min-width: 0; }
.pt-share-scroll .pt-table th, .pt-share-scroll .pt-table td { pointer-events: none; }
.pt-table th, .pt-table td { border: 1px solid var(--line, #e6e8ec); padding: 7px 10px; font-size: 13px; }
.pt-table thead th {
  background: #f4f6f9; font-weight: 600; text-align: center; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.pt-table thead th:first-child, .pt-table thead th:nth-child(2) { z-index: 2; }
.pt-day-th, .pt-slot-th { color: var(--muted, #7d8794); font-weight: 500; }
.pt-table td.pt-day {
  background: #fafbfc; font-weight: 600; text-align: center; vertical-align: middle;
  color: var(--fg, #26313d); border-right: 2px solid var(--line-strong, #d7dbe3);
}
/* 兼职专用日期：只在兼职课表出现，课表总表看不到 —— 挂个小标提示老师 */
.pt-table td.pt-day .pt-only-badge {
  display: block; margin: 4px auto 0; width: fit-content;
  font-size: 10px; font-weight: 500; line-height: 1.6;
  padding: 0 5px; border-radius: 999px;
  color: #8a6d1f; background: #fdf3d8; border: 1px solid #f0dfa8;
  white-space: nowrap;
}
.pt-table td.pt-slot { background: #fafbfc; color: var(--muted, #7d8794); white-space: nowrap; text-align: center; }
.pt-table td.pt-break {
  background: repeating-linear-gradient(45deg, #f7f8fa, #f7f8fa 8px, #f1f3f6 8px, #f1f3f6 16px);
  color: #a6adb6; text-align: center; font-size: 12px; padding: 4px 10px;
}
.pt-room-th { min-width: 120px; }
.pt-room-th .pt-room-name { display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.pt-room-ops { display: inline-flex; gap: 2px; margin-left: 5px; vertical-align: middle; }
.pt-op {
  border: none; background: transparent; color: #9aa3ae; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 3px 4px; border-radius: 5px;
}
.pt-op:hover { background: #e8ecf2; color: var(--fg, #26313d); }
.pt-op.pt-op-del:hover { background: #fdeeea; color: #b0553a; }
/* 班课日期行尾「清」= 清空该天全部标记（z57）。橙色，和右边红色的「删除整行」区分开：
   清标记是轻操作（备注还在、行还在），删行是重操作。 */
.pt-op.pt-op-clear { font-size: 11px; }
.pt-op.pt-op-clear:hover { background: #fdf3e6; color: #a4712b; }
.pt-cell { min-width: 118px; max-width: 200px; height: 46px; text-align: center; vertical-align: middle; }
.pt-cell.filled { border-radius: 8px; }
.pt-cls { font-weight: 600; line-height: 1.3; word-break: break-all; }
.pt-tea { font-size: 11.5px; color: #5c6670; margin-top: 1px; }
.pt-cell.pt-editable { cursor: pointer; }
.pt-cell.pt-editable:hover { box-shadow: inset 0 0 0 2px var(--accent, #2c6ecb); }
#pt-room-panel .modal-card, #pt-edit-panel .modal-card { width: 380px; }

/* 兼职课表：来自课表总表的只读列 */
.pt-main-th { background: #eef4ec !important; }
.pt-main-badge {
  display: inline-block; margin-left: 5px; padding: 1px 7px;
  font-size: 10.5px; font-weight: 600; color: #0d6e3c;
  background: #d9efe0; border: 1px solid #bfe0cb; border-radius: 9px;
  vertical-align: middle;
}
.pt-cell.pt-main-cell { box-shadow: inset 0 0 0 1px rgba(13, 110, 60, .18); }
.pt-cell.pt-main-cell .pt-cls { font-weight: 500; }

/* 兼职课表：「隐藏空白行列」按钮激活态 */
.pt-empty-on { background: #eef4ec; border-color: #0d6e3c; color: #0d6e3c; font-weight: 600; }

/* 班课日期：批量操作条 */
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: #eef4ec; border-bottom: 1px solid #dbe7d8; flex-wrap: wrap; }
.bulk-bar select, .bulk-bar input { padding: 6px 10px; border: 1px solid #c8d8c4; border-radius: 6px; background: #fff; }
.bulk-bar .search { width: 220px; }

/* 班课日期：勾选列 / 备注编辑 / 课程列头操作 */
.cal-sel-col { width: 36px; text-align: center; }
.cal-sel-col input { cursor: pointer; }
.cal-table td.cal-note.editable { cursor: pointer; }
.cal-table td.cal-note.editable:hover { box-shadow: inset 0 0 0 2px #7cb342; }
.cal-note-input { width: 100%; box-sizing: border-box; border: 1px solid #7cb342; border-radius: 4px; padding: 2px 6px; font-size: 13px; }
.cal-tag-th { white-space: nowrap; }
.cal-tag-name { margin-right: 4px; }
.cal-tag-ops { display: inline-flex; gap: 2px; }

/* 班课日期：日期区间设定 */
.cal-date { padding: 5px 8px; border: 1px solid #c8d8c4; border-radius: 6px; background: #fff; font-size: 13px; color: #2c3e2c; }
.cal-date:focus { outline: none; border-color: #0d6e3c; box-shadow: 0 0 0 2px rgba(13,110,60,.15); }

/* 班课日期：删除日期行 */
.cal-del-col { width: 68px; text-align: center; white-space: nowrap; }
.cal-table tbody tr:hover td.cal-del-col .pt-op { opacity: 1; }
.cal-del-col .pt-op { opacity: .45; transition: opacity .15s; margin: 0 1px; }

/* 班课日期：表格区固定高度内部滚动 —— 表头 sticky 常驻，工具栏不再被长表格顶出屏幕 */
#view-calendar .grid-scroll { max-height: calc(100vh - 310px); min-height: 340px; }
#view-calendar .cal-table thead th { position: sticky; top: 0; z-index: 3; }

/* 班课日期：课程筛选 / 批量课程 —— 可手输模糊匹配下拉（combobox）面板 */
.combo-panel {
  position: fixed;
  z-index: 90;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  min-width: 190px;
  -webkit-overflow-scrolling: touch;   /* 手机上惯性滚动 */
  overscroll-behavior: contain;        /* 滚到头不带动页面滚动（否则会触发页面滚动把面板关掉） */
}
.combo-item {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-item b { color: var(--accent); }
.combo-item:hover, .combo-item.on { background: var(--accent-soft); }
.combo-item.combo-new { color: #b45309; font-weight: 500; }
.combo-item.combo-new b { color: #b45309; }
.combo-item.combo-empty { color: var(--muted); font-size: 13px; cursor: default; }
/* 「全部课程」：置于候选首项，用分隔线强调它是「不筛选 / 打全部」的快捷项 */
.combo-item.combo-all { color: #075985; font-weight: 600; border-bottom: 1px solid var(--line, #e5e7eb); margin-bottom: 2px; padding-bottom: 6px; }
#cal-bulk-tag { width: 200px; min-width: 160px; }

/* ---------------- 课程详细（寒暑假课程安排表） ---------------- */
.lg-title { font-size: 22px; font-weight: 700; text-align: center; letter-spacing: 6px; margin: 6px 0 10px; color: var(--text); }
.lg-table th, .lg-table td { text-align: center; }
.lg-table td.lg-on { color: var(--accent); font-weight: 700; line-height: 1.35; }
.lg-table td.lg-off { color: transparent; }
.lg-table tr.lg-total td { background: #fff3bf; font-weight: 700; border-top: 2px solid #e8c33a; }
.lg-table td.lg-sum { color: #b45309; font-variant-numeric: tabular-nums; }
.lg-table td.lg-lunar { color: #c2410c; }
/* 课程列表头第二行：时间段 + 教室（均来自课表总表反查） */
.lg-table tr.lg-meta-row th.lg-meta-th {
  background: #f6f8fb; font-weight: 400; padding: 2px 4px 4px; line-height: 1.4;
  vertical-align: top; border-bottom: 2px solid var(--line);
}
.lg-table .lg-slot { display: block; font-size: 11px; font-weight: 700; color: #0369a1; font-variant-numeric: tabular-nums; }
.lg-table .lg-room { display: block; font-size: 11px; color: var(--muted); }
/* 格子内附注：该课这天的时段与教室（与列头同源，方便直接照着排课） */
.lg-table td.lg-on .lg-c-slot { display: block; font-size: 10px; font-weight: 400; color: #0369a1; font-variant-numeric: tabular-nums; }
.lg-table td.lg-on .lg-c-room { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }
/* 联动班级徽章 */
#lg-link { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #e0f2fe; color: #075985; white-space: nowrap; }
#lg-link.hidden { display: none; }
#lg-link b { color: #0369a1; }
#lg-link button.tiny { padding: 1px 6px; font-size: 11px; line-height: 1.5; }
#lg-start, #lg-end { width: 138px; }

@media print {
  #tabs, .userbox, #view-ledger .toolbar, #view-ledger .hint, .bulk-bar, #sync-state { display: none !important; }
  .combo-panel, .combo-arrow { display: none !important; }  /* 打印时不输出任何打开中的下拉面板 */
  .view { display: none !important; }
  #view-ledger { display: block !important; }
  .grid-scroll { overflow: visible !important; max-height: none !important; border: none !important; }
  .lg-title { font-size: 26px; margin-bottom: 14px; }
  .lg-table { width: 100%; font-size: 11px; }
  .lg-table th, .lg-table td { border: 1px solid #999 !important; }
  tr.lg-total td { background: #fff3bf !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lg-table tr.lg-meta-row th.lg-meta-th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lg-table .lg-slot, .lg-table td.lg-on .lg-c-slot { color: #1d4ed8 !important; }
}

/* ---------- 手机端抽屉：从底部上滑铺满 70vh ---------- */
@media (max-width: 720px) {
  #edit-drawer.drawer {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 75vh;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  #edit-drawer.drawer.open { transform: translateY(0); }
}

/* ---------- 分享账号弹窗：文本域可全选复制 ---------- */
#share-panel .share-text {
  display: block; width: 100%; min-height: 150px; margin-top: 12px;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  font: inherit; font-size: 13px; line-height: 1.6; color: var(--ink, #1d1f24);
  background: #fafbfc; resize: vertical; white-space: pre;
}

/* ---------- 整周视图：每天一个独立表块 ----------
   原来 7 天共用一横排教室列，教室一多就横向溢出、右侧教室看不见。
   改成每天一块后，每块各自带完整教室表头，左右不用滚就能看到本天所有教室。 */
.week-blocks { display: flex; flex-direction: column; gap: 18px; }
/* 注意：这里不能用 overflow:hidden —— 会把内层 .grid-scroll 的横向滚动一起锁死，
   教室列一多右侧就被裁掉。圆角改由头部/表格自身处理。 */
.week-block { border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; }
.week-block-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px;
  padding: 9px 12px; background: #eef1f7;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 10px 10px 0 0;
}
.week-block-head strong { font-size: 14px; color: #1d1f24; }
.week-block-head .week-rooms {
  color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1 1 auto; min-width: 0;
}
/* 表块内的表格区：教室列多时横向滚动，保证每间教室都能看到 */
.week-block .grid-scroll { max-height: none; border: 0; border-radius: 0 0 10px 10px; background: transparent; }
.week-block .tt thead th { position: static; top: auto; }  /* 每块自己一屏，表头不必吸顶 */
/* 整周视图下每列收窄（教室内容量/地址已在表头紧凑显示），尽量一屏看全一天的教室 */
.week-block .tt { width: auto; }   /* 不撑满容器，避免右侧留一大片空白 */
.week-block .tt thead th { min-width: 80px; padding: 6px 4px; }
.week-block .tt td.cell { min-width: 80px; padding: 4px 4px; }
.week-block .tt thead th .room { font-size: 12px; }
.week-block .tt td.cell .c { font-size: 12px; }
/* 整周视图里每块只显示一天，不再需要「周X · 学期」分隔行（已在块头显示） */
.week-block .tt .daysep { display: none; }

/* ---------------- 「显示教室」：按日期分块 ----------------
   勾上后，每个日期单独成块：块头写日期，表内最左是「时间」（行表头），
   右侧是这一天用到的教室列 —— 时间行正对着该天的教室。
   与整周视图同构，所以复用 .week-block 这套结构，只在细节上区分。 */
.day-blocks { gap: 14px; }
.day-blocks .week-block-head { background: #eef1f7; }
/* 分块模式下的时段列固定窄一点，教室列给足宽度 */
.day-blocks .week-block .tt th.slot,
.day-blocks .week-block .tt th.corner { min-width: 92px; }
/* 兼职课表分块：表里没有日期列，容器不再需要横向滚动边框 */
.pt-dayblock-table { width: auto; margin: 0; }
.week-block .pt-dayblock-table { border-radius: 0; }
.week-block .pt-table td.pt-day,
.week-block .pt-table th.pt-day-th { display: none; }   /* 保险：分块模式不该有日期列 */

@media (max-width: 720px) {
  .week-blocks { gap: 12px; }
  .week-block-head { padding: 7px 9px; }
  .week-block-head strong { font-size: 13px; }
  .week-block-head .week-rooms { display: none; }  /* 手机上行宽有限，教室名看表头即可 */
}

/* ============ 控制台（超级管理员）：学校管理 ============ */

/* 登录后、进入某校前的「选学校」卡片 */
.schoolpick-card { width: 520px; max-width: calc(100vw - 32px); }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; max-height: 46vh; overflow: auto; }
.pick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line, #e3e6ee);
  border-radius: 10px; background: #fff; cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s;
}
.pick-item:hover { border-color: #4c7dff; background: #f7f9ff; }
.pick-item[disabled] { opacity: .5; cursor: not-allowed; }
.pick-item .pick-name { font-weight: 600; }
.pick-item .pick-meta { font-size: 12px; color: #7a8194; margin-top: 2px; }
.pick-item .pick-main { flex: 1; min-width: 0; }
.pick-foot { display: flex; justify-content: flex-end; }

/* 控制台统计条 */
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 16px; }
.stat-card {
  flex: 1 1 128px; min-width: 118px; padding: 12px 14px;
  border: 1px solid var(--line, #e3e6ee); border-radius: 10px; background: #fff;
}
.stat-card .stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-lab { font-size: 12px; color: #7a8194; margin-top: 3px; }
.stat-card.warn .stat-num { color: #d9534f; }

/* 控制台表格里的学校名与操作按钮 */
#console-wrap table.data td.school-name { font-weight: 600; }
.school-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; line-height: 18px; vertical-align: middle;
}
.school-tag.on { background: #e8f5ec; color: #2c7a45; }
.school-tag.off { background: #fdeaea; color: #c0392b; }
.school-tag.cur { background: #e8efff; color: #2c53c7; margin-left: 6px; }
.row-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.row-acts button { padding: 3px 9px; font-size: 12px; }
.row-acts button.danger { color: #c0392b; border-color: #f0c4c0; }
.row-acts button.danger:hover { background: #fdeaea; }

/* ---------- 课表总表：导出 Excel 菜单 ---------- */
.export-card { width: 430px; }
.export-card .muted { line-height: 1.7; }
.exp-btn {
  display: block; width: 100%; text-align: left; margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, background .15s;
}
.exp-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.exp-btn b { display: block; font-size: 14px; font-weight: 600; }
.exp-btn span { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- 分享注册制：邀请条与邀请面板 ---------- */
.invite-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #f8faf8;
}
.invite-bar-main { flex: 1 1 auto; min-width: 260px; }
.invite-bar-main strong { margin-right: 8px; font-size: 13.5px; }
.invite-bar-main .muted { line-height: 1.6; }
.invite-bar-actions { flex: 0 0 auto; }

.invite-panel {
  margin-top: 12px; padding: 15px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fcfdfc;
}
.invite-head { display: flex; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }
.invite-head strong { font-size: 14px; }

/* 校长的「邀请老师 / 邀请学生」两块切换页签。
   一次只展开一块：两块同时铺开太长，二维码也会挤在一起。 */
.invite-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
  border-bottom: 1px solid var(--line); padding-bottom: 0; }
.invite-tab {
  position: relative; border: 1px solid transparent; border-bottom: none;
  background: transparent; color: var(--muted); cursor: pointer;
  padding: 7px 16px; font-size: 13px; border-radius: 8px 8px 0 0;
  margin-bottom: -1px; font-family: inherit; transition: background .12s, color .12s;
}
.invite-tab:hover { background: #f2f5f3; color: var(--fg); }
.invite-tab.on {
  background: #fff; border-color: var(--line); color: var(--fg);
  font-weight: 600; box-shadow: 0 1px 0 #fff;
}
.invite-tab .invite-off { margin: 0 0 0 6px; padding: 1px 6px; font-size: 10.5px; }
.invite-off {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px;
  background: #fdeaea; color: #c0392b;
}
.invite-body { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.invite-qr { flex: 0 0 auto; }
.invite-qr img {
  display: block; width: 150px; height: 150px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.invite-info { flex: 1 1 320px; min-width: 280px; }
.invite-link {
  padding: 9px 11px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: #fff; font-size: 12.5px; word-break: break-all; user-select: all;
}
.invite-note { margin: 9px 0 0; line-height: 1.7; }
.invite-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.invite-acts button.danger { color: #c0392b; border-color: #f0c4c0; }
.invite-acts button.danger:hover { background: #fdeaea; }
.invite-joined {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
}
.invite-chip {
  padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: #eef2f7; color: #465060;
}

/* 邀请注册页 /join/<邀请码> */
.join-inviter { margin: -4px 0 10px; }
#join-form label { margin-bottom: 12px; }
.join-foot { margin-top: 14px; text-align: center; }
.join-foot a { color: var(--accent); text-decoration: none; }
.join-foot a:hover { text-decoration: underline; }

/* 注册身份选择：两张可点的卡片，选中的那张描边+浅底，一眼看出选了什么 */
.join-role { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; align-items: stretch; }
.join-role-opt {
  display: flex; flex-direction: column;
  margin: 0 !important; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.join-role-opt:hover { border-color: var(--line-strong); background: #fafbfa; }
.join-role-opt input { position: absolute; opacity: 0; pointer-events: none; }
.join-role-opt .join-role-txt { display: block; font-size: 13.5px; font-weight: 600; color: var(--fg); line-height: 1.3; }
.join-role-opt .join-role-hint { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
/* :has() 让卡片随内部 radio 的选中状态变色（现代浏览器均支持）；
   下面的 .on 是 JS 兜底，老浏览器也照样有反馈。 */
.join-role-opt:has(input:checked), .join-role-opt.on {
  border-color: var(--accent); background: var(--accent-soft, #eef4ff);
}
.join-role-opt:has(input:checked) .join-role-txt, .join-role-opt.on .join-role-txt { color: var(--accent); }
.join-role-opt:has(input:focus-visible) { outline: 2px solid var(--accent-soft, #eef4ff); }
/* 身份被锁定（码本身已定死角色、且只开一种）时的提示条 */
.join-role-lock { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.join-role[hidden] { display: none !important; }
