/* ═══════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════ */
:root {
  /* Brand */
  --primary:        #7c3aed;
  --primary-light:  #a78bfa;
  --primary-dark:   #5b21b6;
  --primary-xdark:  #3b0764;
  --secondary:      #f59e0b;
  --secondary-light:#fcd34d;
  /* Semantic */
  --success:  #10b981;
  --danger:   #ef4444;
  --warning:  #f97316;
  --info:     #3b82f6;
  /* Surface */
  --bg:       #f4f2ff;
  --bg-card:  #ffffff;
  --glass:    rgba(255,255,255,.72);
  --glass-border: rgba(255,255,255,.5);
  /* Text */
  --text:       #18181b;
  --text-muted: #71717a;
  --text-light: #a1a1aa;
  /* Border */
  --border:  #e4e4e7;
  --border-focus: rgba(124,58,237,.45);
  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 2px 8px rgba(124,58,237,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow:    0 4px 16px rgba(124,58,237,.10), 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 8px 28px rgba(124,58,237,.14), 0 2px 8px rgba(0,0,0,.07);
  --shadow-lg: 0 16px 48px rgba(124,58,237,.18), 0 4px 12px rgba(0,0,0,.08);
  --shadow-color: 0 4px 20px;
  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  /* Motion */
  --transition: .18s cubic-bezier(.4,0,.2,1);
  --spring:     .3s cubic-bezier(.34,1.56,.64,1);
}

/* ═══════════════════════════════════════════
   RESET
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
/* Subtle dot-grid background */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background-image: radial-gradient(circle at 1px 1px, rgba(124,58,237,.08) 1px, transparent 0);
  background-size: 28px 28px;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea {
  font-family: inherit; font-size: inherit; outline: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .85rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3.5px rgba(124,58,237,.15);
  background: #fdfcff;
}
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
code {
  font-family: "JetBrains Mono","Fira Code","Consolas",monospace;
  background: rgba(124,58,237,.08);
  color: var(--primary-dark);
  border-radius: 4px;
  padding: .1em .35em;
  font-size: .88em;
}

/* ═══════════════════════════════════════════
   PAGES
═══════════════════════════════════════════ */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* ═══════════════════════════════════════════
   BUTTON SYSTEM
═══════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed 50%, #6d28d9);
  color: #fff;
  padding: .6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem;
  transition: all var(--transition);
  box-shadow: 0 2px 10px rgba(124,58,237,.35), inset 0 1px 0 rgba(255,255,255,.15);
  letter-spacing: .01em;
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.12), transparent);
  opacity: 0; transition: opacity var(--transition);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,.4); }
.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(124,58,237,.3); }
.btn-block { width: 100%; padding: .8rem; font-size: 1rem; border-radius: var(--radius); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  background: var(--glass);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: .88rem;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
}
.btn-ghost:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(124,58,237,.06);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff; padding: .55rem 1.1rem;
  border-radius: var(--radius-sm); font-weight: 600;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
  transition: all var(--transition);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,185,129,.4); }

.btn-danger {
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #fff; padding: .55rem 1.1rem;
  border-radius: var(--radius-sm); font-weight: 600;
  box-shadow: 0 2px 8px rgba(239,68,68,.3);
  transition: all var(--transition);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(239,68,68,.4); }

.btn-warning {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #fff; padding: .55rem 1.1rem;
  border-radius: var(--radius-sm); font-weight: 600;
  box-shadow: 0 2px 8px rgba(249,115,22,.3);
  transition: all var(--transition);
}
.btn-warning:hover { transform: translateY(-1px); }

.btn-sm { padding: .35rem .8rem; font-size: .82rem; }
.btn-lg { padding: .85rem 2.2rem; font-size: 1.05rem; }
.btn-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 1rem;
  transition: all var(--transition);
}
.btn-icon:hover { background: rgba(124,58,237,.1); color: var(--primary); }

