/* =======================================================
   MASRI ACADEMY — Futuristic Dark Theme
   Font: Orbitron (brand) + Syne (heading) + DM Sans (body)
   ======================================================= */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600&display=swap');

:root {
  --primary:        #00c8ff;
  --primary-dark:   #0099cc;
  --primary-glow:   rgba(0, 200, 255, 0.30);
  --primary-dim:    rgba(0, 200, 255, 0.08);
  --secondary:      #8b5cf6;
  --secondary-glow: rgba(139, 92, 246, 0.30);
  --bg:             #040a1a;
  --bg2:            #060d24;
  --surface:        rgba(7, 18, 46, 0.78);
  --surface-solid:  #091230;
  --surface-hover:  rgba(10, 26, 65, 0.90);
  --text:           #c8d8f0;
  --text-bright:    #e6f0ff;
  --muted:          #526180;
  --border:         rgba(0, 200, 255, 0.13);
  --border-hover:   rgba(0, 200, 255, 0.32);
  --success:        #00e887;
  --success-glow:   rgba(0, 232, 135, 0.28);
  --success-dim:    rgba(0, 232, 135, 0.08);
  --error:          #ff4466;
  --error-glow:     rgba(255, 68, 102, 0.28);
  --error-dim:      rgba(255, 68, 102, 0.08);
  --radius:         14px;
  --shadow:         0 8px 32px rgba(0, 0, 0, 0.55);
  --shadow-glow:    0 0 40px rgba(0, 200, 255, 0.07);
  --font-display:   'Orbitron', monospace;
  --font-heading:   'Syne', sans-serif;
  --font-body:      'DM Sans', sans-serif;
}

/* ── RESET ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Animated grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0, 200, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* Floating ambient orbs */
body::after {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0, 180, 255, 0.05) 0%, transparent 70%);
  top: -200px; left: -200px;
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 20s ease-in-out infinite alternate;
}

@keyframes orb-drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(80px, 60px); }
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: #40d8ff; text-decoration: none; }
button, input, select, textarea { font-family: var(--font-body); }

/* ── LAYOUT ─────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* ── NAV ─────────────────────────────────────────── */
nav {
  background: rgba(4, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0,0,0,0.4);
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px;
  color: var(--primary);
  letter-spacing: 1px;
  text-shadow: 0 0 20px var(--primary-glow);
  flex-shrink: 0;
}

.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  padding: 7px 14px; border-radius: 8px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: all .15s; letter-spacing: .3px;
  border: 1px solid transparent;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--primary-dim);
  border-color: var(--border);
  color: var(--primary);
}

/* Hamburger button */
.nav-hamburger {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 8px;
  border-radius: 8px; border: 1px solid var(--border);
  transition: all .15s;
}
.nav-hamburger:hover { background: var(--primary-dim); border-color: var(--border-hover); }
.nav-hamburger span {
  display: block; width: 20px; height: 1.5px;
  background: var(--text); border-radius: 2px; transition: all .25s;
}
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4.5px, 4.5px); background: var(--primary); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4.5px, -4.5px); background: var(--primary); }

