/* 管理系统（毕设） — H-ui 经典后台风格，逆向自 ZeroWdd/studentmanager */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font: 14px/1.6 "Microsoft YaHei", "Hiragino Sans GB", sans-serif; color: #333; background: #f2f2f2; }
a { text-decoration: none; color: #333; }
input, select, textarea, button { font: inherit; outline: none; }

/* ---------- 登录页 ---------- */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1a3b5d 0%, #2f5e8f 100%); display: flex; align-items: center; justify-content: center; }
.login-box { width: 380px; background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.35); overflow: hidden; }
.login-box .hd { background: #3879b7; color: #fff; text-align: center; padding: 22px 0 18px; }
.login-box .hd h1 { font-size: 22px; letter-spacing: 2px; }
.login-box .bd { padding: 26px 32px 30px; }
.role-tabs { display: flex; border-bottom: 1px solid #e5e5e5; margin-bottom: 20px; }
.role-tabs label { flex: 1; text-align: center; padding: 9px 0; cursor: pointer; color: #999; border-bottom: 2px solid transparent; }
.role-tabs input { display: none; }
.role-tabs input:checked + label { color: #3879b7; border-bottom-color: #3879b7; font-weight: bold; }
.form-item { margin-bottom: 16px; display: flex; align-items: center; border: 1px solid #d5d5d5; border-radius: 3px; }
.form-item .icon { width: 42px; text-align: center; color: #999; flex-shrink: 0; }
.form-item input { flex: 1; border: 0; padding: 11px 12px 11px 0; background: transparent; }
.btn-login { width: 100%; background: #3879b7; color: #fff; border: 0; padding: 12px; border-radius: 3px; cursor: pointer; font-size: 16px; letter-spacing: 6px; }
.btn-login:hover { background: #2f6aa6; }
.login-tip { text-align: center; color: #f00; font-size: 12px; min-height: 18px; margin-top: 10px; }

/* ---------- 主框架 ---------- */
.frame { display: none; min-height: 100vh; flex-direction: column; }
.frame.active { display: flex; }
.topbar { height: 50px; background: #3879b7; color: #fff; display: flex; align-items: center; padding: 0 20px; flex-shrink: 0; }
.topbar .logo { font-size: 16px; font-weight: bold; letter-spacing: 1px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; margin-right: 14px; }
.topbar a.logout { color: #fff; font-size: 13px; }
.wrap { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 180px; background: #393d49; flex-shrink: 0; overflow-y: auto; }
.menu-group > .cap { color: #c8c8c8; padding: 12px 16px 8px; font-size: 12px; cursor: pointer; user-select: none; }
.menu-group > .cap::after { content: "▾"; float: right; color: #888; }
.menu-group.closed > .cap::after { content: "▸"; }
.menu-group.closed .menu-item { display: none; }
.menu-item { display: block; padding: 11px 16px 11px 26px; color: #b7bcc6; cursor: pointer; border-left: 3px solid transparent; }
.menu-item:hover { color: #fff; background: #414750; }
.menu-item.active { color: #fff; background: #3879b7; border-left-color: #7cb3ea; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: #f2f2f2; }
.tabbar { background: #fff; border-bottom: 1px solid #ddd; display: flex; align-items: flex-end; padding: 6px 10px 0; overflow-x: auto; flex-shrink: 0; }
.tab { padding: 7px 14px; border: 1px solid #ddd; border-bottom: none; background: #f5f5f5; color: #666; font-size: 13px; cursor: pointer; border-radius: 3px 3px 0 0; margin-right: 4px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tab.active { background: #fff; color: #3879b7; font-weight: bold; position: relative; top: 1px; }
.tab .x { color: #bbb; font-size: 12px; }
.tab .x:hover { color: #d9534f; }
#main { flex: 1; padding: 16px; overflow-y: auto; min-width: 0; }
.crumb { margin-bottom: 12px; color: #666; font-size: 13px; }
.crumb b { color: #333; }

/* ---------- 表格与表单 ---------- */
.toolbar { margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-block; padding: 7px 14px; border: 1px solid #d5d5d5; background: #fff; border-radius: 3px; cursor: pointer; font-size: 13px; }
.btn.primary { background: #3879b7; border-color: #3879b7; color: #fff; }
.btn.danger { background: #d9534f; border-color: #d9534f; color: #fff; }
.btn.green { background: #5cb85c; border-color: #5cb85c; color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid #d5d5d5; border-radius: 3px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { border: 1px solid #e5e5e5; padding: 9px 10px; text-align: left; font-size: 13px; }
.tbl th { background: #f5f6fa; font-weight: normal; color: #555; }
.tbl tr:hover td { background: #f8fafd; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag.ok { background: #dff0d8; color: #3c763d; }
.tag.warn { background: #fcf8e3; color: #8a6d3b; }
.tag.err { background: #f2dede; color: #a94442; }
.tag.info { background: #d9edf7; color: #31708f; }
.empty { text-align: center; color: #999; padding: 30px 0 !important; }

/* 统计卡片 */
.stat-cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-card { flex: 1; min-width: 140px; background: #fff; border: 1px solid #e5e5e5; border-radius: 4px; padding: 18px 20px; }
.stat-card .num { font-size: 28px; font-weight: bold; color: #3879b7; }
.stat-card .lbl { color: #888; margin-top: 4px; font-size: 13px; }
.card { background: #fff; border: 1px solid #e5e5e5; border-radius: 4px; padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 12px; color: #3879b7; }

/* 弹窗 */
.mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 60px 16px; }
.mask.show { display: flex; }
.modal { background: #fff; border-radius: 4px; width: 460px; max-width: 100%; }
.modal .mh { background: #f5f6fa; padding: 12px 16px; font-weight: bold; border-bottom: 1px solid #e5e5e5; display: flex; }
.modal .mh .x { margin-left: auto; cursor: pointer; color: #999; font-weight: normal; }
.modal .mb { padding: 16px; }
.modal .mf { padding: 12px 16px; border-top: 1px solid #e5e5e5; text-align: right; }
.f-row { display: flex; align-items: center; margin-bottom: 12px; }
.f-row .f-lbl { width: 80px; color: #666; flex-shrink: 0; }
.f-row input, .f-row select, .f-row textarea { flex: 1; padding: 8px 10px; border: 1px solid #d5d5d5; border-radius: 3px; }
.f-row textarea { min-height: 70px; resize: vertical; }
.f-msg { color: #d9534f; font-size: 12px; min-height: 16px; margin: 4px 0 0 80px; }

/* toast */
#toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid #e5e5e5; box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 10px 22px; border-radius: 4px; z-index: 200; display: none; }
#toast.err { border-color: #d9534f; color: #a94442; }
#toast.ok { border-color: #5cb85c; color: #3c763d; }

@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .sidebar .cap { display: none; }
  .menu-item { padding: 11px 6px; text-align: center; font-size: 12px; }
  .main { padding: 10px; }
  .tbl th, .tbl td { padding: 6px 6px; font-size: 12px; }
}
