/* ============================================================
   KopdesAcademy (KAC) Web Design System
   LMS Offline-First untuk Operator Koperasi Desa Merah Putih
   Primary: #00897B | Theme: Teal Edukasi | Font: Inter
   ============================================================ */

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

/* ============================================================
   1. CSS Custom Properties — :root (Teal Edukasi)
   ============================================================ */
:root {
  /* Brand */
  --color-primary:        #00897B;
  --color-primary-hover:  #00796B;
  --color-primary-light:  color-mix(in srgb, #00897B 15%, transparent);

  /* Semantic */
  --color-success:        #16A34A;  --color-success-light: #D1FAE5;
  --color-warning:        #F59E0B;  --color-warning-light: #FEF3C7;
  --color-danger:         #EF4444;  --color-danger-light:  #FEE2E2;
  --color-info:           #3B82F6;  --color-info-light:    #DBEAFE;
  --color-purple:         #8B5CF6;  --color-purple-light:  #EDE9FE;

  /* Surface — teal-tinted light mode */
  --bg-page:     #F7FAFA;
  --bg-surface:  #EFF6F5;
  --bg-elevated: #FFFFFF;
  --bg-sidebar:  #00372F;
  --bg-hover:    #E8F4F2;
  --bg-card:     #FFFFFF;  /* alias for backwards compat — sama dengan bg-elevated */

  /* Text */
  --text-primary:   #0D2926;
  --text-secondary: #3D6B65;
  --text-muted:     #80A8A4;

  /* Border */
  --border-default: #C8E0DD;
  --border-strong:  #9FC8C4;
  --border:         #C8E0DD;  /* alias = border-default */

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,55,47,0.05);
  --shadow-sm: 0 1px 3px rgba(0,55,47,0.08);
  --shadow-md: 0 4px 12px rgba(0,55,47,0.10);
  --shadow-lg: 0 8px 24px rgba(0,55,47,0.14);

  /* Layout */
  --header-height: 60px;
  --sidebar-width: 240px;

  /* Z-index — urutan wajib */
  --z-sidebar:       100;
  --z-dropdown:      150;
  --z-modal:         200;
  --z-modal-content: 201;
  --z-toast:         500;

  /* Radius */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   12px;
  --radius-full: 9999px;

  /* Transition */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

[data-theme="dark"] {
  --bg-page:        #0D1F1D;
  --bg-surface:     #162522;
  --bg-elevated:    #1E3330;
  --bg-sidebar:     #0B1917;
  --bg-hover:       #1E3330;
  --bg-card:        #1E3330;  /* alias = bg-elevated */
  --text-primary:   #E8F4F2;
  --text-secondary: #80A8A4;
  --text-muted:     #4D7570;
  --border-default: rgba(0,137,123,0.15);
  --border-strong:  rgba(0,137,123,0.25);
  --border:         rgba(0,137,123,0.15);  /* alias = border-default */
}

/* ============================================================
   2. CSS Reset
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

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

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
}

/* ============================================================
   3. Layout & App Shell
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: width var(--transition-base);
  border-right: 1px solid var(--border-default);
  position: relative;
  z-index: var(--z-sidebar);
}
.app-sidebar.collapsed { width: 60px; }

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.app-header {
  height: var(--header-height);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-page);
}

@media (max-width: 640px) {
  .app-content { padding: 16px; }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.open { display: block; }

/* ============================================================
   4. Sidebar Components
   ============================================================ */
.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  /* TANPA border-bottom */
}

.brand-logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.brand-info { flex: 1; min-width: 0; }
.brand-name { font-size: 14px; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 8px 0;
}

.nav-section { margin-bottom: 4px; }

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
  display: block;
}

.nav-section-divider {
  display: none;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  border-radius: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
}
.nav-item.active .nav-icon { color: var(--color-primary); }

.nav-icon  { width: 18px; flex-shrink: 0; text-align: center; }
.nav-label { flex: 1; }
.nav-arrow { font-size: 11px; transition: transform var(--transition-fast); }
.nav-item.open > .nav-arrow { transform: rotate(90deg); }

