:root {
  --brand: #1f6feb;
  --brand-dark: #12408f;
  --ink: #1b2430;
  --muted: #667085;
  --line: #e3e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #0f9d58;
  --warn: #d97706;
  --bad: #d92d20;
  --side: #16233a;
  --side-2: #1d2d49;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--brand); text-decoration: none; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #25395c, #0f1a2c 60%);
}
.login-card {
  width: 380px; background: #fff; border-radius: 16px; padding: 32px 30px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 12.5px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 111, 235, .12); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: linear-gradient(180deg, var(--side), var(--side-2)); color: #fff;
  padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; }
.logo .mark {
  width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #4f8cff, #1f6feb);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.logo b { font-size: 15px; letter-spacing: .5px; }
.logo small { display: block; font-size: 11px; color: #9db0cc; }
.nav-item {
  padding: 9px 12px; border-radius: 8px; color: #cdd8ea; cursor: pointer; font-size: 13.5px;
  display: flex; align-items: center; gap: 9px; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar .bottom { margin-top: auto; font-size: 12px; color: #8fa2bd; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar .bottom b { color: #fff; font-weight: 600; }

.main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar .grow { flex: 1; }
.pill {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  color: var(--muted); font-size: 12.5px;
}
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .tag { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi .k { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.kpi .v small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-height: 68vh; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
thead th {
  position: sticky; top: 0; background: #eff3fa; color: #33415c; font-weight: 600;
  padding: 9px 10px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line);
  z-index: 2;
}
thead th.left, td.left { text-align: left; }
tbody td { padding: 8px 10px; text-align: center; border-bottom: 1px solid #f0f3f8; white-space: nowrap; }
tbody tr:nth-child(even) td { background: #fafbfe; }
tbody tr:hover td { background: #eef4ff; }
td.num { font-variant-numeric: tabular-nums; }
.rank-badge {
  display: inline-block; min-width: 44px; padding: 2px 8px; border-radius: 20px;
  background: #eef2fb; color: #3b4a68; font-size: 12px; font-variant-numeric: tabular-nums;
}
.rank-badge.top1 { background: transparent; color: #33415C; font-weight: 600; }
.rank-badge.top3 { background: transparent; color: #33415C; font-weight: 600; }
.muted { color: var(--muted); }
.hl { color: var(--brand); font-weight: 600; }

.bar { height: 6px; border-radius: 4px; background: #e8edf7; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #4f8cff, #1f6feb); }
.inline-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.inline-bar .bar { flex: 1; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; width: 240px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }

.empty { padding: 46px; text-align: center; color: var(--muted); }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(12, 20, 33, .45); display: grid; place-items: center; z-index: 50; }
.modal { width: min(760px, 92vw); background: #fff; border-radius: 14px; padding: 22px 24px 18px; max-height: 88vh; overflow: auto; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.modal .footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.drop {
  border: 2px dashed #c9d5ea; border-radius: 12px; padding: 26px; text-align: center; color: var(--muted);
  background: #fbfcff; cursor: pointer;
}
.drop.on { border-color: var(--brand); background: #eff5ff; }
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #16233a; color: #fff; padding: 10px 18px; border-radius: 24px; font-size: 13px;
  box-shadow: 0 10px 24px rgba(0,0,0,.25); opacity: 0; transition: opacity .2s, bottom .2s; pointer-events: none; z-index: 99;
}
.toast.show { opacity: 1; bottom: 44px; }
.hide { display: none !important; }

/* 对照平均分行 */ .sum-row td { background: #F6F8FB; font-weight: 600; }
.sum-row td.sum-label { color: #1F2D3D; }

/* 学科分区：满屏色块改成「白底 + 组首细线 + 悬停整组高亮」，读长表不累 */
th.sgH { border-left: 1px solid #C9D2E0; font-weight: 700; }
th.sgT { background: #F4F6FA; }
td.ghl, th.ghl { background: #EEF4FB !important; }
tr:nth-child(even) td { background: #FCFDFE; }
tr:hover td { background: #F7FAFE; }

/* 与平均分差值 */
td.diff { font-variant-numeric: tabular-nums; }
td.diff-up { color: #16794B; }
td.diff-down { color: #B23B2E; }

/* 考试档案：学期块 → 年级块 */
.term-block { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.term-title { font-weight: 700; font-size: 14px; color: #1F2D3D; margin-bottom: 10px; }
.term-title .tag { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; }
.grade-block { margin: 10px 0 4px; }
.grade-title { font-weight: 600; font-size: 13px; color: #33415C; padding: 6px 10px; background: #F7F9FC; border-left: 3px solid #C9D2E0; border-radius: 4px; margin-bottom: 6px; }
.grade-title .muted { font-weight: 400; }
table.mini { font-size: 12.5px; }
table.mini thead th { background: #FBFCFE; }
table.mini tbody tr:nth-child(even) td { background: #FCFDFE; }

/* ==================== 表格排版统一（视觉修订） ==================== */
body, td, th, input, select, button { font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif; }
table { font-size: 13px; }
thead th { font-size: 12px; font-weight: 600; letter-spacing: .3px; color: #3A4761; background: #F1F4F9 !important; border-bottom: 1px solid #DCE2EC; }
th.sgH { font-size: 13px !important; font-weight: 700 !important; letter-spacing: 1.5px; color: #14315E !important; background: #E6ECF5 !important; border-left: 1px solid #D3DCE8; border-bottom: 1px solid #DCE2EC; }
th.sgT { font-size: 13px; font-weight: 700; color: #14315E; background: #E6ECF5 !important; }
tbody td { font-size: 12.5px; padding: 7px 10px; border-bottom: 1px solid #EDF0F5; }
tbody tr:nth-child(even) td { background: transparent; }
td.left, tbody td:first-child { font-size: 13px; font-weight: 600; color: #1F2D3D; }
td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
table.zone td.sgA { background: #FFFFFF !important; }
table.zone td.sgB { background: #F5F8FC !important; }
table.zone th.sgA { background: #F1F4F9 !important; }
table.zone th.sgB { background: #E7EDF6 !important; }
tbody tr:hover td { background: #F1F6FD !important; }
td.ghl, th.ghl { background: #E3EDFB !important; }
.rank-badge { min-width: 46px; padding: 1px 7px; border-radius: 4px; background: transparent; font-size: 12px; font-weight: 600; color: #33415C; font-variant-numeric: tabular-nums; }
.rank-badge.top1 { background: transparent; color: #33415C; }
.rank-badge.top3 { background: transparent; font-weight: 600; color: #33415C; }
.sum-row td { background: #EEF2F8 !important; font-weight: 700; border-top: 1px solid #CDD6E4; font-size: 12.5px; }
.sum-row td.sum-label { color: #10233F; letter-spacing: .5px; }
td.diff { font-size: 12.5px; font-weight: 600; }
td.diff-up { color: #12754A; }
td.diff-down { color: #A83127; }
table.mini { font-size: 13px; }
table.mini tbody td { font-size: 12.5px; }

/* 两行表头分别吸顶，滚动时不互相压住 */
thead tr:first-child th { top: 0; z-index: 3; }
thead tr:nth-child(2) th { top: 36px; z-index: 2; }

/* ==================== 学科分区配色（仅概览 / 一平三率；低饱和五色 + 总分中性色） ==================== */
/* 学科分区：正文中等明度、表头深一档；总分单独灰蓝，配色与导出 Excel 完全一致 */
table.zone td[data-g="0"] { background: #DCE9F8 !important; }
table.zone th[data-g="0"] { background: #B7D2EC !important; }
table.zone td[data-g="1"] { background: #DCEFE2 !important; }
table.zone th[data-g="1"] { background: #B6DEC6 !important; }
table.zone td[data-g="2"] { background: #FAE6D1 !important; }
table.zone th[data-g="2"] { background: #EFC8A6 !important; }
table.zone td[data-g="3"] { background: #E7E1F6 !important; }
table.zone th[data-g="3"] { background: #CBBBE9 !important; }
table.zone td[data-g="4"] { background: #D8EEF3 !important; }
table.zone th[data-g="4"] { background: #AFD9E2 !important; }
table.zone td[data-g="5"] { background: #E7E7EF !important; }
table.zone th[data-g="5"] { background: #C7C7D6 !important; }

table thead th.sgH { border-left: 1px solid #CBD5E3; border-bottom: 1px solid #DCE2EC; color: #16304F; }
table tbody tr:hover td { filter: brightness(0.975); }
table.zone td.ghl, table.zone th.ghl { background: #D8E6F7 !important; }

/* ==================== 全部数据居中 ==================== */
table th, table td, table td.left, table td:first-child { text-align: center !important; }
table td { font-size: 12.5px; }
table td.left { font-weight: 600; color: #1F2D3D; }

/* ==================== 图表视图 ==================== */
.toolbar .right { margin-left: auto; }
.chart-box { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 14px 18px 18px; }
.chart-title { font-size: 13px; font-weight: 700; color: #1F2D3D; margin-bottom: 4px; }
.chart-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-scroll { max-height: 62vh; overflow: auto; }


/* ==================== 总分块（分区表）：中性灰蓝，与学科五色区分开 ==================== */
table.zone td[data-g="T"] { background: #D5DFEC !important; }
table.zone th[data-g="T"] { background: #B4C4DA !important; }
table.zone td.sgT { background: #D5DFEC !important; }

/* ==================== 排名类表格：只隔行，不用学科分区色 ==================== */
table.stripe td[data-g], table.stripe th[data-g] { background: transparent; }
table.stripe tbody tr:nth-child(odd) td { background: #DCE6F5; }
table.stripe tbody tr:nth-child(even) td { background: #FFFFFF; }
table.stripe thead th { background: #E2EAF6 !important; }
table.stripe tr.sum-row td { background: #C4D3E9 !important; font-weight: 700; }
table.stripe tbody tr:hover td { background: #CBDCF2 !important; }

/* ==================== 分页 ==================== */
.pager { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pager button { min-width: 34px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: #33415C; }
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager button:disabled { color: #B6BFCC; cursor: default; }
.pager .pinfo { color: var(--muted); font-size: 12.5px; margin-left: 6px; }

/* ==================== 图表分析页 ==================== */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.chart-panel { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 14px 16px 10px; }
.chart-panel.wide { grid-column: 1 / -1; }
.chart-panel h4 { margin: 0 0 2px; font-size: 14px; color: #1F2D3D; }
.chart-panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.chart-svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; align-items: center; font-size: 12.5px; color: #475569; margin-bottom: 10px; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
table.pros { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.pros th { background: #F1F4F9; color: #3A4761; font-weight: 600; padding: 8px 6px; border-bottom: 1px solid #DCE2EC; text-align: center; }
table.pros td { padding: 7px 6px; text-align: center; border-bottom: 1px solid #EDF0F5; }
table.pros td.nm { text-align: left; font-weight: 600; color: #1F2D3D; }
.pros-cell { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.dot.up { background: #16A34A; }
.dot.down { background: #E8A93B; }
.dot.flat { background: #C7CEDB; }



/* ==================== 图表放大 / 下载 ==================== */
.chart-panel { position: relative; }
.chart-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; z-index: 2; }
.mini { height: 26px; padding: 0 10px; font-size: 12px; color: #3A4761; background: #fff; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.mini:hover { background: #F2F6FC; border-color: #C7D4E8; }
.zoom-modal { width: min(1180px, 96vw); max-height: 94vh; display: flex; flex-direction: column; }
.zoom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.zoom-head h3 { margin: 0; }
.zoom-head .btn { height: 30px; }
.zoom-body { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* 放大弹窗内的标题 / 说明 / 图例沿用面板排版 */
.zoom-panel { padding: 12px 14px 6px; }
.zoom-panel h4 { margin: 0 0 4px; font-size: 18px; color: #1F2D3D; }
.zoom-panel .sub { margin-bottom: 8px; font-size: 12.5px; color: #667085; }
.zoom-panel .legend { margin-bottom: 8px; }

