:root {
  --bg: #eff3fa;
  --bg-deep: #e7edf8;
  --panel: #ffffff;
  --panel-soft: #f8fafd;
  --ink: #0f1729;
  --ink-2: #33415c;
  --muted: #6b7a90;
  --muted-2: #93a0b4;
  --line: #e3e9f3;
  --line-strong: #d3dced;
  --brand: #3f5bf6;
  --brand-soft: #eef1ff;
  --brand-deep: #2b3fd0;
  --cyan: #06a7c4;
  --ok: #12a150;
  --ok-soft: #e8f8ee;
  --warn: #c77700;
  --warn-soft: #fff5e6;
  --bad: #dc3b3b;
  --bad-soft: #fdeeee;
  --violet: #7c5cf5;
  --violet-soft: #f2eeff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 6px -2px rgba(15, 23, 42, .08);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, .04), 0 12px 28px -14px rgba(15, 23, 42, .22);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 12% -10%, #e6ecff 0%, rgba(230, 236, 255, 0) 60%),
    radial-gradient(900px 420px at 92% 0%, #e2f7fb 0%, rgba(226, 247, 251, 0) 55%),
    var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  background: linear-gradient(135deg, #4a63ff, #7c5cf5 55%, #12b5d4);
  box-shadow: 0 6px 16px -6px rgba(74, 99, 255, .75);
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .2px;
}

.brand-text p {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 1px;
}

.source-tag {
  margin-left: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border: 1px solid #dde3ff;
  white-space: nowrap;
}
.source-tag.live { color: #0b7a4b; background: var(--ok-soft); border-color: #cceddb; }
.source-tag.fallback { color: var(--warn); background: var(--warn-soft); border-color: #ffe2b8; }

.searchbox {
  position: relative;
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
}

.searchbox svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  fill: var(--muted-2);
  pointer-events: none;
}

.searchbox input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fbfcfe;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.searchbox input::placeholder { color: var(--muted-2); }
.searchbox input:focus {
  border-color: #a9b7ff;
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(63, 91, 246, .12);
}

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

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  color: #0b7a4b;
  background: var(--ok-soft);
  border: 1px solid #cfeedd;
  white-space: nowrap;
}
.live-pill[hidden] { display: none; }
.live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, .5);
  animation: pulse 2s infinite;
}
.live-pill.connecting { color: var(--muted); background: #f2f5fb; border-color: var(--line); }
.live-pill.connecting i { background: #b6c2d6; animation: none; box-shadow: none; }
.live-pill.offline { color: var(--warn); background: var(--warn-soft); border-color: #ffe2b8; }
.live-pill.offline i { background: #e79a1a; animation: none; box-shadow: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 550;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #5a6ffb);
  box-shadow: 0 6px 14px -8px rgba(63, 91, 246, .9);
  transition: transform .12s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }

.btn.ghost {
  color: var(--ink-2);
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: none;
}
.btn.ghost:hover { border-color: #b9c4dd; background: #fbfcff; }
.btn.small { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

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

.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 40px;
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 96px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .3px;
}

.count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-deep);
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.student-list {
  overflow-y: auto;
  padding: 4px 8px 10px;
  flex: 1;
}

.student-list::-webkit-scrollbar { width: 8px; }
.student-list::-webkit-scrollbar-thumb { background: #dbe3f1; border-radius: 8px; }

.student-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  transition: background .13s, border-color .13s;
}
.student-item:hover { background: #f6f8fe; }
.student-item.active {
  background: linear-gradient(135deg, #f1f4ff, #f7f9ff);
  border-color: #d9e0ff;
  box-shadow: inset 2px 0 0 var(--brand);
}

.mini-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 650;
  color: var(--brand-deep);
  background: linear-gradient(135deg, #e9edff, #f4f6ff);
  border: 1px solid #e0e6ff;
}
.student-item:nth-child(3n) .mini-avatar { color: #0b7a4b; background: linear-gradient(135deg, #e6f8ee, #f3fdf8); border-color: #d5f0e2; }
.student-item:nth-child(4n) .mini-avatar { color: #7a4a00; background: linear-gradient(135deg, #fff3e0, #fffaf2); border-color: #ffe8c9; }

.si-main { min-width: 0; flex: 1; }
.si-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.si-name .dot-live { width: 5px; height: 5px; border-radius: 50%; background: #b6c2d6; }
.si-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.si-badge {
  font-size: 10.5px;
  color: var(--muted);
  background: #f2f5fb;
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

.side-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted-2);
  background: var(--panel-soft);
}
.side-foot b { color: var(--ink-2); font-weight: 600; }

/* ---------------- 内容区 ---------------- */

.content { min-width: 0; }

.placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 120px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}
.placeholder-art { font-size: 40px; }
.placeholder h2 { font-size: 16px; color: var(--ink-2); font-weight: 600; }
.placeholder p { font-size: 12.5px; color: var(--muted-2); }

.hero {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 20px 22px;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 320px;
  height: 160px;
  background: radial-gradient(circle at 70% 20%, rgba(124, 92, 245, .12), transparent 65%),
              radial-gradient(circle at 95% 60%, rgba(6, 167, 196, .12), transparent 60%);
  pointer-events: none;
}

.hero-main { display: flex; align-items: flex-start; gap: 16px; position: relative; }

.avatar {
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(140deg, #4a63ff, #7c5cf5 60%, #12b5d4);
  box-shadow: 0 10px 22px -12px rgba(74, 99, 255, .95);
}

.hero-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-title h2 { font-size: 22px; font-weight: 680; letter-spacing: .3px; }

.pill {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: #0b7a4b;
  border: 1px solid #d3f0e0;
  font-weight: 600;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 7px;
  font-size: 12.8px;
  color: var(--muted);
}
.hero-meta .kv { display: inline-flex; align-items: baseline; gap: 5px; }
.hero-meta .kv label { color: var(--muted-2); font-size: 11.5px; }
.hero-meta .kv b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-remark {
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--warn-soft);
  border: 1px solid #ffe9c9;
  border-radius: 9px;
  padding: 7px 11px;
  display: inline-block;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  position: relative;
}

.stat {
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.stat label { font-size: 11.5px; color: var(--muted-2); display: block; }
.stat b {
  font-size: 20px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.stat small { font-size: 11.5px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.stat .sub { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.stat.accent b { color: var(--brand-deep); }
.stat.good b { color: var(--ok); }
.stat.warn b { color: var(--warn); }

/* ---------------- 工具条 ---------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  backdrop-filter: blur(8px);
}

.segmented {
  display: flex;
  padding: 3px;
  background: #eef2fa;
  border-radius: 9px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 550;
}
.segmented button.active {
  background: #fff;
  color: var(--brand-deep);
  box-shadow: var(--shadow-sm);
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
}
.filter-chip.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ---------------- 学期 / 课程 ---------------- */

.semester { margin-bottom: 16px; }

.semester-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 2px 10px;
}
.semester-head h3 {
  font-size: 15.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}
.semester-head h3::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4a63ff, #7c5cf5);
}
.semester-head .range { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.sem-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.sem-stats span {
  font-size: 11.5px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}
.sem-stats b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.courses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.course {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 15px 16px 13px;
  transition: box-shadow .18s, transform .18s;
}
.course:hover { box-shadow: var(--shadow-md); }

.course-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.course-head h4 { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.course-head .course-sub { font-size: 11.8px; color: var(--muted-2); margin-top: 2px; }
.course-head .course-badges { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.tag {
  font-size: 10.8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f2f5fb;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 550;
}
.tag.brand { background: var(--brand-soft); color: var(--brand-deep); }
.tag.ok { background: var(--ok-soft); color: #0b7a4b; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }

/* 折叠块 */
.block {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel-soft);
  margin-bottom: 8px;
  overflow: hidden;
}
.block[open] { background: #fff; }

.block > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.block > summary::-webkit-details-marker { display: none; }
.block > summary:hover { background: #f4f7fe; }

.block-icon {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--brand-soft);
}
.block-icon.lesson { color: var(--brand-deep); background: var(--brand-soft); }
.block-icon.homework { color: var(--warn); background: var(--warn-soft); }
.block-icon.exam { color: var(--violet); background: var(--violet-soft); }

.block-title { font-size: 12.8px; color: var(--ink-2); white-space: nowrap; }
.block-title b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.block-title .muted { color: var(--muted-2); font-size: 11.8px; }

.bar {
  flex: 1;
  min-width: 40px;
  height: 6px;
  border-radius: 99px;
  background: #e9eef8;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4a63ff, #7c9bff);
}
.bar.warn > i { background: linear-gradient(90deg, #f0a020, #ffc861); }
.bar.bad > i { background: linear-gradient(90deg, #e05d5d, #ff8a8a); }
.bar.ok > i { background: linear-gradient(90deg, #16a34a, #4ade80); }

.block-more { font-size: 11.8px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { color: var(--muted-2); font-size: 10px; transition: transform .18s; }
.block[open] .chev { transform: rotate(180deg); }

.block-body {
  padding: 2px 11px 11px;
  border-top: 1px solid var(--line);
  background: #fff;
}

/* 听课明细 */
.lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed #eef1f7;
  font-size: 12.4px;
}
.lesson-row:last-child { border-bottom: 0; }
.lesson-date { width: 76px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.lesson-topic { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-min { width: 62px; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; }
.lesson-minbar { width: 54px; height: 5px; border-radius: 99px; background: #eef2fa; flex: none; overflow: hidden; }
.lesson-minbar i { display: block; height: 100%; background: linear-gradient(90deg, #74a4ff, #a9c2ff); }
.lesson-absent { color: var(--bad); font-size: 11px; background: var(--bad-soft); padding: 1px 6px; border-radius: 5px; }

.lesson-summary {
  display: flex;
  justify-content: space-between;
  padding: 8px 2px 2px;
  font-size: 11.8px;
  color: var(--muted-2);
}

/* 作业 */
.hw-group-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.8px;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 4px;
}
.hw-group-title::after { content: ""; flex: 1; height: 1px; background: #eef1f7; }

.hw-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 6px;
  background: #fff;
  overflow: hidden;
}
.hw-item > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  font-size: 12.6px;
}
.hw-item > summary::-webkit-details-marker { display: none; }
.hw-item > summary:hover { background: #f8fafe; }
.hw-status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ok); }
.hw-item.missing .hw-status-dot { background: var(--bad); }
.hw-item.late .hw-status-dot { background: var(--warn); }
.hw-item.pending .hw-status-dot { background: #b6c2d6; }

.hw-title { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-score { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12px; }
.hw-score b { font-weight: 650; }

.hw-detail {
  padding: 9px 12px 11px;
  border-top: 1px dashed var(--line);
  background: #fbfcff;
  font-size: 12.2px;
  color: var(--ink-2);
}
.hw-detail dl { display: grid; grid-template-columns: 68px 1fr; gap: 5px 10px; margin: 0; }
.hw-detail dt { color: var(--muted-2); font-size: 11.6px; }
.hw-detail dd { margin: 0; }
.hw-detail .feedback {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px 10px;
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--ink-2);
  line-height: 1.65;
}

.attach-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 6px 0 0;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--brand-deep);
  font-size: 11.8px;
  text-decoration: none;
}

/* 考试 */
.exam-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }

.exam-card {
  flex: 1 1 148px;
  min-width: 132px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.exam-card:hover {
  border-color: #c4cfff;
  box-shadow: 0 10px 22px -16px rgba(63, 91, 246, .9);
  transform: translateY(-1px);
}
.exam-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.exam-score {
  font-size: 19px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.4px;
  margin-top: 2px;
}
.exam-score small { font-size: 11.5px; color: var(--muted-2); font-weight: 500; margin-left: 2px; }
.exam-bar { display: block; height: 4px; border-radius: 99px; background: #eef2fa; margin-top: 6px; overflow: hidden; }
.exam-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4a63ff, #8fa9ff); }
.exam-bar.mid i { background: linear-gradient(90deg, #e79a1a, #ffcb70); }
.exam-bar.low i { background: linear-gradient(90deg, #dc3b3b, #ff8f8f); }
.exam-thumb {
  margin-top: 7px;
  width: 100%;
  height: 52px;
  border-radius: 7px;
  border: 1px solid var(--line);
  object-fit: cover;
  object-position: top;
  background: #f6f8fc;
}

.empty-hint {
  padding: 10px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  background: #fbfcff;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

/* ---------------- 时间轴 ---------------- */

.timeline { position: relative; padding-left: 6px; }

.month-chip {
  position: sticky;
  top: 66px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 92px 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-bottom: 10px;
}
.tl-date {
  font-size: 11.8px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-top: 9px;
  white-space: nowrap;
}
.tl-rail { position: relative; height: 100%; display: flex; justify-content: center; }
.tl-rail::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: -10px;
  width: 1.5px;
  background: linear-gradient(180deg, var(--line-strong), #eef2fa);
}
.tl-item:last-child .tl-rail::before { display: none; }
.tl-dot {
  position: relative;
  z-index: 1;
  margin-top: 11px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--brand);
}
.tl-item[data-type="homework"] .tl-dot { border-color: #e79a1a; }
.tl-item[data-type="exam"] .tl-dot { border-color: var(--violet); }
.tl-item[data-type="enroll"] .tl-dot { border-color: var(--ok); }

.tl-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 12px;
  box-shadow: var(--shadow-sm);
}
.tl-card h5 { font-size: 13px; font-weight: 600; color: var(--ink); }
.tl-card p { font-size: 11.8px; color: var(--muted); margin-top: 2px; }
.tl-tag {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 5px;
  margin-right: 6px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
  vertical-align: 1px;
}
.tl-item[data-type="homework"] .tl-tag { background: var(--warn-soft); color: var(--warn); }
.tl-item[data-type="exam"] .tl-tag { background: var(--violet-soft); color: var(--violet); }
.tl-item[data-type="enroll"] .tl-tag { background: var(--ok-soft); color: #0b7a4b; }

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-mask[hidden] { display: none; }

.modal {
  width: min(880px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 22px 24px 24px;
  animation: pop .18s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.modal-head h3 { font-size: 18px; font-weight: 660; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-close {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 16px;
  color: var(--muted);
  line-height: 1;
}

.exam-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}
.exam-metric {
  flex: 1 1 130px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.exam-metric label { font-size: 11.5px; color: var(--muted-2); }
.exam-metric b { display: block; font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; }
.exam-metric small { font-size: 11.5px; color: var(--muted-2); }

.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.paper-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafd;
  cursor: zoom-in;
  transition: box-shadow .16s, transform .16s;
}
.paper-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.paper-card img { display: block; width: 100%; height: 260px; object-fit: cover; object-position: top; background: #fff; }
.paper-card figcaption {
  padding: 7px 10px;
  font-size: 11.8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(9, 14, 26, .9);
  display: grid;
  place-items: center;
  padding: 30px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  background: #fff;
  cursor: zoom-out;
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

/* 设置弹窗 */
.setup-grid { display: grid; gap: 10px; margin-top: 14px; }
.setup-row {
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 12.5px;
}
.setup-row label { width: 96px; flex: none; color: var(--muted-2); }
.setup-row div { color: var(--ink-2); word-break: break-all; }
.setup-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f9ff;
  border: 1px solid #e4e9fb;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.75;
}
.setup-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.warn-list { margin: 10px 0 0; padding-left: 18px; color: var(--warn); font-size: 12.2px; }

.table-block {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.table-block h4 {
  font-size: 13px;
  padding: 8px 12px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}
.field-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.field-chip {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  cursor: copy;
}
.field-chip[data-type]::after {
  content: attr(data-type);
  color: var(--muted-2);
  font-size: 10px;
  margin-left: 5px;
}

/* ---------------- 加载态 ---------------- */

.skeleton { display: grid; gap: 12px; }
.sk-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #eef2fa 25%, #f7f9fe 37%, #eef2fa 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s infinite;
}
.sk-card { height: 120px; border-radius: var(--r-lg); }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  z-index: 95;
  padding: 10px 18px;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  font-size: 13px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; }
  .searchbox { order: 3; max-width: none; width: 100%; }
}

@media (max-width: 780px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .sidebar { position: static; max-height: 320px; }
  .courses { grid-template-columns: minmax(0, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand { min-width: 0; }
  .brand-text p { display: none; }
  .tl-item { grid-template-columns: 70px 18px minmax(0, 1fr); }
}

/* ---------------- 打印 ---------------- */

@media print {
  body { background: #fff; }
  .topbar, .sidebar, .toolbar, .modal-mask, .lightbox { display: none !important; }
  .layout { display: block; padding: 0; }
  .hero, .course { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .course { break-inside: avoid; page-break-inside: avoid; }
  .block-body { display: block !important; }
  details > * { display: block !important; }
}

/* --------------------- 权限与锁定提示 --------------------- */

.locked-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
  padding: 22px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f8fafd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}
.locked-hint .locked-sub { font-size: 11.5px; font-weight: 400; opacity: 0.75; }

.perm-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.perm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.perm-row:hover { background: #f6f9fe; }
.perm-row input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand, #2563eb); }
.perm-text { display: flex; flex-direction: column; gap: 2px; }
.perm-text b { font-size: 13.5px; }
.perm-text small { color: var(--muted); font-size: 12px; }

.login-input {
  flex: 1 1 180px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.login-input:focus { border-color: var(--brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
