/* ============================================================
   座位表系统 · WinLane 暖调精致 SaaS 风格
   深色侧栏 · 暖灰背景 · 大圆角卡片 · 柔和阴影 · 丰富层次
   ============================================================ */

/* ---------- CSS 变量（设计令牌） ---------- */
:root {
  /* 背景层次 */
  --bg: #f7f5f2;
  --bg-warm: #f3efe9;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f0ede8;

  /* 侧栏 */
  --sidebar-bg: #2b2d30;
  --sidebar-text: #9ca3af;
  --sidebar-text-hover: #d1d5db;
  --sidebar-active-bg: #a0785c;
  --sidebar-active-text: #ffffff;
  --sidebar-section: #6b7280;
  --sidebar-border: rgba(255,255,255,0.06);

  /* 文字 */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;

  /* 品牌色 */
  --accent: #6366f1;       /* 靛蓝（主操作） */
  --accent-light: #eef2ff;
  --accent-hover: #4f46e5;
  --warm: #a0785c;         /* 暖棕（侧栏活跃/强调） */
  --warm-light: #f5ebe0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  /* 边框与分割 */
  --border: #eae7e1;
  --border-light: #f0ede8;
  --divider: #e5e2dc;

  /* 圆角 */
  --r-sm: 8px;
  --r: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.03);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, "Cascadia Code", "Consolas", monospace;

  /* 间距 */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp: 12px;
  --sp-md: 16px;
  --sp-lg: 20px;
  --sp-xl: 24px;
  --sp-2xl: 32px;
  --sp-3xl: 40px;

  /* 侧栏宽度 */
  --sidebar-w: 272px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
a { color: var(--accent); text-decoration: none; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }

/* Material Symbols */
.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  vertical-align: middle;
}
.mi { font-size: 20px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- App 布局 ---------- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========== 侧栏（深色） ========== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg) 0;
  position: relative;
  z-index: 50;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* 品牌 Logo */
.brand {
  padding: 0 var(--sp-lg) var(--sp-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}
.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--warm), #c49a7a);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; font-weight: 700;
  flex-shrink: 0;
}
.brand-title {
  font-size: 17px; font-weight: 700; color: white; letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 11px; color: var(--sidebar-text); margin-top: 1px;
}

/* 用户信息区 */
.brand-meta {
  margin: var(--sp-md) var(--sp-lg);
  padding: var(--sp-md);
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: var(--sp-sm);
}
.avatar {
  width: 38px; height: 38px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}
.nm { font-size: 13px; font-weight: 600; color: white; line-height: 1.3; }
.rl { font-size: 11px; color: var(--sidebar-text); }

/* 导航分区标题 */
.nav-section {
  padding: var(--sp-lg) var(--sp-lg) var(--sp-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-section);
}

/* 导航项 */
.nav {
  padding: 0 var(--sp-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  border-radius: var(--r-lg);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text-hover);
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: 0 2px 8px rgba(160,120,92,0.3);
}
.nav-item .mi {
  font-size: 20px;
}

/* 侧栏底部 */
.sidebar-footer {
  padding: var(--sp-md) var(--sp-lg);
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  border-radius: var(--r-lg);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: all 0.2s;
}
.btn-logout:hover {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}

/* ========== 主内容区 ========== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}
.main-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* ========== 顶栏 ========== */
.topbar {
  height: 64px;
  min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-2xl);
  gap: var(--sp-md);
  z-index: 30;
  flex-shrink: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* 搜索框 */
.search-box {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 8px 16px;
  width: 280px;
  transition: all 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-box .mi { color: var(--text-tertiary); font-size: 18px; }
.search-box input {
  border: none; background: transparent; flex: 1; font-size: 13.5px; color: var(--text-primary); }
.search-box input::placeholder { color: var(--text-tertiary); }

/* 头像组 */
.avatar-group {
  display: flex; align-items: center;
}
.avatar-group .avatar {
  width: 32px; height: 32px; font-size: 12px;
  border: 2px solid var(--surface);
  margin-left: -8px;
}
.avatar-group .avatar:first-child { margin-left: 0; }
.avatar-more {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 2px solid var(--surface);
  margin-left: -8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
}

/* 图标按钮 */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--error); border: 2px solid var(--surface);
}

