/* ============ 89班学生表现档案 · wxweb 前端 · Material Design 3 ============ */
/* 配色与组件样式对齐 app/public/css/style.css */

:root {
  /* MD3 色彩角色（中性 + 蓝） */
  --bg: #F8F9FA;
  --surface: #FFFFFF;
  --surface-container: #F0F4F9;
  --surface-container-high: #E9EEF6;
  --text: #1F1F1F;
  --text-2: #444746;
  --text-3: #747775;
  --outline: #C4C7C5;
  --outline-variant: #E1E3E1;
  --primary: #0B57D0;
  --on-primary: #FFFFFF;
  --primary-container: #D3E3FD;
  --on-primary-container: #041E49;
  --green: #146C2E;   --green-tonal: #C4EED0;
  --blue: #0B57D0;    --blue-tonal: #D3E3FD;
  --orange: #B06000;  --orange-tonal: #FCE8D6;
  --red: #B3261E;     --red-tonal: #F9DEDC;  --on-red: #FFFFFF;
  --inverse: #303030; --on-inverse: #F4EFF4;
  --err-bg: #F9DEDC;  --err-text: #8C1D18;
  --radius-l: 20px;
  --radius-m: 14px;
  --radius-s: 10px;
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.07), 0 1px 3px 1px rgba(0, 0, 0, 0.05);
  --nav-h: 56px;
  --tab-h: 62px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1B1B1F;
    --surface-container: #1D2024;
    --surface-container-high: #26282C;
    --text: #E3E3E3;
    --text-2: #C4C7C5;
    --text-3: #8E918F;
    --outline: #8E918F;
    --outline-variant: #444746;
    --primary: #A8C7FA;
    --on-primary: #062E6F;
    --primary-container: #0842A0;
    --on-primary-container: #D3E3FD;
    --green: #6DD58C;   --green-tonal: rgba(109, 213, 140, 0.16);
    --blue: #A8C7FA;    --blue-tonal: rgba(168, 199, 250, 0.16);
    --orange: #FDD663;  --orange-tonal: rgba(253, 214, 99, 0.16);
    --red: #F2B8B5;     --red-tonal: rgba(242, 184, 181, 0.16);  --on-red: #601410;
    --inverse: #E3E3E3; --on-inverse: #303030;
    --err-bg: #8C1D18;  --err-text: #F9DEDC;
    --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
/* hidden 属性优先于组件的 display 声明（否则 .tabbar / .hb-detail 等隐藏无效） */
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "PingFang SC",
    "HarmonyOS Sans SC", "MiSans", "Source Han Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14.5px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--primary-container); }

.container { max-width: 920px; margin: 0 auto; padding: 0 16px 56px; }
body.has-tabs .container { padding-bottom: calc(var(--tab-h) + 32px); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: 0 16px;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 8px;
}
.topbar-title { font-size: 16px; font-weight: 500; letter-spacing: 0.2px; }
.topbar-spacer { flex: 1; }
.large-title { font-size: 26px; font-weight: 400; margin: 24px 2px 2px; }
.large-sub { color: var(--text-2); font-size: 13.5px; margin: 0 2px 20px; }

/* ---------- MD3 按钮（药丸形） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px;
  border-radius: 999px;
  font-weight: 500; font-size: 14px; letter-spacing: 0.1px;
  position: relative; overflow: hidden; white-space: nowrap;
  transition: transform 0.12s, background 0.2s, box-shadow 0.2s;
  user-select: none;
}
.btn::after {
  content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0;
  transition: opacity 0.15s; pointer-events: none;
}
.btn:hover::after { opacity: 0.08; }
.btn:active::after { opacity: 0.16; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-text { background: transparent; color: var(--primary); padding: 0 14px; }
.btn-danger { background: var(--red-tonal); color: var(--red); }
.btn-sm { height: 36px; padding: 0 18px; font-size: 13px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); position: relative; flex: none;
  transition: background 0.15s, transform 0.12s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-container-high); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- 输入框 ---------- */
