/* =========================================================
   Learning Plus ERP — Design System (Human-Crafted Overhaul)
   Premium Glassmorphic Topbar + Deep Navy Sidebar + High-End Cards
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  /* Sidebar */
  --sidebar-bg:        #0f172a;
  --sidebar-border:    #1e293b;
  --sidebar-text:      #94a3b8;
  --sidebar-text-hover:#e2e8f0;
  --sidebar-active-bg: #1e3a5f;
  --sidebar-active:    #60a5fa;
  --sidebar-group:     #475569;
  --sidebar-width:     256px;

  /* Topbar */
  --topbar-bg:         rgba(255, 255, 255, 0.88);
  --topbar-border:     #e2e8f0;
  --topbar-height:     64px;

  /* Content */
  --content-bg:        #f8fafc;
  --card-bg:           #ffffff;
  --card-border:       #e2e8f0;
  --card-shadow:       0 4px 20px -4px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --card-shadow-hover: 0 12px 28px -6px rgba(15, 23, 42, 0.12);

  /* Typography */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --font:           'Kalpurush', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading:   'Kalpurush', 'Plus Jakarta Sans', 'Inter', sans-serif;

  /* Accent colors */
  --blue:   #2563eb;
  --blue-dark: #1d4ed8;
  --green:  #10b981;
  --violet: #8b5cf6;
  --orange: #f59e0b;
  --teal:   #06b6d4;
  --red:    #ef4444;
  --pink:   #ec4899;

  /* Status */
  --status-active:     #10b981;
  --status-pending:    #f59e0b;
  --status-cancelled:  #ef4444;
  --status-completed:  #2563eb;
  --status-upcoming:   #94a3b8;

  /* Radius */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  /* Transition */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--content-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ─── Layout ─────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ─── Sidebar Overlay ─────────────────────────────────────── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0b132b 0%, #0f172a 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.sidebar-logo img {
  width: 40px; height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.sidebar-logo-text {
  display: flex; flex-direction: column;
}
.sidebar-logo-name {
  font-family: var(--font-heading);
  font-size: 15px; font-weight: 800;
  color: #ffffff; line-height: 1.2;
  letter-spacing: -0.2px;
}
.sidebar-logo-sub {
  font-size: 10px; color: #60a5fa;
  font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  margin-top: 2px;
}

.sidebar-nav { padding: 14px 0; flex: 1; }

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #ffffff;
  opacity: 0.92;
  padding: 16px 20px 6px;
}

.tree-group {
  margin-bottom: 3px;
}

.tree-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  margin: 3px 12px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}
.tree-toggle:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}
.tree-toggle.has-active {
  color: #ffffff;
  font-weight: 700;
}
.tree-toggle svg:first-child {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
  stroke-width: 2px;
}
.tree-toggle-arrow {
  margin-left: auto;
  width: 14px !important;
  height: 14px !important;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  opacity: 0.85;
  color: #ffffff;
  flex-shrink: 0;
}
.tree-toggle.open .tree-toggle-arrow {
  transform: rotate(90deg);
  opacity: 1;
  color: #ffffff;
}