/* ========== 内容区域 ========== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2xl);
  scroll-behavior: smooth;
}
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* 页面标题区 */
.page-header {
  margin-bottom: var(--sp-xl);
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: var(--sp-xs);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-top: var(--sp-md);
}

/* ========== 卡片 ========== */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: var(--sp-lg) var(--sp-xl) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.card-body {
  padding: var(--sp-lg) var(--sp-xl) var(--sp-xl);
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ========== 统计卡片网格 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  padding: var(--sp-xl);
  box-shadow: var(--shadow-xs);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: var(--sp-md);
}
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--error-bg); color: var(--error); }
.stat-icon.warm { background: var(--warm-light); color: var(--warm); }
.stat-icon.purple { background: var(--accent-light); color: var(--accent); }
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--sp-xs);
}
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  margin-top: var(--sp-sm);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.stat-trend.up { color: var(--success); background: var(--success-bg); }
.stat-trend.down { color: var(--error); background: var(--error-bg); }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--text-primary);
  color: white;
}
.btn-primary:hover { background: #374151; box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; box-shadow: var(--shadow-md); }
.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn-warm {
  background: var(--warm);
  color: white;
}
.btn-warm:hover { opacity: 0.9; box-shadow: var(--shadow-md); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--divider); }
.btn-soft {
  background: var(--surface-3);
  color: var(--text-primary);
}
.btn-soft:hover { background: var(--divider); }
.btn-danger {
  background: var(--error);
  color: white;
}
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; border-radius: var(--r); }
.btn-lg { padding: 12px 24px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--r);
}

/* ========== 表单 ========== */
.field { margin-bottom: var(--sp-md); }
.label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 20 20'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.stack > * + * { margin-top: var(--sp-md); }
.mt { margin-top: var(--sp-md); }

