
.modal-close:hover { 
  background: rgba(239,68,68,0.85) !important; 
  color: #FFFFFF !important; 
  border-color: rgba(239,68,68,0.9) !important; 
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ===========================
   Progress Bar
   =========================== */
.progress {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
}

/* ===========================
   Empty States
   =========================== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-desc { font-size: 0.875rem; }

/* ===========================
   Toast Notifications
   =========================== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-modal);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  min-width: 240px;
  max-width: 360px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
.toast.info    { border-color: rgba(59,130,246,0.4); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===========================
   Loading Spinner
   =========================== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,212,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-secondary);
  gap: 0.75rem;
}

/* ===========================
   Kanban Board
   =========================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 280px);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  min-height: 400px;
}

.kanban-col-header {
  padding: 0.875rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.15);
}

.kanban-tasks { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; }

.task-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.task-card:hover {
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.task-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.task-project {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ===========================
   Timeline (Activity)
   =========================== */
.timeline { position: relative; padding-left: 1.5rem; }

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-dark);
  box-shadow: 0 0 6px var(--primary-glow);
}

.timeline-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.timeline-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.timeline-content strong { color: var(--text-primary); }

/* ===========================
   Charts container
   =========================== */
.chart-container {
  position: relative;
  height: 200px;
}

/* ===========================
   Filters & Search bar
   =========================== */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.875rem 0.55rem 2.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ===========================
   Detail Panel
   =========================== */
.detail-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1.25rem;
}

.detail-item { }
.detail-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}
.detail-value {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ===========================
   Divider
   =========================== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

/* ===========================
   Type indicators
   =========================== */
.type-solar {
  color: var(--accent-solar);
  display: flex; align-items: center; gap: 0.3rem;
}
.type-vinfast {
  color: var(--accent-vinfast);
  display: flex; align-items: center; gap: 0.3rem;
}

/* ===========================
   Mobile Nav
   =========================== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  padding: 0.4rem;
  gap: 0.2rem;
  backdrop-filter: blur(12px);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.25rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 500;
}

.mobile-nav-item .nav-icon { font-size: 1.3rem; }
.mobile-nav-item.active { color: var(--primary); background: rgba(0,212,255,0.08); }
.mobile-nav-item:hover { color: var(--text-secondary); }

/* ===========================
   Animations
   =========================== */
@keyframes fadeInUp {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page-view { animation: fadeInUp 0.2s ease; animation-fill-mode: both; }

/* ===========================
   Desktop Layout (>= 1025px)
   =========================== */
@media (min-width: 1025px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 100;
    transform: none !important;
  }
  .main-content {
    margin-left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    max-width: calc(100% - var(--sidebar-width)) !important;
    min-height: 100vh;
  }
  #app.sidebar-is-collapsed .sidebar,
  .sidebar.collapsed {
    width: var(--sidebar-collapsed) !important;
  }
  #app.sidebar-is-collapsed .main-content {
    margin-left: var(--sidebar-collapsed) !important;
    width: calc(100% - var(--sidebar-collapsed)) !important;
    max-width: calc(100% - var(--sidebar-collapsed)) !important;
  }
  #sidebar-toggle {
    display: none !important;
  }
  #sidebar-overlay {
    display: none !important;
  }
}

/* ===========================
   Mobile & Tablet Responsive (<= 1024px)
   =========================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1200;
    width: 280px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.6);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  #sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    padding: 0.4rem 0.6rem;
    margin-right: 0.5rem;
  }
  #sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1150;
    display: none;
  }
  #sidebar-overlay.active {
    display: block !important;
  }
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 9998;
    justify-content: space-around;
    align-items: center;
    backdrop-filter: blur(12px);
    box-sizing: border-box;
    padding-left: 4px;
    padding-right: 4px;
  }
  .mobile-nav-item .nav-text {
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }
  .page-content,
  .main-content {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* AI Mobile Float: Right corner above bottom nav */
  #ai-chat-widget {
    position: fixed !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    left: auto !important;
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    z-index: 9999 !important;
  }
  #ai-chat-trigger {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    justify-content: center !important;
    font-size: 1.3rem !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45) !important;
  }
  #ai-chat-trigger .ai-trigger-text,
  #ai-chat-trigger .ai-badge {
    display: none !important;
  }
  .ai-fab, #ai-fab {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    left: auto !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 1.3rem !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45) !important;
    z-index: 9999 !important;
  }
}

