/* ================================================================
   JKR HRMS — Theme System & Global Styles
   Three themes: liquid-glass | minimalism | glassmorphism
   ================================================================ */

/* --------------------------------------------------------
   CSS Custom Properties — Liquid Glass (default)
   -------------------------------------------------------- */
[data-theme="liquid-glass"] {
  --bg-primary:         #0a0e1a;
  --bg-secondary:       #111827;
  --bg-tertiary:        #1a2235;
  --bg-hover:           rgba(99, 102, 241, 0.12);
  --sidebar-bg:         rgba(10, 14, 26, 0.92);
  --sidebar-border:     rgba(255, 255, 255, 0.06);
  --topbar-bg:          rgba(10, 14, 26, 0.85);
  --card-bg:            rgba(255, 255, 255, 0.04);
  --card-hover-bg:      rgba(255, 255, 255, 0.07);
  --card-border:        rgba(255, 255, 255, 0.08);
  --card-shadow:        0 4px 24px rgba(0, 0, 0, 0.4);
  --card-hover-shadow:  0 8px 40px rgba(99, 102, 241, 0.2);
  --modal-bg:           #111827;
  --modal-border:       rgba(255, 255, 255, 0.1);
  --input-bg:           rgba(255, 255, 255, 0.05);
  --input-border:       rgba(255, 255, 255, 0.12);
  --input-focus-border: #6366f1;
  --input-focus-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  --text-primary:       #f1f5f9;
  --text-secondary:     #94a3b8;
  --text-muted:         #475569;
  --accent-primary:     #6366f1;
  --accent-hover:       #5558e3;
  --accent-light:       rgba(99, 102, 241, 0.15);
  --success:            #10b981;
  --success-light:      rgba(16, 185, 129, 0.15);
  --warning:            #f59e0b;
  --warning-light:      rgba(245, 158, 11, 0.15);
  --danger:             #ef4444;
  --danger-light:       rgba(239, 68, 68, 0.15);
  --info:               #3b82f6;
  --info-light:         rgba(59, 130, 246, 0.15);
  --border-radius:      14px;
  --border-radius-sm:   8px;
  --border-radius-lg:   20px;
  --blur:               blur(20px);
  --transition:         all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading:       'Poppins', system-ui, sans-serif;
  --font-body:          'Inter', system-ui, sans-serif;
  --sidebar-width:      260px;
  --sidebar-collapsed:  72px;
  --topbar-height:      64px;
  --gradient-hero:      linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-bg:        linear-gradient(135deg, #0a0e1a 0%, #1a1a3e 60%, #0d1b2a 100%);
}

/* --------------------------------------------------------
   CSS Custom Properties — Minimalism & Swiss Style
   -------------------------------------------------------- */
[data-theme="minimalism"] {
  --bg-primary:         #f8fafc;
  --bg-secondary:       #ffffff;
  --bg-tertiary:        #f1f5f9;
  --bg-hover:           #eff6ff;
  --sidebar-bg:         #ffffff;
  --sidebar-border:     #e2e8f0;
  --topbar-bg:          #ffffff;
  --card-bg:            #ffffff;
  --card-hover-bg:      #f8fafc;
  --card-border:        #e2e8f0;
  --card-shadow:        0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --card-hover-shadow:  0 4px 12px rgba(0, 0, 0, 0.1);
  --modal-bg:           #ffffff;
  --modal-border:       #e2e8f0;
  --input-bg:           #ffffff;
  --input-border:       #d1d5db;
  --input-focus-border: #2563eb;
  --input-focus-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  --text-primary:       #0f172a;
  --text-secondary:     #475569;
  --text-muted:         #94a3b8;
  --accent-primary:     #2563eb;
  --accent-hover:       #1d4ed8;
  --accent-light:       #eff6ff;
  --success:            #059669;
  --success-light:      #d1fae5;
  --warning:            #d97706;
  --warning-light:      #fef3c7;
  --danger:             #dc2626;
  --danger-light:       #fee2e2;
  --info:               #0284c7;
  --info-light:         #e0f2fe;
  --border-radius:      8px;
  --border-radius-sm:   4px;
  --border-radius-lg:   12px;
  --blur:               none;
  --transition:         all 0.2s ease;
  --font-heading:       'Inter', system-ui, sans-serif;
  --font-body:          'Inter', system-ui, sans-serif;
  --sidebar-width:      260px;
  --sidebar-collapsed:  64px;
  --topbar-height:      60px;
  --gradient-hero:      linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
  --gradient-bg:        #f8fafc;
}

/* --------------------------------------------------------
   CSS Custom Properties — Glassmorphism
   -------------------------------------------------------- */
[data-theme="glassmorphism"] {
  --bg-primary:         #0f0c29;
  --bg-secondary:       #1a1034;
  --bg-tertiary:        #24183f;
  --bg-hover:           rgba(124, 58, 237, 0.15);
  --sidebar-bg:         rgba(15, 12, 41, 0.9);
  --sidebar-border:     rgba(255, 255, 255, 0.08);
  --topbar-bg:          rgba(15, 12, 41, 0.8);
  --card-bg:            rgba(255, 255, 255, 0.08);
  --card-hover-bg:      rgba(255, 255, 255, 0.12);
  --card-border:        rgba(255, 255, 255, 0.12);
  --card-shadow:        0 8px 32px rgba(0, 0, 0, 0.5);
  --card-hover-shadow:  0 12px 48px rgba(124, 58, 237, 0.3);
  --modal-bg:           rgba(20, 16, 45, 0.95);
  --modal-border:       rgba(255, 255, 255, 0.15);
  --input-bg:           rgba(255, 255, 255, 0.08);
  --input-border:       rgba(255, 255, 255, 0.15);
  --input-focus-border: #a78bfa;
  --input-focus-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
  --text-primary:       #f3f0ff;
  --text-secondary:     #c4b5fd;
  --text-muted:         #7c6fa0;
  --accent-primary:     #7c3aed;
  --accent-hover:       #6d28d9;
  --accent-light:       rgba(124, 58, 237, 0.2);
  --success:            #34d399;
  --success-light:      rgba(52, 211, 153, 0.15);
  --warning:            #fbbf24;
  --warning-light:      rgba(251, 191, 36, 0.15);
  --danger:             #f87171;
  --danger-light:       rgba(248, 113, 113, 0.15);
  --info:               #60a5fa;
  --info-light:         rgba(96, 165, 250, 0.15);
  --border-radius:      16px;
  --border-radius-sm:   10px;
  --border-radius-lg:   24px;
  --blur:               blur(24px);
  --transition:         all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading:       'Poppins', system-ui, sans-serif;
  --font-body:          'Inter', system-ui, sans-serif;
  --sidebar-width:      260px;
  --sidebar-collapsed:  72px;
  --topbar-height:      68px;
  --gradient-hero:      linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  --gradient-bg:        linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* ================================================================
   GLOBAL BASE STYLES
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

[data-theme="liquid-glass"] body,
[data-theme="glassmorphism"] body {
  background-attachment: fixed;
}

/* ================================================================
   LAYOUT STRUCTURE
   ================================================================ */

/* App Shell (authenticated layout) */
#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ----------------------------------------------------------------
   SIDEBAR
   ---------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.app-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Mobile: off-canvas sidebar */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

[data-theme="glassmorphism"] .logo-mark {
  background: var(--gradient-hero);
}

.logo-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}
.logo-sub {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.app-sidebar.collapsed .logo-text,
.app-sidebar.collapsed .sidebar-search,
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .nav-item-text,
.app-sidebar.collapsed .user-info-sidebar {
  display: none !important;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Sidebar Search */
.sidebar-search {
  padding: 10px 12px;
  flex-shrink: 0;
}
.search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  padding: 7px 10px;
  transition: var(--transition);
}
.search-wrapper:focus-within {
  border-color: var(--input-focus-border);
  box-shadow: var(--input-focus-shadow);
}
.search-wrapper i { color: var(--text-muted); font-size: 0.85rem; }
.search-wrapper input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  width: 100%;
  font-family: var(--font-body);
}
.search-wrapper input::placeholder { color: var(--text-muted); }

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 4px; }

