html, body { margin: 0; min-height: 100%; }
body { margin: 0; font-family: "Poppins", sans-serif; background: linear-gradient(135deg, #0b0f2a, #2b1e5a); color: white; min-height: 100vh; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #1a1140; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; box-sizing: border-box; }
.sidebar-toggle { display: none; width: 46px; height: 46px; border: none; border-radius: 14px; background: rgba(255,255,255,0.08); cursor: pointer; align-items: center; justify-content: center; flex-direction: column; gap: 5px; padding: 0; flex-shrink: 0; }
.sidebar-toggle span { width: 20px; height: 2px; background: #fff; border-radius: 999px; display: block; transition: transform 0.25s ease, opacity 0.25s ease, background 0.35s ease; }
.top-section { display: flex; flex-direction: column; gap: 30px; }
.logo-link { text-decoration: none; }
.logo { font-family: "Press Start 2P", cursive; font-size: 14px; line-height: 1.5; background: linear-gradient(90deg, #ff982e 0%, #ff7c2e 28%, #ff4d95 68%, #ff4fb8 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; margin: 0; filter: drop-shadow(0 0 6px rgba(255,138,42,0.45)) drop-shadow(0 0 14px rgba(255,46,151,0.28)); }
.menu { display: flex; flex-direction: column; gap: 30px; padding-top: 14px; }
.menu a { color: white; text-decoration: none; opacity: 0.82; font-size: 14px; display: flex; align-items: center; gap: 10px; line-height: 1.2; padding: 2px 0; }
.menu a:hover, .menu a.active-link { opacity: 1; transform: translateX(5px); }
.nav-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: linear-gradient(135deg, #ff2e97, #ff8c00); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; box-shadow: 0 8px 18px rgba(255,46,151,0.25); }
.bottom-section { padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn, .primary-action, .danger-action, .theme-toggle { border: none; border-radius: 14px; cursor: pointer; font-family: inherit; }
.logout-btn { width: 100%; padding: 12px; background: #ff2e97; color: white; font-weight: 600; }
.main { flex: 1; padding: 24px; box-sizing: border-box; display: flex; flex-direction: column; gap: 22px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.topbar-title { display: flex; align-items: flex-start; gap: 12px; }
.page-title { margin: 0; font-size: 32px; }
.page-subtitle { margin: 8px 0 0; opacity: 0.82; font-size: 14px; max-width: 760px; }
.user-top { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.06); padding: 10px 14px; border-radius: 14px; }
.user-top img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.overview-card, .panel-card { background: #3a2575; border-radius: 20px; padding: 22px; box-sizing: border-box; }
.insights-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 6px; }
.insight-admin-card { background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; }
.insight-admin-card span { display: block; opacity: 0.78; font-size: 13px; }
.insight-admin-card strong { display: block; font-size: 30px; margin: 8px 0 10px; }
.insight-admin-card p { margin: 0; font-size: 13px; opacity: 0.82; }
.insights-admin-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.insight-list-wrap h4 { margin: 0 0 12px; font-size: 15px; }
.insight-review-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.insight-review-item strong { font-size: 22px; }
.overview-card h3, .panel-card h3 { margin: 0 0 10px; font-size: 15px; }
.overview-card p { margin: 0; font-size: 28px; font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel-card.wide { grid-column: 1 / -1; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel-header p { margin: 6px 0 0; opacity: 0.78; font-size: 13px; }
.panel-count-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 4px 12px; margin-left: 10px; border-radius: 999px; background: rgba(34, 211, 238, 0.14); color: #7feaff; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle; }
.bottleneck-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bottleneck-card { background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; }
.bottleneck-card strong { display: block; font-size: 18px; margin-top: 8px; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.analytics-card { background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 16px; }
.analytics-card strong { display: block; font-size: 22px; margin: 10px 0 6px; }
.analytics-card p, .analytics-card small { margin: 0; opacity: 0.78; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 13px; vertical-align: top; }
.admin-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; }
.admin-table th:nth-child(1),
.admin-table th:nth-child(2),
.admin-table th:nth-child(5),
.admin-table th:nth-child(6),
.admin-table td:nth-child(1),
.admin-table td:nth-child(2),
.admin-table td:nth-child(5),
.admin-table td:nth-child(6) {
  text-align: center;
}
.status-pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(34, 211, 238, 0.14); color: #7feaff; }
.status-pill.warning { background: rgba(255, 159, 67, 0.16); color: #ffc27a; }
.admin-form { display: grid; gap: 14px; }
.admin-form label { display: grid; gap: 6px; font-size: 13px; }
.admin-form input, .admin-form textarea, .admin-form select { width: 100%; box-sizing: border-box; border: 1px solid rgba(255,255,255,0.12); background: rgba(10, 16, 42, 0.28); color: white; border-radius: 14px; padding: 12px 14px; font: inherit; }
.admin-form textarea { resize: vertical; }
.grant-list { display: grid; gap: 12px; }
.grant-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); }
.grant-item strong { display: block; margin-bottom: 4px; }
.grant-item p { margin: 0; font-size: 12px; opacity: 0.78; }
.grant-actions { display: flex; gap: 10px; align-items: center; }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.review-column h4, .notes-block h4 { margin: 0 0 12px; font-size: 15px; }
.review-list { display: grid; gap: 12px; }
.review-item { padding: 16px; border-radius: 16px; background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); }
.review-item h5 { margin: 0 0 8px; font-size: 15px; }
.admin-loading-card { position: relative; overflow: hidden; }
.admin-loading-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: translateX(-100%);
  animation: adminShimmer 1.2s infinite;
}
@keyframes adminShimmer {
  to { transform: translateX(100%); }
}
.review-item p { margin: 0 0 8px; font-size: 13px; opacity: 0.85; }
.review-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.meta-pill { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.08); }
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.topic-detail-btn { margin-top: 10px; }
.topic-breakdown-card { display: grid; gap: 10px; }
.topic-breakdown-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-breakdown-stat { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.08); }
.topic-modal-group { padding: 16px; border-radius: 16px; background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); }
.topic-modal-group h4 { margin: 0 0 12px; font-size: 15px; }
.topic-modal-list { display: grid; gap: 10px; }
.topic-modal-row { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.topic-modal-row:last-child { border-bottom: none; padding-bottom: 0; }
.topic-modal-row strong { font-size: 14px; }
.topic-modal-row p { margin: 0; font-size: 13px; opacity: 0.84; }
.topic-modal-row small { opacity: 0.72; }
.secondary-action { padding: 10px 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.14); background: transparent; color: white; cursor: pointer; }
.profile-layout { display: grid; gap: 16px; margin-bottom: 18px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.profile-stat-card { padding: 14px; border-radius: 16px; background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); }
.profile-stat-card strong { display: block; font-size: 22px; margin-top: 6px; }
.profile-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-section { padding: 16px; border-radius: 16px; background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); }
.profile-section h4 { margin: 0 0 12px; }
.profile-list { display: grid; gap: 10px; }
.learner-assessment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.learner-assessment-card { padding: 16px; border-radius: 16px; background: rgba(10, 16, 42, 0.24); border: 1px solid rgba(255,255,255,0.08); }
.learner-assessment-card h5 { margin: 0 0 12px; font-size: 15px; }
.learner-assessment-stack { display: grid; gap: 12px; }
.learner-assessment-row { display: grid; gap: 8px; }
.learner-assessment-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; font-size: 12px; }
.learner-assessment-head > div { display: grid; gap: 2px; }
.learner-assessment-head strong { font-size: 13px; }
.learner-assessment-track { position: relative; height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.08); }
.learner-assessment-track.xp { height: 6px; }
.learner-assessment-fill { height: 100%; border-radius: 999px; }
.learner-assessment-fill.score { background: linear-gradient(90deg, #ff4aa2, #8f7bff); }
.learner-assessment-fill.xp { background: linear-gradient(90deg, #35e0c8, #00d4ff); }
.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 8px;
}
.profile-row > :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.profile-row > :last-child {
  white-space: nowrap;
  text-align: right;
}
.notes-block { margin-top: 18px; }
.admin-modal { position: fixed; inset: 0; background: rgba(8, 10, 26, 0.72); display: none; align-items: center; justify-content: center; padding: 24px; z-index: 80; }
.admin-modal.active { display: flex; }
.admin-modal-box { width: min(920px, 100%); max-height: 88vh; overflow: auto; border-radius: 24px; background: #2c1f5f; padding: 22px; box-sizing: border-box; border: 1px solid rgba(255,255,255,0.08); }
.admin-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.admin-modal-head h3 { margin: 0; }
.admin-modal-head p { margin: 6px 0 0; opacity: 0.8; }
.modal-close-btn { padding: 10px 14px; border-radius: 14px; border: none; background: rgba(255,255,255,0.12); color: white; cursor: pointer; }
.upload-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); }
.primary-action { padding: 12px 16px; background: linear-gradient(90deg, #ff2e97, #22d3ee); color: white; font-weight: 700; }
.danger-action { padding: 8px 12px; background: rgba(255, 89, 94, 0.16); color: #ff9ca0; border: 1px solid rgba(255, 89, 94, 0.26); }
.compact-action { margin-right: 8px; margin-bottom: 6px; }
.danger-action:disabled { opacity: 0.45; cursor: not-allowed; }
.shortcut-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.shortcut-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.inbox-shortcut-card { background: linear-gradient(135deg, rgba(255, 46, 151, 0.14), rgba(34, 211, 238, 0.1)), #3a2575; }
.light-mode body, body.light-mode { background: linear-gradient(135deg, #f3f0ff, #dff9ff); color: #1e1547; }
body.light-mode .sidebar { background: #e9e0ff; }
body.light-mode .sidebar-toggle { background: rgba(108,76,255,0.1); }
body.light-mode .sidebar-toggle span { background: #1a1140; }
body.light-mode .menu a { color: #1e1547; }
body.light-mode .nav-count-badge { color: #fff; }
body.light-mode .overview-card,
body.light-mode .panel-card,
body.light-mode .user-top,
body.light-mode .bottleneck-card,
body.light-mode .analytics-card,
body.light-mode .insight-admin-card,
body.light-mode .admin-form input,
body.light-mode .admin-form textarea,
body.light-mode .admin-form select { color: #1e1547; }
body.light-mode .overview-card,
body.light-mode .panel-card { background: rgba(130, 99, 255, 0.12); }
body.light-mode .bottleneck-card,
body.light-mode .analytics-card,
body.light-mode .admin-form input,
body.light-mode .admin-form textarea,
body.light-mode .admin-form select,
body.light-mode .review-item,
body.light-mode .profile-section,
body.light-mode .profile-stat-card,
body.light-mode .learner-assessment-card,
body.light-mode .grant-item,
body.light-mode .user-top,
body.light-mode .admin-modal-box { background: rgba(255,255,255,0.82); color: #1e1547; }
body.light-mode .learner-assessment-track { background: rgba(60, 40, 120, 0.08); }
.inline-select {
  width: 100%;
  min-width: 170px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 16, 42, 0.28);
  color: white;
  border-radius: 14px;
  padding: 10px 14px;
  font: inherit;
  text-align: center;
  text-align-last: center;
}

body.light-mode .inline-select {
  background: rgba(255,255,255,0.82);
  color: #1e1547;
}
body.light-mode .inbox-shortcut-card { background: rgba(255,255,255,0.82); }
body.light-mode .panel-count-badge { background: rgba(15, 118, 110, 0.12); color: #0f766e; }
body.light-mode .topic-breakdown-stat { background: rgba(130, 99, 255, 0.12); }
.form-status { margin: 0; font-size: 13px; min-height: 20px; color: #8df6cb; }
.theme-toggle { position: fixed; right: 18px; bottom: 18px; width: 56px; height: 56px; background: linear-gradient(90deg, #ff2e97, #22d3ee); color: white; font-size: 22px; box-shadow: 0 0 25px rgba(0, 255, 200, 0.35); }
.popup {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 26, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 120;
  pointer-events: none;
}
.popup.active { display: flex; pointer-events: auto; }
.popup-box {
  width: min(460px, 100%);
  border-radius: 24px;
  background: #2c1f5f;
  padding: 22px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
}
.popup-box h3 {
  margin: 0 0 10px;
  font-size: 22px;
}
.popup-box p {
  margin: 0;
  opacity: 0.86;
  line-height: 1.6;
}
.popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.popup-actions button,
.secondary-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}
.popup-actions button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.secondary-btn {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.14);
}
body.light-mode .popup-box {
  background: rgba(255,255,255,0.95);
  color: #1e1547;
}
body.light-mode .secondary-btn {
  background: rgba(130, 99, 255, 0.12);
  color: #1e1547;
  border-color: rgba(130, 99, 255, 0.18);
}
@media (max-width: 1100px) {
  .overview-grid,
  .admin-grid,
  .bottleneck-grid,
  .analytics-grid,
  .insights-admin-grid,
  .review-grid,
  .insights-admin-columns,
  .learner-assessment-grid,
  .profile-stats,
  .profile-columns { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .layout { flex-direction: column; position: relative; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar { display: none; position: fixed; top: 84px; left: 12px; right: 12px; width: auto; min-height: auto; max-height: calc(100vh - 108px); overflow: auto; border-radius: 22px; box-shadow: 0 18px 42px rgba(6,8,28,0.4); border: 1px solid rgba(255,255,255,0.08); z-index: 1200; }
  .layout.mobile-nav-open .sidebar { display: flex; }
  .layout.mobile-nav-open .sidebar-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .layout.mobile-nav-open .sidebar-toggle span:nth-child(2) { opacity: 0; }
  .layout.mobile-nav-open .sidebar-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .main { padding: 20px; }
  .topbar { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: nowrap; }
  .user-top { margin-left: auto; align-self: auto; flex-shrink: 0; }
  .overview-grid, .admin-grid { grid-template-columns: 1fr; }
  .analytics-grid, .bottleneck-grid, .health-grid { grid-template-columns: 1fr; }
  .role-row, .pending-grid, .filter-bar, .action-row { flex-direction: column; align-items: stretch; }
  .access-table th, .access-table td, .admin-table th, .admin-table td { white-space: nowrap; }
}

@media (max-width: 720px) {
  .main { padding: 16px 12px 24px; }
  .topbar { gap: 10px; }
  .topbar-title { flex: 1; min-width: 0; }
  .page-title { font-size: 28px; }
  .page-subtitle { display: none; }
  .user-top { padding: 8px 10px; gap: 8px; }
  .user-top span { font-size: 13px; white-space: nowrap; }
  .user-top img { width: 34px; height: 34px; }
  .sidebar { top: 72px; left: 10px; right: 10px; padding: 18px; }
  .menu { gap: 20px; padding-top: 8px; }
  .profile-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .profile-row > :last-child {
    white-space: normal;
    text-align: left;
  }
}
.slow-load-warning{
  color:#8effe4 !important;
  font-weight:700;
}
