/* CSS Variables - Official EVN-EC White & Emerald Corporate Theme */
:root {
  --primary: #10B981;
  --primary-dark: #047857;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --secondary: #65A30D;
  --accent-solar: #15803D;
  --accent-solar-glow: rgba(21, 128, 61, 0.15);
  --accent-green: #059669;
  --accent-green-glow: rgba(5, 150, 105, 0.15);
  --accent-vinfast: #059669;
  --accent-vinfast-glow: rgba(5, 150, 105, 0.15);
  --danger: #DC2626;
  --warning: #D97706;
  --success: #10B981;
  --info: #0284C7;

  /* Background - Crisp White Base & Soft Canvas */
  --bg-base: #F4F7F5;
  --bg-dark: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F0FDF4;
  --bg-modal: #FFFFFF;
  --bg-input: #F8FAFC;

  /* Text - High Contrast Deep Slate & Emerald */
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;

  /* Borders */
  --border: #E2E8F0;
  --border-active: #10B981;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --header-height: 64px;

  /* Animations */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

button { cursor: pointer; border: none; outline: none; }

input, textarea, select {
  font-family: inherit;
  outline: none;
}

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===========================
   Login Page
   =========================== */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 60%),
              var(--bg-base);
}

#login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 0 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,212,255,0.05) inset;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 30px var(--primary-glow);
}

.login-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===========================
   Layout
   =========================== */
#app {
  display: none;
  min-height: 100vh;
}

#app.visible { display: flex; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  max-height: 100vh;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

.sidebar-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  background: #FFFFFF;
}

.sidebar-brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #10B981, #059669);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sidebar-toggle-btn {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #ECFDF5;
  border-color: #10B981;
  color: #047857;
}

.sidebar-title {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  color: #0F172A;
}

.sidebar-title span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #10B981;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.55rem 0.75rem 0.15rem;
  margin-top: 0.4rem;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  margin: 0.05rem 0.3rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
  min-height: 34px;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: #ECFDF5;
  color: #047857;
  border-left: 4px solid #10B981;
  border: 1px solid #A7F3D0;
  font-weight: 700;
}

.nav-item.active .nav-icon { color: #047857; }

.nav-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  transition: background var(--transition);
  cursor: pointer;
}

.user-info:hover { background: var(--bg-card-hover); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-details { overflow: hidden; }
.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Sidebar Collapsed Mode */
.sidebar.collapsed {
  width: var(--sidebar-collapsed) !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 0.85rem 0 !important;
  justify-content: center !important;
}

.sidebar.collapsed .sidebar-brand-wrapper {
  gap: 0 !important;
  justify-content: center !important;
  width: 100% !important;
}

.sidebar.collapsed .sidebar-toggle-btn {
  display: none !important;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .logo-text-box,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-footer {
  display: none !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.7rem 0;
  margin: 0.25rem 0.4rem;
}

.sidebar.collapsed .nav-icon {
  margin: 0;
}

#app.sidebar-is-collapsed .main-content {
  margin-left: var(--sidebar-collapsed) !important;
}

/* Topbar Action Buttons */
.btn-topbar-action {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  color: #0F172A;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-topbar-action:hover {
  background: #ECFDF5;
  border-color: #10B981;
  color: #047857;
  transform: translateY(-1px);
}

/* Official EVN-EC White & Emerald Corporate Theme Overrides */
.sidebar {
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
  box-shadow: 2px 0 12px rgba(0,0,0,0.03);
}

.header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.card,
.dept-card,
.kanban-col,
.unit-banner,
.user-dropdown-menu,
.modal-content,
.login-card,
.task-card {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #0F172A !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.05) !important;
}

/* Force override any dark background inline styles */
[style*="background:rgba(15,23,42"],
[style*="background: rgba(15,23,42"],
[style*="background:rgba(10,15,30"],
[style*="background: rgba(10,15,30"],
[style*="background:rgba(10,31,22"],
[style*="background: rgba(10,31,22"],
[style*="background:#0F172A"],
[style*="background: #0F172A"],
[style*="background:#080E1A"],
[style*="background: #080E1A"],
[style*="background:#0D1526"],
[style*="background: #0D1526"] {
  background-color: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #0F172A !important;
}

[style*="color:var(--text-primary)"],
[style*="color: var(--text-primary)"] {
  color: #0F172A !important;
}

[style*="color:var(--text-secondary)"],
[style*="color: var(--text-secondary)"] {
  color: #334155 !important;
}

[style*="color:var(--text-muted)"],
[style*="color: var(--text-muted)"] {
  color: #64748B !important;
}

/* Sub-box panels & progress bars */
[style*="background:rgba(16, 185, 129, 0.12)"],
[style*="background: rgba(16, 185, 129, 0.12)"],
[style*="background:rgba(245, 158, 11, 0.12)"],
[style*="background: rgba(245, 158, 11, 0.12)"],
[style*="background:rgba(239, 68, 68, 0.12)"],
[style*="background: rgba(239, 68, 68, 0.12)"],
[style*="background:rgba(59, 130, 246, 0.12)"],
[style*="background: rgba(59, 130, 246, 0.12)"],
[style*="background:rgba(255,255,255,0.03)"],
[style*="background: rgba(255,255,255,0.03)"] {
  background: #F0FDF4 !important;
  border-color: #A7F3D0 !important;
}

.table-wrapper table th {
  background: #F0FDF4;
  color: #047857;
  border-bottom: 2px solid #CBD5E1;
  font-weight: 700;
}

.table-wrapper table td {
  border-bottom: 1px solid #F1F5F9;
  color: #0F172A;
}

.form-control {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  color: #0F172A;
}

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

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  transition: margin var(--transition-slow);
}