.nav-section {
  margin-bottom: 4px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 18px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  margin: 1px 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-item.active::before {
  transform: scaleY(1);
}

.nav-item-icon {
  width: 20px;
  font-size: 1.05rem;
  flex-shrink: 0;
  text-align: center;
}

.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
  margin: 2px 8px;
}
.app-sidebar.collapsed .nav-item-icon {
  width: auto;
  font-size: 1.15rem;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.user-card:hover { background: var(--bg-hover); }

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info-sidebar .user-name-sm {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.user-info-sidebar .user-role-sm {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ----------------------------------------------------------------
   TOPBAR
   ---------------------------------------------------------------- */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar.collapsed ~ #app-main,
.app-main.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

@media (max-width: 991.98px) {
  .app-main { margin-left: 0 !important; }
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--card-border);
}

.topbar-breadcrumb {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-breadcrumb .bc-current {
  color: var(--text-primary);
  font-weight: 600;
}
.topbar-breadcrumb .bc-sep { color: var(--text-muted); }
.topbar-breadcrumb .bc-home { color: var(--accent-primary); }

/* Language Toggle */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  padding: 3px 8px;
}
.lang-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.lang-btn.active {
  color: var(--accent-primary);
  background: var(--accent-light);
}
.lang-divider { color: var(--sidebar-border); font-size: 0.8rem; }

/* Theme Switcher */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  padding: 3px;
}
.theme-btn {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.theme-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.theme-btn.active {
  background: var(--accent-primary);
  color: white;
}

/* Notification */
.notification-btn { position: relative; }
.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Security Alert */
.security-alert {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  background: var(--warning-light);
  color: var(--warning);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(245,158,11,0.2);
}
.security-alert:hover { background: var(--warning); color: white; }
.alert-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse-dot 1.5s infinite;
}

/* User Dropdown */
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}
.user-avatar-btn:hover { border-color: var(--input-focus-border); }
.user-avatar-btn i { color: var(--text-muted); font-size: 0.75rem; }

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.user-role {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Glass Dropdown */
.glass-dropdown {
  background: var(--modal-bg) !important;
  border: 1px solid var(--modal-border) !important;
  backdrop-filter: var(--blur);
  border-radius: var(--border-radius) !important;
  box-shadow: var(--card-shadow) !important;
  min-width: 180px;
}
.glass-dropdown .dropdown-item {
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: 8px;
  margin: 2px 6px;
  transition: var(--transition);
}
.glass-dropdown .dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.glass-dropdown .dropdown-divider { border-color: var(--sidebar-border); }

/* ----------------------------------------------------------------
   VIEW CONTAINER & PAGE LOADER
   ---------------------------------------------------------------- */
.view-container {
  flex: 1;
  padding: 24px;
  position: relative;
  min-height: calc(100vh - var(--topbar-height));
}

.page-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--gradient-bg);
  z-index: 50;
}
.page-loader.active { display: flex; }

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ================================================================
   CARDS & PANELS
   ================================================================ */
