/* ========== RESET & BASE ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Color Palette */
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --success: #10b981;
  --success-dark: #059669;
  --info: #06b6d4;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #0f172a;
  --light: #f8fafc;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Theme variables - Dark (default) */
  --bg-primary: #020617;
  --bg-secondary: rgba(15, 23, 42, 0.96);
  --bg-tertiary: rgba(15, 23, 42, 0.9);
  --text-primary: #e5e7eb;
  --text-secondary: var(--gray-300);
  --border-color: rgba(148, 163, 184, 0.45);
  --bg-gradient: radial-gradient(circle at top left, #1d4ed8 0, #0f172a 45%, #020617 100%);
  --content-bg: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 55%), #020617;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.75rem;
  --spacing-lg: 1rem;
  --spacing-xl: 1.5rem;
  --spacing-2xl: 2rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 8px 16px -2px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 18px 30px -8px rgba(15, 23, 42, 0.18);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 220ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: rgba(255, 255, 255, 0.98);
  --bg-tertiary: rgba(249, 250, 251, 0.95);
  --text-primary: #111827;
  --text-secondary: var(--gray-700);
  --border-color: rgba(209, 213, 219, 0.8);
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --content-bg: #f9fafb;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ========== APP LAYOUT ========== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-xl);
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: #dc2626;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  flex: 1;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-shrink: 0;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.brand-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-right: var(--spacing-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.brand-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #dc2626;
  text-align: center;
}

.brand-sub {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 600;
  text-align: center;
}

.topbar-meta {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.3);
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #dc2626;
  font-weight: 700;
}

.btn-icon {
  border: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: #dc2626;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.btn-reload.loading i {
  animation: spin 1s linear infinite;
}

.sidebar-toggle {
  display: none; /* Ẩn trên desktop, hiển thị trên mobile */
}

.theme-toggle-container {
  display: flex;
  align-items: center;
}

/* MAIN LAYOUT */
.app-main {
  flex: 1;
  display: flex;
  min-height: 0;
  height: calc(100vh - 56px); /* Chiều cao cố định trừ topbar */
  overflow: hidden; /* Ngăn scroll ở app-main */
}

/* Đảm bảo khi phần DANH SÁCH active, app-main không có overflow */
.app-main:has(#listView.active-view) {
  overflow: hidden !important;
}

/* SIDEBAR - ẨN TRÊN DESKTOP, CHỈ HIỂN THỊ TRÊN MOBILE */
.sidebar {
  display: none;
  width: 200px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  position: fixed;
  left: -220px;
  top: 56px;
  height: calc(100vh - 56px);
  z-index: 900;
  transition: left var(--transition-base), background 0.3s ease, color 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

body.sidebar-open .sidebar {
  left: 0;
}

.sidebar-inner {
  height: fit-content;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md) var(--spacing-sm);
}

.sidebar-section {
  flex: 0 0 auto;
}

.sidebar-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #dc2626;
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 0.4rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
  text-align: center;
  display: inline-block;
  width: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* TAB BUTTONS TRONG SIDEBAR */
.tab-btn {
  border: none;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: #dc2626;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.tab-btn i {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  color: #dc2626;
}

.tab-btn span {
  flex: 1;
  text-align: left;
}

.tab-btn:hover {
  background: linear-gradient(135deg, #fde68a, #fcd34d);
  color: #dc2626;
  transform: translateY(-2px);
  border-color: rgba(220, 38, 38, 0.4);
}

.tab-btn:hover i {
  color: #dc2626;
}

.tab-btn.active {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #dc2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.4);
  border-color: rgba(220, 38, 38, 0.5);
  font-weight: 700;
}

.tab-btn.active i {
  color: #dc2626;
}

/* MENU NGANG TRONG TOPBAR */
.horizontal-menu {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  margin-left: var(--spacing-lg);
}

.menu-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: max-content;
  height: 100%;
}

.horizontal-menu .tab-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  min-width: fit-content;
}

.horizontal-menu .tab-btn:hover {
  transform: translateY(-2px);
}

/* SIDEBAR BACKDROP (MOBILE) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 850;
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

[data-theme="light"] .sidebar-backdrop {
  background: rgba(0, 0, 0, 0.3);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  min-width: 0;
  background: var(--content-bg);
  padding: var(--spacing-lg) var(--spacing-xl) var(--spacing-xl);
  overflow-x: hidden;
  transition: background 0.3s ease;
}

/* Giảm padding-bottom khi phần DANH SÁCH đang active để mở rộng tối đa - dữ liệu phải xuống hết phần thiết bị */
.main-content:has(#listView.active-view) {
  padding-bottom: 0 !important;
  padding-top: 0.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  height: calc(100vh - 56px) !important; /* Trừ chiều cao topbar */
  max-height: calc(100vh - 56px) !important;
  overflow: hidden !important;
}

/* Đảm bảo #listView chiếm hết không gian */
.main-content:has(#listView.active-view) #listView {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Đảm bảo .table-container chiếm hết không gian */
.main-content:has(#listView.active-view) #listView .table-container {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  max-height: 100% !important;
  padding: 0.4rem 0.6rem !important;
  padding-bottom: 0.3rem !important;
  margin: 0 !important;
  overflow: hidden !important;
}

/* Đảm bảo .table-header không chiếm quá nhiều không gian */
.main-content:has(#listView.active-view) #listView .table-header {
  flex-shrink: 0 !important;
  margin-bottom: 0.3rem !important;
  padding-bottom: 0.3rem !important;
}

/* Đảm bảo .table-wrapper chiếm hết không gian còn lại và có scroll */
.main-content:has(#listView.active-view) #listView .table-wrapper {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* ========== FILTERS COMPACT ========== */
.filters {
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 140px;
  flex: 1;
}

.filter-group:has(button) {
  flex: 0 0 auto;
  min-width: auto;
  width: fit-content;
}

.filter-group:has(button) label {
  margin-bottom: 0;
  height: 0;
  overflow: hidden;
}

.filter-group label {
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}

.filter-group select,
.filter-group input {
  padding: 0.3rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.filter-group input[readonly] {
  background: var(--bg-tertiary);
  opacity: 0.7;
  cursor: not-allowed;
}

/* Input with clear button */
.input-with-clear {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-clear input {
  padding-right: 2rem;
  width: 100%;
}

.clear-input-btn {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: all var(--transition-fast);
  z-index: 1;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
}

.clear-input-btn:hover {
  opacity: 1;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

.clear-input-btn:active {
  transform: scale(0.95);
}

.clear-input-btn i {
  font-size: 0.75rem;
}

.input-with-clear input:not(:placeholder-shown):not(:disabled) + .clear-input-btn {
  display: flex;
  opacity: 0.7;
}

.input-with-clear input:disabled + .clear-input-btn {
  display: none;
}

.search-group {
  flex: 2;
  min-width: 220px;
}

/* ========== BUTTONS ========== */
button {
  font-family: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.btn-primary,
.btn-success,
.btn-info {
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  width: fit-content;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #34d399);
  color: #fff;
}

.btn-info {
  background: linear-gradient(135deg, var(--info), #22d3ee);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--success-dark), var(--success));
}

.btn-info:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #0891b2, var(--info));
}

/* Button group with dropdown */
.btn-group {
  display: inline-flex;
  position: relative;
}

.btn-group > button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-dropdown {
  position: relative;
  display: inline-block;
}

.btn-dropdown-toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding: 0.45rem 0.6rem;
  min-width: auto;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 180px;
  margin-top: 4px;
  padding: 0.25rem 0;
}

.btn-dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.8rem;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-item i {
  margin-right: 0.5rem;
  width: 16px;
}

/* ========== VIEWS ========== */
.view {
  display: none;
  animation: fadeIn var(--transition-base);
}

.view.active-view {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== TABLE CONTAINER & TABLE ========== */
.table-container {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-xl);
  padding: 0.75rem 0.9rem;
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.table-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.5);
}

/* Tối ưu cho phần DANH SÁCH - giảm khoảng trắng để hiển thị nhiều dòng hơn */
#listView {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: -0.5rem !important;
  margin-bottom: -0.5rem !important;
}

#listView .table-container {
  padding: 0.4rem 0.6rem !important;
  padding-bottom: 0.4rem !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

#listView .table-header {
  margin-bottom: 0.3rem !important;
  padding-bottom: 0.3rem !important;
  gap: 0.3rem !important;
}

#listView .table-header h2 {
  font-size: 1rem !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  display: inline-block !important;
  min-width: 0 !important;
  overflow: visible !important;
}

#listView .table-header h2 #summaryLabel {
  font-size: 0.85rem !important;
  font-weight: normal !important;
  color: var(--text-secondary) !important;
  line-height: 1.2 !important;
  display: inline !important;
  margin-left: 0.3rem !important;
  white-space: nowrap !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#listView table th,
#listView table td {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
  line-height: 1.3 !important;
}

#listView table th {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
  font-size: 0.85rem !important;
}

#listView table td {
  font-size: 0.875rem !important;
}

.table-header-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: nowrap;
}

/* Đảm bảo h2 trong table-header-title hiển thị đúng */
#listView .table-header-title h2 {
  display: inline-block !important;
  flex-shrink: 0 !important;
  min-width: 0 !important;
  overflow: visible !important;
}

/* Đảm bảo summaryLabel luôn hiển thị trên mọi kích thước màn hình */
#listView .table-header-title h2 #summaryLabel {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
  white-space: nowrap !important;
}

.table-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.table-header span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.list-print-btn-wrapper {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.5rem;
}

.duplicates-btn {
  margin-left: 0;
}

.list-print-btn-wrapper .btn-group {
  display: flex;
  align-items: stretch;
}

/* Scroll wrapper để tiết kiệm chiều cao */
.table-wrapper {
  max-height: calc(100vh - 260px);
  overflow: auto;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

/* ========== TABLE FILTER & SORT (Excel-like) ========== */
#listView table th {
  position: relative;
  user-select: none;
  cursor: pointer;
}

#listView table th .th-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

#listView table th .th-controls {
  display: flex;
  gap: 0.25rem;
  opacity: 1; /* Luôn hiển thị */
}

#listView table th .sort-icon,
#listView table th .filter-icon {
  font-size: 0.75rem;
  color: #06b6d4; /* Màu xanh giống nút in (--info) */
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

#listView table th .sort-icon:hover,
#listView table th .filter-icon:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--primary);
}

