/* ============================================================
   فينكس - Academy Management System
   Modern SaaS Design System
   ============================================================ */

:root {
  --brand: #e63946;
  --brand-rgb: 230, 57, 70;
  --brand-soft: rgba(230, 57, 70, 0.08);
  --brand-hover: #c1121f;
  --brand-light: #fff1f2;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active-bg: rgba(230, 57, 70, 0.15);
  --sidebar-active-text: #f8fafc;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-brand: #f8fafc;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.08);
  --warning: #ea580c;
  --warning-soft: rgba(234, 88, 12, 0.08);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.08);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --navy: #0B2D5C;
  --gold: #F7941D;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --surface: #131825;
  --surface-2: #1a2035;
  --surface-3: #222840;
  --border: #1e293b;
  --border-light: #1a2035;
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --sidebar-bg: #080c14;
  --sidebar-text: #64748b;
  --sidebar-hover: rgba(255, 255, 255, 0.04);
  --brand-light: rgba(230, 57, 70, 0.1);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
  font-family: 'Noto Kufi Arabic', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-hover); }

::selection {
  background: rgba(230, 57, 70, 0.15);
  color: var(--text);
}

/* ====================== LAYOUT ====================== */
.app { display: flex; min-height: 100vh; }

/* ====================== SIDEBAR ====================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  color: var(--sidebar-brand);
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  letter-spacing: -0.01em;
}
.brand .logo {
  width: 38px; height: 38px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(230,57,70,.2), rgba(239,68,68,.1));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.brand .logo img { width: 38px; height: 38px; border-radius: var(--radius); }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-group-title {
  padding: 20px 22px 8px;
  font-size: 0.65rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.5);
  font-weight: 700;
}
.nav-item { display: block; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 22px;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: all var(--transition);
  margin: 1px 10px;
  border-radius: 0 var(--radius) var(--radius) 0;
  border-inline-start: none;
}
[dir="rtl"] .nav-link { border-radius: var(--radius) 0 0 var(--radius); }
.nav-link i {
  font-size: 1.05rem; width: 22px; text-align: center; opacity: 1;
  transition: opacity var(--transition);
}
.nav-link:hover {
  color: #e2e8f0;
  background: var(--sidebar-hover);
}
.nav-link:hover i { opacity: 1; }
.nav-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
  font-weight: 600;
  border-inline-start: none;
}
.nav-link.active i { opacity: 1; color: var(--brand); }

/* ====================== MAIN AREA ====================== */
.main {
  flex: 1;
  margin-inline-start: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* ====================== TOPBAR ====================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar .page-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.topbar .spacer { flex: 1; }

.topbar-btn {
  width: 40px; height: 40px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  position: relative; cursor: pointer;
  transition: all var(--transition);
}
.topbar-btn:hover {
  color: var(--brand);
  border-color: rgba(230, 57, 70, 0.3);
  background: var(--brand-soft);
}
.badge-dot {
  position: absolute; top: -5px; inset-inline-end: -5px;
  background: var(--brand); color: #fff;
  border-radius: 10px; min-width: 20px; height: 20px;
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--surface);
  line-height: 1;
}

/* ====================== CONTENT ====================== */
.content {
  padding: 28px;
  flex: 1;
  animation: fadeInUp 0.3s ease-out;
}

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

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.page-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-head h1 {
  font-size: 1.4rem; margin: 0; font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-head .desc { color: var(--text-3); font-size: 0.85rem; margin-top: 2px; }
.page-head .spacer { flex: 1; }

.footer-bar {
  padding: 16px 28px;
  color: var(--text-3);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ====================== CARDS ====================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-body { padding: 22px; }
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
}
.card-title { font-size: 0.95rem; margin: 0; font-weight: 600; }
.card-tools { margin-inline-start: auto; display: flex; gap: 8px; }

/* ====================== STAT CARDS ====================== */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: 0;
  width: 4px; height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--stat-accent, var(--brand));
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.stat-card:hover::before { opacity: 1; }
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-value {
  font-size: 1.6rem; font-weight: 800; line-height: 1.2;
  letter-spacing: -0.02em;
}
.stat-label { color: var(--text-2); font-size: 0.82rem; font-weight: 500; }
.stat-sub { font-size: 0.75rem; color: var(--text-3); margin-top: 4px; font-weight: 500; }