/* Mobile dropdown menu */
.mobile-menu {
  display: none; position: fixed;
  top: 62px; left: 0; right: 0;
  background: rgba(4, 10, 26, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  z-index: 99; box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  padding: 10px 16px 18px; flex-direction: column; gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  display: block; padding: 13px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text);
  border: 1px solid transparent;
}
.mobile-menu a:hover, .mobile-menu a.active {
  background: var(--primary-dim); border-color: var(--border); color: var(--primary);
}
.mobile-menu-logout {
  display: block; width: 100%; padding: 13px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--error);
  background: var(--error-dim); border: 1px solid var(--error-glow);
  cursor: pointer; text-align: left; transition: all .15s; margin-top: 4px;
}
.mobile-menu-logout:hover { background: rgba(255,68,102,0.14); }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  transition: all .18s; white-space: nowrap;
  min-height: 42px; text-decoration: none; line-height: 1;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: .3px; position: relative; overflow: hidden;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #0099dd 100%);
  color: #020b18;
  box-shadow: 0 0 20px var(--primary-glow), 0 4px 12px rgba(0,0,0,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #30d5ff 0%, #00b8f0 100%);
  box-shadow: 0 0 30px var(--primary-glow), 0 6px 18px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

.btn-danger {
  background: linear-gradient(135deg, var(--error) 0%, #cc2244 100%);
  color: #fff;
  box-shadow: 0 0 20px var(--error-glow);
}
.btn-danger:hover { box-shadow: 0 0 30px var(--error-glow); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #00bb66 100%);
  color: #020b18;
  box-shadow: 0 0 20px var(--success-glow);
}
.btn-success:hover { box-shadow: 0 0 30px var(--success-glow); transform: translateY(-1px); }

.btn-sm { padding: 6px 14px; font-size: 12px; min-height: 34px; border-radius: 8px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-block { width: 100%; }

/* ── CARDS ─────────────────────────────────────── */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), var(--shadow-glow);
  padding: 24px;
  position: relative;
}

.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,200,255,0.3), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ── FORMS ─────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  margin-bottom: 8px; color: var(--primary);
  text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-heading);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 12px 16px;
  background: rgba(0, 200, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  color: var(--text-bright);
  -webkit-appearance: none; appearance: none;
  min-height: 46px;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted); font-size: 14px; }

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: rgba(0, 200, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.12), 0 0 20px rgba(0, 200, 255, 0.06);
  color: var(--text-bright);
}

.form-group textarea { resize: vertical; min-height: 110px; }
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300c8ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.form-group select option { background: var(--surface-solid); color: var(--text); }

.form-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.form-check input[type="checkbox"] {
  width: 18px; height: 18px; min-height: unset; cursor: pointer;
  accent-color: var(--primary);
}
.form-check label {
  font-size: 14px; text-transform: none; letter-spacing: 0;
  color: var(--text); margin-bottom: 0; font-weight: 500;
}

/* ── ALERTS ─────────────────────────────────────── */
.alert {
  padding: 13px 16px; border-radius: 10px;
  font-size: 13px; margin-bottom: 16px; line-height: 1.5;
  border-left: 3px solid;
}
.alert-error {
  background: var(--error-dim); color: #ff7799;
  border-color: var(--error); border-left-color: var(--error);
}
.alert-success {
  background: var(--success-dim); color: var(--success);
  border-color: var(--success);
}

/* ── PROGRESS BAR ─────────────────────────────────── */
.progress-bar {
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 99px; height: 8px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px; transition: width .6s ease;
  background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
  box-shadow: 0 0 10px var(--primary-glow);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute; top: 0; left: -100%; width: 80%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmer 2.5s ease-in-out infinite;
}
@keyframes shimmer { to { left: 200%; } }

/* ── BADGES ─────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  white-space: nowrap; font-family: var(--font-heading);
}
.badge-primary {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(0, 200, 255, 0.25);
}
.badge-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(0, 232, 135, 0.25);
}
.badge-muted {
  background: rgba(82, 97, 128, 0.15);
  color: var(--muted);
  border: 1px solid rgba(82, 97, 128, 0.2);
}

/* ── TABLE ─────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 11px 16px;
  font-size: 10px; color: var(--primary);
  text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: rgba(0, 200, 255, 0.04);
  font-family: var(--font-heading);
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(0, 200, 255, 0.06);
  vertical-align: middle;
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0, 200, 255, 0.04); }

/* ── MODULE ITEMS ─────────────────────────────────── */
.module-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: all .2s; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative; overflow: hidden;
}
.module-item::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary);
  transform: scaleY(0);
  transition: transform .2s;
  border-radius: 0 2px 2px 0;
}
.module-item:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
  transform: translateX(3px);
  box-shadow: -3px 0 20px rgba(0, 200, 255, 0.08), var(--shadow);
}
.module-item:hover::before { transform: scaleY(1); }

.module-item.completed {
  border-color: rgba(0, 232, 135, 0.2);
  background: rgba(0, 232, 135, 0.04);
}
.module-item.completed::before { background: var(--success); transform: scaleY(1); }