.field {
  width: 100%; height: 48px;
  border-radius: var(--radius-m);
  border: 1px solid var(--outline);
  background: transparent;
  padding: 0 16px;
  outline: none;
  transition: border-color 0.2s;
}
.field:focus { border-color: var(--primary); border-width: 2px; padding: 0 15px; }
.field::placeholder { color: var(--text-3); }
.field-textarea { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; line-height: 1.5; font-family: inherit; font-size: 14px; }
.field-textarea:focus { padding: 11px 15px; }

/* ---------- 登录页（首屏直接呈现，无需二次加载） ---------- */
.login-page {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh; padding: 28px 16px 40px;
}
.login-box { max-width: 380px; width: 100%; margin: 0 auto; border-radius: 28px; padding: 34px 28px 22px; }
.login-hello { font-size: 23px; font-weight: 600; text-align: center; margin-bottom: 6px; }
.login-sub { color: var(--text-2); font-size: 13.5px; text-align: center; margin-bottom: 22px; }
.login-btn { width: 100%; margin-top: 14px; }
.login-status {
  min-height: 18px; margin-top: 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; color: var(--text-3); text-align: center;
}
.login-box .note { margin-top: 18px; text-align: left; }
.login-box .footer { padding-top: 12px; }

/* ---------- 说明条（日常表现 ≠ 学业成绩） ---------- */
.note {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  padding: 11px 13px;
  margin-top: 18px;
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--primary); }
.note strong { color: var(--text); font-weight: 600; }

/* ---------- 加载提示 ---------- */
.loading { text-align: center; }
.loading .spinner { margin: 72px auto 16px; }
.loading-text { font-size: 14px; color: var(--text-2); }
.loading-sub { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.dot-spin {
  display: inline-block; width: 14px; height: 14px; flex: none;
  border: 2px solid var(--surface-container-high); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.btn-filled .dot-spin { border-color: color-mix(in srgb, var(--on-primary) 35%, transparent); border-top-color: var(--on-primary); }

/* ---------- 登录页 ---------- */
.login-msg { background: var(--red-tonal); color: var(--red); font-size: 13px; border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; text-align: center; }
.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-container); color: var(--on-primary-container);
  margin: 0 auto 14px;
}
.login-logo svg { width: 30px; height: 30px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-l);
  padding: 20px;
}