#listView table th.sort-asc .sort-icon::before {
  content: "\f0de"; /* fa-sort-up */
  color: #06b6d4; /* Màu xanh giống nút in */
}

#listView table th.sort-desc .sort-icon::before {
  content: "\f0dd"; /* fa-sort-down */
  color: #06b6d4; /* Màu xanh giống nút in */
}

/* Hiển thị số thứ tự sort (1, 2, 3...) */
#listView table th .sort-icon {
  position: relative;
}

#listView table th .sort-icon.sort-order-1::after {
  content: "1";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.5rem;
  font-weight: bold;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.2);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#listView table th .sort-icon.sort-order-2::after {
  content: "2";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.5rem;
  font-weight: bold;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.2);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#listView table th .sort-icon.sort-order-3::after {
  content: "3";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.5rem;
  font-weight: bold;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.2);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#listView table th .sort-icon.sort-order-4::after {
  content: "4";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.5rem;
  font-weight: bold;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.2);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#listView table th .sort-icon.sort-order-5::after {
  content: "5";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.5rem;
  font-weight: bold;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.2);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#listView table th.filter-active .filter-icon {
  color: #06b6d4; /* Màu xanh giống nút in */
}

/* Filter dropdown */
#listView table th .filter-dropdown {
  position: fixed;
  width: 250px;
  height: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  z-index: 99999;
  display: none;
  overflow: hidden;
  padding: 0.5rem;
  resize: both;
  min-width: 200px;
  min-height: 150px;
  max-width: 500px;
  max-height: 500px;
  box-sizing: border-box;
  flex-direction: column;
  color: var(--text-primary);
}

/* Bật resize trên mobile để người dùng có thể kéo rộng ra */
@media (max-width: 768px) {
  #listView table th .filter-dropdown {
    resize: both;
    min-width: 200px;
    min-height: 250px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 100px);
    overflow: hidden;
  }
  
  /* Resize handle rõ ràng hơn trên mobile */
  #listView table th .filter-dropdown::after {
    width: 24px;
    height: 24px;
    background: linear-gradient(-45deg, transparent 25%, var(--text-secondary) 25%, var(--text-secondary) 30%, transparent 30%, transparent 70%, var(--text-secondary) 70%, var(--text-secondary) 75%, transparent 75%);
  }
  
  /* Đảm bảo dropdown không bị cắt trên mobile */
  #listView .table-container {
    overflow: visible;
  }
  
  #listView .table-container .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
  }
}

#listView table th .filter-dropdown.active {
  display: flex !important;
}

/* Header của dropdown để kéo thả */
#listView table th .filter-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  margin: -0.5rem -0.5rem 0.5rem -0.5rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  border-radius: 0.5rem 0.5rem 0 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#listView table th .filter-dropdown-header:active {
  cursor: grabbing;
}

#listView table th .filter-dropdown-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

#listView table th .filter-drag-handle {
  color: var(--text-secondary);
  cursor: grab;
  font-size: 0.875rem;
  padding: 0.25rem;
}

#listView table th .filter-drag-handle:active {
  cursor: grabbing;
}

/* Resize handle cho dropdown - hiển thị ở góc dưới bên phải */
#listView table th .filter-dropdown::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: linear-gradient(-45deg, transparent 30%, var(--text-secondary) 30%, var(--text-secondary) 35%, transparent 35%, transparent 65%, var(--text-secondary) 65%, var(--text-secondary) 70%, transparent 70%);
  cursor: nwse-resize;
  z-index: 10001;
  border-radius: 0 0 0.5rem 0;
}

#listView table th .filter-dropdown:active::after {
  background: linear-gradient(-45deg, transparent 30%, var(--primary) 30%, var(--primary) 35%, transparent 35%, transparent 65%, var(--primary) 65%, var(--primary) 70%, transparent 70%);
}

#listView table th .filter-dropdown .filter-search {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  color: var(--text-primary);
  font-size: 0.875rem;
}

#listView table th .filter-dropdown .filter-options {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 100px;
}

#listView table th .filter-dropdown .filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: background 0.2s;
  color: var(--text-primary);
}

#listView table th .filter-dropdown .filter-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

#listView table th .filter-dropdown .filter-option input[type="checkbox"] {
  cursor: pointer;
}

#listView table th .filter-dropdown .filter-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

#listView table th .filter-dropdown .filter-actions button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

#listView table th .filter-dropdown .filter-actions .btn-apply {
  background: var(--primary);
  color: white;
}

#listView table th .filter-dropdown .filter-actions .btn-apply:hover {
  background: var(--primary-dark);
}

#listView table th .filter-dropdown .filter-actions .btn-clear {
  background: var(--gray-600);
  color: white;
}

#listView table th .filter-dropdown .filter-actions .btn-clear:hover {
  background: var(--gray-700);
}

/* Resize columns giống Excel */
#listView table th {
  position: relative;
}

#listView table th .resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
}

#listView table th .resize-handle:hover {
  background: rgba(0, 0, 0, 0.2);
}

#listView table th.resizing {
  user-select: none;
}

/* Nút bỏ hết lựa chọn trong filter */
#listView table th .filter-dropdown .filter-actions .btn-deselect-all {
  background: var(--warning);
  color: white;
}

#listView table th .filter-dropdown .filter-actions .btn-deselect-all:hover {
  background: #d97706;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: auto;
}

/* Ngoại trừ bảng trong #listView - sẽ dùng table-layout: fixed */
/* Đảm bảo không ảnh hưởng đến #roomView */
#listView table {
  table-layout: fixed !important;
}

/* Đảm bảo #roomView vẫn dùng table-layout: auto */
#roomView table {
  table-layout: auto !important;
}

thead {
  background: #1e40af; /* Nền xanh đậm như hình 2 */
  color: #ffffff; /* Chữ trắng */
  position: sticky;
  top: 0;
  z-index: 5;
}

th {
  padding: 0.35rem 0.6rem;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: visible;
  text-overflow: clip;
}

td {
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  color: var(--text-primary);
  transition: color 0.3s ease, border-color 0.3s ease;
  box-sizing: border-box;
}

/* Override cho #listView - đảm bảo width được áp dụng và tránh chồng lấp */
#listView th,
#listView td {
  box-sizing: border-box !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  padding-left: 0.6rem !important;
  padding-right: 0.6rem !important;
  min-width: fit-content !important;
}

/* Đảm bảo #roomView không bị ảnh hưởng bởi CSS của #listView */
#roomView table th,
#roomView table td {
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  box-sizing: border-box;
}

tbody tr {
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

tbody tr:nth-child(even) {
  background: var(--bg-tertiary);
}

tbody tr:nth-child(odd) {
  background: var(--bg-secondary);
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.18);
}

/* Highlight các hàng trùng lặp */
tbody tr.duplicate-row {
  background: rgba(239, 68, 68, 0.2) !important;
  border-left: 3px solid #ef4444;
}

tbody tr.duplicate-row:hover {
  background: rgba(239, 68, 68, 0.3) !important;
}

/* Điều chỉnh độ rộng thông minh cho các cột trong bảng danh sách (#listView) */
#listView .table-wrapper table,
#listView .table-container table,
#listView table {
  table-layout: auto !important;
  width: auto !important;
  min-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

/* Cột 1: STT */
#listView table th:nth-child(1),
#listView table td:nth-child(1) {
  width: auto !important;
  min-width: 50px !important;
  text-align: center !important;
}

/* Cột 2: SBD */
#listView table th:nth-child(2),
#listView table td:nth-child(2) {
  width: auto !important;
  min-width: 60px !important;
  text-align: center !important;
}

/* Cột 3: HỌ VÀ TÊN - tự động mở rộng theo nội dung */
#listView table th:nth-child(3),
#listView table td:nth-child(3),
#listView .table-wrapper table th:nth-child(3),
#listView .table-wrapper table td:nth-child(3),
#listView .table-container table th:nth-child(3),
#listView .table-container table td:nth-child(3) {
  width: auto !important;
  min-width: 150px !important;
  box-sizing: border-box !important;
}

/* Cột 4: NGÀY SINH */
#listView table th:nth-child(4),
#listView table td:nth-child(4) {
  width: auto !important;
  min-width: 100px !important;
  text-align: center !important;
}

/* Cột 5: LỚP */
#listView table th:nth-child(5),
#listView table td:nth-child(5) {
  width: auto !important;
  min-width: 60px !important;
  text-align: center !important;
}

/* Cột 6: TRƯỜNG THCS - tự động mở rộng theo nội dung */
#listView table th:nth-child(6),
#listView table td:nth-child(6),
#listView .table-wrapper table th:nth-child(6),
#listView .table-wrapper table td:nth-child(6),
#listView .table-container table th:nth-child(6),
#listView .table-container table td:nth-child(6) {
  width: auto !important;
  min-width: 150px !important;
  box-sizing: border-box !important;
}

/* Cột 7: MÔN */
#listView table th:nth-child(7),
#listView table td:nth-child(7) {
  width: auto !important;
  min-width: 80px !important;
  text-align: center !important;
}

/* Cột 8: PHÒNG */
#listView table th:nth-child(8),
#listView table td:nth-child(8) {
  width: auto !important;
  min-width: 120px !important;
}

/* Cột 9: GV BỒI DƯỠNG - tự động mở rộng theo nội dung */
#listView table th:nth-child(9),
#listView table td:nth-child(9) {
  width: auto !important;
  min-width: 150px !important;
}

/* Cột 10: GIÁM THỊ 1 - tự động mở rộng theo nội dung */
#listView table th:nth-child(10),
#listView table td:nth-child(10) {
  width: auto !important;
  min-width: 150px !important;
}

/* Cột 11: GIÁM THỊ 2 - tự động mở rộng theo nội dung */
#listView table th:nth-child(11),
#listView table td:nth-child(11) {
  width: auto !important;
  min-width: 150px !important;
}

/* Cột 12: ĐIỂM */
#listView table th:nth-child(12),
#listView table td:nth-child(12) {
  width: auto !important;
  min-width: 60px !important;
  text-align: center !important;
}

/* Cột 13: GIẢI */
#listView table th:nth-child(13),
#listView table td:nth-child(13) {
  width: auto !important;
  min-width: 60px !important;
  text-align: center !important;
}