.module-num {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--primary);
  flex-shrink: 0; font-family: var(--font-heading);
}
.module-item.completed .module-num {
  background: var(--success-dim);
  border-color: rgba(0, 232, 135, 0.3);
  color: var(--success);
}

.module-info { flex: 1; min-width: 0; }
.module-title {
  font-weight: 600; font-size: 14px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--text-bright);
  font-family: var(--font-heading);
}
.module-desc {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── MARKDOWN PROSE ─────────────────────────────────── */
.prose { line-height: 1.85; font-size: 15px; word-break: break-word; color: var(--text); }
.prose h1, .prose h2, .prose h3 {
  font-family: var(--font-heading); font-weight: 700;
  margin: 1.5em 0 .5em; color: var(--text-bright); line-height: 1.3;
}
.prose h1 { font-size: clamp(20px, 4vw, 26px); }
.prose h2 {
  font-size: clamp(17px, 3.5vw, 21px);
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
  color: var(--primary);
}
.prose h3 { font-size: clamp(15px, 3vw, 18px); color: #80d8ff; }
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { margin: .5em 0 1em 1.5em; }
.prose li { margin-bottom: .4em; }
.prose code {
  background: rgba(0, 200, 255, 0.08); padding: 2px 8px;
  border-radius: 5px; font-size: .85em;
  font-family: 'Courier New', monospace; color: var(--primary);
  border: 1px solid var(--border);
}
.prose pre {
  background: rgba(0, 0, 0, 0.5); color: var(--text-bright);
  border: 1px solid var(--border);
  padding: 20px; border-radius: 10px; overflow-x: auto;
  margin: 1em 0; font-size: 13px; -webkit-overflow-scrolling: touch;
}
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; border: none; }
.prose blockquote {
  border-left: 3px solid var(--primary); padding-left: 16px;
  color: var(--muted); margin: 1em 0; font-style: italic;
  background: var(--primary-dim); border-radius: 0 8px 8px 0; padding: 12px 16px;
}
.prose img { max-width: 100%; border-radius: 10px; margin: .5em 0; border: 1px solid var(--border); }
.prose table { margin: 1em 0; }

/* ── STATS GRID ─────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--primary-glow);
}
.stat-num {
  font-size: 30px; font-weight: 700; color: var(--primary);
  font-family: var(--font-display);
  text-shadow: 0 0 20px var(--primary-glow);
}
.stat-label { font-size: 11px; color: var(--muted); margin-top: 6px; font-weight: 500; letter-spacing: .3px; }

/* ── ADMIN LAYOUT ─────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

.admin-topbar {
  display: none;
  position: sticky; top: 0;
  background: rgba(4, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  color: var(--text-bright);
  padding: 0 16px; height: 56px;
  align-items: center; justify-content: space-between;
  z-index: 201;
  flex-shrink: 0;
}
.admin-topbar-brand {
  font-weight: 700; font-size: 14px;
  font-family: var(--font-display);
  color: var(--primary);
  text-shadow: 0 0 15px var(--primary-glow);
  letter-spacing: 1px;
}
.admin-topbar-logout {
  background: var(--primary-dim);
  border: 1px solid var(--border);
  color: var(--primary); padding: 6px 14px; border-radius: 8px;
  font-size: 12px; cursor: pointer; transition: all .15s; font-family: var(--font-body);
}
.admin-topbar-logout:hover { background: rgba(0,200,255,0.15); border-color: var(--border-hover); }

.admin-hamburger {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: 6px;
  border-radius: 6px; -webkit-tap-highlight-color: transparent;
}
.admin-hamburger span { display: block; width: 22px; height: 2px; background: var(--primary); border-radius: 2px; }

.admin-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 199;
  backdrop-filter: blur(2px);
}
.admin-overlay.open { display: block; }

.admin-sidebar {
  width: 220px;
  background: rgba(4, 8, 22, 0.98);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  color: var(--text); flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: transform .25s ease; z-index: 200;
}
.sidebar-brand {
  padding: 20px 18px; font-size: 14px; font-weight: 700;
  font-family: var(--font-display);
  color: var(--primary);
  text-shadow: 0 0 20px var(--primary-glow);
  border-bottom: 1px solid var(--border);
  letter-spacing: 1px;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; color: var(--muted);
  font-size: 13px; text-decoration: none; transition: all .15s;
  border-left: 2px solid transparent;
  margin: 2px 8px; border-radius: 0 8px 8px 0;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--primary-dim);
  color: var(--primary); text-decoration: none;
  border-left-color: var(--primary);
}
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-logout {
  display: block; width: 100%; padding: 10px; border-radius: 8px;
  background: transparent; border: 1px solid rgba(255,68,102,0.3);
  color: rgba(255,68,102,0.7); font-size: 12px; cursor: pointer;
  text-align: center; transition: all .15s; font-family: var(--font-body);
}
.sidebar-logout:hover { background: var(--error-dim); color: var(--error); border-color: var(--error-glow); }

.main { flex: 1; padding: 28px 32px; overflow-x: hidden; min-width: 0; }
.page-title {
  font-size: 20px; font-weight: 700; margin-bottom: 20px;
  font-family: var(--font-heading); color: var(--text-bright);
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}

/* Quick links */
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-top: 20px; }
.quick-card {
  padding: 20px; border-radius: var(--radius); text-align: center;
  cursor: pointer; transition: all .2s;
  text-decoration: none; color: var(--text); display: block;
  background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.quick-card:hover {
  transform: translateY(-3px); text-decoration: none;
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 200, 255, 0.12);
}
.quick-card .icon { font-size: 26px; margin-bottom: 8px; }
.quick-card .label { font-size: 12px; font-weight: 600; color: var(--text); font-family: var(--font-heading); }