/* ---------- Chip（MD3 8px 圆角） ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: 8px;
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
}
.band-green { background: var(--green-tonal); color: var(--green); }
.band-blue { background: var(--blue-tonal); color: var(--blue); }
.band-orange { background: var(--orange-tonal); color: var(--orange); }
.band-red { background: var(--red-tonal); color: var(--red); }

/* ---------- 统计瓷贴 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 12px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-l);
  padding: 16px 18px;
}
.stat-tile b { display: block; font-size: 24px; font-weight: 400; font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 12.5px; color: var(--text-2); }

/* ---------- 图表 ---------- */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.chart-card { display: flex; flex-direction: column; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.chart-flex { display: flex; align-items: center; gap: 20px; flex: 1; }

.donut-wrap { position: relative; flex: none; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.donut-center b { font-size: 26px; font-weight: 400; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 11px; color: var(--text-2); }

.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.legend-row b { margin-left: auto; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.hbars { display: flex; flex-direction: column; gap: 12px; }
.hb { display: flex; align-items: center; gap: 12px; }
.hb-label { width: 84px; flex: none; font-size: 12.5px; color: var(--text-2); text-align: right; }
.hb-track { flex: 1; height: 18px; border-radius: 9px; background: var(--surface-container); overflow: hidden; }
.hb-bar { height: 100%; width: 0; border-radius: 9px; transition: width 0.9s cubic-bezier(0.2, 0, 0, 1); }
.hb-value { width: 44px; flex: none; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.gauge { margin-top: 2px; }
.gauge-bar { position: relative; display: flex; height: 14px; border-radius: 7px; overflow: visible; gap: 2px; }
.gauge-seg { border-radius: 4px; opacity: 0.85; }
.gauge-marker {
  position: absolute; top: -5px; bottom: -5px; width: 3px;
  background: var(--text); border-radius: 2px;
  transform: translateX(-50%);
  transition: left 0.9s cubic-bezier(0.2, 0, 0, 1);
}
.gauge-val {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 3px 7px; border-radius: 6px; white-space: nowrap;
}
.gauge-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 7px; }

.good-note {
  display: flex; align-items: center; gap: 9px;
  color: var(--green); background: var(--green-tonal);
  border-radius: var(--radius-s);
  padding: 13px 16px; font-size: 13.5px; font-weight: 500;
}
.good-note svg { width: 16px; height: 16px; flex: none; }

/* ---------- 循环横幅 / 当前循环 ---------- */
.cycle-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.chip-cycle { background: var(--primary-container); color: var(--on-primary-container); font-weight: 600; }
.cycle-banner-sub { font-size: 12px; color: var(--text-3); }
table.grid th.ac {
  background: var(--primary-container) !important;
  color: var(--on-primary-container);
}
table.grid td.ac { background: color-mix(in srgb, var(--primary-container) 30%, transparent); }
table.grid td.ac.bad { background: var(--red-tonal); }
table.grid td.ac.ok { color: var(--green); opacity: 0.5; }

/* ---------- 节次分布展开 ---------- */
.hb-group { display: flex; flex-direction: column; }
.hb-click { cursor: pointer; text-align: left; border-radius: 8px; padding: 2px 4px; margin: -2px -4px; }
.hb-click:hover { background: var(--surface-container); }
.hb-click .hb-value { width: auto; min-width: 44px; }
.hb-chevron { width: 16px; height: 16px; flex: none; color: var(--text-3); transition: transform 0.2s; }
.hb-group.open .hb-chevron { transform: rotate(180deg); }
.hb-detail { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 6px 96px; }
.hb-vio {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 12px; border-radius: 8px;
  font-size: 12.5px; color: var(--text-2);
  transition: background 0.15s;
}
.hb-vio:hover { background: var(--surface-container-high); }
.hb-vio b { color: var(--primary); font-weight: 600; flex: none; }
.hb-vio .hb-vio-cycle { flex: none; color: var(--text-3); font-size: 11.5px; }
.hb-vio em { font-style: normal; color: var(--red); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-hint { font-size: 11.5px; color: var(--text-3); margin-top: 10px; }

/* ---------- 排行列表 ---------- */
.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--outline-variant);
}
.rank-row:last-child { border-bottom: 0; }
.rank-pos {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  background: var(--surface-container); color: var(--text-2);
}
.rank-pos.top { background: var(--primary-container); color: var(--on-primary-container); }
.rank-pos.me { background: var(--primary); color: var(--on-primary); }
/* 并列名次：圆形序号变胶囊，号后附小号「并列」标记 */
.rank-pos.tie { width: auto; min-width: 26px; padding: 0 9px; border-radius: 999px; gap: 3px; }
.rank-pos .tie-tag { font-style: normal; font-size: 9.5px; font-weight: 600; letter-spacing: .3px; opacity: .78; }
/* 并列分组：整组折叠成一行，点击（或回车）展开组内名单 */
.rank-group { cursor: pointer; }
.rank-group:hover { background: var(--surface-container); border-radius: 10px; }
.rank-group .rank-name { font-weight: 500; color: var(--text-2); }
.rank-group.open .hb-chevron { transform: rotate(180deg); }
.rank-members { display: flex; flex-direction: column; }
.rank-member { padding-left: 38px; }
.rank-member .rank-name { font-weight: 400; }
.rank-member .rn-text { color: var(--text-2); }
.rank-name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-score small { font-size: 11px; color: var(--text-3); font-weight: 400; margin-left: 2px; }

/* ---------- 详情页 ---------- */
.hero { display: flex; align-items: center; gap: 20px; margin-top: 20px; }
.hero .score-num {
  font-size: 52px; font-weight: 400; line-height: 1;
  font-variant-numeric: tabular-nums; flex: none; min-width: 76px;
}
.hero .score-side { flex: 1; min-width: 0; }
.hero .score-label { font-size: 15.5px; font-weight: 600; margin-bottom: 4px; }
.hero .score-sub { font-size: 12.5px; color: var(--text-2); }

/* ---------- 连续违规警告 ---------- */
.warn-banner {
  background: var(--red-tonal);
  border: 1px solid color-mix(in srgb, var(--red) 32%, transparent);
  border-radius: var(--radius-l);
  padding: 16px 18px;
  margin-bottom: 14px;
  color: var(--red);
}
.warn-banner-head { display: flex; align-items: center; gap: 12px; }
.warn-banner-head svg { flex: none; }
.warn-banner-head b { display: block; font-size: 15px; font-weight: 600; }
.warn-banner-head span { display: block; font-size: 12px; opacity: 0.82; margin-top: 1px; }
.warn-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.warn-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border-radius: var(--radius-s);
  padding: 8px 12px;
  font-size: 12.5px;
}
.warn-item .warn-slot { font-weight: 600; white-space: nowrap; }
.warn-item .warn-type {
  flex: none; font-size: 11px; font-weight: 600; line-height: 1;
  color: var(--on-red); background: var(--red);
  border-radius: 6px; padding: 4px 8px;
  white-space: nowrap;
}
.warn-item em { font-style: normal; color: var(--text); background: var(--surface); border-radius: 6px; padding: 2px 8px; max-width: 100%; }
.warn-item .warn-arrow { display: inline-flex; align-items: center; color: var(--red); opacity: 0.7; flex: none; }

/* 记录分类标签（上课提问不会） */
.cat-tag {
  flex: none; font-size: 11px; font-style: normal; font-weight: 500; line-height: 1;
  color: var(--blue); background: var(--blue-tonal);
  border-radius: 6px; padding: 3px 7px;
  white-space: nowrap;
}

/* 学生端连续违规：整页红色主题 */
body.page-warn { background: color-mix(in srgb, var(--red) 8%, var(--bg)); }
body.page-warn .topbar { background: color-mix(in srgb, color-mix(in srgb, var(--red) 8%, var(--bg)) 82%, transparent); }
body.page-warn .topbar-title { color: var(--red); }
body.page-warn .card { border-color: color-mix(in srgb, var(--red) 30%, var(--outline-variant)); }
body.page-warn .btn-filled { background: var(--red); color: var(--on-red); }
body.page-warn .btn-text { color: var(--red); }
body.page-warn .segmented { border-color: color-mix(in srgb, var(--red) 40%, var(--outline)); }
body.page-warn .segmented button.active { background: var(--red-tonal); color: var(--red); }
body.page-warn .chip-cycle { background: var(--red-tonal); color: var(--red); }
body.page-warn .field:focus { border-color: var(--red); }
body.page-warn table.grid thead th { background: color-mix(in srgb, var(--red) 6%, var(--surface-container)); }
body.page-warn .spinner { border-top-color: var(--red); }
body.page-warn .tab.is-active { color: var(--red); }
body.page-warn .tab-indicator { background: var(--red-tonal); }

/* ---------- MD3 分段按钮 */
.segmented {
  display: flex; gap: 8px;
  border: 1px solid var(--outline);
  border-radius: 999px; padding: 0;
  margin: 20px 0 14px;
  overflow: hidden;
}
.segmented button {
  flex: 1; height: 40px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  position: relative; overflow: hidden;
  transition: background 0.2s, color 0.2s;
}
.segmented button::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity 0.15s; }
.segmented button:hover::after { opacity: 0.06; }
.segmented button.active { color: var(--on-primary-container); background: var(--primary-container); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow: auto; max-height: 66vh; border-radius: var(--radius-l); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.grid th, table.grid td {
  border-bottom: 1px solid var(--outline-variant);
  border-right: 1px solid var(--outline-variant);
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
  min-width: 76px;
}
table.grid thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-container);
  font-weight: 600; font-size: 12.5px; color: var(--text-2);
}
table.grid thead th:first-child { z-index: 4; }
table.grid th:first-child, table.grid td:first-child {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface);
  font-weight: 500; text-align: left;
  min-width: 92px;
  box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.1);
}
table.grid thead th:first-child { background: var(--surface-container); }
table.grid tr:last-child th, table.grid tr:last-child td { border-bottom: 0; }
table.grid td.ok { color: var(--green); opacity: 0.5; font-weight: 600; }
table.grid td.bad {
  background: var(--red-tonal);
  color: var(--red); font-weight: 500;
  white-space: normal; min-width: 110px;
}
/* 上课提问不会：不计违规，蓝色区分 */
table.grid td.lesson {
  background: var(--blue-tonal);
  color: var(--blue); font-weight: 500;
  white-space: normal; min-width: 110px;
}

