* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif; background: #f3f4f6; color: #1f2937; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ============ 登录页 ============ */
#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 44px 40px 36px; width: 380px; max-width: 100%; text-align: center; }
.login-logo { font-size: 44px; margin-bottom: 10px; }
.login-card h1 { font-size: 21px; letter-spacing: 2px; margin-bottom: 8px; }
.login-sub { color: #6b7280; font-size: 13.5px; margin-bottom: 22px; }
#codeIn { width: 100%; padding: 13px 14px; border: 1.5px solid #d1d5db; border-radius: 10px; font-size: 20px; letter-spacing: 8px; text-align: center; text-transform: uppercase; margin-bottom: 14px; }
#codeIn:focus { outline: none; border-color: #4f46e5; }
/* 班级卡片网格 */
#classCards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; text-align: left; }
.ccard { position: relative; border: 1.5px solid #e5e7eb; background: #fff; border-radius: 12px; padding: 13px 8px 11px; text-align: center; }
.ccard:active { transform: scale(.96); border-color: #4f46e5; }
.ccard b { display: block; font-size: 17px; color: #111827; letter-spacing: 1px; font-weight: 700; }
.ccard span { display: block; font-size: 11.5px; color: #9ca3af; margin-top: 3px; letter-spacing: .5px; }
.ccard i { display: inline-block; font-style: normal; font-size: 11px; color: #6b7280; background: #f3f4f6; border-radius: 999px; padding: 1px 9px; margin-top: 7px; }
.ccard em { position: absolute; top: -8px; right: -5px; font-style: normal; font-size: 10.5px; color: #fff; background: #4f46e5; border-radius: 999px 0 999px 999px; padding: 2px 9px; letter-spacing: 1px; }
.ccard.last { border-color: #c7d2fe; background: #f8faff; }
#manualBtn { display: block; width: 100%; border: none; background: none; color: #6b7280; font-size: 13.5px; padding: 6px 0 10px; }
#manualBtn:active { color: #4f46e5; }
@media (min-width: 520px) { #classCards { grid-template-columns: 1fr 1fr 1fr; } }
.login-err { color: #dc2626; font-size: 13.5px; min-height: 18px; margin-top: 12px; }
.ver { margin-top: 14px; font-size: 11px; color: #c0c4cc; letter-spacing: 1px; }

/* ============ 主框架 ============ */
header { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
h1 { font-size: 19px; letter-spacing: 1px; white-space: nowrap; }
.cls-badge { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.by-badge { background: #f0fdf4; color: #047857; border: 1px solid #a7f3d0; padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.spacer { flex: 1; }
#tabs { display: flex; gap: 6px; flex-wrap: wrap; }
#tabs button { padding: 8px 14px; font-size: 14px; letter-spacing: .5px; border: 1px solid #e5e7eb; background: #fff; color: #6b7280; border-radius: 8px; }
#tabs button.on { color: #fff; background: #4f46e5; border-color: #4f46e5; }
#tabs button.locked { color: #c0c4cc; }
.sync { font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.sync.ok { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.sync.pending { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.sync.err { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.btn { padding: 9px 16px; border-radius: 8px; border: 1px solid #c7d2fe; background: #eef2ff; color: #4f46e5; font-size: 14px; }
.btn.pri { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.btn.plain { background: #fff; border-color: #e5e7eb; color: #374151; }
.btn.warn { background: #fff; border-color: #fca5a5; color: #dc2626; }
.btn.grn { background: #059669; color: #fff; border-color: #059669; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; padding: 12px 0; font-size: 15px; }

main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 90px; }
section { display: none; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 24px 26px; }
section.on { display: block; }
.tip { color: #6b7280; font-size: 14px; line-height: 1.8; margin-bottom: 14px; }
.tip b { color: #111827; }
.tip code { background: #f3f4f6; padding: 1px 7px; border-radius: 4px; color: #4f46e5; }

/* ============ ① 名单 ============ */
#raw { width: 100%; height: 150px; padding: 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; line-height: 1.9; resize: vertical; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
#rosterStat { color: #6b7280; font-size: 14px; }
#addName { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; width: 140px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 8px; margin-top: 18px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 8px; font-size: 15px; }
.chip.m { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }
.chip.f { background: #fce7f3; border: 1px solid #f9a8d4; color: #be185d; }
.chip.u { background: #f3f4f6; border: 1px solid #e5e7eb; color: #6b7280; }
.chip .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.chip .x { border: none; background: none; color: rgba(0,0,0,.22); font-size: 16px; }
.chip .x:hover { color: #dc2626; }

/* ============ ② 方阵 ============ */
.fbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.fbar .num { width: 56px; padding: 7px 6px; border: 1px solid #d1d5db; border-radius: 6px; text-align: center; }
.fbar .lb { font-size: 14px; color: #6b7280; }
.sep { width: 1px; height: 24px; background: #e5e7eb; }
#grpBar { display: none; align-items: center; gap: 8px; background: #eef2ff; border: 1px dashed #c7d2fe; padding: 7px 12px; border-radius: 8px; font-size: 14px; color: #312e81; flex-wrap: wrap; }
#grpBar.show { display: flex; }
#grpBar select { padding: 6px 8px; border: 1px solid #c7d2fe; border-radius: 6px; }
#grpBar .btn { padding: 5px 10px; font-size: 13px; }
.confban { display: none; align-items: center; gap: 12px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.confban.show { display: flex; }
.saveState { font-size: 13px; color: #6b7280; }
.saveState.saving { color: #b45309; }
.saveState.saved { color: #059669; }
.saveState.err { color: #dc2626; }

.stage { display: flex; gap: 16px; align-items: flex-start; }
#gridWrap { flex: 1; min-width: 0; overflow: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; position: relative; user-select: none; }
#gridWrap.locked::after { content: '方阵已确认锁定 · 点击「解除确认」后才能调整'; position: absolute; inset: 0; background: rgba(243,244,246,.72); display: flex; align-items: center; justify-content: center; font-size: 15px; color: #6b7280; letter-spacing: 1px; backdrop-filter: blur(1px); }
#poolWrap { width: 190px; flex: none; }
#poolWrap h3 { font-size: 14px; color: #6b7280; font-weight: 600; margin-bottom: 10px; }
#pool { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: min(620px, 60vh); overflow-y: auto; }
.pcard { padding: 10px 4px; border-radius: 8px; text-align: center; font-size: 14px; cursor: grab; touch-action: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard.m { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }
.pcard.f { background: #fce7f3; border: 1px solid #f9a8d4; color: #be185d; }
.pcard.u { background: #f3f4f6; border: 1px solid #e5e7eb; color: #6b7280; }

.fgrid { min-width: min(560px, 100%); }   /* 小方阵不强行拉宽，大屏撑满 560 */
/* 竖排模式（顺时针旋转 90° 显示）：列数变少，格子收窄、字号加大，竖屏几乎不用缩放 */
.fgrid.rot { min-width: 0; }
.fgrid.rot .fcols, .fgrid.rot .frowline { gap: 4px; }
.fgrid.rot .fcols .cl { min-width: 48px; }
.fgrid.rot .fcell { min-width: 48px; height: 54px; font-size: 14px; }
.fgrid.rot .fcell .nm { font-size: 13px; }   /* 3 字姓名完整显示（39px < 格内宽 46px） */
.fcols { display: flex; gap: 5px; margin-bottom: 4px; }
.fcols .cl { flex: 1; min-width: 56px; text-align: center; font-size: 11px; color: #9ca3af; }
.fcols .lead { width: 38px; flex: none; }
.frowline { display: flex; gap: 5px; margin-bottom: 5px; align-items: stretch; }
.rlab { width: 38px; flex: none; font-size: 11px; color: #9ca3af; display: flex; align-items: center; justify-content: center; }
.fcell { flex: 1; min-width: 56px; height: 50px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; position: relative; touch-action: auto; border: 1px dashed #d1d5db; background: #fafafa; color: #d1d5db; }
#gridWrap .fcell[data-sid] { touch-action: none; }   /* 仅编排页锁定手势（拖拽需要）；记录页方阵保持可滚动 */
.fcell.m { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; cursor: grab; }
.fcell.f { background: #fce7f3; border: 1px solid #f9a8d4; color: #be185d; cursor: grab; }
.fcell.u { background: #f3f4f6; border: 1px solid #e5e7eb; color: #6b7280; cursor: grab; }
.fcell .gb { position: absolute; top: 2px; left: 3px; font-size: 10px; color: #fff; border-radius: 3px; padding: 0 4px; }
.fcell .sc { position: absolute; bottom: 2px; right: 3px; font-size: 10.5px; font-weight: 600; border-radius: 3px; padding: 0 4px; }
.fcell .sc.p { background: #d1fae5; color: #065f46; }
.fcell .sc.n { background: #fee2e2; color: #991b1b; }
.fcell .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 92%; }
/* 请假态（B49）：饱和度+明度降低，右上角"假"角标 */
.fcell.leave { filter: saturate(.35) brightness(.82); }
.fcell .lv { position: absolute; top: 2px; right: 3px; font-size: 10px; color: #fff; background: #94a3b8; border-radius: 3px; padding: 0 4px; line-height: 1.5; }
.lvchip { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; white-space: nowrap; }
.fcell.sel { outline: 2.5px solid #4f46e5; outline-offset: -1px; }
.fcell.tgt { outline: 2px dashed #4f46e5; outline-offset: -1px; filter: brightness(.96); }
.fcell.dim { opacity: .22; }
.ghost { position: fixed; z-index: 99; pointer-events: none; background: #4f46e5; color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 15px; box-shadow: 0 6px 20px rgba(79,70,229,.35); transform: translate(-50%,-50%); }

/* ============ ③ 记录 ============ */
.lockcard { text-align: center; padding: 60px 20px; }
.lockcard .big { font-size: 46px; margin-bottom: 14px; }
.lockcard p { color: #6b7280; margin-bottom: 22px; font-size: 15px; }
.vbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.vbar .vg { display: flex; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.vbar .vg button { padding: 8px 16px; border: none; background: #fff; color: #6b7280; font-size: 14px; }
.vbar .vg button.on { background: #4f46e5; color: #fff; }
#searchIn { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; width: 160px; }
#recStat { color: #6b7280; font-size: 13.5px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: #6b7280; margin: 6px 2px 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

#infoBar { display: none; position: sticky; bottom: 12px; margin-top: 16px; background: #111827; color: #fff; border-radius: 10px; padding: 12px 18px; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#infoBar.show { display: flex; }
#infoBar .sc { font-size: 22px; font-weight: 700; }
#infoBar .sc.p { color: #34d399; } #infoBar .sc.n { color: #f87171; }
#infoBar .mini { color: #9ca3af; font-size: 12.5px; }

.dayhead { font-size: 14px; color: #4f46e5; font-weight: 600; margin: 20px 0 8px; letter-spacing: 1px; }
/* 历史记录弹窗内：日期头更紧凑、行去下边距堆叠 */
#histBody .dayhead { margin: 14px 0 6px; }
#histBody .recline { margin-bottom: 5px; }
#histBody .recline .ds { flex: 1; }
.recline { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border: 1px solid #f3f4f6; border-radius: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.recline .tm { font-size: 12px; color: #9ca3af; width: 86px; flex: none; }
.recline .who { font-weight: 600; width: 76px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recline .who.m { color: #1e40af; } .recline .who.f { color: #be185d; }
.recline .pt { flex: none; font-weight: 700; font-size: 14px; border-radius: 6px; padding: 2px 9px; }
.recline .pt.p { background: #d1fae5; color: #065f46; }
.recline .pt.n { background: #fee2e2; color: #991b1b; }
.recline .it { color: #374151; font-size: 14px; }
.recline .ds { color: #9ca3af; font-size: 13px; flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recline img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; cursor: zoom-in; flex: none; }
.recline .del { margin-left: auto; border: none; background: none; color: #d1d5db; font-size: 15px; }
.recline .del:hover { color: #dc2626; }
.recline.pending { opacity: .6; }
.recline .pend { font-size: 11px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px; padding: 1px 6px; flex: none; }

.lbtables { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.lbtables h3 { font-size: 16px; margin-bottom: 10px; letter-spacing: 1px; border-left: 4px solid #4f46e5; padding-left: 8px; }
table.lbt { width: 100%; border-collapse: collapse; }
.lbt th { font-size: 12.5px; color: #6b7280; font-weight: normal; text-align: left; padding: 6px 8px; border-bottom: 1px solid #e5e7eb; }
.lbt td { padding: 8px; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.lbt tr.top td { background: #fffbeb; }
.medal { display: inline-block; width: 22px; text-align: center; }
.cfgn { width: 52px; padding: 6px; border: 1px solid #d1d5db; border-radius: 6px; text-align: center; }

/* ============ ④ 总结 ============ */
.sumbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.sumbar input[type=date] { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.statchips { display: flex; gap: 8px; flex-wrap: wrap; }
.statchips span { font-size: 12.5px; padding: 5px 11px; border-radius: 999px; }
.st-chip.dirty { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.st-chip.done { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.st-chip.fail { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.st-chip.run { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.sumclass { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 18px 22px; margin-bottom: 18px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.9; }
.sumclass h3 { font-size: 16px; margin-bottom: 8px; letter-spacing: 1px; border-left: 4px solid #4f46e5; padding-left: 8px; white-space: normal; }
.sumgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
/* 小组总结卡片 */
.grpgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 18px; }
.sumcard.grp { padding: 14px 16px; }
.sumcard.grp .grpmembers { font-size: 12.5px; color: #6b7280; line-height: 1.9; margin-bottom: 8px; border-bottom: 1px dashed #e5e7eb; padding-bottom: 8px; }
.sumcard.grp .grpmembers i { font-style: normal; color: #9ca3af; margin-right: 6px; }
.sumcard { border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; }
.sumcard h4 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sumcard h4 .g { font-size: 11px; color: #fff; border-radius: 4px; padding: 1px 6px; font-weight: normal; }
.sumcard h4 .t { font-size: 12px; color: #9ca3af; font-weight: normal; }
.sumcard .md { font-size: 13.5px; color: #374151; line-height: 1.85; white-space: pre-wrap; }
.sumpending { color: #9ca3af; text-align: center; padding: 40px 0; font-size: 14px; }
.sumnote { color: #6b7280; font-size: 13px; margin-top: 14px; line-height: 1.8; }
.sumstat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.sumstat .sumnote { margin-top: 0; }
.sumh { font-size: 16px; letter-spacing: 1px; border-left: 4px solid #4f46e5; padding-left: 8px; margin-bottom: 12px; }
.mk { color: #4f46e5; }
.mk.c { color: #0f766e; }

/* ============ 弹窗 ============ */
.overlay { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.overlay.show { display: flex; }
.dlg { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; max-height: 88vh; overflow-y: auto; padding: 26px 30px; }
.dlg h2 { font-size: 18px; letter-spacing: 1px; margin-bottom: 18px; }
.dlghead { display: flex; align-items: flex-start; gap: 10px; }
.dlghead h2 { flex: 1; margin-bottom: 18px; }
.dlghead .btn { flex: none; margin-top: -3px; }
.dlg .sub { color: #6b7280; font-size: 13.5px; margin: -12px 0 16px; }

#pkSearch { width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; margin-bottom: 12px; }
.pkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pkcard { padding: 11px 4px; border-radius: 8px; text-align: center; font-size: 14.5px; cursor: pointer; border: 1px solid transparent; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkcard.m { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.pkcard.f { background: #fce7f3; border-color: #f9a8d4; color: #be185d; }
.pkcard:hover { filter: brightness(.95); outline: 2px solid #4f46e5; }
.pknone { color: #9ca3af; text-align: center; padding: 20px 0; font-size: 14px; }

.typewrap { display: flex; gap: 12px; margin-bottom: 16px; }
.typewrap button { flex: 1; padding: 18px 0; font-size: 17px; border-radius: 10px; border: 2px solid #e5e7eb; background: #fff; color: #6b7280; letter-spacing: 3px; }
.typewrap button.p.on { background: #ecfdf5; border-color: #059669; color: #065f46; }
.typewrap button.n.on { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.itemwrap { display: block; margin-bottom: 14px; }
/* 双标签行（B47）：分类行（必选其一）+ 项目行（该分类下的项目） */
.tagline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tagline .tlb { font-size: 12px; color: #9ca3af; flex: none; width: 34px; }
.tagline .tlhint { font-size: 12.5px; color: #c0c4cc; }
.itemwrap .pill { padding: 8px 15px; border-radius: 999px; border: 1px solid #e5e7eb; background: #fff; color: #374151; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.itemwrap .pill.on { background: #eef2ff; border-color: #4f46e5; color: #4f46e5; font-weight: 600; }
.itemwrap .pill i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.itemwrap .pill.base { background: #f9fafb; }
/* ＋添加胶囊（默认收起，点击展开输入行） */
.itemwrap .addpill { border-style: dashed; color: #9ca3af; background: #fff; }
.itemwrap .cstline { display: none; gap: 6px; width: 100%; align-items: center; }
.itemwrap .cstline input { flex: 1; min-width: 120px; padding: 7px 11px; border: 1px solid #d1d5db; border-radius: 999px; font-size: 13.5px; }
.itemwrap .cstline .cstAdd { border-radius: 999px; background: #eef2ff; border-color: #c7d2fe; color: #4f46e5; }
.itemwrap .cstline .cstCancel { border-radius: 999px; background: #fff; border-color: #e5e7eb; color: #6b7280; padding: 7px 12px; }
.ptsrow { display: flex; align-items: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.ptsrow .lb2 { color: #6b7280; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 0; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; }
.stepper button { width: 40px; height: 38px; border: none; background: #f9fafb; font-size: 18px; color: #374151; }
.stepper b { width: 56px; text-align: center; font-size: 17px; }
#rDesc, #bDesc { width: 100%; height: 86px; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; resize: vertical; }
.photoline { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; flex-wrap: wrap; }
.photoline label { padding: 9px 16px; border: 1px dashed #c7d2fe; background: #eef2ff; color: #4f46e5; border-radius: 8px; font-size: 14px; cursor: pointer; }
#rPhBox img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid #e5e7eb; }
.phdel { border: none; background: none; color: #d1d5db; font-size: 16px; }
.phdel:hover { color: #dc2626; }
.dbtns { display: flex; gap: 10px; margin-top: 20px; }
.dbtns .btn { flex: 1; padding: 11px 0; font-size: 15px; }

.frow2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.frow2 label { width: 56px; flex: none; color: #6b7280; font-size: 14px; }
.frow2 input[type=text] { flex: 1; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 7px; }
.gbtns { display: flex; gap: 8px; flex: 1; }
.gbtns button { flex: 1; padding: 8px 0; border-radius: 7px; border: 1px solid #e5e7eb; background: #fff; color: #6b7280; font-size: 14px; }
.gbtns button.m.on { background: #dbeafe; border-color: #3b82f6; color: #1e40af; }
.gbtns button.f.on { background: #fce7f3; border-color: #ec4899; color: #be185d; }
.gbtns button.u.on { background: #f3f4f6; border-color: #6b7280; color: #374151; }

#photoOv img { max-width: 92vw; max-height: 86vh; border-radius: 10px; }
#photoOv { cursor: zoom-out; }

/* ============ 批量记一笔（B45） ============ */
/* 个人弹窗快捷批量行：⚡批量该生所在 [排][列][组] */
.bqrow { display: flex; align-items: center; gap: 7px; margin: -10px 0 14px; flex-wrap: wrap; }
.bqrow .bql { font-size: 12.5px; color: #6b7280; }
.bqrow .btn { padding: 5px 13px; }
/* 批量保存前名单二次确认（B48） */
#bConfirm .sub b { font-size: 14px; }
.conflist { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; background: #f9fafb; border: 1px solid #f3f4f6; border-radius: 8px; padding: 10px; margin-bottom: 4px; }
.conflist span { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.bmodegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bmodegrid button { border: 1.5px solid #e5e7eb; background: #fff; border-radius: 12px; padding: 16px 8px 13px; text-align: center; }
.bmodegrid button:active { transform: scale(.96); border-color: #4f46e5; }
.bmodegrid button b { display: block; font-size: 16px; color: #111827; margin-bottom: 5px; }
.bmodegrid button small { color: #9ca3af; font-size: 12px; }
/* 选择目标提示条（插在方阵视图顶部） */
.pickbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #eef2ff; border: 1.5px dashed #4f46e5; color: #374151; border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-bottom: 8px; }
.pickbar b { color: #4f46e5; }
.pickbar .btn { margin-left: auto; }

#toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: #111827; color: #fff; padding: 12px 26px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; letter-spacing: .5px; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 横竖屏适配 ============ */
/* 横屏建议条：仅竖屏窄屏显示 */
.rotHint { display: none; align-items: center; gap: 8px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 9px 14px; font-size: 13.5px; margin-bottom: 12px; line-height: 1.6; }
.rotHint.sm2 { padding: 7px 12px; font-size: 12.5px; margin-bottom: 8px; }

/* ---------- 竖屏窄屏（手机/平板竖着拿）：左右改上下，方阵自动等比缩小 ---------- */
@media (max-width: 900px) and (orientation: portrait) {
  .stage { flex-direction: column; }
  /* 关键：stage 的 align-items:flex-start 会让 gridWrap 宽度按内容 fit-content 计算，
     被 648px 宽的方阵撑破 → 整页横向可拖（PC 网页感）且 fitGrid 误判容器宽不缩放。
     显式 width:100% 锁死容器宽，缩放才能正确生效。 */
  #gridWrap { width: 100%; }
  #poolWrap { width: 100%; }
  #pool { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 208px; }
}

/* ---------- 窄屏通用（竖屏手机为主） ---------- */
@media (max-width: 760px) {
  .rotHint { display: flex; }
  /* 顶栏：紧凑两行（信息一行 + 页签一行横向滑动） */
  header { padding: 8px 12px; gap: 8px; }
  header h1 { font-size: 16px; }
  .cls-badge, .by-badge { font-size: 12.5px; padding: 4px 10px; }
  #tabs { order: 9; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { padding: 7px 13px; font-size: 13.5px; white-space: nowrap; flex: none; }
  main { padding: 12px 10px 84px; }
  section { padding: 14px 10px; border-radius: 8px; }
  .tip { font-size: 13px; margin-bottom: 10px; }
  /* iOS：输入字号 ≥16px 防止聚焦自动放大页面 */
  input, select, textarea { font-size: 16px; }
  #searchIn, .fbar .num, .cfgn { font-size: 15px; }
  /* 登录页 */
  .login-card { padding: 34px 24px 28px; }
  #codeIn { font-size: 19px; letter-spacing: 3px; padding: 12px 10px; }
  /* 名单/弹窗 */
  .chips { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .dlg { padding: 18px 16px; border-radius: 12px; max-height: 90vh; }
  .dbtns { flex-wrap: wrap; }
  .dbtns .btn { min-width: 120px; }
  .typewrap button { padding: 14px 0; font-size: 16px; }
  /* 记录流水/信息条 */
  .recline .ds { display: none; }
  .recline .tm { width: 64px; font-size: 11px; }
  .recline .who { width: 66px; }
  #infoBar { padding: 10px 14px; gap: 10px; font-size: 13.5px; }
  #infoBar .sc { font-size: 19px; }
  /* 排行/总结单列 */
  .lbtables { grid-template-columns: 1fr; gap: 16px; }
  .sumgrid { grid-template-columns: 1fr; }
  .sumclass { padding: 14px 14px; font-size: 14px; }
  .ghost { font-size: 16px; padding: 9px 18px; }
  .vbar { gap: 8px; }
  .vbar .vg button { padding: 8px 12px; font-size: 13.5px; }
  #searchIn { width: 128px; }
}

/* ---------- 横屏矮屏（手机横着拿）：一屏放下方阵+待选池 ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .rotHint { display: none !important; }   /* 已是横屏，不再提示 */
  header { flex-wrap: nowrap; padding: 6px 12px; gap: 8px; }
  header h1 { font-size: 15px; }
  header .spacer { flex: 0 0 8px; }
  #tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { padding: 6px 11px; font-size: 13px; white-space: nowrap; flex: none; }
  .by-badge { display: none; }   /* 空间紧张，先藏署名徽标（同步状态保留） */
  main { padding: 8px 10px 56px; }
  section { padding: 10px 12px; }
  .tip { font-size: 12.5px; margin-bottom: 8px; line-height: 1.6; }
  .fbar { margin-bottom: 8px; }
  .fbar .btn, #grpBar .btn { padding: 6px 10px; font-size: 13px; }
  .fbar .num { padding: 6px; width: 50px; }
  .stage { gap: 10px; }
  #poolWrap { width: 158px; }
  #poolWrap h3 { font-size: 12.5px; margin-bottom: 6px; }
  #pool { grid-template-columns: 1fr; gap: 6px; max-height: calc(100vh - 210px); }
  .pcard { padding: 7px 4px; font-size: 13px; }
  .confban { padding: 7px 10px; font-size: 13px; margin-bottom: 8px; }
  .legend { margin: 4px 0 8px; font-size: 12px; }
  .dlg { padding: 14px 18px; max-height: 92vh; }
  .dbtns { margin-top: 14px; }
  .lockcard { padding: 28px 16px; }
}

/* ---------- 极窄屏（小屏手机） ---------- */
@media (max-width: 400px) {
  .chips { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .vbar .vg button { padding: 8px 9px; font-size: 13px; }
  .fbar .lb { display: none; }   /* 「排」「列」字样省略，输入框自明 */
}