/* ====================== TABLES ====================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: start;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 0.87rem;
  transition: background var(--transition);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.selectable-row { cursor: pointer; }
.table tbody tr.row-selected, .table tbody tr.row-selected:hover { background: rgba(var(--brand-rgb), 0.08); }

/* ====================== BADGES ====================== */
.badge-soft {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.73rem; font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-soft-success { background: var(--success-soft); color: var(--success); }
.badge-soft-warning { background: var(--warning-soft); color: var(--warning); }
.badge-soft-danger { background: var(--danger-soft); color: var(--danger); }
.badge-soft-info { background: var(--info-soft); color: var(--info); }
.badge-soft-secondary { background: rgba(100, 116, 139, 0.1); color: var(--text-2); }
.badge-soft-brand { background: var(--brand-soft); color: var(--brand); }

/* ====================== FORMS ====================== */
.form-label {
  font-size: 0.82rem; font-weight: 600; margin-bottom: 6px;
  color: var(--text); display: block;
}
.form-control, .form-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 0.88rem;
  width: 100%;
  transition: all var(--transition);
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.1);
  outline: none;
  color: var(--text);
  background: var(--surface);
}
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-hint { font-size: 0.75rem; color: var(--text-3); margin-top: 4px; }
.input-group .form-control { border-radius: 0; }
.input-group-text {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-3);
  font-size: 0.9rem;
}

/* ====================== BUTTONS ====================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid transparent; border-radius: var(--radius);
  padding: 9px 18px; font-size: 0.87rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition); text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 1px 3px rgba(230, 57, 70, 0.3);
}
.btn-primary:hover {
  background: var(--brand-hover); color: #fff;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.35);
  transform: translateY(-1px);
}
.btn-primary .bi,
.btn-primary i { color: inherit; }
.btn-outline {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  color: var(--brand); border-color: var(--brand);
  background: var(--brand-soft);
}
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3); }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3); }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-light {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
.btn-light:hover { background: var(--surface-3); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 0.92rem; border-radius: var(--radius); }
.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}
.btn-icon i { font-size: 1rem; }
.btn-icon.btn-outline { border-color: var(--border); color: var(--text-2); }
.btn-icon.btn-outline:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.btn-icon.btn-outline.text-danger { color: var(--danger); }
.btn-icon.btn-outline.text-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ====================== ALERTS ====================== */
.alert {
  border-radius: var(--radius-lg); padding: 14px 18px; margin-bottom: 18px;
  font-size: 0.87rem; display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid transparent;
  animation: fadeIn 0.2s ease-out;
}
.alert-success { background: var(--success-soft); border-color: rgba(22,163,74,0.2); color: var(--success); }
.alert-danger { background: var(--danger-soft); border-color: rgba(220,38,38,0.2); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: rgba(234,88,12,0.2); color: var(--warning); }
.alert-info { background: var(--info-soft); border-color: rgba(2,132,199,0.2); color: var(--info); }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }

/* ====================== PAGINATION ====================== */
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 16px 0 0; }
.page-link {
  display: flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-2); font-size: 0.82rem; font-weight: 500;
  background: var(--surface);
  transition: all var(--transition);
}
.page-link:hover {
  color: var(--brand); border-color: rgba(230,57,70,0.3);
  background: var(--brand-soft);
}
.page-item.active .page-link {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 3px rgba(230,57,70,0.3);
}
.page-item.disabled .page-link { opacity: 0.4; pointer-events: none; }

/* ====================== AVATAR ====================== */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.72rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.6rem; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .un { font-weight: 600; color: var(--text); }
.user-cell .ud { font-size: 0.75rem; color: var(--text-3); }

