/* ============================================================
   style.css - Giao diện hệ thống Tư vấn Hướng nghiệp
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS Variables / Design Tokens
   ============================================================ */
:root {
  --mau-chinh:     #4F46E5;
  --mau-chinh-dam: #3730A3;
  --mau-chinh-nhat:#EEF2FF;
  --mau-phu:       #7C3AED;
  --mau-xanh:      #0EA5E9;
  --mau-do:        #EF4444;
  --mau-cam:       #F59E0B;
  --mau-xanhla:    #10B981;

  --bg-chinh:      #F8FAFC;
  --bg-trang:      #FFFFFF;
  --bg-xam:        #F1F5F9;

  --vien:          #E2E8F0;
  --vien-dam:      #CBD5E1;

  --chu-dam:       #0F172A;
  --chu-vua:       #334155;
  --chu-nhat:      #64748B;
  --chu-mo:        #94A3B8;

  --bong:          0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --bong-vua:      0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
  --bong-lon:      0 10px 25px -5px rgba(79,70,229,.12), 0 6px 10px -5px rgba(79,70,229,.06);

  --bo-goc:        12px;
  --bo-goc-lon:    20px;
  --bo-goc-xl:     28px;

  --chuyen-tiep:   all .2s ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scrollbar-gutter: stable; overflow-x: hidden; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-chinh);
  color: var(--chu-dam);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: 90px; /* header(62px) + ticker(28px) */
  overflow-x: hidden;
}
a { color: var(--mau-chinh); text-decoration: none; transition: var(--chuyen-tiep); }
a:hover { color: var(--mau-chinh-dam); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ============================================================
   Header Dashboard (mới)
   ============================================================ */
.dash-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 45%, #1d4ed8 100%);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 4px 24px rgba(55,48,163,.45);
}

.dash-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 62px;
  gap: 20px;
  overflow: hidden; /* Ngăn tràn ngang */
  min-width: 0;
}

/* Logo */
.dash-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;         /* Chiếm phần còn lại, co được */
  min-width: 0;    /* Cho phép overflow:hidden con hoạt động */
  overflow: hidden;
}
.dash-logo-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,220,0,.6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 12px rgba(255,220,0,.3);
}
.dash-logo-ten {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .01em;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-logo-mo-ta {
  font-size: .72rem;
  color: rgba(255,255,255,.65);
  font-weight: 400;
  letter-spacing: .03em;
}


/* Ticker */
.dash-ticker {
  position: fixed;
  top: 62px;
  left: 0;
  width: 100%;
  z-index: 999;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg,#059669,#10B981);
  height: 28px;
  overflow: hidden;
}
.dash-ticker-label {
  padding: 0 14px;
  font-size: .67rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.3);
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
}
.dash-ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.dash-ticker-content {
  display: inline-block;
  white-space: nowrap;
  font-size: .72rem;
  color: rgba(255,255,255,.95);
  padding-left: 100%;
  animation: ticker-scroll 35s linear infinite;
  font-weight: 500;
}
.dash-ticker-content:hover { animation-play-state: paused; }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Navigation buttons */
.dash-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0; /* Nav không bị co */
}
.dash-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: .83rem;
  font-weight: 600;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  transition: all .2s ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.dash-nav-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.2);
}
.dash-nav-btn.active {
  background: rgba(255,255,255,.18);
  color: #FFE066;
  border-color: rgba(255,220,0,.4);
}
/* Nút Trang Chủ */
.dash-btn-trangchu {
  background: #F59E0B;
  color: #fff;
  border-color: #F59E0B;
  box-shadow: 0 3px 10px rgba(245,158,11,.4);
}
.dash-btn-trangchu:hover {
  background: #D97706;
  border-color: #D97706;
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,.55);
  filter: brightness(1.08);
}
.dash-btn-trangchu.active {
  background: #FBBF24;
  border-color: #F59E0B;
  color: #fff;
  box-shadow: 0 4px 16px rgba(245,158,11,.5);
}
/* Nút Đăng nhập */
.dash-btn-dangnhap {
  background: #F59E0B;
  color: #fff;
  border-color: #F59E0B;
  box-shadow: 0 3px 10px rgba(245,158,11,.4);
}
.dash-btn-dangnhap:hover {
  background: #D97706;
  border-color: #D97706;
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,.55);
  filter: brightness(1.08);
}
/* Nút Quản Trị */
.dash-btn-quantri {
  background: #10B981;
  color: #fff;
  border-color: #10B981;
  box-shadow: 0 3px 10px rgba(16,185,129,.4);
}
.dash-btn-quantri:hover {
  background: #059669;
  border-color: #059669;
  color: #fff;
  box-shadow: 0 4px 14px rgba(16,185,129,.55);
  filter: brightness(1.08);
}
/* Nút Đăng xuất */
.dash-btn-dangxuat {
  background: #EF4444;
  color: #fff;
  border-color: #EF4444;
  box-shadow: 0 3px 10px rgba(239,68,68,.35);
}
.dash-btn-dangxuat:hover {
  background: #DC2626;
  border-color: #DC2626;
  color: #fff;
  box-shadow: 0 4px 14px rgba(239,68,68,.5);
  filter: brightness(1.08);
}
/* Nút cài đặt PWA trên header */
.pwa-header-install-btn {
  background: linear-gradient(135deg, #059669, #10B981) !important;
  color: #fff !important;
  border-color: #10B981 !important;
  box-shadow: 0 3px 10px rgba(16,185,129,.4) !important;
  position: relative;
  overflow: hidden;
  animation: pwa-pulse-glow 2.5s ease-in-out infinite;
}
.pwa-header-install-btn:hover {
  background: linear-gradient(135deg, #047857, #059669) !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(16,185,129,.55) !important;
}
@keyframes pwa-pulse-glow {
  0%,100% { box-shadow: 0 3px 10px rgba(16,185,129,.4); }
  50% { box-shadow: 0 3px 18px rgba(16,185,129,.75), 0 0 0 3px rgba(16,185,129,.15); }
}

/* Badge tên admin */
.dash-nav-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 7px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  color: #FFE066;
}
.dash-nav-dot {
  width: 7px; height: 7px;
  background: #10B981;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Header cũ (giữ lại cho tương thích) */
.header {
  background: var(--bg-trang);
  border-bottom: 1px solid var(--vien);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--vien);
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--mau-chinh), var(--mau-phu));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(79,70,229,.3);
  flex-shrink: 0;
}
.header-ten { font-weight: 700; font-size: 1rem; color: var(--chu-dam); }
.header-phu { font-size: 11px; color: var(--chu-mo); font-weight: 500; letter-spacing: .04em; }
.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--chu-vua);
  transition: var(--chuyen-tiep);
}
.header-nav a:hover, .header-nav a.active {
  background: var(--mau-chinh-nhat);
  color: var(--mau-chinh);
}

/* ============================================================
   Layout / Container
   ============================================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}
.trang-chinh { padding: 40px 0 80px; }
.trang-chinh-lon { padding: 32px 0 80px; }

/* ============================================================
   Hero / Search Section
   ============================================================ */
.hero {
  text-align: center;
  padding: 48px 20px 40px;
  background: linear-gradient(135deg, var(--mau-chinh-nhat) 0%, #F5F3FF 100%);
  border-bottom: 1px solid var(--vien);
  margin-bottom: 40px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px;
  background: white;
  border: 1px solid var(--vien-dam);
  border-radius: 99px;
  font-size: 12px; font-weight: 600;
  color: var(--mau-chinh);
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--chu-dam);
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -.02em;
}
.hero h1 span { color: var(--mau-chinh); }
.hero-desc {
  font-size: 1rem; color: var(--chu-nhat);
  max-width: 520px; margin: 0 auto 32px;
}

/* Search box */
.search-wrap {
  max-width: 640px; margin: 0 auto;
  position: relative;
}
.search-input {
  width: 100%;
  padding: 16px 56px 16px 52px;
  border: 2px solid var(--vien-dam);
  border-radius: var(--bo-goc-xl);
  font-size: 1rem;
  font-family: inherit;
  background: white;
  color: var(--chu-dam);
  outline: none;
  transition: var(--chuyen-tiep);
  box-shadow: var(--bong-vua);
}
.search-input:focus {
  border-color: var(--mau-chinh);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12), var(--bong-vua);
}
.search-input::placeholder { color: var(--chu-mo); }
.search-icon {
  position: absolute; left: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--chu-mo); font-size: 20px;
  pointer-events: none; transition: var(--chuyen-tiep);
}
.search-wrap:focus-within .search-icon { color: var(--mau-chinh); }
.search-clear {
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  background: var(--bg-xam); border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; color: var(--chu-nhat);
  font-size: 14px; transition: var(--chuyen-tiep);
}
.search-clear:hover { background: var(--vien-dam); color: var(--chu-dam); }
.search-input:not(:placeholder-shown) ~ .search-clear { display: flex; }

/* Dropdown gợi ý */
.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: white;
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc-lon);
  box-shadow: 0 20px 40px rgba(0,0,0,.12);
  overflow: hidden;
  z-index: 90;
  display: none;
}
.search-dropdown.hien { display: block; animation: truotXuong .15s ease; }
@keyframes truotXuong { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

.ket-qua-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  cursor: pointer; transition: var(--chuyen-tiep);
  border-bottom: 1px solid var(--bg-xam);
  text-decoration: none; color: inherit;
}
.ket-qua-item:last-child { border-bottom: none; }
.ket-qua-item:hover { background: var(--mau-chinh-nhat); }

.ket-qua-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--mau-chinh), var(--mau-phu));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; flex-shrink: 0;
}
.ket-qua-ten { font-weight: 600; font-size: .9rem; color: var(--chu-dam); }
.ket-qua-phu { font-size: .78rem; color: var(--chu-mo); }
.ket-qua-mui-ten { margin-left: auto; color: var(--chu-mo); font-size: 14px; }

.tim-khong-thay {
  padding: 24px; text-align: center;
  color: var(--chu-mo); font-size: .9rem;
}
.dang-tim {
  padding: 16px; text-align: center;
  color: var(--mau-chinh); font-size: .9rem;
}

/* ============================================================
   Thống kê
   ============================================================ */
.thong-ke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.thong-ke-card {
  background: white;
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc-lon);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--bong);
  transition: var(--chuyen-tiep);
}
.thong-ke-card:hover { transform: translateY(-2px); box-shadow: var(--bong-lon); }
.thong-ke-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.thong-ke-icon.xanh { background: #EFF6FF; }
.thong-ke-icon.tim  { background: var(--mau-chinh-nhat); }
.thong-ke-icon.xanhla { background: #ECFDF5; }
.thong-ke-icon.vang { background: #FFFBEB; }
.thong-ke-so { font-size: 1.6rem; font-weight: 800; color: var(--chu-dam); line-height: 1; }
.thong-ke-nhan { font-size: .8rem; color: var(--chu-mo); font-weight: 500; margin-top: 2px; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: white;
  border: 1px solid var(--vien);
  border-radius: var(--bo-goc-xl);
  padding: 28px;
  box-shadow: var(--bong);
}
.card-tieu-de {
  font-size: 1rem; font-weight: 700;
  color: var(--chu-dam);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bg-xam);
}
.card-tieu-de .icon {
  color: var(--mau-chinh);
  font-size: 18px;
}

/* ============================================================
   Trang chi tiết học sinh
   ============================================================ */
.hocsinh-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 768px) {
  .hocsinh-grid { grid-template-columns: 1fr; }
}

.hocsinh-avatar-wrap {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px;
}
.hocsinh-avatar {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--mau-chinh), var(--mau-phu));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 28px;
  box-shadow: 0 6px 16px rgba(79,70,229,.3);
  flex-shrink: 0;
}
.hocsinh-ten { font-size: 1.25rem; font-weight: 700; color: var(--chu-dam); }
.hocsinh-sbd { font-size: .85rem; color: var(--chu-mo); font-weight: 500; }

