/* ==========================================================================
   智训云 · 视图级组件样式
   ========================================================================== */

/* --------------------------- 页面头部 --------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h2 {
  font-size: clamp(19px, 1.6vw, 23px);
  letter-spacing: -.025em;
}
.page-head .desc {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 5px;
  max-width: 60em;
}
.page-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* --------------------------- 网格 --------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.grid-side-rev { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); }
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4, .grid-side, .grid-side-rev { grid-template-columns: 1fr; }
}

/* --------------------------- 欢迎卡 --------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  padding: clamp(20px, 2.4vw, 34px);
  background: linear-gradient(118deg, #2a2a6e 0%, #4338ca 45%, #7c4ddb 100%);
  color: #fff;
  box-shadow: 0 18px 40px -22px rgba(67, 56, 202, .8);
}
.hero::before {
  content: "";
  position: absolute;
  width: 380px; height: 380px;
  right: -110px; top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 66%);
}
.hero::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: 120px; bottom: -170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.3), transparent 68%);
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { font-size: clamp(20px, 2vw, 27px); letter-spacing: -.02em; }
.hero .sub { color: rgba(255,255,255,.76); font-size: 13.5px; margin-top: 8px; max-width: 46em; }
.hero-metrics {
  display: flex;
  gap: clamp(18px, 3vw, 46px);
  margin-top: 24px;
  flex-wrap: wrap;
}
.hero-metric .v {
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.hero-metric .l {
  font-size: 11.5px;
  color: rgba(255,255,255,.62);
  letter-spacing: .03em;
  margin-top: 2px;
}
.hero-actions { display: flex; gap: 9px; margin-top: 22px; flex-wrap: wrap; }
.hero .btn-secondary {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.26);
  color: #fff;
  backdrop-filter: blur(8px);
}
.hero .btn-secondary:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); }
.hero .btn-primary {
  background: #fff;
  color: #2a2a6e;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,.4);
}
.hero .btn-primary:hover { filter: none; background: #f4f5ff; }

/* --------------------------- 列表项 --------------------------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  transition: background .14s;
}
.list-item:last-child { border-bottom: none; }
.list-item:first-child { padding-top: 0; }
.list-title { font-size: 13.5px; font-weight: 600; }
.list-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* --------------------------- 空状态 --------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 64px) 20px;
  text-align: center;
  color: var(--text-3);
}
.empty .ico-wrap {
  width: 56px; height: 56px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--text-3);
  margin-bottom: 14px;
}
.empty h4 { font-size: 14.5px; color: var(--text-2); margin-bottom: 5px; }
.empty p { font-size: 12.5px; max-width: 32em; line-height: 1.7; }

/* --------------------------- 骨架屏 --------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin-bottom: 10px; }
.sk-card { height: 120px; border-radius: var(--r); }

/* --------------------------- 筛选 chips --------------------------- */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
  font-weight: 600;
}

.search {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}
.search input {
  width: 100%;
  padding: 9px 13px 9px 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  transition: all .15s;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }

/* --------------------------- 签到：大屏二维码 --------------------------- */
.qr-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: clamp(16px, 2.4vw, 36px);
  align-items: start;
}
@media (max-width: 1000px) { .qr-stage { grid-template-columns: 1fr; } }

