:root {
  --primary: #0052cc;
  --primary-dark: #003d99;
  --primary-light: #e6f0ff;
  --secondary: #0284c7;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #003d99 0%, #0052cc 60%, #0284c7 100%);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000 !important;
  flex-wrap: wrap;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.youth-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  border: 2px solid #facc15;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.brand-title p {
  font-size: 12px;
  opacity: 0.9;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  flex-shrink: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.header-actions::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.date-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.date-pill:hover {
  background: rgba(255, 255, 255, 0.25);
}

.user-pill {
  background: rgba(0, 0, 0, 0.2);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #15803d;
}

.btn-warning {
  background: #f59e0b;
  color: #fff;
}
.btn-warning:hover:not(:disabled) {
  background: #d97706;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-outline {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Navigation Tabs */
.nav-tabs {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  position: relative;
  z-index: 50 !important;
  flex-wrap: nowrap;
}

.nav-tab {
  padding: 12px 18px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
}

.nav-tab:hover {
  color: var(--primary);
  background: #f8fafc;
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-light);
}

/* Nav Tab Dropdown */
.nav-tab-dropdown-container {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.nav-tab-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 440px;
  max-width: 460px;
  background: #ffffff;
  border: 1.5px solid #0052cc;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  padding: 8px;
  z-index: 99999;
  flex-direction: column;
  gap: 6px;
}

.nav-tab-dropdown-container:hover .nav-tab-dropdown-menu,
.nav-tab-dropdown-container.open .nav-tab-dropdown-menu,
.nav-tab-dropdown-menu.show-menu {
  display: flex !important;
}

.nav-tab-dropdown-item {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  transition: all 0.15s ease;
  line-height: 1.35;
  text-align: left;
}

.nav-tab-dropdown-item:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #0052cc;
  transform: translateY(-1px);
}

.nav-tab-dropdown-item.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

.nav-tab-dropdown-item .item-sub {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}

/* Main Container */
.main-container {
  padding: 16px 20px;
  max-width: 100%;
}

/* Cards & Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.panel {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #f8fafc;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 16px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
}

.month-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.month-pill {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.month-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.month-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Form Controls */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.15);
}

/* THE 131-COLUMN MASTER SPREADSHEET TABLE */
.spreadsheet-wrapper,
#master-spreadsheet-wrapper {
  width: 100% !important;
  flex: 1 1 auto !important;
  height: calc(100vh - 128px) !important;
  min-height: 520px !important;
  max-height: none !important;
  overflow: auto !important;
  box-sizing: border-box !important;
  position: relative;
  border: 1.5px solid #94a3b8;
  background: #fff;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-x pan-y !important;
  overscroll-behavior-x: contain !important;
  scroll-behavior: smooth;
  border-radius: 6px;
  margin-bottom: 2px !important;
}

.master-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  font-size: 12.5px;
}

.master-table th,
.master-table td {
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 8px;
  vertical-align: middle;
}

/* Row 1: Title Banner - CỐ ĐỊNH NỀN XANH CHỮ TRẮNG KHÔNG BỊ TRÔI MẤT KHI CUỘN */
.master-table tr.row-banner {
  height: 36px !important;
  max-height: 36px !important;
}
.master-table tr.row-banner th {
  background: #003d99 !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  text-align: left;
  padding: 4px 10px !important;
  height: 36px !important;
  max-height: 36px !important;
  line-height: 28px !important;
  position: sticky;
  top: 0 !important;
  z-index: 25 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.master-table tr.row-banner th.sticky-col-stt {
  background: #003d99 !important;
  color: #ffffff !important;
  left: 0 !important;
  top: 0 !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  z-index: 60 !important;
}

@media (min-width: 769px) {
  .master-table tr.row-banner th.sticky-col-unit,
  .master-table tr.row-banner th.banner-unit-cell {
    background: #003d99 !important;
    color: #ffffff !important;
    left: 42px !important;
    top: 0 !important;
    z-index: 60 !important;
    width: 370px !important;
    min-width: 370px !important;
    max-width: 370px !important;
    white-space: nowrap !important;
  }
}
@media (max-width: 768px) {
  .master-table tr.row-banner th.banner-unit-cell {
    width: 145px !important;
    min-width: 145px !important;
    max-width: 145px !important;
  }
}

/* Row 2: Criterion Names */
.master-table tr.row-titles th {
  background: #dbeafe;
  color: #0f172a;
  font-weight: 700;
  text-align: center;
  min-width: 125px;
  max-width: 155px;
  height: 96px;
  font-size: 11.5px;
  line-height: 1.3;
  position: sticky;
  top: 38px;
  z-index: 35;
  white-space: normal;
}



/* Row 4: Column Labels (Cột 1 .. Cột 131) */
.master-table tr.row-cols th {
  background: #fed7aa;
  color: #7c2d12;
  font-weight: 700;
  text-align: center;
  font-size: 11px;
  height: 28px;
  position: sticky;
  top: 178px;
  z-index: 25;
}

@media (min-width: 769px) {\n/* Sticky Left Columns: STT, ĐƠN VỊ, TỔNG ĐIỂM / ĐÃ ĐẠT (CỐ ĐỊNH 2 CHIỀU FREEZE PANES) */
.master-table .sticky-col-stt,
.sticky-col-stt {
  position: sticky !important;
  left: 0 !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  padding: 6px 2px !important;
  text-align: center;
  background: #ffffff !important;
  z-index: 18 !important;
  font-weight: 700;
  box-sizing: border-box !important;
}

.master-table .sticky-col-unit,
.sticky-col-unit {
  position: sticky !important;
  left: 42px !important;
  width: 290px !important;
  min-width: 290px !important;
  max-width: 290px !important;
  text-align: left;
  background: #ffffff !important;
  z-index: 18 !important;
  font-weight: 600;
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.35 !important;
  padding: 6px 10px !important;
  box-sizing: border-box !important;
}

.master-table .sticky-col-total,
.sticky-col-total {
  position: sticky !important;
  left: 332px !important;
  width: 80px !important;
  min-width: 80px !important;
  max-width: 80px !important;
  text-align: center;
  background: #fff9db !important;
  font-weight: 800;
  color: #b45309;
  font-size: 13px;
  z-index: 18 !important;
  box-shadow: 3px 0 6px rgba(0,0,0,0.12) !important;
  border-right: 2px solid #0052cc !important;
  box-sizing: border-box !important;
}

/* Corner intersections in thead need higher z-index (50 - 60) to always stay on top */
.master-table thead th.sticky-col-stt,
thead th.sticky-col-stt {
  position: sticky !important;
  left: 0 !important;
  z-index: 55 !important;
  background: #f1f5f9 !important;
  box-sizing: border-box !important;
}

.master-table thead th.sticky-col-unit,
thead th.sticky-col-unit {
  position: sticky !important;
  left: 42px !important;
  z-index: 55 !important;
  background: #f1f5f9 !important;
  box-sizing: border-box !important;
}

.master-table thead th.sticky-col-total,
thead th.sticky-col-total {
  position: sticky !important;
  left: 332px !important;
  z-index: 55 !important;
  background: #fef3c7 !important;
  box-shadow: 3px 0 6px rgba(0,0,0,0.12) !important;
  border-right: 2px solid #0052cc !important;
  box-sizing: border-box !important;
}

.master-table tr.row-banner th.sticky-col-stt,
.master-table tr.row-banner th.sticky-col-unit,
.master-table tr.row-banner th.sticky-col-total {
  top: 0 !important;
  z-index: 60 !important;
}

.master-table tr.row-titles th.sticky-col-stt,
.master-table tr.row-titles th.sticky-col-unit,
.master-table tr.row-titles th.sticky-col-total {
  top: 38px;
  z-index: 55 !important;
}

.master-table tr.row-cols th.sticky-col-stt,
.master-table tr.row-cols th.sticky-col-unit,
.master-table tr.row-cols th.sticky-col-total {
  top: 178px;
  z-index: 50 !important;
}\n}

.master-table tbody tr:hover td {
  background-color: #f0f9ff;
}

.master-table tbody tr:hover td.sticky-col-unit {
  background-color: #e0f2fe;
}

.master-table tbody tr.highlight-unit td {
  background-color: #eff6ff;
}
.master-table tbody tr.highlight-unit td.sticky-col-unit {
  background-color: #dbeafe;
  color: var(--primary-dark);
}

/* Score Cell */
.score-cell {
  text-align: center;
  position: relative;
  padding: 2px !important;
}

.score-input {
  width: 100%;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  border-radius: 4px;
  padding: 2px 4px;
}

.score-input:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #fff;
}

