:root {
  --brand: #0c93a6;
  --brand-2: #0a7c8c;
  --ink: #1f2a37;
  --ink-2: #4b5a68;
  --ink-3: #8592a0;
  --line: #e6ebf1;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #12a150;
  --warn: #d98a00;
  --bad: #d64545;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #dff3f6 0%, #f4f6f9 55%);
  padding: 24px;
}
.login-card {
  width: 360px; max-width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 30px 28px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #16b8c9);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.login-brand h1 { font-size: 17px; margin: 0; letter-spacing: .3px; }
.login-sub { color: var(--ink-3); font-size: 12.5px; margin: 6px 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px;
  background: #fbfcfd; color: var(--ink); outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,147,166,.12); background: #fff; }
.btn-primary {
  width: 100%; height: 42px; border: 0; border-radius: 8px; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); margin-top: 6px;
}
.btn-primary:disabled { opacity: .6; cursor: default; }
.login-err { color: var(--bad); font-size: 12.5px; min-height: 18px; margin-top: 10px; }

/* ---------- 布局 ---------- */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side {
  background: #131c26; color: #cbd5e1; display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), #16b8c9);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.side-brand b { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .4px; }
.side-brand span { display: block; font-size: 11px; color: #7f8ea0; font-weight: 400; letter-spacing: .5px; }
.nav { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.nav button {
  text-align: left; background: transparent; border: 0; color: #a9b6c6; padding: 10px 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px;
}
.nav button:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav button.on { background: rgba(12,147,166,.16); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.nav .ico { width: 16px; text-align: center; opacity: .9; }
.side-foot { margin-top: auto; font-size: 11px; color: #6b7a8c; padding: 10px 6px 0; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 15.5px; margin: 0; font-weight: 600; }
.topbar .crumb { color: var(--ink-3); font-size: 12.5px; margin-left: 10px; font-weight: 400; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; }
.chip-admin { background: #eef7f9; color: var(--brand-2); border: 1px solid #d5ecf0; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink-2); padding: 7px 12px; border-radius: 8px; font-size: 13px; }
.btn-ghost:hover { border-color: #cfd9e2; background: #fafbfc; }

.content { padding: 20px 22px 40px; }
.section-title { font-size: 13px; color: var(--ink-3); margin: 22px 0 10px; letter-spacing: .3px; }
.section-title:first-child { margin-top: 0; }

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi .k { color: var(--ink-3); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 8px; letter-spacing: .3px; }
.kpi .v small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.kpi.accent .v { color: var(--brand-2); }
.kpi.money .v { color: #b26b00; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 13.5px; margin: 0; font-weight: 600; }
.panel-body { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .nav { flex-direction: row; flex-wrap: wrap; } }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--ink-3); font-weight: 500; font-size: 12px; background: #fafbfc; position: sticky; top: 0; }
.tbl tbody tr:hover { background: #f7fbfc; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { max-height: 62vh; overflow: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; }
.badge.on { background: #e8f7ee; color: var(--ok); border-color: #c8ebd6; }
.badge.off { background: #f2f4f7; color: var(--ink-3); border-color: #e6ebf1; }
.badge.role-teacher { background: #eef2ff; color: #4a5bd0; border-color: #dde3ff; }
.badge.role-student { background: #f4f6f9; color: var(--ink-2); border-color: #e6ebf1; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.filters { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filters input, .filters select {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fbfcfd; outline: none; font-size: 13px;
}
.filters input { min-width: 220px; }
.filters input:focus, .filters select:focus { border-color: var(--brand); background: #fff; }
.count-note { color: var(--ink-3); font-size: 12.5px; margin-left: auto; }

.bars { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 92px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #16b8c9); border-radius: 999px; }
.bar-row .v { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.empty { color: var(--ink-3); text-align: center; padding: 28px; font-size: 13px; }

/* ---------- 抽屉 ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,32,.42); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.drawer-mask.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 560px; max-width: 94vw; background: #fff;
  border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(16,24,40,.14); transform: translateX(100%);
  transition: transform .22s ease; z-index: 21; display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { margin: 0; font-size: 15px; }
.drawer-body { padding: 16px 18px 30px; overflow: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 14px; }
.kv .k { color: var(--ink-3); }
.sub-title { font-size: 12.5px; color: var(--ink-3); margin: 18px 0 8px; border-top: 1px solid var(--line); padding-top: 12px; }
