:root {
  --bg: #ffffff;
  --surface: #f7f7f4;
  --line: #d8d8d2;
  --line-soft: #e9e9e4;
  --text: #24241f;
  --muted: #6c6c64;
  --blue: #185fa5;
  --blue-soft: #e6f1fb;
  --teal: #0f6e56;
  --teal-soft: #e1f5ee;
  --amber: #854f0b;
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; margin: 0; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 26px 48px; }
.student-wrap { max-width: 940px; }

.topbar {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px;
}
.topbar .sub { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.tab {
  appearance: none; background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 14px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.section { display: none; }
.section.active { display: block; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.field label { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
select, input[type="text"], input[type="date"], input[type="number"] {
  font: inherit; font-size: 13px; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; min-height: 32px;
}
select[multiple] { min-height: 76px; }
.btn {
  font: inherit; font-size: 13px; cursor: pointer; padding: 7px 14px;
  background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 6px;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #124e88; color: #fff; }
.btn.danger { color: var(--amber); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.metric { background: var(--surface); border-radius: 10px; padding: 12px 14px; }
.metric .label { font-size: 12px; color: var(--muted); }
.metric .value { font-size: 24px; font-weight: 500; margin-top: 2px; }
.metric .value.blue { color: var(--blue); }
.metric .value.teal { color: var(--teal); }
.metric .note { font-size: 11px; color: var(--muted); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.card {
  background: #fff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 14px 16px;
}
.card .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.card .head .hint { font-size: 11px; color: var(--muted); }
.chart-box { position: relative; height: 290px; }
.chart-box.small { height: 250px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { font-weight: 500; color: var(--muted); background: var(--surface); }
tbody tr:hover { background: #fafaf8; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--teal); }
.down { color: #a32d2d; }
.muted { color: var(--muted); }

.check-list {
  max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; background: #fff; min-width: 180px;
}
.check-list label { display: block; font-weight: 400; font-size: 12px; padding: 2px 0; }
.check-list input { margin-right: 6px; }

.note-box {
  background: var(--blue-soft); border-left: 3px solid var(--blue); padding: 10px 12px;
  border-radius: 0 6px 6px 0; color: #0c447c; font-size: 12px; margin-bottom: 14px;
}
.note-box.teal { background: var(--teal-soft); border-left-color: var(--teal); color: #085041; }

.msg { font-size: 12px; margin-top: 8px; min-height: 18px; }
.msg.ok { color: var(--teal); }
.msg.err { color: #a32d2d; }

#login-mask {
  position: fixed; inset: 0; background: rgba(255,255,255,.96); display: flex;
  align-items: center; justify-content: center; z-index: 20;
}
#login-card { width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
#login-card h2 { margin-bottom: 6px; }
#login-card p { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
#login-card input { width: 100%; margin-bottom: 10px; }
#login-card .btn { width: 100%; }

.link-row { word-break: break-all; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--surface); color: var(--muted); }
.badge.on { background: var(--teal-soft); color: var(--teal); }
.badge.off { background: #f7eaea; color: #a32d2d; }

.footnote { color: var(--muted); font-size: 11px; margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 10px; }

@media (max-width: 900px) {
  .wrap { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
