/* ==========================================================================
   课表与签到 · 共享样式
   设计目标：手机单手可用 + 桌面信息密度高；深浅色自适应；无第三方依赖。
   ========================================================================== */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --surface-3: #e4e8ef;
  --text: #15181e;
  --text-dim: #5b6472;
  --text-faint: #8b93a1;
  --line: #dfe3ea;
  --brand: #2f6df6;
  --brand-soft: #e5edfe;
  --brand-text: #ffffff;
  --present: #15a34a;
  --absent: #dc2f2f;
  --late: #d97a00;
  --leave: #2563eb;
  --unknown: #9aa2ae;
  /* 单双周 / 隔周标签用紫色，跟「答疑」的橙、合班的品牌蓝区分开 */
  --week: #6d4ce0;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);
  --radius: 14px;
  --radius-sm: 9px;
  --tabbar-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #181c22;
    --surface-2: #1f242c;
    --surface-3: #272d37;
    --text: #e9edf3;
    --text-dim: #a3adbb;
    --text-faint: #7b8593;
    --line: #2b313b;
    --brand: #5b8cff;
    --brand-soft: #1d2a48;
    --brand-text: #0b0e12;
    --present: #35c46a;
    --absent: #f0605f;
    --late: #f0a63a;
    --leave: #5b8cff;
    --unknown: #6b7482;
    --week: #b9a5ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 900px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: var(--brand);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  line-height: 1.3;
}

/* ------------------------------------------------------------------ 顶栏 */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.appbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand__mark {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #9b5bff));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  flex: none;
}

.appbar__spacer {
  flex: 1 1 auto;
}

.appnav {
  display: none;
  gap: 4px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 10px;
}

@media (min-width: 900px) {
  .appnav {
    display: flex;
  }
}

.appnav a {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
}

.appnav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------- 底部导航 */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 900px) {
  .tabbar {
    display: none;
  }
}

.tabbar a {
  flex: 1;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.tabbar a[aria-current="page"] {
  color: var(--brand);
}

.tabbar svg {
  width: 22px;
  height: 22px;
}

/* ------------------------------------------------------------------ 布局 */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 16px 32px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__body {
  padding: 12px 14px;
}

.muted {
  color: var(--text-dim);
}

.faint {
  color: var(--text-faint);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------------- 控件 */

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 13px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
}

.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--brand) 88%, #000);
}

.btn--ghost {
  background: transparent;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

select.input,
input.input,
textarea.input {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  min-width: 0;
}

textarea.input {
  width: 100%;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  resize: vertical;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface-3);
  color: var(--text-dim);
  white-space: nowrap;
}

.chip--brand {
  background: var(--brand-soft);
  color: var(--brand);
}

/* 顶部重要通知：所有页面共用（挂在顶栏下面） */
.notices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 0;
}

.notice {
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  padding: 9px 11px;
}

.notice__head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.notice__icon {
  font-size: 16px;
  line-height: 1.3;
}

.notice__main {
  flex: 1;
  min-width: 0;
}

.notice__title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.notice__body {
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.notice__meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 3px;
}

.notice__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.notice__comments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notices__actions {
  display: flex;
  justify-content: flex-end;
}

/* 课次面板里的一条讨论发言 */
.comment {
  position: relative;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2, transparent);
}

.comment .sharebtn {
  position: absolute;
  top: 5px;
  right: 5px;
}

/* 课型标签（大课 лекция / 小课 семинар）：原件不标类型，是判出来的，
   所以做得比其它标签轻——它是提示，不是状态。 */
.chip--track {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-weight: 600;
}

/* 整周网格的格子小，课型跟在课名后面用更小的字号 */
.cell__track {
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-faint);
}

.chip--warn {
  background: color-mix(in srgb, var(--late) 18%, transparent);
  color: var(--late);
}

/* 原件标注的单双周 / 隔周 */
.chip--week {
  background: color-mix(in srgb, var(--week) 16%, transparent);
  color: var(--week);
}

/* 「本周不上」：这节课原件标了单双周，这周轮不到它 */
.chip--off {
  background: var(--surface-3);
  color: var(--text-dim);
}

