: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); }

.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtab {
  appearance: none; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 16px; padding: 5px 13px; font: inherit; font-size: 12px;
  color: var(--muted); cursor: pointer;
}
.subtab:hover { border-color: var(--blue); color: var(--blue); }
.subtab.active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.sub-section { display: none; }
.sub-section.active { display: block; }
.eng-section { display: none; }
.eng-section.active { display: block; }

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

.field.picker { min-width: 280px; }
.picker-fold { width: 100%; }
.picker-fold summary {
  cursor: pointer; font-size: 12px; color: var(--blue); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-height: 32px;
  list-style: none;
}
.picker-fold summary::-webkit-details-marker { display: none; }
.picker-fold summary::before { content: '▸ '; color: var(--muted); }
.picker-fold[open] summary::before { content: '▾ '; }
.picker-fold .fold-body { padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.student-search { width: 100%; }
.picker-bar { display: flex; align-items: center; gap: 6px; }
.mini-btn {
  font: inherit; font-size: 11px; cursor: pointer; padding: 2px 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 5px; color: var(--blue);
}
.mini-btn:hover { border-color: var(--blue); background: var(--blue-soft); }
.picked-count { font-size: 11px; color: var(--muted); margin-left: auto; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--blue); background: var(--blue-soft); }

.link-cell { max-width: 420px; }
.link-url { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }

.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.tall { height: 380px; }
.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; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.legend-chip {
  font: inherit; font-size: 11px; cursor: pointer; padding: 3px 9px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--text);
  display: inline-flex; align-items: center; gap: 5px;
}
.legend-chip:hover { border-color: var(--blue); }
.legend-chip.off { opacity: .38; text-decoration: line-through; }
.legend-chip .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.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; }
}

/* ==== 英语能力分析平台补充样式 ==== */
.hidden { display: none !important; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.login-box, .user-box { display: flex; align-items: center; gap: 8px; }
.login-box input { width: 160px; }
.user-box { font-size: 12px; color: var(--muted); }
.sec { display: none; }
.sec.active { display: block; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: 10px; padding: 12px 14px; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-val { font-size: 22px; font-weight: 500; margin-top: 2px; }
.grid2 { 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: 12px; padding: 14px 16px; margin-bottom: 14px; }
.card h3 { margin-bottom: 10px; }
.card canvas { max-height: 280px; }
.card .chart-box { position: relative; height: 260px; }
.search { width: 100%; max-width: 460px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 168px; overflow-y: auto; }
.chip { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.sel { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.form-row label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.primary, .ghost { font: inherit; font-size: 12px; cursor: pointer; padding: 6px 13px; border-radius: 6px; }
.primary { background: var(--blue); border: 1px solid var(--blue); color: #fff; }
.primary:hover { background: #124e88; }
.ghost { background: #fff; border: 1px solid var(--line); color: var(--blue); }
.ghost:hover { border-color: var(--blue); background: var(--blue-soft); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.badge.on { background: var(--teal-soft); color: var(--teal); }
.badge.off { background: #f3e7e7; color: #993c1d; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.legend-chip { font: inherit; font-size: 11px; padding: 2px 9px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; border-left-width: 3px; }
.legend-chip.off { opacity: .4; text-decoration: line-through; }
.analysis { background: var(--surface); border-radius: 6px; padding: 8px; margin-top: 6px; font-size: 11px; max-height: 220px; overflow-y: auto; white-space: pre-wrap; }
.msg { font-size: 12px; color: var(--muted); margin-top: 8px; }
input[type="file"] { font-size: 12px; margin: 6px 0; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
td { border-bottom: 1px solid var(--line-soft); padding: 6px 8px; }
tr:hover td { background: var(--surface); }
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .head { flex-direction: column; align-items: flex-start; }
}

.suggest { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 7px; background: #fff; }
.suggest summary { cursor: pointer; font-size: 13px; }
.suggest-body { margin-top: 8px; padding: 8px 10px; background: var(--surface); border-radius: 6px; font-size: 12px; }
.suggest-body p { margin: 0 0 6px; }