.thong-tin-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-xam);
  font-size: .9rem;
}
.thong-tin-item:last-child { border-bottom: none; }
.thong-tin-icon { color: var(--mau-chinh); font-size: 16px; flex-shrink: 0; }
.thong-tin-nhan { color: var(--chu-mo); width: 90px; flex-shrink: 0; }
.thong-tin-gia-tri { font-weight: 600; color: var(--chu-dam); }

/* Progress bar điểm số */
.diem-item { margin-bottom: 14px; }
.diem-item:last-child { margin-bottom: 0; }
.diem-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.diem-mon { font-size: .85rem; font-weight: 600; color: var(--chu-vua); }
.diem-so {
  font-size: 1rem; font-weight: 800;
}
.diem-so.tot    { color: var(--mau-xanhla); }
.diem-so.kha    { color: var(--mau-chinh); }
.diem-so.trungbinh { color: var(--mau-cam); }
.diem-so.yeu    { color: var(--mau-do); }

.progress-track {
  height: 8px;
  background: var(--bg-xam);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.progress-fill.tot    { background: linear-gradient(90deg, #34D399, #10B981); }
.progress-fill.kha    { background: linear-gradient(90deg, #818CF8, #4F46E5); }
.progress-fill.trungbinh { background: linear-gradient(90deg, #FCD34D, #F59E0B); }
.progress-fill.yeu    { background: linear-gradient(90deg, #FCA5A5, #EF4444); }

/* ============================================================
   AI Tư vấn
   ============================================================ */
.tuvan-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: #FBBF24; /* Vàng đậm */
  border-radius: 12px;
  border-bottom: 2px solid #D97706;
}
.tuvan-badge {
  padding: 3px 10px;
  background: linear-gradient(135deg, var(--mau-chinh), var(--mau-phu));
  color: white;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
}
.spinner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 0; gap: 16px;
  color: var(--chu-mo);
}
.spinner-vong {
  width: 44px; height: 44px;
  border: 3px solid var(--mau-chinh-nhat);
  border-top-color: var(--mau-chinh);
  border-radius: 50%;
  animation: xoay .8s linear infinite;
}
@keyframes xoay { to { transform: rotate(360deg); } }
.spinner-text { font-size: .9rem; font-weight: 500; animation: nhayDan 1.5s ease infinite; }
@keyframes nhayDan { 0%,100%{opacity:.5;} 50%{opacity:1;} }

/* Nội dung markdown AI */
.tuvan-noi-dung { font-size: .93rem; line-height: 1.75; color: var(--chu-vua); }
.tuvan-noi-dung h1,
.tuvan-noi-dung h2,
.tuvan-noi-dung h3 {
  color: var(--chu-dam);
  font-weight: 700;
  margin: 20px 0 8px;
  line-height: 1.3;
}
.tuvan-noi-dung h1 { font-size: 1.2rem; }
.tuvan-noi-dung h2 { font-size: 1.05rem; border-bottom: 2px solid var(--mau-chinh-nhat); padding-bottom: 6px; }
.tuvan-noi-dung h3 { font-size: .95rem; color: var(--mau-chinh); }
.tuvan-noi-dung p { margin: 10px 0; }
.tuvan-noi-dung ul,
.tuvan-noi-dung ol {
  margin: 10px 0 10px 20px;
  padding-left: 4px;
}
.tuvan-noi-dung li { margin: 6px 0; }
.tuvan-noi-dung ul li::before { content: '▸'; color: var(--mau-chinh); margin-right: 8px; font-size: .8em; }
.tuvan-noi-dung strong { font-weight: 700; color: var(--chu-dam); }
.tuvan-noi-dung em { font-style: italic; color: var(--mau-chinh); }
.tuvan-noi-dung code {
  background: var(--mau-chinh-nhat); color: var(--mau-chinh);
  padding: 2px 6px; border-radius: 4px; font-size: .85em;
}
.tuvan-noi-dung blockquote {
  border-left: 3px solid var(--mau-chinh);
  padding-left: 16px; margin: 12px 0;
  color: var(--chu-nhat); font-style: italic;
}

/* ============================================================
   Quản lý học sinh
   ============================================================ */
.quanly-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .quanly-grid { grid-template-columns: 1fr; } }

.bang-hocsinh { width: 100%; border-collapse: collapse; }
.bang-hocsinh th {
  background: var(--bg-xam);
  padding: 11px 14px;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
  color: var(--chu-nhat);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--vien);
}
.bang-hocsinh td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg-xam);
  font-size: .88rem;
  color: var(--chu-vua);
}
.bang-hocsinh tr:last-child td { border-bottom: none; }
.bang-hocsinh tr:hover td { background: var(--mau-chinh-nhat); }

.sbd-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--mau-chinh-nhat);
  color: var(--mau-chinh);
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 700;
  font-family: monospace;
}
.tag-lop {
  display: inline-block;
  padding: 2px 8px;
  background: #ECFDF5;
  color: var(--mau-xanhla);
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
}
.diem-inline {
  font-weight: 700; font-size: .9rem;
}

/* Form thêm/sửa học sinh */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: .82rem; font-weight: 600;
  color: var(--chu-vua); margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--vien-dam);
  border-radius: var(--bo-goc);
  font-family: inherit;
  font-size: .9rem;
  color: var(--chu-dam);
  background: white;
  outline: none;
  transition: var(--chuyen-tiep);
}
.form-input:focus, .form-select:focus {
  border-color: var(--mau-chinh);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border: none; border-radius: var(--bo-goc);
  font-family: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: var(--chuyen-tiep);
  text-decoration: none;
  touch-action: manipulation;
}
.btn-chinh {
  background: linear-gradient(135deg, var(--mau-chinh), var(--mau-phu));
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}
.btn-chinh:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79,70,229,.4);
  color: white;
}
.btn-phu {
  background: white; color: var(--chu-vua);
  border: 1.5px solid var(--vien-dam);
}
.btn-phu:hover { background: var(--bg-xam); color: var(--chu-dam); }
.btn-nguy-hiem {
  background: #FEF2F2; color: var(--mau-do);
  border: 1.5px solid #FECACA;
}
.btn-nguy-hiem:hover { background: var(--mau-do); color: white; }
.btn-sm { padding: 5px 10px; font-size: .78rem; border-radius: 7px; }
.btn-lon { padding: 12px 28px; font-size: .95rem; border-radius: 14px; width: 100%; }

/* ============================================================
   Alerts / Thông báo
   ============================================================ */