.tree-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.tree-children.open {
  max-height: 1000px;
}
.tree-children .nav-item {
  font-size: 14.5px;
  padding: 10px 16px;
  margin: 3px 12px 3px 18px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  color: #ffffff;
  opacity: 0.92;
}
.tree-children .nav-item.active {
  border-left-color: #34d399;
  background: rgba(4, 120, 87, 0.45);
  color: #ffffff;
  font-weight: 700;
  opacity: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  margin: 3px 12px;
  color: #ffffff;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
  user-select: none;
}
.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(4, 120, 87, 0.85), rgba(5, 150, 105, 0.65));
  color: #ffffff;
  font-weight: 700;
  border: 1px solid rgba(52, 211, 153, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.nav-item svg, .nav-item .nav-icon, .nav-item i {
  color: #ffffff;
  width: 20px !important;
  height: 20px !important;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.9;
  text-align: center;
}
.nav-item.active svg, .nav-item.active .nav-icon, .nav-item.active i {
  opacity: 1;
  color: #60a5fa;
}

.tree-toggle i:not(.tree-toggle-arrow) {
  width: 18px;
  font-size: 15px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn i {
  margin-right: 6px;
  font-size: 13px;
  line-height: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 18px; text-align: center;
}

/* ─── Main Content Area ─────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop Collapse and Mobile Responsive Rules */
@media (min-width: 769px) {
  .app-wrapper.sidebar-collapsed .sidebar,
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
  .app-wrapper.sidebar-collapsed .main-area,
  .sidebar.collapsed ~ .main-area {
    margin-left: 0 !important;
    max-width: 100vw !important;
  }
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.topbar-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  font-weight: 500;
}
.topbar-breadcrumb span { color: var(--text-muted); }
.topbar-breadcrumb a:hover { color: var(--blue); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-btn {
  width: 38px; height: 38px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.topbar-btn:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }

.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid #fff;
}

.user-menu {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.user-menu:hover { border-color: var(--blue); transform: translateY(-1px); }
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.user-name { font-family: var(--font-heading); font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ─── Page Content ───────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 {
  font-family: var(--font-heading);
  font-size: 24px; font-weight: 800;
  color: var(--text-primary); line-height: 1.25;
  letter-spacing: -0.03em;
}
.page-header p {
  font-size: 14px; color: var(--text-muted); margin-top: 4px;
}
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: all var(--transition);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  text-decoration: none;
}
.stat-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-3px);
  border-color: #cbd5e1;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
}
.stat-icon.blue   { background: #eff6ff; color: var(--blue); }
.stat-icon.green  { background: #ecfdf5; color: var(--green); }
.stat-icon.violet { background: #f5f3ff; color: var(--violet); }
.stat-icon.orange { background: #fffbeb; color: var(--orange); }
.stat-icon.teal   { background: #f0fdfa; color: var(--teal); }
.stat-icon.red    { background: #fef2f2; color: var(--red); }
.stat-value {
  font-family: var(--font-heading);
  font-size: 30px; font-weight: 800;
  color: var(--text-primary); line-height: 1;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 13px; color: var(--text-muted);
  font-weight: 500;
  margin-top: 5px;
}

/* ─── Dashboard Banner ─────────────────────────────────────── */
.dashboard-banner {
  background: linear-gradient(135deg, #0b132b 0%, #1e293b 60%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.2);
  position: relative;
  overflow: hidden;
}
.dashboard-banner::after {
  content: '';
  position: absolute; right: -50px; top: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none;
}
.banner-title {
  font-family: var(--font-heading);
  font-size: 20px; font-weight: 800;
  color: #ffffff; line-height: 1.3;
  letter-spacing: -0.02em;
}
.banner-sub {
  font-size: 13.5px; color: #94a3b8;
  margin-top: 4px; font-weight: 500;
}
.banner-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 12px; font-weight: 600; color: #38bdf8;
  backdrop-filter: blur(8px);
}
.live-dot {
  width: 8px; height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.quick-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-primary);
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.quick-tile:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(37, 99, 235, 0.12);
}
.quick-tile-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: all var(--transition);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}
.card-title {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.card-body { padding: 24px; }
.card-footer {
  padding: 14px 24px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}

/* 2-column grid for cards */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ─── Data Table ─────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  width: 100% !important;
  position: relative;
}
.table-wrapper::-webkit-scrollbar {
  height: 7px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  padding: 14px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
tbody td {
  padding: 15px 20px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
.td-primary { color: var(--text-primary); font-weight: 600; }
.td-muted { color: var(--text-muted); font-size: 13px; }

/* ─── Badges / Status ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active, .badge-approved, .badge-completed, .badge-pass {
  background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0;
}
.badge-pending, .badge-upcoming, .badge-suspended { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-cancelled, .badge-rejected, .badge-fail {
  background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca;
}
.badge-scheduled { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-running   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-rescheduled { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge-missed    { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.badge-transferred { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.badge-dropped   { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }
.badge-secondary { background: #f1f5f9; color: var(--text-secondary); border: 1px solid #e2e8f0; }
.badge.no-dot::before { display: none; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  font-family: var(--font-heading);
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: 13.5px; font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.01em;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff; border: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.38);
  opacity: 0.96;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff; border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  opacity: 0.96;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff; border: none;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  opacity: 0.96;
}

.btn-outline {
  background: #ffffff; color: var(--text-secondary);
  border: 1.5px solid #cbd5e1;
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: #eff6ff; }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 12px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; border-radius: 8px; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 5px; }

/* 2-column grid for cards */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ─── Data Table ─────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
.td-primary { color: var(--text-primary); font-weight: 500; }
.td-muted { color: var(--text-muted); font-size: 13px; }

/* ─── Badges / Status ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active, .badge-approved, .badge-completed, .badge-pass {
  background: #ecfdf5; color: var(--green);
}
.badge-pending, .badge-upcoming { background: #fffbeb; color: var(--orange); }
.badge-cancelled, .badge-rejected, .badge-fail {
  background: #fef2f2; color: var(--red);
}
.badge-scheduled { background: #eff6ff; color: var(--blue); }
.badge-running   { background: #f0fdf4; color: #16a34a; }
.badge-rescheduled { background: #f5f3ff; color: var(--violet); }
.badge-missed    { background: #fff7ed; color: #c2410c; }
.badge-transferred { background: #f0fdfa; color: var(--teal); }
.badge-dropped   { background: #fdf4ff; color: var(--pink); }
.badge-secondary { background: #f1f5f9; color: var(--text-secondary); }
.badge.no-dot::before { display: none; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn-success {
  background: var(--green); color: #fff; border-color: var(--green);
}
.btn-success:hover { background: #059669; border-color: #059669; }

.btn-danger {
  background: var(--red); color: #fff; border-color: var(--red);
}
.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: transparent; color: var(--text-secondary);
  border-color: var(--card-border);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: #eff6ff; }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-icon.btn-sm { width: 26px; height: 26px; padding: 4px; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
label .required { color: var(--red); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control.is-invalid { border-color: var(--red); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }

.form-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-secondary);
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--blue);
}

/* ─── Search + Filter Bar ────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search-box {
  position: relative; flex: 1; min-width: 200px;
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-size: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: all var(--transition);
}
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.search-box .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); width: 15px; height: 15px;
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 20px;
  border-top: 1px solid var(--card-border);
}
.page-link {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.page-link:hover { border-color: var(--blue); color: var(--blue); }
.page-link.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-info { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 15px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open,
.modal-overlay.active,
.modal-overlay.show,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"],
.modal-overlay[style*="display: block"],
.modal-overlay[style*="display:block"] { opacity: 1; pointer-events: all; display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%; max-width: 520px;
  margin: 0 auto;
  max-height: calc(100vh - 60px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  transform: scale(.96) translateY(8px);
  transition: transform .2s ease;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal.modal-lg { max-width: 720px; }
.modal.modal-sm { max-width: 400px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--card-border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 28px; height: 28px;
  border: none; background: #f1f5f9;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 16px; line-height: 1;
}
.modal-close:hover { background: #e2e8f0; color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--card-border);
}

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 16px;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--card-border);
  margin-bottom: 20px;
}
.tab-item {
  padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.active { color: var(--blue); border-color: var(--blue); font-weight: 600; }

/* ─── Timeline View ─────────────────────────────────────── */
.timeline {
  display: flex; flex-direction: column; gap: 0;
}
.timeline-item {
  display: flex; gap: 16px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px; top: 32px;
  width: 2px; bottom: 0;
  background: var(--card-border);
}
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 12px; font-weight: 700;
  border: 2px solid;
  background: #fff;
}
.timeline-dot.completed { border-color: var(--green); color: var(--green); }
.timeline-dot.missed    { border-color: var(--red); color: var(--red); }
.timeline-dot.pending   { border-color: var(--card-border); color: var(--text-muted); }
.timeline-dot.cancelled { border-color: var(--orange); color: var(--orange); }
.timeline-dot.running   { border-color: var(--blue); color: var(--blue); }
.timeline-content { flex: 1; padding-bottom: 20px; }

/* ─── Module Progress ────────────────────────────────────── */
.module-list { display: flex; flex-direction: column; gap: 8px; }
.module-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.module-item:hover { border-color: #cbd5e1; background: #fff; }
.module-seq {
  width: 28px; height: 28px;
  background: var(--sidebar-bg);
  color: #fff; font-size: 11px; font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.module-info { flex: 1; }
.module-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.module-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Progress Bar ───────────────────────────────────────── */
.progress-bar-wrap {
  height: 6px; background: #e2e8f0;
  border-radius: 10px; overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transition: width .4s ease;
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ─── Dropdown ───────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  min-width: 160px; z-index: 999;
  display: none;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.card:has(.dropdown-menu.open),
.table-wrapper:has(.dropdown-menu.open),
td:has(.dropdown-menu.open) {
  overflow: visible !important;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 14px; color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}
button.dropdown-item {
  width: 100%; background: none; border: none;
  outline: none; text-align: left;
}
.dropdown-item:hover { background: #f8fafc; color: var(--text-primary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: #fef2f2; }
.dropdown-divider { border-top: 1px solid var(--card-border); margin: 4px 0; }

/* ─── Course Type Selector ───────────────────────────────── */
.type-selector {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.type-option {
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.type-option:hover { border-color: var(--blue); background: #eff6ff; }
.type-option.selected { border-color: var(--blue); background: #eff6ff; }
.type-option input { display: none; }
.type-option-icon { font-size: 24px; margin-bottom: 8px; }
.type-option-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.type-option-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Utilities ──────────────────────────────────────────── */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-blue   { color: var(--blue); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-orange { color: var(--orange); }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-sm     { font-size: 13px; }
.font-xs     { font-size: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.divider { border: none; border-top: 1px solid var(--card-border); margin: 16px 0; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 100; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 50px rgba(0,0,0,0.5); }
  .main-area { margin-left: 0 !important; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ─── Global Page Loader System ─────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-loader.active {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.loader-top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #2563eb, #6366f1, #10b981, #2563eb);
  background-size: 300% 100%;
  z-index: 100000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.loader-top-bar.active {
  opacity: 1;
  animation: loader-bar-slide 1.4s infinite linear;
}

@keyframes loader-bar-slide {
  0% { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  padding: 26px 40px;
  border-radius: 22px;
  box-shadow: 0 20px 60px -10px rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(226, 232, 240, 0.9);
  transform: scale(0.95) translateY(6px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-loader.active .loader-card {
  transform: scale(1) translateY(0);
}

.loader-spinner-container {
  position: relative;
  width: 52px; height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border: 3.5px solid #e2e8f0;
  border-top-color: #2563eb;
  border-right-color: #6366f1;
  border-radius: 50%;
  animation: loader-spin 0.8s linear infinite;
}

@keyframes loader-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-logo-static {
  width: 26px !important;
  height: 26px !important;
  max-width: 26px !important;
  max-height: 26px !important;
  object-fit: contain;
  position: relative;
  z-index: 2;
}

.loader-label {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}