/* Header Topbar - Official Crisp White & Emerald Corporate */
.header {
  height: var(--header-height);
  background: #FFFFFF !important;
  border-bottom: 1px solid #E2E8F0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0F172A !important;
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}

.user-info-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

/* =====================================================
   NOTIFICATION SYSTEM (BELL DROPDOWN & FB POPUP TOAST)
   ===================================================== */
.notif-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 20px;
  padding: 1px 5px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  border: 1px solid #FFFFFF;
  animation: pulseNotif 2s infinite;
}

@keyframes pulseNotif {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.notif-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: -60px;
  width: 380px;
  max-width: 90vw;
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12) !important;
  display: none;
  flex-direction: column;
  z-index: 1100;
  overflow: hidden;
}

.notif-dropdown-menu.show {
  display: flex;
}

.notif-header {
  padding: 0.85rem 1rem 0.5rem 1rem;
  background: #F8FAFC;
  border-bottom: 1px solid #F1F5F9;
}

.notif-tabs {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.notif-tab {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.notif-tab:hover {
  background: #F0FDF4;
  border-color: #10B981;
  color: #047857;
}

.notif-tab.active {
  background: #10B981;
  border-color: #059669;
  color: #FFFFFF;
  font-weight: 700;
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.notif-item:hover {
  background: #F0FDF4;
}

.notif-item.unread {
  background: #ECFDF5;
}

.notif-item.unread::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
}

.notif-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notif-icon-box.chat { background: #E0F2FE; color: #0284C7; }
.notif-icon-box.task { background: #FEF3C7; color: #D97706; }
.notif-icon-box.attendance { background: #FEE2E2; color: #DC2626; }
.notif-icon-box.fine { background: #FEE2E2; color: #B91C1C; }
.notif-icon-box.reward { background: #D1FAE5; color: #047857; }

.notif-content {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.35;
}

.notif-title {
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 0.15rem;
}

.notif-desc {
  color: #334155;
  font-size: 0.78rem;
}

.notif-time {
  font-size: 0.7rem;
  color: #64748B;
  margin-top: 0.25rem;
}

.notif-footer {
  padding: 0.5rem 1rem;
  background: #F8FAFC;
  border-top: 1px solid #F1F5F9;
  text-align: center;
}

/* Facebook-Style Live Toast Popup Container */
.fb-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 360px;
  width: calc(100vw - 40px);
  pointer-events: none;
}

.fb-toast {
  pointer-events: auto;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-left: 5px solid #10B981;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.fb-toast.chat { border-left-color: #0284C7; }
.fb-toast.task { border-left-color: #D97706; }
.fb-toast.warning { border-left-color: #EF4444; }
.fb-toast.fine { border-left-color: #DC2626; }
.fb-toast.reward { border-left-color: #10B981; }

.fb-toast-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #ECFDF5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.fb-toast-body {
  flex: 1;
}

.fb-toast-header {
  font-size: 0.82rem;
  font-weight: 800;
  color: #0F172A;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fb-toast-text {
  font-size: 0.78rem;
  color: #334155;
  margin-top: 0.2rem;
  line-height: 1.3;
}

.fb-toast-time {
  font-size: 0.68rem;
  color: #64748B;
  margin-top: 0.3rem;
}

.fb-toast-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #94A3B8;
  cursor: pointer;
  padding: 0 0 0 0.5rem;
  line-height: 1;
}

.fb-toast-close:hover {
  color: #0F172A;
}

.user-info-trigger:hover {
  background: #ECFDF5;
  border-color: #10B981;
}

.user-dropdown-container {
  position: relative;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 270px;
  width: max-content;
  max-width: 330px;
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
  padding: 0 0 0.4rem 0;
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.user-dropdown-menu.show {
  display: flex;
}

.dropdown-header {
  padding: 0.85rem 1rem;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar.lg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #FFFFFF;
  flex-shrink: 0;
}

.menu-user-name, .dropdown-header strong {
  display: block;
  font-weight: 800;
  font-size: 0.92rem;
  color: #0F172A;
  line-height: 1.2;
}

.menu-user-email, #dropdown-user-email {
  font-size: 0.76rem;
  color: #64748B;
  margin-top: 0.15rem;
  font-weight: 500;
  white-space: nowrap;
}

.dropdown-divider {
  height: 1px;
  background: #E2E8F0;
  margin: 0.3rem 0;
  border: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  margin: 0.12rem 0.35rem;
  border-radius: 8px;
  color: #0F172A;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: #ECFDF5;
  color: #047857;
}

.dropdown-item.text-danger, .dropdown-item.danger {
  color: #DC2626;
}

.dropdown-item.text-danger:hover, .dropdown-item.danger:hover {
  background: #FEF2F2;
  color: #DC2626;
}

.dropdown-item.text-danger:hover {
  background: #FEE2E2;
}

/* Page content */
.page-content {
  padding: 1.5rem 2rem;
  width: 100%;
  max-width: 1750px;
  margin: 0 auto;
}

/* ===========================
   Cards & Glassmorphism
   =========================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

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

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===========================
   Stats Grid
   =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent, var(--primary));
}

.stat-card:hover {
  border-color: rgba(0,212,255,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  display: block;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--text-primary), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.stat-change {
  font-size: 0.7rem;
  margin-top: 0.5rem;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
  font-weight: 600;
}
.btn-secondary:hover { background: #E2E8F0; color: #0F172A; border-color: #94A3B8; }

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
  font-weight: 700;
}
.btn-danger:hover { background: #FCA5A5; color: #7F1D1D; }

.btn-solar {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
  font-weight: 700;
}
.btn-solar:hover { background: #FDE68A; color: #78350F; }

.btn-vinfast {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #6EE7B7;
  font-weight: 700;
}
.btn-vinfast:hover { background: #D1FAE5; color: #064E3B; }

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-active); }

/* ===========================
   Forms
   =========================== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  background: rgba(0,212,255,0.05);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control option {
  background: var(--bg-modal);
  color: var(--text-primary);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

/* ===========================
   Tables
   =========================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: rgba(0,212,255,0.05);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }

tbody td {
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ===========================
   Badges & Status
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-planning   { background: rgba(148,163,184,0.15); color: #94A3B8; }
.badge-survey     { background: rgba(245,158,11,0.15);  color: #F59E0B; }
.badge-approved   { background: rgba(59,130,246,0.15);  color: #3B82F6; }
.badge-in_progress{ background: rgba(0,212,255,0.15);   color: #00D4FF; }
.badge-testing    { background: rgba(168,85,247,0.15);  color: #A855F7; }
.badge-completed  { background: rgba(16,185,129,0.15);  color: #10B981; }
.badge-suspended  { background: rgba(249,115,22,0.15);  color: #F97316; }
.badge-cancelled  { background: rgba(239,68,68,0.15);   color: #EF4444; }

.badge-pending    { background: rgba(148,163,184,0.15); color: #94A3B8; }
.badge-blocked    { background: rgba(239,68,68,0.15);   color: #EF4444; }

.badge-solar      { background: rgba(245,158,11,0.15);  color: #F59E0B; }
.badge-vinfast    { background: rgba(16,185,129,0.15);  color: #10B981; }

.badge-low    { background: rgba(148,163,184,0.1); color: #64748B; }
.badge-medium { background: rgba(59,130,246,0.15); color: #3B82F6; }
.badge-high   { background: rgba(245,158,11,0.15); color: #F59E0B; }
.badge-urgent { background: rgba(239,68,68,0.15);  color: #EF4444; }

/* ===========================
   Modal
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,212,255,0.05) inset;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-large { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-modal);
  z-index: 1;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.1rem;
}

.modal-close:hover { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.3); }

.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; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    width: 260px;
    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;
  }
  #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;
  }
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 998;
    justify-content: space-around;
    align-items: center;
    backdrop-filter: blur(12px);
  }
  .page-content {
    padding-bottom: 5.5rem !important;
  }
}

/* Tablet & Mobile Layout Refinement */
@media (max-width: 768px) {
  .header {
    padding: 0 0.75rem !important;
    height: 56px !important;
  }
  .header-title {
    font-size: 0.95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
  }
  .header-actions {
    gap: 0.35rem !important;
  }
  .header-actions .btn-solar,
  .header-actions .btn-vinfast {
    display: none !important;
  }
  .user-details {
    display: none !important;
  }
  .page-content {
    padding: 0.75rem !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 {
    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;
    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) {
  .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;
}

/* Floating AI Chat Assistant Widget */
#ai-chat-widget {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 999;
}

#ai-chat-trigger {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition);
}

#ai-chat-trigger:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
}

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

/* AI FAB Floating Button */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  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.4);
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ai-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5);
}

/* AI Chat Box Popup Window */
.ai-chat-box, #ai-chat-box {
  position: fixed;
  bottom: 90px;
  right: 24px;
  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;
  }
}

/* Desktop High-Resolution Optimization (> 1280px) */
@media (min-width: 1280px) {
  .page-content {
    max-width: 1650px;
    margin: 0 auto;
  }
}
