/* 课表助手 —— 样式 */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1f2430;
  --ink-2: #5a6274;
  --ink-3: #8a92a6;
  --line: #e4e7ee;
  --line-2: #eef0f5;
  --brand: #3b6ef5;
  --brand-d: #2b56cc;
  --brand-soft: #eaf0ff;
  --friend: #f0a63c;
  --green: #24a06b;
  --green-soft: #e8f7f0;
  --red: #d8443c;
  --red-soft: #fdeceb;
  /* 共同空闲时间的「逐节对照」用浅色底（格子里的字改成对应的深色，才看得清） */
  --green-light: #a9e5c4;     /* 双方都有空 */
  --red-light: #ffc0c0;       /* 我有空、对方有课 */
  --blue-light: #a9d1ff;      /* 对方有空、我有课 */
  --radius: 12px;
  --shadow: 0 1px 2px rgba(24, 32, 56, .05), 0 6px 20px rgba(24, 32, 56, .06);
  --shadow-lg: 0 12px 40px rgba(24, 32, 56, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.is-dragging::after {
  content: "松开鼠标导入课程表";
  position: fixed;
  inset: 12px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand);
  background: rgba(59, 110, 245, .08);
  border: 2px dashed var(--brand);
  border-radius: 18px;
  pointer-events: none;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 26px; }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: .3px; }
