:root {
  /* ============================================================================
     DESIGN TOKENS v2 - Modern SaaS Dashboard (tham khảo tinh thần bố cục/khoảng cách
     của các dashboard quản trị hiện đại dạng sidebar + accent xanh, không sao chép
     thương hiệu/asset của bất kỳ sản phẩm cụ thể nào).
     Toàn bộ TÊN biến cũ được GIỮ NGUYÊN (bảo toàn mọi nơi đang dùng var(--primary),
     var(--navy), var(--danger,#dc2626)...) - chỉ cập nhật GIÁ TRỊ + bổ sung biến mới.
     ============================================================================ */
  --primary: #2563EB;      /* Accent Blue - trước là navy đậm #1E3A8A, nay là xanh hiện đại làm màu chủ đạo */
  --navy: #1E3A8A;         /* giữ lại làm màu "đậm" phụ trợ (gradient login, số liệu nhấn mạnh...) */
  --navy-light: #2563EB;   /* alias trỏ về --primary để mọi nơi dùng var(--navy-light) tự động đồng bộ accent mới */
  --primary-hover: #1D4ED8;
  --primary-soft: #EFF6FF; /* nền highlight nhạt cho hover/active (sidebar, tab, chip...) */
  --emerald: #059669;      /* Accent phụ (tuỳ chọn) - dùng cho các điểm nhấn "thành công/khảo thí" nếu cần tách biệt với --primary */
  --cyan: #06B6D4;
  --teal: #0D9488;
  --amber: #F59E0B;
  --coral: #F97316;
  --danger: #dc2626;
  --success: #16a34a;
  --bg: #F8FAFC;
  --bg-alt: #F1F5F9;
  --border: #e2e8f0;
  --text: #1e293b;

  /* ---- Neutrals (thang xám Slate) dùng cho icon/label trạng thái mặc định & phụ ---- */
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;

  /* ---- Bo góc & đổ bóng chuẩn hoá (card viền mỏng, bo góc rounded-xl, shadow tinh tế) ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 6px 16px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.14);

  /* ---- Thang khoảng cách (spacing scale 4px) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ---- Kích thước khung Sidebar / Topbar / Mobile Bottom Nav ---- */
  --sidebar-w: 264px;
  --sidebar-w-mini: 76px;
  --topbar-h: 64px;
  --sidebar-brand-h: 64px;
  --bottom-nav-h: 60px;
  --touch-target: 46px; /* chuẩn 44-48px cho nút/input/dropdown trên mobile */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- LOGIN ---------- */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy), var(--teal)); }