/* 3 cột cuối trong bảng BẢNG GỌI TÊN GHI ĐIỂM (mode score): MÃ ĐỀ, KÝ TÊN, ĐIỂM - độ rộng bằng nhau */
#roomView table th:nth-child(9),
#roomView table td:nth-child(9),
#roomView table th:nth-child(10),
#roomView table td:nth-child(10),
#roomView table th:nth-child(11),
#roomView table td:nth-child(11) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
}

/* 3 cột cuối trong bảng PHIẾU THU BÀI HỌC SINH (mode collect): SỐ TỜ, MÃ ĐỀ, KÝ NỘP - độ rộng bằng nhau */
#roomView table th:nth-child(7),
#roomView table td:nth-child(7),
#roomView table th:nth-child(8),
#roomView table td:nth-child(8),
#roomView table th:nth-child(9),
#roomView table td:nth-child(9) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
}

/* ========== ADMIN PANEL ========== */
.admin-panel {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.admin-panel h3 {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--spacing-sm);
  align-items: flex-end;
}

.admin-row .filter-group {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}

.admin-row .filter-group:has(button) {
  flex: 0 0 auto;
  min-width: auto;
  max-width: none;
  width: fit-content;
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--spacing-sm);
  padding: 0.5rem 0.6rem;
  background: var(--bg-tertiary);
  border-radius: 0.5rem;
  border-left: 3px solid var(--primary-light);
  transition: color 0.3s ease, background 0.3s ease;
}

/* ========== LOOKUP RESULT ========== */
.lookup-result {
  margin-top: var(--spacing-sm);
  padding: 0.7rem 0.8rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.06));
  border-radius: 0.6rem;
  border: 1px solid rgba(59, 130, 246, 0.5);
}

.lookup-result p {
  margin: 0.15rem 0;
  font-size: 0.8rem;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.lookup-result strong {
  color: #bfdbfe;
  font-weight: 600;
}

/* ========== ROOM CONFIG ========== */
.room-config {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.room-config h2 {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.room-config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  row-gap: 0.2rem;
  margin-top: var(--spacing-xs);
}

.room-config-row .btn-primary,
.room-config-row .btn-success,
.room-config-row .btn-info {
  flex: 1;
  min-width: 0;
  width: 100%;
  justify-content: center;
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-config-row .btn-group {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
}

.room-config-row .btn-group > button:first-child {
  flex: 1;
  min-width: 0;
  width: auto;
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-config-row .btn-dropdown {
  display: flex;
  align-items: stretch;
}

.room-config-row .btn-dropdown-toggle {
  font-size: 0.8rem;
  padding: 0.45rem 0.6rem;
  min-width: auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== WEATHER ========== */
/* ITLAND Container */
.itland-container {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.itland-container iframe {
  width: 100%;
  height: calc(100vh - 56px);
  border: none;
  display: block;
}

/* DỊCH VỤ Container */
.service-container {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.service-container iframe {
  width: 100%;
  height: calc(100vh - 56px);
  border: none;
  display: block;
}

/* GIÁO DỤC Container */
.education-container {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.education-container iframe {
  width: 100%;
  height: calc(100vh - 56px);
  border: none;
  display: block;
}

/* VĂN BẢN Container */
.document-container {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.document-container iframe {
  width: 100%;
  height: calc(100vh - 56px);
  border: none;
  display: block;
}

/* PHẢN HỒI Container */
.feedback-container {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.feedback-container iframe {
  width: 100%;
  height: calc(100vh - 56px);
  border: none;
  display: block;
}

.weather-container {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-xl);
  padding: var(--spacing-xl);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.weather-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.weather-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: color 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.weather-location-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 0.25rem 0.75rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--primary-light);
  font-weight: 500;
}

.weather-location-badge i {
  font-size: 0.75rem;
}

.weather-location-badge.hidden {
  display: none !important;
}

.weather-recent-searches.hidden {
  display: none !important;
}

.weather-header-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.weather-search-section {
  margin-bottom: var(--spacing-xl);
}

.weather-search-card {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-radius: 1rem;
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.weather-search-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: 0.75rem;
  padding: var(--spacing-sm);
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.weather-search-input-wrapper:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.weather-search-icon {
  color: var(--primary-light);
  font-size: 1.2rem;
  margin-left: var(--spacing-sm);
}

.weather-search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  padding: var(--spacing-sm);
  outline: none;
}

.weather-search-input-wrapper input::placeholder {
  color: var(--text-secondary);
}

.weather-search-btn {
  margin: 0;
  white-space: nowrap;
}

.weather-quick-cities {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

.weather-recent-searches {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
  margin-top: var(--spacing-sm);
}

.weather-recent-searches .quick-city-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}

.weather-recent-searches .quick-city-btn i {
  margin-right: 0.25rem;
  font-size: 0.7rem;
}

.quick-cities-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-right: var(--spacing-xs);
}

.quick-city-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.quick-city-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.weather-result {
  min-height: 400px;
}

.weather-welcome {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--text-secondary);
}

.weather-welcome-icon {
  font-size: 4rem;
  color: var(--primary-light);
  margin-bottom: var(--spacing-md);
  opacity: 0.7;
}

.weather-welcome h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.weather-welcome p {
  font-size: 1rem;
  color: var(--text-secondary);
}

.weather-main-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 1rem;
  padding: var(--spacing-2xl);
  color: white;
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--spacing-xl);
  position: relative;
  overflow: hidden;
}

.weather-main-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.weather-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  font-size: 1.3rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.weather-temp-main {
  font-size: 5rem;
  font-weight: 700;
  text-align: center;
  margin: var(--spacing-lg) 0;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
}

.weather-main-icon {
  font-size: 4rem !important;
  margin-right: 1rem;
  opacity: 0.9;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.temp-number {
  line-height: 1;
}

.temp-unit {
  font-size: 3rem;
  opacity: 0.8;
}

.weather-description-main {
  font-size: 1.5rem;
  text-align: center;
  margin: var(--spacing-md) 0;
  text-transform: capitalize;
  position: relative;
  z-index: 1;
  font-weight: 500;
}

.weather-time-info {
  text-align: center;
  margin: var(--spacing-md) 0;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  font-size: 1rem;
}

.weather-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
  position: relative;
  z-index: 1;
}

.weather-detail-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: var(--spacing-lg);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.weather-detail-card:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.weather-detail-icon {
  font-size: 1.8rem;
  margin-bottom: var(--spacing-sm);
  opacity: 0.9;
}

.weather-detail-label {
  display: block;
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
}

.weather-detail-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.weather-forecast {
  margin-top: var(--spacing-xl);
}

.weather-forecast-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--border-color);
}

.weather-forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--spacing-md);
}

.weather-forecast-item {
  background: var(--bg-tertiary);
  border-radius: 0.75rem;
  padding: var(--spacing-md);
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.weather-forecast-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.weather-forecast-day {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  font-size: 0.9rem;
}

.weather-forecast-icon {
  font-size: 2rem;
  margin: var(--spacing-sm) 0;
  color: var(--primary-light);
}

.weather-forecast-temp {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--spacing-xs) 0;
}

.weather-forecast-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-top: var(--spacing-xs);
}

/* Hourly Forecast */
.weather-hourly {
  margin-top: var(--spacing-xl);
  background: var(--bg-tertiary);
  border-radius: 1rem;
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
}

.weather-hourly-scroll {
  display: flex;
  gap: var(--spacing-md);
  overflow-x: auto;
  padding: var(--spacing-sm) 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-light) transparent;
}

.weather-hourly-scroll::-webkit-scrollbar {
  height: 6px;
}

.weather-hourly-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.weather-hourly-scroll::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 3px;
}

.weather-hourly-item {
  min-width: 100px;
  text-align: center;
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.weather-hourly-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  background: rgba(59, 130, 246, 0.1);
}

.weather-hourly-time {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.weather-hourly-icon {
  font-size: 1.5rem;
  color: var(--primary-light);
  margin: var(--spacing-xs) 0;
}

.weather-hourly-temp {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--spacing-xs) 0;
}

.weather-hourly-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-top: var(--spacing-xs);
}

/* Skeleton Loading */
.weather-skeleton {
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-card {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.05) 25%, 
    rgba(255, 255, 255, 0.1) 50%, 
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.skeleton-main {
  height: 400px;
  margin-bottom: var(--spacing-xl);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-md);
}

.skeleton-grid .skeleton-card {
  height: 120px;
}

@keyframes pulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.weather-error {
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
  border: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: 1rem;
  color: var(--danger);
  text-align: center;
}

.weather-error i {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.7;
}

.weather-error p {
  font-size: 1rem;
  margin: var(--spacing-sm) 0;
}

.weather-loading {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--text-secondary);
}

.weather-loading i {
  font-size: 3rem;
  animation: spin 1s linear infinite;
  margin-bottom: var(--spacing-md);
  color: var(--primary-light);
}

.weather-loading p {
  font-size: 1rem;
  color: var(--text-primary);
  margin-top: var(--spacing-md);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive cho weather */
@media (max-width: 768px) {
  .weather-container {
    padding: var(--spacing-md);
  }
  
  .weather-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .weather-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .weather-temp-main {
    font-size: 3.5rem;
    flex-direction: column;
    align-items: center;
  }
  
  .weather-main-icon {
    font-size: 3rem !important;
    margin-right: 0 !important;
    margin-bottom: var(--spacing-sm);
  }
  
  .temp-number {
    font-size: 3.5rem;
  }
  
  .temp-unit {
    font-size: 2rem;
  }
  
  .weather-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .weather-forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .weather-search-input-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  
  .weather-search-btn {
    width: 100%;
    margin-top: var(--spacing-sm);
  }
  
  .weather-quick-cities {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .quick-city-btn {
    width: 100%;
  }
  
  .weather-hourly-item {
    min-width: 80px;
  }
  
  .weather-hourly-icon {
    font-size: 1.2rem;
  }
  
  .weather-hourly-temp {
    font-size: 1rem;
  }
}

/* ========== STATS ========== */
.stats-container {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-xl);
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
  text-align: center;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  flex-wrap: nowrap;
}

.stats-container h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 0.4rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
  text-align: center;
  display: inline-block;
  width: auto;
  transition: color 0.3s ease, border-color 0.3s ease;
  flex-shrink: 0;
}