.brand-sub { margin: 0; font-size: 12px; color: var(--ink-3); }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- 通用 ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 9px;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { border-color: #ccd3e2; background: #fafbfe; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef1f7; }
.btn-danger { color: var(--red); border-color: #f2c9c6; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }

.icon-btn {
  border: 0; background: transparent; font-size: 16px; cursor: pointer;
  color: var(--ink-3); width: 30px; height: 30px; border-radius: 8px;
}
.icon-btn:hover { background: #eef1f7; color: var(--ink); }

.hint { font-size: 12px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.spacer { flex: 1; }

/* ---------- 同步状态 ---------- */
.sync-status {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); color: var(--ink-3); background: #f7f8fb;
  white-space: nowrap;
}
.sync-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: none;
}
.sync-status.is-checking, .sync-status.is-saving { color: #a8681a; background: #fffaf0; border-color: #f2e2c4; }
.sync-status.is-synced { color: #1c7a53; background: var(--green-soft); border-color: #bfe6d4; }
.sync-status.is-offline { color: var(--ink-3); background: #f2f4f9; }
.sync-status.is-error { color: #9c2f28; background: var(--red-soft); border-color: #f2c9c6; }
.sync-status.is-saving::before { animation: kb-pulse 1s ease-in-out infinite; }
@keyframes kb-pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* ---------- 人员 ---------- */
.people { display: flex; gap: 12px; margin-bottom: 14px; }
.person-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: .16s;
}
.person-tab:hover { border-color: #cfd7e6; }
.person-tab.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.person-tab[data-person="friend"].is-active { border-color: var(--friend); box-shadow: 0 0 0 3px #fdf1e0; }
.pt-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.pt-avatar-friend { background: var(--friend); }
.pt-info { display: flex; flex-direction: column; line-height: 1.35; }
.pt-name { font-weight: 600; font-size: 14.5px; }
.pt-count { font-size: 12px; color: var(--ink-3); }

/* ---------- 操作栏 ---------- */
.actionbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.person-meta { font-size: 12px; color: var(--ink-3); }

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; display: flex; flex-direction: column;
}
.stat-num { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.stat-label { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 视图切换 ---------- */
.viewtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.view-tab {
  border: 0; background: transparent; font: inherit; font-size: 14px;
  padding: 9px 4px; margin-right: 20px; cursor: pointer; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.view-tab:hover { color: var(--ink); }
.view-tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.subject { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.subject b { color: var(--ink); font-size: 14px; padding: 0 2px; }
.subject-label { color: var(--ink-3); }
.btn-today { padding: 5px 11px; font-size: 12.5px; color: var(--brand); border-color: #cddcff; background: var(--brand-soft); }
.btn-today:hover { background: #dfe8ff; border-color: #b9cdff; }

/* ---------- 周次 ---------- */
.weekbar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; align-items: center; }
.week-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.week-chip {
  min-width: 32px; padding: 4px 9px; font: inherit; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
  cursor: pointer; color: var(--ink-2); position: relative;
}
.week-chip:hover { border-color: #cfd7e6; }
.week-chip.is-empty { opacity: .45; }
.week-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.week-chip.is-thisweek { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.week-chip.is-thisweek.is-active { color: #fff; }
.week-chip i {
  font-style: normal; font-size: 8.5px; display: block; line-height: 1;
  margin-top: 1px; opacity: .85;
}

/* ---------- 手机端单日视图（默认隐藏，窄屏显示） ---------- */
.view-day { display: none; }
.day-bar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.day-week { font-size: 13px; font-weight: 600; color: var(--brand); }
.day-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 12px; }
.day-tab {
  font: inherit; cursor: pointer; padding: 6px 2px 5px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink-2);
}
.day-tab .dt-name { font-size: 14px; font-weight: 600; }
.day-tab .dt-count { font-size: 10px; color: var(--ink-3); }
.day-tab.is-empty .dt-count { opacity: .5; }
.day-tab.is-today { border-color: #f0c98a; background: #fffaf0; }
.day-tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-tab.is-active .dt-count { color: #dce6ff; }

.day-list { display: flex; flex-direction: column; gap: 8px; }
.day-card {
  display: flex; gap: 0; align-items: stretch; position: relative;
  border-radius: 12px; border: 1px solid rgba(0, 0, 0, .06); border-left: 4px solid #999;
  overflow: hidden; cursor: pointer; box-shadow: 0 1px 3px rgba(24, 32, 56, .05);
  min-height: calc(var(--span, 1) * 38px + 22px);
}
.day-card:active { transform: scale(.995); }
.day-card.is-resched { outline: 1.5px dashed #e0952f; outline-offset: -2px; }
.day-card-time {
  flex: none; width: 74px; padding: 9px 6px; text-align: center;
  background: rgba(255, 255, 255, .55); border-right: 1px solid rgba(0, 0, 0, .05);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.day-card-time b { font-size: 11.5px; color: var(--ink-2); }
.day-card-time span { font-size: 10px; color: var(--ink-3); line-height: 1.35; }
.day-card-body { flex: 1; padding: 9px 10px; min-width: 0; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.day-card-name { font-size: 14px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.day-card-line { font-size: 11.5px; color: #4c5468; line-height: 1.4; word-break: break-word; }
.day-card-line.muted { color: var(--ink-3); }
.day-flag { font-size: 10px; background: #e0952f; color: #fff; padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; }
.day-card-eq { flex: none; width: 26px; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }

.day-empty { text-align: center; padding: 40px 16px; background: var(--panel); border: 1px dashed #d5dae6; border-radius: var(--radius); color: var(--ink-2); }
.day-empty-icon { font-size: 30px; margin-bottom: 6px; }
.day-empty-sub { font-size: 12px; color: var(--ink-3); margin: 4px 0 12px; }

/* ---------- 设置里的开学日期 ---------- */
.settings-group { margin-top: 4px; }
.settings-group label { font-size: 13px; color: var(--ink); }
.field-hint { margin: -1px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.55; }
.field-hint b { color: var(--ink-2); }
.now-preview {
  font-size: 12.5px; padding: 9px 12px; border-radius: 9px; line-height: 1.5;
  background: #f2f4f9; color: var(--ink-2); border: 1px solid var(--line);
}
.now-preview.is-ok { background: var(--green-soft); border-color: #bfe6d4; color: #1c7a53; }
.now-preview.is-warn { background: #fffaf0; border-color: #f2e2c4; color: #8a6318; }

.grid-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }

/* ---------- 课程表网格 ---------- */
.tt-scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tt-grid {
  display: grid;
  /* 周一到周五 5 列，星期在最上面一行 */
  grid-template-columns: 68px repeat(5, minmax(132px, 1fr));
  grid-template-rows: auto repeat(var(--rows), 46px);
  min-width: 760px;
  gap: 3px;
  padding: 8px;
}
.tt-corner, .tt-dayhead {
  grid-row: 1;              /* 星期永远在第 1 行（下面才是各节课） */
  background: #f2f4f9;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  padding: 7px 4px;
  position: sticky; top: 0; z-index: 2;
}
.tt-corner { grid-column: 1; }

/* 数据里有排在周末的课时提示一句 */
.tt-note {
  margin-top: 8px; padding: 8px 10px;
  font-size: 12.5px; color: #8a6100;
  background: #fff8e6; border: 1px solid #ffe0a3; border-radius: 8px;
}

.tt-period {
  grid-column: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-3);
  background: #fafbfd;
  border-radius: 7px;
  line-height: 1.25;
}
.tt-period b { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.tt-period.is-pair-end { border-bottom: 2px solid var(--line); }

.tt-card {
  border-radius: 9px;
  border: 1px solid rgba(0, 0, 0, .06);
  border-left: 3px solid #999;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform .12s, box-shadow .12s;
  display: grid;
  grid-template-columns: repeat(var(--lanes, 1), minmax(0, 1fr));
  grid-auto-rows: 100%;
  z-index: 1;
}
.tt-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(24, 32, 56, .14); z-index: 3; }
.tt-card.is-resched { outline: 1.5px dashed #e0952f; outline-offset: -2px; }

.tt-card-inner {
  grid-column: var(--lane, 1);
  grid-row: 1;
  padding: 4px 7px;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.tt-name { font-size: 12.2px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.tt-loc { font-size: 10.8px; color: #4c5468; line-height: 1.3; }
.tt-meta { font-size: 10.3px; color: #6b7288; line-height: 1.3; }
.tt-teacher, .tt-time { font-size: 10.3px; color: #7b8298; }
.tt-flag {
  position: absolute; top: 3px; right: 4px;
  font-size: 9.5px; background: #e0952f; color: #fff;
  padding: 0 4px; border-radius: 4px;
}

/* ---------- 清单 ---------- */
.list-table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); font-size: 13px;
}
.list-table th {
  background: #f2f4f9; text-align: left; padding: 9px 12px;
  font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap;
}
.list-table td { padding: 8px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
.list-table tr:hover td { background: #fafbfe; }
.cell-name { font-weight: 600; }
.cell-ops { white-space: nowrap; text-align: right; }
.tag { font-size: 10.5px; background: #fdf1e0; color: #a8681a; padding: 0 5px; border-radius: 4px; }
.mini {
  font: inherit; font-size: 12px; padding: 3px 8px; margin-left: 4px;
  border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--ink-2);
}
.mini:hover { border-color: #cfd7e6; color: var(--ink); }
.mini-danger:hover { color: var(--red); border-color: #f2c9c6; background: var(--red-soft); }

/* ---------- 共同空闲 ---------- */
.free-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 13px; height: 13px; border-radius: 4px; display: inline-block; }
.lg-both::before { background: var(--green-light); }
.lg-me::before { background: var(--red-light); }
.lg-friend::before { background: var(--blue-light); }
.lg-busy::before { background: #e6e9f0; }
.free-week { margin-left: auto; color: var(--ink-3); }

.rec-box {
  background: var(--green-soft); border: 1px solid #bfe6d4; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 13px;
}
.rec { background: #fff; border: 1px solid #bfe6d4; color: #1c7a53; padding: 3px 9px; border-radius: 7px; font-weight: 600; font-size: 12.5px; }

.free-table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 20px; }
.free-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.free-table th { background: #f2f4f9; text-align: left; padding: 9px 14px; font-size: 12px; color: var(--ink-2); }
.free-table td { padding: 10px 14px; border-top: 1px solid var(--line-2); }
.free-table tr.is-none td { color: var(--ink-3); }
.free-table .num { text-align: right; color: var(--green); font-weight: 600; white-space: nowrap; }
.range {
  display: inline-flex; align-items: baseline; gap: 6px; margin-right: 10px;
  background: var(--green-soft); border: 1px solid #cdeade; color: #1c7a53;
  padding: 2px 9px; border-radius: 7px; font-weight: 600; font-size: 12.5px;
}
.range i { font-style: normal; font-weight: 400; color: #4f9679; font-size: 11.5px; }

.sub-title { font-size: 14px; margin: 0 0 10px; }
.free-grid { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); overflow-x: auto; }
.free-row { display: grid; grid-template-columns: 68px repeat(5, minmax(96px, 1fr)); gap: 3px; margin-bottom: 3px; min-width: 560px; }
.free-head { margin-bottom: 6px; }
.free-label { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-3); background: #fafbfd; border-radius: 7px; line-height: 1.25; }
.free-label b { font-size: 11.5px; color: var(--ink-2); }
.free-dayhead { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: #f2f4f9; border-radius: 8px; padding: 6px 2px; }
.free-cell { height: 34px; border-radius: 7px; display: grid; place-items: center; font-size: 11.5px; background: #eef0f5; color: transparent; }
/* 都是浅色底 + 同色系深色字：浅绿=双方都有空；浅红=我有空、对方有课；浅蓝=对方有空、我有课；灰=两人都有课 */
.free-cell.is-both { background: var(--green-light); color: #10603c; font-weight: 600; }
.free-cell.is-me { background: var(--red-light); color: #9a2b24; }
.free-cell.is-friend { background: var(--blue-light); color: #1d4f8c; }
.free-cell.is-busy { background: #eceff5; }

/* ---------- 时间待定 ---------- */
.unscheduled {
  margin-top: 22px; background: #fffaf0; border: 1px solid #f2e2c4;
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px;
}
.unsched-title { font-weight: 600; margin-bottom: 6px; color: #8a6318; }
.unscheduled ul { margin: 0; padding-left: 18px; }
.unscheduled li { margin: 4px 0; }

/* ---------- 空状态 ---------- */
.empty { background: var(--panel); border: 1px dashed #d5dae6; border-radius: var(--radius); padding: 50px 20px; text-align: center; }
.empty-icon { font-size: 34px; margin-bottom: 8px; }
.empty h3 { margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 0 18px; color: var(--ink-3); font-size: 13px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(22, 28, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(560px, 100%); padding: 20px 22px; max-height: 90vh; overflow: auto;
}
.modal-box-wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 16px; }

.form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.field input[type=text], .field select {
  font: inherit; font-size: 13.5px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  width: 100%;
}
.field input:focus, .field select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field input[type=time] { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.check { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.check input { width: auto; }
.raw { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-3); margin: 0; word-break: break-all; }
.raw:empty { display: none; }

.modal-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-actions-split { align-items: center; }
.settings-foot { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; line-height: 1.6; color: var(--ink-3); }
.period-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pt-row { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); }
.pt-row span { width: 46px; flex: none; }
.pt-row input { width: 92px; }

/* ---------- 导入预览 ---------- */
#preview h3 { margin: 0 0 4px; font-size: 16px; }
.preview-sub { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.preview-warn { background: #fffaf0; border: 1px solid #f2e2c4; border-radius: 10px; padding: 8px 10px 8px 28px; margin: 0 0 12px; font-size: 12.5px; color: #8a6318; }
.preview-empty { background: var(--red-soft); border: 1px solid #f2c9c6; color: #9c2f28; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.preview-body { display: grid; gap: 10px; margin-bottom: 14px; }
.preview-day { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.preview-dayhead { background: #f2f4f9; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.preview-item { display: flex; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line-2); font-size: 12.8px; flex-wrap: wrap; }
.pi-time { color: var(--brand); font-weight: 600; flex: none; min-width: 74px; }
.pi-name { font-weight: 600; }
.pi-meta { color: var(--ink-3); font-size: 12px; }

/* ---------- 其他 ---------- */
.page-footer { margin-top: 34px; text-align: center; font-size: 12px; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 14px);
  background: #222a3c; color: #fff; padding: 9px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .22s; z-index: 300;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .25);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ================= 手机 / 窄屏适配 ================= */

/* 中等宽度：统计两列，表单两列 */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form { grid-template-columns: repeat(2, 1fr); }
  .period-times { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
}

/* 窄屏：课程表换成「一天一张卡片」的纵向视图，整周网格隐藏 */
@media (max-width: 760px) {
  .view-week { display: none; }
  .view-day { display: block; }

  .topbar { flex-wrap: wrap; gap: 8px; }
  .brand-sub { display: none; }
  .brand h1 { font-size: 16px; }

  .people { gap: 8px; }
  .person-tab { padding: 10px 12px; }
  .pt-avatar { width: 32px; height: 32px; font-size: 13px; }
  .pt-name { font-size: 13.5px; }
  .pt-count { font-size: 11px; }

  .actionbar { gap: 8px; }
  .actionbar .btn { flex: 1; justify-content: center; min-height: 40px; }
  .actionbar .person-meta { flex-basis: 100%; }
  .actionbar .hint { display: none; }

  .stats { gap: 8px; }
  .stat { padding: 8px 12px; }
  .stat-num { font-size: 15px; }

  .viewtabs { margin-bottom: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .view-tab { margin-right: 16px; white-space: nowrap; }

  .subject { font-size: 12.5px; }
  .btn-today { flex: none; }

  /* 周次横向滑动，不再换行堆好几排 */
  .weekbar {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: thin;
  }
  .week-chip { flex: none; }
  .week-sep { flex: none; }

  /* 设置窗口在小屏上变成全屏面板 */
  .modal { padding: 0; align-items: stretch; }
  .modal-box {
    width: 100%; max-height: 100%; border-radius: 0; padding: 16px 14px;
    min-height: 100vh;
  }
  .form { grid-template-columns: 1fr; }
  .period-times { grid-template-columns: repeat(2, 1fr); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; justify-content: center; }
  .modal-actions-split .btn-danger { flex-basis: 100%; order: 9; }

  /* 清单在小屏上变成卡片列表 */
  .list-table, .list-table thead, .list-table tbody, .list-table tr, .list-table td { display: block; width: 100%; }
  .list-table thead { display: none; }
  .list-table { border: 0; background: transparent; box-shadow: none; }
  .list-table tr {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
  }
  .list-table td { border: 0; padding: 2px 0; display: flex; gap: 10px; font-size: 13px; }
  .list-table td::before {
    content: attr(data-label); flex: none; width: 42px;
    color: var(--ink-3); font-size: 12px;
  }
  .list-table td.cell-name { font-size: 14.5px; margin-bottom: 4px; }
  .list-table td.cell-name::before { display: none; }
  .list-table td.cell-ops { justify-content: flex-end; margin-top: 6px; }
  .list-table td.cell-ops::before { display: none; }

  /* 共同空闲：表格也变成卡片 */
  .free-table, .free-table thead, .free-table tbody, .free-table tr, .free-table td { display: block; width: 100%; }
  .free-table thead { display: none; }
  .free-table { border: 0; }
  .free-table tr { border-bottom: 1px solid var(--line-2); padding: 8px 0; }
  .free-table td { border: 0; padding: 3px 0; }
  .free-table td:first-child { font-weight: 600; }
  .free-table .num { text-align: left; }
  .free-grid .free-row { min-width: 0; grid-template-columns: 54px repeat(5, minmax(0, 1fr)); }
  .free-label { font-size: 10px; }
  .free-label b { font-size: 10px; }
  .free-cell { height: 30px; font-size: 10px; }
  .free-dayhead { font-size: 11px; padding: 5px 1px; }
  .free-legend { gap: 10px; font-size: 12px; }
  .free-week { margin-left: 0; flex-basis: 100%; }
  .rec-box { font-size: 12.5px; }
}

@media (max-width: 400px) {
  .day-card-time { width: 62px; }
  .day-card-name { font-size: 13.5px; }
  .pt-count { display: none; }
  .person-tab { justify-content: center; }
}
