/* =========================================================================
   班级积分管理 · 设计系统
   视觉对齐原则：
   1. 间距只用 4pt 刻度（4/8/12/16/24/32/48），不出现偶然值
   2. 一屏之内的左右边界统一为 --gutter，卡片内边距统一 --pad-card
   3. 表格 = 同一套 grid 列模板（--cols-*），表头与数据行严格同列
   4. 数字统一 tabular-nums 并右对齐，文本左对齐，绝不居中数字
   5. 圆角/阴影/z-index 均为有限刻度，不使用一次性数值
   ========================================================================= */
:root {
  /* 间距刻度（4pt 基准） */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;
  --s-12: 48px;

  /* 字号刻度 */
  --t-xs: 12px;
  --t-sm: 13px;
  --t-base: 15px;
  --t-lg: 17px;
  --t-xl: 20px;
  --t-2xl: 26px;

  /* 颜色 */
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --line: #e6eaf0;
  --line-2: #f1f5f9;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --green: #047857;
  --green-bg: #ecfdf5;
  --rose: #be123c;
  --rose-bg: #fff1f2;
  --amber: #b45309;
  --amber-bg: #fffbeb;

  /* 圆角 / 阴影 / 层级 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-2: 0 4px 12px rgba(15, 23, 42, .06);
  --shadow-3: 0 16px 40px rgba(15, 23, 42, .18);
  --z-sticky: 10;
  --z-dropdown: 20;
  --z-backdrop: 40;
  --z-modal: 50;
  --z-toast: 60;

  /* 布局 */
  --gutter: var(--s-4);
  --pad-card: var(--s-4);
  --header-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;

  /* 表格列模板：表头与数据行共用，保证纵向严格对齐 */
  --cols-student: 44px minmax(0, 1fr) 84px 68px 64px;
  --cols-group: 44px minmax(0, 1fr) 56px 64px 56px;
  --cols-score: 44px minmax(0, 1fr) 76px 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.tiny { font-size: var(--t-xs); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: var(--s-2); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.wrap { flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.right { text-align: right; }

/* ======================= 基础组件 ======================= */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: var(--pad-card);
}
.card + .card { margin-top: var(--s-3); }
.card-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 24px;
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .01em;
}
.card-title::before {
  content: '';
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--brand);
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  background: var(--line-2);
  color: var(--ink-2);
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .22); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-danger { background: var(--rose-bg); color: var(--rose); }
.btn-warn { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.btn-sm { height: 32px; padding: 0 var(--s-3); font-size: var(--t-xs); border-radius: var(--r-sm); }
.btn-block { width: 100%; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .16);
  color: #fff;
}
.icon-btn:active { transform: scale(.94); }

.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field > label { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fbfcfe;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.textarea { height: auto; min-height: 76px; padding: var(--s-2) var(--s-3); resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); background: #fff; }
.input::placeholder { color: var(--ink-4); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px var(--s-2);
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  background: var(--brand-50);
  color: var(--brand-600);
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-rose { background: var(--rose-bg); color: var(--rose); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-slate { background: var(--line-2); color: var(--ink-3); }

.pill-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--line-2);
}
.pill {
  padding: 5px var(--s-3);
  border-radius: 9px;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
.pill.active { background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-1); }

.empty {
  padding: var(--s-6) var(--s-3);
  text-align: center;
  font-size: var(--t-sm);
  color: var(--ink-4);
}
.divider { height: 1px; background: var(--line-2); margin: var(--s-3) 0; }
.spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================= 登录 ======================= */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6) var(--gutter);
  background: linear-gradient(160deg, #4f46e5 0%, #6d28d9 52%, #312e81 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: var(--s-6);
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
}
.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto var(--s-3);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-2xl); font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  box-shadow: 0 10px 24px rgba(67, 56, 202, .32);
}
.login-title { text-align: center; font-size: var(--t-xl); font-weight: 800; letter-spacing: .02em; }
.login-sub { margin: var(--s-1) 0 var(--s-4); text-align: center; font-size: var(--t-xs); color: var(--ink-4); }
.role-tabs { display: flex; gap: 2px; padding: 4px; margin-bottom: var(--s-4); border-radius: var(--r-md); background: var(--line-2); }
.role-tabs button { flex: 1; height: 34px; border-radius: 9px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-3); }
.role-tabs button.active { background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-1); }
.err-text { margin-top: var(--s-2); font-size: var(--t-xs); color: var(--rose); }
.tips-box {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-2);
  font-size: var(--t-xs);
  line-height: 1.8;
  color: var(--ink-4);
  text-align: center;
}

/* ======================= 班级端骨架 ======================= */
.shell { max-width: 560px; margin: 0 auto; padding-bottom: var(--s-12); }
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--header-h);
  padding: 0 var(--gutter);
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 4px 16px rgba(67, 56, 202, .18);
}
.app-badge {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-base); font-weight: 800;
  background: rgba(255, 255, 255, .2);
  overflow: hidden;
}
.app-badge img { width: 100%; height: 100%; object-fit: cover; }
.app-title { font-size: var(--t-sm); font-weight: 700; line-height: 1.25; }
.app-meta { display: flex; align-items: center; gap: 6px; margin-top: 1px; font-size: 11px; opacity: .85; }
.role-chip {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin: var(--s-3) var(--gutter) 0;
}
.stat-card {
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
}
.stat-card .label { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--ink-3); }
.stat-card .value { margin-top: 2px; font-size: var(--t-xl); font-weight: 800; line-height: 1.2; }