/* Tablet & Mobile Layout Refinement */
@media (max-width: 768px) {
  .header {
    padding: 0 0.5rem !important;
    height: 52px !important;
    gap: 0.35rem !important;
  }
  .header-title {
    font-size: 0.95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 135px;
  }
  .header-actions {
    gap: 0.35rem !important;
  }
  .header-actions .btn-solar,
  .header-actions .btn-vinfast {
    display: none !important;
  }
  .user-details,
  .user-details-box {
    display: none !important;
  }
  .user-info-trigger {
    padding: 0.2rem 0.3rem !important;
    gap: 0.25rem !important;
  }
  .user-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.8rem !important;
  }
  .btn-topbar-action {
    padding: 0.35rem 0.45rem !important;
    font-size: 0.85rem !important;
  }
  #lang-btn {
    display: none !important;
  }
  .btn-switch-tenant {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    border-radius: 14px !important;
  }
  .page-content {
    padding: 0.75rem !important;
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Modal overlay & popup above bottom nav & AI FAB */
  .modal-overlay {
    z-index: 10500 !important;
  }
  .modal {
    z-index: 10501 !important;
    max-width: calc(100vw - 20px) !important;
    margin: 10px auto !important;
    max-height: calc(100vh - 40px) !important;
  }

  /* Toast container above bottom nav */
  #toast-container {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10600 !important;
  }

  /* Notification menu full width on mobile */
  .notif-dropdown-menu {
    position: fixed !important;
    top: 56px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    z-index: 10001 !important;
  }

  /* Force all inline multi-column grids into clean single-column responsive layout */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 340px"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 320px 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .chart-container {
    height: 200px !important;
  }

  /* Full Screen Mobile AI Chat Widget */
  #ai-chat-box, .ai-chat-box {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    z-index: 10000 !important;
  }

  /* Mobile Table Scroller */
  .table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 10px;
  }
  table th, table td {
    padding: 0.5rem 0.65rem !important;
    font-size: 0.78rem !important;
    white-space: nowrap !important;
  }
}

/* Small Smartphone Optimization (320px - 480px) */
@media (max-width: 480px) {
  .header-title {
    max-width: 110px !important;
    font-size: 0.88rem !important;
  }
  .btn-switch-tenant .switch-tenant-text {
    display: none !important;
  }
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }
  .section-header .btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .card {
    padding: 0.85rem !important;
    border-radius: 10px !important;
  }
  .modal-body {
    padding: 1rem !important;
  }
}

/* ===========================
   Utility
   =========================== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.text-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.text-solar { color: var(--accent-solar); }
.text-vinfast { color: var(--accent-vinfast); }
.text-primary-color { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* Neon glow effects */
.glow-primary { box-shadow: 0 0 20px var(--primary-glow); }
.glow-solar   { box-shadow: 0 0 20px var(--accent-solar-glow); }
.glow-vinfast { box-shadow: 0 0 20px var(--accent-vinfast-glow); }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
}

/* Overlay for mobile sidebar */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

#sidebar-overlay.active { display: block; }

/* Department & Unit Organization Styles */
.unit-banner {
  background: linear-gradient(135deg, #FFFFFF, #F0FDF4);
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.05);
  position: relative;
  overflow: hidden;
}

.unit-banner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--unit-accent, var(--primary));
}

.unit-banner.solar { --unit-accent: var(--accent-solar); }
.unit-banner.vinfast { --unit-accent: var(--accent-vinfast); }

.unit-title-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.unit-icon-large {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: #F0FDF4;
  border: 1px solid #A7F3D0;
}

.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.dept-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 16px;
  padding: 1.25rem;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.05);
}

.dept-card:hover {
  border-color: var(--primary) !important;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.12) !important;
}

.dept-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dept-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #F0FDF4;
  border: 1px solid #A7F3D0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.dept-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dept-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.dept-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dept-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: #F8FAFC;
  border-radius: 8px;
  font-size: 0.8rem;
}