/* ---------- 搜索（MD3 search bar） ---------- */
.search-row { position: relative; margin: 0 0 16px; }
.search-row svg {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-2); pointer-events: none;
}
.search-row .field {
  height: 52px; border-radius: 999px;
  background: var(--surface-container); border: none;
  padding: 0 22px 0 48px;
}
.search-row .field:focus { padding: 0 21px 0 47px; }

/* ---------- 学生卡片 ---------- */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 10px;
}
.student-card {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: 18px;
  padding: 20px 12px 16px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.student-card::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity 0.15s; }
.student-card:hover { background: var(--surface-container-high); }
.student-card:hover::after { opacity: 0.04; }
.student-card:active::after { opacity: 0.1; }
.student-card .name { font-size: 15px; font-weight: 500; }
.student-card .meta { font-size: 11.5px; color: var(--text-3); text-align: center; }
.avatar {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 500; flex: none;
}
.student-card.warn { border-color: color-mix(in srgb, var(--red) 45%, var(--outline-variant)); }
.student-card.warn .name { color: var(--red); font-weight: 600; }
.warn-flag {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  background: var(--red); color: var(--on-red);
  font-size: 10.5px; font-weight: 600; line-height: 1;
  letter-spacing: 1px;
  padding: 5px 10px 6px;
  border-radius: 0 0 9px 9px;
  white-space: nowrap;
}