.nav-badge {
  font-size: 11px;
  background: var(--color-danger);
  color: white;
  border-radius: var(--radius-full);
  padding: 1px 6px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  padding: 6px 16px 6px 44px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.nav-sub-item:hover { color: white; }
.nav-sub-item.active { color: var(--color-primary); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

.btn-logout {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.btn-logout:hover { color: var(--color-danger); }

/* ============================================================
   Collapsed sidebar — canonical rules
   ============================================================ */

/* Width target */
.app-sidebar.collapsed { width: 60px; }

/* Sembunyikan semua label/badge/arrow/info — hanya ikon tampil */
.app-sidebar.collapsed .brand-info,
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .nav-arrow,
.app-sidebar.collapsed .nav-badge,
.app-sidebar.collapsed .nav-section-label,
.app-sidebar.collapsed .user-info,
.app-sidebar.collapsed .btn-logout { display: none !important; }

/* Brand: pusatkan logo, hilangkan gap */
.app-sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
  gap: 0;
}

/* Nav section divider tetap tampil sebagai separator antar grup */
.app-sidebar.collapsed .nav-section { margin-bottom: 4px; }
.app-sidebar.collapsed .nav-section-divider {
  display: block;
  margin: 6px 12px;
}

/* Nav item: pusatkan ikon, padding seragam, border-left aktif berubah jadi bar penuh */
.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  gap: 0;
  border-left: none;
  position: relative;
}
.app-sidebar.collapsed .nav-icon {
  width: auto;
  font-size: 16px;
}

/* Active state collapsed: bar kiri 3px tetap, background highlight */
.app-sidebar.collapsed .nav-item.active {
  border-left: 3px solid var(--color-primary);
  background: var(--color-primary-light);
}

/* Sub-item collapsed: hide (tidak ada konteks tanpa label parent) */
.app-sidebar.collapsed .nav-sub-item { display: none; }

/* Footer: pusatkan avatar saja */
.app-sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 12px 0;
  gap: 0;
}

/* Saat collapsed: kedua container overflow visible supaya tooltip ::after escape ke kanan */
.app-sidebar.collapsed { overflow: visible; }
.app-sidebar.collapsed .sidebar-nav { overflow: visible; }
/* Tooltip butuh stacking context tinggi supaya tidak ditutup .app-main */
.app-sidebar.collapsed { z-index: 1000; }

/* Tooltip CSS-only — muncul saat hover nav-item collapsed */
.app-sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
}
.app-sidebar.collapsed .nav-item:hover::after { opacity: 1; }

/* Toggle button icon rotation saat collapsed (opsional visual feedback) */
.app-sidebar.collapsed ~ .app-main [data-sidebar-toggle] i {
  transform: rotate(180deg);
  transition: transform var(--transition-base);
}
[data-sidebar-toggle] i { transition: transform var(--transition-base); }

/* ============================================================
   5. Header Bar
   ============================================================ */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.breadcrumb-sep     { color: var(--text-muted); }
.breadcrumb-current { font-weight: 600; color: var(--text-primary); }

.header-sync { font-size: 12px; color: var(--text-muted); }

.bell-wrapper { position: relative; }
.bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bg-surface);
}