.score-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0,82,204,0.2);
}

.score-input.neg-score {
  color: #dc2626;
  font-weight: 700;
}

.score-input.pos-score {
  color: #0369a1;
}

.evidence-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}

.evidence-dot.ontime {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.evidence-dot.late {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--primary-light);
  color: var(--primary);
}

/* Monthly Report Cards Grid (Unit View) */
.report-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.report-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.report-card:hover {
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(0, 82, 204, 0.08);
}

.report-card.done-card {
  border-left: 4px solid var(--success);
  background: #f8fff9;
}

.report-card.late-card {
  border-left: 4px solid var(--warning);
}

/* Login Screen */
.login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #002b66 0%, #0052cc 55%, #0284c7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.login-header {
  background: #f8fafc;
  padding: 24px 28px 18px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.login-header .logo-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  border: 3px solid #facc15;
}

.login-body {
  padding: 24px 28px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 5px;
  color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
}

/* Modal */
#modal-root {
  position: relative;
  z-index: 9999999 !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999 !important;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: #fff;
  position: relative;
  z-index: 10000000 !important;
  width: 100%;
  max-width: 640px;
  border-radius: 10px;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 4px solid #38bdf8;
  max-width: 420px;
}

.toast.success {
  border-left-color: #22c55e;
}
.toast.warning {
  border-left-color: #f59e0b;
}
.toast.error {
  border-left-color: #ef4444;
}

/* Standard Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border-light);
  padding: 8px 10px;
  text-align: left;
}

.data-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e293b;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}


/* Auth Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 16px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(0, 82, 204, 0.04);
}

/* Mobile & Tablet Responsive (chỉ áp dụng khi màn hình cực nhỏ như điện thoại) */
@media (max-width: 640px) {
  .app-header {
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .header-actions {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 4px !important;
  }
  .nav-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 0 10px;
  }
  .nav-tab {
    flex-shrink: 0;
  }
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .login-card {
    margin: 10px;
    width: calc(100% - 20px);
    max-width: 100%;
  }
  .modal-card {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto;
  }
  .main-container {
    padding: 10px !important;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
}


/* Column move buttons */
.col-move-btns {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-bottom: 3px;
}
.btn-col-move {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  font-size: 10px;
  padding: 1px 5px;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}
.btn-col-move:hover {
  background: #fff;
  color: #003d99;
}


/* Note indicator in score cells */
.score-has-note-dot {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
.cell-score:hover .score-has-note-dot {
  opacity: 1;
  transform: scale(1.15);
}


/* =========================================================================
   MOBILE RESPONSIVENESS & SMOOTH TOUCH SWIPING ENHANCEMENTS (< 768px)
   ========================================================================= */
@media (max-width: 768px) {
  /* Header compact on mobile */
  .app-header {
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .app-title h1 {
    font-size: 13.5px !important;
    line-height: 1.25 !important;
  }
  .header-actions {
    gap: 4px !important;
    width: 100% !important;
    justify-content: flex-start !important;
  }
  .header-actions .btn {
    padding: 4px 7px !important;
    font-size: 11px !important;
  }

  /* 1. FILTER BAR RESTRUCTURED FOR MOBILE - NO CUTOFFS */
  .filter-bar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    overflow-x: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .filter-month-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .month-pills {
    display: flex !important;
    gap: 5px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    padding: 2px 0 4px 0 !important;
    scrollbar-width: thin !important;
  }
  .month-pill {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  .filter-actions-row {
    display: flex !important;
    gap: 6px !important;
    width: 100% !important;
    align-items: center !important;
    margin-top: 4px !important;
  }

  /* 2. UNIFIED SMOOTH SPREADSHEET TABLE ON MOBILE */
  .spreadsheet-wrapper {
    max-height: 62vh !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    border-radius: 6px !important;
    border: 1.5px solid #cbd5e1 !important;
  }

  .master-table {
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }

  /* Reset all horizontal sticky offsets on mobile so all columns scroll in 100% perfect lockstep */
  .master-table th,
  .master-table td,
  .master-table .sticky-col-stt,
  .master-table .sticky-col-unit,
  .master-table .sticky-col-total,
  .master-table thead .sticky-col-stt,
  .master-table thead .sticky-col-unit,
  .master-table thead .sticky-col-total,
  .master-table thead th {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }

  /* Header rows stay sticky vertically when scrolling down through the 41 units */
  .master-table thead tr.row-banner {
    height: 36px !important;
    max-height: 36px !important;
  }
  .master-table thead tr.row-banner th {
    position: sticky !important;
    top: 0px !important;
    z-index: 30 !important;
    background: #003d99 !important;
    color: #ffffff !important;
    height: 36px !important;
    max-height: 36px !important;
    line-height: 36px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .master-table thead tr.row-titles th {
    position: sticky !important;
    top: 32px !important;
    z-index: 30 !important;
  }
  .master-table thead tr.row-cols th {
    position: sticky !important;
    top: 135px !important;
    z-index: 30 !important;
  }

  .master-table .sticky-col-stt {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    font-size: 11px !important;
    padding: 6px 2px !important;
    text-align: center !important;
    background: #f1f5f9 !important;
    color: #1e293b !important;
    box-sizing: border-box !important;
  }

  .master-table .sticky-col-unit {
    width: 145px !important;
    min-width: 145px !important;
    max-width: 145px !important;
    font-size: 11px !important;
    padding: 6px 6px !important;
    line-height: 1.25 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    border-right: 2px solid #93c5fd !important;
    box-sizing: border-box !important;
  }
  .master-table .sticky-col-unit div {
    width: 100% !important;
    max-width: 133px !important;
  }

  .master-table .sticky-col-total {
    width: 65px !important;
    min-width: 65px !important;
    max-width: 65px !important;
    font-size: 11.5px !important;
    padding: 6px 4px !important;
    text-align: center !important;
    background: #fffbeb !important;
    border-right: 1px solid #cbd5e1 !important;
    box-sizing: border-box !important;
  }

  /* Criteria columns size on mobile */
  .master-table thead tr.row-titles th:not(.sticky-col-stt):not(.sticky-col-unit):not(.sticky-col-total),
  .master-table thead tr.row-cols th:not(.sticky-col-stt):not(.sticky-col-unit):not(.sticky-col-total),
  .master-table tbody td:not(.sticky-col-stt):not(.sticky-col-unit):not(.sticky-col-total) {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    box-sizing: border-box !important;
  }

  .master-table th,
  .master-table td,
  .score-cell,
  .score-input {
    touch-action: pan-x pan-y !important;
  }

  /* Mobile scroll hint indicator */
  .mobile-scroll-hint {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px dashed #7dd3fc;
    animation: pulseHint 2s infinite;
  }

  @keyframes pulseHint {
    0%, 100% { opacity: 0.95; }
    50% { opacity: 0.7; }
  }
}

@media (min-width: 769px) {
  .mobile-scroll-hint,
  .table-scroll-controls,
  .mobile-view-toggle-bar {
    display: none !important;
  }
}


/* =========================================================================
   SUPER MOBILE CARD VIEW & DUAL-MODE CONTROLS (< 768px)
   ========================================================================= */
.mobile-view-toggle-bar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-view-toggle-bar {
    display: flex;
    gap: 5px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 7px;
    margin-bottom: 6px;
  }
  .mobile-toggle-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 11.5px;
    font-weight: 700;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
  }
  .mobile-toggle-btn.active {
    background: #0052cc;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 82, 204, 0.25);
  }

  /* Mobile Unit Card */
  .mobile-unit-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
  }
  .mobile-unit-card.expanded {
    border-color: #0052cc;
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.12);
  }
  .mobile-card-header {
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
  }
  .mobile-card-header:active {
    background: #eff6ff;
  }
  .mobile-card-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    margin-bottom: 4px;
  }
  .mobile-card-score-badge {
    background: #fef08a;
    color: #854d0e;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #fde047;
    white-space: nowrap;
  }
  .mobile-card-body {
    padding: 12px 14px;
    background: #ffffff;
  }
  .mobile-crit-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  .mobile-crit-item.has-score {
    border-left: 4px solid #16a34a;
    background: #f0fdf4;
  }
  .mobile-crit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
  }
  .mobile-crit-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
  }
  .mobile-crit-score {
    font-size: 14px;
    font-weight: 800;
    color: #16a34a;
    white-space: nowrap;
  }

  /* Table View Navigation buttons */
  .table-scroll-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
  }
  .btn-scroll-step {
    flex: 1;
    background: #0284c7;
    color: #fff;
    border: none;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
  }
  .btn-scroll-step:active {
    background: #0369a1;
  }
}