.card, .app-card {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: var(--border-radius) !important;
  box-shadow: var(--card-shadow) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: var(--transition);
}

.card:hover, .app-card.hoverable:hover {
  box-shadow: var(--card-hover-shadow) !important;
  transform: translateY(-2px);
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--card-border) !important;
  padding: 16px 20px !important;
}

.card-body { padding: 20px !important; }
.card-footer {
  background: transparent !important;
  border-top: 1px solid var(--card-border) !important;
}

/* ================================================================
   KPI / STAT CARDS
   ================================================================ */
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  backdrop-filter: var(--blur);
  transition: var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.05;
  transform: translate(20px, -20px);
}

.kpi-card.kpi-primary::after { background: var(--accent-primary); }
.kpi-card.kpi-success::after { background: var(--success); }
.kpi-card.kpi-warning::after { background: var(--warning); }
.kpi-card.kpi-danger::after  { background: var(--danger); }
.kpi-card.kpi-info::after    { background: var(--info); }

.kpi-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-3px);
}

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-card.kpi-primary .kpi-icon { background: var(--accent-light); color: var(--accent-primary); }
.kpi-card.kpi-success .kpi-icon { background: var(--success-light); color: var(--success); }
.kpi-card.kpi-warning .kpi-icon { background: var(--warning-light); color: var(--warning); }
.kpi-card.kpi-danger  .kpi-icon { background: var(--danger-light);  color: var(--danger); }
.kpi-card.kpi-info    .kpi-icon { background: var(--info-light);    color: var(--info); }