.qr-card {
  background: linear-gradient(170deg, #14163a, #1e1b4b 60%, #2a2160);
  border-radius: var(--r-xl);
  padding: clamp(20px, 2.4vw, 34px);
  color: #fff;
  box-shadow: 0 30px 60px -30px rgba(20, 22, 58, .9);
  position: relative;
  overflow: hidden;
}
.qr-card::before {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  top: -180px; right: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,92,255,.4), transparent 65%);
}
.qr-card > * { position: relative; z-index: 1; }
.qr-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.qr-title { font-size: clamp(17px, 1.6vw, 21px); font-weight: 650; letter-spacing: -.01em; }
.qr-class { color: rgba(255,255,255,.6); font-size: 12.5px; margin-top: 4px; }
.qr-box {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  margin: 22px auto 0;
  width: min(340px, 100%);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
  position: relative;
}
.qr-box img { width: 100%; height: auto; border-radius: 8px; }
.qr-box .qr-expired {
  position: absolute; inset: 16px;
  background: rgba(255,255,255,.94);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #1e1b4b;
  font-size: 13px;
  font-weight: 600;
  flex-direction: column;
  gap: 8px;
}
.qr-code-big {
  margin-top: 20px;
  text-align: center;
}
.qr-code-big .lbl { font-size: 11.5px; letter-spacing: .16em; color: rgba(255,255,255,.5); text-transform: uppercase; }
.qr-code-big .val {
  font-family: var(--mono);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: .18em;
  margin-top: 4px;
  background: linear-gradient(100deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.qr-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 16px;
  font-size: 11.5px;
  color: rgba(255,255,255,.5);
}

/* 实时统计 */
.live-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
}
.live-cell { background: var(--surface); padding: 14px 12px; text-align: center; }
.live-cell .v {
  font-size: clamp(19px, 1.8vw, 24px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.live-cell .l { font-size: 11px; color: var(--text-3); margin-top: 2px; }
@media (max-width: 520px) { .live-strip { grid-template-columns: repeat(2, 1fr); } }

/* 签到学员流 */
.checkin-feed { max-height: 420px; overflow: auto; }
.feed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  animation: feedIn .35s var(--ease-out);
}
@keyframes feedIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.feed-row:last-child { border-bottom: none; }

/* 学员签到卡 */
.signin-hero {
  text-align: center;
  padding: clamp(24px, 4vw, 44px) 20px;
}
.signin-hero .ring-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto 20px; }
.signin-hero .ring-wrap svg { transform: rotate(-90deg); }
.signin-hero .ring-center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  flex-direction: column;
}
.signin-hero .ring-center .t {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
}
.signin-hero .ring-center .s { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }

.code-input {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 18px 0;
}
.code-input input {
  width: 100%;
  max-width: 300px;
  text-align: center;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .3em;
  padding: 13px 8px 13px 20px;
  border-radius: var(--r);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  text-transform: uppercase;
  transition: all .15s;
}
.code-input input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* --------------------------- 作业卡 --------------------------- */
.asg-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  transition: all .2s var(--ease);
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: left;
}
.asg-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.asg-card .stripe {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
  opacity: 0;
  transition: opacity .2s;
}
.asg-card:hover .stripe { opacity: 1; }
.asg-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.asg-title { font-size: 14.5px; font-weight: 620; letter-spacing: -.01em; line-height: 1.45; }
.asg-class { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.asg-meta {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  flex-wrap: wrap;
}
.asg-meta .m { display: flex; align-items: center; gap: 5px; }

/* 上传区 */
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r);
  padding: clamp(22px, 3vw, 36px);
  text-align: center;
  cursor: pointer;
  transition: all .18s var(--ease);
  background: var(--surface-2);
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.upload-zone .u-ico {
  width: 44px; height: 44px;
  border-radius: 14px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--brand-600);
  box-shadow: var(--shadow-xs);
}
.upload-zone .u-title { font-size: 13.5px; font-weight: 600; }
.upload-zone .u-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-top: 8px;
  font-size: 12.5px;
}
.file-item .f-ext {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand-600);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .02em;
  flex: 0 0 auto;
}

/* 评分 */
.score-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -.02em;
}
.score-badge .s { font-size: 21px; }
.score-badge .m { font-size: 11.5px; color: var(--text-3); font-weight: 500; }

/* 批改抽屉 */
.grade-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .9fr);
  gap: 20px;
}
@media (max-width: 860px) { .grade-panel { grid-template-columns: 1fr; } }