/* 手动加上去的课：绿色，与官方课表区分开 */
.chip--manual {
  background: color-mix(in srgb, var(--present) 16%, transparent);
  color: var(--present);
}

/* -------------------------------------------------------------- 课表页 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar__grow {
  flex: 1 1 160px;
}

.daypicker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 2px 0 6px;
}

.daypicker button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 11px;
  padding: 7px 2px;
  min-width: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.weeknav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.weeknav .btn {
  padding: 5px 10px;
  font-size: 12.5px;
}

/* 整周表的周选择：跟按钮同高，窄屏也不挤。
   选择器带上 select 是为了压过 select.input 的宽度；周标签比日期长，所以放宽到 240px。 */
select.weeknav__week {
  width: auto;
  max-width: 240px;
  padding: 4px 8px;
  font-size: 12.5px;
}

.daypicker button b {
  font-size: 13.5px;
  font-weight: 650;
  color: inherit;
}

.daypicker button span {
  font-size: 10.5px;
  opacity: 0.8;
}

.daypicker button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.daypicker button.is-today {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 45%, transparent);
}

/* 课程卡片 */

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.lesson {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 11px 13px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 11px;
}

.lesson--now {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-sm);
}

/* 这周轮不到的课（单双周）：淡化 + 虚线边框，仍然点得开看作业与资料。
   左侧那条 4px 色条（border-left）保持实线，免得看起来像"课被删了" */
.lesson--off {
  opacity: 0.6;
  border-top-style: dashed;
  border-right-style: dashed;
  border-bottom-style: dashed;
}

.lesson--empty {
  border-left-color: var(--line);
  opacity: 0.55;
  grid-template-columns: 62px 1fr;
}

.lesson__time {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-right: 1px dashed var(--line);
  padding-right: 9px;
}

.lesson__slot {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.4px;
}

.lesson__range {
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.lesson__main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.lesson__title {
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  line-height: 1.32;
  word-break: break-word;
}

.lesson__zh {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.35;
}

.lesson__ru {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.35;
}

/* 教室：单独一行，一眼看到去哪上课 */
.lesson__room {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 13px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  border-radius: 9px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
}

.lesson__room b {
  font-weight: 700;
}

.lesson__room-icon {
  font-size: 12px;
}

/* 课间 */
.lessonbreak {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1px 6px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.lessonbreak__line {
  flex: 1 1 auto;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 11px);
}

.lessonbreak__text {
  white-space: nowrap;
}

.lesson__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.lesson__meta b {
  font-weight: 600;
  color: var(--text);
}

.kind {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}

.kind--lecture {
  background: var(--brand-soft);
  color: var(--brand);
}

.kind--consult {
  background: color-mix(in srgb, var(--leave) 16%, transparent);
  color: var(--leave);
}

.kind--pe {
  background: color-mix(in srgb, var(--present) 16%, transparent);
  color: var(--present);
}

.kind--cross {
  background: color-mix(in srgb, var(--late) 16%, transparent);
  color: var(--late);
}

/* 周视图（桌面网格） */

.weekgrid table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.weekgrid th,
.weekgrid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}

.weekgrid thead th {
  background: var(--surface-2);
  font-size: 13px;
}

.weekgrid tbody th {
  width: 92px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.weekgrid td {
  width: calc((100% - 92px) / 6);
  min-width: 118px;
}

.weekgrid tr:last-child th,
.weekgrid tr:last-child td {
  border-bottom: 0;
}

.weekgrid th:last-child,
.weekgrid td:last-child {
  border-right: 0;
}

.cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  border-radius: 8px;
  padding: 5px 6px;
  margin: -5px -6px;
}

/* 整周表里这周轮不到的课 */
.cell--off {
  opacity: 0.6;
}

.cell--now {
  background: var(--brand-soft);
}

.cell__subject {
  font-weight: 650;
  font-size: 13px;
  line-height: 1.3;
  word-break: break-word;
}

.cell__meta {
  color: var(--text-dim);
  font-size: 11.5px;
}

.cell__zh {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.3;
}