.collapse {
  margin: var(--s-3) var(--gutter) 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.collapse-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-base);
  font-weight: 700;
  cursor: pointer;
}
.collapse-head .chev { margin-left: auto; color: var(--ink-4); transition: transform .2s ease; }
.collapse.open .chev { transform: rotate(180deg); }
.collapse-body { display: none; padding: 0 var(--s-4) var(--s-4); }
.collapse.open .collapse-body { display: block; }

.view-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin: var(--s-3) var(--gutter) 0;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.view-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--s-2) 2px;
  border-radius: var(--r-sm);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-3);
}
.view-tab i { font-style: normal; display: flex; align-items: center; justify-content: center; height: 18px; }
.view-tab.active { background: var(--brand); color: #fff; }

.panel { margin: var(--s-3) var(--gutter) 0; }
.toolbar { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 160px; min-width: 0; }
.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 var(--s-3) 0 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  outline: none;
}
.search-box input:focus { border-color: var(--brand); }
.search-box::before {
  content: '';
  position: absolute;
  left: var(--s-3);
  top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background: currentColor;
  color: var(--ink-4);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.6-3.6'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.6-3.6'/></svg>") center/contain no-repeat;
}

/* ======================= 表格（共用列模板） ======================= */
.table-card { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.table-head, .table-row {
  display: grid;
  grid-template-columns: var(--cols-student);
  align-items: center;
  column-gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
}
.table-head {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-4);
  background: #fafbfd;
  border-bottom: 1px solid var(--line-2);
}
.table-head > div:nth-child(n + 3), .table-row > div:nth-child(n + 3) { text-align: center; }
.table-head > div:last-child, .table-row > div:nth-child(5) { text-align: right; }
.table-row { border-bottom: 1px solid var(--line-2); }
.table-row:last-child { border-bottom: none; }
.table-row .ops {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--s-1);
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px dashed var(--line-2);
}
.table-head.group, .group-row { grid-template-columns: var(--cols-group); }
.table-head.score, .table-row.score { grid-template-columns: var(--cols-score); }

.rank-badge {
  width: 30px; height: 30px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-xs); font-weight: 800;
  background: var(--line-2); color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #fff; }
.rank-3 { background: linear-gradient(135deg, #fdba74, #ea580c); color: #fff; }
.stu-name { font-size: var(--t-sm); font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stu-sub { font-size: 11px; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.points-pill {
  display: inline-block;
  min-width: 44px;
  padding: 2px var(--s-2);
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green);
  font-size: var(--t-sm);
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.points-pill.neg { background: var(--rose-bg); color: var(--rose); }
.op-btn {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--ink-3);
  font-size: var(--t-xs);
  font-weight: 600;
}
.op-btn.add { border-color: #a7f3d0; color: var(--green); }
.op-btn.sub { border-color: #fecdd3; color: var(--rose); }
.op-btn:active { background: var(--line-2); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  padding: var(--s-3) 0 var(--s-1);
  flex-wrap: wrap;
}
.pagination button {
  min-width: 32px; height: 32px;
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-3);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-1);
}
.pagination button.active { background: var(--brand); color: #fff; }
.pagination button:disabled { opacity: .4; }
.pagination input {
  width: 48px; height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  text-align: center;
}

.group-row {
  display: grid;
  align-items: center;
  column-gap: var(--s-2);
  padding: var(--s-3);
  border-bottom: 1px solid var(--line-2);
}
.group-row:last-child { border-bottom: none; }
.progress { height: 4px; margin-top: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #818cf8, #4f46e5); }

/* ======================= 排座 ======================= */
.seat-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-1);
  margin-bottom: var(--s-2);
}
.seat-toolbar .btn { width: 100%; padding: 0 var(--s-2); }
.seat-board {
  padding: var(--s-3);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow-x: auto;
}
.seat-stage-label {
  margin-bottom: var(--s-2);
  text-align: center;
  font-size: var(--t-xs);
  letter-spacing: var(--s-2);
  color: var(--ink-4);
}
.seat-grid { display: grid; gap: var(--s-1); }
.seat {
  min-height: 46px;
  padding: 4px 2px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--ink-4);
  text-align: center;
  word-break: break-all;
  background: #fbfcfe;
}
.seat.filled { border: 1px solid var(--brand-100); background: #fff; box-shadow: var(--shadow-1); }
.seat.empty::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.seat.filled .seat-name { font-size: var(--t-xs); font-weight: 700; color: var(--ink); }
.seat.filled .seat-points { font-size: 10px; font-weight: 700; color: var(--brand-600); font-variant-numeric: tabular-nums; }
.seat-empty-card {
  margin-top: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: #fafbfd;
  font-size: var(--t-xs);
  color: var(--ink-3);
}
.seat-unseated { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-2); }
.seat-chip { padding: 3px var(--s-2); border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; font-size: var(--t-xs); }

/* ======================= 商城 / 成绩 ======================= */
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--s-3); }
.gift-card {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.gift-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-base); font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
}
.gift-name { font-size: var(--t-sm); font-weight: 700; }
.gift-cost { font-size: var(--t-xs); font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }

.score-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.score-metric {
  padding: var(--s-3) var(--s-2);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  text-align: center;
}
.score-metric b { display: block; font-size: var(--t-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
.score-metric span { font-size: 11px; color: var(--ink-4); }
.bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 32px;
  align-items: center;
  gap: var(--s-2);
  margin-top: 6px;
  font-size: var(--t-xs);
}
.bar { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ======================= 管理端（超管 / 成员） ======================= */
.admin-shell { max-width: 1080px; margin: 0 auto; padding: var(--s-4) var(--gutter) var(--s-12); }
.admin-topbar { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }
.admin-title { font-size: var(--t-xl); font-weight: 800; letter-spacing: .01em; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
@media (min-width: 720px) { .admin-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  font-size: var(--t-xs);
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.admin-table th { font-weight: 600; color: var(--ink-4); background: #fafbfd; white-space: nowrap; }
.admin-table td.num, .admin-table th.num {
  width: 76px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .cell-strong { font-size: var(--t-sm); font-weight: 700; color: var(--ink); }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 34px;
  z-index: var(--z-dropdown);
  min-width: 148px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu button {
  display: block;
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--t-xs);
  color: var(--ink-2);
  text-align: left;
}
.dropdown-menu button:hover { background: var(--line-2); }

/* ======================= 成员列表 ======================= */
.member-item {
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-2);
}
.member-item:last-child { border-bottom: none; }
.member-line { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.member-line .name { font-size: var(--t-sm); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-meta { margin-top: 2px; font-size: var(--t-xs); color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-ops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-1); margin-top: var(--s-2); }
.member-ops.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.member-ops .btn { width: 100%; }

/* ======================= 弹层 / 提示 ======================= */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, .45);
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--s-4) var(--s-4) var(--s-6);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: slideUp .18s ease;
  z-index: var(--z-modal);
}
@media (min-width: 640px) {
  .modal-mask { align-items: center; padding: var(--s-4); }
  .modal { border-radius: var(--r-xl); }
}
@keyframes slideUp { from { transform: translateY(20px); opacity: .7; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 32px;
  margin-bottom: var(--s-3);
}
.modal-title { font-size: var(--t-lg); font-weight: 800; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--line-2);
  color: var(--ink-3);
  font-size: var(--t-sm);
  line-height: 1;
}
.modal-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-2);
  position: sticky;
  bottom: calc(var(--s-6) * -1);
  background: var(--surface);
}
.modal-actions .btn { flex: 1; }

.toast-wrap {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--s-8) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  max-width: 86vw;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  background: rgba(15, 23, 42, .92);
  color: #fff;
  font-size: var(--t-xs);
  text-align: center;
  box-shadow: var(--shadow-3);
  animation: fadeIn .18s ease;
}
.toast.ok { background: rgba(4, 120, 87, .95); }
.toast.err { background: rgba(190, 18, 60, .95); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sheet-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--t-sm);
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item > .grow { min-width: 0; }
.delta-pos { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.delta-neg { color: var(--rose); font-weight: 700; font-variant-numeric: tabular-nums; }

.chip-list { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.chip {
  padding: 5px var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfcfe;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
}
.chip.pos { background: var(--green-bg); border-color: #a7f3d0; color: var(--green); }
.chip.neg { background: var(--rose-bg); border-color: #fecdd3; color: var(--rose); }
.chip.active { outline: 2px solid var(--brand); }

/* ======================= 响应式 ======================= */
@media (max-width: 640px) {
  .admin-shell { padding: var(--s-3) var(--s-3) var(--s-12); }
  .admin-title { font-size: var(--t-lg); flex: 1 1 100%; }
  .admin-topbar > .row { margin-left: 0 !important; width: 100%; flex-wrap: wrap; }
  .admin-table { min-width: 0; }
  .admin-table .hide-sm { display: none; }
  .admin-table th, .admin-table td { padding: var(--s-2); }
  .score-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-1); }
  .score-metric { padding: var(--s-2) 4px; }
  .score-metric b { font-size: var(--t-base); }
}
@media (min-width: 900px) {
  .shell { max-width: 780px; }
  :root { --gutter: var(--s-6); --pad-card: var(--s-6); }
  .table-head, .table-row { --cols-student: 52px minmax(0, 1fr) 110px 86px 76px; }
  .table-head.group, .group-row { --cols-group: 52px minmax(0, 1fr) 72px 84px 68px; }
  .table-row .ops { grid-column: auto; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); margin-top: 0; padding-top: 0; border-top: none; }
  .seat-toolbar { gap: var(--s-2); }
}

@media print {
  body { background: #fff; }
  .app-header, .stat-grid, .collapse, .view-tabs, .toolbar, .seat-toolbar, .no-print { display: none !important; }
  .seat-board { box-shadow: none; }
}