/* ====================== MODALS / DROPDOWNS ====================== */
.modal {
  display: none; position: fixed; inset: 0; z-index: 2000;
  align-items: center; justify-content: center;
}
.modal.is-active { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
.modal-panel {
  position: relative; z-index: 1; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); width: 90%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-light); padding: 20px 24px;
}
.modal-head h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.modal-x {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 4px; border-radius: 6px; line-height: 1; font-size: 1.1rem;
  transition: color .15s, background .15s;
}
.modal-x:hover { color: var(--text); background: var(--surface-2); }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid var(--border-light); padding: 16px 24px;
}
.modal-content {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}
.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 20px 24px;
}
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border-light); padding: 16px 24px; }
.dropdown-menu {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  color: var(--text); padding: 6px;
  animation: scaleIn 0.15s ease-out;
}
.dropdown-item {
  color: var(--text); font-size: 0.86rem; font-weight: 500;
  padding: 8px 14px; border-radius: 8px;
  transition: all var(--transition);
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-divider { border-color: var(--border-light); margin: 4px 0; }
.notif-item { padding: 12px 14px; font-size: 0.84rem; }
.notif-item .t { font-weight: 600; }

/* ====================== UTILITIES ====================== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 24px; }
.m-0 { margin: 0; }
.p-0 { padding: 0; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.text-center { text-align: center; }
.text-end { text-align: end; }
.text-muted { color: var(--text-2) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-brand { color: var(--brand) !important; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fs-sm { font-size: 0.8rem; }
.fs-lg { font-size: 1.1rem; }
.w-100 { width: 100%; }
.flex-1 { flex: 1; }
.opacity-75 { opacity: 0.75; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ====================== TABS ====================== */
.nav-tabs {
  border-bottom: 1px solid var(--border);
  display: flex; gap: 2px; overflow-x: auto;
}
.nav-tabs .tab-link {
  padding: 12px 18px; font-size: 0.86rem; font-weight: 600;
  color: var(--text-3); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all var(--transition);
}
.nav-tabs .tab-link:hover { color: var(--brand); }
.nav-tabs .tab-link.active { color: var(--brand); border-bottom-color: var(--brand); }

.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs .tab {
  padding: 10px 18px; font-size: 0.86rem; font-weight: 600;
  color: var(--text-3); border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.tabs .tab:hover { color: var(--brand); }
.tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ====================== FILTER BAR ====================== */
.filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.filter-bar .field { min-width: 170px; flex: 1; }

/* ====================== EMPTY STATE ====================== */
.empty-state {
  text-align: center; padding: 50px 24px; color: var(--text-3);
}
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 14px; display: block; }

/* ====================== TIMELINE ====================== */
.timeline { position: relative; padding-inline-start: 22px; }
.timeline::before {
  content: ""; position: absolute; inset-inline-start: 6px;
  top: 4px; bottom: 4px; width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 0 0 16px 12px; }
.tl-item::before {
  content: ""; position: absolute; inset-inline-start: -19px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--surface);
}
.tl-time { font-size: 0.72rem; color: var(--text-3); }

/* ====================== PROGRESS ====================== */
.progress {
  height: 8px; background: var(--surface-2);
  border-radius: 20px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--brand); border-radius: 20px;
  transition: width 0.6s ease;
}

/* ====================== CHARTS ====================== */
.chart-box { position: relative; height: 300px; }

/* ====================== AUTH / USER MENU ====================== */
.user-menu-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.user-menu-role { font-size: 0.72rem; color: var(--text-3); }

/* ====================== MISC ====================== */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.required::after { content: " *"; color: var(--danger); }
pre.json-view {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 14px; border-radius: var(--radius);
  font-size: 0.78rem; max-height: 200px; overflow: auto;
}
.small { font-size: 0.8rem; }
.border-bottom { border-bottom: 1px solid var(--border); }

