/* ==========================================================================
   后台控制台：总览 / 教师端 / 管理端 布局与专用组件
   ========================================================================== */
#appShell { display: flex; min-height: 100vh; }

/* ---------- 侧栏 ---------- */
.sidebar {
  width: 224px; flex: none; background: var(--sidebar); color: #c9d8e8;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20;
}
.sidebar-brand { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #12b39c, #1e7ff0); display: flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 14px rgba(18,179,156,.3);
}
.brand-name { font-size: 14.5px; font-weight: 700; color: #fff; letter-spacing: .3px; }
.brand-sub { font-size: 10.5px; color: #7e9ab5; letter-spacing: 1.2px; margin-top: 1px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-group { margin-bottom: 18px; }
.nav-label { font-size: 10.5px; color: #5f7d9b; letter-spacing: 1.4px; padding: 0 10px 8px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px;
  border: none; border-radius: 8px; background: transparent; color: #aec2d7;
  font-size: 13.5px; text-align: left; transition: .15s; margin-bottom: 3px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(18,179,156,.24), rgba(30,127,240,.13)); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 #19c2aa; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; flex: none; }
.nav-item .nav-badge { margin-left: auto; font-size: 10px; background: #e94b57; color: #fff; border-radius: 9px; padding: 1px 6px; }
.sidebar-foot { padding: 13px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #6f8ba7; }
.sidebar-foot .sys-line { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex: none; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 15;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crumb { font-size: 12px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.live-pill { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; padding: 5px 11px; }
.pulse { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(22,164,106,.5); } 50% { box-shadow: 0 0 0 6px rgba(22,164,106,0); } }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-meta { line-height: 1.25; }
.user-meta .n { font-size: 13px; font-weight: 600; }
.user-meta .r { font-size: 11px; color: var(--muted); }
.content { padding: 22px 24px 34px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-lr { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.grid-rl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: 16px; }
@media (max-width: 1180px) {
  .grid-2, .grid-3, .grid-lr, .grid-rl { grid-template-columns: 1fr; }
}

/* ---------- 内嵌子标签 ---------- */
.subbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  border-radius: 20px; padding: 5px 14px; font-size: 12.5px; font-weight: 550; transition: .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 排行列表 ---------- */
.rank-list { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px dashed #edf1f5; }
.rank-row:last-child { border-bottom: none; }
.rank-no { width: 24px; height: 24px; border-radius: 7px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.rank-no.top1 { background: #fff2d9; color: #d99413; }
.rank-no.top2 { background: #edf1f7; color: #7d8ea3; }
.rank-no.top3 { background: #fbe9df; color: #c57a4a; }
.rank-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 550; }
.rank-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-bar { width: 80px; flex: none; }

/* ---------- 实时会话列表 ---------- */
.session-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #edf1f5; }
.session-row:last-child { border-bottom: none; }
.session-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: none; animation: pulse 1.6s infinite; }
.session-main { flex: 1; min-width: 0; }
.session-title { font-size: 13px; font-weight: 600; }
.session-meta { font-size: 11.5px; color: var(--muted); }
.session-score { font-size: 17px; font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; }

/* ---------- 设备墙 ---------- */
.device-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.device-cell {
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px; background: #fff;
  cursor: pointer; transition: .15s; position: relative; overflow: hidden;
}
.device-cell:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.device-cell.offline { background: #fbfcfd; border-color: #e9eef3; }
.device-cell.busy { border-color: #bfe9e1; background: #f5fdfb; }
.device-cell .dc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.device-cell .dc-name { font-size: 12.5px; font-weight: 650; }
.device-cell .dc-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 5px; }
.device-cell.offline .dc-name { color: var(--muted); }

/* ---------- 条形指标 ---------- */
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-item { display: grid; grid-template-columns: 92px 1fr 54px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-item .bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-item .bar-val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- 时间线 / 事件 ---------- */
.event-list { display: flex; flex-direction: column; gap: 0; }
.event-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #edf1f5; font-size: 12.5px; }
.event-item:last-child { border-bottom: none; }
.event-time { color: var(--muted); font-size: 11.5px; width: 62px; flex: none; font-variant-numeric: tabular-nums; }
.event-body { flex: 1; color: var(--text-2); }
.event-body b { color: var(--text); }

/* ---------- 项目卡 ---------- */
.sport-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.sport-card { border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px; background: #fff; }
.sport-card .sc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sport-ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; background: var(--primary-soft); }
.sport-card .sc-name { font-weight: 650; font-size: 13.5px; }
.sport-card .sc-meta { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cdd7e3; border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(17px); }

/* ---------- 说明块 ---------- */
.note {
  border-radius: 9px; padding: 12px 14px; font-size: 12.5px; line-height: 1.7;
  background: var(--blue-soft); color: #2a4c96; border: 1px solid #d8e3ff;
}
.note.green { background: var(--primary-soft); color: #0b6e62; border-color: #c9ece5; }
.note.orange { background: var(--orange-soft); color: #9a5a1e; border-color: #ffdfc6; }
.note b { font-weight: 700; }

/* ---------- 详情抽屉 ---------- */
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); font-weight: 550; }

/* ---------- 人脸库对接中心 ---------- */
.face-flow { display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px; }
.flow-step {
  flex: 1 1 106px; min-width: 100px; max-width: 152px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 9px;
  background: var(--panel-2); text-align: center;
}
.fs-no {
  width: 24px; height: 24px; border-radius: 7px; color: #fff;
  font-size: 11px; font-weight: 700; margin: 0 auto 7px;
  display: flex; align-items: center; justify-content: center;
}
.fs-t { font-size: 12.5px; font-weight: 650; color: var(--text); }
.fs-d { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-top: 3px; }
.flow-arrow { display: flex; align-items: center; color: var(--muted); font-size: 15px; flex: none; }
@media (max-width: 1180px) { .flow-arrow { display: none; } }

.face-switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.face-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--panel-2); cursor: pointer;
}
.face-switch:hover { border-color: var(--primary); }
.face-switch b { display: block; font-size: 13px; font-weight: 650; color: var(--text); }
.face-switch small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.code {
  background: var(--panel-2); color: var(--text-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 13px 15px; margin: 0; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px; line-height: 1.7; white-space: pre;
}

/* ---------- 打印/导出 ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .subbar { display: none !important; }
  .content { padding: 0; }
}