/* ═══════════════════════════════════════════
   AUTH PAGE
═══════════════════════════════════════════ */
.auth-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e0533 0%, #3b0764 25%, #6d28d9 55%, #a855f7 80%, #f472b6 100%);
  position: relative; overflow: hidden;
}
/* Animated orbs */
.auth-bg::before, .auth-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  animation: orbFloat 8s ease-in-out infinite;
}
.auth-bg::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,.35) 0%, transparent 70%);
  top: -180px; right: -120px;
  animation-delay: 0s;
}
.auth-bg::after {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,.3) 0%, transparent 70%);
  bottom: -150px; left: -80px;
  animation-delay: -4s;
}
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-20px) scale(1.05); }
  66% { transform: translate(-20px,15px) scale(.97); }
}
/* Floating particles */
.auth-bg .auth-particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.auth-card {
  background: rgba(255,255,255,.96);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.5rem;
  width: 440px; max-width: 95vw;
  box-shadow: 0 32px 80px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.2);
  position: relative; z-index: 1;
  backdrop-filter: blur(20px);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon {
  font-size: 3.5rem; display: block; margin-bottom: .6rem;
  animation: logoBounce 2.5s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(124,58,237,.4));
}
@keyframes logoBounce {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}
.logo-title {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.logo-sub { color: var(--text-muted); font-size: .88rem; margin-top: .3rem; }

/* Floating pet decorations on auth background */
.auth-floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.af {
  position: absolute; font-size: 2rem; opacity: .18;
  animation: afloat 6s ease-in-out infinite;
  filter: blur(.5px);
}
.af1  { top: 8%;  left: 8%;  animation-duration: 7s;  animation-delay: 0s;   font-size: 2.4rem; }
.af2  { top: 15%; right: 10%;animation-duration: 9s;  animation-delay: -2s;  font-size: 1.8rem; }
.af3  { top: 70%; left: 5%;  animation-duration: 8s;  animation-delay: -1s;  font-size: 2.8rem; }
.af4  { top: 80%; right: 8%; animation-duration: 6.5s;animation-delay: -3s;  font-size: 2rem;   }
.af5  { top: 40%; left: 3%;  animation-duration: 10s; animation-delay: -4s;  font-size: 1.6rem; }
.af6  { top: 55%; right: 4%; animation-duration: 7.5s;animation-delay: -1.5s;font-size: 2.2rem; }
.af7  { top: 25%; left: 18%; animation-duration: 11s; animation-delay: -5s;  font-size: 1.5rem; }
.af8  { top: 88%; left: 40%; animation-duration: 8.5s;animation-delay: -2.5s;font-size: 2.5rem; }
@keyframes afloat {
  0%,100% { transform: translateY(0) rotate(0deg); }
  33%     { transform: translateY(-20px) rotate(8deg); }
  66%     { transform: translateY(-10px) rotate(-5deg); }
}

.auth-tabs {
  display: flex; gap: .4rem; margin-bottom: 1.75rem;
  background: #f4f4f8; border-radius: var(--radius); padding: .3rem;
}
.auth-tab {
  flex: 1; padding: .55rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem; color: var(--text-muted);
  transition: all var(--transition);
}
.auth-tab.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,.12), 0 0 0 1px rgba(124,58,237,.1);
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field label {
  font-weight: 600; font-size: .8rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.form-field input:not([type="checkbox"]):not([type="radio"]) { width: 100%; padding: .7rem 1rem; border-radius: var(--radius-sm); font-size: .95rem; }
.form-input { width: 100%; padding: .7rem 1rem; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════════
   MAIN HEADER
═══════════════════════════════════════════ */
.main-header {
  height: 62px;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  box-shadow: 0 1px 0 var(--border), 0 4px 16px rgba(0,0,0,.04);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(16px);
}
.header-left { display: flex; align-items: center; gap: .75rem; }
.logo-sm { font-size: 1.8rem; filter: drop-shadow(0 2px 6px rgba(124,58,237,.3)); }
.site-name {
  font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em;
  background: linear-gradient(135deg, #6d28d9, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header-right { display: flex; align-items: center; gap: 1rem; }
.teacher-name {
  font-weight: 600; font-size: .9rem; color: var(--text);
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(168,85,247,.08));
  padding: .3rem .85rem; border-radius: 20px;
  border: 1px solid rgba(124,58,237,.15);
}

/* ═══════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════ */
.dashboard-body {
  max-width: 1200px; margin: 0 auto;
  padding: 2.5rem 2rem;
}
.dashboard-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem;
}
.section-title {
  font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em;
  color: var(--text);
}
.section-title::after {
  content: ''; display: block; width: 36px; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px; margin-top: .3rem;
}
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.4rem;
}

.class-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--spring), box-shadow var(--transition);
  border: 1.5px solid rgba(124,58,237,.08);
  overflow: hidden;
  position: relative;
}
.class-card:hover { transform: translateY(-5px) scale(1.01); box-shadow: var(--shadow-md); }
/* Gradient banner at top */
.class-card-banner {
  height: 72px;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6, #a855f7);
  position: relative; overflow: hidden;
  display: flex; align-items: center; padding: 0 1.4rem;
}
.class-card-banner::before {
  content: '🏫';
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  font-size: 2.8rem; opacity: .25;
}
.class-card-banner-title {
  font-size: 1.15rem; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.class-card-body { padding: 1rem 1.4rem 1.2rem; }
.class-card-grade {
  display: inline-flex; align-items: center;
  color: var(--text-muted); font-size: .82rem; font-weight: 500;
  margin-bottom: .85rem;
  background: rgba(124,58,237,.07); padding: .2rem .65rem;
  border-radius: 20px; border: 1px solid rgba(124,58,237,.12);
}
.class-card-stats { display: flex; gap: 1.25rem; margin-bottom: 1rem; }
.class-card-stat { display: flex; flex-direction: column; }
.class-card-stat .stat-val {
  font-size: 1.5rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.class-card-stat .stat-label { font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }
.class-card-actions {
  display: flex; gap: .5rem;
  padding-top: .85rem; border-top: 1px solid var(--border);
}
.class-card-actions button { flex: 1; font-size: .82rem; }

/* ═══════════════════════════════════════════
   CLASS HEADER
═══════════════════════════════════════════ */
.class-header {
  background: linear-gradient(135deg, #3b0764 0%, #5b21b6 40%, #7c3aed 100%);
  border-bottom: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.75rem;
  gap: 1rem; flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(91,33,182,.3);
  position: sticky; top: 0; z-index: 100;
}
.class-header-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.btn-back {
  background: rgba(255,255,255,.15);
  color: #fff;
  padding: .4rem .95rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: .82rem;
  border: 1px solid rgba(255,255,255,.25);
  transition: all var(--transition); white-space: nowrap;
  backdrop-filter: blur(8px);
}
.btn-back:hover { background: rgba(255,255,255,.25); transform: translateX(-2px); }
.class-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.class-page-name { font-size: 1.1rem; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-page-grade { font-size: .75rem; color: rgba(255,255,255,.65); margin-top: .05rem; }

.class-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
.nav-btn {
  padding: .38rem .8rem;
  border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600;
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1);
  transition: all var(--transition); white-space: nowrap;
  backdrop-filter: blur(8px);
}
.nav-btn:hover {
  background: rgba(255,255,255,.22);
  color: #fff; border-color: rgba(255,255,255,.4);
  transform: translateY(-1px);
}
.nav-btn.primary {
  background: rgba(255,255,255,.95); color: var(--primary);
  border-color: transparent; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-btn.primary:hover {
  background: #fff; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.nav-btn.accent {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(249,115,22,.35);
}
.nav-btn.accent:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249,115,22,.45); }

/* ═══════════════════════════════════════════
   CLASS TABS
═══════════════════════════════════════════ */
.class-tabs {
  display: flex; gap: 0;
  background: #fff;
  border-bottom: 2px solid var(--border);
  padding: 0 1.75rem;
  position: sticky; top: 60px; z-index: 99;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.tab-btn {
  padding: .85rem 1.35rem;
  font-weight: 700; font-size: .88rem;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  letter-spacing: .01em;
  position: relative;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; background: var(--primary); border-radius: 50%;
  animation: tabDot .25s var(--spring) forwards;
}
@keyframes tabDot { from { transform: translateX(-50%) scale(0); } to { transform: translateX(-50%) scale(1); } }

/* ═══════════════════════════════════════════
   CLASS CONTENT
═══════════════════════════════════════════ */
.class-content { padding: 1.5rem 1.75rem; min-height: calc(100vh - 130px); }
.tab-content { display: none; animation: fadeUp .2s ease; }
.tab-content.active { display: block; }
@keyframes fadeUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }
.tab-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.4rem; gap: 1rem; flex-wrap: wrap;
}
.tab-toolbar h3 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }

/* ═══════════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════════ */
.filter-bar {
  display: flex; gap: .65rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 1.1rem;
  background: var(--bg-card);
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.filter-input { min-width: 160px; font-size: .875rem; }
.filter-select { font-size: .875rem; min-width: 115px; }
.filter-score { display: flex; align-items: center; gap: .4rem; }
.filter-input-sm { width: 82px; font-size: .875rem; }

.batch-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: 1rem;
  background: var(--bg-card);
  padding: .5rem .85rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s;
}
.batch-bar.active {
  border-color: rgba(124,58,237,.45);
  background: linear-gradient(135deg, rgba(124,58,237,.04), rgba(168,85,247,.04));
}
/* 触发按钮 */
.batch-toggle-btn {
  display: flex; align-items: center; gap: .4rem;
  font-weight: 600; font-size: .85rem;
  padding: .35rem .85rem !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 20px !important;
  background: transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.batch-toggle-btn:hover { border-color: var(--primary) !important; color: var(--primary); }
.batch-bar.active .batch-toggle-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff !important; border-color: transparent !important;
}
/* 展开内容区：默认隐藏 */
.batch-expanded {
  display: none; align-items: center; gap: .55rem; flex-wrap: wrap;
}
.batch-bar.active .batch-expanded { display: flex; }
/* 全选按钮 */
.batch-select-btn {
  border: 1.5px dashed rgba(124,58,237,.5) !important;
  color: var(--primary) !important;
  background: transparent; font-weight: 600;
  transition: background .15s;
}
.batch-select-btn.all-selected { background: rgba(124,58,237,.1); }
/* 计数 */
.batch-count-label { font-size: .83rem; color: var(--muted); min-width: 3.5rem; }
.batch-count-label.has-selection { font-weight: 700; color: var(--primary); }
/* 分割线 */
.batch-divider { width: 1px; height: 20px; background: var(--border); margin: 0 .1rem; flex-shrink: 0; }
/* 禁用态 */
.batch-bar button:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
#batch-count {
  font-size: .875rem;
}