/* ====================== LOGIN / AUTH ====================== */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1a2744 50%, #27407a 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,39,68,0.18) 0%, transparent 70%);
  top: -200px; right: -200px;
}
.auth-wrap::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,39,68,0.12) 0%, transparent 70%);
  bottom: -100px; left: -100px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  padding: 40px;
  position: relative;
  z-index: 1;
  animation: scaleIn 0.3s ease-out;
}
.auth-logo {
  width: 100px; height: 100px; border-radius: 24px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, rgba(26,39,68,0.08), rgba(39,64,122,0.05));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(26, 39, 68, 0.12);
  border: 1px solid rgba(26, 39, 68, 0.1);
}
.auth-logo img { width: 76px; height: 76px; }
.auth-title {
  text-align: center; font-weight: 800; font-size: 1.4rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), var(--text-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-sub {
  text-align: center; color: var(--text-3);
  font-size: 0.88rem; margin-bottom: 28px; line-height: 1.6;
}

/* ====================== PUBLIC SITE ====================== */
.public-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
}
[data-theme="dark"] .public-nav { background: rgba(19,24,37,0.9); }
.public-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1a2744 45%, #20315c 70%, #27407a 100%);
  color: #fff; padding: 80px 0; text-align: center;
  position: relative; overflow: hidden;
}
.public-hero::before {
  content: '';
  position: absolute;
  width: 800px; height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
  top: -400px; right: -200px;
}
.public-hero h1 {
  font-size: 2.6rem; font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.public-hero p {
  opacity: 0.9; font-size: 1.1rem;
  max-width: 640px; margin: 14px auto 0; line-height: 1.7;
}
.public-footer {
  background: #0f172a; color: #94a3b8;
  padding: 36px 0; font-size: 0.85rem;
}
.course-card {
  cursor: pointer;
  transition: all var(--transition);
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ====================== CERTIFICATE ====================== */
.certificate-page {
  background: #eef1f6; min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.certificate {
  background: #fff; width: 1024px; max-width: 100%;
  border: 2px solid #d9c08a; position: relative; padding: 50px 60px;
  text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  background-image:
    radial-gradient(circle at 0 0, rgba(217,192,138,0.15) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(217,192,138,0.15) 0%, transparent 40%);
}
.certificate .cert-academy { font-size: 0.95rem; letter-spacing: 2px; text-transform: uppercase; color: #8a6d1f; }
.certificate .cert-title { font-size: 2rem; font-weight: 800; color: #1f2937; margin: 18px 0 30px; letter-spacing: 1px; }
.certificate .cert-student-name { font-size: 2rem; font-weight: 700; color: #991b1b; margin: 12px 0; }
.certificate .cert-body { font-size: 1rem; color: #4b5563; }
.certificate .cert-course { font-size: 1.35rem; font-weight: 700; color: #b45309; }
.certificate .cert-meta { font-size: 0.8rem; color: #6b7280; margin-top: 26px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.certificate .cert-sign { display: flex; justify-content: space-between; margin-top: 40px; }
.certificate .sign-block { text-align: center; font-size: 0.85rem; color: #6b7280; }
.certificate .sign-line { width: 180px; border-top: 1px solid #9ca3af; margin-bottom: 8px; }
.cert-qr { position: absolute; inset-inline-end: 30px; bottom: 30px; }

/* ====================== RECEIPT / PRINT DOC ====================== */
.print-sheet {
  background: #fff; max-width: 860px; margin: 0 auto;
  padding: 40px 44px; box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  min-height: 500px; color: #111827; font-size: 0.95rem;
}
.document-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  border-bottom: 2px solid #111827; padding-bottom: 14px; margin-bottom: 20px;
}
.document-header img { height: 60px; width: auto; object-fit: contain; }
.document-header h3 { margin: 0 0 4px; font-weight: 800; }
.document-header h4 { margin: 0; font-weight: 800; }
.document-header .document-title-block { text-align: end; }
.document-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px;
  margin-bottom: 16px; font-size: 0.9rem;
}
.document-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.document-table th, .document-table td { border: 1px solid #d1d5db; padding: 7px 10px; }
.document-table thead th { background: #f3f4f6; font-weight: 700; }
.document-summary { margin-bottom: 18px; }
.document-footer {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  margin-top: 40px; flex-wrap: wrap;
}
.document-sign { text-align: center; min-width: 140px; }
.sign-line { width: 180px; border-top: 1px solid #9ca3af; margin-bottom: 8px; }
.document-stamp { text-align: center; }
.stamp-box {
  width: 110px; height: 110px; border: 2px dashed #9ca3af;
  border-radius: 8px; margin: 0 auto;
}

/* ====================== PRINT ====================== */
@media print {
  .sidebar, .topbar, .footer-bar, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}

/* ====================== RESPONSIVE ====================== */
@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { transform: translateX(0); }
  [dir="rtl"] .sidebar { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); }
  [dir="rtl"] .sidebar.collapsed { transform: translateX(100%); }
  .main { margin-inline-start: 0; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .page-head h1 { font-size: 1.15rem; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.3rem; }
}