.kpi-body { flex: 1; min-width: 0; }
.kpi-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.kpi-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.kpi-trend { font-weight: 600; }
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  border-radius: var(--border-radius-sm) !important;
  transition: var(--transition) !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3) !important;
}
.btn-primary:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  box-shadow: 0 6px 16px rgba(99,102,241,0.4) !important;
  transform: translateY(-1px);
}

[data-theme="glassmorphism"] .btn-primary {
  box-shadow: 0 4px 12px rgba(124,58,237,0.4) !important;
}

.btn-outline-primary {
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  background: transparent !important;
}
.btn-outline-primary:hover {
  background: var(--accent-light) !important;
  transform: translateY(-1px);
}

.btn-outline-secondary {
  border-color: var(--card-border) !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
}
.btn-outline-secondary:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}

.btn-danger {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: white !important;
}

.btn-success {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
}

.btn-sm {
  font-size: 0.78rem !important;
  padding: 4px 10px !important;
}

/* ================================================================
   FORMS & INPUTS
   ================================================================ */
.form-control, .form-select {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  border-radius: var(--border-radius-sm) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: var(--transition) !important;
  padding: 9px 12px !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: var(--input-focus-shadow) !important;
  background: var(--input-bg) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-select option { background: var(--bg-secondary); color: var(--text-primary); }

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.invalid-feedback { font-size: 0.78rem; margin-top: 4px; }
.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-light) !important;
}

/* ================================================================
   MODALS
   ================================================================ */
.modal-content {
  background: var(--modal-bg) !important;
  border: 1px solid var(--modal-border) !important;
  border-radius: var(--border-radius-lg) !important;
  backdrop-filter: var(--blur);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--card-border) !important;
  padding: 18px 24px !important;
  background: transparent !important;
}
.modal-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}
.modal-footer {
  border-top: 1px solid var(--card-border) !important;
  padding: 14px 24px !important;
  background: transparent !important;
}
.modal-body { padding: 24px !important; }

.btn-close {
  filter: var(--btn-close-filter, invert(1)) !important;
  opacity: 0.5 !important;
}
[data-theme="minimalism"] .btn-close { filter: none !important; }
.btn-close:hover { opacity: 1 !important; }

.modal-backdrop {
  backdrop-filter: blur(4px);
  background: rgba(0,0,0,0.7) !important;
}

/* ================================================================
   DATATABLES OVERRIDES
   ================================================================ */
.dataTables_wrapper {
  color: var(--text-primary) !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  border-radius: var(--border-radius-sm) !important;
  color: var(--text-primary) !important;
  font-size: 0.82rem !important;
  padding: 5px 8px !important;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_info {
  color: var(--text-secondary) !important;
  font-size: 0.82rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--border-radius-sm) !important;
  color: var(--text-secondary) !important;
  border: 1px solid transparent !important;
  transition: var(--transition) !important;
  font-size: 0.82rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--bg-hover) !important;
  border-color: var(--card-border) !important;
  color: var(--text-primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: white !important;
  font-weight: 600;
}

table.dataTable thead th {
  background: transparent !important;
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--card-border) !important;
  padding: 10px 12px !important;
}