/* ── MODULE READER ─────────────────────────────────── */
.module-header {
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.module-header h1 {
  font-size: clamp(18px, 4vw, 24px); font-weight: 700;
  margin-top: 10px; line-height: 1.3;
  font-family: var(--font-heading); color: var(--text-bright);
}
.back-link {
  font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); padding: 6px 14px; border-radius: 8px;
  transition: all .15s;
}
.back-link:hover { color: var(--primary); border-color: var(--border-hover); background: var(--primary-dim); }

.content-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px;
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
}
.content-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,200,255,0.4), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Complete bar */
.complete-bar {
  position: sticky; bottom: 0;
  background: rgba(4, 10, 26, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 12px 0; margin-top: 32px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4), 0 -1px 0 var(--border);
}
.complete-bar .inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.nav-modules { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── MODAL ─────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: rgba(6, 14, 38, 0.97);
  backdrop-filter: blur(24px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 40px var(--primary-glow);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px;
}
.modal-header h3 {
  font-size: 16px; font-weight: 700; color: var(--text-bright);
  font-family: var(--font-heading);
}
.modal-close {
  background: none; border: 1px solid var(--border); cursor: pointer;
  font-size: 18px; color: var(--muted); padding: 4px 10px;
  border-radius: 6px; transition: all .15s; line-height: 1; min-height: 0;
}
.modal-close:hover { background: var(--primary-dim); color: var(--primary); border-color: var(--border-hover); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* ── SIDEBAR LAYOUT (non-admin) ─────────────────────────────────── */
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; padding: 24px 0; }
.sidebar { position: sticky; top: 80px; align-self: start; }
.sidebar nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; color: var(--muted); margin-bottom: 4px; transition: all .15s;
  border: 1px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: var(--primary-dim); color: var(--primary); border-color: var(--border);
  text-decoration: none;
}