/* ═══════════════════════════════════════════
   STUDENTS GRID
═══════════════════════════════════════════ */
.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(198px, 1fr));
  gap: 1.25rem;
}
.students-empty {
  grid-column: 1/-1; text-align: center;
  padding: 5rem 1rem; color: var(--text-muted);
}
.students-empty .empty-icon { font-size: 4.5rem; display: block; margin-bottom: .85rem; opacity: .35; }

/* ═══════════════════════════════════════════
   STUDENT CARD  ★ Core redesign
═══════════════════════════════════════════ */
.student-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid transparent;
  transition: transform var(--spring), box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: visible;
  user-select: none;
}
.student-card:hover { transform: translateY(-5px) scale(1.01); box-shadow: var(--shadow-md); }
.student-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.2), var(--shadow-md);
}
.student-card.selected::after {
  content: ''; /* cleared — using .card-select-check instead */
}

/* ── 卡片左上角勾选框（默认隐藏，select-mode 时出现）── */
.card-select-check {
  position: absolute; top: .55rem; left: .55rem; z-index: 10;
  width: 22px; height: 22px;
  border: 2px solid rgba(124,58,237,.35);
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  display: none; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .15s, box-shadow .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.select-mode .card-select-check { display: flex; }
.card-select-check:hover {
  border-color: var(--primary);
  background: rgba(124,58,237,.08);
  transform: scale(1.15);
}
.card-check-icon { font-size: .68rem; font-weight: 800; color: transparent; line-height: 1; }
.student-card.selected .card-select-check {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(124,58,237,.4);
}
.student-card.selected .card-check-icon { color: #fff; }

/* Card top gradient banner (group color stripe upgraded) */
.card-group-stripe {
  height: 5px; position: relative; overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* default gradient if no group */
.card-group-stripe:not([style]) {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa, #c4b5fd);
}

/* Pet area */
.card-pet-wrap {
  position: relative; height: 108px;
  display: flex; align-items: center; justify-content: center;
  /* soft radial glow behind pet */
  background: radial-gradient(ellipse 80% 70% at 50% 60%, rgba(124,58,237,.07) 0%, transparent 80%);
}
.card-pet-img {
  height: 90px; width: 90px; object-fit: contain;
  animation: petFloat 3s ease-in-out infinite;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.18));
  position: relative; z-index: 1;
}
@keyframes petFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.card-pet-missing {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border-radius: var(--radius); font-size: 2.8rem;
  display: flex; align-items: center; justify-content: center;
  animation: petFloat 3s ease-in-out infinite;
}

/* Level badge */
.card-level-row {
  display: flex; align-items: center; justify-content: center;
  gap: .3rem; margin-bottom: .45rem; padding: 0 .75rem;
}
.card-level-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; font-size: .68rem; font-weight: 800;
  padding: .18rem .55rem; border-radius: 20px;
  box-shadow: 0 2px 6px rgba(245,158,11,.35);
  letter-spacing: .03em;
}
.card-level-title { font-size: .68rem; color: var(--text-muted); font-weight: 500; }

/* Name */
.card-name {
  text-align: center; font-size: 1rem; font-weight: 800;
  letter-spacing: -.01em; margin-bottom: .15rem;
  padding: 0 .75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-student-no {
  text-align: center; font-size: .72rem; color: var(--text-light);
  margin-bottom: .5rem;
}

/* Progress */
.card-progress-wrap { margin: 0 .85rem .6rem; }
.card-progress-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .7rem; color: var(--text-muted); margin-bottom: .25rem; font-weight: 500;
}
/* "还差 XX 🍗" — matches card-chicken-val style */
.card-need-num {
  font-weight: 800;
  font-size: .82rem;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 .15rem;
}
.card-need-leg {
  font-size: .82rem;
  /* keep emoji rendering natural but shift baseline to align */
  vertical-align: middle;
  line-height: 1;
}
.card-maxlevel {
  font-size: .72rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.card-progress-bar {
  height: 5px; background: #f0f0f8; border-radius: 3px; overflow: hidden;
}
.card-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa, #c4b5fd);
  border-radius: 3px;
  transition: width .6s cubic-bezier(.34,1.56,.64,1);
  position: relative;
}
.card-progress-fill::after {
  content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; background: #fff;
  border: 2px solid #8b5cf6; border-radius: 50%;
}

/* Progress sub-label */
.card-progress-sub {
  font-size: .66rem;
  color: var(--text-light);
  text-align: right;
  margin-top: .2rem;
  letter-spacing: .01em;
}

