* { box-sizing: border-box; }
:root {
  --bg: #f4f6f9; --panel: #fff; --line: #e4e8ee; --text: #1f2329; --muted: #8a8f99;
  --brand: #4a7cf7; --brand-soft: #eef3ff; --ok: #33b56a; --warn: #f5a623; --err: #e5484d;
}
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.6; }
.err { color: var(--err); font-size: 13px; min-height: 18px; }
.mt { margin-top: 26px; }

/* buttons / inputs */
.btn { padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.ghost { background: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; background: #fff; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--brand); }
input:disabled, select:disabled { background: #f2f3f5; color: #9aa1a9; border-color: #e6e8ec; cursor: not-allowed; -webkit-text-fill-color: #9aa1a9; }
label.row:has(input:disabled) { color: #9aa1a9; }
label { display: block; font-size: 12.5px; color: #5a6068; margin: 0 0 5px; font-weight: 500; }
label.row { display: flex; align-items: center; gap: 7px; margin: 9px 0; font-size: 13.5px; color: var(--text); }
label.row input { width: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.grid2 .full, .grid3 .full { grid-column: 1 / -1; }
.row-wrap { display: flex; align-items: center; }
.secret-toggle { width: max-content; margin: 6px 0 0; font-size: 12px; color: var(--muted); cursor: pointer; }
.secret-toggle input { margin: 0; }

/* login */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4a7cf7, #7c5cff); }
.login-card { background: #fff; padding: 34px; border-radius: 16px; width: 330px; max-width: 92vw; box-shadow: 0 16px 48px rgba(0,0,0,.22); }
.login-card h1 { margin: 0 0 4px; font-size: 21px; }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 12.5px; }
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; padding: 11px; border: 0; border-radius: 9px; background: var(--brand); color: #fff; font-size: 15px; cursor: pointer; margin-top: 4px; }

/* layout：顶部功能栏固定不动，下方内容区独立滚动 */
html, body { height: 100%; }
body { overflow: hidden; }
.layout { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.appbar { flex: 0 0 auto; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.appbar-row { display: flex; align-items: center; gap: 14px; padding: 10px 20px; }
.logo { display: flex; align-items: center; gap: 9px; padding: 0; flex: 0 0 auto; }
.logo .ico { font-size: 20px; }
.logo-txt b { display: block; font-size: 14.5px; }
.logo-txt small { color: var(--muted); font-size: 11px; }
.side-nav { display: flex; flex-direction: row; align-items: center; gap: 5px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.nav-item { text-align: center; padding: 8px 14px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; font-size: 14px; color: #5a6068; white-space: nowrap; }
.nav-item:hover { background: #f4f6f9; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.appbar-right { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.side-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.run { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.page-title { display: none; }

.main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.content { flex: 1 1 auto; padding: 22px 26px 40px; overflow: auto; -webkit-overflow-scrolling: touch; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 13px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 17px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 25px; font-weight: 700; margin-top: 5px; letter-spacing: -.5px; }
.stat.blue .v { color: var(--brand); }
.stat.green .v { color: var(--ok); }
.stat.orange .v { color: var(--warn); }
.stat.soon .v { color: #c9820a; }
.stat.red .v { color: #d64545; }
.stat.gray .v { color: #9aa1a9; }
.stat.notstarted .v { color: #7266c9; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 190px; }
.toolbar select { width: auto; min-width: 118px; }
.toolbar-sub { margin: 9px 0 15px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* 成绩总览内嵌报表 */
.ov-wrap { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ov-frame { display: block; width: 100%; height: calc(100vh - 210px); min-height: 560px; border: 0; }
[data-device="mobile"] .ov-frame { height: calc(100vh - 260px); min-height: 460px; }
/* 颜色图例 */
.legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-left: auto; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #5a6068; white-space: nowrap; }
.lg::before { content: ''; width: 13px; height: 13px; border-radius: 3px; border: 1px solid; border-left-width: 3px; flex: 0 0 auto; }
.lg-notstarted::before { background: #f0edff; border-color: #d6cef4; border-left-color: #7266c9; }
.lg-ongoing::before { background: #e9faf0; border-color: #bfe8d0; border-left-color: #33b56a; }
.lg-upcoming::before { background: #fff5e0; border-color: #f3d69b; border-left-color: #e8a33d; }
.lg-late::before { background: #ffece7; border-color: #f9c5b2; border-left-color: #d9481f; }
.lg-done::before { background: #e8eaee; border-color: #d3d7de; border-left-color: #8b93a0; }
.lg-latecheckin::before { background: #fff4e8; border-color: #f6d5a8; border-left-color: #e2711d; }

/* task cards */
.task-list { display: flex; flex-direction: column; gap: 13px; }
.group-title { font-size: 13px; font-weight: 600; color: #5a6068; margin: 6px 0 -2px; display: flex; align-items: center; gap: 8px; }
.group-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
/* align-items:start：内容少的卡片（如公告/通知）不再被拉高到同排最高卡片，避免卡内出现大片空白 */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 13px; align-items: start; }
.task { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
/* 未开始=浅紫；进行中=浅绿 / 即将到期=浅黄 / 已逾期=浅橙 / 已完结=灰 */
.task.notStarted { background: #f0edff; border-color: #d6cef4; box-shadow: inset 4px 0 0 #7266c9; }
.task.submitted, .task.ongoing { background: #e9faf0; border-color: #bfe8d0; box-shadow: inset 4px 0 0 #33b56a; }
.task.upcoming { background: #fff5e0; border-color: #f3d69b; box-shadow: inset 4px 0 0 #e8a33d; }
.task.late { background: #ffece7; border-color: #f9c5b2; box-shadow: inset 4px 0 0 #d9481f; }
/* 逾期打卡：有真实打卡记录但晚于截止，用浅橙与「完全未打卡」区分 */
.task.lateCheckin { background: #fff4e8; border-color: #f6d5a8; box-shadow: inset 4px 0 0 #e2711d; }
.late-info { color: #b4450f; font-weight: 600; }
.task.done { background: #e8eaee; border-color: #d3d7de; box-shadow: inset 4px 0 0 #8b93a0; }
.task.done .tt { color: #454c56; }
.task.done .meta { color: #666d78; }
.task.done .foot { color: #868d98; }
.badge.u-notStarted { background: #e5dfff; color: #5d50ae; }
.badge.u-submitted, .badge.u-ongoing { background: #e4f6ec; color: #1a8f4c; }
.badge.u-upcoming { background: #ffefcf; color: #b07706; }
.badge.u-late { background: #ffd7c7; color: #a8330d; }
.badge.u-lateCheckin { background: #ffe2bd; color: #96550a; }
.badge.u-done { background: #e9ebef; color: #7b828c; }
.task .head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.task .iden { margin-left: auto; font-size: 11px; color: var(--muted); }
.task .tt { font-weight: 600; font-size: 14.5px; line-height: 1.45; margin-bottom: 7px; }
.task .meta { font-size: 12.5px; color: #5a6068; line-height: 1.7; }
.task .meta:empty { display: none; }
/* 公告 / 通知类卡片：内容少，收紧上下留白，避免浪费空间 */
.task.announce { padding: 9px 13px; }
.task.announce .head { margin-bottom: 5px; }
.task.announce .tt { margin-bottom: 4px; font-size: 14px; line-height: 1.4; }
.task.announce .meta { line-height: 1.5; font-size: 12px; }
.task.announce .foot { margin-top: 6px; padding-top: 6px; }
.task.announce .growth-comments { margin-top: 7px; }
.task .meta .sep { color: #d5d9e0; margin: 0 5px; }
/* 未到期任务的实时剩余时间（精确到秒） */
.countdown { font-size: 12.5px; font-variant-numeric: tabular-nums; letter-spacing: .3px; margin-top: 6px; padding: 3px 9px; border-radius: 7px; display: inline-block; font-weight: 600; }
.countdown.cd-go { background: #eaf6ee; color: #1f7a3d; }
.countdown.cd-soon { background: #fff4d6; color: #9a6700; }
.countdown.cd-start { background: #eef0f5; color: #5a6068; }
.countdown.cd-done { background: #f1f2f5; color: #99a; font-weight: 500; }
.growth-comments { margin-top: 10px; border: 1px solid rgba(101, 116, 139, .2); border-radius: 9px; background: rgba(255,255,255,.72); overflow: hidden; }
.growth-comments summary { padding: 8px 10px; color: #47617c; font-size: 12px; font-weight: 600; cursor: pointer; user-select: none; }
.growth-comments[open] summary { border-bottom: 1px solid rgba(101, 116, 139, .14); }
.growth-list { max-height: 320px; overflow-y: auto; padding: 4px 10px; }
.growth-item { padding: 8px 0 8px 9px; border-left: 3px solid #55aa7b; }
.growth-item + .growth-item { border-top: 1px dashed rgba(101, 116, 139, .18); }
.growth-item.improve { border-left-color: #dc8b48; }
.growth-item-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px; font-size: 11.5px; color: #4b5563; }
.growth-item-head b { color: #263d53; font-size: 12px; }
.growth-item-head span { color: #7b8794; }
.growth-remark { margin-top: 4px; color: #5f6b78; font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.task .foot { font-size: 11.5px; color: #858c96; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(0,0,0,.06); }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-push { flex: none; padding: 5px 11px; border: 1px solid #b8ccf4; border-radius: 7px; background: #eef4ff; color: #3264b8; font-size: 11.5px; cursor: pointer; transition: transform .12s ease, background .16s ease, box-shadow .16s ease; }
.task-push:hover:not(:disabled) { background: #dfeaff; box-shadow: 0 2px 7px rgba(50,100,184,.16); }
.task-push:active:not(:disabled) { transform: translateY(1px) scale(.96); box-shadow: none; }
.task-push:focus-visible { outline: 2px solid #4a7cf7; outline-offset: 2px; }
.task-push:disabled { cursor: wait; opacity: .72; }
.task-push.loading { animation: pushPulse 1s ease-in-out infinite alternate; }
.task-push.success { border-color: #9fd5b5; background: #e8f8ef; color: #18834a; }
.task-push.error { border-color: #efb4ae; background: #fff0ee; color: #bd3c32; }
.push-feedback { margin-top: 7px; font-size: 11.5px; line-height: 1.55; overflow-wrap: anywhere; }
.push-feedback:empty { display: none; }
.push-feedback.success { color: #18834a; }
.push-feedback.partial { color: #a66a08; }
.push-feedback.error { color: #bd3c32; }
.push-feedback.loading { color: #5a6068; }
@keyframes pushPulse { from { opacity: .58; } to { opacity: 1; } }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; background: #f0f2f5; color: #6b7280; }
.badge.hw { background: #fff2e6; color: #e8860c; }
.badge.st { background: #eafaf0; color: var(--ok); }
.badge.fb { background: #fff6e0; color: #d1880a; }
.badge.done { background: #f0f2f5; color: #6b7280; }

/* settings */
.subnav { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.sub-item { padding: 8px 15px; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: #5a6068; }
.sub-item.active { background: var(--brand-soft); border-color: #c9daff; color: var(--brand); font-weight: 600; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; max-width: clamp(860px, 62vw, 1200px); }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.iden-row { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fbfcfd; }
.iden-row .grid2 { margin-bottom: 8px; }
.panel-actions { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 9px; align-items: center; }
.panel-actions .save-msg { margin-left: 4px; }

/* settings lock */
.lock-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 17px; border-radius: 12px; margin-bottom: 16px; max-width: clamp(860px, 62vw, 1200px);
  background: #fff8ec; border: 1px solid #ffe0a8;
}
.lock-bar.unlocked { background: #eefaf2; border-color: #b9e6ca; }
.lock-info { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.lock-ico { font-size: 19px; line-height: 1.2; }
.lock-txt { min-width: 0; }
.lock-txt b { font-size: 14px; }
.lock-txt .muted { margin-top: 3px; line-height: 1.6; }
.lock-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.lock-timer { font-size: 12px; color: #d1880a; background: #fff; padding: 4px 9px; border-radius: 20px; border: 1px solid #ffe0a8; font-family: ui-monospace, Menlo, monospace; }
/* 锁定时整个设置面板呈只读态 */
#page-settings.locked .sub-panel { opacity: .93; }
#page-settings.locked .sub-panel input,
#page-settings.locked .sub-panel select { background: #f5f6f8; }
#page-settings.locked .iden-row { background: #f7f8fa; }
#page-settings.locked .sub-panel .btn:not(#test-notify) { opacity: .45; cursor: not-allowed; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(20, 24, 31, .45); display: flex; align-items: center; justify-content: center; z-index: 120; padding: 18px; }
.modal-card { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.modal-card h3 { margin: 0 0 8px; font-size: 16.5px; }
.modal-card .muted { line-height: 1.65; }
.modal-card input { margin: 14px 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }

/* 统计快照 */
.stats-snap { margin-bottom: 16px; max-width: clamp(860px, 62vw, 1200px); }
.snap-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.snap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(94px, 1fr)); gap: 10px; margin-bottom: 10px; }
.snap-cell { background: #f7f9fc; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.snap-cell span { display: block; font-size: 11.5px; color: var(--muted); }
.snap-cell b { font-size: 18px; }

/* 分析页 */
.an-card { margin-bottom: 16px; overflow-x: auto; }
.an-card h3 { margin: 0 0 12px; font-size: 14.5px; }
.an-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.student-table { min-width: 1320px; }
.growth-table { min-width: 780px; }
.checkin-table { min-width: 920px; }
.student-table td, .student-table th, .growth-table td, .growth-table th, .checkin-table td, .checkin-table th { white-space: nowrap; }
.checkin-table td:nth-child(1), .checkin-table td:nth-child(3) { white-space: normal; min-width: 190px; line-height: 1.55; }
.an-subhead { margin: 20px 0 10px; color: #465363; font-size: 13.5px; }
.mini-stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 0 0 16px; }
.mini-stats .stat { padding: 11px 13px; }
.mini-stats .stat .v { font-size: 22px; }
.stat .v.small-value { font-size: 16px; letter-spacing: 0; white-space: nowrap; }
.point-up { color: #18834a !important; }
.point-down { color: #bd5a32 !important; }
.rate-note { margin: -3px 0 13px; line-height: 1.65; }
.an-chart { width: 100%; height: auto; display: block; }
.an-bars { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.an-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.an-name { width: 130px; flex: 0 0 auto; color: #3f4650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar { flex: 1; height: 15px; background: #f0f2f5; border-radius: 8px; overflow: hidden; min-width: 60px; }
.an-bar i { display: block; height: 100%; background: linear-gradient(90deg, #5b9de0, #2f6fb5); border-radius: 8px; }
.an-val { width: 118px; flex: 0 0 auto; text-align: right; color: #6b7280; font-variant-numeric: tabular-nums; }
.an-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 12.5px; }
.an-table th, .an-table td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); }
.an-table th { color: var(--muted); font-weight: 600; background: #fafbfc; }
.an-table td { color: #3f4650; }
.an-table tbody tr:hover { background: #f8fafd; }
/* 分析页可排序表头：点击列头切换降序 / 升序 */
.an-table th.an-th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.an-table th.an-th-sort:hover { color: #2f6fb5; background: #f2f6fc; }
.an-table th.an-th-sort::after { content: ' ⇅'; color: #c3cad3; font-weight: 400; }
.an-table th.an-th-sort.active { color: #2f6fb5; }
.an-table th.an-th-sort.active::after { content: ''; }
.badge.cls { background: #eef2fa; color: #3f5b8c; }
.btn.danger { background: #d9403a; color: #fff; border-color: #d9403a; }
.btn.danger:hover { background: #c0362f; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 10px 0; }

/* logs */
.log-list { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.log-item .who { font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 1px 7px; border-radius: 20px; white-space: nowrap; }
.log-item.audit .lv { background: #eef3ff; color: var(--brand); }
.log-item { padding: 10px 15px; border-bottom: 1px solid #f2f4f7; display: flex; gap: 11px; font-size: 12.5px; align-items: baseline; }
.log-item:last-child { border-bottom: 0; }
.log-item .ts { color: #a8adb5; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; }
.log-item .lv { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: #f0f2f5; color: #6b7280; }
.log-item.info .lv { background: #eafaf0; color: var(--ok); }
.log-item.warn .lv { background: #fff6e0; color: #d1880a; }
.log-item.error .lv { background: #fdecec; color: var(--err); }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 11px 20px; border-radius: 9px; font-size: 13.5px; z-index: 99; }

/* ============ 终端自适应 ============ */

/* 设备信息标识 */
.device-chip { font-size: 11.5px; color: var(--muted); background: #f4f6f9; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.bottom-nav { display: none; }

/* ---------- 平板 (>=768 且 <1024，或 iPad) ---------- */
[data-device="tablet"] .appbar-row { padding: 9px 13px; gap: 10px; }
[data-device="tablet"] .logo-txt { display: none; }
[data-device="tablet"] .nav-item { font-size: 13px; padding: 8px 11px; }
[data-device="tablet"] .appbar-right { font-size: 10.5px; gap: 8px; }
[data-device="tablet"] .side-status span:last-child,
[data-device="tablet"] #side-last, [data-device="tablet"] #side-device { display: none; }
[data-device="tablet"] .stats { grid-template-columns: repeat(2, 1fr); }
[data-device="tablet"] .task-grid { grid-template-columns: repeat(2, 1fr); }
[data-device="tablet"] .grid3 { grid-template-columns: repeat(2, 1fr); }
[data-device="tablet"] .card { max-width: none; }

/* ---------- 手机 (<768) ---------- */
[data-device="mobile"] .appbar-row { padding: 8px 12px; gap: 8px; }
[data-device="mobile"] .logo-txt { display: none; }
[data-device="mobile"] .side-nav { display: none; }
[data-device="mobile"] #side-last, [data-device="mobile"] #side-device { display: none; }
[data-device="mobile"] .bottom-nav {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border: 0; background: transparent; font-size: 11px; color: #5a6068; cursor: pointer; }
.bn-item .bn-ico { font-size: 17px; line-height: 1; }
.bn-item.active { color: var(--brand); font-weight: 600; }

[data-device="mobile"] .content { padding: 14px 13px 84px; }
[data-device="mobile"] .appbar-right { gap: 8px; }
[data-device="mobile"] .device-chip { display: none; }
[data-device="mobile"] .stats { grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 15px; }
[data-device="mobile"] .stat { padding: 12px 13px; }
[data-device="mobile"] .stat .v { font-size: 21px; }
[data-device="mobile"] .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
[data-device="mobile"] .toolbar select,
[data-device="mobile"] .toolbar .grow { width: 100%; }
[data-device="mobile"] .task-grid { grid-template-columns: 1fr; }
[data-device="mobile"] .grid2, [data-device="mobile"] .grid3 { grid-template-columns: 1fr; gap: 10px; }
[data-device="mobile"] .card { padding: 15px 14px; max-width: none; border-radius: 12px; }
[data-device="mobile"] .subnav { gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
[data-device="mobile"] .sub-item { flex: 0 0 auto; padding: 8px 13px; font-size: 13px; }
[data-device="mobile"] .panel-actions { flex-wrap: wrap; }
[data-device="mobile"] .legend { margin-left: 0; gap: 9px; width: 100%; }
[data-device="mobile"] .toolbar-sub { gap: 7px; }
[data-device="mobile"] .lock-bar { flex-direction: column; align-items: stretch; gap: 11px; padding: 13px 14px; max-width: none; }
[data-device="mobile"] .lock-actions { justify-content: flex-end; }
[data-device="mobile"] .iden-row { padding: 11px; }
[data-device="mobile"] .log-item { flex-wrap: wrap; gap: 6px; }
[data-device="mobile"] .btn { padding: 9px 13px; }
[data-device="mobile"] .toast { bottom: 78px; }

/* 触摸设备：加大点击热区 */
html[data-touch="1"] .btn { min-height: 38px; }
html[data-touch="1"] .nav-item, html[data-touch="1"] .sub-item { min-height: 40px; }

/* ---------- 学生头像 ---------- */
.task .who { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.task .who .iden { margin-left: 0; font-size: 12px; color: var(--muted); }
.avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; }
.avatar.ph { display: inline-flex; align-items: center; justify-content: center; }

.mini-av { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 4px; }

.av-preview { margin: 12px 0; }
.av-pv-item { display: flex; align-items: center; gap: 14px; }
.av-pv-img { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--brand); flex: 0 0 auto; }
.av-pv-img img { width: 100%; height: 100%; object-fit: cover; }

.av-list { display: flex; flex-wrap: wrap; gap: 10px; }
.av-chip { display: inline-flex; align-items: center; gap: 8px; background: #f6f8fa; border: 1px solid var(--line); border-radius: 20px; padding: 4px 13px 4px 4px; font-size: 13px; }
.av-chip-av { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.av-chip-av img { width: 100%; height: 100%; object-fit: cover; }
.mt-xs { margin-top: 6px; }
.speak-range { display: flex; align-items: center; gap: 7px; }
.speak-range input { width: 84px; flex: 0 0 auto; }
.speak-range .muted { flex: 0 0 auto; }
.pw-hint { min-height: 18px; }
.pw-hint.ok { color: #16a34a; }
.pw-hint.bad { color: #dc2626; }

/* ============ 浏览器窗口自适应兜底（纯 CSS，不依赖 JS 设备识别） ============ */
/* 窄窗口通用防溢出：任何布局模式下都生效，只收紧间距/字号，不改变导航结构 */
@media (max-width: 900px) {
  .content { padding: 16px 16px 36px; }
  .appbar-row { padding: 9px 14px; gap: 9px; }
  .nav-item { padding: 8px 11px; }
  .toolbar { gap: 8px; }
  .toolbar select { min-width: 104px; }
  .card, .lock-bar, .stats-snap { max-width: none; }
  .an-name { width: 104px; }
  .an-val { width: 100px; }
}
@media (max-width: 640px) {
  .content { padding: 14px 12px 84px; }
  .appbar-row { padding: 8px 12px; gap: 8px; }
  .appbar-right { gap: 8px; }
  .logo-txt { display: none; }
  .card, .lock-bar { padding: 15px 14px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar select, .toolbar .grow { width: 100%; min-width: 0; }
  .task-grid { grid-template-columns: 1fr; }
  .an-name { width: 84px; }
  .an-val { width: 88px; font-size: 11.5px; }
  .panel-actions { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 26px 22px; }
}
/* 超宽屏：卡片/表格列随窗口拉伸，不出现过窄固定列 */
@media (min-width: 1600px) {
  .content { padding: 26px 34px 48px; }
  .task-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
  .sub-area { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}
.log-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.log-pager .btn { min-width: 96px; }

/* ============ 高分屏 / 4K 分辨率适配（data-hires 由 JS 按屏幕分辨率+DPR 设置） ============ */
[data-hires="1"] .content { padding: 26px 32px 44px; }
[data-hires="1"] .nav-item { font-size: 15px; padding: 9px 16px; }
[data-hires="1"] .stat .k { font-size: 13px; }
[data-hires="1"] .stat .v { font-size: 29px; }
[data-hires="1"] .task .tt { font-size: 16px; }
[data-hires="1"] .task .meta { font-size: 13.5px; }
[data-hires="1"] .task .foot { font-size: 12.5px; }
[data-hires="1"] input, [data-hires="1"] select { font-size: 14.5px; }
[data-hires="1"] .btn { font-size: 14px; }
[data-hires="1"] .an-table { font-size: 13.5px; }
[data-hires="1"] .log-item { font-size: 13.5px; }
[data-hires="1"] .hint, [data-hires="1"] .muted { font-size: 12.5px; }

/* ============ 分析页 / 设置页 分辨率专项适配 ============ */
/* 学习情况页（合并：分析+学生状态+成绩总览）：卡片/统计/运营区放开 860px 上限，用满内容区 */
#page-learning .card, #page-learning .stats, #page-learning .an-overview,
#page-learning .an-card, #page-learning .ops-analysis { max-width: none; }
/* 设置页：卡片上限随分辨率提高（1366≈984px / 1920≈1280px），表单更舒展但不失控 */
#page-settings .card, #page-settings .lock-bar { max-width: clamp(860px, 72vw, 1280px); }
/* 宽屏（≥1600px）：分析卡片双列布局，充分利用大屏；窄屏保持单列 */
@media (min-width: 1600px) {
  #an-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  #an-body .an-card { margin-bottom: 0; }
  #an-body .an-card.wide { grid-column: 1 / -1; }
}
/* 高分屏双列时表格允许自身横向滚动，避免挤压 */
@media (min-width: 1600px) {
  #an-body .an-table { min-width: 460px; }
}

/* ============ 独立成绩分析 ============ */
#page-grades .card, #page-grades .stats { max-width: none; }
.grade-toolbar { margin-bottom: 14px; }
.grade-notice { margin-bottom: 16px; padding: 12px 15px; border: 1px solid #f3d69b; border-radius: 10px; background: #fff8e8; color: #8a620c; font-size: 13px; line-height: 1.65; }
.grade-stat-value { font-size: 23px; white-space: nowrap; }
.grade-analysis { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-bottom: 24px; }
.grade-analysis .an-card { margin: 0; min-width: 0; }
.grade-subject-card { grid-column: 1 / -1; }
.grade-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grade-table { min-width: 650px; }
.grade-record .grade-table { min-width: 520px; }
.grade-table td, .grade-table th { white-space: nowrap; }
.grade-subject-bars { margin-bottom: 16px; }
.grade-subject-bars .an-val { width: 190px; }
.grade-distribution .an-val { width: 60px; }
.grade-line-chart { min-height: 210px; }
.grade-empty { padding: 24px 12px; color: var(--muted); font-size: 13px; line-height: 1.7; text-align: center; }
.grade-empty.compact { padding: 16px 8px; }
.grade-section-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.grade-section-head h2 { margin: 0; font-size: 17px; }
.grade-records { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.grade-record { min-width: 0; }
.grade-record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.grade-record-head h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.5; }
.grade-record-head .badge { flex: 0 0 auto; }
.grade-record-meta { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.grade-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; padding: 12px 15px; border-radius: 9px; background: var(--brand-soft); color: #355eae; font-size: 13px; }
.grade-total b { font-size: 23px; }
.grade-total-row { background: #f5f8ff; }
.grade-comment { margin-top: 14px; padding: 12px 14px; border-left: 3px solid #a9c8ea; background: #f8fafd; font-size: 12.5px; line-height: 1.7; }
.grade-comment p { margin: 5px 0 0; white-space: pre-wrap; }
.score-up { color: #d64545 !important; }
.score-down { color: #23945a !important; }
.student-anomaly { background: #ffecec !important; }
.student-status-table { min-width: 1120px; }

@media (min-width: 1600px) {
  .grade-records { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 1100px) {
  .grade-analysis { grid-template-columns: minmax(0, 1fr); }
  .grade-subject-card { grid-column: auto; }
}
@media (max-width: 640px) {
  .grade-stat-value { font-size: 19px; }
  .grade-record-head { flex-direction: column; gap: 8px; }
  .grade-subject-bars .an-val { width: 132px; }
  .grade-line-chart { min-height: 180px; }
}

/* 学习情况页：运营分析折叠区 */
.ops-analysis { margin-top: 20px; }
.ops-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid #e6e8eb;
  border-radius: 12px;
  background: #fbfcfe;
  color: #2f3a47;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ops-toggle:hover { background: #f3f6fb; }
.ops-caret { transition: transform .18s ease; color: #8a93a0; font-size: 13px; }
.ops-body { margin-top: 14px; }

/* ============ 合集父卡子任务展开 ============ */
.task-sub-toggle {
  border: 1px solid #d7dee8; background: #f7f9fc; color: #4a5568;
  border-radius: 12px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  transition: background .15s ease;
}
.task-sub-toggle:hover { background: #eaf1f8; }
.sub-area {
  /* 独立网格区：横跨整行，与主网格同宽同列规则（水平不加内边距，保证子卡与主卡像素级等宽） */
  grid-column: 1 / -1;
  margin-top: 2px; padding: 12px 0;
  background: #f7f9fc; border: 1px dashed #d7dee8; border-radius: 10px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 13px;
}
.sub-area .task { margin-bottom: 0; }
.sub-area .countdown { font-size: 12px; }
/* display:grid 会覆盖 hidden 属性的默认隐藏，必须显式恢复 */
.sub-area[hidden] { display: none; }

/* ============ 语音测试播报文本回显 ============ */
.speak-test-text {
  margin-top: 10px; padding: 10px 12px;
  background: #f7f9fc; border: 1px solid #dbe4ee; border-radius: 8px;
  font-size: 13px; color: #333;
}
.speak-test-body {
  margin: 6px 0; padding: 8px 10px;
  background: #fff; border-left: 3px solid #4a90d9; border-radius: 4px;
  line-height: 1.7; word-break: break-all; white-space: pre-wrap;
}

/* ============ 全局按钮点击/执行反馈 ============ */
button { transition: transform .08s ease, filter .12s ease, box-shadow .12s ease; }
button:active { transform: scale(.955); filter: brightness(.9); }
.fx-ripple-host { position: relative; overflow: hidden; }
.fx-ripple {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.55) 0%, rgba(255,255,255,.25) 45%, transparent 70%);
  transform: scale(0); opacity: .9; pointer-events: none;
  animation: fx-ripple .55s ease-out forwards;
}
@keyframes fx-ripple { to { transform: scale(2.6); opacity: 0; } }
button.fx-busy { pointer-events: none; opacity: .72; }
button.fx-busy::after {
  content: ''; display: inline-block; width: 11px; height: 11px;
  margin-left: 6px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; vertical-align: -2px;
  animation: fx-spin .7s linear infinite;
}
@keyframes fx-spin { to { transform: rotate(360deg); } }