/* Special override for Reports tracking spreadsheet (single header row, top must be 0) */
#reports-spreadsheet-wrapper table tr.row-titles th,
#reports-spreadsheet-wrapper table thead th {
  top: 0 !important;
}

#reports-spreadsheet-wrapper table thead .sticky-col-stt,
#reports-spreadsheet-wrapper table thead .sticky-col-unit,
#reports-spreadsheet-wrapper table thead .sticky-col-total {
  top: 0 !important;
  z-index: 55 !important;
}


/* =========================================================================
   NOTIFICATION BELL & DROPDOWN STYLES (UPGRADED)
   ========================================================================= */
.notification-bell-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notification-bell-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}

.notification-bell-btn:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

.notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  min-width: 22px;
  height: 22px;
  line-height: 20px;
  border-radius: 11px;
  text-align: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 2px solid #ffffff;
  animation: pulse-badge 1.8s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* HUY HIỆU ĐỎ TRÊN LOGO ĐOÀN (PHONG CÁCH FACEBOOK) */
.brand-logo-badge-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.logo-facebook-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  min-width: 19px;
  height: 19px;
  line-height: 15px;
  padding: 0 4px;
  border-radius: 12px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  animation: logoBadgePulse 2s infinite ease-in-out;
}

@keyframes logoBadgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  }
  50% {
    transform: scale(1.14);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8), 0 2px 6px rgba(0, 0, 0, 0.45);
  }
}

/* THANH TAB LỌC THÔNG BÁO: TẤT CẢ / MỚI / ĐÃ XEM */
.notif-tab-bar {
  display: flex;
  background: #f8fafc;
  border-bottom: 1.5px solid #cbd5e1;
  padding: 8px 10px;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0 !important;
  min-height: 48px !important;
  align-items: center;
}

.notif-tab-bar::-webkit-scrollbar {
  height: 3px;
}

.notif-tab-bar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.notif-tab-btn {
  flex-shrink: 0 !important;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  line-height: 1;
}

.notif-tab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.notif-tab-btn.active {
  background: #0052cc;
  color: #ffffff;
  border-color: #0052cc;
  box-shadow: 0 1px 3px rgba(0, 82, 204, 0.3);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  width: 480px;
  max-width: min(480px, calc(100vw - 28px));
  max-height: calc(100vh - 100px);
  background: #ffffff !important;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 82, 204, 0.25);
  border: 2px solid #0052cc;
  z-index: 999999 !important;
  overflow: hidden;
  color: #0f172a;
  text-align: left;
  animation: slideDown 0.2s ease-out;
  display: flex;
  flex-direction: column;
}

@media (max-width: 600px) {
  .notification-dropdown {
    position: fixed;
    top: 48px;
    right: 6px;
    left: 6px;
    bottom: 12px;
    width: auto;
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 60px);
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    border-radius: 12px;
  }
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, #003d99 0%, #0052cc 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0 !important;
}

.notification-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 10px;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: center;
  flex-shrink: 0 !important;
}

.notification-item {
  padding: 12px 14px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notification-item:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
}

.notification-item:active {
  transform: scale(0.99);
}

.notification-item.unread {
  background: #f8faff;
  border: 1.5px solid #bfdbfe;
  border-left: 5px solid #2563eb;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.1);
}

.notification-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #0f172a;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.notification-time {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.notification-desc {
  font-size: 12.5px;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 6px;
}

.notification-files {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.notification-file-pill {
  font-size: 11.5px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 600;
  border: 1px solid #bae6fd;
}

/* =========================================================================
   FLOATING CHAT WIDGET STYLES (UPGRADED WITH PRIVATE CHAT & FILE ATTACHMENTS)
   ========================================================================= */
.floating-chat-trigger {
  display: none !important;
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: linear-gradient(135deg, #0052cc 0%, #1e40af 100%);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 18px rgba(0, 82, 204, 0.45);
  cursor: pointer;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  transition: all 0.25s ease;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.floating-chat-trigger:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 24px rgba(0, 82, 204, 0.55);
}

.chat-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 10px;
  text-align: center;
  padding: 0 5px;
  border: 1.5px solid #fff;
}

.chat-widget-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 580px;
  min-width: 440px;
  max-width: calc(100vw - 20px);
  height: 720px;
  min-height: 520px;
  max-height: calc(100vh - 28px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  border: 1.5px solid #cbd5e1;
  z-index: 995;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  animation: slideUp 0.2s ease-out;
  container-type: inline-size;

  /* Scale variables - Mặc định to rõ, đẹp mắt */
  --chat-font-title: 15px;
  --chat-font-user: 12px;
  --chat-font-tab: 13px;
  --chat-font-sender: 12px;
  --chat-font-msg: 14px;
  --chat-font-time: 11.5px;
  --chat-bubble-pad: 6px 12px;
  --chat-header-pad: 12px 18px;
  --chat-tabs-pad: 8px 12px;
  --chat-input-pad: 10px 14px;
  --chat-input-h: 42px;
  --chat-input-font: 14px;
  --chat-btn-size: 40px;
  --chat-btn-font: 13.5px;
  --chat-body-pad: 14px 16px;
  --chat-body-gap: 10px;
}

/* Khi kéo dãn rộng >= 720px */
@container (min-width: 720px) {
  .chat-widget-box {
    --chat-font-title: 16.5px;
    --chat-font-user: 13px;
    --chat-font-tab: 14px;
    --chat-font-sender: 13px;
    --chat-font-msg: 15px;
    --chat-font-time: 12px;
    --chat-bubble-pad: 7px 14px;
    --chat-header-pad: 14px 20px;
    --chat-tabs-pad: 10px 16px;
    --chat-input-pad: 12px 18px;
    --chat-input-h: 46px;
    --chat-input-font: 14.5px;
    --chat-btn-size: 44px;
    --chat-btn-font: 14px;
    --chat-body-pad: 16px 20px;
    --chat-body-gap: 12px;
  }
}

/* Khi kéo dãn rộng >= 920px */
@container (min-width: 920px) {
  .chat-widget-box {
    --chat-font-title: 18px;
    --chat-font-user: 14px;
    --chat-font-tab: 15px;
    --chat-font-sender: 13.5px;
    --chat-font-msg: 16px;
    --chat-font-time: 12.5px;
    --chat-bubble-pad: 8px 15px;
    --chat-header-pad: 16px 24px;
    --chat-tabs-pad: 12px 20px;
    --chat-input-pad: 14px 22px;
    --chat-input-h: 50px;
    --chat-input-font: 15.5px;
    --chat-btn-size: 48px;
    --chat-btn-font: 15px;
    --chat-body-pad: 18px 24px;
    --chat-body-gap: 14px;
  }
}

/* Khi phóng to toàn màn hình (.maximized) */
.chat-widget-box.maximized {
  left: 12px !important;
  top: 12px !important;
  right: 12px !important;
  bottom: 12px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 14px !important;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.45) !important;
  z-index: 99999 !important;

  /* Scale everything up for big, beautiful, crystal clear readability */
  --chat-font-title: 18.5px;
  --chat-font-user: 14px;
  --chat-font-tab: 15px;
  --chat-font-sender: 13.5px;
  --chat-font-msg: 16.5px;
  --chat-font-time: 12.5px;
  --chat-bubble-pad: 8px 16px;
  --chat-header-pad: 16px 24px;
  --chat-tabs-pad: 12px 20px;
  --chat-input-pad: 14px 24px;
  --chat-input-h: 50px;
  --chat-input-font: 15.5px;
  --chat-btn-size: 48px;
  --chat-btn-font: 15px;
  --chat-body-pad: 20px 26px;
  --chat-body-gap: 14px;
}