/* ========== 标签 / 徽章 ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-warm { background: var(--warm-light); color: var(--warm); }
.badge-red { background: var(--error-bg); color: var(--error); }
.badge-gray { background: var(--surface-3); color: var(--text-secondary); }
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.badge-dot.green { background: var(--success); }
.badge-dot.red { background: var(--error); }
.badge-dot.blue { background: var(--info); }
.badge-dot.yellow { background: var(--warning); }

/* ========== 分段控制器 ========== */
.segment {
  display: inline-flex;
  background: var(--surface-3);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segment-btn {
  padding: 7px 16px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.segment-btn:hover { color: var(--text-primary); }
.segment-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ========== 表格 ========== */
.table-wrap {
  overflow: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.selected { background: var(--accent-light); }

/* ========== 座位网格 ========== */
.classroom {
  position: relative;
  padding: var(--sp-2xl);
}
.front {
  text-align: center;
  padding: var(--sp-sm) var(--sp-md);
  background: linear-gradient(90deg, transparent, var(--warm-light), transparent);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--warm);
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-xl);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.classroom.teacher-view .front-placeholder { visibility: hidden; }
.classroom.teacher-view .front:not(.front-placeholder) { margin-top: var(--sp-xl); margin-bottom: 0; }
.classroom.teacher-view .seat-grid {
  transform: rotate(180deg);
}
.classroom.teacher-view .seat-cell {
  transform: rotate(180deg);
}
.classroom.teacher-view .seat-cell.occupied:hover {
  transform: rotate(180deg) translateY(2px);
}
.chart-main { position: relative; }
.seat-map-toolbar {
  position: absolute;
  top: var(--sp-md);
  right: var(--sp-xl);
  z-index: 2;
}
.seat-grid {
  display: grid;
  gap: 10px;
  margin: 0 auto;
  justify-content: start;
}
.seat-cell {
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.seat-cell.empty {
  background: var(--surface-3);
  border: 1.5px dashed var(--border);
  color: var(--text-tertiary);
  cursor: default;
}
.seat-cell.occupied {
  background: var(--surface);
  border-color: var(--border-light);
  box-shadow: var(--shadow-xs);
  color: var(--text-primary);
}
.classroom:not(.teacher-view) .seat-cell.occupied:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-light);
  transform: translateY(-2px);
}
.seat-cell.me {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.seat-cell.conflict {
  border-color: var(--error);
  background: var(--error-bg);
  animation: shake 0.4s ease;
}
.seat-cell .seat-name {
  font-size: 15px;
  font-weight: 600;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.seat-cell .seat-id {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}
.score-seat-net { font-size: 10px; color: var(--text-tertiary); }
.seat-cell .seat-tag {
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
}
.seat-cell .seat-tag.leader { background: var(--warning); }
.seat-cell .seat-tag.near-sighted { background: var(--info); }
.score-seat { appearance: none; padding: 0; }
.score-seat:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.score-unseated { margin-top: var(--sp-xl); }
.score-unseated-list { display: flex; flex-wrap: wrap; gap: var(--sp-sm); margin-top: var(--sp-sm); }
.score-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}
.score-filters .field { min-width: 150px; margin-bottom: 0; }
.score-default-control { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 0 20px; color: var(--text-secondary); font-size: 13px; }
.score-default-control label { font-weight: 700; color: var(--text-primary); }
.score-default-control .input { width: 92px; margin: 0; }
.score-audit { color: var(--text-tertiary); font-size: 11px; line-height: 1.5; }
.score-summary-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: var(--sp-lg); }
.score-positive { color: #059669 !important; font-weight: 700; }
.score-negative { color: var(--error) !important; font-weight: 700; }
.score-modal .field { margin-bottom: var(--sp-md); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ========== 进度环 ========== */
.progress-ring {
  position: relative;
  width: 100px; height: 100px;
}
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring-circle {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 8;
}
.progress-ring-value {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.progress-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.progress-ring-percent {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.progress-ring-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ========== 空状态 ========== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3xl) var(--sp-xl);
  text-align: center;
  color: var(--text-secondary);
}
.empty-icon {
  font-size: 48px;
  color: var(--border);
  margin-bottom: var(--sp-md);
}
.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-xs);
}
.empty-desc {
  font-size: 13.5px;
  color: var(--text-tertiary);
  max-width: 360px;
}

/* ========== Toast 提示 ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: var(--r-full);
  font-size: 13.5px;
  font-weight: 500;
  color: white;
  z-index: 9999;
  animation: toastIn 0.3s ease forwards;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
/* 提示里的操作按钮（如整班排座后的「撤销」） */
.toast-action {
  flex: none;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.16);
  color: white;
  font: inherit;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background 0.18s ease;
}
.toast-action:hover { background: rgba(255,255,255,0.34); }
.toast.info { background: rgba(59,130,246,0.92); }
.toast.success { background: rgba(16,185,129,0.92); }
.toast.error { background: rgba(239,68,68,0.92); }
@keyframes toastIn {
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ========== 遮罩层 ========== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-2xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
.modal-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-sm);
}
.modal-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-lg);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ========== 登录页 ========== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--sp-xl);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-2xl);
  animation: fadeUp 0.5s ease;
}
.login-head {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-bottom: var(--sp-sm);
}
.login-head .brand-logo { width: 44px; height: 44px; font-size: 22px; }
.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.login-sub {
  font-size: 13px;
  color: var(--text-tertiary);
}
/* 登录页：账号登录 / 班级登记 切换标签 */
.seg-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  padding: 4px;
  border-radius: var(--r);
  margin: 20px 0 18px;
}
.seg-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: calc(var(--r) - 4px);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}
.seg-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
/* 班级登记：名单选择 */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--sp-md);
}
.roster-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.16s ease;
  text-align: left;
}
.roster-btn:hover {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.roster-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; border-radius: 9px; flex-shrink: 0; }
.demo-box {
  margin-top: var(--sp-lg);
  padding: var(--sp-md);
  background: var(--surface-3);
  border-radius: var(--r);
  font-size: 12px;
}
.demo-box .t {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.demo-box .d {
  color: var(--text-tertiary);
  line-height: 1.5;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 抽答动画 ========== */
.draw-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-3xl) var(--sp-xl);
}
.draw-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-lg);
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
  animation: popIn 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
.draw-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.draw-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.timer-bar {
  width: 100%;
  max-width: 300px;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: var(--sp-lg);
}
.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  border-radius: var(--r-full);
  transition: width 1s linear;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ========== 工具类 ========== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--sp-xs); }
.gap-sm { gap: var(--sp-sm); }
.gap { gap: var(--sp); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }
.grow { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.c-1 { color: var(--text-primary); }
.c-2 { color: var(--text-secondary); }
.c-3 { color: var(--text-tertiary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ========== 两列布局 ========== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}
.grid-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-lg);
}