.cell__room {
  display: inline-block;
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

.cell__ru {
  color: var(--text-faint);
  font-size: 10.5px;
}

/* -------------------------------------------------------------- 签到页 */

.statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 6px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat b {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat span {
  font-size: 11px;
  color: var(--text-dim);
}

.stat--present b {
  color: var(--present);
}

.stat--absent b {
  color: var(--absent);
}

.stat--late b {
  color: var(--late);
}

.stat--leave b {
  color: var(--leave);
}

.stat--unknown b {
  color: var(--unknown);
}

.progress {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  display: flex;
}

.progress i {
  display: block;
  height: 100%;
}

.students {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 720px) {
  .students {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .students {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.student {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--unknown);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s;
}

.student[data-status="present"] {
  border-left-color: var(--present);
}

.student[data-status="absent"] {
  border-left-color: var(--absent);
}

.student[data-status="late"] {
  border-left-color: var(--late);
}

.student[data-status="leave"] {
  border-left-color: var(--leave);
}

.student__id {
  width: 24px;
  flex: none;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.student__name {
  flex: 1 1 auto;
  min-width: 0;
}

.student__zh {
  font-weight: 650;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.student__ru {
  font-size: 11.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student__actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.sbtn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
}

.sbtn:hover {
  background: var(--surface-3);
}

.sbtn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.sbtn[disabled]:hover {
  background: var(--surface-2);
}

.sbtn[aria-pressed="true"][data-status="present"] {
  background: var(--present);
  border-color: var(--present);
  color: #fff;
}

.sbtn[aria-pressed="true"][data-status="absent"] {
  background: var(--absent);
  border-color: var(--absent);
  color: #fff;
}

.sbtn[aria-pressed="true"][data-status="late"] {
  background: var(--late);
  border-color: var(--late);
  color: #fff;
}

.sbtn[aria-pressed="true"][data-status="leave"] {
  background: var(--leave);
  border-color: var(--leave);
  color: #fff;
}

.note-input {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  width: 100%;
  margin-top: 5px;
}

/* -------------------------------------------------------------- 管理页 */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.table th {
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 650;
}

.table tr:last-child td {
  border-bottom: 0;
}

.tablewrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* -------------------------------------------------------------- 全校搜索结果 */

.searchrow {
  display: flex;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.08);
}

.searchrow__when {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 0 0 auto;
  min-width: 88px;
  font-size: 12px;
  line-height: 1.4;
}

.searchrow__when b {
  font-size: 12.5px;
}

.searchrow__main {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

/* -------------------------------------------------------------- 课程资料 */

.matcourse__body {
  gap: 6px;
}

/* 一个分组（「一节课」，如 Лекция01）——用原生 details 折叠 */
.matdir {
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.07);
  padding: 2px 4px;
}

.matdir__head {
  cursor: pointer;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 8px;
}

.matdir__name {
  word-break: break-word;
}

.matdir__meta {
  font-weight: 500;
  margin-left: auto;
  font-size: 11.5px;
}

.matdir__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px 6px 12px;
}

.matdir--d1,
.matdir--d2,
.matdir--d3 {
  background: transparent;
}

/* 单个 PDF */
.matfile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.09);
}

.matfile__open {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.matfile__open:hover .matfile__name {
  text-decoration: underline;
}

.matfile__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matfile__size {
  flex: 0 0 auto;
  font-size: 11.5px;
}

.matfile__ext {
  flex: 0 0 auto;
  font-size: 12.5px;
  text-decoration: none;
  opacity: 0.6;
  padding: 2px 6px;
  border-radius: 6px;
}

.matfile__ext:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.18);
}

/* 资料分区标题（第 N 组 的资料 / 公共资料） */
.matsection {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 4px 0;
  font-size: 14px;
}

/* 科目内部的「教材 / 书」「讲义 / 笔记」「其他」分组 */
.matgroup {
  border-radius: 10px;
  border-left: 3px solid rgba(127, 127, 127, 0.35);
  padding: 2px 4px 2px 6px;
}

.matgroup--book {
  border-left-color: #d9a441;
}

.matgroup--notes {
  border-left-color: #4a90d9;
}

.matgroup__head {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px;
}

.matgroup__meta {
  margin-left: auto;
  font-weight: 500;
  font-size: 11.5px;
}

.matgroup__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 2px 6px 8px;
}