table.dataTable tbody td {
  color: var(--text-primary) !important;
  border-bottom: 1px solid rgba(255,255,255,0.04) !important;
  font-size: 0.875rem !important;
  padding: 11px 12px !important;
  vertical-align: middle;
}
[data-theme="minimalism"] table.dataTable tbody td {
  border-bottom: 1px solid var(--card-border) !important;
}

table.dataTable tbody tr:hover td {
  background: var(--bg-hover) !important;
}

table.dataTable, .table {
  color: var(--text-primary) !important;
}

/* ================================================================
   BADGES & STATUS
   ================================================================ */
.badge {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  padding: 4px 8px !important;
  border-radius: 20px !important;
  letter-spacing: 0.02em;
}

.badge-active    { background: var(--success-light); color: var(--success); }
.badge-inactive  { background: var(--danger-light);  color: var(--danger); }
.badge-retired   { background: var(--info-light);    color: var(--info); }
.badge-transferred { background: var(--warning-light); color: var(--warning); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-expiring  { background: var(--warning-light); color: var(--warning); animation: pulse 2s infinite; }
.badge-expired   { background: var(--danger-light);  color: var(--danger); }

.badge-sys-admin  { background: var(--danger-light);   color: var(--danger); }
.badge-hq-admin   { background: var(--info-light);     color: var(--info); }
.badge-state-admin{ background: var(--accent-light);   color: var(--accent-primary); }

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================================================================
   FILTER BAR
   ================================================================ */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  backdrop-filter: var(--blur);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-bar .filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.filter-bar .form-select,
.filter-bar .form-control {
  min-width: 140px;
  flex: 1;
  max-width: 200px;
}

/* ================================================================
   TABS (for staff profile etc.)
   ================================================================ */
.nav-tabs {
  border-bottom: 1px solid var(--card-border) !important;
  gap: 4px;
}
.nav-tabs .nav-link {
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  color: var(--text-secondary) !important;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 14px !important;
  transition: var(--transition) !important;
  background: transparent !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-tabs .nav-link:hover {
  color: var(--text-primary) !important;
  border-bottom-color: var(--card-border) !important;
}
.nav-tabs .nav-link.active {
  color: var(--accent-primary) !important;
  border-bottom-color: var(--accent-primary) !important;
  font-weight: 600;
}
.tab-content { padding-top: 20px; }

/* ================================================================
   LOGIN PAGE
   ================================================================ */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-bg);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  backdrop-filter: var(--blur);
  box-shadow: 0 25px 80px rgba(0,0,0,0.5);
  animation: fadeInUp 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-mark {
  width: 64px;
  height: 64px;
  border-radius: var(--border-radius);
  background: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(99,102,241,0.5);
}
[data-theme="glassmorphism"] .login-logo-mark {
  background: var(--gradient-hero);
}
.login-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.login-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ================================================================
   PROFILE HEADER
   ================================================================ */
.profile-header {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  backdrop-filter: var(--blur);
  position: relative;
  overflow: hidden;
}
.profile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-hero);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}
.profile-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.profile-meta-item { display: flex; align-items: center; gap: 4px; }
.profile-meta-item i { color: var(--text-muted); }

/* ================================================================
   CHART CONTAINERS
   ================================================================ */
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 20px;
  backdrop-filter: var(--blur);
  transition: var(--transition);
}
.chart-card:hover {
  box-shadow: var(--card-hover-shadow);
}
.chart-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ================================================================
   ORG CHART
   ================================================================ */
#org-chart-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  min-height: 500px;
  overflow: auto;
  padding: 20px;
}

.orgchart .node .title {
  background: var(--accent-primary) !important;
  font-family: var(--font-heading) !important;
  font-size: 0.75rem !important;
}
.orgchart .node .content {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  color: var(--text-secondary) !important;
  font-size: 0.7rem !important;
}
.orgchart > .nodes {
  background: transparent !important;
}