/* Dashboard Event Slider Responsive & Fixed Height (Tối ưu mở rộng cao x3 chuẩn Desktop) */
#dash-event-slider {
  margin-bottom: 1.75rem;
}
.event-slider-main-box {
  height: 440px !important;
  max-height: 440px !important;
  overflow: hidden !important;
}
.event-slider-main-box img {
  height: 440px !important;
  max-height: 440px !important;
  object-fit: cover !important;
}
@media (max-width: 1024px) {
  .event-slider-main-box {
    height: 360px !important;
    max-height: 360px !important;
  }
  .event-slider-main-box img {
    height: 360px !important;
    max-height: 360px !important;
  }
}
@media (max-width: 768px) {
  .event-slider-main-box {
    grid-template-columns: 1fr !important;
    height: auto !important;
    max-height: none !important;
  }
  .event-slider-main-box > div:first-child {
    padding: 1.25rem 1.1rem !important;
  }
  .event-slider-main-box > div:last-child {
    height: 220px !important;
    max-height: 220px !important;
  }
  .event-slider-main-box img {
    height: 220px !important;
    max-height: 220px !important;
  }
}

/* Sidebar Navigation Buffer */
.sidebar-nav {
  padding-bottom: 12px !important;
}

/* Floating AI Chat Assistant Widget (Bottom-Right so Bottom-Left is dedicated to User Profile) */
#ai-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 24px;
  left: auto;
  width: auto;
  max-width: 240px;
  z-index: 9999;
}

#login-page:not([style*="display: none"]) ~ #ai-chat-widget,
#app[style*="display: none"] ~ #ai-chat-widget,
#login-page:not([style*="display: none"]) ~ #ai-fab,
#app[style*="display: none"] ~ #ai-fab {
  display: none !important;
}

#ai-chat-trigger {
  width: 100%;
  justify-content: center;
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border: none;
  padding: 0.52rem 0.85rem;
  border-radius: 24px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition);
}

#ai-chat-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
}

.ai-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.65rem;
}

/* AI FAB Floating Button (VNT & Desktop Floating) */
.ai-fab, #ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-fab:hover, #ai-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.55);
}