/* 分发按钮与分发弹层（仅管理员可见） */
.sharebtn {
  flex: 0 0 auto;
  border: 1px solid rgba(127, 127, 127, 0.35);
  background: rgba(127, 127, 127, 0.08);
  color: inherit;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.75;
}

.sharebtn:hover {
  opacity: 1;
}

.sharebtn--on {
  opacity: 1;
  border-color: #4a90d9;
  background: rgba(74, 144, 217, 0.16);
}

.sharedialog {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(20, 24, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sharedialog__box {
  width: min(460px, 96vw);
  max-height: 86vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text, #1b1f26);
  box-shadow: var(--shadow-md);
}

.sharepick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sharepick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.1);
  font-size: 13px;
  cursor: pointer;
}

/* 拖拽：可拖的条目 + 投放区高亮 */
.matfile[draggable='true'] {
  cursor: grab;
}

.matfile[draggable='true']:active {
  cursor: grabbing;
}

.is-dropover {
  outline: 2px dashed #4a90d9;
  outline-offset: 2px;
  background: rgba(74, 144, 217, 0.09);
}

/* 可点击的课次卡片：点开看作业与资料 */
.lesson--clickable,
.cell--clickable {
  cursor: pointer;
}

.lesson--clickable:hover {
  border-color: var(--brand, #2f6df6);
  box-shadow: var(--shadow-sm);
}

.cell--clickable:hover {
  outline: 1px dashed rgba(47, 109, 246, 0.55);
}

/* 管理员拖课程块改时间：抓手光标 + 拖动中半透明 + 落点高亮 */
.cell--draggable {
  cursor: grab;
}

.cell--draggable:active {
  cursor: grabbing;
}

.cell--dragging {
  opacity: 0.45;
}

.cell--drop {
  outline: 2px dashed var(--brand, #2f6df6);
  outline-offset: -2px;
  background: rgba(47, 109, 246, 0.07);
}

/* 课次面板（作业 + 这门课的资料） */
.lessonpanel {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(20, 24, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lessonpanel__box {
  width: min(620px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

.lessonpanel__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lessonpanel__head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lessonpanel__subject {
  font-size: 16px;
  font-weight: 650;
}

.lessonpanel__block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(127, 127, 127, 0.07);
}

.lessonpanel__title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  font-weight: 650;
  font-size: 13.5px;
}

.lessonpanel__hw {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 13px;
}

.lessonpanel__file {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 13px;
  min-width: 0;
}

.lessonpanel__file a {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lessonpanel__file a:hover {
  text-decoration: underline;
}

/* PDF 页内预览：整屏遮罩 + iframe（交给浏览器自带的 PDF 阅读器） */
.pdfpreview {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #1b1f26;
  display: flex;
  flex-direction: column;
}

.pdfpreview__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: #23272f;
  color: #fff;
}

.pdfpreview__name {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdfpreview__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pdfpreview__actions .btn--ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.07);
}

.pdfpreview__frame {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  background: #fff;
}

body.pdfpreview-open {
  overflow: hidden;
}

/* -------------------------------------------------------------- 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  background: #1c2027;
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 90;
  max-width: 90vw;
  text-align: center;
}

@media (min-width: 900px) {
  .toast {
    bottom: 26px;
  }
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 源站课表更新提示：常驻底部，点一下刷新页面 */
.schedule-update {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--brand, #1f6feb);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 95;
  max-width: 92vw;
  text-align: center;
}

@media (min-width: 900px) {
  .schedule-update {
    bottom: 26px;
  }
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--unknown);
  flex: none;
}

.live-dot.is-on {
  background: var(--present);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--present) 22%, transparent);
}

.empty {
  text-align: center;
  padding: 34px 16px;
  color: var(--text-faint);
  font-size: 14px;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: sk 1.2s linear infinite;
  border-radius: 8px;
  height: 56px;
}