.stats-print-btn-wrapper {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.stats-print-btn-wrapper .btn-group {
  display: flex;
  align-items: stretch;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: var(--spacing-md);
}

.stat-card {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 0.5rem;
  padding: 0.4rem 0.5rem;
  text-align: center;
  transition: all var(--transition-base);
  border: 1px solid rgba(220, 38, 38, 0.2);
  position: relative;
  overflow: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 70px;
}

.stat-card::before {
  display: none;
}

.stat-card h3 {
  margin: 0 0 0.2rem 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  transition: color 0.3s ease;
}

.stat-card p {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #dc2626;
  line-height: 1.2;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.4);
}

.stats-subtables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

/* THỐNG KÊ CÁ NHÂN ĐẠT GIẢI */
.stats-awards-section {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-xl);
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  margin-top: var(--spacing-xl);
}

.stats-awards-section h3 {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 1rem;
  font-weight: 700;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 0.4rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
  text-align: center;
  display: inline-block;
}

/* Tabs đã được loại bỏ, hiển thị tất cả trong một bảng */

.awards-content {
  margin-top: var(--spacing-md);
}

.awards-content .table-wrapper {
  max-height: 500px;
  overflow-y: auto;
}

/* ========== BIỂU MẪU THÔNG BÁO CHO GIA ĐÌNH, PHỤ HUYNH VÀ THÍ SINH ĐẠT GIẢI ========== */
.awards-notification-form-section {
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-xl);
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  margin-top: var(--spacing-xl);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.awards-notification-form-section h3 {
  margin: 0 0 var(--spacing-lg) 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.8rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.08));
  border-radius: 0.5rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
  text-align: center;
  display: inline-block;
}

.notification-form-container {
  margin-top: var(--spacing-md);
}

.notification-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--spacing-lg);
  align-items: start;
}

.form-section {
  background: var(--bg-tertiary);
  border-radius: 0.7rem;
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  transition: all var(--transition-base);
  min-width: 0;
}

/* Tất cả các phần form đều sắp xếp ngang khi màn hình đủ rộng */
.form-section-full-width {
  grid-column: span 1;
}

/* Phần XÁC NHẬN cũng sắp xếp ngang như các phần khác */
.form-section-confirm {
  grid-column: span 1;
  display: flex;
  align-items: center;
  padding: var(--spacing-md) var(--spacing-lg);
}

.form-section-confirm .form-checkbox {
  margin-top: 0;
  width: 100%;
}

.form-section:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.form-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section-title i {
  font-size: 1rem;
  color: var(--primary);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-width: 0;
}

.form-group.full-width {
  flex: 1 1 100%;
  min-width: 100%;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  transition: color 0.3s ease;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 0.2rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  transition: all var(--transition-base);
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  width: 220px;
}

.form-group textarea {
  width: 100%;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 12px;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-group select:hover {
  border-color: var(--primary-light);
}

.form-group select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233b82f6' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--bg-secondary);
}

.form-group input:read-only,
.form-group input[readonly] {
  background: var(--bg-primary);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
  width: 100%;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
  margin: 0;
}

