/* ═══════════════════════════════════════════════════
   style.css — 初中体育智能管理平台 V2.0
   ═══════════════════════════════════════════════════ */

/* ─── 1. CSS 变量 ─── */
:root {
  --navy:      #0F172A;
  --navy-800:  #1E293B;
  --navy-700:  #334155;
  --blue:      #2563EB;
  --blue-dark: #1D4ED8;
  --blue-50:   #EFF6FF;
  --blue-100:  #DBEAFE;
  --green:     #16A34A;
  --green-50:  #F0FDF4;
  --amber:     #D97706;
  --amber-50:  #FFFBEB;
  --red:       #DC2626;
  --red-50:    #FEF2F2;
  --purple:    #7C3AED;
  --purple-50: #F5F3FF;
  --bg:        #F8FAFC;
  --surface:   #FFFFFF;
  --border:    #E2E8F0;
  --border-md: #CBD5E1;
  --text-1:    #0F172A;
  --text-2:    #334155;
  --text-3:    #64748B;
  --text-4:    #94A3B8;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.10), 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 4px 6px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.06);
  --shadow-md: 0 10px 15px rgba(15,23,42,.08), 0 4px 6px rgba(15,23,42,.05);
  --shadow-lg: 0 20px 25px rgba(15,23,42,.10), 0 8px 10px rgba(15,23,42,.06);
  --sidebar-w: 220px;
  --header-h:  60px;
  --font: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --transition: .15s ease;
}

/* ─── 2. 全局重置 ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* ─── 3. 登录页 ─── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a5c 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
#login-screen::before {
  content: '';
  position: absolute;
  top: -40%; right: -20%;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.15) 0%, transparent 70%);
  pointer-events: none;
}
#login-screen::after {
  content: '';
  position: absolute;
  bottom: -30%; left: -15%;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22,163,74,.10) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px; justify-content: center;
}
.login-logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.login-title { text-align: center; margin-bottom: 8px; }
.login-title h1 { font-size: 18px; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.login-title p  { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.login-divider  { height: 1px; background: var(--border); margin: 24px 0; }
.form-group     { margin-bottom: 20px; }
.form-label     { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; letter-spacing: .01em; }
.input-wrap     { position: relative; }
.input-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-4); pointer-events: none; flex-shrink: 0; }
.form-input {
  width: 100%; height: 46px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 0 14px 0 42px; font-size: 15px; color: var(--text-1);
  background: var(--surface); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-input.error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,.10); }
.login-error {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--red);
  margin-top: 12px; padding: 10px 12px;
  background: var(--red-50); border-radius: var(--radius-sm);
  border: 1px solid rgba(220,38,38,.15);
}
.btn-login {
  width: 100%; height: 48px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; letter-spacing: .02em;
  transition: opacity var(--transition), transform var(--transition);
  margin-top: 8px;
}
.btn-login:hover  { opacity: .92; transform: translateY(-1px); }
.btn-login:active { opacity: 1; transform: translateY(0); }
.login-footer { text-align: center; font-size: 12px; color: var(--text-4); margin-top: 24px; }

/* ─── 4. 应用主体结构 ─── */
#app-screen { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ─── 5. 顶部导航栏 ─── */
.app-header {
  background: var(--navy);
  color: #fff;
  padding: 0 20px;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  z-index: 200;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.header-brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.header-icon {
  width: 36px; height: 36px;
  background: rgba(37,99,235,.8);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.header-text { min-width: 0; }
.header-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-subtitle { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 1px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-db-count {
  font-size: 12px; color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: 4px 10px; border-radius: 999px;
}
.btn-logout {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.8);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  border: 1px solid rgba(255,255,255,.10);
  transition: background var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ─── 6. 侧边栏 + 主内容区 ─── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 999px; }

.sidebar-nav { padding: 12px 10px; flex: 1; display: flex; flex-direction: column; }
.sidebar-bottom { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.55); font-size: 14px; font-weight: 500;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}
.sidebar-item svg { flex-shrink: 0; opacity: .8; transition: opacity var(--transition); }
.sidebar-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.sidebar-item:hover svg { opacity: 1; }
.sidebar-item.active { background: rgba(37,99,235,.65); color: #fff; font-weight: 600; }
.sidebar-item.active svg { opacity: 1; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,.09); margin: 6px 12px 8px; }

/* ─── 7. 主内容区 ─── */
.app-main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
}

.page-pane { display: none; padding: 24px; animation: fadeIn .2s ease; }
.page-pane.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── 8. 移动端底部导航（桌面端隐藏） ─── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 300;
  overflow-x: auto;
  scrollbar-width: none;
}
.mobile-nav::-webkit-scrollbar { display: none; }
.mobile-nav-inner {
  display: flex;
  min-width: max-content;
  width: 100%;
  padding: 0 4px;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 12px 10px;
  flex: 1; min-width: 52px;
  color: var(--text-4); font-size: 10px; font-weight: 500;
  transition: color var(--transition);
}
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.active { color: var(--blue); }