/* ============================================================
   6. Buttons (explicit height — DILARANG via padding)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}
.btn:hover   { filter: brightness(0.92); }
.btn:active  { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-xs { height: 24px; padding: 0 8px;  font-size: 11px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 16px; }
.btn-xl { height: 52px; padding: 0 24px; font-size: 16px; }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.btn-xs { width: 24px; height: 24px; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-icon.btn-lg { width: 44px; height: 44px; }

.btn-primary   { background: var(--color-primary); color: white; }
.btn-secondary { background: transparent; border: 1px solid var(--border-default); color: var(--text-primary); }
.btn-outline   { background: transparent; border: 1px solid var(--color-primary); color: var(--color-primary); }
.btn-ghost     { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger    { background: var(--color-danger); color: white; }
.btn-danger-outline { background: transparent; border: 1px solid var(--color-danger); color: var(--color-danger); }
.btn-success   { background: var(--color-success); color: white; }
.btn-link      { background: transparent; color: var(--color-primary); padding: 0; height: auto; text-decoration: underline; }
.btn-teal      { background: var(--color-primary); color: white; }

/* Loading state */
.btn.loading { position: relative; color: transparent; pointer-events: none; }
.btn.loading::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-secondary.loading::after,
.btn-ghost.loading::after,
.btn-outline.loading::after {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--text-primary);
}

/* ============================================================
   7. Cards
   ============================================================ */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
}
.card-header-actions { display: flex; gap: 8px; align-items: center; }

.card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.card-sub   { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.card-body   { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-default);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Stat Card — CANONICAL .stat-card */
.stat-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  border-top: 3px solid transparent;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-primary { border-top-color: var(--color-primary); }
.stat-success { border-top-color: var(--color-success); }
.stat-warning { border-top-color: var(--color-warning); }
.stat-danger  { border-top-color: var(--color-danger);  }
.stat-info    { border-top-color: var(--color-info);    }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-body  { flex: 1; min-width: 0; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-trend { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.trend-up   { color: var(--color-success); }
.trend-down { color: var(--color-danger);  }
.trend-flat { color: var(--text-muted);    }

/* Domain cards */
.course-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
  cursor: pointer;
}
.course-card:hover { box-shadow: var(--shadow-md); }
.course-card-thumb {
  height: 140px;
  background: var(--color-primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  color: var(--color-primary);
}
.course-card-body { padding: 16px; }
.course-card-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.course-card-meta  { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; margin-bottom: 10px; }
.course-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

.certificate-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border-radius: var(--radius-xl);
  padding: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}
.certificate-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.certificate-card-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.certificate-card-sub   { font-size: 13px; opacity: 0.8; }
.certificate-card-meta  { margin-top: 16px; font-size: 12px; opacity: 0.7; }

.batch-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-info-light);
  color: var(--color-info);
  border: 1px solid rgba(59,130,246,0.2);
}

.completion-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.completion-ring svg { transform: rotate(-90deg); }
.completion-ring-text {
  position: absolute;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.module-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}