/* ================================================================
   ANIMATIONS & KEYFRAMES
   ================================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.7; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

/* Page content animation */
.view-content { animation: fadeInUp 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

/* Staggered card animation */
.stagger-item {
  animation: fadeInUp 0.4s ease both;
}
.stagger-item:nth-child(1) { animation-delay: 0.03s; }
.stagger-item:nth-child(2) { animation-delay: 0.06s; }
.stagger-item:nth-child(3) { animation-delay: 0.09s; }
.stagger-item:nth-child(4) { animation-delay: 0.12s; }
.stagger-item:nth-child(5) { animation-delay: 0.15s; }
.stagger-item:nth-child(6) { animation-delay: 0.18s; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--card-border) 25%,
    var(--bg-hover) 50%,
    var(--card-border) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

/* Page Transition */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--accent-primary);
  z-index: 9998;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  pointer-events: none;
}
.page-transition-overlay.entering {
  transform: translateX(0);
}
.page-transition-overlay.leaving {
  transform: translateX(100%);
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.text-primary-custom { color: var(--text-primary) !important; }
.text-secondary-custom { color: var(--text-secondary) !important; }
.text-muted-custom { color: var(--text-muted) !important; }
.text-accent { color: var(--accent-primary) !important; }

.bg-card { background: var(--card-bg) !important; }
.border-custom { border-color: var(--card-border) !important; }

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Divider */
hr { border-color: var(--card-border) !important; opacity: 1 !important; }

/* Number counter animation target */
.counter-value { display: inline-block; transition: none; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state h6 { font-size: 0.95rem; color: var(--text-secondary); }
.empty-state p  { font-size: 0.82rem; }

/* Info row (label + value pairs) */
.info-row {
  display: flex;
  gap: 8px;
  font-size: 0.875rem;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
[data-theme="minimalism"] .info-row { border-bottom: 1px solid var(--card-border); }
.info-row:last-child { border-bottom: none; }
.info-label { min-width: 160px; color: var(--text-muted); font-size: 0.8rem; font-weight: 500; }
.info-value { color: var(--text-primary); font-weight: 500; }

/* Tag/skill badges */
.skill-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent-primary);
  gap: 5px;
  margin: 2px;
}

/* Warning highlight row */
.row-warning td { background: var(--warning-light) !important; }
.row-danger  td { background: var(--danger-light) !important; }

/* Section header within cards */
.section-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title i { color: var(--accent-primary); }

/* Diff panel for audit log */
.diff-col-before { background: var(--danger-light); border-radius: var(--border-radius-sm); padding: 12px; }
.diff-col-after  { background: var(--success-light); border-radius: var(--border-radius-sm); padding: 12px; }
.diff-col-before pre, .diff-col-after pre {
  font-size: 0.72rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .view-container { padding: 16px; }
  .page-title { font-size: 1.3rem; }
  .kpi-value { font-size: 1.6rem; }
  .profile-header { flex-direction: column; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-select,
  .filter-bar .form-control { max-width: 100%; }
}

@media (max-width: 576px) {
  .login-card { padding: 28px 20px; }
  .view-container { padding: 12px; }
}

/* ================================================================
   SWAL OVERRIDES
   ================================================================ */
.swal2-popup {
  background: var(--modal-bg) !important;
  border: 1px solid var(--modal-border) !important;
  border-radius: var(--border-radius-lg) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-body) !important;
}
.swal2-title   { color: var(--text-primary) !important; font-family: var(--font-heading) !important; }
.swal2-content { color: var(--text-secondary) !important; }
.swal2-confirm { background: var(--accent-primary) !important; font-family: var(--font-body) !important; }
.swal2-cancel  { background: var(--bg-hover) !important; color: var(--text-primary) !important; font-family: var(--font-body) !important; border: 1px solid var(--card-border) !important; }
.swal2-toast   { background: var(--modal-bg) !important; border: 1px solid var(--modal-border) !important; border-radius: var(--border-radius) !important; box-shadow: var(--card-shadow) !important; }