/* ---------- 循环记录 ---------- */
.cycle-list { display: flex; flex-direction: column; gap: 10px; }
.period-group { display: flex; flex-direction: column; gap: 10px; }
.period-group + .period-group { margin-top: 16px; }
.period-head {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 2px 2px;
  font-weight: 600; font-size: 15px; color: var(--text);
}
.cycle-card { padding: 0; overflow: hidden; }
.cycle-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--outline-variant);
  font-weight: 600; font-size: 14.5px;
}
.vio-row { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--outline-variant); }
.vio-row:last-child { border-bottom: 0; }
.vio-row .slot-tag {
  flex: none; font-size: 12px; font-weight: 500;
  color: var(--red); background: var(--red-tonal);
  border-radius: 7px; padding: 3px 9px;
}
.vio-row .vio-text { font-size: 13.5px; }
.good-row {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 18px;
  color: var(--green); font-size: 13.5px; font-weight: 500;
}
.good-row svg { width: 16px; height: 16px; }

/* ---------- 纵向柱状图（分布 / 对比） ---------- */
.vbars { display: flex; align-items: stretch; gap: 8px; padding-top: 2px; }
.vbar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.vbar-val { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: 5px; }
.vbar-track { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; }
.vbar-bar { width: 100%; border-radius: 7px 7px 3px 3px; transition: height 0.8s cubic-bezier(0.2, 0, 0, 1); }
.vbar-label { font-size: 11px; color: var(--text-2); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- 折线趋势图 ---------- */
.linechart { display: flex; flex-direction: column; }
.linechart svg { flex: 1; width: 100%; min-height: 0; }
.line-path { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.line-area { stroke: none; }
.line-x { display: flex; justify-content: space-between; gap: 3px; margin-top: 8px; }
.line-x span {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  font-size: 10.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.line-x span em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.line-x span.cur em { color: var(--red); }

/* ---------- 排名行：小号 Chip / 匿名标识 / 本人行 ---------- */
.rank-name { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-weight: 500; }
.rn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rank-name .chip { flex: none; }
.chip-mini { height: 20px; font-size: 11px; padding: 0 7px; }
.chip-anon { height: 20px; font-size: 11px; padding: 0 7px; background: var(--surface-container-high); color: var(--text-2); }
.rank-row.is-me { background: color-mix(in srgb, var(--primary-container) 34%, transparent); border-radius: 10px; }

/* ---------- MD3 开关 ---------- */
.switch {
  position: relative; flex: none; width: 54px; height: 32px;
  border-radius: 999px; border: 2px solid var(--outline);
  background: var(--surface-container-high);
  transition: background 0.22s, border-color 0.22s;
}
.switch::after {
  content: ""; position: absolute; top: 50%; left: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--outline);
  transform: translateY(-50%);
  transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), width 0.22s, height 0.22s, background 0.22s;
}
.switch[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.switch[aria-checked="true"]::after { width: 24px; height: 24px; background: var(--on-primary); transform: translate(14px, -50%); }
.switch:disabled { opacity: 0.5; }

/* ---------- 历史违纪 ---------- */
.vio-cycle-tag {
  flex: none; font-size: 11.5px; color: var(--text-3);
  background: var(--surface-container);
  border-radius: 6px; padding: 3px 8px;
}
.history-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--text-2); margin-bottom: 4px; }