.chat-header,
.chat-tabs-bar,
.ai-chips-container,
.chat-search-bar,
.chat-private-unit-bar,
.chat-input-row {
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Chat resize handles */
.chat-resize-handle {
  position: absolute;
  z-index: 1000;
  touch-action: none;
}

.chat-resize-handle-se {
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  user-select: none;
}

.chat-resize-handle-r {
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: ew-resize;
}

.chat-resize-handle-b {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 7px;
  cursor: ns-resize;
}

.chat-resize-handle-l {
  top: 0;
  left: 0;
  width: 7px;
  height: 100%;
  cursor: ew-resize;
}

.chat-resize-handle-t {
  top: 0;
  left: 0;
  width: 100%;
  height: 7px;
  cursor: ns-resize;
}

.chat-resize-handle-sw {
  bottom: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.chat-resize-handle-ne {
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.chat-resize-handle-nw {
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.chat-maximize-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.chat-maximize-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.chat-tabs-bar {
  display: flex;
  background: #003380;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.chat-tab-btn {
  flex: 1 1 0;
  background: transparent;
  color: #bfdbfe;
  border: none;
  padding: var(--chat-tabs-pad, 9px 12px);
  font-size: var(--chat-font-tab, 13px);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.chat-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.chat-tab-btn.active {
  background: #0052cc;
  color: #ffffff;
  border-bottom: 3px solid #fde047;
}

.chat-tab-btn.video-tab.active {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
  color: #ffffff !important;
  border-bottom: 3px solid #fde047 !important;
}

.chat-tab-btn.tts-tab.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  border-bottom: 3px solid #fde047 !important;
}

.chat-tab-btn.ai-tab.active {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
  color: #ffffff !important;
  border-bottom: 3px solid #fde047 !important;
}

.chat-private-unit-bar {
  background: #f1f5f9;
  padding: 8px 12px;
  border-bottom: 1px solid #cbd5e1;
}

.chat-unit-select {
  width: 100%;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid #0052cc;
  background: #ffffff;
  color: #0f172a;
}

.chat-header {
  background: linear-gradient(90deg, #003d99 0%, #0052cc 100%);
  color: #ffffff;
  padding: var(--chat-header-pad, 12px 18px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.chat-search-bar {
  padding: 6px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-title {
  font-weight: 800;
  font-size: var(--chat-font-title, 15px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-user {
  font-size: var(--chat-font-user, 12px);
  color: #bfdbfe;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.chat-mobile-back-btn {
  display: none !important;
}

.chat-close-btn-main {
  background: #ef4444 !important;
  border: 1px solid #dc2626 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}

.chat-close-btn-main:hover {
  background: #dc2626 !important;
}

.chat-close-btn-main:active {
  transform: scale(0.95) !important;
}

.tab-label-short {
  display: none;
}

.tab-label-full {
  display: inline;
}

.btn-text-mobile {
  display: none;
}

.btn-text-full {
  display: inline;
}

.chat-messages-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: var(--chat-body-pad, 16px 18px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #f8fafc;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  gap: var(--chat-body-gap, 12px) !important;
}

.chat-message-row {
  display: flex !important;
  flex-direction: column !important;
  width: fit-content !important;
  max-width: min(85%, 680px) !important;
  height: auto !important;
  min-height: unset !important;
  flex: none !important;
  box-sizing: border-box !important;
}

.chat-message-row.mine {
  align-self: flex-end !important;
  align-items: flex-end !important;
  margin-left: auto !important;
}

.chat-message-row.theirs {
  align-self: flex-start !important;
  align-items: flex-start !important;
  margin-right: auto !important;
}

.chat-sender-name {
  font-size: var(--chat-font-sender, 12px);
  font-weight: 700;
  margin-bottom: 4px;
  color: #0369a1;
  width: fit-content !important;
}

.chat-sender-name.admin {
  color: #b91c1c;
}

.chat-message-bubble {
  height: auto !important;
  min-height: unset !important;
  max-height: none !important;
  width: fit-content !important;
  max-width: 100% !important;
  display: inline-block !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  box-sizing: border-box !important;
  padding: var(--chat-bubble-pad, 6px 12px) !important;
  border-radius: 14px !important;
  font-size: var(--chat-font-msg, 14px) !important;
  line-height: 1.4 !important;
  flex: 0 0 auto !important;
}

.chat-text-content {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.chat-message-row.mine .chat-message-bubble {
  background: #0052cc !important;
  color: #ffffff !important;
  border-bottom-right-radius: 4px !important;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.12) !important;
}

.chat-message-row.theirs .chat-message-bubble {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-bottom-left-radius: 4px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

.chat-message-time {
  font-size: var(--chat-font-time, 11.5px);
  color: #94a3b8;
  margin-top: 4px;
  width: fit-content !important;
}

.chat-input-row {
  padding: var(--chat-input-pad, 10px 14px) !important;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.chat-attach-btn {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  border-radius: 8px;
  width: var(--chat-btn-size, 40px) !important;
  height: var(--chat-btn-size, 40px) !important;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0 !important;
  transition: all 0.2s;
}

.chat-attach-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.chat-input-field {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 14px !important;
  font-size: var(--chat-input-font, 14px) !important;
  height: var(--chat-input-h, 42px) !important;
  min-height: var(--chat-input-h, 42px) !important;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box !important;
}

.chat-input-field:focus {
  border-color: #0052cc;
}

.chat-send-btn {
  background: #0052cc;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 18px !important;
  font-weight: 700;
  font-size: var(--chat-btn-font, 13.5px) !important;
  height: var(--chat-input-h, 42px) !important;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn:hover {
  background: #003d99;
}

.chat-media-img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: block;
  box-sizing: border-box !important;
}

.chat-media-video {
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px;
  margin-top: 4px;
  display: block;
  box-sizing: border-box !important;
}

/* Typing indicator animation */
.ai-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.ai-typing-dots span {
  width: 6px;
  height: 6px;
  background-color: #7c3aed;
  border-radius: 50%;
  animation: aiTypingBounce 1.2s infinite ease-in-out;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.chat-file-box {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
}

.chat-file-box.mine {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.filter-pills-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-pill-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-pill-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.filter-pill-btn.active {
  background: #0052cc;
  color: #ffffff;
  border-color: #0052cc;
  box-shadow: 0 2px 6px rgba(0, 82, 204, 0.3);
}

/* EMOJI & STICKER PICKER */
.chat-emoji-btn {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-emoji-btn:hover {
  background: #fef08a;
  border-color: #facc15;
  transform: scale(1.05);
}
.chat-emoji-picker {
  position: absolute;
  bottom: 58px;
  left: 10px;
  right: 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 -8px 25px rgba(0,0,0,0.18);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: 250px;
  overflow: hidden;
  animation: slideUp 0.15s ease-out;
}
.emoji-picker-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.emoji-tab-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}
.emoji-tab-btn.active {
  background: #ffffff;
  color: #0052cc;
  border-bottom: 2px solid #0052cc;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px;
  overflow-y: auto;
  max-height: 200px;
}
.emoji-item {
  font-size: 20px;
  text-align: center;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
}
.emoji-item:hover {
  background: #eff6ff;
  transform: scale(1.25);
}
.sticker-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px;
  overflow-y: auto;
  max-height: 200px;
}
.sticker-item {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #166534;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.sticker-item:hover {
  background: #dcfce7;
  border-color: #22c55e;
  transform: translateY(-1px);
}

/* LAYOUT 1 KHUNG MÀN HÌNH CHUẨN ĐẸP - TƯƠNG THÍCH MỌI MÀN HÌNH MÁY TÍNH / LAPTOP */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
}

@media (min-width: 769px) {
  body {
    zoom: 0.8;
  }
}

#app {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.app-header {
  flex-shrink: 0;
  min-height: 46px;
  height: auto;
  max-height: none;
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap !important;
  gap: 6px 12px;
  background: linear-gradient(135deg, #003380 0%, #0052cc 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 99999 !important;
  overflow: visible !important;
}

.notification-bell-container {
  position: relative;
  flex-shrink: 0;
  overflow: visible !important;
  z-index: 999999 !important;
}

.brand-box {
  display: flex;
  align-items: center;
  flex-shrink: 0 !important;
  min-width: max-content !important;
}

.brand-title {
  white-space: nowrap !important;
}

@media (min-width: 769px) {
.app-header {
  min-height: 46px !important;
  height: auto !important;
  max-height: none !important;
  flex-wrap: wrap !important;
  gap: 6px 12px !important;
}

.brand-box {
  flex-shrink: 0 !important;
  min-width: max-content !important;
}

.brand-title {
  min-width: max-content !important;
  white-space: nowrap !important;
}

.brand-title * {
  white-space: nowrap !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap !important;
  flex-shrink: 1 !important;
  flex: 1 1 auto !important;
  justify-content: flex-end !important;
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.header-actions::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.header-actions .btn {
  font-size: 11px !important;
  padding: 3px 6px !important;
  white-space: nowrap !important;
  height: 26px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
}

.header-actions select {
  height: 26px !important;
  font-size: 11px !important;
  padding: 2px 5px !important;
  max-width: 165px !important;
}
}

.header-status-box {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-tabs {
  flex-shrink: 0;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
  height: 38px;
  padding: 0 12px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap !important;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.main-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 4px 12px;
  margin-bottom: 2px;
}

.filter-bar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap !important;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.month-pills {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap !important;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.month-pills::-webkit-scrollbar {
  height: 4px;
}
.month-pills::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.month-pill {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap !important;
  flex-shrink: 0;
  height: 30px;
  display: inline-flex;
  align-items: center;
}

.month-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.month-pill.active {
  background: #0052cc !important;
  border-color: #003d99 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 82, 204, 0.3) !important;
}

.panel.reports-table-panel {
  flex: 1 1 auto !important;
  height: calc(100vh - 130px) !important;
  min-height: 540px !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  margin-bottom: 2px !important;
}

#reports-spreadsheet-wrapper,
.reports-log-container {
  width: 100%;
  flex: 1 1 auto !important;
  height: calc(100vh - 185px) !important;
  min-height: 480px !important;
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  position: relative;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-x pan-y !important;
  overscroll-behavior-x: contain !important;
  scroll-behavior: smooth;
  border-radius: 6px;
  box-sizing: border-box !important;
}

.chat-file-box {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 5px;
  color: #0f172a;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-file-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.chat-file-name {
  font-weight: 700;
  font-size: 12px;
  line-height: 1.35;
  color: #0f172a;
  word-break: break-word;
  white-space: normal;
}
.chat-file-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
  padding-top: 5px;
}

/* Criteria table scroll container with sticky headers */
.criteria-table-container {
  height: calc(100vh - 185px) !important;
  min-height: calc(100vh - 185px) !important;
  max-height: calc(100vh - 185px) !important;
  flex: 1 1 auto !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-width: thin;
}

.criteria-table-container thead th {
  position: sticky !important;
  top: 0 !important;
  background: #f1f5f9 !important;
  z-index: 25 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Reports resizable split drag bar */
.split-drag-bar {
  transition: background 0.15s;
}
.split-drag-bar:hover {
  background: #0284c7 !important;
}
.split-drag-bar:hover div,
.split-drag-bar:hover span {
  color: #ffffff !important;
}

/* =========================================================================
   1. MINI DASHBOARD (4 CHỈ SỐ TÓM TẮT TRÊN ĐẦU TRANG)
   ========================================================================= */
.mini-dashboard-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
}

@media (max-width: 900px) {
  .mini-dashboard-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .mini-dashboard-container {
    grid-template-columns: 1fr;
  }
}

.mini-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.mini-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.mini-stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
}

.mini-stat-card.card-blue::before { background: #2563eb; }
.mini-stat-card.card-green::before { background: #16a34a; }
.mini-stat-card.card-orange::before { background: #ea580c; }
.mini-stat-card.card-red::before { background: #dc2626; }

.mini-stat-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.card-blue .mini-stat-icon { background: #eff6ff; color: #2563eb; }
.card-green .mini-stat-icon { background: #f0fdf4; color: #16a34a; }
.card-orange .mini-stat-icon { background: #fff7ed; color: #ea580c; }
.card-red .mini-stat-icon { background: #fef2f2; color: #dc2626; }

.mini-stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mini-stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

/* Pulsing alert for pending reviews */
.pulse-alert {
  animation: pulse-soft 2s infinite ease-in-out;
}

@keyframes pulse-soft {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4);
    border-color: #fb923c;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(234, 88, 12, 0);
    border-color: #ea580c;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
    border-color: #fb923c;
  }
}

/* =========================================================================
   2. MODERN TABLE DESIGN (PROGRESS BAR & CROSSHAIR HOVER)
   ========================================================================= */
.score-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.score-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 800;
}

.score-progress-pct {
  font-size: 10px;
  color: #16a34a;
  font-weight: 700;
}

.score-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.score-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Table crosshair highlight */
.spreadsheet-table tbody tr:hover td {
  background-color: #f1f8ff !important;
}

.spreadsheet-table td.col-hover-active {
  background-color: #f0f7ff !important;
  box-shadow: inset 1px 0 0 #93c5fd, inset -1px 0 0 #93c5fd;
}

.spreadsheet-table tbody tr:hover td.col-hover-active {
  background-color: #e0f2fe !important;
}

/* Sticky column enhancements */
@media (min-width: 769px) {
  .sticky-col-stt {
    position: sticky !important;
    left: 0 !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    z-index: 18 !important;
    background: #ffffff !important;
  }
  .sticky-col-unit {
    position: sticky !important;
    left: 42px !important;
    width: 290px !important;
    min-width: 290px !important;
    max-width: 290px !important;
    z-index: 18 !important;
    background: #ffffff !important;
  }
  .sticky-col-total {
    position: sticky !important;
    left: 332px !important;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    z-index: 18 !important;
    background: #fff9db !important;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.12) !important;
    border-right: 2px solid #0052cc !important;
  }

  thead .sticky-col-stt {
    left: 0 !important;
    z-index: 55 !important;
  }
  thead .sticky-col-unit {
    left: 42px !important;
    z-index: 55 !important;
  }
  thead .sticky-col-total {
    left: 332px !important;
    z-index: 55 !important;
  }
}

/* =========================================================================
   3. AI ASSISTANT CHAT TAB & PROMPT CHIPS
   ========================================================================= */
.chat-tab-btn.ai-tab {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff !important;
  position: relative;
}

.chat-tab-btn.ai-tab.active {
  background: #ffffff !important;
  color: #4f46e5 !important;
  font-weight: 800;
}

.ai-tab-badge {
  background: #f59e0b;
  color: #ffffff;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 6px;
  margin-left: 3px;
  font-weight: 800;
  text-transform: uppercase;
}

.ai-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.ai-chip-btn {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-chip-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.chat-msg-ai {
  background: #f5f3ff !important;
  border: 1px solid #ddd6fe !important;
  border-left: 4px solid #7c3aed !important;
  color: #1e1b4b !important;
  height: auto !important;
  min-height: unset !important;
  width: fit-content !important;
  max-width: 100% !important;
  display: inline-block !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  font-size: clamp(13.5px, 1.1vw, 16px) !important;
  line-height: 1.5 !important;
  padding: 8px 14px !important;
  border-radius: 14px !important;
  border-bottom-left-radius: 3px !important;
  box-sizing: border-box !important;
  flex: none !important;
}

.chat-msg-ai .sender-name {
  color: #6d28d9 !important;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* AI Rewrite Button */
.btn-ai-rewrite {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-ai-rewrite:hover {
  opacity: 0.92;
  transform: scale(1.03);
}

/* =========================================================================
   4. DARK MODE (CHẾ ĐỘ BAN ĐÊM)
   ========================================================================= */
body.dark-mode {
  background-color: #0f172a !important;
  color: #cbd5e1 !important;
}

body.dark-mode header,
body.dark-mode .app-header {
  background: #1e293b !important;
  border-color: #334155 !important;
}

body.dark-mode .nav-tabs-bar {
  background: #1e293b !important;
  border-color: #334155 !important;
}

body.dark-mode .nav-tab-btn {
  background: #334155 !important;
  color: #94a3b8 !important;
  border-color: #475569 !important;
}

body.dark-mode .nav-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
}

body.dark-mode .mini-stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .mini-stat-label {
  color: #94a3b8 !important;
}

body.dark-mode .mini-stat-value {
  color: #f8fafc !important;
}

body.dark-mode .spreadsheet-wrapper,
body.dark-mode #reports-spreadsheet-wrapper {
  background: #0f172a !important;
  border-color: #334155 !important;
}

body.dark-mode table.spreadsheet-table {
  background: #0f172a !important;
  color: #cbd5e1 !important;
}

body.dark-mode table.spreadsheet-table tbody td {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

body.dark-mode table.spreadsheet-table tbody tr:hover td {
  background-color: #1e293b !important;
}

body.dark-mode table.spreadsheet-table td.col-hover-active {
  background-color: #1e293b !important;
}

body.dark-mode .sticky-col-stt,
body.dark-mode .sticky-col-unit,
body.dark-mode .sticky-col-total {
  background: #1e293b !important;
  color: #f8fafc !important;
}

body.dark-mode .chat-window {
  background: #1e293b !important;
  border-color: #475569 !important;
}

body.dark-mode .chat-messages-container {
  background: #0f172a !important;
}

body.dark-mode .chat-input-area {
  background: #1e293b !important;
  border-color: #334155 !important;
}

body.dark-mode .chat-input {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

body.dark-mode .ai-chips-container {
  background: #1e293b !important;
  border-color: #334155 !important;
}

body.dark-mode .ai-chip-btn {
  background: #334155 !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

body.dark-mode .chat-msg-other {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

body.dark-mode .notification-dropdown {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #38bdf8 !important;
}

body.dark-mode .notification-list {
  background: #090d16 !important;
}

body.dark-mode .notification-item {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
  color: #f1f5f9 !important;
}

body.dark-mode .notification-item:hover {
  background: #273549 !important;
}

/* Dark Mode Toggle Button */
.btn-dark-mode-toggle {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-dark-mode-toggle:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

/* AI Review Result Modal Badge */
.ai-badge-chip {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ai-badge-ok { background: #dcfce7; color: #15803d; }
.ai-badge-warn { background: #fef9c3; color: #854d0e; }
.ai-badge-err { background: #fee2e2; color: #b91c1c; }

/* =========================================================================
   FULL VIEWPORT HEIGHT & STICKY HEADER CHO TẤT CẢ CÁC BẢNG DỮ LIỆU
   ========================================================================= */
.panel.fullscreen-table-panel,
.panel:has(.accounts-table-container),
.panel:has(.criteria-table-container),
.panel:has(.ranking-table-container),
.panel:has(.unit-submit-table-container) {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  margin-bottom: 2px !important;
}

/* 1. Bảng Quản Lý Đơn Vị & Tài Khoản */
.accounts-table-container {
  height: calc(100vh - 160px) !important;
  min-height: 500px !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  overflow: auto !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
  position: relative;
  -webkit-overflow-scrolling: touch !important;
  border-bottom: 1px solid var(--border-light);
}

/* 2. Bảng Xếp Hạng Thi Đua & Tổng Hợp Điểm */
.ranking-table-container {
  height: calc(100vh - 160px) !important;
  min-height: 500px !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  overflow: auto !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
  position: relative;
  -webkit-overflow-scrolling: touch !important;
  border-bottom: 1px solid var(--border-light);
}

/* 3. Bảng Quản Lý Bộ Tiêu Chí & Hạn Nộp */
.criteria-table-container {
  height: calc(100vh - 195px) !important;
  min-height: 480px !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  overflow: auto !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
  position: relative;
  -webkit-overflow-scrolling: touch !important;
  border-bottom: 1px solid var(--border-light);
}

/* 4. Khung Split Báo Cáo & Nhật Ký Toàn Đoàn */
.reports-split-container {
  height: calc(100vh - 140px) !important;
  min-height: 500px !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* 5. Bảng Danh Sách Văn Bản & Tài Liệu Chỉ Đạo */
.table-container:has(#admin-docs-table),
.table-container {
  height: calc(100vh - 350px) !important;
  min-height: 320px !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  overflow: auto !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border-light);
}

/* 6. Bảng Kê Khai & Nộp Minh Chứng của Đơn Vị Cơ Sở */
.unit-submit-table-container {
  height: calc(100vh - 280px) !important;
  min-height: 460px !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  box-sizing: border-box !important;
  position: relative;
  -webkit-overflow-scrolling: touch !important;
  border-bottom: 1px solid var(--border-light);
  scrollbar-width: thin;
  scrollbar-color: #0052cc #f1f5f9;
}

/* Định kiểu thanh cuộn dọc (scrollbar) to rõ, nổi bật, dễ kéo thả trên Windows & Mac */
.unit-submit-table-container::-webkit-scrollbar,
.accounts-table-container::-webkit-scrollbar,
.ranking-table-container::-webkit-scrollbar,
.criteria-table-container::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  width: 10px !important;
  height: 10px !important;
}

.unit-submit-table-container::-webkit-scrollbar-track,
.accounts-table-container::-webkit-scrollbar-track,
.ranking-table-container::-webkit-scrollbar-track,
.criteria-table-container::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
  border-left: 1px solid #e2e8f0;
  border-radius: 4px;
}

.unit-submit-table-container::-webkit-scrollbar-thumb,
.accounts-table-container::-webkit-scrollbar-thumb,
.ranking-table-container::-webkit-scrollbar-thumb,
.criteria-table-container::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: #0052cc !important;
  border-radius: 6px !important;
  border: 2px solid #f1f5f9;
}

.unit-submit-table-container::-webkit-scrollbar-thumb:hover,
.accounts-table-container::-webkit-scrollbar-thumb:hover,
.ranking-table-container::-webkit-scrollbar-thumb:hover,
.criteria-table-container::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: #003d99 !important;
}

.main-container::-webkit-scrollbar {
  width: 9px !important;
  height: 9px !important;
}

.main-container::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
}

.main-container::-webkit-scrollbar-thumb {
  background: #94a3b8 !important;
  border-radius: 5px !important;
}

.main-container::-webkit-scrollbar-thumb:hover {
  background: #0052cc !important;
}

/* =========================================================================
   CỐ ĐỊNH TIÊU ĐỀ BẢNG (STICKY THEAD & TH) VÀ GIAO ĐIỂM FREEZE PANES
   ========================================================================= */
.accounts-table-container thead,
.accounts-table-container thead th,
.ranking-table-container thead,
.ranking-table-container thead th,
.criteria-table-container thead,
.criteria-table-container thead th,
.unit-submit-table-container thead,
.unit-submit-table-container thead th,
.master-table thead,
.master-table thead th,
#reports-spreadsheet-wrapper thead,
#reports-spreadsheet-wrapper thead th,
#reports-bottom-section thead,
#reports-bottom-section thead th,
.table-container thead,
.table-container thead th,
#admin-docs-table thead,
#admin-docs-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background: #f1f5f9 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Ô giao nhau giữa thead và 3 cột đầu đặt z-index: 55 để luôn nổi lên trên cùng */
@media (min-width: 769px) {
  .master-table thead th.sticky-col-stt,
  thead th.sticky-col-stt {
    position: sticky !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 55 !important;
    background: #f1f5f9 !important;
    box-sizing: border-box !important;
  }

  .master-table thead th.sticky-col-unit,
  thead th.sticky-col-unit {
    position: sticky !important;
    left: 42px !important;
    top: 0 !important;
    z-index: 55 !important;
    background: #f1f5f9 !important;
    box-sizing: border-box !important;
  }

  .master-table thead th.sticky-col-total,
  thead th.sticky-col-total {
    position: sticky !important;
    left: 332px !important;
    top: 0 !important;
    z-index: 55 !important;
    background: #fef3c7 !important;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.12) !important;
    border-right: 2px solid #0052cc !important;
    box-sizing: border-box !important;
  }
}

/* THANH CUỘN NGANG VÀ DỌC TO RÕ (HORIZONTAL & VERTICAL SCROLLBARS) CHO CÁC BẢNG MA TRẬN */
.spreadsheet-wrapper,
#reports-spreadsheet-wrapper,
#master-spreadsheet-wrapper {
  scrollbar-width: thin;
  scrollbar-color: #0052cc #e2e8f0;
}

.spreadsheet-wrapper::-webkit-scrollbar,
#reports-spreadsheet-wrapper::-webkit-scrollbar,
#master-spreadsheet-wrapper::-webkit-scrollbar {
  width: 10px !important;
  height: 14px !important;
}

.spreadsheet-wrapper::-webkit-scrollbar-track,
#reports-spreadsheet-wrapper::-webkit-scrollbar-track,
#master-spreadsheet-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
  border-top: 1.5px solid #cbd5e1 !important;
  border-radius: 4px;
}

.spreadsheet-wrapper::-webkit-scrollbar-thumb,
#reports-spreadsheet-wrapper::-webkit-scrollbar-thumb,
#master-spreadsheet-wrapper::-webkit-scrollbar-thumb {
  background: #0052cc !important;
  border-radius: 6px !important;
  border: 2px solid #f1f5f9;
}

.spreadsheet-wrapper::-webkit-scrollbar-thumb:hover,
#reports-spreadsheet-wrapper::-webkit-scrollbar-thumb:hover,
#master-spreadsheet-wrapper::-webkit-scrollbar-thumb:hover {
  background: #003d99 !important;
}

body.dark-mode .accounts-table-container thead th,
body.dark-mode .ranking-table-container thead th,
body.dark-mode .criteria-table-container thead th,
body.dark-mode .unit-submit-table-container thead th,
body.dark-mode .master-table thead th,
body.dark-mode #reports-spreadsheet-wrapper thead th,
body.dark-mode #reports-bottom-section thead th,
body.dark-mode .table-container thead th,
body.dark-mode #admin-docs-table thead th {
  background: #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}




/* Nút phát âm thanh đọc câu trả lời Trợ lý AI (Text-to-Speech) */
.ai-tts-btn {
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.22);
  color: #7c3aed;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s ease;
  vertical-align: middle;
}

.ai-tts-btn:hover {
  background: rgba(124, 58, 237, 0.18);
  border-color: #7c3aed;
  transform: scale(1.12);
}

.ai-tts-btn.speaking {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  animation: pulse-tts 0.85s infinite alternate ease-in-out;
}

@keyframes pulse-tts {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

/* AI Text-to-Speech Studio */

/* QR Code Studio */
.chat-tab-btn.qr-tab {
  color: #0284c7;
}
.chat-tab-btn.qr-tab:hover {
  background: #f0f9ff;
  color: #0369a1;
}
.chat-tab-btn.qr-tab.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

.qr-studio-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 14px 16px;
  overflow-y: auto;
  box-sizing: border-box;
  background: #ffffff;
}

body.dark-mode .qr-studio-wrapper {
  background: #1e293b;
  color: #f1f5f9;
}

.chat-tab-btn.tts-tab {
  color: #059669;
}
.chat-tab-btn.tts-tab:hover {
  background: #ecfdf5;
  color: #047857;
}
.chat-tab-btn.tts-tab.active {
  background: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important;
}

.tts-studio-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 14px 16px;
  overflow-y: auto;
  box-sizing: border-box;
  background: #ffffff;
}

body.dark-mode .tts-studio-wrapper {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
body.dark-mode #tts-result-box {
  background: #1e293b !important;
  border-color: #334155 !important;
}

/* KHUNG PANEL DÀI XUỐNG SÁT ĐÁY (CHUẨN MẪU SỐ 3) CHO VĂN BẢN VÀ LỊCH SỬ NỘP */
@media (min-width: 769px) {
  .admin-docs-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: calc(100vh - 128px) !important;
    min-height: 520px !important;
    max-height: none !important;
    margin-bottom: 2px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }
}

.admin-docs-table-container {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
}

#admin-docs-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background: #f8fafc !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.unit-history-panel {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  height: calc(100vh - 215px) !important;
  min-height: 420px !important;
  max-height: none !important;
  margin-bottom: 2px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

.unit-history-panel .panel-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
}

.unit-history-panel .data-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background: #f8fafc !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}



/* =========================================================================
   TỐI ƯU HÓA CUỘN NỘI DUNG VÀ VUỐT CHẠM CHO KHUNG CHAT (CHAT TOUCH SCROLL)
   ========================================================================= */
.chat-messages-body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  overscroll-behavior-y: contain !important;
}

.chat-messages-body *,
.chat-message-row,
.chat-message-bubble,
.chat-text-content,
.tts-studio-wrapper,
.qr-studio-wrapper {
  touch-action: pan-y !important;
}

/* =========================================================================
   CHẾ ĐỘ TỐI ƯU MOBILE & TABLET (<= 768px): THANH CÔNG CỤ VÀ KHUNG CHAT PRO
   ========================================================================= */
@media (max-width: 768px) {
  /* MỞ KHÓA TOÀN BỘ CUỘN TRANG TRÊN MOBILE / ZALO WEBVIEW */
  html, body {
    height: auto !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
  }

  #app {
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    width: 100% !important;
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  .main-container {
    flex: none !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 6px 8px 80px 8px !important;
  }

  .panel.fullscreen-table-panel,
  .panel,
  .admin-docs-panel,
  .unit-history-panel {
    flex: none !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .admin-docs-panel .panel-body,
  .unit-history-panel .panel-body {
    flex: none !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 10px 10px !important;
  }

  .unit-submit-table-container,
  .table-container,
  .ranking-table-container,
  .criteria-table-container,
  .accounts-table-container,
  .admin-docs-table-container {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
  }

  /* RÚT GỌN LƯỚI THỐNG KÊ (STATS GRID) TRÊN MOBILE: 2x2 GỌN ĐẸP, TIẾT KIỆM KHÔNG GIAN */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
  }
  .stat-card {
    padding: 8px 10px !important;
    border-radius: 8px !important;
  }
  .stat-card .stat-label {
    font-size: 11px !important;
  }
  .stat-card .stat-value {
    font-size: 15px !important;
  }
  .stat-card .stat-sub {
    display: none !important;
  }

  /* BANNER GÓC NHÌN QUẢN TRỊ VIÊN GỌN TRÊN MOBILE */
  .admin-view-as-banner {
    padding: 6px 10px !important;
    font-size: 11.5px !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .admin-view-as-banner .btn {
    padding: 3px 8px !important;
    font-size: 11px !important;
    height: 26px !important;
  }

  /* MODAL NỘP BÁO CÁO / XEM CHI TIẾT VỪA VẶN MÀN HÌNH MOBILE */
  .modal-backdrop {
    padding: 6px !important;
    align-items: flex-start !important;
    padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 9999999 !important;
    background: rgba(15, 23, 42, 0.75) !important;
  }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 10px !important;
    margin: 0 auto !important;
    z-index: 10000000 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  }
  .modal-header {
    padding: 10px 14px !important;
    flex-shrink: 0 !important;
  }
  .modal-body {
    padding: 12px 14px !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overflow-y: auto !important;
    flex: 1 1 auto !important;
  }
  .modal-footer {
    flex-shrink: 0 !important;
    padding: 10px 14px !important;
  }

  /* CHẾ ĐỘ THẺ NỘP BÁO CÁO CỰC KỲ DỄ THAO TÁC TRÊN ĐIỆN THOẠI */
  .mobile-submit-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  .mobile-submit-card:active {
    background: #fbfdff;
  }
  .mobile-submit-card.has-score {
    border-color: #86efac;
    background: #fdfffe;
  }
  .mobile-submit-card.is-pending {
    border-color: #fde68a;
    background: #fffdfa;
  }
  .mobile-submit-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
  }
  .mobile-submit-col-badge {
    background: #ffedd5;
    color: #9a3412;
    font-size: 11.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #fed7aa;
  }
  .mobile-submit-month-badge {
    background: #f1f5f9;
    color: #334155;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
  }
  .mobile-submit-card-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
  }
  .mobile-submit-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 11.5px;
    background: #f8fafc;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
  }
  .mobile-submit-action-btn {
    width: 100% !important;
    min-height: 42px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
    margin-top: 4px !important;
  }

  .app-header {
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }

  .brand-box {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .brand-title {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  .brand-title h1 {
    font-size: clamp(10px, 3.1vw, 13px) !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    letter-spacing: -0.2px !important;
  }

  .header-status-box {
    margin-left: 0 !important;
    height: 30px !important;
  }

  /* Sắp xếp thanh công cụ trên mobile: Gọn gàng, thoáng đẹp, bấm chọn dễ dàng */
  .header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    flex-shrink: 1 !important;
    padding: 2px 0 4px 0 !important;
  }

  .header-actions .btn {
    padding: 4px 9px !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    flex: 0 0 auto !important;
  }

  .header-actions select {
    height: 30px !important;
    font-size: 11.5px !important;
    max-width: 170px !important;
    padding: 3px 6px !important;
    border-radius: 6px !important;
  }

  .header-actions .date-pill {
    height: 30px !important;
    padding: 3px 8px !important;
    font-size: 11.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    border-radius: 6px !important;
  }

  /* KHUNG CHAT TOÀN MÀN HÌNH TRÊN MOBILE: VUỐT CHẠM CUỘN CỰC KỲ MƯỢT MÀ */
  .chat-widget-box {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    max-height: 100% !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 0 !important;
    transform: none !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
  }

  .chat-resize-handle {
    display: none !important;
    pointer-events: none !important;
  }

  .chat-header {
    padding: 8px 10px !important;
    padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    border-radius: 0 !important;
    cursor: default !important;
    touch-action: auto !important;
    flex-shrink: 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    gap: 6px !important;
    background: linear-gradient(90deg, #003d99 0%, #0052cc 100%) !important;
  }

  .chat-header-left {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  .chat-header-title {
    font-size: 13.5px !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .chat-header-user {
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 170px !important;
  }

  .chat-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  .chat-header-actions .btn-text-full {
    display: none !important;
  }

  .chat-header-actions .btn-text-mobile {
    display: inline !important;
  }

  .chat-header-actions .btn-chat-clear {
    display: inline-flex !important;
  }

  .chat-mobile-back-btn {
    display: inline-flex !important;
  }

  .chat-header .chat-maximize-btn {
    display: none !important;
  }

  .chat-header .chat-drag-hint {
    display: none !important;
  }

  .chat-header .chat-close-btn {
    display: none !important;
  }

  .chat-close-btn-main {
    padding: 4px 10px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
  }

  .tab-label-full {
    display: none !important;
  }

  .tab-label-short {
    display: inline !important;
  }

  .chat-tabs-bar {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 4px 3px !important;
    gap: 2px !important;
    background: #f1f5f9 !important;
    border-bottom: 1px solid #cbd5e1 !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
  }

  .chat-tab-btn {
    width: 100% !important;
    min-width: 0 !important;
    padding: 6px 1px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-align: center !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #334155 !important;
    box-sizing: border-box !important;
    height: 32px !important;
  }

  .chat-tab-btn.active {
    background: #0052cc !important;
    color: #ffffff !important;
    border-color: #0052cc !important;
  }

  .chat-tab-btn.ai-tab.active {
    background: #7c3aed !important;
    color: #ffffff !important;
    border-color: #7c3aed !important;
  }

  .chat-tab-btn.tts-tab.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
  }

  .chat-tab-btn.qr-tab.active {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
  }

  .chat-search-bar {
    flex-shrink: 0 !important;
    padding: 6px 10px !important;
  }

  .chat-private-unit-bar {
    flex-shrink: 0 !important;
    padding: 6px 10px !important;
  }

  .chat-messages-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    padding: 12px 14px !important;
    -webkit-user-select: text !important;
    user-select: text !important;
  }

  .chat-input-row {
    flex-shrink: 0 !important;
    padding: 8px 10px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
  }

  /* CHỐNG PHÓNG TO (ANTI-ZOOM) TRÊN IPHONE / IOS KHI CHẠM VÀO Ô GÕ VĂN BẢN & TÌM KIẾM */
  .chat-input-field,
  .chat-search-bar input,
  #chat-input-field,
  #chat-search-input,
  .chat-search-input,
  .chat-input-row input,
  .chat-floating-window input,
  .chat-floating-window textarea,
  .chat-floating-window select,
  .modal-box input,
  .modal-box textarea,
  .modal-box select {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }
}


/* ========================================================================= */
/* DONG THONG BAO CHU CHAY NGANG (MARQUEE TICKER)                            */
/* ========================================================================= */
.marquee-ticker-bar {
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  flex-shrink: 0;
  z-index: 45;
  user-select: none;
}

.marquee-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0 10px;
  height: 100%;
  white-space: nowrap;
  flex-shrink: 0;
  z-index: 2;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.08);
}

.marquee-content-container {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  cursor: pointer;
}

.marquee-text-track {
  display: inline-block;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
  will-change: transform;
  animation-name: marqueeScroll;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.marquee-ticker-bar:hover .marquee-text-track,
.marquee-text-track.paused {
  animation-play-state: paused !important;
}

@keyframes marqueeScroll {
  0% {
    transform: translateX(100vw);
  }
  100% {
    transform: translateX(-100%);
  }
}

.marquee-admin-action {
  flex-shrink: 0;
  z-index: 2;
  padding: 0 8px;
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .marquee-ticker-bar {
    height: 30px;
    min-height: 30px;
    max-height: 30px;
  }
  .marquee-badge {
    font-size: 10px;
    padding: 0 6px;
    letter-spacing: 0.2px;
  }
  .marquee-text-track {
    font-size: 12px;
  }
  .marquee-admin-action button {
    font-size: 10px !important;
    padding: 1px 5px !important;
    height: 20px !important;
  }
}


/* ========================================================================= */
/* NANG CAP TOAN DIEN GIAO DIEN MOBILE (LIGHT & DARK MODE)                   */
/* ========================================================================= */
@media (max-width: 768px) {
  /* 4 The thong ke tren Mobile: Luoi 2x2 vuong van, dep mat */
  .stats-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  .stat-card {
    padding: 10px 12px !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #ffffff !important;
  }
  .stat-card .stat-label {
    font-size: 11px !important;
    color: #64748b !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
  }
  .stat-card .stat-value {
    font-size: 18px !important;
    font-weight: 800 !important;
    margin-top: 2px !important;
  }
  .stat-card .stat-sub {
    font-size: 10.5px !important;
    color: #64748b !important;
    margin-top: 2px !important;
    display: block !important;
  }

  /* The tieu chi tren Mobile: Chuan, ro dep, gon gang */
  .mobile-submit-card {
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05) !important;
    margin-bottom: 12px !important;
    padding: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: hidden !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease !important;
  }
  .mobile-submit-card:active {
    transform: scale(0.995) !important;
  }
  .mobile-submit-card.has-score {
    border-left: 5px solid #16a34a !important;
    border-color: #cbd5e1 !important;
  }
  .mobile-submit-card.is-pending {
    border-left: 5px solid #f59e0b !important;
    border-color: #cbd5e1 !important;
  }
  .mobile-submit-card-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding-bottom: 8px !important;
  }
  .mobile-submit-col-badge {
    background: #ffedd5 !important;
    color: #9a3412 !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    border: 1px solid #fed7aa !important;
  }
  .mobile-submit-month-badge {
    background: #eff6ff !important;
    color: #1e40af !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    border: 1px solid #dbeafe !important;
  }
  .mobile-submit-card-title {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.45 !important;
    margin: 2px 0 !important;
  }
  .mobile-submit-card-meta {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px 12px !important;
    background: #f8fafc !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
  }
  .mobile-submit-card-meta .meta-item {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }
  .mobile-submit-card-meta .meta-label {
    font-size: 11px !important;
    color: #64748b !important;
    font-weight: 600 !important;
  }
  .mobile-submit-card-meta .meta-value {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
  }
  .mobile-submit-card-meta .meta-value.score-val {
    color: #0369a1 !important;
  }
  .mobile-submit-card-meta .meta-value.deadline-val {
    color: #dc2626 !important;
  }
  .mobile-submit-card-meta .meta-value.start-val {
    color: #059669 !important;
  }

  .mobile-submit-action-btn {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    margin-top: 2px !important;
  }

  /* Support Dark Mode tren Mobile */
  body.dark-mode .mobile-submit-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3) !important;
  }
  body.dark-mode .mobile-submit-card.has-score {
    border-left-color: #22c55e !important;
    border-color: #475569 !important;
  }
  body.dark-mode .mobile-submit-card.is-pending {
    border-left-color: #f59e0b !important;
    border-color: #475569 !important;
  }
  body.dark-mode .mobile-submit-card-header {
    border-bottom-color: #334155 !important;
  }
  body.dark-mode .mobile-submit-card-title {
    color: #f8fafc !important;
  }
  body.dark-mode .mobile-submit-card-meta {
    background: #0f172a !important;
    border-color: #334155 !important;
  }
  body.dark-mode .mobile-submit-card-meta .meta-label {
    color: #94a3b8 !important;
  }
  body.dark-mode .mobile-submit-card-meta .meta-value {
    color: #f1f5f9 !important;
  }
  body.dark-mode .stat-card {
    background: #1e293b !important;
    border-color: #334155 !important;
  }
  body.dark-mode .stat-card .stat-label {
    color: #94a3b8 !important;
  }
  body.dark-mode .stat-card .stat-sub {
    color: #94a3b8 !important;
  }
}
