:root {
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;
  --primary: #2E6BE6;
  --primary-soft: #EAF1FE;
  --success: #16A34A;
  --success-soft: #E8F7EE;
  --warning: #D97706;
  --warning-soft: #FEF3E2;
  --danger: #DC2626;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.brand-mark {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--primary); position: relative; display: inline-block;
}
.brand-mark::after {
  content: ''; position: absolute; left: 9px; top: 7px;
  border-left: 7px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.brand-tag { font-size: 11px; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 20px; font-weight: 400; }
.switcher { display: flex; background: #F1F3F7; border-radius: 9px; padding: 3px; }
.switch-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 20px; border-radius: 7px; font-size: 13px;
}
.switch-btn.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 500; }
.account-info { color: var(--muted); font-size: 12px; min-width: 160px; text-align: right; }

.main { padding: 28px 20px 60px; }
.view { max-width: 1280px; margin: 0 auto; }

.login-wrap { display: flex; justify-content: center; padding-top: 60px; }
.login-card {
  width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px; box-shadow: 0 8px 30px rgba(31,41,55,.05);
}
.login-card h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; margin: 0 0 18px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
label input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--text);
  outline: none; background: #fff;
}
label input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,107,230,.1); }
.register-box { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 16px; }
.error { color: var(--danger); font-size: 12px; margin-top: 10px; }

.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  font-size: 13px; cursor: pointer; font-family: inherit; transition: all .15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #245BC8; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.success { background: var(--success); color: #fff; }
.btn.full { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.spread { justify-content: space-between; }

/* 手机学生端 */
.phone {
  width: 390px; height: 790px; margin: 0 auto;
  background: #1F2937; border-radius: 40px; padding: 8px;
  box-sizing: border-box; box-shadow: 0 20px 50px rgba(31,41,55,.18);
  position: relative;
}
.phone-notch {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 22px; background: #1F2937; border-radius: 0 0 14px 14px; z-index: 3;
}
.phone-screen {
  width: 100%; height: 100%; background: #F7F9FC; border-radius: 33px;
  overflow: hidden; display: flex; flex-direction: column; position: relative;
}
.phone-status {
  display: flex; justify-content: space-between; padding: 10px 22px 4px;
  font-size: 11px; color: #111827; font-weight: 600;
}
.phone-status-right { letter-spacing: 2px; }
.phone-header {
  padding: 14px 18px 12px; display: flex; justify-content: space-between; align-items: center;
  background: #fff; border-bottom: 1px solid var(--line);
}
.phone-title { font-size: 17px; font-weight: 600; }
.phone-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.phone-body { flex: 1; overflow-y: auto; padding: 14px; padding-bottom: 70px; }
.bottom-nav {
  position: absolute; bottom: 0; left: 0; right: 0; height: 62px;
  background: #fff; border-top: 1px solid var(--line); display: flex;
}
.bottom-nav button {
  flex: 1; border: 0; background: transparent; color: #9CA3AF; font-size: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.bottom-nav button.active { color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 18px; line-height: 1; }

.mini-card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.mini-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat-num { font-size: 18px; font-weight: 600; color: var(--primary); }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 2px; }
.notice { background: var(--warning-soft); color: #92400E; border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 12px; }
.notice.ok { background: var(--success-soft); color: #166534; }
.tag { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 20px; background: #F1F3F7; color: var(--muted); }
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.orange { background: var(--warning-soft); color: var(--warning); }
.video-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.video-item:last-child { border-bottom: 0; }
.video-cover {
  width: 56px; height: 40px; border-radius: 7px; background: linear-gradient(135deg, #2E6BE6, #7AA5F5);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0;
}
.video-info { flex: 1; min-width: 0; }
.video-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-meta { font-size: 10px; color: var(--muted); margin-top: 3px; }
.progress { height: 5px; background: #EDF0F5; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.player { background: #111827; border-radius: 10px; aspect-ratio: 16/9; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; margin-bottom: 10px; }
.player-icon { font-size: 38px; opacity: .8; }
.player-time { font-size: 12px; opacity: .7; margin-top: 6px; }
.big-btn { width: 100%; padding: 12px; border-radius: 10px; border: 0; background: var(--primary); color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; }
.big-btn:disabled { background: #C9D3E4; cursor: not-allowed; }
.check-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 12px; border-bottom: 1px dashed var(--line); }
.check-line:last-child { border-bottom: 0; }
.input-line { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; }
.input-line:focus { border-color: var(--primary); }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 10px; }
.calendar i { aspect-ratio: 1; border-radius: 6px; background: #F1F3F7; display: flex; align-items: center; justify-content: center; font-size: 10px; font-style: normal; color: var(--muted); }
.calendar i.on { background: var(--success); color: #fff; }

/* 管理端 */
.admin-panel { display: flex; min-height: calc(100vh - 116px); background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sidebar { width: 210px; background: #FAFBFD; border-right: 1px solid var(--line); padding: 18px 12px; flex-shrink: 0; }
.sidebar-title { font-size: 12px; color: var(--muted); padding: 0 10px 12px; font-weight: 600; letter-spacing: .5px; }
.side-btn {
  width: 100%; border: 0; background: transparent; text-align: left; padding: 10px 12px;
  border-radius: 8px; color: #4B5563; cursor: pointer; font-size: 13px; margin-bottom: 3px;
}
.side-btn:hover { background: #F1F3F7; }
.side-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar-foot { margin-top: 30px; padding: 10px; font-size: 10px; color: #9CA3AF; line-height: 1.7; }
.admin-main { flex: 1; padding: 24px 28px; min-width: 0; }
.admin-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.admin-heading h1 { margin: 0; font-size: 20px; font-weight: 600; }
.admin-heading p { margin-bottom: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.metric { background: #F9FAFC; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.metric-label { font-size: 12px; color: var(--muted); }
.metric-value { font-size: 26px; font-weight: 600; margin-top: 4px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; background: #FAFBFD; }
tr:last-child td { border-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.form-grid label { margin: 0; }
.form-actions { display: flex; gap: 8px; align-items: flex-end; }
.code-box { font-size: 30px; font-weight: 600; letter-spacing: 6px; color: var(--primary); background: var(--primary-soft); padding: 12px 18px; border-radius: 10px; display: inline-block; }
.empty { color: var(--muted); text-align: center; padding: 30px; font-size: 12px; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1F2937; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,.2);
}
.toast.error { background: var(--danger); }

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .brand-tag, .account-info { display: none; }
  .admin-panel { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-title, .sidebar-foot { display: none; }
  .side-btn { width: auto; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