/* 通知面板 */
.notif-list { max-height: 420px; overflow: auto; }
.notif-item {
  display: flex;
  gap: 11px;
  padding: 12px;
  border-radius: var(--r-sm);
  transition: background .14s;
  cursor: pointer;
  position: relative;
}
.notif-item:hover { background: var(--surface-3); }
.notif-item.unread { background: var(--brand-soft); }
.notif-item.unread:hover { filter: brightness(.98); }
.notif-item .n-ico {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--brand-600);
}
.notif-item .n-title { font-size: 13px; font-weight: 600; }
.notif-item .n-body { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.55; }
.notif-item .n-time { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* 时间线 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1.5px;
  background: var(--border);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -21px; top: 5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand);
}
.tl-item.danger::before { border-color: var(--danger); }
.tl-item.warn::before { border-color: var(--warn); }
.tl-item .tl-t { font-size: 13px; font-weight: 550; }
.tl-item .tl-d { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* 图表容器 */
.chart-box { width: 100%; overflow: visible; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* 环形图 */
.donut-wrap { display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); flex-wrap: wrap; }
.donut { position: relative; flex: 0 0 auto; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.donut-center .v { font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.donut-center .l { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; min-width: 130px; }
.dl-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dl-row i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.dl-row .dl-v { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }

/* 详情键值 */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 500; }

/* 微交互：复制 */
.copy-hint {
  font-size: 11px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color .15s;
}
.copy-hint:hover { color: var(--brand); }

/* 打印（签到表导出） */
@media print {
  .sidebar, .topbar, .tabbar, .page-actions { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ============================ 响应式细节修正 ============================ */

/* 顶栏用户菜单：禁止换行，窄屏隐藏箭头 */
.topbar-actions .dropdown > .icon-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  flex-wrap: nowrap;
}
.topbar-actions { flex: 0 0 auto; }
@media (max-width: 520px) {
  .topbar-actions { gap: 6px; }
  .topbar-actions .dropdown > .icon-btn svg:last-child { display: none; }
  .topbar-actions .dropdown > .icon-btn { padding: 4px; }
  .topbar h1 { font-size: 16px; }
}

/* 移动端英雄区指标：两列网格，避免换行错位 */
@media (max-width: 640px) {
  .hero-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }
  .hero { padding: 20px 18px; }
  .hero h2 { font-size: 19px; }
  .hero .sub { font-size: 12.5px; }
  .hero-metric .v { font-size: 21px; }
}

/* 空状态在窄屏收紧 */
@media (max-width: 640px) {
  .empty { padding: 28px 12px; }
  .empty .ico-wrap { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 10px; }
  .empty h4 { font-size: 13.5px; }
  .empty p { font-size: 12px; }
  .card-head { padding: 13px 14px; }
  .card-body { padding: 14px; }
  .card-pad { padding: 14px; }
  .page-head { margin-bottom: 14px; }
  .page-head h2 { font-size: 18px; }
  .page-head .desc { font-size: 12.5px; }
}

/* 统计卡：紧凑且去掉多余留白 */
.stat { padding: 16px 16px 14px; }
.stat .ico { margin-bottom: 12px; }
.stat .value { line-height: 1.2; }

/* 表格在窄屏可横向滚动，避免挤压 */
.table-wrap { scrollbar-width: thin; }
@media (max-width: 640px) {
  table.tbl th { font-size: 10.5px; padding: 9px 10px; }
  table.tbl td { padding: 10px 10px; font-size: 12.5px; }
}

/* 签到大屏：右侧统计卡高度自适应 */
.qr-stage > .col .checkin-feed { min-height: 120px; max-height: min(46vh, 380px); }
@media (max-width: 1000px) {
  .qr-box { width: min(300px, 100%); }
  .qr-code-big .val { font-size: 30px; }
}

/* 批改面板在高 DPI 窄屏改为单列 */
@media (max-width: 860px) {
  .grade-panel { grid-template-columns: 1fr; }
  .grade-panel > .card { max-height: none !important; position: static !important; }
}

/* 搜索框在窄屏占满 */
@media (max-width: 640px) {
  .search { max-width: none; width: 100%; }
  .toolbar, .row.wrap { row-gap: 10px; }
}

/* 登录页窄屏 */
@media (max-width: 420px) {
  .auth-panel { padding: 20px 16px 32px; }
  .auth-card h2 { font-size: 23px; }
  .auth-card .sub { margin-bottom: 22px; }
}