/* Score chips */
.card-scores {
  display: flex; justify-content: center; gap: .5rem;
  margin: 0 .75rem .75rem;
}
.card-score-item {
  flex: 1; text-align: center; padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(124,58,237,.06), rgba(168,85,247,.04));
  border: 1px solid rgba(124,58,237,.1);
}
.card-score-val {
  font-size: .95rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.card-score-label { font-size: .65rem; color: var(--text-muted); margin-top: .15rem; }
.card-chicken-val {
  font-size: .95rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
/* 鸡腿不足时变灰警告 */
.card-score-item--empty .card-chicken-val {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.card-score-item--empty {
  background: rgba(239,68,68,.05) !important;
  border-color: rgba(239,68,68,.15) !important;
}
.card-score-item--empty .card-score-label {
  color: var(--danger);
  font-weight: 600;
}

/* Medal strip */
.card-medals {
  display: flex;
  align-items: center;
  gap: .22rem;
  padding: .45rem .85rem .35rem;
  min-height: 34px;
  border-top: 1px solid rgba(124,58,237,.07);
  flex-wrap: wrap;
}
.card-medals-empty {
  justify-content: center;
  font-size: .68rem;
  color: var(--text-light);
  font-style: italic;
}
.card-medal-icon {
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245,158,11,.12), rgba(249,115,22,.1));
  border: 1px solid rgba(245,158,11,.25);
  cursor: default;
  transition: transform var(--spring);
  line-height: 1;
}
.card-medal-icon:hover {
  transform: scale(1.25) rotate(-8deg);
  z-index: 2; position: relative;
}
.card-medal-more {
  font-size: .7rem; font-weight: 800;
  color: var(--secondary);
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 20px;
  padding: .1rem .45rem;
  white-space: nowrap;
}

/* Action buttons */
.card-actions {
  display: flex; gap: .3rem; padding: 0 .75rem .85rem;
  justify-content: center;
}
.card-action-btn {
  flex: 1; padding: .42rem .2rem;
  border-radius: var(--radius-sm); font-size: .78rem; font-weight: 700;
  text-align: center; transition: all var(--transition);
  border: 1.5px solid var(--border); color: var(--text-muted);
  background: #fafafa;
}
.card-action-btn:hover { transform: scale(1.06) translateY(-1px); }
.card-action-btn.add {
  color: #fff;
  background: linear-gradient(135deg, #34d399, #10b981);
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(16,185,129,.3);
}
.card-action-btn.add:hover { box-shadow: 0 4px 12px rgba(16,185,129,.4); }
.card-action-btn.deduct {
  color: #fff;
  background: linear-gradient(135deg, #f87171, #ef4444);
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(239,68,68,.3);
}
.card-action-btn.deduct:hover { box-shadow: 0 4px 12px rgba(239,68,68,.4); }
.card-action-btn.feed {
  color: #fff;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(249,115,22,.3);
}
.card-action-btn.feed:hover { box-shadow: 0 4px 12px rgba(249,115,22,.4); }
.card-action-btn.more {
  background: linear-gradient(135deg, rgba(124,58,237,.1), rgba(168,85,247,.1));
  color: var(--primary); border-color: rgba(124,58,237,.2);
  position: relative;
}
.card-action-btn.more:hover { background: var(--primary); color: #fff; }

/* ── 齿轮操作弹框菜单 ── */
.ca-more-wrap { position: relative; }

.card-action-menu {
  display: flex; flex-direction: column; gap: .3rem;
  padding: .25rem 0 .5rem;
}
.cam-item {
  display: flex; align-items: center; gap: .85rem;
  width: 100%; padding: .72rem 1.1rem;
  background: none; border: none; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
  transition: background .14s, transform .1s;
}
.cam-item:hover {
  background: rgba(124,58,237,.07);
  transform: translateX(3px);
}
.cam-item:hover .cam-label { color: var(--primary); }
.cam-icon {
  font-size: 1.35rem; width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); border-radius: 8px; flex-shrink: 0;
}
.cam-label {
  font-size: .9rem; font-weight: 600; color: var(--text);
  line-height: 1.2; transition: color .14s;
}
.cam-sub {
  font-size: .75rem; color: var(--text-muted); margin-top: .1rem;
}
.cam-item--danger .cam-icon { background: rgba(239,68,68,.1); }
.cam-item--danger .cam-label { color: var(--danger); }
.cam-item--danger:hover { background: rgba(239,68,68,.07); }
.cam-item--danger:hover .cam-label { color: #dc2626; }
.cam-item--disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.cam-divider {
  height: 1px; background: var(--border);
  margin: .3rem .8rem;
}

/* ── 颁发徽章 图标选择器 ── */
.medal-icon-picker {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .25rem;
}
.medal-icon-btn {
  width: 38px; height: 38px; font-size: 1.25rem;
  border-radius: 8px; border: 2px solid var(--border);
  background: var(--bg-card); cursor: pointer;
  transition: all .15s; display: flex; align-items: center; justify-content: center;
}
.medal-icon-btn:hover { border-color: var(--primary); transform: scale(1.1); }
.medal-icon-btn.selected {
  border-color: var(--primary);
  background: rgba(124,58,237,.15);
  box-shadow: 0 0 0 3px rgba(124,58,237,.25);
  transform: scale(1.12);
}
.medal-icon-btn.selected::after {
  content: '✓'; position: absolute;
  top: -5px; right: -5px;
  width: 14px; height: 14px;
  background: var(--primary); color: #fff;
  font-size: .55rem; font-weight: 900;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ── 删除徽章 列表 ── */
.del-medal-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  transition: background .12s;
}
.del-medal-row:hover { background: rgba(0,0,0,.03); }
.del-medal-icon { font-size: 1.6rem; flex-shrink: 0; }
.del-medal-info { flex: 1; min-width: 0; }
.del-medal-title { font-weight: 700; font-size: .88rem; }
.del-medal-date { font-size: .75rem; color: var(--text-muted); }
.btn-danger-sm {
  padding: .25rem .65rem; border-radius: 6px; font-size: .75rem; font-weight: 700;
  background: rgba(239,68,68,.12); color: var(--danger);
  border: 1px solid rgba(239,68,68,.25); cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-danger-sm:hover { background: rgba(239,68,68,.25); }

/* ── 兑换商品 ── */
.redeem-item-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-bottom: .45rem;
  transition: background .12s;
}
.redeem-item-row:hover { background: rgba(124,58,237,.04); }
.redeem-item-row--poor { opacity: .5; }
.redeem-item-icon { font-size: 1.8rem; flex-shrink: 0; }
.redeem-item-info { flex: 1; min-width: 0; }
.redeem-item-name { font-weight: 700; font-size: .9rem; }
.redeem-item-meta { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.btn-primary-sm {
  padding: .3rem .8rem; border-radius: 6px; font-size: .78rem; font-weight: 700;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn-primary-sm:hover { background: var(--primary-dark); transform: translateY(-1px); }
.redeem-filter-btn.active {
  background: rgba(124,58,237,.15) !important; color: var(--primary) !important;
  border-color: rgba(124,58,237,.3) !important;
}

/* ═══════════════════════════════════════════
   GROUPS
═══════════════════════════════════════════ */
.groups-list { display: flex; flex-direction: column; gap: 1rem; }
.group-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow-sm); border-left: 5px solid var(--primary);
  transition: transform var(--transition), box-shadow var(--transition);
}
.group-card:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.group-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .85rem;
}
.group-card-name {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: .95rem;
}
.group-color-dot { width: 14px; height: 14px; border-radius: 50%; }
.group-card-actions { display: flex; gap: .4rem; }
.group-members { display: flex; flex-wrap: wrap; gap: .4rem; }
.group-member-tag {
  background: #f4f4f8; border-radius: 20px;
  padding: .22rem .75rem; font-size: .82rem; color: var(--text);
  display: flex; align-items: center; gap: .3rem;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.group-member-tag:hover { border-color: var(--danger); }
.remove-from-group { color: var(--text-light); font-size: .72rem; cursor: pointer; transition: color var(--transition); }
.remove-from-group:hover { color: var(--danger); }

/* ── 添加成员多选界面 ── */
.am-toolbar {
  display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem;
}
.am-search-input {
  flex: 1; padding: .55rem .9rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); font-size: .9rem; outline: none;
  transition: border-color var(--transition);
}
.am-search-input:focus { border-color: var(--primary); }
.am-count {
  white-space: nowrap; font-size: .82rem; font-weight: 700;
  color: var(--primary); background: rgba(124,58,237,.1);
  border-radius: 20px; padding: .25rem .7rem;
}
.am-select-all-row {
  display: flex; gap: .5rem; margin-bottom: .6rem;
}
.am-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .5rem;
  max-height: 340px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem;
  background: var(--bg-soft);
}
.am-card {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .7rem; border-radius: var(--radius-sm);
  border: 2px solid transparent; background: #fff;
  cursor: pointer; user-select: none;
  transition: all var(--transition);
  position: relative;
}
.am-card:hover { border-color: var(--primary-light); background: rgba(124,58,237,.04); }
.am-card--selected {
  border-color: var(--primary);
  background: rgba(124,58,237,.08);
}
.am-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 800; color: transparent;
  background: #fff; flex-shrink: 0;
  transition: all var(--transition);
}
.am-card--selected .am-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.am-name { font-size: .88rem; font-weight: 600; line-height: 1.2; }
.am-no { font-size: .75rem; color: var(--text-muted); }
.am-cur-group {
  font-size: .65rem; color: #f97316;
  background: rgba(249,115,22,.1); border-radius: 10px;
  padding: .1rem .35rem; margin-left: auto; white-space: nowrap;
}

/* ═══════════════════════════════════════════
   RECORDS
═══════════════════════════════════════════ */
.records-filters { display: flex; gap: .5rem; }
.records-list { display: flex; flex-direction: column; gap: .55rem; }
.record-item {
  background: var(--bg-card); border-radius: var(--radius);
  padding: .85rem 1.15rem;
  box-shadow: var(--shadow-xs);
  display: flex; align-items: center; gap: 1rem;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.record-item:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); }
