/* ============================================================
   页面布局：登录 / 学员端 / 管理后台
   ============================================================ */

/* ================= 登录页 ================= */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--surface);
}
.auth-brand {
  position: relative;
  overflow: hidden;
  background: var(--grad);
  color: #fff;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
}
.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(0.5px);
  z-index: -1;
  opacity: .22;
  background: radial-gradient(circle at 30% 30%, #fff, transparent 65%);
}
.auth-brand::before { width: 46vw; height: 46vw; right: -16vw; top: -14vw; }
.auth-brand::after { width: 30vw; height: 30vw; left: -10vw; bottom: -12vw; opacity: .16; }

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32);
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  flex: none;
}
.brand-mark svg { width: 21px; height: 21px; }

.auth-headline {
  font-size: clamp(26px, 2.6vw, 40px);
  font-weight: 750;
  line-height: 1.22;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.auth-sub {
  font-size: clamp(14px, 1vw, 16px);
  color: rgba(255, 255, 255, .8);
  max-width: 34ch;
  line-height: 1.7;
}
.auth-feats {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: clamp(22px, 3vw, 38px);
  padding: 0;
  list-style: none;
}
.auth-feats li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  color: rgba(255, 255, 255, .9);
}
.feat-ico {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .22);
  display: grid;
  place-items: center;
  flex: none;
}
.feat-ico svg { width: 15px; height: 15px; }
.auth-foot { font-size: 12.5px; color: rgba(255, 255, 255, .55); }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 56px);
  background: var(--surface);
  position: relative;
}
.auth-card { width: 100%; max-width: 372px; }
.auth-title { font-size: clamp(22px, 2vw, 27px); margin-bottom: 6px; }
.auth-desc { color: var(--text-3); font-size: 14px; margin-bottom: clamp(20px, 3vw, 30px); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-error {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--danger-50);
  color: #b42318;
  font-size: 13.5px;
  line-height: 1.5;
  animation: fadeUp .2s var(--ease);
}
.auth-error.show { display: flex; }
[data-theme="dark"] .auth-error { background: rgba(240, 68, 56, .14); color: #ff9b93; }
.auth-error svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.auth-help {
  margin-top: 22px;
  font-size: 12.8px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
}
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 44px; }
.pwd-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.pwd-toggle:hover { background: var(--surface-hover); color: var(--text-2); }
.pwd-toggle svg { width: 17px; height: 17px; }
.auth-theme {
  position: absolute;
  top: 20px;
  right: 22px;
  z-index: 2;
}

/* ================= 应用外壳（后台） ================= */
.shell {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 60;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: .01em;
}
.sidebar-brand .brand-mark {
  background: var(--grad);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: var(--shadow-brand);
}
.sidebar-brand .brand-mark svg { color: #fff; width: 19px; height: 19px; }
.nav-group-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 11px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 520;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all var(--dur) var(--ease);
  position: relative;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
[data-theme="dark"] .nav-item.active { background: rgba(75, 107, 251, .16); color: var(--brand-300); }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item.active svg { opacity: 1; }
.nav-count {
  margin-left: auto;
  background: var(--danger-500);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  display: grid;
  place-items: center;
}
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 2.4vw, 32px);
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-title { font-size: 16.5px; font-weight: 650; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content {
  flex: 1;
  padding: clamp(16px, 2.4vw, 30px) clamp(16px, 2.4vw, 32px) 40px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.user-chip:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.user-chip .u-name { font-size: 13.5px; font-weight: 550; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .u-role { font-size: 11.5px; color: var(--text-3); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  flex: none;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ================= 统计卡 ================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: clamp(12px, 1.4vw, 18px);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(15px, 1.8vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: all var(--dur) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--grad-soft);
  opacity: .8;
}
.stat-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--brand-50);
  color: var(--brand-600);
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .stat-ico { background: rgba(75, 107, 251, .16); }
.stat-ico svg { width: 19px; height: 19px; }
.stat-ico.ok { background: var(--ok-50); color: var(--ok-500); }
.stat-ico.warn { background: var(--warn-50); color: var(--warn-500); }
.stat-ico.danger { background: var(--danger-50); color: var(--danger-500); }
[data-theme="dark"] .stat-ico.ok { background: rgba(18, 183, 106, .15); }
[data-theme="dark"] .stat-ico.warn { background: rgba(247, 144, 9, .15); }
[data-theme="dark"] .stat-ico.danger { background: rgba(240, 68, 56, .15); }
.stat-num {
  font-size: clamp(23px, 2vw, 29px);
  font-weight: 720;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; color: var(--text-3); }

/* ================= 学员端 ================= */
.stu-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.stu-header {
  background: var(--grad);
  color: #fff;
  padding: clamp(20px, 4vw, 34px) clamp(16px, 4vw, 32px) clamp(52px, 9vw, 86px);
  position: relative;
  overflow: hidden;
}
.stu-header::after {
  content: "";
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 420px;
  max-height: 420px;
  right: -14vw;
  top: -22vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 68%);
}
.stu-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.stu-hello { font-size: clamp(20px, 2.4vw, 27px); font-weight: 720; letter-spacing: -.01em; }
.stu-sub { font-size: 13.5px; color: rgba(255, 255, 255, .8); margin-top: 5px; }
.stu-header .icon-btn, .stu-header .user-chip {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .26);
  color: #fff;
}
.stu-header .user-chip:hover { background: rgba(255, 255, 255, .24); }
.stu-header .u-role { color: rgba(255, 255, 255, .7); }
.stu-header .avatar { background: rgba(255, 255, 255, .24); border: 1px solid rgba(255, 255, 255, .32); }