/* ========== 列表项 ========== */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r);
  transition: background 0.15s;
  cursor: pointer;
}
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--accent-light); }

/* ========== 响应式 ---------- */
@media (max-width: 1024px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; height: calc(100vh - 56px); }
  .topbar { height: 56px; padding: 0 var(--sp-md); }
  .content { padding: var(--sp-md); }
  .search-box { width: 180px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .seat-cell { width: 56px; height: 56px; font-size: 11px; }
  .seat-cell .seat-name { font-size: 13px; max-width: 52px; }
  .score-filters { align-items: stretch; }
  .score-filters .field { flex: 1 1 140px; }
  .page-title { font-size: 21px; }
  .modal { width: 95%; padding: var(--sp-lg); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-box { display: none; }
}

/* ========== 概览快捷入口 ========== */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
}
.quick-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: var(--sp-lg) var(--sp-xl);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
  text-align: left;
  width: 100%;
}
.quick-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--divider);
}
.quick-icon {
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.quick-icon.blue { background: var(--info-bg); color: var(--info); }
.quick-icon.green { background: var(--success-bg); color: var(--success); }
.quick-icon.warm { background: var(--warm-light); color: var(--warm); }
.quick-icon.purple { background: var(--accent-light); color: var(--accent); }
.quick-icon.red { background: var(--error-bg); color: var(--error); }
.quick-icon.gray { background: var(--surface-3); color: var(--text-secondary); }
.quick-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.quick-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ========== 提示条 ========== */
.hint-box {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  background: var(--info-bg);
  border: 1px solid #dbeafe;
  color: #1e40af;
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--r);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: var(--sp-lg);
}
.hint-box .mi { color: var(--info); margin-top: 2px; flex-shrink: 0; }
.hint-soft {
  background: var(--surface-3);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
.hint-soft .mi { color: var(--text-secondary); }

/* ========== 座位：禁用 / 拖拽态 ========== */
.seat-cell.disabled {
  background: repeating-linear-gradient(45deg, #f0ede8, #f0ede8 6px, #e7e3dc 6px, #e7e3dc 12px);
  border: 1.5px dashed var(--border);
  color: var(--text-tertiary);
  cursor: not-allowed;
}
.seat-cell.disabled:hover { transform: none; box-shadow: none; border-color: var(--border); }
.seat-ban { font-size: 18px; font-weight: 700; color: var(--text-tertiary); line-height: 1; }
.seat-cell.dragging { opacity: 0.35; }
.seat-cell.drag-over {
  border-color: var(--accent) !important;
  background: var(--accent-light) !important;
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ========== 座位编辑模式（教师端） ========== */
.classroom.edit-mode .seat-cell { cursor: pointer; }
/* 进入编辑模式后所有座位带一圈淡色光晕，一眼可见当前可点击 */
.classroom.edit-mode .seat-cell { box-shadow: 0 0 0 2px var(--accent-light); }
.classroom.edit-mode .seat-cell:hover {
  transform: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ========== 座位编辑弹窗 ========== */
.se-current {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.se-current .avatar { width: 38px; height: 38px; font-size: 15px; flex: none; }
.se-current .se-avatar-empty {
  background: var(--surface-3);
  color: var(--text-tertiary);
  font-size: 13px;
}
.se-actions { display: flex; flex-direction: column; gap: var(--sp-sm); margin-top: var(--sp-md); }
.se-action {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-md);
  background: var(--surface);
}
.se-action > .label { display: block; margin-bottom: 6px; }
.se-row { display: flex; gap: var(--sp-sm); align-items: center; }
.se-row > .select, .se-row > .input { flex: 1 1 0; min-width: 0; }
.se-row > .btn { flex: none; }

/* ========== 布局编辑网格 ========== */
.layout-grid {
  display: grid;
  gap: 6px;
  justify-content: start;
}
.layout-cell {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1.5px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.layout-cell:hover { border-color: var(--accent); color: var(--accent); }
.layout-cell.banned {
  background: repeating-linear-gradient(45deg, #f0ede8, #f0ede8 4px, #e7e3dc 4px, #e7e3dc 8px);
  border-color: var(--border);
  color: var(--text-tertiary);
}
.layout-cell .x { font-weight: 700; font-size: 14px; }

/* ========== 导入分隔 ========== */
.or-sep {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  margin: var(--sp-sm) 0;
  position: relative;
}