@keyframes sk {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================================ 现在推荐 */

.nowcard {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface) 62%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.nowcard--live {
  border-color: color-mix(in srgb, var(--present) 45%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--present) 14%, var(--surface)), var(--surface) 62%);
}

.nowcard--free {
  background: var(--surface);
}

.nowcard__body {
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nowcard__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.nowcard__subject {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.nowcard__zh {
  font-size: 13.5px;
  color: var(--text-dim);
}

.nowcard__room {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 14px;
  font-weight: 650;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  border-radius: 9px;
  padding: 4px 11px;
  font-variant-numeric: tabular-nums;
}

.nowcard__ru {
  font-size: 12.5px;
  color: var(--text-faint);
}

.nowcard__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.nowcard__meta b {
  color: var(--text);
  font-weight: 600;
}

.nowcard__bar {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.nowcard__bar i {
  display: block;
  height: 100%;
  background: var(--present);
  border-radius: 999px;
}

.nowcard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-dim);
}

.nowcard__hw {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--late);
  background: color-mix(in srgb, var(--late) 12%, transparent);
  border-radius: 8px;
  padding: 5px 9px;
}

/* ================================================================ 按天视图 */

.daysview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dayblock {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dayblock--today {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-sm);
}

.dayblock__head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.dayblock__date {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-weight: 700;
  font-size: 15px;
}

.dayblock__date span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.dayblock__body {
  padding: 11px 13px 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* ================================================================ 作业 */

.homework {
  border: 1px solid color-mix(in srgb, var(--late) 32%, var(--line));
  border-left: 4px solid var(--late);
  background: color-mix(in srgb, var(--late) 8%, var(--surface));
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.homework__title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--late);
  display: flex;
  align-items: center;
  gap: 6px;
}

.homework__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 13.5px;
  line-height: 1.5;
}

.homework__subject {
  font-weight: 650;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 1px 7px;
  font-size: 12px;
  white-space: nowrap;
}

.homework__content {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.homework__due {
  font-size: 11.5px;
  color: var(--absent);
  font-weight: 650;
  white-space: nowrap;
}

.homework__del {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 13px;
  padding: 0 3px;
  border-radius: 6px;
}

.homework__del:hover {
  color: var(--absent);
  background: var(--surface-2);
}

/* 管理页作业表单 */

.hwform {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 720px) {
  .hwform {
    grid-template-columns: 150px 1fr;
    align-items: start;
  }
  .hwform__wide {
    grid-column: 1 / -1;
  }
}

.hwlist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hwrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13.5px;
  background: var(--surface);
}

.hwrow__date {
  font-size: 12px;
  font-weight: 650;
  color: var(--brand);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ================================================================ 登录 / 注册 */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
}

.gate__card {
  width: min(100%, 400px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gate__mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  flex: none;
}

.gate__tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}

.gate__tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 8px 6px;
  border-radius: 9px;
  font-weight: 650;
  font-size: 13.5px;
  cursor: pointer;
}

.gate__tabs button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.gate__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gate__field label {
  font-size: 12.5px;
  color: var(--text-dim);
}

.gate__field input {
  width: 100%;
  padding: 11px 12px;
}

.gate input.is-code {
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

.gate__submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
}

.gate__msg {
  font-size: 13px;
  min-height: 18px;
  text-align: center;
  line-height: 1.5;
}

.gate__msg.is-error {
  color: var(--absent);
}

.gate__msg.is-ok {
  color: var(--present);
}

.gate__hint {
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.6;
}

.gate__hint a {
  font-weight: 600;
}

/* ================================================================ 用户管理 */

.userlist {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.userrow {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: var(--surface);
}

.userrow--pending {
  border-color: color-mix(in srgb, var(--late) 40%, var(--line));
  background: color-mix(in srgb, var(--late) 7%, var(--surface));
}

.userrow__name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 160px;
}

.userrow__username {
  font-weight: 650;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.userrow__sub {
  font-size: 11.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userrow__actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: none;
}

.userrow__actions .btn {
  padding: 5px 10px;
  font-size: 12.5px;
}

@media (max-width: 560px) {
  .userrow__actions {
    flex: 1 1 100%;
  }
  .userrow__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
