* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2F6BFF;
  --primary-light: #EAF0FF;
  --ok: #16A34A;
  --warn: #D97706;
  --danger: #DC2626;
  --text: #1C2434;
  --text-2: #5B6472;
  --bg: #F2F4F8;
  --border: #E3E8F0;
  --card: #FFFFFF;
}
body { font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #2F6BFF 0%, #4E8CFF 55%, #7FB0FF 100%); }
.login-card { width: 380px; background: #fff; border-radius: 16px; padding: 40px 36px 28px; box-shadow: 0 20px 60px rgba(31, 60, 145, 0.25); }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); color: #fff; font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.login-title { text-align: center; font-size: 20px; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 28px; }
.login-hint { text-align: center; color: #9AA3B2; font-size: 12px; margin-top: 18px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #14213D; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.side-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; }
.side-title { font-size: 16px; font-weight: 600; }
.side-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 4px; border-radius: 10px; color: #C7D2E8; cursor: pointer; font-size: 14px; transition: background .15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-download { text-decoration: none; border: 1px solid rgba(255,255,255,0.14); margin-top: 6px; }
.nav-download:hover { text-decoration: none; border-color: rgba(255,255,255,0.35); }
.nav-download:active { color: #fff; }
.nav-badge { background: #FF4D4F; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: bold; line-height: 1.4; }
.nav-tag { margin-left: auto; font-size: 11px; background: rgba(255,255,255,0.12); padding: 2px 8px; border-radius: 10px; }
.nav-item.active .nav-tag { background: rgba(255,255,255,0.22); }
.side-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.side-user-name { font-size: 13px; color: #C7D2E8; margin-bottom: 8px; word-break: break-all; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: var(--card); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.page-title { font-size: 18px; font-weight: 600; }
.content { padding: 22px 24px; flex: 1; }

/* ---------- 卡片/表格 ---------- */
.card { background: var(--card); border-radius: 12px; border: 1px solid var(--border); padding: 18px 20px; margin-bottom: 18px; }
.card h3 { font-size: 15px; margin-bottom: 14px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; background: #F8FAFD; }
tr:hover td { background: #F7FAFF; }
.empty { text-align: center; color: #9AA3B2; padding: 40px 0; }

/* ---------- 表单/控件 ---------- */
.field { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; margin-bottom: 14px; outline: none; }
.field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,0.12); }
.field-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
select.field { width: auto; min-width: 160px; margin-bottom: 0; }
input[type="search"].field { margin-bottom: 0; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn { border: none; border-radius: 9px; padding: 9px 18px; font-size: 14px; cursor: pointer; transition: opacity .15s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost { background: transparent; color: #C7D2E8; border: 1px solid rgba(255,255,255,0.2); }
.btn-danger-outline { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn-ok { background: #2F6BFF; color: #fff; }
.btn-ok:hover { opacity: 0.9; }
.btn-off { background: #EA6668; color: #fff; }
.btn-off:hover { opacity: 0.9; }
.ops-cell { white-space: nowrap; }
.ops-cell .btn, .ops-cell .link { margin-right: 6px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-ok { background: #E7F6EC; color: var(--ok); }
.badge-off { background: #FDEBEB; color: var(--danger); }
.badge-warn { background: #FEF3E2; color: var(--warn); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-status-pending { background: #FFF4E0; color: var(--warn); }
.badge-status-ongoing { background: #E7F6EC; color: var(--ok); }
.badge-status-ended { background: #EEF1F5; color: var(--text-2); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; width: 440px; max-width: 92vw; max-height: 86vh; overflow-y: auto; padding: 24px; }
.modal h3 { font-size: 16px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ---------- 其他 ---------- */
.err-msg { background: #FDEBEB; color: var(--danger); padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.loading { text-align: center; color: var(--text-2); padding: 60px 0; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; color: var(--text-2); font-size: 13px; }
.pager button { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.stat-label { color: var(--text-2); font-size: 13px; }
.text-muted { color: var(--text-2); }
.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--danger); cursor: pointer; }
.link-danger:hover { text-decoration: underline; }

/* ---------- 看板 ---------- */
.trend-row, .dist-line { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.trend-date, .dist-label { width: 76px; font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.trend-bar { flex: 1; height: 18px; background: #F0F3F9; border-radius: 9px; overflow: hidden; }
.trend-fill { height: 100%; background: var(--primary); border-radius: 9px; min-width: 2px; transition: width .3s; }
.trend-num, .dist-num { width: 64px; font-size: 13px; font-weight: 600; text-align: right; flex-shrink: 0; }

/* ---------- 首页图文广告（P7，后台发布，位于左侧导航栏） ---------- */
#adBanner { padding: 90px 10px 8px; }
#adBanner .ad-banner { position: relative; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 6px 8px; cursor: pointer; overflow: hidden; }
#adBanner .ad-banner:hover { border-color: rgba(255,255,255,0.35); }
#adBanner .ad-img { height: 32px !important; width: auto; max-width: 96px; max-height: 32px; object-fit: contain; object-position: left center; border-radius: 6px; background: #fff; flex-shrink: 0; }
#adBanner .ad-title { flex: 1; font-size: 12.5px; color: #DDE4F0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#adBanner .ad-close { flex-shrink: 0; width: 18px; height: 18px; line-height: 16px; text-align: center; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; font-size: 11px; cursor: pointer; user-select: none; }
#adBanner .ad-close:hover { background: rgba(0,0,0,.6); }
#adBanner .ad-tag { position: absolute; top: 0; left: 0; background: #FF6B35; color: #fff; font-size: 9px; line-height: 1; padding: 3px 5px; border-radius: 0 0 6px 0; z-index: 2; }

/* ---------- P11 线上授课 ---------- */
.live-viewer-tag { display: inline-block; background: #E7F6EC; color: #2F855A; padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.live-fps-btn.active, .live-quality-btn.active { background: var(--primary); color: #fff; }
.live-fps-btn, .live-quality-btn { flex: 1; background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.input { border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--primary); }

/* ---------- P12 课堂签到 ---------- */
.att-tab-bar { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.att-tab-btn { background: none; border: none; padding: 10px 18px; font-size: 14px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.att-tab-btn:hover { color: var(--primary); }
.att-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.att-tab-panel { animation: attFadeIn .2s ease; }
@keyframes attFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.att-code-display { font-size: 48px; font-weight: 800; letter-spacing: 12px; color: var(--primary); font-family: "SF Mono", "Consolas", "Monaco", monospace; text-align: center; margin: 8px 0; line-height: 1.2; }
.att-countdown { font-size: 32px; font-weight: 700; color: var(--text); font-family: "SF Mono", "Consolas", "Monaco", monospace; margin-top: 12px; }

.att-duration-group { display: flex; gap: 8px; }
.att-duration-btn { flex: 1; padding: 9px 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text-2); font-size: 13px; cursor: pointer; transition: all .15s; }
.att-duration-btn:hover { border-color: var(--primary); color: var(--primary); }
.att-duration-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.att-student-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.att-student-tag { display: inline-block; background: #F0F3F9; color: var(--text); padding: 5px 12px; border-radius: 14px; font-size: 13px; }