/* ================= 浅色主题 · 移动优先 ================= */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #eceef4;
  --line-2: #e2e5ee;
  --txt: #1b1f2a;
  --txt-2: #59607a;
  --txt-3: #9aa0b4;
  --brand: #5b5bf5;
  --brand-2: #8b7cff;
  --ok: #10b981;
  --bad: #ef4444;
  --warn: #f59e0b;
  --r: 18px;
  --shadow: 0 6px 24px rgba(28, 33, 56, .07);
  --shadow-lg: 0 20px 60px rgba(28, 33, 56, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
code { background: #f1f3f9; color: #444b63; padding: 2px 7px; border-radius: 6px; font-size: 12px; }
h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.muted { color: var(--txt-3); }
.sm { font-size: 12px; }
.good { color: var(--ok); }
.bad { color: var(--bad); }
.w100 { width: 100%; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  background: rgba(246, 247, 251, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 229, 238, .7);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .3px; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), #35c2ff);
  box-shadow: 0 6px 16px rgba(91, 91, 245, .35);
}
.brand b { font-size: 15.5px; }
.brand span { font-size: 10px; color: var(--txt-3); letter-spacing: 1.6px; margin-top: 2px; }
.who { font-size: 12.5px; color: var(--txt-2); }

/* ---------- 布局 ---------- */
.layout { display: block; }
.main { max-width: 860px; margin: 0 auto; padding: 18px 16px 24px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.page-head h1 { font-size: 22px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(28, 33, 56, .05);
}
.tabbar .nav-item {
  flex: 1; max-width: 110px; border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border-radius: 14px; cursor: pointer;
  color: var(--txt-3); font-size: 11px; font-family: inherit;
  transition: color .16s, background .16s, transform .12s;
}
.tabbar .nav-item i { font-style: normal; font-size: 18px; line-height: 1; }
.tabbar .nav-item:active { transform: scale(.96); }
.tabbar .nav-item.on {
  color: var(--brand);
  background: linear-gradient(180deg, rgba(91, 91, 245, .10), rgba(91, 91, 245, .04));
}
.tabbar .nav-item.on i { transform: translateY(-1px); }

/* 旧的侧边栏规则保留为空，避免旧结构报错 */
.side, .side-foot, .brand span { display: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card .k { font-size: 12px; color: var(--txt-3); letter-spacing: .4px; margin-bottom: 10px; font-weight: 600; }
.card .v { font-size: 26px; font-weight: 800; letter-spacing: -.6px; color: var(--txt); }
.card .v.sm { font-size: 16px; }

.grid.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.grid.cards .card { margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border: none; border-radius: 13px; cursor: pointer;
  font: 600 13.5px/1 inherit; color: #fff; font-family: inherit;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 20px -8px rgba(91, 91, 245, .8);
  transition: transform .12s, filter .16s, box-shadow .18s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn.sm { padding: 8px 13px; font-size: 12.5px; border-radius: 10px; }
.btn.ghost { background: #f2f4fa; color: var(--txt-2); box-shadow: none; }
.btn.ghost:hover { background: #e9ecf6; }
.btn.danger { background: #fee2e2; color: #b91c1c; box-shadow: none; }
.btn.danger:hover { background: #fecaca; }

/* ---------- 表单 ---------- */
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line-2); background: #fbfcff;
  color: var(--txt); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: #b3b8c9; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 4px rgba(91, 91, 245, .12);
}

/* ---------- 标签 / 行 ---------- */
.tag {
  display: inline-flex; align-items: center; font-size: 11.5px; padding: 3px 9px;
  border-radius: 999px; background: #eef0ff; color: #5856d6; font-weight: 600;
}
.tag.ok { background: #e7f8f0; color: #0f9d63; }
.tag.bad { background: #fdecec; color: #d33; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.between { justify-content: space-between; }
.list-row { padding: 12px 2px; border-bottom: 1px solid var(--line); margin: 0; }
.list-row:last-child { border-bottom: none; }
.list-row.on { background: #f4f5ff; border-radius: 12px; padding: 12px; }

/* ---------- 课程卡 ---------- */
.course {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 15px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.course-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.course-name { font-weight: 700; font-size: 15px; line-height: 1.4; }
.course-meta { font-size: 12px; color: var(--txt-3); margin-top: 3px; }
.course-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.course-foot .bar { flex: 1; }

/* ---------- 进度条 ---------- */
.bar { height: 8px; width: 100%; background: #eceefa; border-radius: 999px; overflow: hidden; }
.bar i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #35c2ff);
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
}

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; margin-top: 6px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--txt-3); font-weight: 600;
  padding: 9px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover { background: #fafbff; }

/* ---------- 日志 ---------- */
.logs {
  background: #0f1420; color: #b7c0d4; border-radius: 13px; padding: 12px 13px;
  font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 230px; overflow: auto; white-space: pre-wrap;
}
.logs::-webkit-scrollbar { width: 8px; }
.logs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }

/* ---------- 公告 ---------- */
.ann { margin: 10px 0; padding-left: 12px; border-left: 3px solid #dfe2f5; }
.ann b { font-size: 13px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 90;
  padding: 11px 18px; border-radius: 13px; font-size: 13px;
  background: rgba(27, 31, 42, .94); color: #fff; box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease both; max-width: calc(100% - 32px); text-align: center;
}
.toast.ok { background: linear-gradient(135deg, #10b981, #0ea472); }
.toast.bad { background: linear-gradient(135deg, #ef4444, #dc2626); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 浮层 / 弹窗 ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 24, 36, .38);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease both;
}
.sheet-mask[hidden] { display: none !important; }
.sheet-panel {
  width: 100%; max-width: 620px; max-height: 82vh; background: #fff;
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .24s cubic-bezier(.22, 1, .36, 1) both;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head b { font-size: 16px; }
.sheet-list { overflow: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.sheet-foot { display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }

.cell-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px;
  border-radius: 12px; border: 1px solid var(--line); margin-bottom: 8px; cursor: pointer;
  transition: border-color .14s, background .14s;
}
.cell-item.on { border-color: var(--brand); background: #f5f5ff; }
.cell-item .tick {
  width: 20px; height: 20px; border-radius: 7px; border: 1.5px solid var(--line-2);
  flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; background: #fff;
}
.cell-item.on .tick { background: var(--brand); border-color: var(--brand); }
.cell-item .name { flex: 1; font-size: 13.5px; line-height: 1.4; }

.modal-mask {
  position: fixed; inset: 0; z-index: 70; background: rgba(20, 24, 36, .45);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  backdrop-filter: blur(4px); animation: fade .16s ease both;
}
.modal-mask[hidden] { display: none !important; }
.modal {
  width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 22px 20px 18px;
  box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.22, 1, .36, 1) both;
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal .warn {
  background: #fff7ed; border: 1px solid #fed7aa; color: #b45309;
  border-radius: 12px; padding: 11px 13px; font-size: 13px; line-height: 1.6; margin: 10px 0 4px;
}
.modal .row { margin-top: 14px; }
.modal .row .btn { flex: 1; }

@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

@media (min-width: 720px) {
  .sheet-mask { align-items: center; }
  .sheet-panel { border-radius: 22px; max-height: 76vh; }
  .main { padding: 24px 20px 32px; }
}