.record-type-badge {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; flex-shrink: 0;
}
.record-type-badge.add { background: linear-gradient(135deg,rgba(52,211,153,.2),rgba(16,185,129,.15)); }
.record-type-badge.deduct { background: linear-gradient(135deg,rgba(248,113,113,.2),rgba(239,68,68,.15)); }
.record-type-badge.feed { background: linear-gradient(135deg,rgba(251,191,36,.2),rgba(249,115,22,.15)); }
.record-info { flex: 1; min-width: 0; }
.record-name { font-weight: 700; font-size: .9rem; }
.record-reason { font-size: .8rem; color: var(--text-muted); }
.record-amount { font-size: 1rem; font-weight: 800; white-space: nowrap; }
.record-amount.add { color: var(--success); }
.record-amount.deduct { color: var(--danger); }
.record-amount.feed { color: var(--warning); }
.record-time { font-size: .72rem; color: var(--text-light); white-space: nowrap; }

/* ═══════════════════════════════════════════
   SHOP
═══════════════════════════════════════════ */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.shop-item-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 1.4rem 1.25rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  border: 1.5px solid var(--border);
  transition: transform var(--spring), box-shadow var(--transition);
  overflow: hidden; position: relative;
}
.shop-item-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--secondary), #f97316);
}
.shop-item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
/* ── 图标选择器 ── */
.shop-icon-grid {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem;
}
.shop-icon-pick {
  width: 42px; height: 42px; font-size: 1.35rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer; position: relative;
  transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center;
}
.shop-icon-pick:hover {
  border-color: var(--primary);
  transform: scale(1.12);
  background: rgba(124,58,237,.08);
}
.shop-icon-pick.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(109,40,217,.25));
  box-shadow: 0 0 0 3px rgba(124,58,237,.35), 0 3px 10px rgba(124,58,237,.3);
  transform: scale(1.15);
}
/* 选中时右上角打勾 */
.shop-icon-pick.selected::after {
  content: '✓';
  position: absolute; top: -6px; right: -6px;
  width: 16px; height: 16px;
  background: var(--primary); color: #fff;
  font-size: .6rem; font-weight: 900;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.shop-medal-badge {
  display: inline-block; margin-bottom: .6rem;
  font-size: .7rem; font-weight: 700;
  background: linear-gradient(135deg, #f59e0b22, #f97316 22);
  background: rgba(245,158,11,.12);
  color: #b45309; border: 1px solid rgba(245,158,11,.35);
  border-radius: 20px; padding: .15rem .6rem;
}
.shop-medal-toggle-label {
  font-size: .85rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: .45rem;
  user-select: none;
}
.shop-medal-toggle-label input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0;
  margin: 0; cursor: pointer;
  accent-color: var(--primary);
}
.shop-item-icon { font-size: 2.8rem; margin-bottom: .6rem; display: block; }
.shop-item-name { font-weight: 800; margin-bottom: .25rem; }
.shop-item-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: .85rem; }
.shop-item-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .75rem;
}
.shop-item-price {
  font-weight: 800; font-size: .95rem;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.shop-item-stock { font-size: .78rem; color: var(--text-muted); }
.shop-item-actions { display: flex; gap: .4rem; }
.shop-item-actions button { flex: 1; }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,10,30,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 500;
  backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius-xl);
  width: 500px; max-width: 95vw; max-height: 90vh;
  box-shadow: 0 32px 80px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.5);
  display: flex; flex-direction: column;
  animation: modalIn .2s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity:0; transform:scale(.93) translateY(14px); }
  to { opacity:1; transform:scale(1) translateY(0); }
}
.modal-box.wide { width: 680px; }
.modal-box.narrow { width: 390px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.35rem 1.6rem 1.1rem;
  background: linear-gradient(135deg, rgba(124,58,237,.04), rgba(168,85,247,.04));
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; color: var(--text-muted);
  transition: all var(--transition); background: transparent;
}
.modal-close:hover { background: rgba(239,68,68,.1); color: var(--danger); transform: rotate(90deg); }
.modal-body { padding: 1.35rem 1.6rem 1.6rem; overflow-y: auto; flex: 1; }
.modal-form { display: flex; flex-direction: column; gap: 1rem; }
.modal-form-row { display: flex; gap: .85rem; }
.modal-form-row .form-field { flex: 1; }
.modal-footer {
  display: flex; gap: .65rem; justify-content: flex-end;
  padding-top: 1rem; border-top: 1px solid var(--border); margin-top: 1rem;
}

/* ═══════════════════════════════════════════
   PET SELECTOR
═══════════════════════════════════════════ */
.pet-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: .55rem; max-height: 300px; overflow-y: auto; padding: .25rem;
}
.pet-selector-item {
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: .45rem; text-align: center; cursor: pointer;
  transition: all var(--spring);
  background: #fafafa;
}
.pet-selector-item:hover { border-color: var(--primary-light); transform: scale(1.06); background: rgba(124,58,237,.04); }
.pet-selector-item.selected {
  border-color: var(--primary); background: rgba(124,58,237,.08);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
  transform: scale(1.05);
}
.pet-selector-img { width: 48px; height: 48px; object-fit: contain; display: block; margin: 0 auto .3rem; }
.pet-selector-name { font-size: .68rem; color: var(--text-muted); font-weight: 500; }