/* ── TOAST ─────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 16px; z-index: 9999; }
.toast {
  padding: 13px 18px; border-radius: 10px; font-size: 13px;
  margin-top: 8px; font-weight: 500;
  animation: toastIn .3s ease;
  max-width: min(320px, calc(100vw - 32px));
  border: 1px solid;
  backdrop-filter: blur(16px);
}
.toast-success {
  background: rgba(0, 40, 20, 0.95); color: var(--success);
  border-color: rgba(0, 232, 135, 0.3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 20px var(--success-glow);
}
.toast-error {
  background: rgba(40, 5, 10, 0.95); color: var(--error);
  border-color: rgba(255, 68, 102, 0.3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 20px var(--error-glow);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ── SPINNER ─────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid rgba(0, 200, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
  box-shadow: 0 0 10px var(--primary-glow);
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 40px; }

/* ── CERT BANNER ─────────────────────────────────── */
.cert-banner {
  background: linear-gradient(135deg, rgba(139,92,246,0.15) 0%, rgba(0,200,255,0.1) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--text-bright); border-radius: var(--radius); padding: 28px 24px;
  text-align: center; position: relative; overflow: hidden;
}
.cert-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 50%, rgba(139,92,246,0.15), transparent 60%);
  pointer-events: none;
}
.cert-banner h3 { font-size: 19px; margin-bottom: 8px; font-family: var(--font-heading); color: var(--text-bright); }
.cert-banner p { font-size: 13px; opacity: .85; margin-bottom: 20px; }
.cert-banner-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cert-banner-actions .btn { min-width: 180px; }

/* ── VERIFY PAGE ─────────────────────────────────── */
.cert-detail {
  background: rgba(0, 200, 255, 0.04);
  border: 1px solid rgba(0, 200, 255, 0.2);
  border-radius: 10px; padding: 20px; margin: 20px 0; text-align: left;
}
.cert-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; gap: 12px;
}
.cert-row:last-child { border-bottom: none; }
.cert-key { color: var(--muted); font-weight: 500; flex-shrink: 0; }
.cert-val { font-weight: 600; color: var(--text-bright); text-align: right; word-break: break-all; }

/* ── ADMIN TABLE → CARD (mobile) ─────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  nav { padding: 0 16px; }
  .admin-topbar { display: flex; }
  .admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh;
    transform: translateX(-100%);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-layout { flex-direction: column; }
  .main { padding: 16px; }
  .content-card { padding: 20px 18px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; max-height: 88vh; max-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 26px; }
  .complete-bar .inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .nav-modules { width: 100%; gap: 8px; }
  .nav-modules .btn { flex: 1; justify-content: center; }
  #complete-status { text-align: center; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .card { padding: 18px 16px; }
  .nav-brand { font-size: 12px; letter-spacing: .5px; }
  .module-item { padding: 13px 14px; gap: 12px; }
  .module-num { width: 34px; height: 34px; font-size: 12px; border-radius: 8px; }
  .module-title { font-size: 13px; }
  .cert-banner { padding: 20px 16px; }
  .cert-banner h3 { font-size: 16px; }
  .cert-banner-actions { flex-direction: column; align-items: stretch; }
  .cert-banner-actions .btn { min-width: unset; width: 100%; }
  .stats-grid { gap: 8px; }
  .quick-links { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .quick-card { padding: 16px 12px; }
  .quick-card .icon { font-size: 22px; }
  .main { padding: 12px; }
  .content-card { padding: 16px 14px; }

  .admin-table-responsive table,
  .admin-table-responsive thead,
  .admin-table-responsive tbody,
  .admin-table-responsive tr,
  .admin-table-responsive th,
  .admin-table-responsive td { display: block; width: 100%; }
  .admin-table-responsive thead { display: none; }
  .admin-table-responsive tr {
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 12px; background: var(--surface); overflow: hidden;
  }
  .admin-table-responsive td {
    display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap;
    padding: 11px 14px; border-bottom: 1px solid var(--border);
    font-size: 12px; gap: 8px; min-height: 44px;
  }
  .admin-table-responsive td:last-child { border-bottom: none; }
  .admin-table-responsive td[data-label]::before {
    content: attr(data-label);
    font-size: 9px; font-weight: 700; color: var(--primary);
    text-transform: uppercase; letter-spacing: .8px; flex-shrink: 0; min-width: 72px;
    font-family: var(--font-heading);
  }
  .admin-table-responsive .td-actions { justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  .admin-table-responsive .td-actions::before { display: none; }
  .admin-table-responsive td.td-span { justify-content: center; text-align: center; }
  .admin-table-responsive td.td-span::before { display: none; }
  .admin-table-responsive .td-progress { flex-direction: column; align-items: flex-start; gap: 4px; }
  .admin-table-responsive .td-progress::before { min-width: unset; }
  .admin-table-responsive .td-progress-bar { width: 100%; }
}