/* AI Chat Box Popup Window */
.ai-chat-box {
  position: fixed;
  bottom: 90px;
  right: 24px;
  left: auto;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border: 2px solid #10B981;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  animation: slideUpFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#ai-chat-widget #ai-chat-box {
  position: fixed;
  bottom: 76px;
  right: 24px;
  left: auto;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border: 2px solid #10B981;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: slideUpFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-box.open, #ai-chat-box.active, #ai-chat-box[style*="display: block"], #ai-chat-box[style*="display: flex"] {
  display: flex !important;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-box-header {
  padding: 0.85rem 1.1rem;
  background: linear-gradient(135deg, #064E3B, #047857);
  color: #FFFFFF !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-box-header div {
  color: #FFFFFF;
}

.ai-box-model-select {
  padding: 0.4rem 1rem;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-box-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #F8FAFC;
}

.ai-msg {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 88%;
  word-break: break-word;
}

.ai-msg.bot {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  align-self: flex-start;
  color: #0F172A;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}

.ai-msg.user {
  background: linear-gradient(135deg, #059669, #10B981);
  color: #FFFFFF;
  align-self: flex-end;
  box-shadow: 0 3px 10px rgba(5,150,105,0.25);
}

.ai-box-quick-prompts {
  padding: 0.5rem 0.65rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
  scrollbar-width: none;
}

.ai-box-quick-prompts::-webkit-scrollbar {
  display: none;
}

.ai-prompt-chip {
  background: #FFFFFF;
  border: 1px solid #10B981;
  color: #047857;
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(16,185,129,0.08);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.ai-prompt-chip:hover {
  background: #10B981;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16,185,129,0.25);
}

.ai-box-input-container, .ai-box-input-row {
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid #E2E8F0;
  background: #FFFFFF;
  flex-shrink: 0;
  box-sizing: border-box;
}

.ai-box-input {
  flex: 1;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #CBD5E1;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #0F172A;
  background: #F8FAFC;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.ai-box-input:focus {
  border-color: #10B981;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.ai-box-input-container .btn, .ai-box-input-row .btn {
  padding: 0.65rem 1.1rem !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  background: linear-gradient(135deg, #059669, #10B981) !important;
  color: #FFFFFF !important;
  border: none !important;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.ai-box-input-container .btn:hover, .ai-box-input-row .btn:hover {
  background: linear-gradient(135deg, #047857, #059669) !important;
  box-shadow: 0 6px 16px rgba(16,185,129,0.4);
}

/* AI Hub Category Tabs & Prompt Pills */
.ai-cat-tab {
  padding: 0.55rem 1.1rem;
  border-radius: 20px;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.ai-cat-tab:hover, .ai-cat-tab.active {
  background: #ECFDF5;
  border-color: #10B981;
  color: #047857;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.ai-prompt-pill {
  padding: 0.45rem 0.85rem;
  border-radius: 18px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #0F172A;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.ai-prompt-pill:hover {
  background: rgba(0, 212, 255, 0.18);
  border-color: var(--accent-vinfast);
  color: #FFF;
  transform: translateY(-1px);
}

/* Mic Voice Recording Pulsing Animation */
.btn-mic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-mic:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--accent-vinfast);
}
.btn-mic.recording {
  background: #EF4444 !important;
  color: #FFF !important;
  border-color: #F87171 !important;
  animation: pulse-mic 1.2s infinite;
}

@keyframes pulse-mic {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* VoIP Call Animations */
@keyframes voipPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.3; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

@keyframes waveBounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.2); }
}

/* ⚡ Hardware-Accelerated 60fps Smooth Rendering & Page Transitions */
.main-content {
  contain: content;
  transform: translateZ(0);
  transition: opacity 0.15s ease-in-out;
}

.page-view {
  animation: fadeInFast 0.2s ease;
  animation-fill-mode: both;
}

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

/* ============================================================
   ULTRA-RESPONSIVE MOBILE & DESKTOP UI ENHANCEMENTS
   ============================================================ */

/* Global Smooth Touch Enhancements */
html, body {
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

/* Mobile Touch Optimization (Tablet & Smartphone) */
@media (max-width: 768px) {
  .mobile-swipe-hint {
    display: block !important;
  }

  button, .btn, input, select, .nav-item {
    min-height: 42px;
    touch-action: manipulation;
  }

  /* Unit Department Tab Bar Scroller for Mobile */
  .dept-unit-tab-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    padding: 0.75rem 0.5rem !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .dept-unit-tab-bar button {
    flex-shrink: 0 !important;
    scroll-snap-align: start;
    font-size: 0.85rem !important;
    padding: 0.55rem 1.1rem !important;
  }

  /* Mobile Org Chart Scroller Container */
  #org-tree-viewport {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 1rem !important;
    touch-action: pan-x pan-y;
  }

  /* Mobile Cards Grid */
  .dept-grid, .grid-2, .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Section Header Stack on Mobile */
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  .section-header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .section-header > div:last-child .btn {
    flex: 1;
    justify-content: center;
  }

/* Responsive Modal Dialog Adjustments */
  .modal-dialog {
    max-width: 95vw !important;
    margin: 1rem auto !important;
    border-radius: 16px !important;
  }

  /* MOBILE CHAT RESPONSIVE WRAPPER */
  .chat-layout-wrapper {
    flex-direction: column !important;
    height: auto !important;
    min-height: calc(100vh - 140px) !important;
  }
  .chat-sidebar-panel {
    width: 100% !important;
    max-height: 280px !important;
    border-right: none !important;
    border-bottom: 1px solid #E2E8F0 !important;
  }
  .chat-main-panel {
    width: 100% !important;
    flex: 1 !important;
  }

  /* MOBILE TABLE HORIZONTAL SCROLL ENHANCEMENTS */
  .table-wrapper, div[style*="overflow-x: auto"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 14px !important;
    max-width: 100% !important;
  }
  table {
    min-width: 600px !important;
  }

  /* MOBILE BOTTOM NAVIGATION BAR */
  .vnt-mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #064E3B;
    border-top: 1.5px solid #10B981;
    z-index: 9999;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.25);
    padding-left: 4px;
    padding-right: 4px;
    margin: 0;
    box-sizing: border-box;
  }
  .page-content,
  .main-content {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .vnt-mobile-bottom-nav .mob-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #A7F3D0;
    text-decoration: none;
    flex: 1;
    height: 100%;
    padding: 3px 0;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.15s ease;
    border-radius: 8px;
  }
  .vnt-mobile-bottom-nav .mob-item .mob-icon {
    font-size: 1.25rem !important;
    line-height: 1.1 !important;
    margin-bottom: 2px;
    display: block;
  }
  .vnt-mobile-bottom-nav .mob-item .mob-text {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100%;
    color: inherit;
    letter-spacing: -0.1px;
    display: block;
  }
  .vnt-mobile-bottom-nav .mob-item.active {
    color: #FFFFFF !important;
    background: rgba(16, 185, 129, 0.28) !important;
    box-shadow: inset 0 2px 0 #34D399;
  }
  .vnt-mobile-bottom-nav .mob-item.active .mob-text {
    font-weight: 800 !important;
    color: #FFFFFF !important;
  }

  /* MOBILE RESPONSIVE ENHANCEMENTS FOR VNT MODULES */
  .class-board-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .modal-overlay .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 1.15rem !important;
    margin: 10px auto !important;
  }
  .form-row {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  .page-view {
    padding: 0.75rem !important;
  }
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  .grades-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

/* Tablet Optimization (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .class-board-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Desktop High-Resolution Optimization (> 1280px) */
@media (min-width: 1280px) {
  .page-content {
    max-width: 100% !important;
    width: 100%;
    margin: 0;
  }
  .class-board-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
  }
}

/* ==========================================================================
   TỐI ƯU HÓA GIAO DIỆN CHO MÀN HÌNH LAPTOP & DESKTOP NHỎ (1024px - 1440px)
   (MacBook 13", Màn hình 1366x768, 1280x800, 1440x900)
   ========================================================================== */
@media (max-width: 1440px) {
  :root {
    --sidebar-width: 220px;
  }
  .training-suite-wrapper {
    padding: 0 !important;
  }
  .training-nav-tab {
    padding: 0.48rem 0.85rem !important;
    font-size: 0.82rem !important;
    gap: 0.35rem !important;
    border-radius: 10px !important;
  }
  .training-nav-tab span:first-child {
    font-size: 0.95rem !important;
  }
  .training-banner-header {
    padding: 0.9rem 1.25rem !important;
    border-radius: 14px !important;
    margin-bottom: 1rem !important;
  }
  .training-banner-header h2 {
    font-size: 1.25rem !important;
  }
  .training-card-box {
    padding: 1rem 1.15rem !important;
    border-radius: 14px !important;
  }
}

@media (max-width: 1366px) {
  /* Bảng Học Viên & Báo Cáo Chuyên Cần */
  #rpt-matrix-wrapper {
    max-height: 520px !important;
  }
  #rpt-att-table th, #rpt-att-table td {
    padding: 6px 3px !important;
    font-size: 0.74rem !important;
  }
  #rpt-att-table .rpt-date-col {
    min-width: 42px !important;
  }
  #train-stu-table th, #train-stu-table td {
    padding: 7px 5px !important;
    font-size: 0.78rem !important;
  }
  .filter-select-custom {
    padding: 0.38rem 0.55rem !important;
    font-size: 0.78rem !important;
  }
  .rpt-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 0.6rem !important;
  }
  .rpt-kpi-card {
    padding: 0.65rem 0.85rem !important;
  }
  .rpt-kpi-card .kpi-num {
    font-size: 1.1rem !important;
  }
  /* Lớp học & Thẻ điểm danh */
  .class-board-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)) !important;
    gap: 0.85rem !important;
  }
  .stu-att-card {
    padding: 0.6rem !important;
  }
}

/* ==========================================================================
   THANH CUỘN TRƯỢT NGANG TÙY CHỈNH NỔI BẬT & DỄ THAO TÁC (HORIZONTAL SCROLLBAR)
   ========================================================================== */
#rpt-matrix-wrapper,
#rpt-grades-table-wrapper,
#table-grades-master-wrapper,
#train-stu-table-wrapper,
.table-responsive,
.custom-scrollbar-x {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin !important;
  scrollbar-color: #2563EB #E2E8F0 !important;
}

#rpt-matrix-wrapper::-webkit-scrollbar,
#rpt-grades-table-wrapper::-webkit-scrollbar,
#table-grades-master-wrapper::-webkit-scrollbar,
#train-stu-table-wrapper::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.custom-scrollbar-x::-webkit-scrollbar {
  height: 12px !important;
  width: 10px !important;
}

#rpt-matrix-wrapper::-webkit-scrollbar-track,
#rpt-grades-table-wrapper::-webkit-scrollbar-track,
#table-grades-master-wrapper::-webkit-scrollbar-track,
#train-stu-table-wrapper::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