.form-checkbox label {
  margin: 0;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  line-height: 1.5;
  flex: 1;
  word-wrap: break-word;
  white-space: normal;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

.form-actions button {
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-submit-form {
  background: var(--primary);
  color: white;
}

.btn-submit-form:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-submit-form:active {
  transform: translateY(0);
}

.btn-reset-form {
  background: var(--gray-600);
  color: white;
}

.btn-reset-form:hover {
  background: var(--gray-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-print-form {
  background: var(--info);
  color: white;
}

.btn-print-form:hover {
  background: #0891b2;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.form-success-message {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08));
  border-radius: 0.6rem;
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  animation: slideIn 0.3s ease-out;
}

.form-success-message.hidden {
  display: none;
}

.form-success-message i {
  font-size: 1.5rem;
  color: var(--success);
  flex-shrink: 0;
}

.form-success-message p {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== RESPONSIVE CHO FORM ========== */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  
  .form-group {
    width: 100%;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions button {
    width: 100%;
    justify-content: center;
  }
}

/* Tối ưu cho màn hình nhỏ hơn */
@media (max-width: 480px) {
  .form-section {
    padding: var(--spacing-md);
  }
  
  .form-row {
    gap: var(--spacing-xs);
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* Tối ưu cho màn hình lớn - dàn nhiều cột hơn */
@media (min-width: 1200px) {
  .form-row {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
  }
}

@media (min-width: 1600px) {
  .form-row {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* Responsive cho form */
@media (max-width: 1200px) {
  .notification-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .form-group {
    width: 100%;
    flex: 1 1 100%;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100% !important;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions button {
    width: 100%;
    justify-content: center;
  }
}

/* Tối ưu cho màn hình nhỏ hơn */
@media (max-width: 480px) {
  .form-section {
    padding: var(--spacing-md);
  }
  
  .form-row {
    gap: var(--spacing-xs);
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    width: 100% !important;
  }
}

/* Tối ưu cho màn hình lớn - hiển thị nhiều cột */
@media (min-width: 1400px) {
  .notification-form {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: var(--spacing-xl);
  }
}

@media (min-width: 1800px) {
  .notification-form {
    grid-template-columns: repeat(3, 1fr);
  }
}

.subtable {
  background: var(--bg-tertiary);
  border-radius: 0.8rem;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease, border-color 0.3s ease;
  text-align: center;
}

.subtable h3 {
  margin: 0 0 0.4rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 0.4rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
  text-align: center;
  display: inline-block;
  width: auto;
  transition: color 0.3s ease;
}

.awards-note {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.05));
  border-radius: 0.75rem;
  border: 2px solid rgba(37, 99, 235, 0.3);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
  text-align: left;
}

.awards-note-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid rgba(37, 99, 235, 0.3);
}

.awards-note-content {
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.awards-note-content p {
  margin: 0.4rem 0;
  padding-left: var(--spacing-sm);
  position: relative;
}

.awards-note-content p:first-child {
  margin-top: 0;
}

.awards-note-content p:last-child {
  margin-bottom: 0;
}

/* GIẢI THÍCH CÁCH TÍNH TOP GIẢI */
.top-score-note {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(74, 222, 128, 0.05));
  border-radius: 0.75rem;
  border: 2px solid rgba(34, 197, 94, 0.3);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
  text-align: left;
}

.top-score-note-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #22c55e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid rgba(34, 197, 94, 0.3);
}

.top-score-note-content {
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.top-score-note-content p {
  margin: 0.4rem 0;
  padding-left: var(--spacing-sm);
  position: relative;
}

.top-score-note-content p:first-child {
  margin-top: 0;
}

.top-score-note-content p:last-child {
  margin-bottom: 0;
}

.top-score-note-content ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.top-score-note-content li {
  margin: 0.3rem 0;
  line-height: 1.6;
}

.top-score-note-content strong {
  color: var(--primary-light);
  font-weight: 600;
}

.top-score-note-content em {
  color: var(--text-secondary);
  font-style: italic;
}

.top-score-formula {
  text-align: center;
  font-weight: 600;
  color: var(--primary-light);
  margin: 0.6rem 0;
}

.top-score-example {
  text-align: center;
  font-weight: 600;
  color: var(--success);
  margin: 0.6rem 0;
}

/* GIẢI THÍCH CHI TIẾT CÁCH XẾP GIẢI */
.awards-explanation {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(74, 222, 128, 0.05));
  border-radius: 0.75rem;
  border: 2px solid rgba(34, 197, 94, 0.3);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
  text-align: left;
}

.awards-explanation-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #22c55e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid rgba(34, 197, 94, 0.3);
}

.awards-explanation-content {
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.awards-explanation-content p {
  margin: 0.6rem 0;
  padding-left: var(--spacing-sm);
  position: relative;
}

.awards-explanation-content p:first-child {
  margin-top: 0;
}

.awards-explanation-content p:last-child {
  margin-bottom: 0;
}

.awards-explanation-content ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.awards-explanation-content li {
  margin: 0.4rem 0;
  line-height: 1.6;
}

.awards-explanation-content strong {
  color: var(--primary-light);
  font-weight: 600;
}

.awards-explanation-content em {
  color: var(--text-secondary);
  font-style: italic;
}

.awards-explanation-hidden {
  display: none !important;
}

.awards-explanation-select {
  margin: var(--spacing-md) 0;
  padding: var(--spacing-md);
  background: rgba(34, 197, 94, 0.05);
  border-radius: 0.5rem;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.awards-explanation-select label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.awards-explanation-select .subject-select {
  width: 100%;
  max-width: 300px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
}

.awards-explanation-select .subject-select:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.explanation-student-list {
  margin: var(--spacing-md) 0;
  overflow-x: auto;
}

.explanation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  overflow: hidden;
}

.explanation-table thead {
  background: rgba(34, 197, 94, 0.15);
}

.explanation-table th {
  padding: 0.5rem;
  text-align: center;
  font-weight: 600;
  border-bottom: 2px solid rgba(34, 197, 94, 0.3);
  color: var(--text-primary);
}

.explanation-table td {
  padding: 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.explanation-table tbody tr:hover {
  background: rgba(34, 197, 94, 0.05);
}

.explanation-table tbody tr:nth-child(even) {
  background: rgba(34, 197, 94, 0.02);
}

/* GIẢI THÍCH CHI TIẾT THEO TRƯỜNG */
.school-explanation {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(192, 132, 252, 0.05));
  border-radius: 0.75rem;
  border: 2px solid rgba(168, 85, 247, 0.3);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.15);
  text-align: left;
}

.school-explanation-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #a855f7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid rgba(168, 85, 247, 0.3);
}

.school-explanation-select {
  margin: var(--spacing-md) 0;
  padding: var(--spacing-md);
  background: rgba(168, 85, 247, 0.05);
  border-radius: 0.5rem;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.school-explanation-select label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.school-explanation-select .school-select {
  width: 100%;
  max-width: 300px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
}

.school-explanation-select .school-select:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.school-explanation-content {
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.school-explanation-content p {
  margin: 0.6rem 0;
  padding-left: var(--spacing-sm);
  position: relative;
}

.school-explanation-content p:first-child {
  margin-top: 0;
}

.school-explanation-content p:last-child {
  margin-bottom: 0;
}

.school-explanation-content ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.school-explanation-content li {
  margin: 0.4rem 0;
  line-height: 1.6;
}

.school-explanation-content strong {
  color: var(--primary-light);
  font-weight: 600;
}

.school-explanation-content em {
  color: var(--text-secondary);
  font-style: italic;
}

.school-explanation-hidden {
  display: none !important;
}

/* ========== FOOTER ========== */
/* Footer chỉ hiển thị trong phần TRA CỨU, ẩn trong phần DANH SÁCH */
.page-footer {
  text-align: center;
  font-size: 0.8rem;
  color: rgba(249, 250, 251, 0.75);
  padding-top: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

/* Ẩn footer khi không ở phần TRA CỨU */
#listView .page-footer,
#roomView .page-footer,
#weatherView .page-footer {
  display: none !important;
}

/* Hiển thị footer trong phần TRA CỨU */
#lookupView .page-footer {
  display: block !important;
}

.page-footer p {
  margin: 0.1rem 0;
}

.footer-version {
  font-size: 0.75rem;
  opacity: 0.65;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  max-width: 360px;
}

.toast {
  background: var(--bg-secondary);
  border-radius: 0.8rem;
  padding: 0.55rem 0.75rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideInRight var(--transition-base);
  border-left: 3px solid var(--primary);
  min-width: 260px;
  transition: background 0.3s ease;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideInRight {
  from {
    transform: translateX(320px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon {
  font-size: 1.1rem;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast-message {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
  transition: color 0.3s ease;
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  transition: background 0.3s ease;
}

[data-theme="light"] .loading-overlay {
  background: rgba(255, 255, 255, 0.9);
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  text-align: center;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(148, 163, 184, 0.5);
  border-top-color: #e5e7eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--spacing-sm);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner p {
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0;
}

/* ========== SCROLLBAR STYLING ========== */
.table-wrapper::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

.table-wrapper::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.8);
  border-radius: 999px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 1);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .main-content {
    padding: var(--spacing-md);
  }

  .table-wrapper {
    max-height: calc(100vh - 280px);
  }
}

@media (max-width: 900px) {
  /* Ẩn menu ngang trên mobile */
  .horizontal-menu {
    display: none !important;
  }

  /* Hiển thị sidebar toggle trên mobile */
  .sidebar-toggle {
    display: inline-flex !important;
  }

  /* Hiển thị sidebar trên mobile */
  .sidebar {
    display: block;
    position: fixed;
    left: -220px;
    top: 56px;
    transition: left var(--transition-base);
    height: calc(100vh - 56px);
    width: 200px;
    z-index: 900;
  }

  body.sidebar-open .sidebar {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 850;
    display: none;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
  
  [data-theme="light"] .sidebar-backdrop {
    background: rgba(0, 0, 0, 0.3);
  }

  .room-config-row .btn-primary,
  .room-config-row .btn-success,
  .room-config-row .btn-info {
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
  }

  .room-config-row .btn-primary i,
  .room-config-row .btn-success i,
  .room-config-row .btn-info i {
    font-size: 0.75rem;
  }
  
  .room-config-row .btn-group {
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  
  .room-config-row .btn-group > button:first-child {
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
    width: auto;
  }
  
  .room-config-row .btn-dropdown-toggle {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    height: 100%;
  }

  .main-content {
    padding: var(--spacing-md);
  }

  .filters {
    margin-bottom: var(--spacing-md);
  }

  .filter-group {
    min-width: 48%;
  }

  .table-wrapper {
    max-height: calc(100vh - 260px);
  }

  .admin-row .filter-group {
    max-width: 180px;
  }
}

@media (max-width: 768px) {
  .admin-row .filter-group {
    min-width: calc(50% - 0.25rem);
    max-width: calc(50% - 0.25rem);
    flex: 0 0 calc(50% - 0.25rem);
  }

  .admin-row .filter-group:has(button) {
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 var(--spacing-md);
  }

  .brand-title {
    font-size: 0.8rem;
  }

  .brand-sub {
    display: none;
  }

  /* Đảm bảo summaryLabel luôn hiển thị trên màn hình nhỏ */
  #listView .table-header h2 {
    position: relative;
  }

  /* Đảm bảo summaryLabel không bị ẩn */
  #listView .table-header h2 #summaryLabel {
    position: relative !important;
    text-indent: 0 !important;
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.9rem !important;
    white-space: nowrap !important;
  }
  
  /* Ẩn text "DANH SÁCH THÍ SINH" khi sidebar ẩn trên mobile */
  #listView .table-header-title h2 {
    display: inline-block !important;
  }
  
  /* Khi sidebar ẩn, chỉ hiển thị summaryLabel */
  #listView .table-header-title h2:has(#summaryLabel:not(:empty)) {
    /* Text node sẽ được ẩn bằng JavaScript, chỉ giữ lại summaryLabel */
  }

  /* Cho phép cuộn ngang khi màn hình nhỏ */
  #listView .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Đảm bảo bảng tự động mở rộng theo nội dung và có thể cuộn ngang */
  #listView table {
    table-layout: auto !important;
    width: auto !important;
    min-width: 100% !important;
  }

  /* Đảm bảo các cột tự động mở rộng theo nội dung, không bị chồng lấp */
  #listView table th,
  #listView table td {
    padding: 0.25rem 0.6rem !important;
    min-width: max-content !important;
    width: auto !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }
  
  /* Tối ưu thêm cho màn hình nhỏ - giảm khoảng trắng tối đa */
  .main-content {
    padding-top: 0.5rem !important;
    padding-bottom: 0.3rem !important;
  }
  
  #listView .table-container {
    padding: 0.3rem 0.5rem !important;
    padding-bottom: 0.3rem !important;
    margin-bottom: 0 !important;
  }
  
  #listView {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  
  #listView .table-header {
    margin-bottom: 0.25rem !important;
    padding-bottom: 0.25rem !important;
  }
  
  #listView .table-header h2 {
    font-size: 0.9rem !important;
  }
  
  #listView .table-header h2::before {
    font-size: 0.9rem !important;
  }
  
  #listView .table-header span {
    font-size: 0.8rem !important;
  }

  /* Đảm bảo dropdown hiển thị đúng trên mobile - kích thước nhỏ nhất đủ chức năng khi mở */
  #listView table th .filter-dropdown {
    z-index: 99999 !important;
    position: fixed !important;
    resize: both !important;
    min-width: 200px !important;
    min-height: 250px !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100vh - 100px) !important;
  }
  
  /* Đảm bảo table-container không che dropdown */
  #listView .table-container {
    overflow: visible;
  }
  
  #listView .table-container .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
  }

  .stats-header {
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }

  .stats-header h2 {
    flex: 0 0 auto;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }

  .stats-print-btn-wrapper {
    flex: 0 0 auto;
  }

  .stats-print-btn-wrapper .btn-info {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }

  .topbar-meta {
    display: none;
  }

  .filters {
    padding: 0.5rem 0.6rem;
  }

  .filter-group {
    min-width: auto;
    flex: 0 0 auto;
    width: fit-content;
    max-width: 180px;
  }

  .filter-group select,
  .filter-group input[type="text"] {
    width: 100%;
    min-width: 120px;
  }

  .admin-panel {
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }

  .admin-panel h3 {
    font-size: 0.85rem;
    margin-bottom: var(--spacing-sm);
    padding-bottom: 0.3rem;
  }

  .admin-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .admin-row .filter-group {
    min-width: calc(50% - 0.15rem);
    max-width: calc(50% - 0.15rem);
    flex: 0 0 calc(50% - 0.15rem);
  }

  .admin-row .filter-group:has(button) {
    min-width: calc(50% - 0.15rem);
    max-width: calc(50% - 0.15rem);
    flex: 0 0 calc(50% - 0.15rem);
  }

  .admin-row .filter-group select,
  .admin-row .filter-group input {
    width: 100%;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
  }

  .admin-row .btn-primary,
  .admin-row .btn-success {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    justify-content: center;
  }

  .help-text {
    font-size: 0.75rem;
    padding: 0.5rem;
  }

  .room-config {
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }

  .room-config h2 {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    padding-bottom: 0.3rem;
  }

  .room-config-row {
    gap: 0.15rem;
    row-gap: 0.15rem;
  }

  .room-config-row .filter-group {
    min-width: calc(50% - 0.075rem);
    flex: 0 0 calc(50% - 0.075rem);
  }

  .room-config-row .btn-primary,
  .room-config-row .btn-success,
  .room-config-row .btn-info {
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
    gap: 0.25rem;
    width: 100%;
  }

  .room-config-row .btn-primary i,
  .room-config-row .btn-success i,
  .room-config-row .btn-info i {
    font-size: 0.7rem;
  }
  
  .room-config-row .btn-group {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: stretch;
  }
  
  .room-config-row .btn-group > button:first-child {
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
    gap: 0.25rem;
    width: auto;
  }
  
  .room-config-row .btn-dropdown {
    display: flex;
    align-items: stretch;
  }
  
  .room-config-row .btn-dropdown-toggle {
    font-size: 0.7rem;
    padding: 0.35rem 0.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ========== PRINT STYLES ========== */
/* Ẩn trên màn hình, hiển thị khi in */
.hide-on-screen {
  display: none;
}

@media print {
  /* Ẩn các cột Giám thị 1, Giám thị 2 khi in */
  .hide-on-print {
    display: none !important;
  }
  
  /* Hiển thị các cột ẩn trên màn hình khi in */
  .hide-on-screen {
    display: table-cell !important;
  }

  /* Riêng bảng PHÒNG THI (niêm yết, gọi tên, thu bài): bỏ hoàn toàn cột Ghi chú khi in */
  .print-room .hide-on-screen {
    display: none !important;
  }
  
  /* Ẩn tên giáo viên bồi dưỡng nhưng giữ lại cột */
  .hide-teacher-name-on-print {
    display: none !important;
  }
  
  /* Ngăn cách giữa các phòng khi in tất cả */
  .print-room-section {
    page-break-after: always;
    page-break-inside: avoid;
  }
  
  .print-room-section:last-child {
    page-break-after: auto;
  }
  
  /* Đảm bảo header và footer của mỗi phòng hiển thị đúng */
  .print-room-section .print-header {
    display: block !important;
  }
  
  .print-room-section .print-signature-wrapper,
  .print-room-section .print-score-footer,
  .print-room-section .print-collect-footer {
    display: block !important;
  }
  
  .print-room-section .print-page-info {
    display: block !important;
  }
  
  @page {
    margin: 0;
    size: A4;
    margin-bottom: 15mm;
  }
  
  @page {
    @bottom-center {
      content: "Trang " counter(page) " / " counter(pages);
      font-size: 9px;
      color: #666;
      font-style: italic;
      text-align: center;
    }
  }
  
  /* Khởi tạo counter cho số trang */
  body {
    counter-reset: page;
  }

  body {
    background: #fff !important;
    margin: 0;
    padding: 0;
    color: #000 !important;
  }

  * {
    color: #000 !important;
  }

  .topbar,
  .sidebar,
  .filters,
  .room-config,
  .page-footer,
  .toast-container,
  .loading-overlay {
    display: none !important;
  }

  .main-content {
    padding: 10mm;
    margin: 0;
    background: #fff !important;
    color: #000 !important;
  }

  /* Mặc định: ẩn statsView và listView, hiển thị roomView */
  #statsView {
    display: none !important;
  }

  #listView {
    display: none !important;
  }

  #roomView {
    display: block !important;
  }

  /* Khi in danh sách: hiển thị listView, ẩn roomView và statsView */
  body.printing-list #listView {
    display: block !important;
    visibility: visible !important;
  }

  body.printing-list #listView * {
    visibility: visible !important;
  }

  body.printing-list #roomView,
  body.printing-list #statsView {
    display: none !important;
  }

  body.printing-list .list-print-btn-wrapper {
    display: none !important;
  }

  /* Khi in thống kê: hiển thị statsView, ẩn roomView và listView */
  body.printing-stats .main-content {
    padding: 10mm !important;
  }

  body.printing-stats #statsView {
    display: block !important;
    visibility: visible !important;
  }

  body.printing-stats #statsView * {
    visibility: visible !important;
  }

  body.printing-stats #roomView,
  body.printing-stats #listView {
    display: none !important;
  }

  body.printing-stats .stats-container {
    display: block !important;
    background: white !important;
    color: black !important;
    visibility: visible !important;
  }

  body.printing-stats .stats-container * {
    visibility: visible !important;
  }

  body.printing-stats .stats-grid {
    display: grid !important;
    visibility: visible !important;
  }

  body.printing-stats .stat-card {
    display: flex !important;
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    color: #dc2626 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    visibility: visible !important;
  }

  body.printing-stats .stats-subtables {
    display: block !important;
    visibility: visible !important;
  }

  body.printing-stats .subtable {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    margin-bottom: var(--spacing-xl) !important;
    page-break-inside: avoid !important;
  }

  body.printing-stats .subtable table {
    width: 100% !important;
    border-collapse: collapse !important;
    display: table !important;
    table-layout: auto !important;
    visibility: visible !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 14px !important;
    word-wrap: break-word !important;
  }
  
  body.printing-stats .subtable table * {
    border-color: #000 !important;
  }

  body.printing-stats .subtable table thead {
    display: table-header-group !important;
    visibility: visible !important;
  }

  body.printing-stats .subtable table tbody {
    display: table-row-group !important;
    visibility: visible !important;
  }

  body.printing-stats .subtable table tr {
    display: table-row !important;
    visibility: visible !important;
  }

  body.printing-stats .subtable table th,
  body.printing-stats .subtable table td {
    display: table-cell !important;
    text-align: center !important;
    padding: 2px 3px !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
    visibility: visible !important;
    vertical-align: middle !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.25 !important;
    overflow: visible !important;
    white-space: normal !important;
    hyphens: auto !important;
    background: #fff !important;
    color: #000 !important;
  }
  
  body.printing-stats .subtable table th {
    padding: 4px 5px !important;
    line-height: 1.4 !important;
    font-size: 14px !important;
    font-weight: normal !important;
  }
  
  body.printing-stats .subtable table td {
    font-size: 14px !important;
    font-weight: normal !important;
  }

  /* Cột thứ tự */
  body.printing-stats .subtable table th:nth-child(1),
  body.printing-stats .subtable table td:nth-child(1) {
    width: auto !important;
    min-width: 30px !important;
    max-width: 50px !important;
    text-align: center !important;
  }

  /* Cột tên (trường hoặc môn) */
  body.printing-stats .subtable table th:nth-child(2),
  body.printing-stats .subtable table td:nth-child(2) {
    width: auto !important;
    min-width: 100px !important;
    text-align: left !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  /* Các cột số liệu */
  body.printing-stats .subtable table th:nth-child(3),
  body.printing-stats .subtable table td:nth-child(3),
  body.printing-stats .subtable table th:nth-child(4),
  body.printing-stats .subtable table td:nth-child(4),
  body.printing-stats .subtable table th:nth-child(5),
  body.printing-stats .subtable table td:nth-child(5),
  body.printing-stats .subtable table th:nth-child(6),
  body.printing-stats .subtable table td:nth-child(6),
  body.printing-stats .subtable table th:nth-child(7),
  body.printing-stats .subtable table td:nth-child(7),
  body.printing-stats .subtable table th:nth-child(8),
  body.printing-stats .subtable table td:nth-child(8),
  body.printing-stats .subtable table th:nth-child(9),
  body.printing-stats .subtable table td:nth-child(9),
  body.printing-stats .subtable table th:nth-child(10),
  body.printing-stats .subtable table td:nth-child(10) {
    width: auto !important;
    min-width: 60px !important;
    text-align: center !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  body.printing-stats .stats-multiple-rooms {
    display: none !important;
    visibility: hidden !important;
  }

  body.printing-stats .stats-header {
    display: flex !important;
    justify-content: flex-start !important;
  }

  body.printing-stats .stats-print-btn-wrapper {
    display: none !important;
  }

  body.printing-stats .stats-container h2 {
    margin-bottom: var(--spacing-md) !important;
  }

  body.printing-stats .table-wrapper {
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    max-height: none !important;
  }

  body.printing-stats .subtable .table-wrapper {
    width: 100% !important;
  }

  /* Ẩn nút in khi in thống kê */
  body.printing-stats .stats-print-btn-wrapper {
    display: none !important;
  }
  
  /* Định dạng in cho bảng CÁC CÁ NHÂN ĐẠT GIẢI giống với các bảng thống kê */
  body.printing-stats .stats-awards-section {
    background: #fff !important;
    color: #000 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-top: var(--spacing-xl) !important;
  }
  
  body.printing-stats .stats-awards-section h3 {
    background: #fff !important;
    color: #000 !important;
    border: none !important;
    padding: 0.3rem 0.6rem !important;
    margin-bottom: var(--spacing-md) !important;
  }
  
  body.printing-stats .stats-awards-section table {
    border: 1px solid #000 !important;
    border-collapse: collapse !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 14px !important;
  }
  
  body.printing-stats .stats-awards-section table * {
    border-color: #000 !important;
  }
  
  body.printing-stats .stats-awards-section table th,
  body.printing-stats .stats-awards-section table td {
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
    background: #fff !important;
    color: #000 !important;
    padding: 2px 3px !important;
    line-height: 1.25 !important;
    font-size: 14px !important;
  }
  
  body.printing-stats .stats-awards-section table th {
    padding: 4px 5px !important;
    line-height: 1.4 !important;
    font-weight: normal !important;
  }

  .print-room {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    border: none;
    background: #fff !important;
    color: #000 !important;
  }

  .table-wrapper {
    max-height: none;
    overflow: visible;
  }

  table {
    font-size: 14px;
    border-collapse: collapse !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    table-layout: auto;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
  }
  
  table * {
    border-color: #000 !important;
  }

  th,
  td {
    padding: 2px 3px;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
    word-wrap: break-word;
    line-height: 1.25;
    overflow: visible;
    white-space: normal;
  }

  th {
    white-space: normal;
    text-align: center;
    padding: 4px 5px !important;
    line-height: 1.4 !important;
    vertical-align: middle;
    font-size: 14px;
    color: #000 !important;
    background: #fff !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }

  td {
    font-size: 14px;
    color: #000 !important;
    font-weight: normal !important;
    background: #fff !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }
  
  thead th,
  tbody td,
  tbody th {
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }

  /* Tăng chiều cao dòng gấp đôi cho bảng PHÒNG THI (3 nút in) nhưng giữ nguyên độ rộng cột */
  .print-room table {
    border: 1px solid #000 !important;
    border-collapse: collapse !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }
  
  .print-room table * {
    border-color: #000 !important;
  }
  
  .print-room table thead {
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }
  
  .print-room table thead th,
  .print-room table thead tr th {
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }
  
  .print-room table th {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    line-height: 1.6 !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }

  .print-room table td {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    line-height: 1.5 !important;
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }
  
  .print-room table tbody td,
  .print-room table tbody th {
    border: 1px solid #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #000 !important;
  }

  /* Không đảo màu header khi in, giữ nền trắng chữ đen */
  thead {
    background: #fff !important;
    color: #000 !important;
  }

  /* Ẩn tiêu đề mặc định khi in, dùng header theo mẫu A4 */
  .print-room .table-header {
    display: none;
  }

  .print-header {
    display: block;
    margin-top: 1em;
    margin-bottom: 8px;
    font-size: 13px;
    color: #000 !important;
  }
  
  /* Khi phòng có từ 26 thí sinh trở lên: giảm chiều cao header/footer, KHÔNG thay đổi bảng */
  .print-room-section.many-students .print-header,
  .print-room.many-students .print-header {
    margin-top: 0.3em !important;
    margin-bottom: 3px !important;
    font-size: 11px !important;
  }
  
  .print-room-section.many-students .print-header-row,
  .print-room.many-students .print-header-row {
    margin-bottom: 3px !important;
  }
  
  .print-room-section.many-students .print-header-center,
  .print-room.many-students .print-header-center {
    margin-bottom: 3px !important;
  }
  
  .print-room-section.many-students .print-main-title,
  .print-room.many-students .print-main-title {
    margin-bottom: 2px !important;
    font-size: 12px !important;
  }

  .print-header * {
    color: #000 !important;
  }

  .print-header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
  }

  .print-header-left {
    text-align: left;
    width: 48%;
  }

  .print-header-left > div:first-child {
    margin-left: 1.3em;
    /* Không bôi đậm dòng UBND PHƯỜNG HỒNG BÀNG dù dùng <strong> */
    font-weight: normal;
  }

  .print-header-left > div:first-child strong {
    font-weight: normal;
  }

  .print-header-left > div:last-child {
    margin-left: 1em;
  }

  .print-header-right {
    text-align: right;
    width: 48%;
  }

  .print-header-right > div:first-child {
    margin-right: 1em;
  }

  .print-header-right > div:last-child {
    text-align: right;
    padding-right: 0;
    margin-right: 4.8em;
  }

  .print-header-center {
    text-align: center;
    margin-bottom: 8px;
  }

  .print-main-title {
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 4px;
  }

  .print-underline {
    text-decoration: underline;
  }

  /* Phần ký tên cuối bản in */
  .print-signature-wrapper {
    margin-top: 1em;
    padding-top: 0;
    color: #000 !important;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: flex-start;
  }
  
  /* Giảm chiều cao signature khi có nhiều thí sinh */
  .print-room-section.many-students .print-signature-wrapper,
  .print-room.many-students .print-signature-wrapper {
    margin-top: 0.3em !important;
  }
  
  .print-room-section.many-students .print-signature-date,
  .print-room.many-students .print-signature-date {
    margin-bottom: 5mm !important;
    margin-top: 0.3em !important;
    font-size: 10px !important;
  }
  
  .print-room-section.many-students .print-signature-title,
  .print-room.many-students .print-signature-title {
    font-size: 13px !important;
    margin-top: -1em !important;
  }
  
  .print-room-section.many-students .print-signature-spacing,
  .print-room.many-students .print-signature-spacing {
    height: 2em !important;
  }
  
  .print-room-section.many-students .print-signature-name,
  .print-room.many-students .print-signature-name {
    font-size: 11px !important;
  }

  .print-signature-wrapper * {
    color: #000 !important;
  }

  .print-signature-right {
    text-align: center;
    margin-left: auto;
    margin-right: 0;
    width: auto;
    min-width: 200px;
    max-width: 300px;
  }

  .print-signature-date {
    text-align: center;
    font-size: 12px;
    font-style: italic;
    margin-bottom: 12px;
    margin-right: 0;
    margin-top: 1em;
  }

  .print-signature-title {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 0;
    margin-right: 0;
    margin-top: -0.5em;
  }

  .print-signature-spacing {
    height: 6em;
    margin-bottom: 0;
  }

  .print-signature-name {
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-right: 0;
    margin-top: 0;
    display: block;
  }

  .print-signature-name:first-of-type {
    margin-top: 2em;
  }

  /* Cho phép chỉnh sửa ngày tháng khi in */
  [contenteditable="true"] {
    min-width: 20px;
    display: inline-block;
    border-bottom: 1px dotted #000;
    padding: 0 2px;
  }

  @media print {
    [contenteditable="true"] {
      border-bottom: 1px dotted #000;
    }
  }

  /* Footer thời gian in và số trang */
  .print-page-info {
    display: none !important;
    position: fixed;
    bottom: 5mm;
    left: 0;
    right: 0;
    width: 100%;
    font-size: 9px;
    color: #666 !important;
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .print-page-info-content {
    text-align: center;
    font-style: italic;
  }

  .print-page-info-time {
    text-align: center;
    font-style: italic;
  }

  @media print {
    .print-page-info {
      display: flex !important;
    }
    
    .print-page-info-clone {
      display: flex !important;
    }
    
    /* Số trang sẽ được hiển thị bằng @page @bottom-center */
    /* Thời gian sẽ được thêm vào bằng JavaScript */
  }

  /* Footer riêng cho BẢNG GỌI TÊN GHI ĐIỂM */
  .print-score-footer {
    display: none;
    margin-top: 0;
    padding-top: 2mm;
    color: #000 !important;
    page-break-inside: avoid;
    flex-direction: row;
    justify-content: space-between;
    gap: 20mm;
  }
  
  /* Giảm chiều cao score footer khi có nhiều thí sinh */
  .print-room-section.many-students .print-score-footer,
  .print-room.many-students .print-score-footer {
    margin-top: 0 !important;
    padding-top: 0 !important;
    font-size: 10px !important;
  }
  
  .print-room-section.many-students .print-score-footer-left,
  .print-room-section.many-students .print-score-footer-right,
  .print-room.many-students .print-score-footer-left,
  .print-room.many-students .print-score-footer-right {
    font-size: 10px !important;
  }
  
  .print-room-section.many-students .print-score-footer-title,
  .print-room.many-students .print-score-footer-title {
    font-size: 11px !important;
    margin-bottom: 4px !important;
  }
  
  .print-room-section.many-students .print-score-footer-date,
  .print-room.many-students .print-score-footer-date {
    font-size: 10px !important;
    margin-bottom: 6px !important;
  }
  
  .print-room-section.many-students .print-score-footer-info,
  .print-room.many-students .print-score-footer-info {
    margin-bottom: 6px !important;
  }
  
  .print-room-section.many-students .print-score-footer-info > div,
  .print-room.many-students .print-score-footer-info > div {
    margin-bottom: 3px !important;
    line-height: 1.3 !important;
  }
  
  .print-room-section.many-students .print-score-footer-signature,
  .print-room.many-students .print-score-footer-signature {
    margin-top: 8px !important;
  }
  
  .print-room-section.many-students .print-score-footer-signature > div:first-child,
  .print-room.many-students .print-score-footer-signature > div:first-child {
    font-size: 11px !important;
  }
  
  .print-room-section.many-students .print-score-footer-name,
  .print-room.many-students .print-score-footer-name {
    font-size: 10px !important;
  }
  
  .print-room-section.many-students .print-score-footer-signature > div:first-child + .print-score-footer-name,
  .print-room.many-students .print-score-footer-signature > div:first-child + .print-score-footer-name {
    margin-top: 5em !important;
  }
  
  /* Thu nhỏ dòng Phạm Thị Xuân Hòa (dòng cuối cùng) khi có 26-30 thí sinh */
  .print-room-section.many-students .print-score-footer-left .print-score-footer-signature .print-score-footer-name:last-of-type,
  .print-room.many-students .print-score-footer-left .print-score-footer-signature .print-score-footer-name:last-of-type,
  .print-room-section.many-students .print-score-footer-right .print-score-footer-signature .print-score-footer-name:last-of-type,
  .print-room.many-students .print-score-footer-right .print-score-footer-signature .print-score-footer-name:last-of-type {
    font-size: 10px !important;
  }

  .print-score-footer * {
    color: #000 !important;
  }

  .print-score-footer-left,
  .print-score-footer-right {
    flex: 1;
    font-size: 12px;
  }

  .print-score-footer-right {
    margin-left: 11em;
  }

  .print-score-footer-title {
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: center;
  }

  .print-score-footer-date {
    font-size: 12px;
    font-style: italic;
    margin-bottom: 12px;
    text-align: center;
    margin-right: 0;
  }

  .print-score-footer-info {
    margin-bottom: 12px;
  }

  .print-score-footer-info > div {
    margin-bottom: 6px;
    line-height: 1.6;
  }

  .print-score-footer-spacer {
    height: 1em;
    margin: 0;
    padding: 0;
  }

  .print-score-footer-info .editable-field {
    min-width: 200px;
    display: inline;
    border-bottom: none;
    padding: 0;
    text-align: left;
    background-image: none;
    line-height: 1.4;
    color: #333;
    letter-spacing: 1px;
    white-space: nowrap;
  }
  
  .print-score-footer-date .editable-field {
    border-bottom: none;
    padding: 0;
    background-image: none;
    min-width: 40px;
    display: inline;
    line-height: 1.4;
    color: #333;
    letter-spacing: 1px;
    white-space: nowrap;
  }
  
  .print-score-footer-info > div {
    white-space: nowrap;
  }

  .print-score-footer-signature {
    margin-top: 15px;
    text-align: center;
  }

  .print-score-footer-signature > div:first-child {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 0 !important;
    margin-right: 0;
    margin-top: 0;
    display: block;
  }
  
  /* Khoảng cách từ TRƯỞNG BAN/TỔ TRƯỞNG xuống TRƯỞNG PHÒNG VHXH - dùng adjacent sibling selector */
  .print-score-footer-signature > div:first-child + .print-score-footer-name {
    margin-top: 7.5em !important;
    margin-bottom: 0 !important;
  }

  .print-score-footer-name {
    font-size: 12px;
    margin-bottom: 0 !important;
    margin-right: 0;
    display: block;
  }
  
  /* Dòng cuối cùng (Phạm Thị Xuân Hòa) sát với dòng trên */
  .print-score-footer-signature > .print-score-footer-name:last-of-type {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Bên BAN COI THI: 2 dòng tên TRƯỞNG PHÒNG VHXH + Phạm Thị Xuân Hòa đậm, dịch xuống */
  .print-score-footer-left .print-score-footer-name {
    font-weight: bold !important;
    font-size: 13px;
  }

  .print-score-footer-left .print-score-footer-signature .print-score-footer-name:first-of-type {
    margin-top: 7.5em !important;
    margin-right: 0;
    margin-bottom: 0;
  }
  
  .print-score-footer-left .print-score-footer-signature .print-score-footer-name:last-of-type {
    margin-top: 0 !important;
    margin-right: 0;
    margin-bottom: 0;
    font-weight: 700 !important;
    font-size: 13px !important;
  }

  /* Bên TỔ KHỚP PHÁCH VÀO ĐIỂM: giống bên trái */
  .print-score-footer-right .print-score-footer-name {
    font-weight: bold !important;
    font-size: 13px;
    margin-right: 0;
  }
  
  .print-score-footer-right .print-score-footer-signature .print-score-footer-name:first-of-type {
    margin-top: 7.5em !important;
    margin-right: 0;
    margin-bottom: 0;
  }
  
  .print-score-footer-right .print-score-footer-signature .print-score-footer-name:last-of-type {
    margin-top: 0 !important;
    margin-right: 0;
    margin-bottom: 0;
    font-weight: 700 !important;
    font-size: 13px !important;
  }

  /* Footer riêng cho PHIẾU THU BÀI HỌC SINH */
  .print-collect-footer {
    display: none;
    margin-top: calc(20mm - 7em);
    padding-top: 10mm;
    color: #000 !important;
    page-break-inside: avoid;
    flex-direction: row;
    justify-content: space-between;
    gap: 20mm;
  }
  
  /* Giảm chiều cao collect footer khi có nhiều thí sinh */
  .print-room-section.many-students .print-collect-footer,
  .print-room.many-students .print-collect-footer {
    margin-top: 0.3em !important;
    padding-top: 0 !important;
    font-size: 10px !important;
  }
  
  .print-room-section.many-students .print-collect-footer-proctor > div,
  .print-room.many-students .print-collect-footer-proctor > div {
    margin-bottom: 3px !important;
    line-height: 1.3 !important;
  }
  
  .print-room-section.many-students .print-collect-footer-date,
  .print-room.many-students .print-collect-footer-date {
    font-size: 10px !important;
    margin-bottom: 6px !important;
  }
  
  .print-room-section.many-students .print-collect-footer-signature,
  .print-room.many-students .print-collect-footer-signature {
    margin-top: 8px !important;
  }
  
  .print-room-section.many-students .print-collect-footer-signature > div:first-child,
  .print-room.many-students .print-collect-footer-signature > div:first-child {
    font-size: 11px !important;
  }
  
  .print-room-section.many-students .print-collect-footer-name,
  .print-room.many-students .print-collect-footer-name {
    font-size: 10px !important;
  }

  .print-collect-footer * {
    color: #000 !important;
  }

  .print-collect-footer-left,
  .print-collect-footer-right {
    flex: 1;
    font-size: 12px;
    margin-top: 1em;
  }

  .print-collect-footer-proctor {
    margin-bottom: 12px;
  }

  .print-collect-footer-proctor > div {
    margin-bottom: 12px;
    line-height: 1.6;
  }

  .print-collect-footer-proctor .editable-field {
    min-width: 200px;
    display: inline;
    border-bottom: none;
    padding: 0;
    text-align: left;
    background-image: none;
    line-height: 1.4;
    color: #333;
    letter-spacing: 1px;
    white-space: nowrap;
  }

  .print-collect-footer-date .editable-field {
    border-bottom: none;
    padding: 0;
    background-image: none;
    min-width: 40px;
    display: inline;
    line-height: 1.4;
    color: #333;
    letter-spacing: 1px;
    white-space: nowrap;
  }
  
  .print-collect-footer-proctor > div {
    white-space: nowrap;
  }

  .print-collect-footer-date {
    font-size: 12px;
    font-style: italic;
    margin-bottom: 12px;
    text-align: center;
    margin-right: 0;
  }

  .print-collect-footer-signature {
    margin-top: 15px;
    text-align: center; /* Căn giữa cả khối TRƯỞNG BAN + TRƯỞNG PHÒNG VHXH + Phạm Thị Xuân Hòa */
  }

  .print-collect-footer-signature > div:first-child {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
    margin-top: -0.5em;
    margin-right: 0;
  }

  .print-collect-footer-name {
    font-size: 12px;
    margin-bottom: 4px;
    margin-right: 0;
    display: block;
  }
  
  .print-collect-footer-name:nth-of-type(1) {
    margin-top: 20em;
    font-weight: bold !important;
    font-size: 13px;
  }
  
  .print-collect-footer-name:nth-of-type(2) {
    margin-top: 6em;
    font-weight: 700 !important;
    font-size: 13px !important;
  }

  @media print {
    /* Ẩn footer mặc định khi in mode score hoặc collect */
    .print-mode-score .print-signature-wrapper,
    .print-mode-collect .print-signature-wrapper {
      display: none !important;
    }
    
    /* Hiển thị footer score khi in mode score */
    .print-mode-score .print-score-footer {
      display: flex !important;
    }
    
    /* Hiển thị footer collect khi in mode collect */
    .print-mode-collect .print-collect-footer {
      display: flex !important;
    }
    
    /* Ẩn footer score khi không phải mode score */
    .print-room:not(.print-mode-score) .print-score-footer {
      display: none !important;
    }
    
    /* Ẩn footer collect khi không phải mode collect */
    .print-room:not(.print-mode-collect) .print-collect-footer {
      display: none !important;
    }
    
    /* Hiển thị footer mặc định khi không phải mode score hoặc collect */
    .print-room:not(.print-mode-score):not(.print-mode-collect) .print-signature-wrapper {
      display: flex !important;
      flex-direction: row !important;
      justify-content: flex-end !important;
      align-items: flex-start !important;
    }
    
    .print-score-footer-info .editable-field,
    .print-score-footer-date .editable-field {
      border-bottom: none !important;
      background-image: none !important;
    }
    
    .print-collect-footer-proctor .editable-field,
    .print-collect-footer-date .editable-field {
      border-bottom: none !important;
      background-image: none !important;
    }
    
    .print-collect-footer-name:nth-of-type(2) {
      font-weight: 700 !important;
      font-size: 13px !important;
    }
    
    /* Đảm bảo khoảng cách cho score footer - giảm xuống 1/4 nữa */
    .print-score-footer-left .print-score-footer-signature .print-score-footer-name:first-of-type,
    .print-score-footer-right .print-score-footer-signature .print-score-footer-name:first-of-type {
      margin-top: 7.5em !important;
      margin-right: 0 !important;
      margin-bottom: 0 !important;
    }
    
    .print-score-footer-signature > div:first-child + .print-score-footer-name {
      margin-top: 7.5em !important;
      margin-bottom: 0 !important;
    }
    
    .print-score-footer-left .print-score-footer-signature .print-score-footer-name:last-of-type,
    .print-score-footer-right .print-score-footer-signature .print-score-footer-name:last-of-type {
      margin-top: 0 !important;
      margin-right: 0 !important;
      margin-bottom: 0 !important;
      font-weight: 700 !important;
      font-size: 13px !important;
    }
  }

  /* Dòng tổng ở cuối bảng phòng thi */
  .room-total-row td {
    border-top: 2px solid #000;
    color: #000 !important;
    background: #fff !important;
  }

  /* Căn chỉnh độ rộng cột tự động - chỉ đặt min-width để đảm bảo không quá hẹp */
  .print-room table th:nth-child(1),
  .print-room table td:nth-child(1) {
    min-width: 25px;
    max-width: 35px;
  }

  .print-room table th:nth-child(2),
  .print-room table td:nth-child(2) {
    min-width: 35px;
    max-width: 50px;
  }

  .print-room table th:nth-child(3),
  .print-room table td:nth-child(3) {
    min-width: 100px;
  }

  .print-room table th:nth-child(4),
  .print-room table td:nth-child(4) {
    min-width: 60px;
    max-width: 80px;
  }

  .print-room table th:nth-child(5),
  .print-room table td:nth-child(5) {
    min-width: 35px;
    max-width: 50px;
  }

  .print-room table th:nth-child(6),
  .print-room table td:nth-child(6) {
    min-width: 80px;
  }

  .print-room table th:nth-child(7),
  .print-room table td:nth-child(7) {
    min-width: 60px;
    max-width: 80px;
  }

  .print-room table th:nth-child(8),
  .print-room table td:nth-child(8) {
    min-width: 60px;
    max-width: 80px;
  }

  /* 3 cột cuối cho mode score: MÃ ĐỀ, KÝ TÊN, ĐIỂM - độ rộng bằng nhau */
  .print-room.print-mode-score table th:nth-child(9),
  .print-room.print-mode-score table td:nth-child(9),
  .print-room.print-mode-score table th:nth-child(10),
  .print-room.print-mode-score table td:nth-child(10),
  .print-room.print-mode-score table th:nth-child(11),
  .print-room.print-mode-score table td:nth-child(11) {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    text-align: center;
  }

  /* 3 cột cuối cho mode collect: SỐ TỜ, MÃ ĐỀ, KÝ NỘP - độ rộng bằng nhau */
  .print-room.print-mode-collect table th:nth-child(7),
  .print-room.print-mode-collect table td:nth-child(7),
  .print-room.print-mode-collect table th:nth-child(8),
  .print-room.print-mode-collect table td:nth-child(8),
  .print-room.print-mode-collect table th:nth-child(9),
  .print-room.print-mode-collect table td:nth-child(9) {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    text-align: center;
  }
}

/* Header in A4 chỉ hiển thị khi in (mặc định ẩn trên màn hình) */
@media screen {
  .print-header {
    display: none;
  }
  .print-signature-wrapper {
    display: none;
  }
  .print-score-footer {
    display: none !important;
  }
  .print-collect-footer {
    display: none !important;
  }
  .print-page-info {
    display: none !important;
  }
}

/* ========== BÁO CÁO THÍ SINH THI NHIỀU PHÒNG ========== */
.stats-multiple-rooms {
  margin-top: 2rem;
}

.multiple-rooms-warning {
  color: var(--warning);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.no-multiple-rooms {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  display: none;
}

/* ========== ACCESSIBILITY / REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== MODAL STYLES ========== */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.share-btn i {
  font-size: 1.2rem;
}

.share-format-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.share-format-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  font-weight: 500;
}

.share-format-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-format-btn i {
  font-size: 1.5rem;
}

.share-format-btn[data-format="pdf"] i {
  color: #ef4444;
}

.share-format-btn[data-format="excel"] i {
  color: #10b981;
}

/* ========== LOOKUP RESULT CONTAINER ========== */
.lookup-result-container {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.lookup-result-card {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  flex: 1;
  min-width: 280px;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.lookup-result-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.lookup-result-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.lookup-result-header p {
  margin: 0;
  color: #1f2937;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
}

.lookup-header-bold {
  font-weight: 700 !important;
}

.lookup-header-italic-underline {
  font-style: italic;
  text-decoration: underline;
}

.lookup-header-bold-underline {
  font-weight: 700 !important;
  text-decoration: underline;
}

.lookup-header-bold {
  font-weight: 700 !important;
}

.lookup-header-italic-underline {
  font-style: italic;
  text-decoration: underline;
}

.lookup-result-body {
  margin-top: 0.5rem;
}

.lookup-result-body p {
  margin: 0.4rem 0;
  color: #1f2937;
  font-size: 0.95rem;
  line-height: 1.6;
}

.lookup-result-card strong {
  font-weight: 600;
  color: #111827;
  min-width: 90px;
  display: inline-block;
}

.lookup-result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.lookup-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
  min-width: 120px;
  white-space: nowrap;
}

.lookup-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.lookup-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.lookup-action-btn i {
  font-size: 1rem;
}

.lookup-btn-share {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #ffffff;
}

.lookup-btn-share:hover {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.lookup-btn-save {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #ffffff;
}

.lookup-btn-save:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

.lookup-btn-print {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #ffffff;
}

.lookup-btn-print:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

/* Responsive cho lookup result */
@media (max-width: 768px) {
  .lookup-result-container {
    flex-direction: column;
  }
  
  .lookup-result-actions {
    flex-direction: row;
    width: 100%;
  }
  
  .lookup-action-btn {
    flex: 1;
    min-width: auto;
  }
  
  .lookup-result-card {
    min-width: 100%;
  }
}