.module-type-badge.type-text  { background: var(--color-info-light); color: var(--color-info); }
.module-type-badge.type-video { background: var(--color-danger-light); color: var(--color-danger); }
.module-type-badge.type-quiz  { background: var(--color-warning-light); color: #92400E; }

/* ============================================================
   8. Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: #92400E; }
.badge-danger  { background: var(--color-danger-light);  color: var(--color-danger);  }
.badge-info    { background: var(--color-info-light);    color: var(--color-info);    }
.badge-purple  { background: var(--color-purple-light);  color: var(--color-purple);  }
.badge-gray    { background: var(--bg-elevated);         color: var(--text-muted);    }

.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Role badges */
.badge-role-admin      { background: #FEE2E2; color: #991B1B; }
.badge-role-instruktur { background: #DBEAFE; color: #1E40AF; }
.badge-role-peserta    { background: #D1FAE5; color: #065F46; }
.badge-role-manager    { background: #DBEAFE; color: #1E40AF; }
.badge-role-user       { background: #D1FAE5; color: #065F46; }

/* Status badges */
.badge-status-aktif     { background: var(--color-success-light); color: var(--color-success); }
.badge-status-selesai   { background: var(--color-info-light); color: var(--color-info); }
.badge-status-pending   { background: var(--color-warning-light); color: #92400E; }
.badge-status-nonaktif  { background: var(--bg-elevated); color: var(--text-muted); }
.badge-status-lulus     { background: #D1FAE5; color: #065F46; }
.badge-status-tidak-lulus { background: var(--color-danger-light); color: var(--color-danger); }

/* ============================================================
   9. Icon Color Helpers
   ============================================================ */
.icon-primary { background: var(--color-primary-light); color: var(--color-primary); }
.icon-success { background: var(--color-success-light); color: var(--color-success); }
.icon-warning { background: var(--color-warning-light); color: var(--color-warning); }
.icon-danger  { background: var(--color-danger-light);  color: var(--color-danger);  }
.icon-info    { background: var(--color-info-light);    color: var(--color-info);    }
.icon-muted   { background: var(--bg-elevated);         color: var(--text-muted);    }

[data-theme="dark"] .icon-success { background: rgba(22,163,74,0.15);  color: #34D399; }
[data-theme="dark"] .icon-warning { background: rgba(245,158,11,0.15); color: #FCD34D; }
[data-theme="dark"] .icon-danger  { background: rgba(239,68,68,0.15);  color: #FCA5A5; }
[data-theme="dark"] .icon-info    { background: rgba(59,130,246,0.15); color: #93C5FD; }
[data-theme="dark"] .icon-primary { background: var(--color-primary-light); }

/* ============================================================
   10. Avatar
   ============================================================ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ============================================================
   11. Page Header
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.page-sub   { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.btn-back:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .page-header { flex-direction: column; gap: 12px; }
  .page-header-actions { width: 100%; justify-content: flex-end; }
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--bg-surface);
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr.selected { background: var(--color-primary-light); }

.col-no     { width: 48px; text-align: center; }
.col-action { width: 80px; }
.sortable   { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text-primary); }
.sort-icon  { font-size: 10px; color: var(--text-muted); margin-left: 4px; }

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.table-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.empty-row td { padding: 0; border: none; }
.table-empty  { text-align: center; padding: 48px 24px; }
.table-empty-icon  { font-size: 36px; color: var(--text-muted); margin-bottom: 12px; }
.table-empty-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.table-empty-sub   { font-size: 13px; color: var(--text-muted); }

/* Pagination — CANONICAL .pagination-btn */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 32px;
  padding: 0 6px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.pagination-btn:hover   { background: var(--bg-elevated); }
.pagination-btn.active  { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.pagination-ellipsis    { padding: 0 6px; color: var(--text-muted); }
.pagination-info { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   13. Forms
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-label .required { color: var(--color-danger); margin-left: 2px; }

.form-control {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-control.error { border-color: var(--color-danger); }
.form-control:disabled { opacity: 0.5; background: var(--bg-surface); cursor: not-allowed; }
.form-control-lg { height: 44px; font-size: 15px; }

textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; }

.form-select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 36px 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394A3B8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.form-select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); outline: none; }
.form-select-sm { height: 30px; font-size: 13px; }

.form-error { font-size: 12px; color: var(--color-danger); }
.form-hint  { font-size: 12px; color: var(--text-muted); }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-label { font-size: 14px; cursor: pointer; }

.form-row   { display: flex; gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

@media (max-width: 640px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

.input-group { display: flex; position: relative; align-items: center; }
.input-prefix {
  position: absolute; left: 12px;
  color: var(--text-muted); font-size: 14px;
  pointer-events: none;
}
.input-suffix {
  position: absolute; right: 12px;
  color: var(--text-muted); font-size: 14px;
}
.input-group .form-control { padding-left: 36px; }
.input-group .form-control.has-suffix { padding-right: 36px; }

.search-box { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute; left: 10px;
  color: var(--text-muted); font-size: 13px;
  pointer-events: none;
}
.search-box .form-control { padding-left: 32px; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 12px;
  transition: background var(--transition-base);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   14. Modal (z-index WAJIB > sidebar)
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal {
  position: relative;
  z-index: var(--z-modal-content);
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  max-width: 560px;
  animation: modal-in 0.2s ease;
}
.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-close { color: var(--text-muted); }
.modal-close:hover { color: var(--text-primary); }

.modal-body   { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-default);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 95vh; }
}

/* ============================================================
   15. Dropdown
   ============================================================ */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
}
.dropdown-menu.open { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  width: 100%;
  white-space: nowrap;
  background: transparent;
  border: none;
  text-align: left;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.text-danger { color: var(--color-danger); }

.dropdown-header {
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border-default);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-default);
  margin: 4px 0;
}

/* ============================================================
   16. Toast
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: calc(100vw - 48px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  border-left: 4px solid transparent;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
}
.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger);  }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info    { border-left-color: var(--color-info);    }

.toast-icon    { flex-shrink: 0; font-size: 16px; margin-top: 1px; }
.toast-body    { flex: 1; min-width: 0; }
.toast-title   { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.toast-message { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.toast-close   { color: var(--text-muted); margin-left: auto; flex-shrink: 0; }
.toast-close:hover { color: var(--text-primary); }

/* ============================================================
   17. Tabs
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 20px;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab-item:hover  { color: var(--text-primary); }
.tab-item.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 500; }

.tab-count {
  font-size: 11px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  margin-left: 4px;
  color: var(--text-muted);
}
.tab-item.active .tab-count { background: var(--color-primary-light); color: var(--color-primary); }

.tab-content { }
.tab-pane         { display: none; }
.tab-pane.active  { display: block; }

/* ============================================================
   18. Alerts
   ============================================================ */
.alert {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border-left: 4px solid transparent;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.alert-icon  { flex-shrink: 0; margin-top: 1px; }
.alert-body  { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.alert-info    { background: var(--color-info-light);    border-left-color: var(--color-info);    color: #1E40AF; }
.alert-success { background: var(--color-success-light); border-left-color: var(--color-success); color: #065F46; }
.alert-warning { background: var(--color-warning-light); border-left-color: var(--color-warning); color: #92400E; }
.alert-danger  { background: var(--color-danger-light);  border-left-color: var(--color-danger);  color: #991B1B; }

/* ============================================================
   19. Progress Bar
   ============================================================ */
.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  /* width diset via JS: el.style.width = pct + '%' */
}
.progress-fill.success { background: var(--color-success); }
.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger  { background: var(--color-danger);  }

/* Larger progress bar variant */
.progress-bar-lg {
  height: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

/* Quiz styling */
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  margin-bottom: 10px;
}
.quiz-option:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.quiz-option.selected { border-color: var(--color-primary); background: var(--color-primary-light); }
.quiz-option.correct { border-color: var(--color-success); background: var(--color-success-light); }
.quiz-option.incorrect { border-color: var(--color-danger); background: var(--color-danger-light); }
.quiz-option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.quiz-option.selected .quiz-option-letter { background: var(--color-primary); color: white; }
.quiz-option.correct .quiz-option-letter  { background: var(--color-success); color: white; }
.quiz-option.incorrect .quiz-option-letter { background: var(--color-danger); color: white; }
.quiz-option-text { flex: 1; font-size: 14px; padding-top: 4px; }

.quiz-header { margin-bottom: 24px; }
.quiz-question-num { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.quiz-question-text { font-size: 16px; font-weight: 600; line-height: 1.5; }

/* Video player embed */
.video-player-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
}
.video-player-wrap iframe,
.video-player-wrap video {
  width: 100%; height: 100%;
  display: block;
}
.video-overlay-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.video-overlay-play:hover { background: rgba(0,0,0,0.15); }
.video-play-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* Module content area */
.module-content {
  max-width: 760px;
  margin: 0 auto;
}
.module-content h2 { font-size: 20px; font-weight: 700; margin: 24px 0 12px; }
.module-content h3 { font-size: 17px; font-weight: 600; margin: 20px 0 10px; }
.module-content p  { line-height: 1.7; margin-bottom: 14px; color: var(--text-secondary); }
.module-content ul, .module-content ol { padding-left: 20px; margin-bottom: 14px; }
.module-content li { line-height: 1.7; color: var(--text-secondary); margin-bottom: 4px; }
.module-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 12px 16px;
  background: var(--color-primary-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 16px 0;
  font-style: italic;
  color: var(--text-secondary);
}

/* ============================================================
   20. Empty State, Skeleton, Timeline, Filter Bar
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-icon  { font-size: 48px; color: var(--text-muted); margin-bottom: 16px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-sub   { font-size: 14px; color: var(--text-muted); }

/* Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text   { height: 14px; border-radius: var(--radius-sm); }
.skeleton-title  { height: 20px; width: 60%; border-radius: var(--radius-sm); }
.skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border-default);
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
}
.timeline-dot {
  position: absolute;
  left: -21px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  top: 2px;
}
.timeline-dot.active { background: var(--color-primary); border-color: var(--color-primary); }
.timeline-content { }
.timeline-title   { font-weight: 600; font-size: 14px; }
.timeline-time    { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--bg-surface);
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.filter-chip:hover  { background: var(--bg-elevated); }
.filter-chip.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* Chart container */
.chart-container { position: relative; width: 100%; }

/* ============================================================
   21. Interactive States
   ============================================================ */
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.nav-item:focus-visible,
.tab-item:focus-visible,
.pagination-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

table tbody tr.selected { background: var(--color-primary-light); }

.btn:disabled,
.form-control:disabled,
.form-select:disabled,
.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   22. Animations & Keyframes
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade   { animation: fade-in 0.2s ease; }
.animate-spin   { animation: spin 1s linear infinite; }
.animate-pulse  { animation: pulse 2s ease-in-out infinite; }

/* ============================================================
   23. Scrollbar
   ============================================================ */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ============================================================
   24. Utility Classes
   ============================================================ */
/* Flex & Grid */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.flex-1        { flex: 1; }
.flex-wrap     { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.grid         { display: grid; gap: 20px; }
.grid-cols-2  { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3  { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4  { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* Spacing */
.gap-1 { gap: 4px;  } .gap-2 { gap: 8px;  } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }

.mt-1 { margin-top: 4px;  } .mt-2 { margin-top: 8px;  } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px;  } .mb-2 { margin-bottom: 8px;  } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

.p-2 { padding: 8px;  } .p-3 { padding: 12px; }
.p-4 { padding: 16px; } .p-5 { padding: 20px; } .p-6 { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

/* Typography */
.text-xs   { font-size: 11px; } .text-sm   { font-size: 12px; }
.text-base { font-size: 14px; } .text-lg   { font-size: 16px; }
.text-xl   { font-size: 18px; } .text-2xl  { font-size: 20px; }
.text-3xl  { font-size: 24px; }

.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.text-primary   { color: var(--text-primary);   }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted);     }
.text-success   { color: var(--color-success);  }
.text-warning   { color: var(--color-warning);  }
.text-danger    { color: var(--color-danger);   }
.text-center { text-align: center; }
.text-right  { text-align: right;  }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase   { text-transform: uppercase; }
.capitalize  { text-transform: capitalize; }
.link        { color: var(--color-primary); cursor: pointer; }
.link:hover  { text-decoration: underline; }

/* Visual */
.w-full  { width: 100%;  }
.h-full  { height: 100%; }
.min-w-0 { min-width: 0; }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.border        { border: 1px solid var(--border-default); }
.border-top    { border-top: 1px solid var(--border-default); }
.border-bottom { border-bottom: 1px solid var(--border-default); }

.bg-surface { background: var(--bg-surface); }
.bg-page    { background: var(--bg-page);    }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.overflow-hidden { overflow: hidden; }
.hidden  { display: none; }
.block   { display: block; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ============================================================
   25. Auth Pages (Login / Register) — No Sidebar
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  padding: 40px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-xl);
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 24px; font-weight: 800;
  margin: 0 auto 12px;
}
.auth-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-sub   { font-size: 14px; color: var(--text-muted); text-align: center; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--text-muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-default);
}
.auth-footer { text-align: center; margin-top: 24px; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--color-primary); }

/* ============================================================
   26. Landing Page
   ============================================================ */
.landing-page { background: var(--bg-page); }
.landing-nav {
  position: sticky; top: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 0 40px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  z-index: var(--z-dropdown);
}
.landing-nav-brand { display: flex; align-items: center; gap: 12px; }
.landing-nav-links { display: flex; align-items: center; gap: 24px; }
.landing-nav-links a { font-size: 14px; color: var(--text-secondary); transition: color var(--transition-fast); }
.landing-nav-links a:hover { color: var(--color-primary); }

.hero-section {
  padding: 80px 40px;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-page) 0%, var(--bg-surface) 100%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 4px 14px; font-size: 13px; font-weight: 600;
  margin-bottom: 20px;
}
.hero-title { font-size: 40px; font-weight: 800; line-height: 1.2; margin-bottom: 16px; max-width: 720px; margin-left: auto; margin-right: auto; }
.hero-sub   { font-size: 18px; color: var(--text-secondary); max-width: 560px; margin: 0 auto 32px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 40px; justify-content: center;
  margin-top: 60px; padding-top: 40px;
  border-top: 1px solid var(--border-default);
  flex-wrap: wrap;
}
.hero-stat-value { font-size: 28px; font-weight: 800; color: var(--color-primary); }
.hero-stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.features-section { padding: 80px 40px; }
.section-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--color-primary); margin-bottom: 8px; }
.section-title { font-size: 30px; font-weight: 700; margin-bottom: 12px; }
.section-sub   { font-size: 16px; color: var(--text-secondary); max-width: 520px; line-height: 1.6; }

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: box-shadow var(--transition-fast);
}
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}
.feature-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-desc  { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.cta-section {
  padding: 80px 40px;
  text-align: center;
  background: var(--color-primary);
  color: white;
}
.cta-title { font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.cta-sub   { font-size: 16px; opacity: 0.85; max-width: 480px; margin: 0 auto 32px; }

.landing-footer {
  padding: 40px;
  border-top: 1px solid var(--border-default);
  text-align: center;
  font-size: 13px; color: var(--text-muted);
}

/* ============================================================
   27. Certificate Display
   ============================================================ */
.cert-display {
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cert-display::before {
  content: '';
  position: absolute; inset: 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  pointer-events: none;
}
.cert-header { margin-bottom: 24px; }
.cert-logo   { width: 56px; height: 56px; margin: 0 auto 12px; }
.cert-issuer { font-size: 13px; color: var(--text-muted); }
.cert-body   { margin: 24px 0; }
.cert-given  { font-size: 14px; color: var(--text-muted); margin-bottom: 6px; }
.cert-name   { font-size: 28px; font-weight: 700; color: var(--color-primary); margin-bottom: 8px; }
.cert-course { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.cert-date   { font-size: 13px; color: var(--text-muted); }
.cert-footer { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-default); }
.cert-id     { font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }
.cert-verify { margin-top: 8px; }

/* Public verify page */
.verify-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: 24px;
}
.verify-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.verify-header {
  padding: 24px;
  background: var(--color-primary);
  color: white;
  text-align: center;
}
.verify-body { padding: 32px; }
.verify-result {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
.verify-result.valid   { background: var(--color-success-light); border: 1px solid rgba(22,163,74,0.3); }
.verify-result.invalid { background: var(--color-danger-light);  border: 1px solid rgba(239,68,68,0.3); }

/* ============================================================
   28. Storage / Offline UI
   ============================================================ */
.storage-bar-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  height: 12px;
  overflow: hidden;
  margin: 8px 0;
}
.storage-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width 0.4s ease;
}
.storage-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-default);
}
.storage-item:last-child { border-bottom: none; }

/* ============================================================
   29. Sidebar Persona-Specific
   ============================================================ */
/* Peserta sidebar (minimal) — no special overrides needed */
/* Instruktur + Admin sidebar — full sidebar, default */