.login-box { background: #fff; padding: 40px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); width: 380px; }
.login-box h1 { font-size: 20px; color: var(--navy); text-align: center; margin-bottom: 4px; }
.login-box p.subtitle { text-align: center; color: #6b7280; font-size: 13px; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.pass-field-wrap { position: relative; }
.pass-field-wrap input { width: 100%; padding-right: 40px; }
.pass-field-wrap .eye-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 15px; padding: 4px 8px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 6px; color: #374151; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}

.btn { display: inline-block; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; font-weight: 600; transition: 0.15s; }
.btn-primary { background: var(--navy-light); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--navy); }
.btn-accent { background: var(--amber); color: #fff; }
.btn-accent:hover { background: var(--coral); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; border: none; cursor: pointer; }
.btn-xs-danger { background: #fee2e2; color: var(--danger); }
.btn-xs-primary { background: #dbeafe; color: var(--navy-light); }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 16px; }
.demo-hint { margin-top: 20px; font-size: 12px; color: #9ca3af; text-align: center; line-height: 1.6; }

/* ---------- TOPBAR & NAV ---------- */
.topbar { background: var(--navy); color: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.topbar .title { font-weight: 600; font-size: 15px; }
.topbar .user-info { font-size: 13px; display: flex; align-items: center; gap: 12px; }
.topbar button.logout { background: rgba(255,255,255,0.15); color: #fff; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; }

/* ==== Toolbar cố định: chuông / chat / avatar dropdown (chèn tự động bởi nav.js) ==== */
.topbar-extras { display: flex; align-items: center; gap: 6px; }
.tb-icon-wrap { position: relative; }
.tb-icon-btn { background: rgba(255,255,255,0.12); border: none; color: #fff; font-size: 16px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; position: relative; }
.tb-icon-btn:hover { background: rgba(255,255,255,0.22); }
.tb-badge { position: absolute; top: -2px; right: -2px; background: var(--danger, #dc2626); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; min-width: 16px; text-align: center; }
.tb-avatar-btn { background: none; border: none; cursor: pointer; padding: 0; }
.tb-avatar-circle { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--amber, #f59e0b); color: #1e293b; font-weight: 700; font-size: 14px; }
.tb-dropdown { display: none; position: absolute; top: 42px; right: 0; background: #fff; color: var(--text, #1f2937); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); min-width: 220px; z-index: 60; overflow: hidden; padding: 6px 0; }
.tb-dropdown.open { display: block; }
.tb-dropdown-right { right: 0; left: auto; }
.tb-dropdown-empty { padding: 14px; font-size: 12px; color: #9ca3af; text-align: center; }
.tb-dropdown-header { padding: 10px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.tb-dropdown-item { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 14px; font-size: 13px; cursor: pointer; color: var(--text, #1f2937); }
.tb-dropdown-item:hover { background: #f1f5f9; }
.tb-dropdown-danger { color: var(--danger, #dc2626); }
.tb-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.6); display: flex; align-items: center; justify-content: center; z-index: 70; }
.tb-modal-box { background: #fff; border-radius: 16px; padding: 24px; width: 340px; }
.tb-modal-box h3 { margin-top: 0; }

/* ==== Floating Chatbox kiểu Facebook: cố định góc dưới-phải, KHÔNG dùng backdrop nên không chặn thao tác
   với phần còn lại của trang (khác với .tb-modal-backdrop dùng cho các modal Hồ sơ/Avatar/Đổi mật khẩu). ==== */
.fb-chatbox { position: fixed; bottom: 0; right: 20px; width: 320px; max-width: 92vw; background: #fff;
  border-radius: 10px 10px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,0.18); z-index: 1050; display: flex;
  flex-direction: column; overflow: hidden; }
.fb-chatbox-header { background: var(--primary); color: #fff; padding: 10px 12px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; cursor: pointer; user-select: none; }
.fb-chatbox-header .fb-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fb-chatbox-header .fb-actions { display: flex; gap: 4px; flex-shrink: 0; }
.fb-chatbox-header .fb-actions button { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 22px;
  height: 22px; border-radius: 4px; cursor: pointer; font-size: 12px; line-height: 1; }
.fb-chatbox-header .fb-actions button:hover { background: rgba(255,255,255,0.32); }
.fb-chatbox-body { display: flex; flex-direction: column; height: 400px; }
.fb-chatbox.minimized .fb-chatbox-body { display: none; }
.fb-chatbox-messages { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column;
  gap: 8px; background: #f8fafc; }
.fb-chatbox-inputrow { padding: 8px 10px; border-top: 1px solid #f1f5f9; display: flex; gap: 6px; background: #fff; }
.fb-chatbox-inputrow input { flex: 1; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 18px; font-size: 13px; }
.fb-chatbox-inputrow button { border: none; background: var(--primary); color: #fff; width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 14px; flex-shrink: 0; }
.fb-chatbox-inputrow button:hover { opacity: 0.9; }
.role-chip { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--amber); color: #fff; font-weight: 700; text-transform: uppercase; }

/* ==== Hàng 1 tin nhắn trong cửa sổ chat nổi: avatar (chỉ đoạn chat riêng - DIRECT) + bong bóng nội dung + giờ gửi.
   Nhóm lớp (GROUP) không có avatar ở đây - giữ nguyên kiểu hiển thị cũ (chỉ tên người gửi dạng chữ). ==== */
.fb-msg-row { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.fb-msg-row.mine { justify-content: flex-end; }
.fb-msg-col { display: flex; flex-direction: column; max-width: 80%; gap: 3px; }
.fb-msg-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--amber, #f59e0b); color: #1e293b;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  overflow: hidden; }
.fb-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ==== Chấm tròn trạng thái Online/Offline - dùng CHUNG toàn hệ thống (classrooms.html, Bong bóng chat nổi...) ==== */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online { background: #16a34a; box-shadow: 0 0 0 2px rgba(22,163,74,0.15); }
.status-dot.offline { background: #9ca3af; }

/* ==== Nút tròn nổi (FAB) góc dưới-phải: điểm truy cập DUY NHẤT, LUÔN hiển thị trên mọi trang đã đăng nhập,
   gộp chung "Ai đang online" (nhắn nhanh) + "Đoạn chat" (lịch sử) - giống bong bóng Messenger của Facebook. ==== */
.fb-fab-btn { position: fixed; bottom: 20px; right: 24px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 24px; z-index: 1040;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25); display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s; padding: 0; }
.fb-fab-btn:hover { transform: scale(1.06); }
.fb-fab-btn .tb-badge { top: -2px; right: -2px; }

.fb-fab-panel { position: fixed; bottom: 88px; right: 24px; width: 320px; max-width: 92vw; max-height: 460px;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,0.22); z-index: 1039; overflow: hidden;
  display: flex; flex-direction: column; }
.fb-fab-panel-header { background: var(--primary); color: #fff; padding: 12px 14px; font-size: 14px; font-weight: 700;
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fb-fab-panel-close { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 22px; height: 22px;
  border-radius: 4px; cursor: pointer; font-size: 12px; line-height: 1; flex-shrink: 0; }
.fb-fab-panel-close:hover { background: rgba(255,255,255,0.32); }
.fb-fab-panel-tabs { display: flex; border-bottom: 1px solid var(--border, #e5e7eb); flex-shrink: 0; }
.fb-fab-panel-tabs button { flex: 1; border: none; background: none; padding: 10px; font-size: 12px; font-weight: 600;
  color: #9ca3af; cursor: pointer; border-bottom: 2px solid transparent; }
.fb-fab-panel-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.fb-fab-panel-body { flex: 1; overflow-y: auto; }
.fb-fab-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.fb-fab-list-item:hover { background: #f1f5f9; }
.fb-fab-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amber, #f59e0b);
  color: #1e293b; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
  flex-shrink: 0; position: relative; overflow: hidden; }
.fb-fab-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fb-fab-avatar .status-dot { position: absolute; bottom: -1px; right: -1px; border: 2px solid #fff; }
.fb-fab-list-item .fb-fab-info { min-width: 0; flex: 1; overflow: hidden; }
.fb-fab-list-item .fb-fab-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-fab-list-item .fb-fab-sub { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-fab-empty { padding: 28px 14px; text-align: center; font-size: 12px; color: #9ca3af; }


.app-nav { background: #fff; border-bottom: 1px solid var(--border); display: flex; gap: 4px; padding: 0 20px; overflow-x: auto; }
.app-nav-link { display: inline-block; padding: 12px 16px; font-size: 13px; color: #4b5563; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.app-nav-link:hover { color: var(--navy-light); }
.app-nav-link.active { color: var(--navy-light); border-bottom-color: var(--navy-light); font-weight: 600; }

/* ---------- LAYOUT ---------- */
/* FIX #1: margin cố định 2 bên (32px) làm nội dung KHÔNG được căn giữa phần
   không gian còn lại sau khi body.has-sidebar đẩy nội dung sang phải bằng
   padding-left -> Heading/card bị dồn sát lề trái, mất cân đối 2 bên.
   Đổi sang margin: auto để container luôn tự căn giữa vùng làm việc. */
.container { max-width: 1400px; margin: 24px auto; padding: 0 24px; }
.card { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); text-align: center; }
.stat-card .value { font-size: 28px; font-weight: 800; color: var(--navy-light); }
.stat-card .label { font-size: 12px; color: #6b7280; margin-top: 4px; }

.simple-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.simple-table th { text-align: left; font-size: 12px; color: #6b7280; padding: 10px 8px; border-bottom: 2px solid var(--bg-alt); }
.simple-table td { padding: 10px 8px; font-size: 13px; border-bottom: 1px solid var(--bg-alt); }
.simple-table tr:hover td { background: var(--bg-alt); }
.simple-table td.col-class { max-width: 180px; white-space: normal; line-height: 1.35; }
.action-cell { display: flex; gap: 4px; white-space: nowrap; flex-wrap: wrap; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }

.empty-state { text-align: center; padding: 40px 20px; color: #9ca3af; font-size: 13px; }

.status-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-badge.open { background: #dcfce7; color: var(--success); }
.status-badge.closed { background: #fee2e2; color: var(--danger); }
.status-badge.not_open_yet { background: #fef3c7; color: #b45309; }
.status-badge.inactive { background: #f1f5f9; color: #9ca3af; }

.exam-list-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--bg-alt); flex-wrap: wrap; gap: 10px; }
.exam-list-item:last-child { border-bottom: none; }
.exam-list-item .info h3 { margin: 0 0 4px; font-size: 15px; }
.exam-list-item .info span { font-size: 12px; color: #6b7280; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #d1d5db; border-radius: 24px; transition: 0.2s; }
.slider::before { position: absolute; content: ''; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: #fff; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .slider { background-color: var(--success); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.toggle-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--bg-alt); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-info h4 { margin: 0 0 4px; font-size: 14px; }
.toggle-row .toggle-info p { margin: 0; font-size: 12px; color: #6b7280; }

/* FIX #3: đã gộp .detail-table thành MỘT định nghĩa duy nhất (xem khối
   "DETAIL TABLE — chuẩn hoá" phía dưới) để tránh 3 rule .detail-table
   chồng chéo/ghi đè nhau gây co dãn cột bất thường & rớt dòng từng chữ. */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.correct { background: #dcfce7; color: var(--success); }
.badge.wrong { background: #fee2e2; color: var(--danger); }
.badge.empty { background: var(--bg-alt); color: #9ca3af; }
.qtype-tag { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #e0f2fe; color: var(--navy); margin-left: 6px; font-weight: 600; }

.result-score { text-align: center; padding: 30px 0; }
.result-score .big-score { font-size: 56px; font-weight: 800; color: var(--navy-light); }
.result-score .sub { color: #6b7280; font-size: 14px; }

/* =======================================================
   PHÒNG THI - Phiếu trả lời trắc nghiệm (gọn, giống mockup)
   ======================================================= */
.exam-topbar { background: var(--navy); color: #fff; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.exam-topbar .exam-name { font-size: 14px; font-weight: 600; }
.timer-box { background: rgba(255,255,255,0.15); padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 16px; letter-spacing: 1px; color: var(--amber); }
.timer-box.warning { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%{opacity:1;} 50%{opacity:0.6;} 100%{opacity:1;} }

.exam-split { display: flex; height: calc(100vh - 52px - 40px); }
.exam-view-toolbar { background: #1e293b; display: flex; gap: 8px; padding: 6px 14px; justify-content: center; flex-wrap: wrap; position: sticky; top: 52px; z-index: 9; }
.exam-view-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #334155; color: #fff; border: none; border-radius: 6px;
  padding: 7px 12px; font-size: 12px; cursor: pointer; font-weight: 600;
  white-space: nowrap;
}
.exam-view-toolbar button:hover { background: #475569; }
.exam-view-toolbar button.active { background: var(--navy-light); }
.exam-view-toolbar button .btn-icon { flex-shrink: 0; }
.split-resizer { width: 6px; cursor: col-resize; background: var(--border); flex-shrink: 0; touch-action: none; }
.split-resizer:hover, .split-resizer.dragging { background: var(--navy-light); }
@media (hover: none) { .split-resizer { width: 16px; } }
.exam-split.view-pdf-only .answer-pane, .exam-split.view-pdf-only .split-resizer { display: none; }
.exam-split.view-pdf-only .pdf-pane { flex: 1 1 100% !important; }
.exam-split.view-sheet-only .pdf-pane, .exam-split.view-sheet-only .split-resizer { display: none; }
.exam-split.view-sheet-only .answer-pane { flex: 1 1 100% !important; }
.pdf-pane { flex: 1.3; border-right: 2px solid var(--border); background: #525659; display: flex; flex-direction: column; }
.pdf-toolbar { background: #323639; color: #fff; padding: 8px 14px; display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 13px; flex-wrap: wrap; }
.pdf-btn { background: #4b5054; color: #fff; border: none; border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.pdf-btn:hover { background: #5c6266; }
.pdf-page-info, .pdf-zoom-group { display: flex; align-items: center; gap: 6px; }
.pdf-page-info input { width: 44px; text-align: center; border-radius: 4px; border: none; padding: 3px; }
.pdf-canvas-wrap { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 16px; }
.pdf-canvas-wrap canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.pdf-loading { color: #fff; text-align: center; padding: 20px; font-size: 13px; }

.answer-pane { flex: 1; overflow-y: auto; padding: 18px 20px; background: #fff; display: flex; flex-direction: column; }
.answer-pane-header h3 { font-size: 16px; margin: 0 0 6px; color: var(--text); }
.answer-progress-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.answer-progress-row .pct { color: var(--navy-light); font-weight: 700; }
.progress-bar-track { height: 6px; background: var(--bg-alt); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.progress-bar-fill { height: 100%; background: var(--navy-light); border-radius: 3px; transition: width 0.2s; }

.answer-scroll { flex: 1; overflow-y: auto; padding-right: 4px; }

.section-block { margin-bottom: 20px; }
.section-title { font-size: 14px; font-weight: 800; color: var(--text); margin: 0 0 2px; letter-spacing: 0.3px; }
.section-subtitle { font-size: 12px; color: #6b7280; margin: 0 0 6px; }
.section-underline { height: 2px; background: var(--navy-light); margin-bottom: 14px; }

.q-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }

/* Câu trắc nghiệm - nút tròn */
.mc-question-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.mc-question-row .q-label { font-size: 13px; font-weight: 600; color: var(--text); }
.mc-options-round { display: flex; gap: 8px; }
.mc-round-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--navy-light);
  background: #fff; color: var(--navy-light); font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: 0.12s;
}
.mc-round-btn:hover { background: #eff6ff; }
.mc-round-btn.selected { background: var(--navy-light); color: #fff; border-color: var(--navy-light); }

/* Câu đúng/sai - thẻ card gọn theo mockup */
.tf-question-card { grid-column: span 1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.tf-question-card .q-label { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.tf-sub-row { display: flex; align-items: center; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.tf-sub-row .sub-label { color: #4b5563; }
.tf-btn-group { display: flex; gap: 6px; }
.tf-btn { width: 34px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: #f9fafb; cursor: pointer; font-size: 12px; font-weight: 700; }
.tf-btn.sel-d { background: #dcfce7; border-color: var(--success); color: var(--success); }
.tf-btn.sel-s { background: #fee2e2; border-color: var(--danger); color: var(--danger); }

/* Câu trả lời ngắn */
.sa-question-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.sa-question-row .q-label { font-size: 13px; font-weight: 600; }
.short-answer-input {
  width: 110px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-weight: 600; text-align: center;
}
.short-answer-input::placeholder { color: #cbd5e1; font-size: 11px; }

.submit-area { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--bg-alt); }

/* ---------- Mockup mode chips (Luyện thi badge...) ---------- */
.mode-badge { font-size: 11px; padding: 3px 10px; border-radius: 20px; background: #fef3c7; color: #b45309; font-weight: 700; }

/* ============================================================================================
   MODERN SAAS DASHBOARD - SIDEBAR NAVIGATION (thay thế .app-nav thanh ngang cũ)
   Kiến trúc: #navBar được nav.js "biến hình" thành <aside> Sidebar CỐ ĐỊNH bên trái bằng
   position:fixed. KHÔNG cần sửa cấu trúc thẻ bao ngoài trong 17 file HTML: toàn bộ khoảng
   đẩy nội dung sang phải chỉ xử lý bằng padding-left trên <body>, nên .topbar và .container
   (hoặc .dashboard-container...) tự động "nhường chỗ" mà không cần thêm div wrapper mới.
   .app-nav / .app-nav-link cũ được GIỮ NGUYÊN trong file (không xoá) để không phá vỡ những
   trang CHƯA kịp chuyển đổi trong tiến trình triển khai theo từng nhóm.
   ============================================================================================ */

body.has-sidebar {
  padding-left: var(--sidebar-w);
  transition: padding-left 0.22s ease;
}
body.has-sidebar.sidebar-collapsed { padding-left: var(--sidebar-w-mini); }

#navBar.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* vùng cuộn thật sự là .sidebar-scroll bên trong */
  transition: width 0.22s ease, transform 0.22s ease;
}
body.sidebar-collapsed #navBar.sidebar { width: var(--sidebar-w-mini); }

.sidebar-brand {
  height: var(--sidebar-brand-h);
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-4);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  font-weight: 800; font-size: 15px; color: var(--ink-900);
  white-space: nowrap; overflow: hidden;
}
.sidebar-brand .sidebar-brand-mark {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
body.sidebar-collapsed .sidebar-brand-text { display: none; }

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--space-3) var(--space-2) var(--space-4); }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: var(--radius-pill); }

.sidebar-group { margin-bottom: var(--space-1); }
.sidebar-group-btn {
  width: 100%; display: flex; align-items: center; gap: var(--space-3);
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px var(--space-3); border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-400);
}
.sidebar-group-btn:hover { color: var(--ink-700); background: var(--bg-alt); }
.sidebar-group-btn .sg-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-group-btn .sg-chevron { flex-shrink: 0; transition: transform 0.18s ease; color: var(--ink-400); }
.sidebar-group.open .sg-chevron { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-group-btn .sg-label,
body.sidebar-collapsed .sidebar-group-btn .sg-chevron { display: none; }
body.sidebar-collapsed .sidebar-group-btn { justify-content: center; }

.sidebar-sublist { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.2s ease; }
.sidebar-sublist > div { overflow: hidden; }
.sidebar-group.open .sidebar-sublist { grid-template-rows: 1fr; }
body.sidebar-collapsed .sidebar-sublist { display: none; } /* mini sidebar: chỉ hiện icon nhóm, không xổ menu con */

.sidebar-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 9px var(--space-3) 9px 34px; margin: 1px 0;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--ink-500);
  text-decoration: none; white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.sidebar-link .sidebar-icon { flex-shrink: 0; display: flex; color: inherit; }
.sidebar-link .sidebar-icon svg { width: 17px; height: 17px; stroke: currentColor; }
.sidebar-link:hover { background: var(--primary-soft); color: var(--primary); }
.sidebar-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

/* Mini sidebar (collapsed - chỉ icon, 70-76px): nhóm KHÔNG accordion nữa, mỗi mục hiện trực tiếp icon phẳng
   xếp dọc; nhãn chữ ẩn, thay bằng tooltip đơn giản qua title="" (đã có sẵn trên thẻ <a>). */
body.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px 0; margin: 1px 10px; }
body.sidebar-collapsed .sidebar-link .sidebar-link-label { display: none; }
body.sidebar-collapsed .sidebar-group .sidebar-sublist { display: block; grid-template-rows: 1fr; }
body.sidebar-collapsed .sidebar-group-label-mini {
  display: block; text-align: center; font-size: 9px; color: var(--ink-300); margin: 6px 0 2px;
}
.sidebar-group-label-mini { display: none; }

.sidebar-footer { flex-shrink: 0; padding: var(--space-3); border-top: 1px solid var(--border); }
.sidebar-collapse-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  background: var(--bg-alt); border: none; border-radius: var(--radius-sm); cursor: pointer;
  padding: 9px; color: var(--ink-500); font-size: 12px; font-weight: 600;
}
.sidebar-collapse-btn:hover { background: var(--border); color: var(--ink-700); }
.sidebar-collapse-btn svg { width: 16px; height: 16px; stroke: currentColor; transition: transform 0.2s; flex-shrink: 0; }
body.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-collapse-btn .scb-label { display: none; }

/* Lớp phủ mờ phía sau Sidebar khi ở chế độ Off-canvas Drawer (Mobile/Tablet) */
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: 190; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
body.sidebar-mobile-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

/* Nút Hamburger (#sidebarToggle) chèn vào .topbar bởi nav.js */
.hamburger-btn {
  background: none; border: none; cursor: pointer; padding: 6px; margin-right: var(--space-2);
  border-radius: var(--radius-sm); color: var(--ink-700); display: flex; align-items: center; flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-alt); }
.hamburger-btn svg { width: 20px; height: 20px; stroke: currentColor; }

/* ============================================================================================
   TOPBAR (bản v2) - nhỏ gọn, nền sáng, đồng bộ với Sidebar. Ghi đè phần cần thiết của .topbar cũ
   (giữ nguyên toàn bộ selector con .title/.user-info/.logout để JS không cần đổi tên).
   ============================================================================================ */
.topbar {
  background: #fff; color: var(--ink-900);
  height: var(--topbar-h); padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 150;
  box-shadow: var(--shadow-xs);
}
.topbar .title { display: flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.topbar .user-info { color: var(--ink-700); }
.topbar button.logout { background: var(--bg-alt); color: var(--ink-700); }
.topbar button.logout:hover { background: var(--border); }

.tb-icon-btn { background: var(--bg-alt); color: var(--ink-500); }
.tb-icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.tb-avatar-circle { background: var(--primary); color: #fff; }

/* ============================================================================================
   MOBILE BOTTOM NAVIGATION BAR (5 mục phím tắt) - chèn vào <body> bởi nav.js, ẩn trên Desktop.
   ============================================================================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-nav-h);
  background: #fff; border-top: 1px solid var(--border);
  z-index: 220;
  box-shadow: 0 -2px 10px rgba(15,23,42,0.06);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-bottom-nav .mbn-row { display: flex; height: var(--bottom-nav-h); }
.mbn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--ink-400); font-size: 10px; font-weight: 600;
  min-height: var(--touch-target);
}
.mbn-item svg { width: 21px; height: 21px; stroke: currentColor; }
.mbn-item.active { color: var(--primary); }

/* ============================================================================================
   RESPONSIVE / MOBILE-FIRST: Sidebar -> Off-canvas Drawer, ẩn khoảng đẩy nội dung, hiện Bottom Nav.
   Breakpoint 1024px = ranh giới Desktop/Tablet theo đặc tả (mục III).
   ============================================================================================ */
@media (max-width: 1024px) {
  body.has-sidebar, body.has-sidebar.sidebar-collapsed { padding-left: 0; padding-bottom: var(--bottom-nav-h); }
  #navBar.sidebar { width: var(--sidebar-w); transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-mobile-open #navBar.sidebar { transform: translateX(0); }
  body.sidebar-collapsed #navBar.sidebar { width: var(--sidebar-w); } /* mini-sidebar không áp dụng trên mobile */
  .sidebar-collapse-btn { display: none; } /* thu gọn kiểu mini chỉ có ý nghĩa trên Desktop */
  .mobile-bottom-nav { display: block; }
  .hamburger-btn { display: flex; }
}
@media (min-width: 1025px) {
  .sidebar-backdrop { display: none; }
  .mobile-bottom-nav { display: none; }
}

/* ============================================================================================
   KHÔNG CÒN TOPBAR: thương hiệu (logo + tên) ở ĐẦU sidebar · tài khoản + chuông ở CUỐI sidebar.
   ============================================================================================ */
body.has-sidebar { --topbar-h: 0px; }           /* mọi chỗ canh theo chiều cao topbar (sticky, tools host...) tự về 0 */
body.has-sidebar .topbar { display: none !important; }  /* phòng trang nào còn sót markup topbar cũ */

.sidebar-brand { justify-content: space-between; gap: var(--space-2); padding: 0 var(--space-3) 0 var(--space-4); }
.sb-brand-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.sb-logo { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; line-height: 0; }
.sb-logo .brand-icon svg { width: 26px !important; height: 26px !important; display: block; }
.sb-logo-img { max-width: 100%; max-height: 32px; border-radius: 6px; object-fit: contain; display: block; }
/* Thương hiệu 2 dòng: "EduLMS" (18px đậm) + phụ đề "Quản lý học tập" (11px). min-width:0 + ellipsis => KHÔNG BAO GIỜ tràn
   đè lên nút thu gọn "<<" (trước đây tên dài chạy marquee nên bị cắt 2 đầu: "duLMS - Hệ thống qu"). Tên đầy đủ xem ở tooltip (title). */
.sb-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden; color: var(--ink-900, #0f172a); line-height: 1.15; }
.sb-track { display: block; min-width: 0; max-width: 100%; overflow: hidden; }
.sb-text { display: block; max-width: 100%; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-sub { display: block; max-width: 100%; font-size: 11px; font-weight: 500; color: var(--ink-500, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* nav.js vẫn có bộ đo marquee; nay không chạy chữ nữa nên nếu lỡ có bản sao thì ẩn đi */
.sb-name .sb-dup { display: none !important; }

.sb-collapse-btn {
  flex-shrink: 0; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-alt); border: none; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-500); padding: 0; font: inherit;
}
.sb-collapse-btn:hover { background: var(--border); color: var(--ink-700); }
.sb-collapse-btn svg { width: 16px; height: 16px; stroke: currentColor; transition: transform 0.2s; display: block; }
.sb-collapse-btn .sb-ico-mob { display: none; }
body.sidebar-collapsed .sb-collapse-btn svg { transform: rotate(180deg); }

/* Sidebar thu gọn (mini 76px): chỉ logo + nút mở rộng xếp dọc */
body.sidebar-collapsed .sidebar-brand { flex-direction: column; justify-content: center; height: auto; min-height: var(--sidebar-brand-h); padding: 10px 0; gap: 8px; }
body.sidebar-collapsed .sb-brand-main { flex: 0 0 auto; }
body.sidebar-collapsed .sb-name { display: none; }

/* Tài khoản + chuông ở cuối sidebar (thay nút Thu gọn) */
.sb-account { display: flex; align-items: center; gap: var(--space-2); }
.sb-account-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left;
  background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); color: var(--ink-900, #0f172a);
  font: inherit; /* <button> không tự kế thừa font của trang → tên + chip vai trò bị rơi về font hệ thống (lỗi font "QUẢN TRỊ VIÊN") */
}
.sb-account-btn:hover { background: var(--bg-alt); }
.sb-account .tb-avatar-circle { flex-shrink: 0; width: 38px; height: 38px; overflow: hidden; }
.sb-account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.sb-account-name { max-width: 100%; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink-900, #0f172a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-role-chip { display: inline-flex; align-items: center; font-family: inherit; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: 0.02em; padding: 4px 9px; border-radius: 9999px; text-transform: uppercase; white-space: nowrap; -webkit-font-smoothing: antialiased; }
.sb-account .tb-icon-wrap { flex-shrink: 0; }
.sb-account .tb-icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.sb-account .tb-icon-btn svg { width: 18px; height: 18px; stroke: currentColor; }
body.sidebar-collapsed .sb-account { flex-direction: column; gap: 8px; }
body.sidebar-collapsed .sb-account-btn { flex: 0 0 auto; padding: 4px; }
body.sidebar-collapsed .sb-account-text { display: none; }

/* Menu Tài khoản + Thông báo: phần tử NỔI gắn vào <body>, đặt vị trí bằng JS (nav.js#placeFloatingDropdown) */
.tb-dropdown.tb-dropdown-float { position: fixed; top: auto; right: auto; left: 0; z-index: 400; }
#avatarDropdown.tb-dropdown-float { min-width: 230px; }

/* Nút "Menu" ở thanh điều hướng dưới (mobile/tablet) — thay hamburger của Topbar cũ */
button.mbn-item { background: none; border: none; font-family: inherit; cursor: pointer; padding: 0; }
.mbn-menu svg { stroke: currentColor; }

@media (max-width: 1024px) {
  .sb-collapse-btn .sb-ico-desk { display: none; }
  .sb-collapse-btn .sb-ico-mob { display: inline-flex; }
  .sb-collapse-btn svg { transform: none !important; }
  /* Ngăn kéo luôn ở dạng đầy đủ: bỏ kiểu "mini" */
  body.sidebar-collapsed .sidebar-brand { flex-direction: row; justify-content: space-between; height: var(--sidebar-brand-h); padding: 0 var(--space-3) 0 var(--space-4); gap: var(--space-2); }
  body.sidebar-collapsed .sb-brand-main { flex: 1; }
  body.sidebar-collapsed .sb-name { display: block; }
  body.sidebar-collapsed .sb-account { flex-direction: row; gap: var(--space-2); }
  body.sidebar-collapsed .sb-account-btn { flex: 1; padding: 6px; }
  body.sidebar-collapsed .sb-account-text { display: flex; }
}

/* ============================================================================================
   TOUCH-FRIENDLY BASE (mục III.3): nút/input/dropdown tối thiểu 44-48px chiều cao trên mobile,
   bảng dữ liệu cuộn ngang mượt thay vì vỡ layout.
   ============================================================================================ */
@media (max-width: 768px) {
  .btn, .form-group input, .form-group select, .form-group textarea,
  .filter-bar select, .filter-bar input, .btn-sm { min-height: var(--touch-target); }
  .btn, .btn-sm { padding-top: 0; padding-bottom: 0; }
  table.simple-table, table.detail-table { display: block; }
  .table-scroll, .simple-table, .detail-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================================================================
   CARD / RADIUS chuẩn hoá theo Design System mới (bo góc rounded-xl, viền mỏng, shadow tinh tế)
   ============================================================================================ */
.card, .stat-card, .stat-box, .chart-box, .widget-box { border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn { border-radius: var(--radius-sm); }

/* ============================================================================================
   ICON + TEXT ALIGNMENT SYSTEM
   Quy chuẩn căn chỉnh trục dọc: icon và chữ luôn thẳng hàng.
   ============================================================================================ */
.heading-icon,
.btn-icon,
.brand-icon,
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  vertical-align: middle;
  flex-shrink: 0;
}
.heading-icon svg,
.btn-icon svg,
.brand-icon svg,
.action-icon svg {
  display: block;
}
.btn-icon svg { transform: translateY(0.5px); }

/* ---------- Buttons with icon ---------- */
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1.2;
  white-space: nowrap;
}
.btn-with-icon .btn-icon { flex-shrink: 0; }
.btn.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- Form elements ---------- */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.required-star { color: var(--danger); margin-left: 2px; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-input::placeholder { color: var(--ink-400); }
.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-hint { font-size: 12px; color: var(--ink-500); margin-top: 6px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ============================================================================================
   PAGE HEADER
   FIX #1: chuẩn hoá theo Modern SaaS Dashboard — .page-header tự căn hàng ngang
   (space-between) thay vì chỉ là 1 cột dọc chờ .page-title-row con xử lý, để mọi
   trang dùng đúng class gốc (không có CSS override riêng) vẫn thẳng hàng, cân đối.
   ============================================================================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.2;
}

/* ============================================================================================
   ALERTS / NOTICES
   ============================================================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.5;
}
.alert p { margin: 4px 0 0; }
.alert-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.alert-info { background: var(--primary-soft); border-color: #bfdbfe; color: var(--ink-900); }
.alert-info .alert-icon { color: var(--primary); }
.alert-warning { background: #fef3c7; border-color: #fde68a; color: #78350f; }
.alert-warning .alert-icon { color: var(--amber); }
.alert-danger { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.alert-danger .alert-icon { color: var(--danger); }
.alert-success { background: #dcfce7; border-color: #bbf7d0; color: #14532d; }
.alert-success .alert-icon { color: var(--success); }

.practice-info-card { margin-bottom: 0; }

/* ============================================================================================
   EXAM LIST CARDS
   ============================================================================================ */
.exam-list { display: flex; flex-direction: column; gap: 0; }
.exam-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.exam-card:last-child { border-bottom: none; }
.exam-card-main { flex: 1; min-width: 0; }
.exam-card-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.exam-title { font-size: 15px; font-weight: 700; color: var(--ink-900); margin: 0; line-height: 1.3; }
.exam-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.exam-meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-500);
  background: var(--bg-alt);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.meta-icon { flex-shrink: 0; display: inline-flex; align-items: center; }

.exam-time-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-400); }
.time-icon { flex-shrink: 0; display: inline-flex; align-items: center; }

.exam-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; flex-shrink: 0; padding-top: 2px; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.tag-icon { flex-shrink: 0; display: inline-flex; align-items: center; }
.tag-lock { background: #f3f4f6; color: var(--ink-500); }

/* ---------- Mode badge (practice) ---------- */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #fef3c7;
  color: #b45309;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Button variants ---------- */
.btn-outline-primary {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  text-decoration: none !important;
}
.btn-outline-primary:hover { background: var(--primary-soft); }
.btn-outline-info {
  background: transparent;
  border: 1.5px solid #0ea5e9;
  color: #0ea5e9;
  text-decoration: none !important;
}
.btn-outline-info:hover { background: #f0f9ff; }
.btn-danger-ghost {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}
.btn-danger-ghost:hover { background: #fee2e2; border-color: var(--danger); }

/* Bỏ gạch chân trên mọi link bên trong .exam-card-actions */
.exam-card-actions a,
.exam-card-actions a:hover,
.exam-card-actions a:focus,
.exam-card-actions a:visited { text-decoration: none !important; }

/* Đảm bảo flexbox thẳng hàng cho mọi .btn-sm có icon */
.btn.btn-sm.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1;
  white-space: nowrap;
}

/* ============================================================================================
   SKELETON LOADING
   ============================================================================================ */
.skeleton-list { display: flex; flex-direction: column; gap: 0; }
.skeleton-item {
  height: 88px;
  background: linear-gradient(90deg, var(--bg-alt) 25%, #e8edf2 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.skeleton-item:last-child { border-bottom: none; }
.skeleton-block {
  background: linear-gradient(90deg, var(--bg-alt) 25%, #e8edf2 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }

/* ============================================================================================
   EMPTY / ERROR STATES
   ============================================================================================ */
.empty-state { text-align: center; padding: 44px 20px; color: var(--ink-400); font-size: 13.5px; }
.empty-icon { display: block; margin: 0 auto 12px; }
.error-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  color: #991b1b;
  font-size: 13px;
}
.error-icon { flex-shrink: 0; display: inline-flex; align-items: center; }

/* ============================================================================================
   HISTORY PAGE — FILTER BAR
   ============================================================================================ */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap input { width: 100%; padding-left: 34px; }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  color: var(--ink-400);
}
.filter-bar select { padding: 9px 30px 9px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.filter-bar select:focus { outline: none; border-color: var(--primary); }

/* ============================================================================================
   HISTORY PAGE — STAT CARDS with icons
   ============================================================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-card { text-align: center; padding: 20px 16px; }
.stat-icon-wrap {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.stat-icon-primary { background: var(--primary-soft); color: var(--primary); }
.stat-icon-emerald { background: #f0fdf4; color: var(--emerald); }
.stat-icon-success { background: #dcfce7; color: var(--success); }
.stat-icon-danger { background: #fee2e2; color: var(--danger); }
.stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--ink-500); margin-top: 4px; }

/* ============================================================================================
   HISTORY PAGE — TABLE
   ============================================================================================ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; white-space: nowrap; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--bg-alt);
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: var(--primary-soft); }
.td-time { white-space: nowrap; color: var(--ink-500); font-size: 12px; }
.td-exam-title { max-width: 200px; white-space: normal; }
.student-name { font-weight: 600; color: var(--ink-900); }
.username-code { font-size: 12px; background: var(--bg-alt); padding: 2px 6px; border-radius: 4px; color: var(--ink-700); }
.score-chip { font-weight: 800; font-size: 14px; color: var(--primary); }
.score-max { color: var(--ink-400); font-size: 12px; }
.td-actions { white-space: nowrap; }

/* FIX #3: gỡ định nghĩa .detail-table trùng lặp thứ 2 (đã gộp về 1 khối
   chuẩn duy nhất bên dưới, gần phần RESULT SCORE BOX). */

/* Modal detail sections scrollable */
#detailContent .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#detailContent .section-block { margin-top: 18px; }

/* ---------- Risk indicator ---------- */
.risk-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.risk-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.risk-high { background: #fee2e2; color: var(--danger); }
.risk-high .risk-dot { background: var(--danger); }
.risk-medium { background: #fef3c7; color: #b45309; }
.risk-medium .risk-dot { background: var(--amber); }
.risk-none { background: #dcfce7; color: var(--success); }
.risk-none .risk-dot { background: var(--success); }

/* ============================================================================================
   RESULT SCORE BOX
   ============================================================================================ */
.result-score-box {
  text-align: center;
  padding: 28px 20px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #fff 100%);
  border-radius: var(--radius-lg);
  border: 1px solid #bfdbfe;
  margin: 16px 0;
}
.big-score { font-size: 56px; font-weight: 900; color: var(--primary); line-height: 1; }
.score-sep { font-size: 18px; color: var(--ink-500); font-weight: 600; margin-top: 4px; }
.correct-info { font-size: 13px; color: var(--ink-500); margin-top: 6px; }

/* ============================================================================================
   SECTION BLOCKS (result detail)
   ============================================================================================ */
.section-block { margin-top: 20px; }
.section-title { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.section-underline { height: 2px; background: var(--primary); margin-bottom: 14px; width: 48px; }
/* ============================================================================================
   DETAIL TABLE — chuẩn hoá (định nghĩa DUY NHẤT, thay cho 3 bản trùng lặp cũ)
   FIX #3: dùng table-layout: auto để cột tự co giãn theo nội dung thay vì bị ép
   width cố định gây "Thoát / toàn / màn / hình"; chỉ khoá white-space: nowrap cho
   3 cột ngắn (Câu, Trả lời, Đáp án đúng) — cột Điểm vẫn giữ nowrap vì nội dung
   luôn ngắn (số + "/max").
   ============================================================================================ */
.detail-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.detail-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  padding: 8px 12px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.detail-table td {
  padding: 8px 12px;
  line-height: 1.4;
  font-size: 13px;
  border-bottom: 1px solid var(--bg-alt);
  text-align: center;
}
.detail-table th:nth-child(1), .detail-table td:nth-child(1),
.detail-table th:nth-child(2), .detail-table td:nth-child(2),
.detail-table th:nth-child(3), .detail-table td:nth-child(3),
.detail-table th:nth-child(4), .detail-table td:nth-child(4) {
  white-space: nowrap;
}
.detail-table .row-correct td { background: #f0fdf4; }
.detail-table .row-wrong td { background: #fef2f2; }
.detail-table .row-partial td { background: #fefce8; }
.score-chip-sm { font-weight: 700; font-size: 12px; padding: 1px 5px; border-radius: 4px; }
.score-correct { background: #dcfce7; color: var(--success); }
.score-wrong { background: #fee2e2; color: var(--danger); }
.score-partial { background: #fef3c7; color: #b45309; }
.score-max-sm { color: var(--ink-400); font-size: 11px; }

/* ============================================================================================
   INCIDENTS & SUSPICIOUS BLOCKS
   ============================================================================================ */
.incidents-block {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.incidents-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
}
.incidents-icon { flex-shrink: 0; display: inline-flex; align-items: center; color: var(--ink-500); }
.incidents-count {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}
.incidents-list { display: flex; flex-direction: column; }
/* FIX #3: .incident-label trước đây là flex:1 KHÔNG có min-width/nowrap nên khi
   hàng bị chật (cùng hàng với icon + giờ), chữ bị co lại và rớt xuống dòng theo
   từng từ ("Thoát / toàn / màn / hình"). Cố định min-width + nowrap cho cột
   Loại vi phạm & Thời gian; cột Chi tiết mô tả (flex:1, min-width:0) mới được
   phép xuống dòng theo từ (word-break) vì nó chứa văn bản tự do, dài.  */
.incident-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 16px 10px 13px;
  border-bottom: 1px solid var(--bg-alt);
  border-left: 3px solid var(--ink-300);
  font-size: 12.5px;
  color: var(--ink-700);
}
.incident-row:last-child { border-bottom: none; }
.incident-index {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-alt); color: var(--ink-500);
  font-size: 10.5px; font-weight: 700;
}
.incident-icon { flex-shrink: 0; display: inline-flex; align-items: center; margin-top: 1px; color: var(--ink-500); }
.incident-label { min-width: 160px; white-space: nowrap; font-weight: 600; }
.incident-time { min-width: 150px; white-space: nowrap; color: var(--ink-400); font-size: 12px; }
.incident-dur { display: flex; align-items: center; gap: 6px; }
.incident-dur svg { flex: none; }
.incident-details { flex: 1 1 100%; min-width: 0; word-break: break-word; font-size: 11.5px; color: var(--ink-400); margin-top: 3px; padding-left: 29px; }
@media (max-width: 480px) {
  .incident-label, .incident-time { min-width: 0; white-space: normal; }
}

/* Xếp loại mức độ vi phạm theo màu sắc - viền trái của từng dòng + nhãn nhỏ (severity chip) đi kèm.
   info (xanh dương) = sự kiện thông tin (bắt đầu/vào lại phiên, không phải vi phạm thật sự)
   low (xanh lá) -> medium (vàng) -> high (cam) -> critical (đỏ): mức độ nghiêm trọng tăng dần. */
.severity-chip {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  padding: 2px 7px; border-radius: var(--radius-pill);
}
.incident-row.sev-info { border-left-color: #3b82f6; }
.severity-chip.sev-info { background: #dbeafe; color: #1d4ed8; }
.incident-row.sev-low { border-left-color: #22c55e; }
.severity-chip.sev-low { background: #dcfce7; color: #15803d; }
.incident-row.sev-medium { border-left-color: var(--amber, #f59e0b); }
.severity-chip.sev-medium { background: #fef3c7; color: #b45309; }
.incident-row.sev-high { border-left-color: #f97316; }
.severity-chip.sev-high { background: #ffedd5; color: #c2410c; }
.incident-row.sev-critical { border-left-color: var(--danger); background: #fef2f2; }
.severity-chip.sev-critical { background: #fee2e2; color: #b91c1c; }

/* ============================================================================================
   LỊCH SỬ CHỌN ĐÁP ÁN (ANSWER SELECTION HISTORY) - xem public/js/main.js#renderAnswerHistoryBlock
   ============================================================================================ */
.answer-history-block { margin-top: 20px; }
.answer-history-toggle-btn.active { background: var(--primary-soft); color: var(--primary); }
.answer-history-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.answer-history-section { border-bottom: 1px solid var(--bg-alt); }
.answer-history-section:last-child { border-bottom: none; }
.answer-history-section-title {
  padding: 10px 16px;
  background: var(--bg-alt);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-700);
  letter-spacing: 0.2px;
}
.answer-history-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--bg-alt);
  font-size: 12.5px;
}
.answer-history-row:last-child { border-bottom: none; }
.ah-row-label { flex-shrink: 0; min-width: 56px; font-weight: 700; color: var(--ink-700); }
.ah-sequence { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.ah-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
}
.ah-chip.ah-correct { background: #dcfce7; color: var(--success); }
.ah-chip.ah-wrong { background: #fee2e2; color: var(--danger); }
.ah-arrow { color: var(--ink-400); font-size: 11px; margin: 0 1px; }

.suspicious-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  color: #991b1b;
  font-size: 13px;
}
.suspicious-icon { flex-shrink: 0; display: inline-flex; align-items: center; margin-top: 1px; }

/* ============================================================================================
   DETAIL MODAL META ROW
   ============================================================================================ */
.detail-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.detail-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-600);
  background: var(--bg-alt);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* ============================================================================================
   EXAM-EDIT PAGE — CARD SECTION TITLE
   ============================================================================================ */
.card-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.card-section-icon { flex-shrink: 0; display: inline-flex; align-items: center; color: var(--primary); }

/* ---------- Toggle rows ---------- */
.toggle-row {
  display: flex;
  flex-wrap: wrap; /* BẮT BUỘC giữ wrap: huy hiệu khoá tính năng (featureGate.js) dùng flex-basis:100% để xuống hàng riêng */
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--bg-alt);
  gap: 12px;
}
.toggle-row:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-info { flex: 1 1 0%; min-width: 0; } /* basis 0: nhãn tự co/xuống dòng chứ KHÔNG đẩy công tắc xuống dưới (lỗi cũ khi mô tả dài) */
.toggle-row .switch, .toggle-row .num-inline { flex: none; }
#acThresholdRow .toggle-row:last-child { border-bottom: 1px solid var(--bg-alt, #eef2f7); padding-bottom: 14px; } /* hàng số cuối trong cụm vẫn có đường kẻ như các hàng công tắc */
.toggle-row .num-inline { width: 84px; padding: 8px 10px; text-align: center; }
.toggle-label { font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.toggle-hint { display: block; font-size: 11.5px; color: var(--ink-400); margin-top: 2px; }

/* ---------- Nhóm nhỏ trong khối cài đặt riêng cho đề thi (vd: Nhóm chấm bài, Nhóm vi phạm) ---------- */
.settings-subgroup-title {
  margin: 18px 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}
.settings-subgroup-title:first-of-type { margin-top: 14px; }

/* ---------- Structure grid ngang ----------
   FIX #2: đổi từ 3 CỘT dọc (grid-template-columns: repeat(3,1fr)) - gây chật hẹp
   khi nhập liệu - sang 3 HÀNG NGANG xếp chồng. Mỗi .structure-item giờ chiếm
   trọn chiều rộng và tự bố trí Nhãn phần + 2 ô nhập (Số câu / Tổng điểm) dàn
   trải đều theo chiều ngang bằng flex, thay vì grid dọc như trước. */
.structure-grid-horizontal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.structure-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1.5px solid var(--border);
}
.structure-item--teal { border-color: #99f6e4; background: #f0fdfa; }
.structure-item--amber { border-color: #fde68a; background: #fffbeb; }
.structure-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-800);
  flex: 0 0 auto;
  min-width: 190px;
  margin-bottom: 0;
}
.structure-item--teal .structure-item-label { color: #0f766e; }
.structure-item--amber .structure-item-label { color: #92400e; }
/* Ô nhập Số câu / Tổng điểm giờ nằm CÙNG HÀNG với nhãn phần, dàn đều theo chiều ngang */
.structure-item .form-row-2 {
  flex: 1 1 260px;
  display: flex;
  gap: 14px;
  margin: 0;
}
.structure-item .form-row-2 .form-group { flex: 1; min-width: 130px; }
.structure-item .form-row-2 .form-label { margin-bottom: 4px; }
@media (max-width: 640px) {
  .structure-item { flex-direction: column; align-items: stretch; }
  .structure-item-label { min-width: 0; }
  .structure-item .form-row-2 { flex: 1 1 auto; width: 100%; }
}
.grand-total-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
}
.grand-total-label { font-size: 13px; color: var(--ink-600); font-weight: 500; }
.grand-total-value { font-size: 22px; font-weight: 900; color: var(--primary); }
.grand-total-unit { font-size: 13px; color: var(--ink-500); }

/* ---------- Part title row ---------- */
.part-title-row { display: flex; align-items: center; gap: 10px; }
.part-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.part-num--teal { background: var(--teal); }
.part-num--amber { background: var(--amber); }
.part-title { font-size: 14px; font-weight: 700; color: var(--ink-900); }

/* ---------- Scan result box ---------- */
#scanResultBox { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-top: 10px; background: var(--bg-alt); }
.scan-loading { font-size: 13px; color: var(--ink-500); display: flex; align-items: center; gap: 8px; }
.scan-success { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.scan-success-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: #dcfce7; border-radius: 50%; color: var(--success); margin-top: 1px; }
.scan-error { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--danger); }
.scan-error-icon { flex-shrink: 0; display: inline-flex; align-items: center; }

/* ---------- Q-point input ---------- */
.qpoint:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }

/* ---------- Form label hint ---------- */
.form-label-hint { font-size: 11px; color: var(--ink-400); font-weight: 400; }

/* ============================================================================================
   RESPONSIVE — History & Exam Cards
   ============================================================================================ */
@media (max-width: 768px) {
  .exam-card { flex-direction: column; }
  .exam-card-actions { width: 100%; }
  .exam-card-actions .btn { flex: 1; }
  .structure-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar select, .filter-bar input { width: 100%; min-height: var(--touch-target); }
  .search-input-wrap { min-width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .structure-grid { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 17px; }
}

.user-actions-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* Nút 3 chấm vuông vắn, bo góc nhẹ */
.btn-dots-action {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  color: var(--ink-500);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-dots-action:hover {
  background: var(--bg-alt);
  color: var(--ink-900);
  border-color: var(--ink-400);
}

/* Menu xổ xuống */
.user-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-md, 0 6px 16px rgba(15,23,42,0.1));
  min-width: 170px;
  z-index: 100;
  padding: 6px 0;
}
.user-dropdown-menu.show {
  display: block;
}

/* Các mục trong dropdown */
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  text-align: left;
}
.user-dropdown-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.user-dropdown-item svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  flex-shrink: 0;
}
.user-dropdown-item.danger {
  color: var(--danger);
}
.user-dropdown-item.danger:hover {
  background: #fee2e2;
  color: var(--danger);
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Phân trang popup thiết bị */
.device-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}
.device-pag-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-700);
}
.device-page-input {
  width: 48px;
  height: 30px;
  text-align: center;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  outline: none;
  font-size: 13px;
}
.device-page-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.device-pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  color: var(--ink-700);
  transition: all 0.15s;
}
.device-pag-btn:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}
.device-pag-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Khung bao bọc ô mật khẩu */
.pass-field-wrap {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}

/* Ô nhập mật khẩu chừa khoảng trống bên phải cho icon */
.pass-field-wrap input {
  width: 100% !important;
  padding-right: 40px !important;
}

/* Nút con mắt căn giữa tuyệt đối bên phải */
.pass-field-wrap .eye-toggle-btn,
.pass-field-wrap .eye-toggle {
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  cursor: pointer !important;
  padding: 4px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--ink-400, #94a3b8) !important;
  z-index: 2 !important;
  line-height: 0 !important;
}

.pass-field-wrap .eye-toggle-btn:hover,
.pass-field-wrap .eye-toggle:hover {
  color: var(--ink-700, #334155) !important;
}

.pass-field-wrap .eye-toggle-btn svg,
.pass-field-wrap .eye-toggle svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
}

/* Nút Tất cả: Cân đối chiều cao, bo viền mềm mại */
/* Đồng bộ chiều cao ô chọn tháng và nút Tất cả theo chuẩn control (--ctl-h, xem css/controls.css) */
#filterMonth {
  height: var(--ctl-h, 38px) !important;
  padding: 0 8px !important;
  box-sizing: border-box !important;
  font-size: 13px !important;
}

.btn-clear-month {
  height: var(--ctl-h, 38px) !important;
  padding: 0 10px !important;
  border-radius: var(--radius-sm, 8px) !important;
  border: 1.5px solid var(--border) !important;
  background: #fff !important;
  color: var(--ink-700) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
}

.btn-clear-month:hover {
  background: var(--bg-alt) !important;
  border-color: var(--ink-400) !important;
  color: var(--ink-900) !important;
}

/* Nút QR gọn gàng, vừa vặn */
.btn-qr-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm, 6px);
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.btn-qr-compact:hover {
  background: var(--primary-hover, #1d4ed8);
}
.btn-qr-compact svg {
  display: block;
}

/* 1. Giãn khoảng cách giữa nút QR và nút Xoá từ 4px lên 8px */
.fee-table td > div[style*="display:flex"] {
  gap: 8px !important;
}

/* 2. Căn tâm icon thùng rác thẳng hàng tuyệt đối với chữ Xoá */
.fee-table .btn-danger-ghost {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  line-height: 1 !important;
}

.fee-table .btn-danger-ghost .btn-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
}

.fee-table .btn-danger-ghost .btn-icon svg {
  transform: translateY(-0.5px) !important; /* Đưa tâm icon nhích nhẹ lên để cân bằng trọng tâm chữ Xoá */
  display: block !important;
}

/* Khung bọc từng mục: thu hẹp gap về 8px chuẩn UI */
.tb-dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  padding: 8px 14px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: var(--ink-700, #334155) !important;
  text-decoration: none !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  text-align: left !important;
}

.tb-dropdown-item:hover {
  background: var(--bg-alt, #f8fafc) !important;
  color: var(--primary, #2563eb) !important;
}

/* Icon giữ nguyên vị trí gốc, không dịch translateY */
.tb-dropdown-item svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  stroke: currentColor !important;
  flex-shrink: 0 !important;
  display: block !important;
  transform: none !important;
}

/* Thẻ span chữ: giữ line-height tự nhiên, không lệch trục */
.tb-dropdown-item span {
  display: inline-block !important;
  line-height: 1 !important;
  transform: none !important;
}

/* Mục thoát */
.tb-dropdown-item.tb-dropdown-danger {
  color: var(--danger, #dc2626) !important;
}

.tb-dropdown-item.tb-dropdown-danger:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}

/* Khóa kích thước cố định cho icon trong tiêu đề của từng dòng cài đặt */
.setting-title svg {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  stroke-width: 2 !important;
  margin-right: 6px !important;
  vertical-align: middle !important;
}

/* Khóa kích thước icon ở tiêu đề đầu thẻ card */
.settings-group-card-header svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

/* Căn thẳng hàng icon và chữ tiêu đề */
.setting-title {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: var(--ink-900) !important;
}

/* Anti-Flicker Gate: ẩn tiêu đề topbar cho tới khi branding được gán xong để chống giật/chớp giao diện (FOUC) */
.topbar .title:not(.branding-ready) {
  opacity: 0;
  visibility: hidden;
}
.topbar .title.branding-ready {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.1s ease-in;
}

/* Khóa toàn bộ cụm tiêu đề Topbar theo trục giữa flexbox */
.topbar .title {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  font-size: 20px !important;
  font-weight: 680 !important;
  color: var(--ink-900, #0f172a) !important;
  line-height: 1 !important;
}

/* Khung chứa icon SVG */
.topbar .title .brand-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 24px !important;
  width: 24px !important;
  line-height: 0 !important;
  flex-shrink: 0 !important;
}

/* Đưa tâm quang học của icon khớp tuyệt đối với tâm chữ EduLMS */
.topbar .title .brand-icon svg {
  display: block !important;
  width: 24px !important;
  height: 24px !important;
  transform: translateY(1px) !important;
}

@media (max-width: 768px) {
  .topbar {
    height: 56px !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  /* 1. Nút hamburger gọn gàng */
  .hamburger-btn,
  #sidebarToggle {
    margin-right: 0 !important;
    padding: 6px !important;
    flex-shrink: 0 !important;
  }

  /* 2. Tiêu đề / Tên thương hiệu: Luôn trên 1 dòng, không xuống dòng */
  .topbar .title {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-right: 4px !important;
  }
  .topbar .title .brand-icon svg,
  .topbar .title img {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
  }

  /* 3. Bên phải: Chỉ giữ icon chuông và avatar tròn */
  .topbar .user-info {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  /* Ẩn chữ tên người dùng và badge vai trò cam to trên mobile */
  .topbar .user-info > span#userName,
  .topbar .user-info .role-chip {
    display: none !important;
  }

  /* Giữ cụm thông báo và avatar gọn gàng */
  .topbar-extras {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .tb-icon-btn {
    width: 36px !important;
    height: 36px !important;
  }
  .tb-avatar-circle {
    width: 34px !important;
    height: 34px !important;
  }
}

/* Switch toggle tuyển sinh */
.admission-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700, #334155);
}

.switch-control {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s ease;
  border-radius: 22px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch-control input:checked + .switch-slider {
  background-color: var(--success, #16a34a);
}

.switch-control input:checked + .switch-slider:before {
  transform: translateX(16px);
}

/* Chấm tròn trạng thái online ở tab cửa sổ chat */
.chat-window .tab-btn .status-dot,
.chat-tabs .status-dot,
.chat-tab-online-dot,
span[class*="online-dot"] {
  display: inline-block !important;
  width: 9px !important;
  height: 9px !important;
  border-radius: 50% !important;
  background-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2) !important;
  opacity: 1 !important;
  vertical-align: middle !important;
  margin-right: 6px !important;
}

/* Đảm bảo thanh lọc tự động xuống dòng mượt mà khi nhiều bộ lọc */
.filter-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
}

.filter-bar select,
.filter-bar .search-input-wrap {
  flex: 1 1 auto;
  min-width: 140px;
}

.filter-bar .btn {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

a.btn,
.btn {
  text-decoration: none !important;
}

a.btn:hover,
.btn:hover {
  text-decoration: none !important;
}

.btn-with-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

.btn-with-icon .btn-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  line-height: 0 !important;
  transform: translateY(-0.5px);
}

.btn-with-icon .btn-icon svg {
  display: block !important;
}

.btn-with-icon span {
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
}

/* Badge vai trò trên topbar */
.badge-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  line-height: 1;
  letter-spacing: 0.02em;
  margin-left: 8px;
  text-transform: uppercase;
}

.user-info {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* ============================================================================================
   UNIFIED COMPACT HEADER (.page-header-bar) — DUY NHẤT 1 kiểu heading cho mọi trang quản trị
   [Icon 36x36 nền nhạt] + Tiêu đề (20px / 700 / #0f172a)  ........  [Bộ lọc chính] [Nút CTA]
   Quy tắc: KHÔNG có dòng mô tả phụ, KHÔNG lặp tiêu đề lần 2 trong card.
   ============================================================================================ */
.page-header-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 12px 16px; width: 100%; max-width: 100%; min-height: 40px; margin: 0 0 16px; box-sizing: border-box;
}
.page-header-bar .ph-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
.page-header-bar .ph-icon {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px;
  background: var(--primary-soft, #EFF6FF); color: var(--primary, #2563EB);
  display: inline-flex; align-items: center; justify-content: center; line-height: 0;
}
.page-header-bar .ph-icon svg { width: 20px; height: 20px; display: block; stroke: currentColor; }
.page-header-bar .page-title {
  margin: 0; display: block; min-width: 0; font-size: 20px; font-weight: 700; color: #0f172a; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-header-bar .ph-right {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
  margin-left: auto; min-width: 0; max-width: 100%; flex: 0 1 auto;
}
/* điều khiển trong cụm phải: cùng chiều cao, không bị ép width:100% bởi .btn-primary / .form-group */
.page-header-bar .ph-right .btn,
.page-header-bar .ph-right .ui-btn-cta,
.page-header-bar .ph-right .ui-btn-ghost,
.page-header-bar .ph-right .btn-danger-solid,
.page-header-bar .ph-right .btn-outline-danger { width: auto; min-height: var(--ctl-h-std, 38px); white-space: nowrap; flex: 0 0 auto; }
.page-header-bar .ph-right select,
.page-header-bar .ph-right input[type="text"],
.page-header-bar .ph-right input[type="search"],
.page-header-bar .ph-right input[type="month"],
.page-header-bar .ph-right input[type="date"] {
  width: auto; min-width: 0; max-width: 100%; height: var(--ctl-h-std, 38px); padding: 0 12px; box-sizing: border-box;
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 8px; background-color: #fff; font-size: 13.5px; color: var(--ink-900, #0f172a);
}
.page-header-bar .ph-right select { padding-right: 30px; max-width: 240px; text-overflow: ellipsis; }
.page-header-bar .ph-right .btn,
.page-header-bar .ph-right .ui-btn-cta,
.page-header-bar .ph-right .ui-btn-ghost,
.page-header-bar .ph-right .btn-danger-solid,
.page-header-bar .ph-right .btn-outline-danger,
.page-header-bar .ph-right .profile-print-btn { height: var(--ctl-h-std, 38px); padding-top: 0; padding-bottom: 0; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.page-header-bar .ph-right a.ui-btn-cta, .page-header-bar .ph-right a.ui-btn-cta:hover { text-decoration: none; color: #fff; }
.page-header-bar .ph-right .btn, .page-header-bar .ph-right .btn-outline-danger { font-size: 13.5px; font-weight: 600; }
.page-header-bar .ph-right .btn-danger-solid { padding-left: 12px; padding-right: 12px; font-size: 13px; }
.page-header-bar .ph-right .ui-btn-cta { padding-left: 14px; padding-right: 14px; }
.page-header-bar .ph-right .form-group { margin: 0; }
.page-header-bar .ph-right .ui-search input { padding-left: 32px; width: 200px; min-width: 0; }
.page-header-bar .ph-filter { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.page-header-bar .ph-filter select { min-width: 130px; }
.page-header-bar .ph-filter > label { font-size: 12.5px; font-weight: 600; color: var(--ink-500, #64748b); white-space: nowrap; margin: 0; }
.page-header-bar .ph-count, .ph-count {
  display: inline-flex; align-items: center; flex: 0 0 auto; white-space: nowrap;
  padding: 4px 12px; border-radius: var(--radius-pill, 999px);
  background: var(--primary-soft, #EFF6FF); color: var(--primary, #2563EB); font-size: 12px; font-weight: 700;
}
.ph-count.badge-success { background: #dcfce7; color: #15803d; }
.page-header-bar .ph-chip {
  font-size: 12px; color: var(--ink-500, #64748b); background: #fff; border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-pill, 999px); padding: 7px 14px; white-space: nowrap;
}
@media (max-width: 640px) {
  .page-header-bar { gap: 10px; }
  .page-header-bar .ph-left { flex: 1 1 100%; }
  .page-header-bar .ph-right { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
  .page-header-bar .ph-right select, .page-header-bar .ph-right .ui-search { flex: 1 1 100%; }
  .page-header-bar .ph-right .ui-search input { width: 100%; min-width: 0; }
  .page-header-bar .page-title { font-size: 18px; }
}

/* ============================================================================================
   .main-content — LƯỚI BẢO VỆ BỐ CỤC toàn cục cho vùng nội dung chính (không bao giờ tràn ngang cửa sổ).
   - overflow-x: hidden theo yêu cầu; nhưng "hidden" biến phần tử thành scroll-container làm HỎNG position:sticky
     bên trong (tiêu đề bảng ghim, thanh sticky) => dùng "clip" (không tạo scroll-container) ở trình duyệt hỗ trợ.
   - Trần 1400px giữ nguyên như .container cũ để màn hình siêu rộng không bị kéo dãn quá mức.
   ============================================================================================ */
.main-content { flex: 1; min-width: 0; max-width: 100%; overflow-x: hidden; padding: 20px 24px; box-sizing: border-box; }
@supports (overflow: clip) { .main-content { overflow-x: clip; } }
.container.main-content { max-width: 1400px; margin: 0 auto; }
.main-content > *, .main-content .card { min-width: 0; max-width: 100%; }
.main-content .table-scroll { max-width: 100%; }
@media (max-width: 640px) { .main-content { padding: 14px 14px; } }