.alert {
  padding: 14px 18px; border-radius: var(--bo-goc-lon);
  font-size: .9rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.alert-loi   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-ok    { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-info  { background: var(--mau-chinh-nhat); color: var(--mau-chinh-dam); border: 1px solid #C7D2FE; }

/* ============================================================
   Phân trang
   ============================================================ */
.phan-trang {
  display: flex; align-items: center; gap: 6px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--bg-xam);
  flex-wrap: wrap;
}
.phan-trang a, .phan-trang span {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: .85rem; font-weight: 600;
  transition: var(--chuyen-tiep);
  border: 1.5px solid var(--vien-dam);
  color: var(--chu-vua);
}
.phan-trang a:hover { background: var(--mau-chinh-nhat); border-color: var(--mau-chinh); color: var(--mau-chinh); }
.phan-trang .dang-chon { background: var(--mau-chinh); border-color: var(--mau-chinh); color: white; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: .83rem; color: var(--chu-mo);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--mau-chinh); font-weight: 500; }
.breadcrumb .phan-cach { color: var(--chu-mo); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: white;
  border-top: 1px solid var(--vien);
  padding: 20px 24px;
  text-align: center;
  margin-top: auto;
}
.footer p { font-size: .82rem; color: var(--chu-mo); }

/* ============================================================
   Animations & Utilities
   ============================================================ */
.fade-in { animation: hienRa .35s ease both; }
@keyframes hienRa { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.slide-in { animation: truotVao .3s ease both; }
@keyframes truotVao { from { opacity:0; transform:translateX(-12px); } to { opacity:1; transform:translateX(0); } }

.text-tam { text-align: center; }
.pading-tren { padding-top: 60px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.w-full { width: 100%; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .header { padding: 0 16px; }
  .header-nav a { padding: 6px 10px; font-size: .8rem; }
  .container { padding: 0 14px; }
  .hero { padding: 32px 14px 28px; }
  .card { padding: 18px; }
  .thong-ke-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .bang-hocsinh th:nth-child(3),
  .bang-hocsinh td:nth-child(3) { display: none; }
}

/* Loading overlay */
.overlay-loading {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; display: none;
}
.overlay-loading.hien { display: flex; }

/* Modal xác nhận xóa */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-overlay.hien { display: flex; }
.modal-box {
  background: white; border-radius: var(--bo-goc-xl);
  padding: 32px; max-width: 420px; width: calc(100% - 40px);
  text-align: center;
  animation: hienRa .2s ease;
}
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.modal-box p  { color: var(--chu-nhat); font-size: .9rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ══════════════════════════════════════
   📱 MOBILE RESPONSIVE — style.css
   ══════════════════════════════════════ */

/* Hamburger button (hiển thị trên mobile) */
.dash-hamburger {
  display: none; /* Hamburger ẩn hoàn toàn — nav luôn hiện */
}

@media (max-width: 768px) {
  /* Body padding: header 54px + ticker 24px = 78px */
  body { padding-top: 78px; }

  .dash-header-inner {
    padding: 0 12px;
    height: 54px;
    gap: 6px;
  }
  .dash-logo-ten { font-size: .85rem; }
  .dash-logo-mo-ta { display: none; }
  .dash-logo-icon { width: 36px; height: 36px; font-size: 18px; }

  /* Hamburger luôn ẩn — nav hiện trực tiếp */
  .dash-hamburger { display: none !important; }

  /* Nav: hiện inline, compact, không dropdown */
  .dash-nav {
    display: flex;
    position: static;         /* không fixed — nằm trong flow */
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    z-index: auto;
    animation: none;
  }
  .dash-nav-btn {
    padding: 5px 10px;
    font-size: .78rem;
    gap: 3px;
    border-radius: 8px;
    white-space: nowrap;
  }
  /* .nav-txt hiện trên tablet */
  .nav-txt { display: inline; }

  /* Ticker & offset */
  .dash-ticker { top: 54px; height: 24px; }
  .dash-ticker-content { font-size: .65rem; }
  .dash-ticker-label { font-size: .6rem; padding: 0 10px; }
  .app-container { margin-top: 78px; }

  /* Form row */
  .form-row { grid-template-columns: 1fr; }
  .btn-lon { font-size: .88rem; padding: 11px 20px; }

  /* Hero section compact */
  .hero { padding: 32px 16px 28px; margin-bottom: 24px; }
  .hero h1 { font-size: 1.5rem; }
  .hero-desc { font-size: .88rem; margin-bottom: 20px; }

  /* Modal */
  .modal-box { padding: 24px 18px; max-width: 100%; border-radius: 16px; }

  /* Hocsinh grid */
  .hocsinh-grid { grid-template-columns: 1fr; }

  /* Touch */
  .btn, .dash-nav-btn, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
}

@media (max-width: 480px) {
  body { padding-top: 80px; }
  .dash-header-inner {
    padding: 4px 8px;
    height: auto;
    min-height: 54px;
    gap: 6px;
    align-items: center;
    /* Ngăn tràn ngang */
    overflow: hidden;
    min-width: 0;
  }
  .dash-logo {
    flex-shrink: 1;
    min-width: 0;
    overflow: visible;
    align-items: center;
  }
  .dash-logo-ten {
    font-size: .72rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.25;
    max-width: 160px;
  }
  .dash-logo-icon { width: 30px; height: 30px; font-size: 15px; flex-shrink: 0; }
  .dash-logo-mo-ta { display: none; }

  /* Ticker — bên dưới header min-height=54px */
  .dash-ticker { top: 54px; height: 22px; }
  body { padding-top: 80px; }

  /* Nav: chỉ hiện emoji icon, ẩn chữ */
  .nav-txt { display: none; }
  .dash-nav {
    gap: 2px;
    flex-shrink: 0;
  }
  .dash-nav-btn {
    padding: 5px 7px;
    font-size: 1.05rem;
    border-radius: 7px;
    min-width: 32px;
    justify-content: center;
  }
  /* Nút PWA nhỏ gọn trên mobile */
  .pwa-header-install-btn {
    min-width: 32px;
    padding: 5px 7px;
    animation: pwa-pulse-glow 2s ease-in-out infinite;
  }

  /* Login modal full-width */
  #modal-dangnhap > div {
    width: calc(100vw - 16px) !important;
    padding: 20px 12px !important;
    border-radius: 14px !important;
  }
}

/* ══════════════════════════════════════
   📱 Extra Mobile Rules (768px)
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  /* hocsinh.php: back button full-width */
  .btn.btn-phu { display: flex; width: 100%; justify-content: center; box-sizing: border-box; }

  /* Breadcrumb wrap on small screens */
  .breadcrumb { flex-wrap: wrap; gap: 4px; font-size: .8rem; padding: 8px 12px; }

  /* AI refresh button compact */
  .btn-ai-refresh { padding: 5px 10px; font-size: .75rem; }

  /* hocsinh-grid single column */
  .hocsinh-grid { grid-template-columns: 1fr !important; gap: 14px; }

  /* Score bars in hocsinh.php */
  .diem-item { padding: 10px 0; }
  .diem-header { font-size: .82rem; }

  /* Thong-tin rows compact */
  .thong-tin-item { padding: 8px 0; font-size: .84rem; }

  /* Card padding smaller */
  .card { padding: 14px; }

  /* Footer compact */
  footer.footer { padding: 14px 16px; font-size: .78rem; }

  /* Admin stats 2-col → more compact */
  .stat-card-admin { padding: 12px 14px; }
}

/* ============================================================
   Sidebar Analytics Block — Phân tích học sinh Khối 12
   ============================================================ */
.sb-analytics-block {
  margin-top: 14px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(99,102,241,.18);
  box-shadow: 0 4px 16px rgba(79,70,229,.1);
  background: #fff;
}

/* Header gradient */
.sb-analytics-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}
.sb-analytics-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.3));
}
.sb-analytics-title {
  font-size: .82rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: .01em;
}
.sb-analytics-sub {
  font-size: .68rem;
  color: rgba(255,255,255,.7);
  margin-top: 1px;
}
.sb-analytics-sub strong { color: #FFE066; }

/* Metric rows */
.sb-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sb-metric-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #F1F5F9;
  transition: background .18s;
  border-left: 4px solid transparent;
}
.sb-metric-row:last-child { border-bottom: none; }
.sb-metric-row:hover { background: #F8FAFF; }

/* Accent colors */
.sb-blue  { border-left-color: #4F46E5; }
.sb-green { border-left-color: #10B981; }
.sb-orange{ border-left-color: #F59E0B; }

/* Icon circle */
.sb-metric-icon-wrap {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: #F1F5F9;
}
.sb-blue  .sb-metric-icon-wrap { background: #EEF2FF; }
.sb-green .sb-metric-icon-wrap { background: #ECFDF5; }
.sb-orange .sb-metric-icon-wrap{ background: #FFFBEB; }

/* Body text */
.sb-metric-body {
  flex: 1;
  min-width: 0;
}
.sb-metric-num {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.01em;
  color: #0F172A;
}
.sb-metric-label {
  font-size: .67rem;
  color: #64748B;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 2px;
}

/* Right chip tag */
.sb-metric-tag {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}
.sb-blue  .sb-metric-tag { background: #EEF2FF; color: #4F46E5; }
.sb-green .sb-metric-tag { background: #ECFDF5; color: #059669; }
.sb-orange .sb-metric-tag{ background: #FFFBEB; color: #D97706; }

/* ============================================================
   Leaderboard — Bảng xếp hạng
   ============================================================ */
.lb-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Tab bar */
.lb-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
  border-bottom: 2px solid #E2E8F0;
  background: #F8FAFC;
}
.lb-tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: .83rem;
  font-weight: 700;
  color: #64748B;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all .18s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  letter-spacing: .01em;
}
.lb-tab:hover { color: #4F46E5; background: #EEF2FF; }
.lb-tab.active {
  color: #4F46E5;
  background: #fff;
  border-bottom-color: #4F46E5;
  box-shadow: 0 -2px 8px rgba(79,70,229,.08);
}

/* Panel */
.lb-panel { flex: 1; display: flex; flex-direction: column; }

/* Colored header strip */
.lb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}
.lb-header-blue   { background: linear-gradient(90deg, #4F46E5, #818CF8); }
.lb-header-purple { background: linear-gradient(90deg, #F59E0B, #F97316); }

/* Table */
.lb-table-wrap {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}
.lb-table thead tr {
  background: #F1F5F9;
  position: sticky;
  top: 0;
  z-index: 1;
}
.lb-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: #64748B;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 1px solid #E2E8F0;
}
.lb-row {
  border-bottom: 1px solid #F1F5F9;
  transition: background .15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: #F8FAFF; }
.lb-table td { padding: 9px 12px; vertical-align: middle; }

/* Rank medals */
.lb-medal { font-size: 1.3rem; display: flex; justify-content: center; }
.lb-rank-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #F1F5F9;
  color: #64748B;
  font-size: .75rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

/* Lop name + mini bar */
.lb-lop-name { font-weight: 700; font-size: .85rem; color: #0F172A; margin-bottom: 4px; }
.lb-mini-bar {
  height: 4px;
  background: #E2E8F0;
  border-radius: 99px;
  overflow: hidden;
}
.lb-mini-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

/* Score */
.lb-score { font-size: 1rem; font-weight: 900; }
.lb-center { text-align: center; }
.lb-right  { text-align: right; }

/* Khá-Giỏi badge */
.lb-kg-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #ECFDF5;
  color: #059669;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
}

/* Top HS: clickable name */
.lb-hs-name {
  font-weight: 600;
  color: #0F172A;
  text-decoration: none;
  transition: color .15s;
}
.lb-hs-name:hover { color: #4F46E5; text-decoration: underline; }

/* Lớp chip */
.lb-lop-chip {
  display: inline-block;
  padding: 2px 8px;
  background: #EEF2FF;
  color: #4F46E5;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
}

/* Reuse gradient fills from existing vars */
.lb-mini-fill.gradient-tot    { background: linear-gradient(90deg, #34D399, #10B981); }
.lb-mini-fill.gradient-kha    { background: linear-gradient(90deg, #818CF8, #4F46E5); }
.lb-mini-fill.gradient-trungbinh { background: linear-gradient(90deg, #FCD34D, #F59E0B); }
.lb-mini-fill.gradient-yeu    { background: linear-gradient(90deg, #FCA5A5, #EF4444); }





/* ============================================================
   Leaderboard v2 â€” Dual-section (Theo Lop + Toan Truong)
   ============================================================ */
.lb2-wrapper { display:grid; grid-template-columns:1fr 1fr; gap:12px; height:100%; min-height:0; }
.lb2-section { display:flex; flex-direction:column; border-radius:14px; overflow:hidden; border:1px solid #E2E8F0; box-shadow:0 4px 16px rgba(0,0,0,.07); background:#fff; min-height:0; }
.lb2-sec-header { display:flex; align-items:center; gap:10px; padding:11px 14px; flex-shrink:0; }
.lb2-header-blue   { background:linear-gradient(135deg,#4F46E5,#818CF8); }
.lb2-header-purple { background:linear-gradient(135deg,#F59E0B,#F97316); }
.lb2-hdr-icon  { font-size:1.35rem; flex-shrink:0; filter:drop-shadow(0 1px 3px rgba(0,0,0,.3)); }
.lb2-hdr-title { font-size:.82rem; font-weight:800; color:#fff; letter-spacing:.01em; }
.lb2-hdr-sub   { font-size:.67rem; color:rgba(255,255,255,.72); margin-top:2px; }
.lb2-medal { font-size:1.3rem; line-height:1; }
.lb2-rank-num { display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; border-radius:50%; background:#F1F5F9; color:#64748B; font-size:.7rem; font-weight:800; }
.lb2-lop-list { flex:1; overflow-y:auto; display:flex; flex-direction:column; }
.lb2-lop-card { display:flex; align-items:center; gap:8px; padding:9px 12px; border-bottom:1px solid #F1F5F9; cursor:pointer; transition:background .15s,box-shadow .15s; }
.lb2-lop-card:last-child { border-bottom:none; }
.lb2-lop-card:hover { background:#F8F7FF; box-shadow:inset 3px 0 0 #6366F1; }
.lb2-lop-rank { display:flex; align-items:center; justify-content:center; width:30px; flex-shrink:0; }
.lb2-lop-info { flex:1; min-width:0; }
.lb2-lop-top-row { display:flex; align-items:baseline; justify-content:space-between; gap:4px; margin-bottom:2px; }
.lb2-lop-name  { font-size:.88rem; font-weight:800; color:#0F172A; }
.lb2-lop-score { font-size:1rem; font-weight:900; flex-shrink:0; }
.lb2-lop-top-hs { display:flex; align-items:center; gap:3px; margin-bottom:4px; overflow:hidden; }
.lb2-crown        { font-size:.75rem; flex-shrink:0; }
.lb2-top-hs-name  { font-size:.7rem; color:#475569; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; }
.lb2-top-hs-score { font-size:.7rem; font-weight:800; flex-shrink:0; }
.lb2-lop-bar-row { display:flex; align-items:center; gap:6px; }
.lb2-lop-bar-track { flex:1; height:4px; background:#E2E8F0; border-radius:99px; overflow:hidden; }
.lb2-lop-bar-fill { height:100%; border-radius:99px; transition:width 1.2s cubic-bezier(.4,0,.2,1); }
.lb2-lop-kg { font-size:.63rem; color:#059669; font-weight:700; white-space:nowrap; flex-shrink:0; }
.lb2-lop-arrow { color:#CBD5E1; font-size:1rem; flex-shrink:0; transition:color .15s; }
.lb2-lop-card:hover .lb2-lop-arrow { color:#6366F1; }
.lb2-lop-bar-fill.gradient-tot       { background:linear-gradient(90deg,#34D399,#10B981); }
.lb2-lop-bar-fill.gradient-kha       { background:linear-gradient(90deg,#818CF8,#4F46E5); }
.lb2-lop-bar-fill.gradient-trungbinh { background:linear-gradient(90deg,#FCD34D,#F59E0B); }
.lb2-lop-bar-fill.gradient-yeu       { background:linear-gradient(90deg,#FCA5A5,#EF4444); }
.lb2-hs-section { overflow:hidden; }
.lb2-ticker-wrap { flex:1; overflow:hidden; position:relative; min-height:0; }
.lb2-ticker-wrap::before,.lb2-ticker-wrap::after { content:""; position:absolute; left:0; right:0; height:22px; z-index:2; pointer-events:none; }
.lb2-ticker-wrap::before { top:0; background:linear-gradient(to bottom,#fff,transparent); }
.lb2-ticker-wrap::after  { bottom:0; background:linear-gradient(to top,#fff,transparent); }
.lb2-ticker { display:flex; flex-direction:column; will-change:transform; }
.lb2-ticker-item { display:flex; align-items:center; gap:8px; padding:9px 12px; border-bottom:1px solid #F1F5F9; text-decoration:none; color:inherit; transition:background .14s; flex-shrink:0; }
.lb2-ticker-item:hover { background:#F8F7FF; }
.lb2-ticker-item:last-child { border-bottom:none; }
.lb2-ticker-rank { display:flex; align-items:center; justify-content:center; width:30px; flex-shrink:0; }
.lb2-ticker-info { flex:1; min-width:0; }
.lb2-ticker-name { font-size:.82rem; font-weight:700; color:#0F172A; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lb2-ticker-meta { margin-top:2px; }
.lb2-ticker-lop  { display:inline-block; padding:1px 6px; background:#EEF2FF; color:#4F46E5; border-radius:5px; font-size:.65rem; font-weight:700; }
.lb2-ticker-score{ font-size:.95rem; font-weight:900; flex-shrink:0; }
.lb2-popup-overlay { position:fixed; inset:0; background:rgba(15,23,42,.48); backdrop-filter:blur(4px); z-index:400; opacity:0; pointer-events:none; transition:opacity .22s; }
.lb2-popup-overlay.active { opacity:1; pointer-events:all; }
.lb2-popup { position:fixed; top:50%; left:50%; transform:translate(-50%,-44%) scale(.96); width:min(94vw,420px); max-height:82vh; background:#fff; border-radius:20px; box-shadow:0 24px 64px rgba(0,0,0,.22); z-index:401; opacity:0; pointer-events:none; transition:opacity .22s,transform .28s cubic-bezier(.34,1.56,.64,1); display:flex; flex-direction:column; overflow:hidden; }
.lb2-popup.active { opacity:1; pointer-events:all; transform:translate(-50%,-50%) scale(1); }
.lb2-popup-header { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; background:linear-gradient(135deg,#4F46E5,#818CF8); color:#fff; font-size:.85rem; font-weight:800; flex-shrink:0; gap:8px; }
.lb2-popup-close { background:rgba(255,255,255,.22); border:none; color:#fff; width:28px; height:28px; border-radius:50%; cursor:pointer; font-size:.85rem; display:flex; align-items:center; justify-content:center; transition:background .14s; flex-shrink:0; }
.lb2-popup-close:hover { background:rgba(255,255,255,.38); }
.lb2-popup-body { overflow-y:auto; flex:1; padding:14px 16px; }
.lb2-popup-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:14px; }
.lb2-popup-stat { display:flex; flex-direction:column; align-items:center; padding:10px 6px; background:#F8FAFC; border-radius:12px; border:1px solid #E2E8F0; text-align:center; gap:4px; }
.lb2-popup-stat span   { font-size:.63rem; color:#64748B; font-weight:600; }
.lb2-popup-stat strong { font-size:1rem; font-weight:900; color:#0F172A; }
.lb2-popup-list-title { font-size:.7rem; font-weight:800; color:#64748B; text-transform:uppercase; letter-spacing:.07em; margin-bottom:8px; }
.lb2-popup-list { display:flex; flex-direction:column; gap:2px; }
.lb2-popup-item { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:10px; text-decoration:none; color:inherit; transition:background .14s; border:1px solid transparent; }
.lb2-popup-item:hover { background:#F8F7FF; border-color:#E0E7FF; }
.lb2-popup-rank  { display:flex; align-items:center; justify-content:center; width:28px; flex-shrink:0; }
.lb2-popup-name  { flex:1; font-size:.82rem; font-weight:600; color:#0F172A; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lb2-popup-score { font-size:.88rem; font-weight:900; flex-shrink:0; }
@media (max-width:680px) {
  .lb2-wrapper { grid-template-columns:1fr; }
  .lb2-hs-section { max-height:260px; }
}

/* ============================================================
   Leaderboard v2 â€” Popup subject score additions
   ============================================================ */

/* Make popup wider for subject scores */
.lb2-popup { width: min(96vw, 540px); }

/* Override popup-item: now a div, not an anchor */
.lb2-popup-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  transition: background .14s;
  border: 1px solid transparent;
}
.lb2-popup-item:hover { background: #F8F7FF; border-color: #E0E7FF; }

/* Student info column (name + subject chips) */
.lb2-popup-student {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Name is now a link */
.lb2-popup-name {
  flex: unset;
  font-size: .82rem;
  font-weight: 700;
  color: #0F172A;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb2-popup-name:hover { color: #4F46E5; text-decoration: underline; }

/* Subject chips row */
.lb2-popup-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* Individual subject chip */
.lb2-popup-mon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .65rem;
  border: 1px solid color-mix(in srgb, var(--mc, #64748B) 25%, transparent);
  background: color-mix(in srgb, var(--mc, #64748B) 8%, white);
}
.lb2-popup-mon em {
  font-style: normal;
  color: var(--mc, #64748B);
  font-weight: 600;
  letter-spacing: .01em;
}
.lb2-popup-mon strong {
  font-weight: 800;
  font-size: .68rem;
}

/* Rank aligned to top for multi-line rows */
.lb2-popup-rank { align-self: flex-start; margin-top: 2px; }

/* Score aligned to top too */
.lb2-popup-score { align-self: flex-start; margin-top: 1px; }

/* â”€â”€ Subject chips on CLASS CARDS (top student row) â”€â”€ */
.lb2-card-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 4px;
}
.lb2-card-mon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .62rem;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
}
.lb2-card-mon em   { font-style: normal; color: #64748B; font-weight: 600; }
.lb2-card-mon strong { font-weight: 800; }

/* â”€â”€ Subject chips on TICKER items â”€â”€ */
.lb2-ticker-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}
.lb2-ticker-mon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .62rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
.lb2-ticker-mon em   { font-style: normal; color: #64748B; font-weight: 600; }
.lb2-ticker-mon strong { font-weight: 800; }

/* Ticker items are now taller â€” align rank to top */
.lb2-ticker-item { align-items: flex-start; }
.lb2-ticker-rank { margin-top: 2px; }
.lb2-ticker-score { margin-top: 1px; }

/* ============================================================
   Leaderboard v2 â€” Premium Section Headers (redesign)
   ============================================================ */

/* Override existing simple header styles */
.lb2-sec-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  min-height: 72px;
}

/* Decorative blobs via ::before / ::after */
.lb2-sec-header::before,
.lb2-sec-header::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.lb2-sec-header::before {
  width: 160px; height: 160px;
  top: -60px; right: -40px;
  background: rgba(255,255,255,.10);
}
.lb2-sec-header::after {
  width: 90px; height: 90px;
  bottom: -40px; right: 100px;
  background: rgba(255,255,255,.07);
}

/* â”€â”€ BLUE header: rich electric-blue â†’ violet â”€â”€ */
.lb2-header-blue {
  background: linear-gradient(135deg,
    #1E40AF 0%,
    #3B82F6 35%,
    #6366F1 65%,
    #8B5CF6 100%
  );
  box-shadow: 0 6px 24px rgba(99,102,241,.45), inset 0 1px 0 rgba(255,255,255,.15);
}

/* â”€â”€ PURPLE header: deep violet â†’ rose-gold â”€â”€ */
/* ── ORANGE header: amber → orange ── */
.lb2-header-purple {
  background: linear-gradient(135deg,
    #92400E 0%,
    #D97706 30%,
    #F59E0B 65%,
    #F97316 100%
  );
  box-shadow: 0 6px 24px rgba(245,158,11,.4), inset 0 1px 0 rgba(255,255,255,.15);
}

/* â”€â”€ Icon wrapper with glass circle â”€â”€ */
.lb2-hdr-icon-wrap {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  position: relative;
  z-index: 1;
}
.lb2-hdr-icon {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
  display: block;
}

/* â”€â”€ Text column â”€â”€ */
.lb2-hdr-text {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.lb2-hdr-title {
  font-size: .95rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .02em;
  text-shadow: 0 1px 6px rgba(0,0,0,.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb2-hdr-sub {
  font-size: .7rem;
  color: rgba(255,255,255,.78);
  margin-top: 3px;
  font-weight: 500;
  letter-spacing: .01em;
}

/* â”€â”€ Glassy count badge â”€â”€ */
.lb2-hdr-badge {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* Gold variant for "Top 20" */
.lb2-hdr-badge-gold {
  background: linear-gradient(135deg, rgba(251,191,36,.5), rgba(245,158,11,.4));
  border-color: rgba(251,191,36,.55);
  color: #FEF3C7;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* Subtle shimmer animation on header titles */
@keyframes hdr-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.lb2-hdr-title {
  background: linear-gradient(90deg,
    rgba(255,255,255,1) 40%,
    rgba(255,255,255,.55) 50%,
    rgba(255,255,255,1) 60%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: hdr-shimmer 4s linear infinite;
}

/* ============================================================
   Leaderboard v2 â€” Compact Single-Row Design (lb2v-*)
   ============================================================ */

/* â”€â”€ Grid wrapper: allow left panel to stretch naturally â”€â”€ */
.lb2-wrapper {
  grid-template-columns: 1fr 1fr;
  align-items: start;  /* don't stretch both cols to same height */
}

/* â”€â”€ Left section: show ALL classes, no overflow hidden â”€â”€ */
.lb2-lop-section {
  height: auto !important;
  min-height: 0;
}
.lb2-lop-list {
  overflow-y: visible !important;
  flex: unset;
}

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   SINGLE-ROW CARD
â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.lb2v-card {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, box-shadow .14s;
  position: relative;
  overflow: hidden;
}
.lb2v-card:last-child { border-bottom: none; }
.lb2v-card:hover {
  z-index: 1;
  box-shadow: inset 3px 0 0 #6366F1, 0 2px 8px rgba(99,102,241,.1);
}

/* Row highlight by rank */
.lb2v-r1 { background: linear-gradient(90deg, rgba(251,191,36,.11) 0%, rgba(255,255,255,0) 70%); }
.lb2v-r2 { background: linear-gradient(90deg, rgba(148,163,184,.1) 0%, rgba(255,255,255,0) 70%); }
.lb2v-r3 { background: linear-gradient(90deg, rgba(251,146,60,.09) 0%, rgba(255,255,255,0) 70%); }
.lb2v-r4 { background: #fff; }

/* â”€â”€ Rank cell â”€â”€ */
.lb2v-rank {
  width: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.lb2v-rnum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: .7rem; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
}

/* â”€â”€ Class pill â”€â”€ */
.lb2v-classpill {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .02em;
  color: #fff;
}
.lb2v-cp-tot       { background: linear-gradient(135deg, #10B981, #059669); }
.lb2v-cp-kha       { background: linear-gradient(135deg, #6366F1, #4F46E5); }
.lb2v-cp-trungbinh { background: linear-gradient(135deg, #F59E0B, #D97706); }
.lb2v-cp-yeu       { background: linear-gradient(135deg, #EF4444, #DC2626); }

/* â”€â”€ Crown & student name â”€â”€ */
.lb2v-crown { font-size: .85rem; flex-shrink: 0; }
.lb2v-hsname {
  font-size: .78rem; font-weight: 700; color: #1E293B;
  flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis;
  min-width: 60px; max-width: 140px;
}
.lb2v-hstb { font-size: .78rem; font-weight: 900; flex-shrink: 0; }

/* â”€â”€ Spacer â”€â”€ */
.lb2v-spacer { flex: 1; }

/* â”€â”€ KG% badge â”€â”€ */
.lb2v-kg {
  flex-shrink: 0;
  font-size: .67rem; font-weight: 800;
  color: #059669;
  background: #D1FAE5;
  padding: 2px 6px; border-radius: 6px;
}

/* â”€â”€ Class avg score â”€â”€ */
.lb2v-avg {
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 900;
  min-width: 34px;
  text-align: right;
}

/* â”€â”€ Arrow â”€â”€ */
.lb2v-arrow { color: #CBD5E1; font-size: 1rem; flex-shrink: 0; transition: color .14s; }
.lb2v-card:hover .lb2v-arrow { color: #6366F1; }

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   SINGLE-ROW TICKER
â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.lb2v-trow {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 1px solid #F1F5F9;
  text-decoration: none; color: inherit;
  white-space: nowrap;
  transition: background .14s;
  flex-shrink: 0;
  overflow: hidden;
}
.lb2v-trow:hover { opacity: .88; }

/* Rank tints on ticker too */
.lb2v-trow.lb2v-r1 { background: linear-gradient(90deg, rgba(251,191,36,.11), transparent); }
.lb2v-trow.lb2v-r2 { background: linear-gradient(90deg, rgba(148,163,184,.1), transparent); }
.lb2v-trow.lb2v-r3 { background: linear-gradient(90deg, rgba(251,146,60,.09), transparent); }
.lb2v-trow.lb2v-r4 { background: transparent; }

.lb2v-tname {
  font-size: .8rem; font-weight: 700; color: #0F172A;
  flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis;
  min-width: 80px; max-width: 150px;
}
.lb2v-tlop {
  flex-shrink: 0;
  padding: 2px 7px; border-radius: 6px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff; font-size: .65rem; font-weight: 800;
}
.lb2v-tscore { font-size: 1rem; font-weight: 900; flex-shrink: 0; min-width: 32px; text-align: right; }

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   SHARED SUBJECT CHIPS (lb2v-chip-*)
â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.lb2v-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 5px; border-radius: 5px;
  font-size: .63rem; font-weight: 600;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.lb2v-chip em   { font-style: normal; font-weight: 700; }
.lb2v-chip strong { font-weight: 900; font-size: .65rem; }

/* Per-subject color palette */
.lb2v-chip-t  { background:#EEF2FF; border-color:#C7D2FE; color:#4338CA; }
.lb2v-chip-v  { background:#FFF7ED; border-color:#FED7AA; color:#C2410C; }
.lb2v-chip-a  { background:#F0FDF4; border-color:#BBF7D0; color:#166534; }
.lb2v-chip-s  { background:#FFF1F2; border-color:#FECDD3; color:#BE123C; }
.lb2v-chip-l  { background:#F0F9FF; border-color:#BAE6FD; color:#0369A1; }
.lb2v-chip-h  { background:#FDF4FF; border-color:#E9D5FF; color:#7E22CE; }
.lb2v-chip-si { background:#ECFDF5; border-color:#A7F3D0; color:#047857; }
.lb2v-chip-d, .lb2v-chip- { background:#FFFBEB; border-color:#FDE68A; color:#92400E; }

/* Ticker section: give fixed height for auto-scroll */
.lb2-hs-section {
  height: auto;
}
.lb2-ticker-wrap { height: 520px; }

/* ============================================================
   Leaderboard v3 â€” Premium 2-Row Cards (lb3-*)
   ============================================================ */

/* â”€â”€ Wrapper: side-by-side, top-aligned â”€â”€ */
.lb2-wrapper { align-items: start !important; }
.lb2-lop-section { height: auto !important; }
.lb2-lop-list    { overflow-y: visible !important; flex: unset !important; }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   CLASS CARD (lb3-card)
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.lb3-card {
  display: flex;
  flex-direction: column;
  padding: 10px 14px 9px 0;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  position: relative;
  transition: background .15s, box-shadow .14s;
  overflow: hidden;
}
.lb3-card:last-child { border-bottom: none; }
.lb3-card:hover { background: #F8FAFF; }

/* Coloured left accent bar */
.lb3-card::before {
  content: ''; position: absolute;
  left: 0; top: 6px; bottom: 6px; width: 4px;
  border-radius: 0 4px 4px 0;
  background: #E2E8F0;
  transition: background .15s, width .15s;
}
.lb3-card:hover::before { background: #6366F1; width: 5px; }
.lb3-rank1::before { background: #F59E0B !important; }
.lb3-rank2::before { background: #94A3B8 !important; }
.lb3-rank3::before { background: #F97316 !important; }
.lb3-rank4::before { background: #CBD5E1; }

/* Rank row tints */
.lb3-rank1 { background: linear-gradient(90deg, rgba(251,191,36,.07) 0%, #fff 60%); }
.lb3-rank2 { background: linear-gradient(90deg, rgba(148,163,184,.07) 0%, #fff 60%); }
.lb3-rank3 { background: linear-gradient(90deg, rgba(249,115,22,.06) 0%, #fff 60%); }

/* â”€â”€ Row 1: Rank Â· Class Â· HS count Â· spacer Â· KG% Â· Score Â· Arrow â”€â”€ */
.lb3-r1 {
  display: flex; align-items: center; gap: 7px;
  padding-left: 14px;
}
.lb3-medal { font-size: 1.25rem; flex-shrink: 0; line-height: 1; width: 28px; text-align: center; }
.lb3-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: .72rem; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
}
.lb3-cname {
  font-size: .92rem; font-weight: 900;
  color: #0F172A; letter-spacing: .01em;
}
.lb3-divider, .lb3-sep { color: #CBD5E1; font-size: .85rem; flex-shrink: 0; }
.lb3-hs-count { font-size: .7rem; color: #94A3B8; font-weight: 500; flex-shrink: 0; }
.lb3-spacer { flex: 1; }

/* KG% badge */
.lb3-kg {
  padding: 2px 8px; border-radius: 99px;
  font-size: .68rem; font-weight: 700; flex-shrink: 0;
}
.lb3-kg-hi  { background: #D1FAE5; color: #065F46; }
.lb3-kg-md  { background: #DBEAFE; color: #1E40AF; }
.lb3-kg-lo  { background: #FEF9C3; color: #92400E; }

/* Score */
.lb3-score {
  font-size: 1.12rem; font-weight: 900;
  min-width: 36px; text-align: right; flex-shrink: 0;
}
.lb3-score-tot       { color: #059669; }
.lb3-score-kha       { color: #2563EB; }
.lb3-score-trungbinh { color: #D97706; }
.lb3-score-yeu       { color: #DC2626; }

/* Arrow */
.lb3-arr { color: #CBD5E1; font-size: 1rem; flex-shrink: 0; transition: color .14s, transform .14s; }
.lb3-card:hover .lb3-arr { color: #6366F1; transform: translateX(2px); }

/* â”€â”€ Row 2: Crown Â· Name Â· Score Â· Â· T 10 V 7.0 A 7.3 â”€â”€ */
.lb3-r2 {
  display: flex; align-items: center; gap: 4px;
  padding-left: 56px; /* visual indent past medal */
  white-space: nowrap; overflow: hidden;
  margin-top: 2px;
}
.lb3-crown2 { font-size: .8rem; flex-shrink: 0; }
.lb3-hsn {
  font-size: .78rem; font-weight: 700; color: #334155;
  overflow: hidden; text-overflow: ellipsis;
  flex: 0 1 auto; max-width: 140px;
}
.lb3-hstb { font-size: .78rem; font-weight: 900; flex-shrink: 0; }
.lb3-msub {
  font-size: .66rem; font-weight: 700; flex-shrink: 0;
  letter-spacing: .01em;
}
.lb3-mval {
  font-size: .68rem; font-weight: 900; flex-shrink: 0;
  margin-left: 1px; margin-right: 4px;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   TICKER ROW (lb3-trow)
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.lb3-trow {
  display: flex; flex-direction: column;
  padding: 9px 14px 8px 0;
  border-bottom: 1px solid #F1F5F9;
  text-decoration: none; color: inherit;
  position: relative;
  transition: background .14s;
  flex-shrink: 0;
}
.lb3-trow:last-child { border-bottom: none; }
.lb3-trow:hover { background: #F8FAFF; }

.lb3-trow::before {
  content: ''; position: absolute;
  left: 0; top: 6px; bottom: 6px; width: 4px;
  border-radius: 0 4px 4px 0; background: #E2E8F0;
  transition: background .14s;
}
.lb3-trow:hover::before { background: #7C3AED; }
.lb3-trow.lb3-rank1::before { background: #F59E0B !important; }
.lb3-trow.lb3-rank2::before { background: #94A3B8 !important; }
.lb3-trow.lb3-rank3::before { background: #F97316 !important; }

.lb3-trow.lb3-rank1 { background: linear-gradient(90deg, rgba(251,191,36,.06), #fff 60%); }
.lb3-trow.lb3-rank2 { background: linear-gradient(90deg, rgba(148,163,184,.06), #fff 60%); }
.lb3-trow.lb3-rank3 { background: linear-gradient(90deg, rgba(249,115,22,.05), #fff 60%); }

.lb3-trow .lb3-r1 { padding-left: 14px; }
.lb3-trow .lb3-r2 { padding-left: 56px; margin-top: 2px; }

/* Ticker-specific overrides */
.lb3-tname {
  font-size: .85rem; font-weight: 800; color: #0F172A;
  flex: 1; overflow: hidden; text-overflow: ellipsis;
}
.lb3-tlop {
  flex-shrink: 0; padding: 2px 8px; border-radius: 6px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff; font-size: .67rem; font-weight: 800; letter-spacing: .02em;
}
.lb3-trow .lb3-score { font-size: 1.05rem; font-weight: 900; }

/* â”€â”€ lb3-card / lb3-trow: TRUE SINGLE ROW override â”€â”€ */
.lb3-card {
  flex-direction: row !important;
  align-items: center;
  gap: 5px;
  padding: 8px 10px 8px 0;
  white-space: nowrap;
  overflow: hidden;
}
.lb3-trow {
  flex-direction: row !important;
  align-items: center;
  gap: 5px;
  padding: 8px 12px 8px 0;
  white-space: nowrap;
  overflow: hidden;
}
/* Remove sub-row containers (now flat) */
.lb3-r1, .lb3-r2 { display: none; }

/* Separator dot between class/student/subject sections */
.lb3-sep2 { color: #CBD5E1; font-size: .8rem; flex-shrink: 0; }

/* ============================================================
   Leaderboard v4 â€” Fixed-Column Grid Table (lb4-*)
   ============================================================ */

/* â”€â”€ Left panel: allow full height â”€â”€ */
.lb2-lop-section { height: auto !important; }
.lb2-lop-list    { overflow: visible !important; flex: unset !important; }

/* â”€â”€ Grid columns shared by header and rows â”€â”€
   col: [rank][class][student-name][T][V][A][S][L][H][Si][Ä][KG%][ÄTB][â€º]
   = 30px 54px 1fr 38px 38px 38px 38px 38px 38px 38px 38px 44px 50px 20px       */
.lb4-hdr,
.lb4-row {
  display: grid;
  grid-template-columns: 30px 56px 1fr repeat(8, 38px) 44px 52px 18px;
  align-items: center;
  gap: 0 2px;
  padding: 0 10px 0 8px;
  overflow: hidden;
}

/* Header row */
.lb4-hdr {
  background: #F8FAFC;
  border-bottom: 2px solid #E2E8F0;
  padding-top: 5px;
  padding-bottom: 5px;
  position: sticky; top: 0; z-index: 2;
}
.lb4-hdr > span {
  font-size: .63rem; font-weight: 700;
  color: #94A3B8; text-transform: uppercase; letter-spacing: .04em;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb4-hdr > span:nth-child(3) { text-align: left; }

/* Data row */
.lb4-row {
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  min-height: 40px;
  transition: background .12s;
  position: relative;
}
.lb4-row:last-child { border-bottom: none; }
.lb4-row:hover { background: #F8FAFF; }

/* Left rank accent */
.lb4-row::before {
  content: ''; position: absolute;
  left: 0; top: 4px; bottom: 4px; width: 3px;
  border-radius: 0 3px 3px 0; background: transparent;
  transition: background .12s;
}
.lb4-row:hover::before { background: #6366F1; }
.lb4-rank1::before { background: #F59E0B !important; }
.lb4-rank2::before { background: #94A3B8 !important; }
.lb4-rank3::before { background: #F97316 !important; }

.lb4-rank1 { background: linear-gradient(90deg, rgba(251,191,36,.06) 0%, #fff 55%); }
.lb4-rank2 { background: linear-gradient(90deg, rgba(148,163,184,.06) 0%, #fff 55%); }
.lb4-rank3 { background: linear-gradient(90deg, rgba(249,115,22,.05) 0%, #fff 55%); }

/* â”€â”€ Rank cell â”€â”€ */
.lb4-rank-cell {
  font-size: 1.1rem; text-align: center;
  display: flex; align-items: center; justify-content: center;
}
.lb4-rnum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: .7rem; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
}
/* â”€â”€ Class name â”€â”€ */
.lb4-class {
  font-size: .85rem; font-weight: 900; color: #0F172A;
  padding: 0 2px;
}
/* â”€â”€ Student cell â”€â”€ */
.lb4-student {
  display: flex; align-items: center; gap: 4px;
  overflow: hidden; padding: 0 4px;
}
.lb4-crown  { font-size: .8rem; flex-shrink: 0; }
.lb4-student > span.lb4-sttb { flex-shrink: 0; font-size: .72rem; font-weight: 900; }
.lb4-student > :not(.lb4-crown):not(.lb4-sttb) {
  font-size: .76rem; font-weight: 600; color: #1E293B;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* â”€â”€ Subject score cell â”€â”€ */
.lb4-subj {
  font-size: .76rem; font-weight: 800;
  text-align: center;
}
.lb4-empty { color: #CBD5E1 !important; font-weight: 400 !important; }

/* â”€â”€ KG% badge â”€â”€ */
.lb4-kg {
  font-size: .68rem; font-weight: 700; text-align: center;
  padding: 2px 3px; border-radius: 5px;
}
.lb4-hi { background: #D1FAE5; color: #065F46; }
.lb4-md { background: #DBEAFE; color: #1E40AF; }
.lb4-lo { background: #FEF9C3; color: #92400E; }

/* â”€â”€ Average score (ÄTB) â”€â”€ */
.lb4-avg {
  font-size: 1rem; font-weight: 900; text-align: right;
}
.lb4-avg-tot       { color: #059669; }
.lb4-avg-kha       { color: #2563EB; }
.lb4-avg-trungbinh { color: #D97706; }
.lb4-avg-yeu       { color: #DC2626; }

/* â”€â”€ Arrow â”€â”€ */
.lb4-arr {
  color: #CBD5E1; font-size: .9rem; text-align: center;
  transition: color .12s, transform .12s;
}
.lb4-row:hover .lb4-arr { color: #6366F1; transform: translateX(2px); }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   TICKER TABLE â€” Same grid principle
   col: [rank][name][class][T][V][A][S][L][H][Si][Ä][ÄTB]
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.lb4-thdr,
.lb4-trow {
  display: grid;
  grid-template-columns: 30px 1fr 56px repeat(8, 38px) 52px;
  align-items: center;
  gap: 0 2px;
  padding: 0 12px 0 8px;
  overflow: hidden;
}
.lb4-thdr {
  background: #F8FAFC;
  border-bottom: 2px solid #E2E8F0;
  padding-top: 5px; padding-bottom: 5px;
  position: sticky; top: 0; z-index: 2;
}
.lb4-thdr > span {
  font-size: .63rem; font-weight: 700;
  color: #94A3B8; text-transform: uppercase; letter-spacing: .04em;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb4-thdr > span:nth-child(2) { text-align: left; }

.lb4-trow {
  border-bottom: 1px solid #F1F5F9;
  text-decoration: none; color: inherit;
  min-height: 38px;
  transition: background .12s;
  position: relative; flex-shrink: 0;
}
.lb4-trow:hover { background: #F8FAFF; }
.lb4-trow::before {
  content: ''; position: absolute;
  left: 0; top: 4px; bottom: 4px; width: 3px;
  border-radius: 0 3px 3px 0; background: transparent;
}
.lb4-trow:hover::before { background: #7C3AED; }
.lb4-trow.lb4-rank1::before { background: #F59E0B !important; }
.lb4-trow.lb4-rank2::before { background: #94A3B8 !important; }
.lb4-trow.lb4-rank3::before { background: #F97316 !important; }
.lb4-trow.lb4-rank1 { background: linear-gradient(90deg, rgba(251,191,36,.06), #fff 55%); }
.lb4-trow.lb4-rank2 { background: linear-gradient(90deg, rgba(148,163,184,.06), #fff 55%); }
.lb4-trow.lb4-rank3 { background: linear-gradient(90deg, rgba(249,115,22,.05), #fff 55%); }

.lb4-tname {
  font-size: .8rem; font-weight: 700; color: #0F172A;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb4-tlop {
  padding: 2px 6px; border-radius: 6px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff; font-size: .64rem; font-weight: 800;
  text-align: center;
}

/* â”€â”€ lb4 layout tweaks: wider student name column, no wrap on left panel â”€â”€ */
.lb4-hdr,
.lb4-row {
  /* rank | class | student(wider) | 8 subjects | kg% | dtb | arrow */
  grid-template-columns: 28px 50px minmax(140px,1fr) repeat(8, 36px) 42px 50px 16px !important;
  gap: 0 1px !important;
}

/* Student cell: never wrap, truncate */
.lb4-student {
  white-space: nowrap;
  overflow: hidden;
}
.lb4-student > span:not(.lb4-crown):not(.lb4-sttb) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Subject scores: compact, no wrap */
.lb4-subj {
  overflow: hidden;
  white-space: nowrap;
  font-size: .72rem !important;
}

/* Right ticker: keep student name from wrapping */
.lb4-thdr, .lb4-trow {
  grid-template-columns: 28px minmax(130px,1fr) 52px repeat(8, 36px) 50px !important;
  gap: 0 1px !important;
}
.lb4-tname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keep ticker wrap tall enough for all 20 rows + header */

/* ============================================================
   LEADERBOARD FINAL v8 - Two-panel layout, compact 42px rows
   ============================================================ */

/* Wrapper: grid 50/50, left drives height */
.lb2-wrapper {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  align-items: start !important;
  gap: 0 !important;
}

/* LEFT section: auto height, no scroll */
.lb2-lop-section {
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
  min-width: 0 !important;
  height: auto !important;
}
.lb2-lop-list {
  overflow: visible !important;
  height: auto !important;
  flex: unset !important;
}

/* RIGHT section: JS sets height to match left panel */
.lb2-hs-section {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  min-width: 0 !important;
}

/* Ticker wrap: fills remaining height after header */
.lb2-ticker-wrap {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Ticker inner */
.lb2-ticker {
  display: flex !important;
  flex-direction: column !important;
  will-change: transform !important;
}

/* ══ ROW: single horizontal line, 42px ══ */
.lb5-card,
.lb5-trow {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  min-height: 42px !important;
  height: 42px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  padding: 0 10px 0 0 !important;
}

/* Hide old 2-row sub-elements */
.lb5-top, .lb5-bot, .lb5-tbot { display: none !important; }

/* ══ ZONE L: identity ══ */
.lb5-zone-l {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  overflow: hidden !important;
  padding-left: 8px !important;
}
.lb5-card .lb5-zone-l { flex: 0 0 210px !important; }
.lb5-trow .lb5-zone-l { flex: 0 0 195px !important; }

.lb5-zone-l .lb5-icon  { flex-shrink:0!important; font-size:1rem!important; width:26px!important; text-align:center!important; }
.lb5-zone-l .lb5-rnum  { width:19px!important; height:19px!important; font-size:.63rem!important; flex-shrink:0!important; }
.lb5-zone-l .lb5-cname { font-size:.88rem!important; font-weight:900!important; flex-shrink:0!important; color:#0F172A!important; }
.lb5-zone-l .lb5-tname { font-size:.8rem!important; font-weight:700!important; color:#0F172A!important; flex:1 1 auto!important; min-width:0!important; overflow:hidden!important; text-overflow:ellipsis!important; white-space:nowrap!important; }
.lb5-zone-l .lb5-tlop  { font-size:.62rem!important; padding:1px 6px!important; flex-shrink:0!important; }
.lb5-zone-l .lb5-hsn   { font-size:.73rem!important; font-weight:600!important; color:#334155!important; flex:1 1 auto!important; min-width:0!important; overflow:hidden!important; text-overflow:ellipsis!important; white-space:nowrap!important; }
.lb5-zone-l .lb5-sttb  { font-size:.71rem!important; font-weight:800!important; flex-shrink:0!important; }
.lb5-zone-l .lb5-bsep  { color:#CBD5E1!important; flex-shrink:0!important; font-size:.7rem!important; }
.lb5-zone-l .lb5-cr    { font-size:.78rem!important; flex-shrink:0!important; }

/* ══ ZONE M: pills ══ */
.lb5-zone-m {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 0 8px !important;
  overflow: hidden !important;
  justify-content: flex-start !important;
}
.lb5-zone-m .lb5-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  padding: 2px 7px !important;
  border-radius: 99px !important;
  border: 1px solid transparent !important;
  font-size: .66rem !important;
  font-weight: 600 !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}
.lb5-zone-m .lb5-pill strong { font-size: .69rem !important; font-weight: 900 !important; }

/* ══ ZONE R: score ══ */
.lb5-zone-r {
  flex: 0 0 52px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 3px !important;
}
.lb5-zone-r .lb5-avg { font-size: 1rem !important; font-weight: 900 !important; }
.lb5-zone-r .lb5-arr { color:#CBD5E1; font-size:.9rem; transition: color .12s, transform .12s; }
.lb5-card:hover .lb5-zone-r .lb5-arr { color:#6366F1; transform:translateX(2px); }
/* ══ HEADER: 2-line (title + column labels) ══ */
.lb2-sec-header {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 14px !important;
  flex-shrink: 0 !important;
}
.lb2-hdr-text {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
}
.lb2-hdr-title { font-size: .84rem !important; font-weight: 800 !important; color: #fff !important; letter-spacing: .01em !important; }

/* Column labels row */
.lb2-hdr-cols {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: .62rem !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,.75) !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}
.lb2-hdr-cols .lb2-col-sep {
  color: rgba(255,255,255,.4) !important;
  font-size: .55rem !important;
}
.lb2-hdr-cols .lb2-col-flex {
  flex: 1 !important;
  text-align: center !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.lb2-hdr-cols > span:last-child { margin-left: auto !important; }

/* ══ ZONE-L: Cột định danh có separator rõ ràng ══ */

/* Bảng trái: rank | lớp | sep | 👑 | tên | ĐTB */
.lb5-card .lb5-zone-l {
  flex: 0 0 220px !important;
  display: flex !important;
  align-items: center !important;
  gap: 0 !important;
  padding-left: 8px !important;
  overflow: hidden !important;
}
.lb5-card .lb5-zone-l > * { flex-shrink: 0 !important; }
.lb5-card .lb5-zone-l .lb5-icon  { width: 24px !important; text-align: center !important; }
.lb5-card .lb5-zone-l .lb5-cname { font-size: .86rem !important; font-weight: 900 !important; color: #0F172A !important; padding: 0 5px 0 4px !important; }

/* Separator pipe giữa lớp và tên */
.lb5-card .lb5-zone-l .lb5-bsep {
  color: #CBD5E1 !important;
  font-size: .9rem !important;
  margin: 0 4px !important;
  flex-shrink: 0 !important;
}
.lb5-card .lb5-zone-l .lb5-cr    { font-size: .75rem !important; margin-right: 2px !important; }
.lb5-card .lb5-zone-l .lb5-hsn  {
  font-size: .76rem !important; font-weight: 600 !important; color: #334155 !important;
  flex: 1 1 auto !important; min-width: 0 !important;
  overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important;
}
.lb5-card .lb5-zone-l .lb5-sttb {
  font-size: .7rem !important; font-weight: 800 !important;
  padding: 1px 4px !important;
  border-radius: 4px !important;
  background: #F1F5F9 !important;
  margin-left: 3px !important;
  flex-shrink: 0 !important;
}
.lb5-card .lb5-zone-l .lb5-sttb.tot-text    { background: #D1FAE5 !important; color: #065F46 !important; }
.lb5-card .lb5-zone-l .lb5-sttb.kha-text    { background: #DBEAFE !important; color: #1E40AF !important; }
.lb5-card .lb5-zone-l .lb5-sttb.trungbinh-text { background: #FEF9C3 !important; color: #92400E !important; }

/* Bảng phải: rank | tên | badge lớp */
.lb5-trow .lb5-zone-l {
  flex: 0 0 205px !important;
  display: flex !important;
  align-items: center !important;
  gap: 0 !important;
  padding-left: 8px !important;
  overflow: hidden !important;
}
.lb5-trow .lb5-zone-l > * { flex-shrink: 0 !important; }
.lb5-trow .lb5-zone-l .lb5-icon { width: 24px !important; text-align: center !important; }
.lb5-trow .lb5-zone-l .lb5-tname {
  font-size: .77rem !important; font-weight: 700 !important; color: #0F172A !important;
  flex: 1 1 auto !important; min-width: 0 !important;
  overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important;
  padding: 0 4px !important;
}
.lb5-trow .lb5-zone-l .lb5-tlop {
  font-size: .61rem !important; padding: 1px 5px !important;
  border-radius: 5px !important;
  background: linear-gradient(135deg,#4F46E5,#7C3AED) !important;
  color: #fff !important; font-weight: 800 !important;
  margin-left: 3px !important;
  white-space: nowrap !important;
}
/* ══ Zone-L width adjustment: give more room to names ══ */
.lb5-card .lb5-zone-l { flex: 0 0 248px !important; }
.lb5-trow .lb5-zone-l { flex: 0 0 232px !important; }

/* Zone-M slightly smaller pills to save space */
.lb5-zone-m .lb5-pill {
  padding: 2px 5px !important;
  font-size: .64rem !important;
  gap: 2px !important;
}
.lb5-zone-m .lb5-pill strong { font-size: .68rem !important; }

/* Ensure Zone-R stays compact */
.lb5-zone-r { flex: 0 0 48px !important; }
/* ══════════════════════════════
   LEADERBOARD HEADER: 2-BAR DESIGN
   ══════════════════════════════ */

/* Bar 1: Info (icon + title + badge) */
.lb2-info-bar {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 14px !important;
  flex-shrink: 0 !important;
  border-radius: 12px 12px 0 0 !important;
}
.lb2-info-bar .lb2-hdr-title {
  flex: 1 !important;
  font-size: .88rem !important;
  font-weight: 800 !important;
  color: #fff !important;
  letter-spacing: .01em !important;
}

/* Bar 2: Column labels - mirrors the Zone-L / Zone-M / Zone-R layout */
.lb2-col-bar {
  display: flex !important;
  align-items: center !important;
  padding: 5px 10px 5px 8px !important;
  flex-shrink: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,.12) !important;
}
.lb2-colbar-blue   { background: rgba(255,255,255,.12) !important; }
.lb2-colbar-purple { background: rgba(255,255,255,.12) !important; }

/* Col label items - widths must match Zone-L / Zone-M / Zone-R */
.lb2-cb-rank {
  flex: 0 0 24px !important;
  text-align: center !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.8) !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
}
.lb2-cb-identity {
  /* matches Zone-L for lb5-card (248px) and lb5-trow (232px) */
  flex: 0 0 220px !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.8) !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
  padding-left: 6px !important;
}
.lb2-cb-scores {
  flex: 1 !important;
  text-align: center !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.8) !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
}
.lb2-cb-avg {
  flex: 0 0 52px !important;
  text-align: right !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.8) !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
  padding-right: 6px !important;
}

/* Bo tron goc tren bang trai giong bang phai */
.lb2-lop-section { border-radius: 12px !important; }
.lb2-hs-section  { border-radius: 12px !important; }
/* ══ COL-BAR: mirror Zone-L/M/R widths exactly ══ */
/* Reset col-bar padding so spans align with data rows */
.lb2-col-bar {
  display: flex !important;
  align-items: center !important;
  padding: 4px 0 !important;
  flex-shrink: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,.15) !important;
}

/* Override old cb- classes */
.lb2-cb-rank, .lb2-cb-identity, .lb2-cb-scores, .lb2-cb-avg { display: none !important; }

/* Zone-L mirror: left panel = 248px, right panel = 232px */
.lb2-cb-lz {
  flex: 0 0 248px !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.85) !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  padding-left: 8px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.lb2-cb-lz-r {
  flex: 0 0 232px !important;
}

/* Zone-M mirror: flex:1, same padding as lb5-zone-m */
.lb2-cb-mz {
  flex: 1 1 auto !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.85) !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  text-align: center !important;
  padding: 0 8px !important;
}

/* Zone-R mirror: 48px, right-aligned */
.lb2-cb-rz {
  flex: 0 0 48px !important;
  font-size: .6rem !important;
  font-weight: 700 !important;
  color: rgba(255,255,255,.85) !important;
  text-transform: uppercase !important;
  letter-spacing: .05em !important;
  text-align: right !important;
  padding-right: 4px !important;
}
/* ══ FIX: Info-bar compact (1 line) + col-bar visible ══ */

/* Info-bar: giam padding de thanh 1 dong mong */
.lb2-info-bar {
  padding: 7px 12px !important;
  gap: 8px !important;
  min-height: 0 !important;
  border-radius: 12px 12px 0 0 !important;
}
.lb2-info-bar .lb2-hdr-icon-wrap { line-height: 1; }
.lb2-hdr-icon { font-size: 1.1rem !important; }
.lb2-info-bar .lb2-hdr-title {
  font-size: .82rem !important;
  font-weight: 700 !important;
}
.lb2-hdr-badge {
  padding: 2px 10px !important;
  font-size: .7rem !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}

/* Col-bar: nen toi ro hon, chu trang dam, khong dung mau nhat */
.lb2-col-bar {
  background: rgba(0,0,0,.25) !important;
  padding: 5px 0 5px 0 !important;
  border-bottom: none !important;
  border-top: 1px solid rgba(255,255,255,.1) !important;
}

/* Cac nhan cot: chu trang ro hon, size vua */
.lb2-cb-lz, .lb2-cb-mz, .lb2-cb-rz {
  font-size: .62rem !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,.95) !important;
  text-transform: uppercase !important;
  letter-spacing: .07em !important;
}

/* Can giua Zone-M nhan 'Diem cac mon' */
.lb2-cb-mz { text-align: center !important; padding: 0 8px !important; }

/* DTB ben phai */
.lb2-cb-rz { text-align: right !important; padding-right: 6px !important; }

/* Zone-L labels: padding trai khop voi du lieu */
.lb2-cb-lz { padding-left: 8px !important; }
/* ══ FINAL FIX: info-bar super compact + col-bar 4-col aligned ══ */

/* === INFO BAR: canh giua, gon nhe === */
.lb2-info-bar {
  padding: 5px 12px !important;
  gap: 7px !important;
  border-radius: 12px 12px 0 0 !important;
  min-height: 0 !important;
  line-height: 1.2 !important;
  justify-content: center !important;
}
.lb2-hdr-icon-wrap {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.lb2-hdr-icon { font-size: .82rem !important; line-height: 1 !important; }
.lb2-info-bar .lb2-hdr-title {
  font-size: .74rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  flex: unset !important;
  white-space: nowrap !important;
}
.lb2-hdr-badge {
  padding: 2px 7px !important;
  font-size: .62rem !important;
  font-weight: 800 !important;
  border-radius: 20px !important;
  flex-shrink: 0 !important;
}

/* === COL-BAR: 4 span rieng, nen sang phu hop, chu mau dam === */
.lb2-col-bar {
  display: flex !important;
  align-items: center !important;
  padding: 4px 0 !important;
  background: rgba(255,255,255,.15) !important;
  border-bottom: 1px solid rgba(255,255,255,.1) !important;
  /* Huy bo mau nen toi cu */
}

/* Override tat ca class col-bar cu */
.lb2-colbar-blue, .lb2-colbar-purple,
.lb2-cb-lz, .lb2-cb-mz, .lb2-cb-rz,
.lb2-cb-rank, .lb2-cb-identity, .lb2-cb-scores, .lb2-cb-avg { display: none !important; }

/* === 4 SPAN MOI === */
/* Span 1: HANG - khop voi lb5-icon (width:24px + padding-left:8px) */
.lb2-cb-rank {
  display: flex !important;
  flex: 0 0 32px !important;
  justify-content: center !important;
  font-size: .58rem !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,.95) !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
}

/* Span 2: LOP & HOC SINH - khop phan con lai cua zone-l trai (248-32=216px) */
.lb2-cb-id {
  display: flex !important;
  flex: 0 0 216px !important;
  font-size: .58rem !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,.95) !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  padding-left: 2px !important;
}
/* Bảng phải: zone-l=232px, nen 232-32=200px */
.lb2-cb-id-r { flex: 0 0 200px !important; }

/* Span 3: DIEM MON - khop zone-m (flex:1), padding 0 8px */
.lb2-cb-pills {
  display: flex !important;
  flex: 1 1 auto !important;
  justify-content: center !important;
  font-size: .58rem !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,.95) !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
}

/* Span 4: DTB - khop zone-r (48px), right-align */
.lb2-cb-dtb {
  display: flex !important;
  flex: 0 0 48px !important;
  justify-content: flex-end !important;
  padding-right: 6px !important;
  font-size: .58rem !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,.95) !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
}
/* ══════════════════════════════════════════════════════════
   COL-BAR REDESIGN: gradient header extension + nhan cot ro rang
   ══════════════════════════════════════════════════════════ */

/* === SECTION: bo rong gradient xuong col-bar === */
/* Dung lb2-lop-section de bao gom ca col-bar trong gradient */
.lb2-lop-section {
  background: linear-gradient(160deg,
    #1E40AF 0%,
    #3B82F6 40%,
    #6366F1 70%,
    #8B5CF6 100%
  ) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}
.lb2-hs-section {
  background: linear-gradient(160deg,
    #92400E 0%,
    #D97706 35%,
    #F59E0B 70%,
    #F97316 100%
  ) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

/* Info-bar: transparent (lay gradient tu section) */
.lb2-header-blue, .lb2-header-purple {
  background: transparent !important;
  box-shadow: none !important;
}

/* Col-bar: overlay toi, border sep dep, giua info-bar va data */
.lb2-col-bar {
  background: rgba(0, 0, 0, 0.32) !important;
  backdrop-filter: blur(6px) !important;
  border-top: 1px solid rgba(255,255,255,.22) !important;
  border-bottom: 3px solid rgba(0,0,0,.12) !important;
  padding: 6px 0 !important;
}

/* Data rows phai co nen trang rieng, do section gio la gradient */
.lb2-lop-list, .lb2-ticker-wrap {
  background: #fff !important;
  border-radius: 0 0 12px 12px !important;
}

/* === NHAN COT: trang, dam, uppercase, ro rang === */
.lb2-cb-rank,
.lb2-cb-id, .lb2-cb-id-r,
.lb2-cb-pills,
.lb2-cb-dtb {
  display: flex !important;
  font-size: .6rem !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  text-transform: uppercase !important;
  letter-spacing: .09em !important;
  text-shadow: 0 1px 4px rgba(0,0,0,.5) !important;
}

/* width chinh xac khop voi Zone-L/M/R */
.lb2-cb-rank   { flex: 0 0 32px !important; justify-content: center !important; }
.lb2-cb-id     { flex: 0 0 216px !important; padding-left: 2px !important; }
.lb2-cb-id-r   { flex: 0 0 200px !important; }
.lb2-cb-pills  { flex: 1 1 auto !important; justify-content: center !important; }
.lb2-cb-dtb    { flex: 0 0 48px !important; justify-content: flex-end !important; padding-right: 6px !important; }

/* Tat class cu tranh conflict */
.lb2-cb-lz, .lb2-cb-lz-r, .lb2-cb-mz, .lb2-cb-rz,
.lb2-cb-identity, .lb2-cb-scores, .lb2-cb-avg { display: none !important; }

/* === old lb2-rank class off === */
.lb2-colbar-blue, .lb2-colbar-purple { background: transparent !important; }
/* ══ FIX: Col-bar bang phai (hs-section) lay mau purple ══ */
/* Col-bar mac dinh cho lb2-lop-section (blue) */
.lb2-lop-section .lb2-col-bar {
  background: rgba(30, 64, 175, 0.85) !important;
  border-top: 1px solid rgba(255,255,255,.25) !important;
  border-bottom: 2px solid rgba(0,0,0,.15) !important;
}

/* Col-bar cho lb2-hs-section (purple) */
.lb2-hs-section .lb2-col-bar {
  background: rgba(88, 28, 135, 0.85) !important;
  border-top: 1px solid rgba(255,255,255,.25) !important;
  border-bottom: 2px solid rgba(0,0,0,.15) !important;
}

/* Thuo bo backdrop-filter chung vi co the khong co hieu ung */
.lb2-col-bar {
  backdrop-filter: none !important;
}

/* Dam bao nhan cot van trang ro rang */
.lb2-cb-rank,
.lb2-cb-id, .lb2-cb-id-r,
.lb2-cb-pills,
.lb2-cb-dtb {
  color: rgba(255,255,255,1) !important;
  text-shadow: 0 1px 3px rgba(0,0,0,.6) !important;
}
/* ══ PIXEL-PERFECT FIX: col-bar align voi data rows ══
   Browser measurement: icon starts at 9px, col-bar at 1px → need padding-left:8px
   cb-rank = 24px (matches lb5-icon width)
   cb-id = 248-24 = 224px (left), 232-24 = 208px (right)
*/

/* Col-bar: them padding-left:8px khop voi card padding */
.lb2-lop-section .lb2-col-bar,
.lb2-hs-section  .lb2-col-bar {
  padding-left: 8px !important;
  padding-right: 0 !important;
}

/* cb-rank: dung 24px = lb5-icon width, center */
.lb2-cb-rank {
  flex: 0 0 24px !important;
  justify-content: center !important;
}

/* cb-id bang trai: 248 - 24 = 224px */
.lb2-cb-id {
  flex: 0 0 224px !important;
  padding-left: 0 !important;
}

/* cb-id bang phai: 232 - 24 = 208px */
.lb2-cb-id-r {
  flex: 0 0 208px !important;
}

/* cb-pills: flex:1 da dung, chi dam bao center */
.lb2-cb-pills { flex: 1 1 auto !important; justify-content: center !important; }

/* cb-dtb: 48px, khop zone-r */
.lb2-cb-dtb { flex: 0 0 48px !important; justify-content: flex-end !important; padding-right: 4px !important; }

/* ══════════════════════════════════════════════════════════
   📱 MOBILE FIX: Xếp hạng theo Lớp + Bảng xếp hạng Toàn trường
   Trên mobile: hiển thị 1 cột (dọc) thay vì 2 cột ngang
   Điểm các môn vẫn hiển thị đầy đủ - wrap xuống dòng 2
   ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Wrapper: 1 cột dọc ── */
  .lb2-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    height: auto !important;
  }

  /* ── Mỗi section: full width ── */
  .lb2-lop-section,
  .lb2-hs-section {
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    height: auto !important;
  }

  /* ── Danh sách lớp: không giới hạn chiều cao ── */
  .lb2-lop-list {
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
    flex: unset !important;
  }

  /* ── Bảng toàn trường: cuộn được ── */
  .lb2-ticker-wrap {
    height: 520px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: unset !important;
  }

  /* ── Card/Row: 2 dòng bằng flex-wrap ──
     Dòng 1: [Zone-L tên/lớp flex:1] + [Zone-R ĐTB flex-shrink:0]
     Dòng 2: [Zone-M pills - flex:0 0 100% → buộc wrap]          */
  .lb5-card,
  .lb5-trow {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 8px 10px 7px !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  /* Dòng 1 - trái: identity (Zone-L) - flex:1 co giãn */
  .lb5-zone-l,
  .lb5-card .lb5-zone-l,
  .lb5-trow .lb5-zone-l {
    order: 1 !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding-left: 8px !important;
    padding-right: 0 !important;
  }

  /* Tên không bị cắt quá sớm */
  .lb5-zone-l .lb5-hsn   { max-width: none !important; }
  .lb5-zone-l .lb5-tname { max-width: none !important; }

  /* Dòng 1 - phải: ĐTB (Zone-R) - flex-shrink:0, không wrap */
  .lb5-zone-r {
    order: 2 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 44px !important;
    padding-right: 2px !important;
  }

  /* Dòng 2: pills điểm các môn - 100% width → buộc xuống dòng mới */
  .lb5-zone-m {
    order: 3 !important;
    flex: 0 0 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    padding: 6px 8px 2px !important;
    overflow: visible !important;
    justify-content: flex-start !important;
  }

  /* Pills gọn trên mobile */
  .lb5-zone-m .lb5-pill {
    font-size: .62rem !important;
    padding: 2px 5px !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }
  .lb5-zone-m .lb5-pill strong { font-size: .64rem !important; }

  /* Col-bar: ẩn nhãn "Điểm các môn" (pills đã ở dòng 2) */
  .lb2-cb-pills { display: none !important; }

  /* cb-id mở rộng chiếm phần còn lại */
  .lb2-cb-id   { flex: 1 1 auto !important; }
  .lb2-cb-id-r { flex: 1 1 auto !important; }
  .lb2-cb-dtb  { flex: 0 0 56px !important; }
}

/* ══ FINAL OVERRIDE: Info-bar canh giữa + compact ══ */
.lb2-info-bar {
  justify-content: center !important;
  padding: 4px 12px !important;
  gap: 7px !important;
}
.lb2-info-bar .lb2-hdr-icon-wrap {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
}
.lb2-hdr-icon { font-size: .78rem !important; }
.lb2-info-bar .lb2-hdr-title {
  flex: unset !important;
  font-size: .73rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}
.lb2-hdr-badge {
  flex-shrink: 0 !important;
  font-size: .61rem !important;
  padding: 2px 7px !important;
}