.stu-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: -46px auto 0;
  padding: 0 clamp(14px, 4vw, 28px) calc(96px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 2;
}
.stu-tabs {
  margin: 0 auto 16px;
  max-width: 460px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: none;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar-inner { display: flex; max-width: 560px; margin: 0 auto; }
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
  border-radius: 10px;
  transition: color var(--dur) var(--ease);
}
.tabbar-item svg { width: 21px; height: 21px; }
.tabbar-item.active { color: var(--brand-600); }
[data-theme="dark"] .tabbar-item.active { color: var(--brand-300); }

/* 签到主卡片 */
.checkin-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow);
  text-align: center;
}
.checkin-hero.open { border-color: var(--brand-200); box-shadow: var(--shadow-lg); }
.ci-ring {
  width: clamp(96px, 15vw, 118px);
  height: clamp(96px, 15vw, 118px);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  background: var(--grad-soft);
  border: 2px dashed var(--brand-300);
  color: var(--brand-600);
  position: relative;
}
.ci-ring.done {
  background: var(--ok-50);
  border: 2px solid var(--ok-500);
  color: var(--ok-500);
}
[data-theme="dark"] .ci-ring.done { background: rgba(18, 183, 106, .12); }
.ci-ring svg { width: 42px; height: 42px; }
.ci-ring.pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--brand-400);
  opacity: 0;
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.92); opacity: .7; }
  100% { transform: scale(1.16); opacity: 0; }
}
.code-input {
  letter-spacing: .42em;
  text-align: center;
  font-size: clamp(22px, 4vw, 27px);
  font-weight: 700;
  font-family: var(--mono);
  height: 58px;
  padding-left: .42em;
  border-radius: var(--radius);
}
.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--dur) var(--ease);
}
.session-row:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }
.session-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  flex: none;
}
[data-theme="dark"] .session-ico { background: rgba(75, 107, 251, .15); }
.session-ico svg { width: 18px; height: 18px; }

/* 作业卡 */
.asg-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(14px, 2vw, 18px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.asg-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow); transform: translateY(-1px); }
.asg-title { font-size: 15px; font-weight: 600; }
.asg-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); }

/* 文件项 */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
}
.file-item svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }

/* ================= 响应式 ================= */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 210px 1fr; }
}

@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { min-height: 100vh; min-height: 100dvh; }
  .auth-theme { top: 16px; right: 16px; }

  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 268px;
    transform: translateX(-100%);
    transition: transform .26s var(--ease);
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: none; }
  .sidebar-mask {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 55;
    animation: fadeIn .2s var(--ease);
  }
  .tabbar { display: block; }
  .topbar { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 640px) {
  .content { padding: 14px 12px 32px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 13px; gap: 7px; }
  .stat-num { font-size: 21px; }
  .stat-label { font-size: 11.5px; }
  .stat-ico { width: 32px; height: 32px; border-radius: 9px; }
  .stat-ico svg { width: 16px; height: 16px; }
  .modal { max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-root { align-items: flex-end; padding: 0; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .user-chip .u-role { display: none; }
  .topbar-title { font-size: 15px; }
  .card-head { padding: 13px 14px; }
  .card-body { padding: 14px; }
}

@media (max-width: 340px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-panel { padding: 22px 18px; }
}

/* 超宽屏 */
@media (min-width: 1920px) {
  .content { max-width: 1680px; }
  .stu-header-inner, .stu-main { max-width: 1200px; }
}

/* 横屏矮屏 */
@media (max-height: 560px) and (min-width: 720px) {
  .auth-brand { padding: 24px 40px; }
  .auth-feats { gap: 9px; margin-top: 14px; }
}