/* ---------- 跟手性 / 渲染性能 ---------- */
button, a, .field, .btn, .icon-btn, .tab, .segmented button, .switch,
.student-card, .rank-row, .hb-click, .hb-vio { touch-action: manipulation; }
.student-card { content-visibility: auto; contain-intrinsic-size: auto 176px; }
.rank-row { content-visibility: auto; contain-intrinsic-size: auto 50px; }
.cycle-card { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.hb-group { content-visibility: auto; contain-intrinsic-size: auto 44px; }

/* ---------- 空状态 / 加载 ---------- */
.empty-state { text-align: center; color: var(--text-2); padding: 64px 20px; }
.empty-state svg { color: var(--outline); margin-bottom: 10px; }
.empty-state p { font-size: 14px; }
.spinner {
  width: 30px; height: 30px; margin: 80px auto;
  border: 3px solid var(--surface-container-high); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Snackbar（MD3） ---------- */
.snackbar {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--inverse); color: var(--on-inverse);
  padding: 12px 20px; border-radius: 8px;
  font-size: 13.5px; font-weight: 400;
  box-shadow: var(--elev-1);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 300; max-width: 86vw;
}
body.has-tabs .snackbar { bottom: calc(var(--tab-h) + 16px); }
.snackbar.show { opacity: 1; transform: translate(-50%, 0); }
.snackbar.err { background: var(--err-bg); color: var(--err-text); }

/* ---------- 页脚 ---------- */
.footer { text-align: center; color: var(--text-3); font-size: 12px; padding: 32px 0 8px; }

/* ---------- 底部导航（MD3 指示条） ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--outline-variant);
}
.tabbar-inner { display: flex; width: 100%; max-width: 920px; margin: 0 auto; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-2); position: relative;
  transition: color 0.2s;
}
a.tab { text-decoration: none; -webkit-tap-highlight-color: transparent; }
a.tab:active { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.tab svg { width: 22px; height: 22px; }
.tab-label { font-size: 11px; font-weight: 500; letter-spacing: 0.2px; }
.tab-indicator {
  position: absolute; top: 6px; width: 56px; height: 30px; border-radius: 15px;
  background: var(--primary-container);
  opacity: 0; transform: scaleX(0.6);
  transition: opacity 0.22s, transform 0.22s cubic-bezier(0.2, 0, 0, 1);
  z-index: -1;
}
.tab.is-active { color: var(--primary); }
.tab.is-active .tab-indicator { opacity: 1; transform: none; }

/* ================= 对话框（报告） ================= */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.42);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.dialog {
  background: var(--surface);
  border-radius: 28px;
  width: 100%; max-width: 700px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--elev-1);
  animation: rise 0.25s cubic-bezier(0.2, 0, 0, 1);
}
@keyframes rise { from { opacity: 0; transform: scale(0.96); } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px 26px; }
.dialog-title { font-size: 17px; font-weight: 600; }
.dialog-body { overflow: auto; padding: 6px 22px 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; }