/* ─── 9. 通用卡片 ─── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 24px;
}
.card-title {
  font-size: 16px; font-weight: 700; color: var(--text-1);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.card-title svg { color: var(--blue); }

/* ─── 10. 通用按钮 ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  transition: all var(--transition); letter-spacing: .01em;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 1px 2px rgba(22,163,74,.25); }
.btn-success:hover { background: #15803D; }
.btn-secondary { background: var(--bg); color: var(--text-2); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); border-color: var(--border-md); }
.btn-danger { background: var(--red-50); color: var(--red); border: 1.5px solid rgba(220,38,38,.2); }
.btn-danger:hover { background: #FEE2E2; }
.btn-purple { background: var(--purple-50); color: var(--purple); border: 1.5px solid rgba(124,58,237,.2); }
.btn-purple:hover { background: #EDE9FE; }
.btn-sm  { padding: 7px 12px;  font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg  { padding: 14px 28px; font-size: 15px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ─── 11. 通用表单控件 ─── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-hint  { font-size: 12px; color: var(--text-4); }
.input, .select {
  height: 42px; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 0 12px; font-size: 14px; color: var(--text-1);
  background: var(--surface); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.select {
  padding-right: 32px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.time-input-wrap { display: flex; align-items: center; gap: 8px; }
.time-input-wrap .input { width: 80px; text-align: center; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 8px; }
.time-sep  { font-size: 20px; font-weight: 700; color: var(--text-3); line-height: 1; }
.time-unit { font-size: 13px; color: var(--text-3); flex-shrink: 0; }

/* 性别切换 */
.gender-toggle { display: inline-flex; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; }
.gender-btn { padding: 7px 20px; border-radius: calc(var(--radius) - 3px); font-size: 14px; font-weight: 600; color: var(--text-3); transition: all var(--transition); }
.gender-btn.active                { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow-sm); }
.gender-btn.active.male           { color: var(--blue); }
.gender-btn.active.female         { color: #9333EA; }

/* ─── 12. 评分展示区 ─── */
.score-result { border-radius: var(--radius-lg); padding: 28px 24px; text-align: center; transition: all .25s ease; }
.score-number { font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score-unit   { font-size: 20px; font-weight: 600; margin-left: 4px; opacity: .7; }
.grade-badge  { display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; margin-top: 12px; }
.grade-badge.perfect   { background: var(--purple-50); color: var(--purple); border: 1px solid rgba(124,58,237,.2); }
.grade-badge.excellent { background: var(--green-50);  color: var(--green);  border: 1px solid rgba(22,163,74,.2); }
.grade-badge.good      { background: var(--blue-50);   color: var(--blue);   border: 1px solid rgba(37,99,235,.2); }
.grade-badge.pass      { background: var(--amber-50);  color: var(--amber);  border: 1px solid rgba(217,119,6,.2); }
.grade-badge.fail      { background: var(--red-50);    color: var(--red);    border: 1px solid rgba(220,38,38,.2); }
.score-tip { font-size: 14px; margin-top: 10px; opacity: .8; }

/* ─── 13. 区块标题 ─── */
.section-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.section-title    { font-size: 20px; font-weight: 800; color: var(--text-1); }
.section-subtitle { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.section-actions  { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ─── 14. 首页 Dashboard ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.dash-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.dash-card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.dash-card-label { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.dash-card-value { font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-card-sub   { font-size: 12px; color: var(--text-3); }
.dash-card.blue   .dash-card-icon  { background: var(--blue-50);   color: var(--blue); }
.dash-card.green  .dash-card-icon  { background: var(--green-50);  color: var(--green); }
.dash-card.amber  .dash-card-icon  { background: var(--amber-50);  color: var(--amber); }
.dash-card.purple .dash-card-icon  { background: var(--purple-50); color: var(--purple); }
.dash-card.blue   .dash-card-value { color: var(--blue); }
.dash-card.green  .dash-card-value { color: var(--green); }
.dash-card.amber  .dash-card-value { color: var(--amber); }
.dash-card.purple .dash-card-value { color: var(--purple); }

.home-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.quick-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 20px;
}

/* ─── 15. 通用图表卡片 ─── */
.chart-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; }
.chart-title { font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 16px; }
.chart-canvas-wrap { position: relative; height: 220px; }

/* ─── 16. 筛选栏 ─── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.filter-bar .select  { height: 36px; font-size: 13px; }
.filter-bar .input   { height: 36px; font-size: 13px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.filter-search { flex: 1; min-width: 140px; }
.filter-search .input { width: 100%; }
.filter-divider { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }

/* ─── 17. 单项计算器 ─── */
.calc-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.calc-form .field-group { margin-bottom: 20px; }
.calc-actions { display: flex; gap: 10px; margin-top: 24px; }
.calc-result-wrap { position: sticky; top: 16px; }
.score-placeholder { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 48px 24px; text-align: center; color: var(--text-4); }
.score-placeholder-icon { font-size: 40px; margin-bottom: 12px; }
.score-placeholder p { font-size: 14px; }

/* ─── 18. 学生档案表格 ─── */
.students-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.students-count { font-size: 13px; color: var(--text-3); }
.students-count strong { color: var(--text-1); }
.students-actions { display: flex; gap: 8px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.student-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 700px; }
.student-table th {
  background: var(--bg); padding: 11px 14px; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--text-3);
  letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.student-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.student-table tbody tr:last-child td { border-bottom: none; }
.student-table tbody tr:hover { background: var(--bg); }
.student-table .col-no    { width: 46px; text-align: center; color: var(--text-4); }
.student-table .col-score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.student-table .col-del   { width: 44px; text-align: center; }

/* ─── 19. 批量录入 (Import Page inline table) ─── */
.batch-table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.batch-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.batch-table th { background: var(--bg); padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.batch-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.batch-table tbody tr:last-child td { border-bottom: none; }
.batch-table tbody tr:hover { background: var(--bg); }
.batch-table td .input { height: 36px; font-size: 14px; width: 100%; min-width: 80px; }
.batch-table td .time-input-wrap .input { min-width: 56px; }
.col-no    { width: 48px; text-align: center; color: var(--text-4); font-size: 13px; }
.col-name  { min-width: 100px; }
.col-perf  { min-width: 140px; }
.col-score { width: 80px; text-align: center; }
.col-grade { width: 90px; text-align: center; }
.col-del   { width: 44px; text-align: center; }
.score-cell { font-size: 18px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.btn-del-row { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-4); transition: all var(--transition); margin: 0 auto; }
.btn-del-row:hover { background: var(--red-50); color: var(--red); }

/* ─── 20. 统计看板 ─── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-label { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 36px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-sub   { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.stat-card.blue   .stat-value { color: var(--blue); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.amber  .stat-value { color: var(--amber); }
.stat-card.purple .stat-value { color: var(--purple); }

.stats-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* 等级分布条 */
.grade-bar-wrap { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.grade-bar-row  { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.grade-bar-label { width: 44px; font-weight: 600; text-align: right; flex-shrink: 0; }
.grade-bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.grade-bar-fill  { height: 100%; border-radius: 999px; transition: width .4s ease; }
.grade-bar-count { width: 32px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.grade-bar-pct   { width: 40px; text-align: right; color: var(--text-3); font-size: 12px; flex-shrink: 0; }

/* ─── 21. 班级分析 ─── */
.grade-tab-row { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.grade-tab-btn {
  padding: 8px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text-3);
  background: var(--surface); border: 1.5px solid var(--border);
  transition: all .15s ease;
}
.grade-tab-btn:hover   { border-color: var(--blue); color: var(--blue); }
.grade-tab-btn.active  { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 2px 6px rgba(37,99,235,.25); }

.class-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 20px; }
.class-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 18px; }
.class-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.class-card-name { font-size: 16px; font-weight: 800; color: var(--text-1); }
.class-rank-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.rank-1 { background: #FFF7ED; color: #EA580C; }
.rank-2 { background: #F1F5F9; color: #475569; }
.rank-3 { background: #FFF7ED; color: #B45309; }
.rank-other { background: var(--bg); color: var(--text-3); }
.class-card-avg { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--blue); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.class-card-avg-unit { font-size: 14px; font-weight: 400; color: var(--text-3); }
.class-card-metrics { display: flex; gap: 12px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.class-card-metric strong { color: var(--text-2); font-weight: 700; }
.class-empty { text-align: center; padding: 40px; color: var(--text-4); font-size: 14px; }

/* 班级排名表格 */
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th { background: var(--bg); padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.rank-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rank-table tbody tr:last-child td { border-bottom: none; }
.rank-table tbody tr:hover { background: var(--bg); }
.rank-num { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ─── 22. Excel 导入导出 ─── */
.import-section { margin-bottom: 28px; }
.import-section-title { font-size: 15px; font-weight: 700; color: var(--text-1); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.format-guide {
  background: var(--navy-800); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; overflow-x: auto;
}
.format-guide pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.8; color: #CBD5E1; white-space: pre; }
.format-guide .fh { color: #93C5FD; font-weight: 700; }
.format-guide .fv { color: #86EFAC; }

.import-zone {
  border: 2px dashed var(--border-md); border-radius: var(--radius-lg);
  padding: 36px 24px; text-align: center; background: var(--bg);
  cursor: pointer; transition: all .2s ease;
}
.import-zone:hover { border-color: var(--blue); background: var(--blue-50); }
.import-zone-icon  { font-size: 36px; margin-bottom: 10px; }
.import-zone-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.import-zone-hint  { font-size: 13px; color: var(--text-4); margin-top: 6px; }

.import-result {
  margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.import-result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.import-result-title { font-size: 14px; font-weight: 700; }
.import-result-actions { display: flex; gap: 8px; }
.import-preview-table { font-size: 13px; }
.import-error-list {
  padding: 14px 16px; background: #FFF7ED;
  border-top: 1px solid #FED7AA; font-size: 13px; color: #92400E;
  max-height: 240px; overflow-y: auto;
}
.import-err-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 4px 0; border-bottom: 1px solid #FEE2B0;
}
.import-err-row:last-child { border-bottom: none; }
.import-err-no {
  flex-shrink: 0; min-width: 20px; height: 20px; line-height: 20px;
  background: #F97316; color: #fff; border-radius: 50%;
  font-size: 11px; font-weight: 700; text-align: center;
}

.export-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.export-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.export-card-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.export-card-desc  { font-size: 13px; color: var(--text-3); flex: 1; }

/* ─── 23. 系统设置 ─── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 24px; }
.settings-card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row-label { color: var(--text-3); }
.info-row-value { font-weight: 600; color: var(--text-1); }
.danger-zone { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.danger-zone-title { font-size: 13px; font-weight: 700; color: var(--red); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .04em; }

/* ─── 24. 评分参考表 ─── */
.ref-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.ref-tab-btn { padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-3); background: var(--surface); border: 1.5px solid var(--border); transition: all var(--transition); }
.ref-tab-btn:hover  { border-color: var(--blue); color: var(--blue); }
.ref-tab-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 2px 6px rgba(37,99,235,.25); }
.ref-table-wrap { overflow-x: auto; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 400px; }
.ref-table th { background: var(--navy); color: rgba(255,255,255,.85); padding: 12px 16px; text-align: center; font-size: 13px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.ref-table th:first-child { border-radius: var(--radius) 0 0 0; }
.ref-table th:last-child  { border-radius: 0 var(--radius) 0 0; }
.ref-table td { padding: 11px 16px; text-align: center; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.ref-table tbody tr:last-child td { border-bottom: none; }
.ref-table td.score-col { font-weight: 700; font-size: 15px; }
.ref-row-perfect   td { background: rgba(124,58,237,.07); }
.ref-row-excellent td { background: rgba(22,163,74,.06); }
.ref-row-good      td { background: rgba(37,99,235,.06); }
.ref-row-pass      td { background: rgba(217,119,6,.06); }
.ref-row-fail      td { background: rgba(220,38,38,.04); }

/* ─── 24.1 快速录入 / 学生总览 ─── */
.quick-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.quick-search-row { display: flex; gap: 8px; }
.quick-search-row .input { flex: 1; min-width: 0; }
.quick-match-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.quick-match-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text-2);
}
.quick-match-item:hover { border-color: var(--blue); background: var(--blue-50); }
.quick-match-item span { font-size: 12px; color: var(--text-3); }
.quick-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.quick-score-preview {
  margin-top: 14px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border); color: var(--text-3); font-size: 13px;
}
.quick-score-preview.perfect, .quick-score-preview.excellent { background: var(--green-50); color: var(--green); border-color: rgba(22,163,74,.25); }
.quick-score-preview.good { background: var(--blue-50); color: var(--blue); border-color: rgba(37,99,235,.25); }
.quick-score-preview.pass { background: var(--amber-50); color: var(--amber); border-color: rgba(217,119,6,.25); }
.quick-score-preview.fail { background: var(--red-50); color: var(--red); border-color: rgba(220,38,38,.25); }
.quick-student-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; color: var(--text-2); }
.quick-student-head strong { color: var(--text-1); font-size: 16px; }

/* ─── 25. 空状态 ─── */
.empty-state { padding: 60px 24px; text-align: center; color: var(--text-4); }
.empty-state-icon { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; }

/* ─── 26. 通知提示 Toast ─── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  background: var(--navy-800); color: #fff;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: slideUp .25s ease;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--blue); }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ─── 27. 导入模式行样式 ─── */
.btn-import { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 600; background: #F0FDF4; color: var(--green); border: 1.5px solid rgba(22,163,74,.25); transition: all var(--transition); }
.btn-import:hover { background: #DCFCE7; border-color: var(--green); }
.perf-display { display: inline-flex; align-items: baseline; gap: 4px; font-size: 15px; font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; }
.perf-unit    { font-size: 12px; font-weight: 400; color: var(--text-3); }
.gender-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.gender-tag.male   { background: #EFF6FF; color: var(--blue); }
.gender-tag.female { background: #FDF4FF; color: #9333EA; }
.proj-tag { display: inline-block; padding: 3px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* ─── 28. 批量导入底部统计栏 ─── */
.batch-stats-bar { display: flex; flex-wrap: wrap; gap: 1px; margin-top: 16px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bsi { flex: 1; min-width: 90px; background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.bsi-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.bsi-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text-1); font-variant-numeric: tabular-nums; }
.bsi-green .bsi-value { color: var(--green); }
.bsi-blue  .bsi-value { color: var(--blue); }

/* ─── 29. 响应式 ─── */
@media (max-width: 1200px) {
  .dashboard-grid    { grid-template-columns: repeat(2, 1fr); }
  .home-charts       { grid-template-columns: 1fr; }
  .class-grid        { grid-template-columns: repeat(3, 1fr); }
  .export-cards      { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .stats-charts { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .class-grid    { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar     { display: none; }
  .app-main    { padding-bottom: 70px; }  /* leave room for mobile nav */
  .mobile-nav  { display: flex; }

  .page-pane   { padding: 16px; }

  .app-header  { padding: 0 14px; }
  .header-subtitle { display: none; }

  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid     { grid-template-columns: repeat(2, 1fr); }
  .class-grid     { grid-template-columns: repeat(2, 1fr); }
  .export-cards   { grid-template-columns: 1fr; }
  .settings-grid  { grid-template-columns: 1fr; }
  .home-charts    { grid-template-columns: 1fr; }

  .calc-layout    { grid-template-columns: 1fr; }
  .calc-result-wrap { position: static; }
  .quick-layout { grid-template-columns: 1fr; }
  .quick-form-grid { grid-template-columns: 1fr; }

  .login-card { padding: 36px 28px; }

  .toast-container { bottom: 80px; right: 12px; left: 12px; }
  .toast { justify-content: center; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .class-grid     { grid-template-columns: 1fr 1fr; }
  .stats-grid     { grid-template-columns: 1fr 1fr; }
  .header-title   { font-size: 12px; }
  .header-db-count { display: none; }
  .bsi { min-width: calc(33% - 1px); }
}

/* ─── 30. 学生三类项目卡片 ─── */
.students-list { display: flex; flex-direction: column; gap: 12px; }

.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.student-card:hover { box-shadow: var(--shadow-sm); }

.student-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.student-card-info {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; flex-wrap: wrap;
}
.student-card-score {
  display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex-shrink: 0;
}
.student-total-score { display: flex; align-items: baseline; gap: 2px; }
.stu-score-num {
  font-size: 28px; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--text-1);
}
.stu-score-max { font-size: 14px; color: var(--text-3); font-weight: 400; }
.stu-code-tag {
  font-family: var(--mono); font-size: 11px; color: #6B7280;
  background: #F3F4F6; border: 1px solid #E5E7EB;
  border-radius: 4px; padding: 1px 6px; letter-spacing: .02em;
}
.stu-del-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-4); flex-shrink: 0;
  transition: all var(--transition);
}
.stu-del-btn:hover { background: var(--red-50); color: var(--red); }

.student-cat-blocks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.cat-block {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.cat-block:last-child { border-right: none; }
.cat-block-header {
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  margin-bottom: 6px; text-transform: uppercase;
}
.cat-block-project {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-block-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; margin-top: 3px;
}
.cat-lbl { color: var(--text-4); }
.cat-val { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text-2); }

/* ─── 31. 单项计算折算行 ─── */
.calc-conversion-row {
  margin-top: 14px; padding: 12px 16px;
  background: rgba(37,99,235,.08); border-radius: var(--radius);
  border: 1px solid rgba(37,99,235,.18); text-align: center;
}
.calc-conv-label { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.calc-conv-value { font-size: 24px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.calc-conv-max   { font-size: 13px; font-weight: 400; color: var(--text-3); }
.calc-conv-note  { font-size: 11px; color: var(--text-4); margin-top: 4px; line-height: 1.4; }

/* ─── 32. 响应式：学生卡片 ─── */
@media (max-width: 768px) {
  .student-cat-blocks { grid-template-columns: 1fr; }
  .cat-block { border-right: none; border-bottom: 1px solid var(--border); }
  .cat-block:last-child { border-bottom: none; }
}
@media (max-width: 480px) {
  .student-card-header { gap: 8px; }
  .stu-score-num { font-size: 22px; }
}

/* ─── 33. 打印 ─── */
@media print {
  .sidebar, .mobile-nav, .app-header, .filter-bar, .students-toolbar, .batch-stats-bar { display: none; }
  .app-body { display: block; }
  .page-pane { display: block !important; padding: 0; }
  .student-card { break-inside: avoid; }
}

/* ═══════════════════════════════════════════════════════
   34. 登录页入口选择
═══════════════════════════════════════════════════════ */
.entry-choice-tip {
  text-align: center; font-size: 13px; color: var(--text-3);
  margin-bottom: 16px; font-weight: 500;
}
.entry-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.entry-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 16px; border-radius: var(--radius-lg);
  border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all var(--transition); gap: 6px;
  font-family: var(--font); text-align: center;
}
.entry-btn:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.entry-btn-icon { font-size: 28px; }
.entry-btn-label { font-size: 15px; font-weight: 700; color: var(--text-1); }
.entry-btn-sub   { font-size: 11px; color: var(--text-3); }
.teacher-entry:hover { border-color: var(--blue); background: var(--blue-50); }
.student-entry:hover { border-color: var(--green); background: var(--green-50); }
.student-entry { border-color: var(--green); }
.teacher-entry { border-color: var(--blue); }

.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--text-3); cursor: pointer;
  background: none; border: none; padding: 0; margin-bottom: 16px;
  font-family: var(--font); transition: color var(--transition);
}
.back-link:hover { color: var(--blue); }
.student-login-btn { background: linear-gradient(135deg, #16A34A, #15803D) !important; }

/* ═══════════════════════════════════════════════════════
   35. 学生端整体布局
═══════════════════════════════════════════════════════ */
#student-screen {
  display: flex; flex-direction: column;
  min-height: 100vh; background: var(--bg);
}

/* 顶部栏 */
.sp-header {
  height: var(--header-h);
  background: linear-gradient(135deg, #15803D 0%, #16A34A 100%);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(22,163,74,.25);
}
.sp-header-brand { display: flex; align-items: center; gap: 10px; }
.sp-header-icon  { font-size: 22px; }
.sp-header-title { font-size: 14px; font-weight: 700; color: #fff; }
.sp-header-sub   { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 1px; }
.sp-logout-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius-sm); padding: 6px 12px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--transition);
}
.sp-logout-btn:hover { background: rgba(255,255,255,.25); }

/* 身体区域（侧边栏 + 主内容）*/
.sp-body {
  display: flex; flex: 1; overflow: hidden;
}

/* 侧边栏 */
.sp-sidebar {
  width: 160px; background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px; display: flex; flex-direction: column; gap: 4px;
  flex-shrink: 0; overflow-y: auto;
}
.sp-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: var(--text-2);
  background: none; border: none; cursor: pointer; width: 100%;
  transition: all var(--transition); text-align: left;
}
.sp-nav-item:hover  { background: var(--green-50); color: var(--green); }
.sp-nav-item.active { background: var(--green-50); color: var(--green); font-weight: 700; }

/* 主内容区 */
.sp-main {
  flex: 1; overflow-y: auto; padding: 24px;
  position: relative;
}

/* 移动端底部导航 */
.sp-mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 0; z-index: 100;
}
.sp-mobile-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 4px 8px; font-size: 10px; color: var(--text-3);
  background: none; border: none; cursor: pointer; flex: 1;
  transition: color var(--transition);
}
.sp-mobile-item svg { width: 20px; height: 20px; }
.sp-mobile-item.active { color: var(--green); }

/* ═══════════════════════════════════════════════════════
   36. 学生端通用组件
═══════════════════════════════════════════════════════ */
.sp-section-header { margin-bottom: 20px; }
.sp-section-title  { font-size: 20px; font-weight: 800; color: var(--text-1); }
.sp-section-sub    { font-size: 13px; color: var(--text-3); margin-top: 3px; }

.sp-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
}
.sp-empty-icon  { font-size: 48px; margin-bottom: 14px; }
.sp-empty-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text-1); }
.sp-empty-desc  { font-size: 14px; color: var(--text-3); }

.sp-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.sp-card-title {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  margin-bottom: 16px;
}
.sp-calc-ref { margin-top: 24px; }
.sp-calc-ref .btn { margin-bottom: 16px; }

/* ═══════════════════════════════════════════════════════
   37. P1 — 当前成绩
═══════════════════════════════════════════════════════ */
.sp-total-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px 24px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.sp-total-main  { display: flex; align-items: baseline; gap: 4px; margin-bottom: 8px; }
.sp-total-num   { font-size: 48px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.sp-total-max   { font-size: 18px; color: var(--text-3); font-weight: 500; }
.sp-total-detail { display: flex; align-items: center; margin-bottom: 8px; }
.sp-total-dist  { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }

.sp-compare-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--border); margin-top: 6px;
}
.sp-compare-label { font-size: 13px; color: var(--text-3); }

.sp-cat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.sp-cat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.sp-cat-label   { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 4px; }
.sp-cat-project { font-size: 13px; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.sp-cat-row     { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 4px; color: var(--text-2); }
.sp-diff-tag    { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }
.sp-diff-tag.up   { color: #16A34A; background: #F0FDF4; }
.sp-diff-tag.down { color: #DC2626; background: #FEF2F2; }
.sp-rec-card { min-height: 170px; }
.sp-rec-note {
  margin-top: 10px; padding: 6px 8px; border-radius: var(--radius-sm);
  background: var(--green-50); color: var(--green); font-size: 12px; font-weight: 700;
  text-align: center;
}
.sp-measured-list { display: flex; flex-direction: column; gap: 8px; }
.sp-measured-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg);
}
.sp-mi-project { font-size: 14px; font-weight: 800; color: var(--text-1); }
.sp-mi-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sp-mi-score { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; }
.sp-mi-score strong { color: var(--text-1); font-size: 14px; }

.sp-ai-box {
  background: linear-gradient(135deg, #F0FDF4 0%, #EFF6FF 100%);
  border: 1px solid rgba(22,163,74,.2);
  border-radius: var(--radius-lg); padding: 20px;
}
.sp-ai-box-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text-1); }
.sp-ai-item {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 10px; font-size: 13px; color: var(--text-2); line-height: 1.5;
}
.sp-ai-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ═══════════════════════════════════════════════════════
   38. P2 — 成长历史
═══════════════════════════════════════════════════════ */
.sp-history-summary {
  display: flex; gap: 0; background: var(--surface);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
  border: 1px solid var(--border);
}
.sp-hs-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 16px 12px; border-right: 1px solid var(--border);
  gap: 4px;
}
.sp-hs-item:last-child { border-right: none; }
.sp-hs-item strong  { font-size: 20px; font-weight: 800; color: var(--text-1); font-variant-numeric: tabular-nums; }
.sp-hs-item span    { font-size: 11px; color: var(--text-3); }

.sp-history-list { display: flex; flex-direction: column; gap: 10px; }
.sp-history-item {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  display: grid; grid-template-columns: 100px 1fr auto;
  align-items: center; gap: 12px;
}
.sp-hi-left  { display: flex; flex-direction: column; gap: 4px; }
.sp-hi-date  { font-size: 13px; font-weight: 600; color: var(--text-1); }
.sp-hi-center{ display: flex; align-items: center; gap: 8px; }
.sp-hi-score { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-hi-max   { font-size: 12px; color: var(--text-3); font-weight: 400; }
.sp-hi-cats  { font-size: 11px; color: var(--text-3); line-height: 1.6; text-align: right; }

.sp-diff-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
}
.sp-diff-badge.up   { color: #16A34A; background: #F0FDF4; }
.sp-diff-badge.down { color: #DC2626; background: #FEF2F2; }
.sp-diff-badge.flat { color: #64748B; background: #F1F5F9; }

/* ═══════════════════════════════════════════════════════
   39. P3 — 趋势分析
═══════════════════════════════════════════════════════ */
.sp-chart-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.sp-chart-title { font-size: 14px; font-weight: 700; color: var(--text-1); margin-bottom: 14px; }
.sp-chart-wrap  { height: 220px; }

.sp-analysis-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.sp-analysis-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.sp-compare-note   { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.sp-compare-rows   { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sp-compare-item   { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sp-compare-item:last-child { border-bottom: none; }
.sp-compare-totals { display: flex; gap: 20px; flex-wrap: wrap; }
.sp-ct-item        { font-size: 13px; color: var(--text-2); }
.sp-trend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sp-trend-card {
  border: 1px solid var(--border); background: var(--bg);
  border-radius: var(--radius); padding: 14px;
}
.sp-trend-card-title { font-size: 14px; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.sp-trend-line { font-size: 13px; color: var(--text-2); margin-bottom: 8px; line-height: 1.5; }
.sp-trend-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sp-trend-advice { font-size: 13px; color: var(--green); background: var(--green-50); border-radius: var(--radius-sm); padding: 8px; margin-top: 10px; }

/* ═══════════════════════════════════════════════════════
   40. P4 — 个人中心
═══════════════════════════════════════════════════════ */
.sp-profile-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  display: flex; gap: 16px; align-items: flex-start;
}
.sp-avatar-wrap { flex-shrink: 0; }
.sp-avatar {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--green-50), #D1FAE5);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 28px;
  border: 2px solid rgba(22,163,74,.2);
}
.sp-profile-detail  { flex: 1; min-width: 0; }
.sp-profile-name    { font-size: 20px; font-weight: 800; color: var(--text-1); margin-bottom: 6px; }
.sp-profile-meta    { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sp-profile-code    { font-size: 12px; color: var(--text-3); font-family: var(--mono); margin-bottom: 4px; }
.sp-profile-pwd-status { font-size: 12px; }

.sp-medals-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.sp-medal {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 14px; background: var(--amber-50);
  border: 1px solid rgba(217,119,6,.2); border-radius: var(--radius);
  min-width: 80px; text-align: center;
}
.sp-medal-icon { font-size: 24px; }
.sp-medal-name { font-size: 12px; font-weight: 700; color: var(--amber); }
.sp-medal-desc { font-size: 10px; color: var(--text-3); line-height: 1.3; }

.sp-pwd-form { display: flex; flex-direction: column; gap: 10px; }
.sp-input {
  width: 100%; height: 42px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 0 14px; font-size: 14px; color: var(--text-1);
  background: var(--surface); outline: none; font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.sp-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.sp-btn-primary {
  height: 42px; background: linear-gradient(135deg, var(--green), #15803D);
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font);
  transition: opacity var(--transition);
}
.sp-btn-primary:hover { opacity: .88; }
.sp-msg { font-size: 13px; padding: 8px 12px; border-radius: var(--radius-sm); }
.sp-msg.success { color: var(--green); background: var(--green-50); }
.sp-msg.error   { color: var(--red);   background: var(--red-50); }

.sp-privacy-notice {
  text-align: center; font-size: 12px; color: var(--text-3);
  padding: 16px; margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* Toast for student portal */
.sp-toast-container { position: fixed; bottom: 70px; right: 16px; z-index: 9999; }

/* ═══════════════════════════════════════════════════════
   41. 响应式 — 学生端
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sp-sidebar { display: none; }
  .sp-mobile-nav { display: flex; }
  .sp-main { padding: 16px; padding-bottom: 72px; }
  .sp-cat-grid { grid-template-columns: 1fr; gap: 8px; }
  .sp-trend-grid { grid-template-columns: 1fr; }
  .sp-measured-item { align-items: flex-start; }
  .sp-header { padding: 0 14px; }
  .sp-history-item { grid-template-columns: 90px 1fr; }
  .sp-hi-cats { display: none; }
  .sp-total-num { font-size: 36px; }
  .entry-btns { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════
   学生档案详情模态框
════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  width: 100%; max-width: 820px;
  padding: 28px 28px 32px;
  position: relative;
  margin: auto;
}
.modal-close-btn {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none;
  font-size: 22px; color: var(--text-3); cursor: pointer;
  line-height: 1; padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.modal-close-btn:hover { background: var(--border); color: var(--text-1); }

/* ── Student Detail Modal内部 ── */
.sd-header {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.sd-section { margin-bottom: 24px; }
.sd-section-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-1);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.sd-msg-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}
.sd-msg-form.hidden { display: none; }

/* ════════════════════════════════════════════
   教师留言卡片（教师端 + 学生端）
════════════════════════════════════════════ */
.teacher-msg-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.teacher-msg-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.teacher-msg-header strong { font-size: 14px; color: var(--text-1); }
.teacher-msg-body {
  font-size: 14px; line-height: 1.75;
  color: var(--text-2);
  white-space: pre-wrap;
  margin-bottom: 10px;
}
.teacher-msg-footer {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 8px;
}
.teacher-msg-sign {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.teacher-msg-sign span { font-size: 13px; color: var(--text-3); font-style: italic; }
.teacher-sig-img { max-height: 36px; max-width: 120px; object-fit: contain; }

/* ── 学生端留言 ── */
.sp-letters-list { display: flex; flex-direction: column; gap: 12px; }
.sp-letter-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF9F0 100%);
  border: 1px solid #FDE68A;
  border-left: 4px solid #F59E0B;
  border-radius: 10px;
  padding: 16px 18px;
}
.sp-letter-title {
  font-size: 15px; font-weight: 700;
  color: #92400E;
  margin-bottom: 8px;
}
.sp-letter-content {
  font-size: 14px; line-height: 1.8;
  color: #44403C;
  margin-bottom: 14px;
}
.sp-letter-footer {
  display: flex; justify-content: space-between; align-items: flex-end;
}
.sp-letter-date { font-size: 12px; color: #A16207; }
.sp-letter-sign { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sp-letter-teacher { font-size: 13px; color: #78716C; font-style: italic; }
.sp-sig-img { max-height: 32px; max-width: 100px; object-fit: contain; }
