:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --border: #e2e8f0;
  --border-soft: #eef2f7;
  --text: #334155;
  --heading: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --primary-border: #c7d2fe;
  --gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 60%, #7c3aed 115%);
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 10px 28px -8px rgba(15, 23, 42, 0.14);
  --shadow-lg: 0 24px 56px -16px rgba(15, 23, 42, 0.2);
  --shadow-glow: 0 14px 34px -12px rgba(99, 102, 241, 0.45);
  --header-h: 60px;
}

.panel-topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.panel-topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
}

.panel-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.panel-logo {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  white-space: nowrap;
  color: var(--heading);
  font-family: var(--font-display, -apple-system, "Segoe UI", sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.panel-logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel-logo img {
  display: block;
  height: 28px;
  width: auto;
}

body.dark-mode .panel-logo img {
  filter: invert(1) hue-rotate(180deg);
}

.panel-topbar-rule {
  flex-shrink: 0;
  width: 1px;
  height: 22px;
  background: var(--border);
}

.panel-topbar-title {
  max-width: 45vw;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.panel-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-topbar-link:hover {
  color: var(--primary);
}

.panel-user {
  color: var(--heading);
  font-size: 0.88rem;
  font-weight: 600;
}

.panel-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.panel-topbar-btn:hover {
  background: var(--surface-soft);
  color: var(--heading);
}

.admin-layout,
.dashboard {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - var(--header-h));
}

:is(.admin-layout, .dashboard) > .admin-sidebar {
  position: sticky;
  top: var(--header-h);
  z-index: 200;
  flex: 0 0 252px;
  width: 252px;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background:
    radial-gradient(80% 40% at 100% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
    linear-gradient(180deg, #131833 0%, #0b1120 65%);
  border: 0;
  transform: none;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-brand h3 {
  color: #f8fafc;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-brand h3 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-brand p {
  color: #64748b;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-brand img {
  display: block;
  height: 34px;
  width: auto;
  margin-bottom: 2px;
  filter: invert(1) hue-rotate(180deg);
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu li a {
  color: #94a3b8;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu li a:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #f8fafc;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu li a.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(99, 102, 241, 0.65);
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu li a i {
  color: #64748b;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu li a:hover i,
:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu li a.active i {
  color: #fff;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu-label {
  color: #475569;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .sidebar-menu-divider {
  background: rgba(148, 163, 184, 0.12);
}

:is(.admin-layout, .dashboard) > .admin-sidebar .logout-link {
  color: #fca5a5 !important;
}

:is(.admin-layout, .dashboard) > .admin-sidebar .logout-link:hover {
  background: rgba(220, 38, 38, 0.2) !important;
  color: #fecaca !important;
}

.admin-content {
  flex: 1;
  min-width: 0;
  padding: 22px 26px 40px;
}

.dashboard-content {
  flex: 1;
  min-width: 0;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 26px 40px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.3rem;
}

.admin-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.admin-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-card {
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.admin-grid .admin-card {
  margin-bottom: 0;
  min-width: 0;
}

.admin-form {
  width: 100%;
}

.dashboard-welcome {
  margin-bottom: 24px;
}

.dashboard-welcome h2 {
  margin-bottom: 4px;
  font-size: 1.4rem;
}

.dashboard-welcome p {
  margin: 0;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.05rem;
}

.stat-blue .stat-icon {
  background: rgba(99, 102, 241, 0.13);
  color: #4f46e5;
}

.stat-green .stat-icon {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.stat-orange .stat-icon {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.stat-purple .stat-icon {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-info h3 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.1;
}

.stat-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.stat-trend.up {
  color: var(--success);
}

.stat-trend.down {
  color: var(--danger);
}

.stat-number {
  display: block;
  color: var(--heading);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-num {
  display: block;
  color: var(--heading);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-text {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.admin-stat-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.admin-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 1rem;
}

.admin-stat-icon.green {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.admin-stat-icon.blue {
  background: rgba(99, 102, 241, 0.13);
  color: #4f46e5;
}

.admin-stat-icon.orange {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.admin-stat-icon.purple {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.admin-stat-box h4 {
  margin: 0;
  font-size: 1.15rem;
}

.admin-stat-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.admin-stats-row:has(> .admin-stat-card:nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.dash-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.dash-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  font-size: 1.05rem;
}

.dash-stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-stat-num {
  color: var(--heading);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
}

.dash-stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.dash-grid-2col .admin-card,
.dash-grid-2col > .admin-card {
  margin-bottom: 20px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.quick-action i {
  color: var(--primary);
  font-size: 1.2rem;
}

.quick-action:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-dark);
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.quick-action-btn i {
  color: var(--primary);
  font-size: 1.2rem;
}

.quick-action-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.recent-info strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-info small {
  color: var(--muted);
  font-size: 0.8rem;
}

.no-data {
  margin: 0;
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

.chart-grid .admin-card {
  margin-bottom: 0;
}

.chart-box {
  position: relative;
}

.chart-box canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 300px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 200px;
}

.chart-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  height: 100%;
}

.chart-bar-track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  max-width: 44px;
  height: 100%;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 6px;
}

.chart-bar-fill {
  display: block;
  width: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: height 0.4s;
}

.chart-bar-value {
  color: var(--heading);
  font-size: 0.78rem;
  font-weight: 700;
}

.chart-bar-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.table-container {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table-container .admin-table {
  border: 0;
}

.admin-card .card-body {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border: 1px solid var(--border);
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9rem;
}

.admin-table thead th {
  padding: 12px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: var(--surface-soft);
}

.actions-cell {
  text-align: right;
  white-space: nowrap;
}

.actions-cell .btn-action {
  margin-left: 6px;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-form-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-form-inline input {
  width: 220px;
  padding: 7px 12px;
  font-size: 0.85rem;
}

.search-form-inline .btn-sm {
  margin: 0;
}

.message-item {
  padding: 16px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.message-item:last-child {
  border-bottom: none;
}

.message-item:hover {
  background: var(--surface-soft);
}

.message-item.unread {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.message-from {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-from strong {
  color: var(--heading);
  font-size: 0.92rem;
}

.message-from small {
  color: var(--muted);
  font-size: 0.8rem;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.message-date {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.message-subject {
  margin-bottom: 4px;
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 600;
}

.message-body {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-reply-form {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg-soft, #f8fafc);
  border: 1px solid var(--border-soft, #e2e8f0);
  border-radius: 10px;
}

.message-reply-form .form-group {
  margin-bottom: 12px;
}

.message-reply-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-soft, #e2e8f0);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.my-course-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.my-course-row:last-child {
  border-bottom: none;
}

.course-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.my-course-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.my-course-info strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-course-info small {
  color: var(--muted);
  font-size: 0.8rem;
}

.my-course-card {
  overflow: hidden;
}

.my-course-card .card-image {
  overflow: hidden;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

body.dark-mode .my-course-card .card-image {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(124, 58, 237, 0.14) 100%);
}

.my-course-card .card-image img {
  height: 130px;
  object-fit: cover;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.my-course-card:hover .card-image img {
  transform: scale(1.05);
}

.my-course-card .course-cat-badge {
  top: 10px;
  left: 10px;
}

.course-badge.certified {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.95);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.35);
}

.course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-bar,
.progress-track {
  height: 8px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.progress-bar {
  flex: 1;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 999px;
  transition: width 0.4s;
}

.course-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--muted);
}

.course-score {
  color: var(--heading);
  font-weight: 700;
}

.exam-hero {
  padding: 40px 0;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.exam-hero-content h1 {
  margin-bottom: 8px;
  font-size: 1.6rem;
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.exam-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.exams-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 24px 0 48px;
}

.exams-list .card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exams-list .card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.exams-list .card-content h3 {
  margin-bottom: 6px;
  font-size: 1.02rem;
}

.exams-list .card-content p {
  color: var(--muted);
  font-size: 0.88rem;
}

.exams-list .card-content .btn {
  margin-top: auto;
}

.exam-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.exam-stat-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.exam-stat-card h3 {
  margin-bottom: 4px;
  font-size: 1.3rem;
}

.exam-stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.exam-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.take-exam {
  padding: 24px 0 0;
}

.exam-header {
  position: sticky;
  top: var(--header-h);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.exam-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--heading);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.exam-timer i {
  color: var(--muted);
}

.exam-timer.warning {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.exam-timer.warning i {
  color: var(--danger);
}

.exam-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 120px;
}

.exam-progress .progress-text {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.question-nav-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  margin: 18px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.question-nav-panel.active {
  display: flex;
}

.question-nav-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}

.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 8px;
}

.question-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.question-nav-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.question-nav-btn.answered {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(99, 102, 241, 0.6);
}

.question-nav-btn.answered:hover {
  background: var(--gradient);
  filter: brightness(1.05);
}

.question-nav-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  color: var(--muted);
  font-size: 0.8rem;
}

.question-nav-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-answered,
.legend-unanswered {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-answered {
  background: var(--gradient);
}

.legend-unanswered {
  background: var(--border);
}

.questions-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.question-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.question-card.highlight {
  animation: question-highlight 1.5s;
}

@keyframes question-highlight {
  0%, 60% {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
  }
  100% {
    box-shadow: var(--shadow-sm);
  }
}

.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  margin-bottom: 14px;
  padding: 0 12px;
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
}

.question-text {
  margin-bottom: 16px;
  color: var(--heading);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.option-label input[type="radio"] {
  width: auto;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--primary);
}

.option-label:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

.option-label:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.option-label:has(input:checked) .option-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.option-text {
  color: var(--text);
  font-size: 0.92rem;
}

.exam-submit-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.exam-submit-section .btn-submit {
  width: auto;
  min-width: 220px;
}

.submit-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.submit-info strong {
  color: var(--heading);
}

.payment-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 24px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%);
}

.payment-container {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.payment-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.payment-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.payment-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.payment-back:hover {
  background: var(--surface-soft);
}

.payment-course-info {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.payment-course-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.1rem;
}

.payment-course-info h2 {
  margin: 0 0 2px;
  font-size: 1rem;
}

.payment-course-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.payment-details {
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
}

.payment-amount {
  color: var(--heading);
  font-weight: 800;
}

.payment-methods {
  margin-bottom: 20px;
}

.payment-methods h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.payment-method-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.payment-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.payment-method input[type="radio"] {
  width: auto;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--primary);
}

.payment-method-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 600;
}

.payment-method-content i {
  color: var(--primary);
}

.payment-method.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.payment-user-info {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.payment-user-info h3 {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.payment-user-info p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.payment-user-info p:last-child {
  margin-bottom: 0;
}

.payment-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.payment-secure i {
  color: var(--success);
}

.cert-count-header {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.cert-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.cert-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 60%);
  border-bottom: 1px solid var(--border-soft);
}

.cert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gradient);
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 8px 18px -8px rgba(99, 102, 241, 0.6);
}

.cert-card-header h3 {
  margin: 0;
  font-size: 0.98rem;
}

.cert-card-body {
  padding: 16px 18px;
}

.cert-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cert-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cert-detail .label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cert-id {
  overflow: hidden;
  color: var(--heading);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cert-course-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cert-course {
  overflow: hidden;
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cert-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
}

.cert-card-footer .btn {
  flex: 1;
}

.cert-detail strong {
  color: var(--heading);
}

.cert-details .cert-id {
  font-weight: 600;
}

.empty-state-card {
  padding: 48px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state-card i,
.empty-state i {
  display: block;
  margin: 0 auto 14px;
  color: #cbd5e1;
  font-size: 2.4rem;
}

.empty-state-card h3 {
  margin-bottom: 6px;
}

.empty-state-card p,
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 2rem;
  font-weight: 800;
}

.avatar-initials {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.profile-avatar-section h3 {
  margin-bottom: 2px;
  font-size: 1.05rem;
}

.profile-avatar-section p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.avatar-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.avatar-info h4 {
  margin: 0;
  font-size: 1rem;
}

.avatar-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.avatar-upload {
  margin-top: 12px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.profile-stat {
  padding: 12px;
  background: var(--surface-soft);
  border-radius: 10px;
  text-align: center;
}

.current-image {
  display: inline-block;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
  line-height: 0;
}

.file-input {
  width: 100%;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.file-input::-webkit-file-upload-button {
  margin-right: 10px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.panel-footer {
  flex-shrink: 0;
  padding: 9px 24px;
  background: rgba(248, 250, 252, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.panel-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 1280px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.panel-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.panel-footer-links a {
  color: var(--muted);
}

.panel-footer-links a:hover {
  color: var(--heading);
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
  cursor: pointer;
}

.toast-icon {
  margin-top: 2px;
  color: var(--muted);
}

.toast-message {
  flex: 1;
  color: var(--text);
  font-size: 0.88rem;
}

.toast-close {
  padding: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.toast-action {
  padding: 5px 14px;
  background: var(--gradient);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

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

body.dark-mode .panel-topbar,
body.dark-mode .panel-footer,
body.dark-mode .admin-card,
body.dark-mode .stat-card,
body.dark-mode .admin-stat-box,
body.dark-mode .dash-stat-card,
body.dark-mode .exam-timer,
body.dark-mode .question-card,
body.dark-mode .exam-submit-section,
body.dark-mode .payment-container,
body.dark-mode .cert-card,
body.dark-mode .profile-avatar-section {
  background: var(--surface);
}

body.dark-mode .panel-topbar {
  background: rgba(11, 18, 32, 0.72);
  border-bottom: 1px solid rgba(38, 50, 79, 0.7);
}

body.dark-mode :is(.admin-layout, .dashboard) > .admin-sidebar {
  background:
    radial-gradient(80% 40% at 100% 0%, rgba(99, 102, 241, 0.14), transparent 60%),
    linear-gradient(180deg, #0d1124 0%, #070c18 65%);
}

body.dark-mode .admin-table tbody tr:hover,
body.dark-mode .option-label,
body.dark-mode .course-stats,
body.dark-mode .payment-course-info,
body.dark-mode .payment-user-info {
  background: var(--surface-soft);
}

@media (max-width: 1024px) {
  .admin-stats-row,
  .admin-grid,
  .chart-grid,
  .dash-stats-grid,
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-grid-2col {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  :is(.admin-layout, .dashboard) > .admin-sidebar {
    position: fixed;
    top: 0;
    z-index: 340;
    width: 272px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  :is(.admin-layout, .dashboard) > .admin-sidebar.active {
    transform: translateX(0);
  }

  .admin-layout,
  .dashboard {
    display: block;
    min-height: 0;
  }

  .admin-content,
  .dashboard-content {
    padding: 20px 16px 40px;
  }

  .admin-header {
    flex-direction: column;
    gap: 12px;
  }

  .admin-header-actions {
    width: 100%;
    overflow-x: auto;
  }

  .panel-topbar {
    padding: 0 16px;
  }

  .panel-topbar-title {
    max-width: 42vw;
  }

  .panel-user,
  .panel-topbar-link,
  .panel-topbar-btn {
    display: none;
  }

  .admin-grid,
  .chart-grid,
  .stats-grid,
  .admin-stats-row,
  .dash-stats-grid {
    grid-template-columns: 1fr;
  }

  .exam-header {
    flex-wrap: wrap;
  }

  .exam-header .exam-progress {
    order: 3;
    flex-basis: 100%;
  }

  .exam-submit-section {
    flex-direction: column;
    align-items: stretch;
  }

  .exam-submit-section .btn-submit {
    width: 100%;
  }

  .question-card {
    padding: 18px 16px;
  }

  .search-form-inline {
    flex: 1;
  }

  .search-form-inline input {
    width: auto;
    flex: 1;
    min-width: 140px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .cert-grid {
    grid-template-columns: 1fr;
  }

  .cert-details {
    grid-template-columns: 1fr;
  }

  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .panel-topbar-right .panel-topbar-link {
    display: none;
  }

  .panel-topbar-btn {
    padding: 6px 10px;
  }

  .admin-date {
    display: none;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .exams-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  body.panel-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  body.panel-app > .main-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .admin-layout,
  .dashboard {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    height: 100%;
  }

  body.panel-app > .main-content > .admin-layout,
  body.panel-app > .main-content > .dashboard {
    height: 100%;
  }

  .admin-content,
  .dashboard-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  :is(.admin-layout, .dashboard) > .admin-sidebar {
    height: 100%;
  }

  body.panel-app .admin-card {
    border-radius: 14px;
  }

  body.panel-app .admin-card .card-body {
    padding: 18px;
  }

  body.panel-app .admin-card .card-header {
    padding: 14px 18px;
  }

  .admin-table thead th {
    padding: 10px 16px;
  }

  .admin-table tbody td {
    padding: 10px 14px;
  }

  .actions-cell .btn-action {
    padding: 6px 11px;
    font-size: 0.8rem;
  }

  .admin-date {
    padding: 5px 12px;
    font-size: 0.78rem;
  }

  .admin-sidebar::-webkit-scrollbar,
  .admin-content::-webkit-scrollbar,
  .dashboard-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  .admin-sidebar::-webkit-scrollbar-track,
  .admin-content::-webkit-scrollbar-track,
  .dashboard-content::-webkit-scrollbar-track {
    background: transparent;
  }

  .admin-sidebar::-webkit-scrollbar-thumb,
  .admin-content::-webkit-scrollbar-thumb,
  .dashboard-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    background-clip: content-box;
    border: 3px solid transparent;
    border-radius: 999px;
  }

  .admin-sidebar::-webkit-scrollbar-thumb:hover,
  .admin-content::-webkit-scrollbar-thumb:hover,
  .dashboard-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    background-clip: content-box;
    border: 3px solid transparent;
  }

  .admin-sidebar::-webkit-scrollbar-thumb {
    background: #475569;
    background-clip: content-box;
  }

  body.dark-mode .admin-sidebar::-webkit-scrollbar-thumb,
  body.dark-mode .admin-content::-webkit-scrollbar-thumb,
  body.dark-mode .dashboard-content::-webkit-scrollbar-thumb {
    background: #334155;
    background-clip: content-box;
    border: 3px solid transparent;
  }
}