/* ---------- 报告纸面 ---------- */
.report-sheet {
  width: 100%; max-width: 640px; margin: 0 auto;
  background: #FFFFFF; color: #1F1F1F;
  border: 1px solid var(--outline-variant);
  border-radius: 16px;
  padding: 26px;
  font-size: 14px;
}
.rp-head { border-radius: 14px; padding: 22px 24px 18px; margin-bottom: 20px; }
.rp-title { font-size: 21px; font-weight: 700; }
.rp-date { font-size: 12px; margin-top: 3px; opacity: 0.75; }
.rp-id-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.rp-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; flex: none;
}
.rp-name { font-size: 19px; font-weight: 700; }
.rp-sub { font-size: 12px; color: #747775; }
.rp-score-panel { display: flex; align-items: center; gap: 22px; border-radius: 16px; padding: 20px 24px; margin-bottom: 6px; }
.rp-score { font-size: 56px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rp-score-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rp-chip { align-self: flex-start; display: inline-block; border-radius: 8px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; }
.rp-rank { font-size: 14.5px; font-weight: 600; }
.rp-overview { font-size: 12.5px; color: #444746; }
.rp-section { font-size: 15px; font-weight: 700; margin: 20px 0 12px; }
.rp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 4px; }
.rp-tag {
  flex: none; font-size: 11px; font-style: normal; font-weight: 600;
  color: #0B57D0; background: #D3E3FD;
  border-radius: 6px; padding: 3px 7px; white-space: nowrap;
}
.rp-hint { font-size: 12px; color: #444746; margin: -4px 0 10px; }
.rp-tile { border-radius: 14px; padding: 14px; text-align: center; }
.rp-tile b { display: block; font-size: 20px; font-weight: 700; }
.rp-tile span { font-size: 11.5px; color: #444746; }
.report-sheet .hb-label { width: 96px; color: #444746; }
.report-sheet .hb-track { background: #E9EEF6; }
.report-sheet .hb-value { color: #1F1F1F; }
.rp-static .hb-bar { width: var(--w, 0); }
.rp-vio-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #E1E3E1; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px;
}
.rp-slot {
  flex: none; font-size: 11.5px; font-weight: 600;
  border-radius: 6px; padding: 3px 8px; white-space: nowrap;
}
.rp-vio-text { font-size: 13.5px; }
.rp-good {
  border-radius: 10px; padding: 13px 16px;
  font-size: 13.5px; font-weight: 500;
}
.rp-footer { text-align: center; color: #747775; font-size: 11.5px; margin-top: 26px; }

/* ---------- 打印 ---------- */
#printArea { display: none; }
@media print {
  body.printing > #app, body.printing > .snackbar, body.printing > .scrim, body.printing > .tabbar { display: none !important; }
  body.printing { background: #fff; }
  body.printing > #printArea { display: block; }
  #printArea .report-sheet { border: 0; border-radius: 0; max-width: 100%; }
}

/* ---------- 设置 ---------- */
.set-list { border: 1px solid var(--outline-variant); border-radius: var(--radius-l); overflow: hidden; background: var(--surface); }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-height: 54px; }
.set-row + .set-row { border-top: 1px solid var(--outline-variant); }
.set-label { flex: 1; min-width: 0; }
.set-label b { display: block; font-size: 14px; font-weight: 500; }
.set-label span { font-size: 12px; color: var(--text-2); word-break: break-all; }
.set-row .btn { flex: none; text-decoration: none; }
.set-value { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-row { grid-template-columns: 1fr; }
  .hero { padding: 18px; gap: 14px; flex-wrap: wrap; }
  .hero .btn { width: 100%; }
  .large-title { font-size: 23px; }
  .container { padding: 0 12px 44px; }
  body.has-tabs .container { padding-bottom: calc(var(--tab-h) + 28px); }
  .rp-tiles { grid-template-columns: repeat(2, 1fr); }
  .hb-label { width: 64px; }
  .hb-detail { padding-left: 76px; }
  .dialog { max-height: 94vh; border-radius: 22px; }
  .scrim { padding: 10px; }
}
