/* 非管理员门户（机构用户 / 教师 / 家长 / 学生）
 * 原生 JS，零 CDN。
 * 未登录(401) → 统一登录 /sso/login（绝不是 /admin/login：那是独立管理员入口）
 */
* { box-sizing: border-box; }
body {
    margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    background: #f4f6fa; color: #1f2733;
}
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 22px; background: #fff; border-bottom: 1px solid #e3e8f0;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar .logo {
    width: 30px; height: 30px; border-radius: 8px; background: #4f8cff; color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.topbar .me { font-size: 13px; color: #5a6577; display: flex; align-items: center; gap: 14px; }
.topbar .link { color: #4f8cff; text-decoration: none; }

.tabs { display: flex; gap: 4px; padding: 0 22px; background: #fff; border-bottom: 1px solid #e3e8f0; flex-wrap: wrap; }
.tabs button {
    border: 0; background: transparent; padding: 12px 14px; font-size: 14px; cursor: pointer;
    color: #5a6577; border-bottom: 2px solid transparent;
}
.tabs button.active { color: #4f8cff; border-bottom-color: #4f8cff; font-weight: 600; }

.wrap { max-width: 1040px; margin: 22px auto; padding: 0 16px; }
.card { background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(20,30,50,.06); margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.sub { margin: 0 0 14px; font-size: 12px; color: #8893a7; }

.kvlist { display: flex; flex-direction: column; gap: 2px; }
.kv { display: flex; align-items: baseline; padding: 7px 0; border-bottom: 1px solid #f0f3f8; }
.kv:last-child { border-bottom: 0; }
.kv .k { flex: 0 0 76px; color: #8893a7; font-size: 13px; }
.kv .v { flex: 1; color: #1f2733; font-size: 14px; word-break: break-all; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #eef1f6; }
th { color: #8893a7; font-weight: 600; font-size: 12px; }
tbody tr:hover { background: #fafbfe; }
.empty { padding: 22px; text-align: center; color: #9aa6bd; font-size: 13px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; margin: 0 5px 5px 0; }
.badge.admin { background: #e0533d; }
.badge.teacher { background: #3d7de0; }
.badge.student { background: #2aa36b; }
.badge.parent { background: #8a6bd6; }
.badge.org { background: #6b7a90; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.stat { background: #fbfcfe; border: 1px solid #e9edf5; border-radius: 10px; padding: 14px; }
.stat .n { font-size: 22px; font-weight: 700; color: #2b3a55; }
.stat .l { font-size: 12px; color: #8893a7; margin-top: 2px; }

.btn {
    border: 0; background: #4f8cff; color: #fff; border-radius: 8px;
    padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.btn:hover { background: #3f7af0; }
.btn.ghost { background: #fff; color: #4f8cff; border: 1px solid #cddcf8; }
.btn.mini { padding: 4px 10px; font-size: 12px; }
.btn.danger { background: #fff; color: #c0392b; border: 1px solid #f0cfca; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 6px; }
.row-actions .btn:first-child { margin-left: 0; }

.toast {
    position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
    background: #2b3a55; color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.err { background: #c0392b; }

@media (max-width: 640px) {
    .wrap { margin: 14px auto; }
    table { font-size: 12px; }
    th, td { padding: 7px 6px; }
}

/* ---------- 通用弹窗（portal.js 动态创建） ---------- */
.pmask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: center; justify-content: center; }
.pmask.show { display: flex; }
.pmodal { background: #fff; border-radius: 12px; width: min(92vw, 400px); max-height: 86vh; overflow: auto; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.pm-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.pfield { margin-bottom: 12px; }
.pfield label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.pfield input, .pfield select { width: 100%; padding: 8px 10px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.pm-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }


/* ---------- 学生/教师管理 & 家长绑定（2026-09-30） ---------- */
.card h3.h-flex { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pfield input[type="file"] { padding: 6px; }
.pb-hint { font-size: 12px; color: #8893a7; margin-bottom: 10px; line-height: 1.7; }
.pb-link { background: #f6f8fc; border: 1px solid #e3e8f0; border-radius: 8px; padding: 10px 12px; font-size: 12px; word-break: break-all; color: #2b3a55; margin-bottom: 12px; }
.pb-qr { text-align: center; margin: 4px 0 10px; }
.pb-qr img { width: 220px; height: 220px; border: 1px solid #e3e8f0; border-radius: 8px; }
/* 家长绑定卡片：学生信息（姓名/机构/账号）随二维码一起展示，便于保存转发 */
.pb-stu { text-align: center; margin-bottom: 10px; }
.pb-stu .n { font-size: 17px; font-weight: 600; color: #2b3a55; }
.pb-stu .m { font-size: 12px; color: #8893a7; margin-top: 4px; word-break: break-all; }
a.btn { text-decoration: none; display: inline-block; }

/* ---- 班级成员抽屉：分块标题 / 成员详情弹窗表格（2026-10-01） ---- */
#classMembers h4 { margin: 14px 0 8px; font-size: 14px; color: #2c3e50; }
.pm-info { width: 100%; border-collapse: collapse; }
.pm-info th { text-align: left; width: 84px; padding: 6px 8px; color: #666; font-weight: 600; white-space: nowrap; vertical-align: top; }
.pm-info td { padding: 6px 8px; color: #333; word-break: break-all; }

/* ---- 主菜单尾部：作业站/学习站跳转链接（2026-10-01） ---- */
.tabs a.ext {
    margin-left: auto; align-self: center; text-decoration: none;
    border: 1px solid #d7e3ff; background: #f4f8ff; color: #4f8cff;
    border-radius: 6px; padding: 5px 12px; font-size: 13px; font-weight: 600;
}
.tabs a.ext + a.ext { margin-left: 0; }
.tabs a.ext:hover { background: #e7efff; }
.pm-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.pm-table th, .pm-table td { border: 1px solid #ececec; padding: 6px 8px; text-align: left; }
.pm-table th { background: #f6f7f9; color: #555; font-weight: 600; white-space: nowrap; }
.pm-table td { color: #333; word-break: break-all; }