/* ═══════════════════════════════════════════
   BIG SCREEN
═══════════════════════════════════════════ */
.fullscreen-overlay {
  position: fixed; inset: 0;
  display: none; z-index: 800; overflow: auto;
}
.fullscreen-overlay.open { display: flex; flex-direction: column; }
#big-screen {
  background: radial-gradient(ellipse at 30% 20%, #1a0845, #0d0527 60%);
  color: #fff;
}
/* star field effect */
#big-screen::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 15% 25%, rgba(255,255,255,.8) 0%, transparent 100%),
    radial-gradient(1px 1px at 72% 14%, rgba(255,255,255,.6) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 88% 60%, rgba(255,255,255,.7) 0%, transparent 100%),
    radial-gradient(1px 1px at 42% 75%, rgba(255,255,255,.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 5%  82%, rgba(255,255,255,.6) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 60% 40%, rgba(255,255,255,.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 93% 32%, rgba(255,255,255,.8) 0%, transparent 100%),
    radial-gradient(1px 1px at 28% 55%, rgba(255,255,255,.5) 0%, transparent 100%);
  pointer-events: none;
}
.bs-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2.5rem; flex-shrink: 0; position: relative; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.4), transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.bs-title-wrap { display: flex; align-items: center; gap: .85rem; }
.bs-logo { font-size: 2.2rem; filter: drop-shadow(0 0 12px rgba(168,85,247,.8)); }
.bs-class-name {
  font-size: 1.8rem; font-weight: 800;
  background: linear-gradient(135deg, #fff, #c4b5fd);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.bs-stats { display: flex; gap: 2.5rem; }
.bs-stat { text-align: center; }
.bs-stat-val { font-size: 1.6rem; font-weight: 800; color: #fcd34d; line-height: 1; }
.bs-stat-label { font-size: .72rem; color: rgba(255,255,255,.55); margin-top: .2rem; }
.bs-close {
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.85);
  padding: .45rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .85rem; border: 1px solid rgba(255,255,255,.2);
  transition: all var(--transition); backdrop-filter: blur(8px);
}
.bs-close:hover { background: rgba(255,255,255,.2); color: #fff; }

.bs-podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 1.75rem; padding: 1.25rem 2.5rem;
  flex-shrink: 0; position: relative; z-index: 1;
}
.bs-podium-item { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.bs-podium-pet {
  width: 86px; height: 86px; object-fit: contain;
  animation: petFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 16px rgba(253,224,71,.6));
}
.bs-podium-name { font-size: .95rem; font-weight: 700; color: rgba(255,255,255,.95); }
.bs-podium-score { font-size: 1.25rem; font-weight: 800; color: #fcd34d; }
.bs-podium-rank {
  width: 84px; background: rgba(255,255,255,.08);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800;
  border-top: 2px solid rgba(255,255,255,.15);
}
.bs-podium-item:nth-child(1) .bs-podium-rank { height: 75px; background: rgba(253,224,71,.18); border-color: rgba(253,224,71,.4); }
.bs-podium-item:nth-child(2) .bs-podium-rank { height: 100px; background: rgba(253,224,71,.25); border-color: rgba(253,224,71,.5); }
.bs-podium-item:nth-child(3) .bs-podium-rank { height: 55px; background: rgba(253,224,71,.14); border-color: rgba(253,224,71,.3); }

.bs-cards {
  flex: 1; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 1rem; padding: 1rem 2.5rem 2.5rem;
  overflow-y: auto; position: relative; z-index: 1;
}
.bs-card {
  background: rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: .85rem;
  text-align: center;
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  transition: transform var(--spring), background var(--transition);
}
.bs-card:hover { transform: scale(1.04); background: rgba(255,255,255,.12); }
.bs-card-pet { width: 60px; height: 60px; object-fit: contain; animation: petFloat 3s ease-in-out infinite; margin-bottom: .4rem; }
.bs-card-name { font-size: .9rem; font-weight: 700; color: rgba(255,255,255,.95); }
.bs-card-score { font-size: .95rem; color: #fcd34d; font-weight: 800; }
.bs-card-level { font-size: .7rem; color: rgba(255,255,255,.5); }

/* ═══════════════════════════════════════════
   ROLL CALL
═══════════════════════════════════════════ */
.rc-overlay {
  background: radial-gradient(ellipse at center, #1a0533 0%, #0a011a 70%);
  align-items: center; justify-content: center;
}
.rc-content { text-align: center; padding: 2rem 1rem; }
.rc-title {
  font-size: 2.2rem; font-weight: 800; color: #fff;
  margin-bottom: 2.5rem;
  background: linear-gradient(135deg, #c4b5fd, #f9a8d4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: none;
}
.rc-drum {
  width: 230px; height: 230px; margin: 0 auto 2.5rem;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  border: 2px solid rgba(168,85,247,.4);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 0 0 8px rgba(168,85,247,.08), 0 0 0 16px rgba(168,85,247,.04),
              0 0 80px rgba(168,85,247,.3);
}
.rc-drum::before {
  content: ''; position: absolute; inset: -10px;
  border-radius: 50%; border: 1px dashed rgba(168,85,247,.25);
  animation: drumRotate 12s linear infinite;
}
@keyframes drumRotate { to { transform: rotate(360deg); } }
.rc-pet-wrap { text-align: center; }
.rc-pet-img {
  width: 120px; height: 120px; object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(168,85,247,.9));
}
.rc-name {
  font-size: 1.5rem; font-weight: 800; color: #fff;
  margin-top: .6rem;
  text-shadow: 0 0 24px rgba(255,255,255,.5);
}
.rc-drum.spinning .rc-pet-wrap { animation: rcSpin .08s linear infinite; }
@keyframes rcSpin {
  0% { transform: scale(.95) rotate(-3deg); opacity: .7; }
  50% { transform: scale(1.06) rotate(3deg); opacity: 1; }
  100% { transform: scale(.95) rotate(-3deg); opacity: .7; }
}
.rc-actions { display: flex; gap: 1rem; justify-content: center; }
.rc-result {
  margin-top: 1.75rem; font-size: 1.25rem; color: #fcd34d;
  font-weight: 700; min-height: 2rem; letter-spacing: .02em;
}

/* ═══════════════════════════════════════════
   REMOTE SCORE
═══════════════════════════════════════════ */
.rs-overlay {
  background: rgba(10,5,25,.95);
  backdrop-filter: blur(12px);
  align-items: flex-start; justify-content: center;
}
.rs-content { width: 100%; max-width: 920px; margin: 2.5rem auto; padding: 0 1.25rem; }
.rs-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem; color: #fff;
}
.rs-header h2 {
  font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, #c4b5fd, #f9a8d4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.rs-body { display: flex; gap: 1.5rem; }
.rs-left { flex: 1; min-width: 0; }
.rs-right { width: 310px; flex-shrink: 0; display: flex; flex-direction: column; }
.rs-hint { color: rgba(255,255,255,.5); font-size: .875rem; margin-bottom: .85rem; }
.rs-student-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .5rem; max-height: 70vh; overflow-y: auto;
}
.rs-student-btn {
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: .7rem .5rem;
  color: #fff; text-align: center; cursor: pointer;
  transition: all var(--transition);
}
.rs-student-btn:hover {
  border-color: rgba(168,85,247,.6);
  background: rgba(124,58,237,.25); transform: scale(1.04);
}
.rs-student-btn .rs-btn-name { font-size: .875rem; font-weight: 700; }
.rs-student-btn .rs-btn-score { font-size: .72rem; color: rgba(255,255,255,.5); margin-top: .1rem; }
/* Header hint */
.rs-header-left { display: flex; flex-direction: column; gap: .25rem; }
.rs-header-hint { font-size: .8rem; color: rgba(255,255,255,.5); }

/* Student btn staged state */
.rs-student-btn--staged {
  border-color: rgba(253,224,71,.7) !important;
  background: rgba(253,224,71,.15) !important;
  position: relative;
}
.rs-staged-badge {
  position: absolute; top: -8px; right: -8px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff; font-size: .7rem; font-weight: 800;
  padding: .1rem .4rem; border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  white-space: nowrap;
}

.rs-control {
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-lg); padding: 1.1rem;
  color: #fff; border: 1px solid rgba(255,255,255,.1);
  margin-bottom: .85rem;
}
.rs-control label { font-size: .82rem; color: rgba(255,255,255,.6); display: block; margin-bottom: .5rem; font-weight: 600; }
.rs-score-btns { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.rs-score-btn {
  padding: .42rem .75rem; border-radius: var(--radius-sm);
  background: rgba(124,58,237,.25); border: 1.5px solid rgba(124,58,237,.4);
  color: #fff; font-weight: 700; transition: all var(--transition);
}
.rs-score-btn:hover, .rs-score-btn.active {
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(124,58,237,.4);
}
.rs-score-btn.danger { background: rgba(239,68,68,.25); border-color: rgba(239,68,68,.4); }
.rs-score-btn.danger:hover, .rs-score-btn.danger.active {
  background: var(--danger); border-color: var(--danger);
}
.rs-control .form-input {
  background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff;
}

/* ── Pending box ── */
.rs-pending-box {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.rs-pending-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem .9rem;
  background: rgba(255,255,255,.05);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.rs-pending-title { font-size: .8rem; font-weight: 700; color: rgba(255,255,255,.7); flex: 1; }
.rs-pending-count {
  font-size: .75rem; background: rgba(124,58,237,.4);
  color: #e9d5ff; border-radius: 20px; padding: .05rem .5rem;
}
.rs-pending-clear {
  font-size: .72rem; color: rgba(255,255,255,.4);
  background: none; border: none; cursor: pointer;
  padding: .1rem .35rem; border-radius: 4px;
  transition: all .15s;
}
.rs-pending-clear:hover { color: #fff; background: rgba(239,68,68,.3); }
.rs-pending-list {
  min-height: 60px; max-height: 220px; overflow-y: auto;
  padding: .45rem .5rem;
}
.rs-pending-empty { font-size: .78rem; color: rgba(255,255,255,.3); text-align: center; padding: .75rem 0; }
.rs-pending-item {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .45rem; border-radius: var(--radius-sm);
  transition: background .15s;
}
.rs-pending-item:hover { background: rgba(255,255,255,.05); }
.rs-pending-name { flex: 1; font-size: .82rem; color: rgba(255,255,255,.85); }
.rs-pending-val { font-size: .82rem; font-weight: 800; min-width: 30px; text-align: right; }
.rs-pending-val.add { color: #4ade80; }
.rs-pending-val.deduct { color: #f87171; }
.rs-pending-remove {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.3); font-size: .75rem; padding: 0 .2rem;
  border-radius: 3px; transition: all .15s;
}
.rs-pending-remove:hover { color: #f87171; background: rgba(239,68,68,.2); }

/* ── Confirm button ── */
.rs-confirm-btn {
  margin: .6rem .6rem .6rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border: none; color: #fff;
  font-size: .92rem; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  transition: all .2s; box-shadow: 0 4px 15px rgba(124,58,237,.4);
}
.rs-confirm-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124,58,237,.5);
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.rs-confirm-btn:active:not(:disabled) { transform: translateY(0); }
.rs-confirm-btn:disabled {
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.35);
  cursor: not-allowed; box-shadow: none;
}
.rs-confirm-btn--deduct {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 4px 15px rgba(220,38,38,.4);
}
.rs-confirm-btn--deduct:hover:not(:disabled) {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 25px rgba(220,38,38,.5);
}
.rs-confirm-icon { font-size: 1rem; }

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast-container {
  position: fixed; top: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column;
  gap: .5rem; pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: .85rem 1.2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 1px 0 rgba(255,255,255,.6);
  display: flex; align-items: center; gap: .65rem;
  font-size: .88rem; font-weight: 500;
  min-width: 230px;
  animation: toastIn .28s var(--spring);
  pointer-events: auto;
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { font-size: 1.1rem; }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity:0; transform:translateX(32px) scale(.95); } to { opacity:1; transform:translateX(0) scale(1); } }
@keyframes toastOut { to { opacity:0; transform:translateX(32px) scale(.95); } }

/* ═══════════════════════════════════════════
   LEVEL SETTINGS
═══════════════════════════════════════════ */
.level-settings-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.level-settings-table th, .level-settings-table td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
.level-settings-table th { font-weight: 700; background: #f9f9fc; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.level-settings-table tbody tr:hover { background: rgba(124,58,237,.03); }
.level-settings-table input { width: 90px; padding: .32rem .55rem; font-size: .875rem; }
.level-settings-table select { padding: .32rem .55rem; font-size: .875rem; }

/* ═══════════════════════════════════════════
   DATA CENTER
═══════════════════════════════════════════ */
.data-center-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.dc-stat-card {
  border-radius: var(--radius); padding: 1.4rem; text-align: center;
  color: #fff; position: relative; overflow: hidden;
}
.dc-stat-card::after { content:''; position:absolute; inset:0; background:linear-gradient(135deg,rgba(255,255,255,.1),transparent); }
.dc-stat-card:nth-child(1) { background: linear-gradient(135deg, #7c3aed, #5b21b6); box-shadow: 0 4px 16px rgba(124,58,237,.3); }
.dc-stat-card:nth-child(2) { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 16px rgba(16,185,129,.3); }
.dc-stat-card:nth-child(3) { background: linear-gradient(135deg, #f97316, #ea580c); box-shadow: 0 4px 16px rgba(249,115,22,.3); }
.dc-stat-card:nth-child(4) { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 4px 16px rgba(59,130,246,.3); }
.dc-stat-val { font-size: 2.2rem; font-weight: 800; line-height: 1; position: relative; z-index: 1; }
.dc-stat-label { font-size: .78rem; opacity: .82; margin-top: .3rem; position: relative; z-index: 1; }
.dc-top-item {
  display: flex; align-items: center; gap: .85rem;
  padding: .65rem .75rem; border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.dc-top-item:hover { background: rgba(124,58,237,.05); }
.dc-top-rank { width: 26px; text-align: center; font-weight: 800; color: var(--text-muted); font-size: .9rem; }
.dc-top-rank.gold { color: #f59e0b; }
.dc-top-rank.silver { color: #6b7280; }
.dc-top-rank.bronze { color: #d97706; }
.dc-top-img { width: 38px; height: 38px; object-fit: contain; }
.dc-top-info { flex: 1; min-width: 0; }
.dc-top-name { font-weight: 700; font-size: .9rem; }
.dc-top-score { font-size: .78rem; color: var(--text-muted); }
.dc-top-bar-wrap { flex: 1; }
.dc-top-bar { height: 7px; background: #f0f0f8; border-radius: 4px; overflow: hidden; }
.dc-top-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; }

/* ═══════════════════════════════════════════
   MEDAL WALL & BADGES
═══════════════════════════════════════════ */
.medal-wall { display: flex; flex-direction: column; gap: .65rem; }
.medal-item {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1rem; background: linear-gradient(135deg, #fafafa, #f5f3ff);
  border-radius: var(--radius-sm); border: 1px solid rgba(124,58,237,.1);
  transition: transform var(--transition);
}
.medal-item:hover { transform: translateX(3px); }
.medal-icon { font-size: 1.9rem; }
.medal-info { flex: 1; }
.medal-title { font-weight: 700; font-size: .9rem; }
.medal-date { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }
.medal-delete { color: var(--text-light); padding: .25rem; border-radius: 50%; transition: all var(--transition); }
.medal-delete:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.add-medal-form { display: flex; gap: .5rem; margin-top: 1rem; }
.add-medal-form input { flex: 1; }
.badges-grid { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.badge-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(168,85,247,.08));
  border: 1px solid rgba(124,58,237,.2);
  border-radius: 20px; padding: .28rem .85rem;
  font-size: .82rem; font-weight: 700; color: var(--primary);
  transition: all var(--transition);
}
.badge-chip:hover { background: rgba(124,58,237,.18); transform: scale(1.04); }
.badge-chip .remove-badge { cursor: pointer; opacity: .6; font-size: .78rem; transition: opacity var(--transition); }
.badge-chip .remove-badge:hover { opacity: 1; }
.add-badge-form { display: flex; gap: .5rem; }
.add-badge-form input { flex: 1; }

/* ═══════════════════════════════════════════
   SCORE INPUT
═══════════════════════════════════════════ */
.score-quick-btns { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .85rem; }
.score-quick-btn {
  padding: .32rem .75rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); font-size: .85rem; font-weight: 700;
  transition: all var(--transition); background: #fafafa;
}
.score-quick-btn.add-q { color: var(--success); border-color: rgba(16,185,129,.4); }
.score-quick-btn.add-q:hover { background: var(--success); color: #fff; border-color: var(--success); transform: scale(1.06); }
.score-quick-btn.deduct-q { color: var(--danger); border-color: rgba(239,68,68,.4); }
.score-quick-btn.deduct-q:hover { background: var(--danger); color: #fff; border-color: var(--danger); transform: scale(1.06); }

/* ═══════════════════════════════════════════
   BATCH ADD - TABS
═══════════════════════════════════════════ */
.batch-tabs {
  display: flex; gap: .4rem; margin-bottom: 1rem;
  background: #f4f4f8; border-radius: var(--radius); padding: .3rem;
}
.batch-tab {
  flex: 1; padding: .5rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .875rem; color: var(--text-muted);
  transition: all var(--transition);
}
.batch-tab.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,.1), 0 0 0 1px rgba(124,58,237,.1);
}
.btab-content { display: none; }
.btab-content.active { display: block; }

/* Excel upload */
.excel-upload-area {
  border: 2px dashed rgba(124,58,237,.3);
  border-radius: var(--radius);
  padding: 2rem 1.5rem; text-align: center;
  transition: all var(--transition); cursor: pointer;
  background: linear-gradient(135deg, rgba(124,58,237,.03), rgba(168,85,247,.03));
  margin-bottom: .85rem;
}
.excel-upload-area:hover, .excel-upload-area.drag-over {
  border-color: var(--primary); background: rgba(124,58,237,.07);
  transform: scale(1.01);
}
.excel-upload-icon { font-size: 2.8rem; margin-bottom: .6rem; }
.excel-upload-area p { color: var(--text-muted); font-size: .875rem; margin-bottom: .2rem; }
.batch-template-hint {
  display: flex; align-items: center; gap: .85rem;
  padding: .65rem .9rem;
  background: linear-gradient(135deg, rgba(245,158,11,.07), rgba(249,115,22,.05));
  border-radius: var(--radius-sm); border-left: 3px solid var(--secondary);
}
.tpl-hint-text { font-size: .8rem; color: var(--text-muted); }

/* Import guide */
.import-guide {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: .85rem; overflow: hidden;
}
.import-guide-header {
  display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem;
  background: #f9f9fc; cursor: pointer; font-size: .875rem;
  font-weight: 700; color: var(--text-muted);
}
.import-guide-icon { font-size: 1rem; }
.guide-toggle {
  margin-left: auto; font-size: .78rem; color: var(--primary);
  font-weight: 600; padding: .15rem .5rem; border-radius: 4px;
  transition: background var(--transition);
}
.guide-toggle:hover { background: rgba(124,58,237,.1); }
.import-guide-body { padding: .9rem; border-top: 1px solid var(--border); }
.import-table-wrap { overflow-x: auto; margin-bottom: .75rem; }
.import-example-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.import-example-table th, .import-example-table td {
  padding: .42rem .8rem; text-align: left; border: 1px solid var(--border);
}
.import-example-table th {
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(168,85,247,.06));
  font-weight: 700; white-space: nowrap;
}
.import-example-table tbody tr:nth-child(odd) { background: #fafafa; }
.col-required {
  background: rgba(239,68,68,.1); color: var(--danger);
  font-size: .65rem; padding: .05rem .35rem; border-radius: 10px;
  font-weight: 700; margin-left: .25rem;
}
.col-optional {
  background: rgba(16,185,129,.1); color: var(--success);
  font-size: .65rem; padding: .05rem .35rem; border-radius: 10px;
  font-weight: 700; margin-left: .25rem;
}
.import-tips {
  display: flex; flex-direction: column; gap: .3rem;
  margin-bottom: .75rem; padding: .65rem .9rem;
  background: rgba(59,130,246,.06); border-radius: var(--radius-sm);
  border-left: 3px solid var(--info);
}
.import-tips p { font-size: .82rem; }
.pet-ref-section { margin-top: .35rem; }
.pet-ref-title { font-size: .8rem; color: var(--text-muted); margin-bottom: .45rem; font-weight: 700; }
.pet-ref-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.pet-ref-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .55rem; border-radius: 20px;
  background: rgba(124,58,237,.07); border: 1px solid rgba(124,58,237,.18);
  font-size: .76rem; font-weight: 700; color: var(--primary);
  cursor: default; transition: all var(--transition); user-select: all;
}
.pet-ref-tag:hover { background: rgba(124,58,237,.14); transform: scale(1.06); }
.pet-ref-tag em { font-style: normal; color: var(--text-muted); font-weight: 400; font-size: .7rem; }

/* Text tab */
.text-import-guide { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .85rem; }
@media (max-width: 540px) { .text-import-guide { grid-template-columns: 1fr; } }
.text-format-box, .text-example-box {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .85rem; background: #fafafa;
}
.text-format-title { font-weight: 700; font-size: .82rem; color: var(--text-muted); margin-bottom: .5rem; }
.text-format-rule { font-size: .82rem; margin-bottom: .4rem; }
.text-format-tmpl {
  display: block; background: rgba(124,58,237,.07);
  border: 1px dashed rgba(124,58,237,.3); border-radius: 4px;
  padding: .38rem .65rem; font-size: .8rem; color: var(--primary-dark); word-break: break-all;
}
.text-example-pre {
  background: #1a1a2e; color: #a5f3fc;
  border-radius: var(--radius-sm); padding: .65rem .85rem;
  font-size: .82rem; line-height: 1.75; margin-bottom: .4rem; overflow-x: auto;
  font-family: "JetBrains Mono","Fira Code","Consolas",monospace;
}
.text-example-note { font-size: .72rem; color: var(--text-muted); }

/* Batch textarea */
.batch-textarea {
  width: 100%; min-height: 140px; padding: .8rem;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  font-family: "JetBrains Mono","Fira Code","Consolas",monospace;
  font-size: .9rem; resize: vertical; line-height: 1.65;
}
.batch-textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3.5px rgba(124,58,237,.12); }

/* Preview list */
.batch-preview-list { max-height: 220px; overflow-y: auto; margin-top: .85rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); overflow: hidden; }
.batch-preview-list:empty { border: none; }
.batch-preview-item { display: flex; align-items: center; gap: .65rem; padding: .48rem .8rem; font-size: .875rem; }
.batch-preview-item:nth-child(odd) { background: #fafafa; }
.batch-preview-item .bpi-pet { width: 28px; height: 28px; object-fit: contain; }

/* ═══════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

/* ═══════════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: .5rem; }

.color-picker-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform var(--spring);
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 3px var(--primary), 0 2px 8px rgba(0,0,0,.2); }

.info-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .55rem 0; border-bottom: 1px solid #f4f4f8;
}
.info-row:last-child { border-bottom: none; }
.info-row label { width: 80px; color: var(--text-muted); font-size: .85rem; flex-shrink: 0; font-weight: 500; }
.info-row span { font-weight: 700; }

/* Level up flash */
@keyframes levelUp {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); filter: brightness(1.4) drop-shadow(0 0 12px rgba(253,224,71,.8)); }
  100% { transform: scale(1); }
}
.level-up-flash { animation: levelUp .7s cubic-bezier(.34,1.56,.64,1); }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .class-header { gap: .6rem; }
  .class-nav { gap: .25rem; }
  .nav-btn { padding: .32rem .55rem; font-size: .75rem; }
  .students-grid { grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); }
  .bs-cards { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .bs-podium { gap: .75rem; }
  .rs-body { flex-direction: column; }
  .rs-right { width: 100%; }
  .class-content { padding: .85rem 1rem; }
  .class-tabs { padding: 0 1rem; top: 56px; }
}
@media (max-width: 480px) {
  .dashboard-body { padding: 1.25rem 1rem; }
  .data-center-grid { grid-template-columns: 1fr; }
  .modal-box { border-radius: var(--radius-lg); }
}
