/* ═══════════════════════════════════════════════════════════════
   TALENTH LMS — application styles
   Mobile-first. Desktop layout preserved from the approved design.
   Every class name from the original dashboard is kept so markup
   and future refactors stay compatible.
   ═══════════════════════════════════════════════════════════════ */

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-background-tertiary);
  line-height: var(--leading-normal);
  overscroll-behavior-y: none;
}

button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; } /* 16px stops iOS zoom */
img, video { max-width: 100%; display: block; }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ───────────────────────────── AUTH SCREEN ───────────────────── */

.auth-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background: var(--dark);
  background-image:
    linear-gradient(rgba(0,163,180,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,163,180,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  padding: var(--s-5);
  padding-top: calc(var(--s-5) + var(--safe-top));
  padding-bottom: calc(var(--s-5) + var(--safe-bottom));
}

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--color-background-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--s-7) var(--s-6);
  box-shadow: var(--shadow-lg);
}

.auth-logo { font-size: 22px; font-weight: 600; color: var(--navy); }
.auth-logo b { color: var(--cyan); font-weight: 600; }
.auth-sub { font-size: var(--text-sm); color: var(--color-text-secondary); margin: var(--s-1) 0 var(--s-6); }

.auth-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--color-border-tertiary); margin-bottom: var(--s-5); }
.auth-tab {
  flex: 1; padding: var(--s-3) 0; background: none; border: none;
  border-bottom: 2px solid transparent; font-size: var(--text-base);
  font-weight: 500; color: var(--color-text-secondary); cursor: pointer;
}
.auth-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

.field { margin-bottom: var(--s-4); }
.field label {
  display: block; font-size: var(--text-xs); font-weight: 500;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--color-text-secondary); margin-bottom: var(--s-1);
}
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  transition: border-color var(--dur-fast) var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,163,180,0.15);
}
.field-error { font-size: var(--text-xs); color: var(--red-fg); margin-top: var(--s-1); display: none; }
.field.invalid input { border-color: var(--red-fg); }
.field.invalid .field-error { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 var(--s-5);
  border: none; border-radius: var(--border-radius-md);
  font-size: var(--text-md); font-weight: 500; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--cyan); color: #fff; }
.btn-primary:hover { background: var(--cyan-hover); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-hover); }
.btn-ghost { background: transparent; color: var(--cyan); border: 1.5px solid var(--cyan); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--s-4); font-size: var(--text-sm); }

.btn .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite; display: none;
}
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-label { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-divider {
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-5) 0; color: var(--color-text-tertiary); font-size: var(--text-xs);
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; border-top: 1px solid var(--color-border-tertiary);
}
.auth-note {
  margin-top: var(--s-5); font-size: var(--text-sm);
  color: var(--color-text-secondary); text-align: center;
}
.auth-note button { background: none; border: none; color: var(--cyan); cursor: pointer; font-size: inherit; }

.demo-banner {
  margin-top: var(--s-5); padding: var(--s-3);
  background: var(--blue-bg); color: var(--blue-fg);
  border-radius: var(--border-radius-md); font-size: var(--text-sm);
  line-height: 1.5;
}

/* ───────────────────────────── APP SHELL ─────────────────────── */

.app { display: none; }
.app.active { display: block; }
.auth-screen.hidden { display: none; }

.lms {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
  background: var(--color-background-tertiary);
}

/* ── Sidebar (desktop) / drawer (mobile) ── */

.sidebar {
  background: var(--navy);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0;
  width: min(82vw, 300px);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform var(--dur-slow) var(--ease);
  padding-top: var(--safe-top);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(10,37,64,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-med) var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sidebar-logo { padding: 18px 16px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo span { font-size: 16px; font-weight: 500; color: #fff; }
.sidebar-logo span b { color: var(--cyan); font-weight: 500; }
.sidebar-logo small {
  display: block; font-size: 10px; color: rgba(255,255,255,0.35);
  margin-top: 2px; letter-spacing: 0.5px;
}

.sidebar-user {
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.user-av {
  width: 36px; height: 36px; border-radius: 50%; background: var(--cyan);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: #fff; line-height: 1.2; }
.user-school { font-size: 11px; color: rgba(255,255,255,0.45); }

.nav-section {
  padding: 14px 16px 6px; font-size: 10px; font-weight: 500;
  letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,0.3);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 0 16px;
  font-size: 13px; color: rgba(255,255,255,0.6);
  background: none; border: none; border-left: 2px solid transparent;
  cursor: pointer; text-align: left;
  transition: color var(--dur-fast), background var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; border-left-color: var(--cyan); background: rgba(0,163,180,0.12); }
.nav-icon { width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--cyan); color: #fff;
  font-size: 10px; font-weight: 500; padding: 1px 7px;
  border-radius: var(--border-radius-full);
}
.nav-badge:empty { display: none; }

.sidebar-footer { margin-top: auto; padding: 16px; }
.cohort-box {
  background: rgba(0,163,180,0.1); border: 1px solid rgba(0,163,180,0.25);
  border-radius: var(--border-radius-md); padding: 12px;
}
.cohort-box .k { font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.cohort-box .v { font-size: 18px; font-weight: 500; color: var(--cyan); }
.cohort-box .s { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 2px; }

.signout-btn {
  width: 100%; margin-top: var(--s-3); min-height: 40px;
  background: none; border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--border-radius-md); color: rgba(255,255,255,0.6);
  font-size: 12px; cursor: pointer;
}
.signout-btn:hover { color: #fff; border-color: rgba(255,255,255,0.35); }

/* ── Main column ── */

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--color-background-primary);
  border-bottom: 1px solid var(--color-border-tertiary);
  padding: 0 var(--s-4);
  padding-top: var(--safe-top);
  height: calc(var(--topbar-h) + var(--safe-top));
  display: flex; align-items: center; gap: var(--s-3);
}
.topbar-title { font-size: 15px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: var(--s-2); }

.menu-btn, .notif-btn, .icon-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: var(--color-background-primary);
  position: relative; color: var(--color-text-secondary); font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
.notif-dot {
  width: 8px; height: 8px; background: var(--cyan); border-radius: 50%;
  position: absolute; top: 8px; right: 8px;
  border: 1.5px solid var(--color-background-primary);
  display: none;
}
.notif-dot.show { display: block; }

.search-box {
  display: none; flex: 1; max-width: 320px;
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-md);
  padding: 8px 12px; align-items: center; gap: 8px;
}
.search-box input {
  border: none; background: none; outline: none; width: 100%;
  font-size: 13px; color: var(--color-text-primary);
}

.content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--s-4);
  padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + var(--s-5));
  max-width: var(--content-max); width: 100%; margin: 0 auto;
}

.view { display: none; animation: viewIn var(--dur-med) var(--ease); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Bottom navigation (mobile only) ── */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex;
  background: var(--color-background-primary);
  border-top: 1px solid var(--color-border-tertiary);
  padding-bottom: var(--safe-bottom);
  height: calc(var(--bottomnav-h) + var(--safe-bottom));
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  font-size: 10px; font-weight: 500; color: var(--color-text-tertiary);
  -webkit-tap-highlight-color: transparent;
}
.bnav-item .bnav-ico { font-size: 18px; line-height: 1; }
.bnav-item.active { color: var(--cyan); }

/* ───────────────────────────── COMPONENTS ────────────────────── */

.card {
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: var(--s-4);
}
.card-title { font-size: 13px; font-weight: 500; margin-bottom: 14px; }

.stat-card {
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 14px 16px;
}
.stat-label { font-size: 11px; color: var(--color-text-secondary); margin-bottom: 4px; }
.stat-val { font-size: 22px; font-weight: 500; }
.stat-val.accent { color: var(--cyan); }
.stat-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; }

.progress-bar-bg { background: var(--color-background-secondary); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: var(--cyan); transition: width var(--dur-slow) var(--ease); }

.badge {
  display: inline-block; font-size: 10px; font-weight: 500;
  padding: 2px 9px; border-radius: var(--border-radius-full);
}
.badge-cyan  { background: var(--green-bg); color: var(--green-fg); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-red   { background: var(--red-bg);   color: var(--red-fg); }
.badge-lime  { background: var(--lime-bg);  color: var(--lime-fg); }
.badge-gray  { background: var(--color-background-secondary); color: var(--color-text-secondary); }

.course-card {
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: var(--s-4); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.course-card:hover { border-color: var(--cyan); }
.course-card:active { transform: scale(0.99); }
.course-thumb {
  height: 88px; background: var(--dark);
  border-radius: var(--border-radius-md); margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--cyan);
}

.filter-pill {
  min-height: 36px; padding: 0 14px; border-radius: var(--border-radius-full);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--color-border-secondary);
  color: var(--color-text-secondary); background: var(--color-background-primary);
  cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.filter-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.school-filter {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: var(--s-4); scrollbar-width: none;
}
.school-filter::-webkit-scrollbar { display: none; }

.tab-row {
  display: flex; gap: 0; border-bottom: 1px solid var(--color-border-tertiary);
  margin-bottom: var(--s-4); overflow-x: auto; scrollbar-width: none;
}
.tab-row::-webkit-scrollbar { display: none; }
.inner-tab {
  min-height: 40px; padding: 0 14px; font-size: 12px; font-weight: 500;
  cursor: pointer; color: var(--color-text-secondary);
  border: none; border-bottom: 2px solid transparent; background: none;
  white-space: nowrap;
}
.inner-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.lesson-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 12px;
  border-radius: var(--border-radius-md); cursor: pointer;
  border: 1px solid transparent; width: 100%;
  background: none; text-align: left;
  transition: background var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.lesson-row:hover { background: var(--color-background-secondary); border-color: var(--color-border-tertiary); }
.lesson-row.active-lesson { background: var(--blue-bg); border-color: var(--cyan); }
.lesson-row.locked { opacity: 0.55; cursor: not-allowed; }
.lesson-icon {
  width: 32px; height: 32px; border-radius: var(--border-radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; background: var(--color-background-secondary);
}
.check-circle {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--color-border-secondary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.check-circle.done { background: var(--cyan); border-color: var(--cyan); }
.check-circle.done::after {
  content: ""; width: 5px; height: 9px;
  border: 1.5px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg); margin-top: -2px;
}

/* ── Custom video player ── */
.video-player {
  background: var(--dark); border-radius: var(--border-radius-lg);
  position: relative; margin-bottom: var(--s-4); overflow: hidden;
  outline: none;
}
.pl-stage {
  aspect-ratio: 16 / 9; max-height: 420px; position: relative;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pl-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.pl-grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(0,163,180,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,163,180,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}
.pl-big-play {
  width: 62px; height: 62px; border-radius: 50%; z-index: 2;
  background: rgba(0,163,180,0.92); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.pl-big-play:hover { transform: scale(1.06); }
.pl-big-play::after {
  content: ""; width: 0; height: 0; border-style: solid;
  border-width: 11px 0 11px 19px;
  border-color: transparent transparent transparent #fff; margin-left: 5px;
}
.pl-big-play.hidden { opacity: 0; pointer-events: none; }
.video-label {
  font-size: 12px; color: rgba(255,255,255,0.55);
  position: absolute; top: 12px; left: 14px; right: 14px; z-index: 2;
  text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.pl-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(0,0,0,0.35);
  font-size: 11px; color: rgba(255,255,255,0.75);
}
.icon-ctrl {
  background: none; border: none; color: rgba(255,255,255,0.85);
  font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
  min-width: 30px;
}
.icon-ctrl:hover { background: rgba(255,255,255,0.12); }
.pl-time-now, .pl-time-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-bar {
  flex: 1; height: 18px; display: flex; align-items: center;
  position: relative; cursor: pointer; touch-action: none;
}
.pl-bar::before {
  content: ""; position: absolute; left: 0; right: 0; height: 4px;
  background: rgba(255,255,255,0.18); border-radius: 3px;
}
.pl-fill {
  position: absolute; left: 0; height: 4px; width: 0%;
  background: var(--cyan); border-radius: 3px;
}
.pl-knob {
  position: absolute; left: 0%; width: 13px; height: 13px; margin-left: -6px;
  background: #fff; border: 2.5px solid var(--cyan); border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.video-player:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.video-player:fullscreen .pl-stage { flex: 1; max-height: none; aspect-ratio: auto; }

.activity-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--color-border-tertiary);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); margin-top: 5px; flex-shrink: 0; }
.activity-title { font-size: 12px; font-weight: 500; }
.activity-meta { font-size: 11px; color: var(--color-text-secondary); }

.leaderboard-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--color-border-tertiary);
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row.me { background: rgba(0,163,180,0.06); border-radius: var(--border-radius-md); padding-left: 8px; }
.rank-num { width: 22px; font-size: 12px; font-weight: 500; color: var(--color-text-secondary); text-align: center; flex-shrink: 0; }
.lboard-av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--navy);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 500; flex-shrink: 0;
}

.cert-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--dark) 100%);
  border-radius: var(--border-radius-lg); padding: var(--s-6);
  text-align: center; position: relative; overflow: hidden; color: #fff;
}
.cert-card.locked-cert {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border-tertiary);
  color: var(--color-text-primary);
}
.cert-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,163,180,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,163,180,0.04) 1px, transparent 1px);
  background-size: 36px 36px;
}
.cert-inner { position: relative; z-index: 1; }
.cert-seal {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--cyan);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; background: rgba(0,163,180,0.12);
  font-size: 22px; color: var(--cyan);
}
.cert-seal.dashed { border: 1.5px dashed var(--color-border-secondary); background: none; color: var(--color-text-secondary); }

.assignment-row {
  border-radius: var(--border-radius-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary);
}
.assignment-row.graded  { background: rgba(234,243,222,0.5); border-color: #97C459; }
.assignment-row.review  { background: rgba(250,238,218,0.5); border-color: #EF9F27; }
.assignment-row.overdue { background: rgba(252,235,235,0.5); border-color: #F09595; }
.assignment-ico { font-size: 20px; flex-shrink: 0; width: 24px; text-align: center; }

/* ── Empty & skeleton states ── */

.empty-state {
  text-align: center; padding: var(--s-8) var(--s-5);
  color: var(--color-text-secondary);
}
.empty-state .ico { font-size: 32px; margin-bottom: var(--s-3); opacity: 0.5; }
.empty-state h3 { font-size: 14px; font-weight: 500; color: var(--color-text-primary); margin-bottom: 4px; }
.empty-state p { font-size: 12px; max-width: 280px; margin: 0 auto var(--s-4); }

.skeleton {
  background: linear-gradient(90deg,
    var(--color-background-secondary) 25%,
    var(--color-background-tertiary) 50%,
    var(--color-background-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--border-radius-md);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Toasts ── */

.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 12px);
  z-index: 100; display: flex; flex-direction: column; gap: 8px;
  width: min(92vw, 380px); pointer-events: none;
}
.toast {
  background: var(--dark); color: #fff;
  border-radius: var(--border-radius-md);
  padding: 12px 16px; font-size: 13px;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn var(--dur-med) var(--ease);
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--cyan); }
.toast.error { border-left: 3px solid #F09595; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.leaving { opacity: 0; transition: opacity var(--dur-med); }

/* ── Connectivity banner ── */

.offline-banner {
  display: none; position: sticky; top: 0; z-index: 45;
  background: var(--amber-bg); color: var(--amber-fg);
  font-size: 12px; font-weight: 500; text-align: center; padding: 7px 12px;
}
body.is-offline .offline-banner { display: block; }

/* ── Layout grids: mobile first ── */

.grid-stats  { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: var(--s-5); }
.grid-2      { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-courses{ display: grid; grid-template-columns: 1fr; gap: 12px; }
.learn-layout{ display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
.community-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }

.hide-mobile { display: none; }

/* ───────────────────────────── BREAKPOINTS ───────────────────── */

@media (min-width: 640px) {
  .grid-stats { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .grid-courses { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .content { padding: var(--s-5); padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + var(--s-6)); }
}

@media (min-width: 1024px) {
  /* Desktop: persistent sidebar, no drawer, no bottom nav — the approved layout */
  .lms { grid-template-columns: var(--sidebar-w) 1fr; }
  .sidebar {
    position: sticky; top: 0; height: 100dvh;
    transform: none; width: auto; box-shadow: none;
  }
  .scrim { display: none; }
  .menu-btn { display: none; }
  .bottom-nav { display: none; }
  .search-box { display: flex; }
  .hide-mobile { display: revert; }
  .content { padding: var(--s-5) var(--s-6); padding-bottom: var(--s-7); }
  .toast-stack { bottom: 24px; }
  .grid-courses { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .learn-layout { grid-template-columns: 1fr 280px; align-items: start; }
  .community-layout { grid-template-columns: 1fr 230px; align-items: start; }
}

@media (min-width: 1280px) {
  .grid-courses { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

/* ── Install prompt chip ── */
.install-chip {
  display: none; align-items: center; gap: 10px;
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 12px 14px; margin-bottom: var(--s-4);
}
.install-chip.show { display: flex; }
.install-chip .t { flex: 1; font-size: 12px; color: var(--color-text-secondary); }
.install-chip .t b { display: block; font-size: 13px; color: var(--color-text-primary); font-weight: 500; }

/* ═══════════════════ PHASES 2–6 ADDITIONS ═══════════════════ */

/* ── Notifications panel ── */
.topbar-right { position: relative; }
.notif-count {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
  background: var(--cyan); color: #fff; font-size: 9px; font-weight: 500;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px; pointer-events: none;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(340px, calc(100vw - 24px));
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary); border-radius: var(--border-radius-lg);
  box-shadow: 0 12px 34px rgba(10,37,64,0.16); z-index: 90;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.notif-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.notif-head {
  font-size: 12px; font-weight: 500; padding: 12px 14px;
  border-bottom: 1px solid var(--color-border-tertiary);
}
.notif-list { max-height: min(380px, 60vh); overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--color-border-tertiary);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(0,163,180,0.05); }
.notif-ico {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--blue-bg); color: var(--navy);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.notif-item.unread .notif-ico { background: var(--cyan); color: #fff; }
.notif-title { font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.notif-body { font-size: 11px; color: var(--color-text-secondary); line-height: 1.5; }
.notif-when { font-size: 10px; color: var(--color-text-secondary); margin-top: 3px; }

/* ── Modals ── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,37,64,0.55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease);
  padding: 0;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--color-background-primary); width: 100%;
  max-width: 480px; max-height: 92dvh; display: flex; flex-direction: column;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  transform: translateY(24px); transition: transform var(--dur-med) var(--ease);
}
.modal.open .modal-card { transform: none; }
.modal-wide { max-width: 620px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--color-border-tertiary);
}
.modal-title { font-size: 15px; font-weight: 500; }
.modal-body { padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
body.modal-open { overflow: hidden; }
@media (min-width: 700px) {
  .modal { align-items: center; padding: 24px; }
  .modal-card { border-radius: var(--border-radius-lg); }
}

/* ── File drop zone ── */
.drop-zone {
  border: 1.5px dashed var(--color-border-secondary);
  border-radius: var(--border-radius-md); padding: 22px 14px;
  text-align: center; cursor: pointer; font-size: 13px;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.drop-zone small { display: block; margin-top: 5px; font-size: 11px; color: var(--color-text-secondary); }
.drop-zone.drag, .drop-zone:hover { border-color: var(--cyan); background: rgba(0,163,180,0.04); }
.drop-zone.has-file { border-style: solid; border-color: var(--cyan); background: rgba(0,163,180,0.06); }

.grade-box {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--lime-bg, #EDFBEB); border-radius: var(--border-radius-md);
  padding: 14px; margin-bottom: 14px;
}
.grade-num { font-size: 28px; font-weight: 500; color: #0F6E56; line-height: 1; }
.grade-num span { font-size: 12px; color: var(--color-text-secondary); font-weight: 400; }
.grade-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; color: #0F6E56; margin-bottom: 4px; }
.grade-feedback { font-size: 12px; color: var(--color-text-secondary); line-height: 1.65; }
.review-box {
  background: var(--amber-bg, #FBF3E0); border-radius: var(--border-radius-md);
  padding: 14px; margin-bottom: 14px;
}
.review-box p { font-size: 12px; color: var(--color-text-secondary); line-height: 1.65; margin-top: 8px; }

/* ── Quiz engine ── */
.quiz-timer {
  font-size: 12px; color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums; margin-top: 3px;
}
.quiz-timer.danger { color: var(--red-fg); font-weight: 500; }
.quiz-progress { display: flex; gap: 5px; margin-bottom: 14px; flex-wrap: wrap; }
.q-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--color-border-secondary);
}
.q-dot.done { background: var(--navy); }
.q-dot.now { background: var(--cyan); transform: scale(1.25); }
.quiz-count { font-size: 11px; color: var(--color-text-secondary); margin-bottom: 8px; }
.quiz-q { font-size: 15px; font-weight: 500; line-height: 1.5; margin-bottom: 16px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.quiz-opt {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary); border-radius: var(--border-radius-md);
  padding: 12px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
  color: var(--color-text-primary);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.quiz-opt:hover { border-color: var(--cyan); }
.quiz-opt.picked { border-color: var(--cyan); background: rgba(0,163,180,0.07); }
.opt-mark { color: var(--cyan); flex-shrink: 0; }
.quiz-nav { display: flex; gap: 10px; justify-content: flex-end; }
.quiz-nav .btn { min-width: 110px; }
.quiz-result { text-align: center; padding: 8px 0 18px; }
.quiz-score { font-size: 42px; font-weight: 500; line-height: 1; }
.quiz-result.pass .quiz-score { color: #0F6E56; }
.quiz-result.fail .quiz-score { color: var(--red-fg); }
.quiz-verdict { font-size: 13px; font-weight: 500; margin: 6px 0 8px; text-transform: uppercase; letter-spacing: 1.5px; }
.quiz-note { font-size: 12px; color: var(--color-text-secondary); line-height: 1.65; max-width: 380px; margin: 0 auto; }
.quiz-review { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.review-item {
  border: 1px solid var(--color-border-tertiary); border-left-width: 3px;
  border-radius: var(--border-radius-md); padding: 11px 13px;
}
.review-item.ok { border-left-color: #0F6E56; }
.review-item.bad { border-left-color: var(--red-fg); }
.review-q { font-size: 12px; font-weight: 500; margin-bottom: 5px; }
.review-a { font-size: 11px; color: var(--color-text-secondary); margin-bottom: 3px; }
.review-why { font-size: 11px; color: var(--color-text-secondary); line-height: 1.55; font-style: italic; margin-top: 4px; }

/* ── Admin tables ── */
.table-head, .table-row {
  display: grid; grid-template-columns: 1.6fr 1fr 0.9fr 0.9fr auto;
  gap: 10px; align-items: center; padding: 11px 4px;
}
.table-head {
  font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-tertiary);
}
.table-row { border-bottom: 1px solid var(--color-border-tertiary); }
.table-row:last-child { border-bottom: none; }
.table-row.inactive { opacity: 0.5; }
.payments-grid { grid-template-columns: 1.3fr 1fr 0.9fr 0.8fr auto; }
.role-select {
  font-size: 12px; padding: 6px 8px; border-radius: var(--border-radius-sm, 6px);
  border: 1px solid var(--color-border-secondary);
  background: var(--color-background-primary); color: var(--color-text-primary);
  font-family: inherit; cursor: pointer;
}
@media (max-width: 640px) {
  .table-head, .table-row { grid-template-columns: 1.4fr auto auto; }
  .table-head span.hide-mobile, .table-row span.hide-mobile { display: none; }
}

/* ── Settings selects/textareas + preference toggles ── */
.field select {
  width: 100%; padding: 11px 12px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-md);
  background: var(--color-background-primary); color: var(--color-text-primary);
}
.pref-toggle {
  width: 40px; height: 22px; border: none; border-radius: 11px;
  background: var(--color-border-secondary); position: relative; cursor: pointer;
  transition: background var(--dur-fast) var(--ease); flex-shrink: 0;
}
.pref-toggle span {
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  position: absolute; left: 2px; top: 2px;
  transition: transform var(--dur-fast) var(--ease);
  box-shadow: 0 1px 3px rgba(10,37,64,0.25);
}
.pref-toggle[aria-checked="true"] { background: var(--cyan); }
.pref-toggle[aria-checked="true"] span { transform: translateX(18px); }

/* ── Grading rows ── */
.grading-row { cursor: pointer; font-family: inherit; }
.grading-row:hover { border-color: var(--cyan); }

/* ═══════════ Native-feel: theme, SVG icons, view transitions ═══════════ */
.nav-icon svg, .bnav-ico svg { width: 18px; height: 18px; display: block; }
.nav-icon, .bnav-ico { display: flex; align-items: center; justify-content: center; }
.notif-btn [data-ico] svg, #theme-ico svg { width: 19px; height: 19px; display: block; }
.notif-btn { display: flex; align-items: center; justify-content: center; }

.view.active { animation: view-in .28s cubic-bezier(.16,.84,.44,1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.bottom-nav { min-height: 60px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
.bnav-item { min-width: 56px; padding-top: 8px; gap: 3px; }
.bnav-item:active { transform: scale(.94); }
.nav-item, .btn, .assignment-row { -webkit-tap-highlight-color: transparent; }
.nav-item:active { transform: scale(.985); }

[data-theme="dark"] .video-player { box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }
[data-theme="dark"] .demo-banner { background: rgba(0,163,180,0.12); color: var(--color-text-primary); }
[data-theme="dark"] .auth-card { box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
@media (prefers-reduced-motion: reduce) { .view.active { animation: none; } }

/* ═══════════ Owner connect + demo transparency ═══════════ */
.owner-connect { margin-top: 14px; border-top: 1px solid var(--color-border-tertiary); padding-top: 12px; }
.owner-connect summary { font-size: 12.5px; color: var(--color-text-secondary); cursor: pointer; font-weight: 600; }
.owner-connect summary:hover { color: var(--navy, #003366); }
.owner-connect[open] summary { margin-bottom: 10px; }
.oc-note { font-size: 11.5px; color: var(--color-text-secondary); line-height: 1.6; margin-bottom: 10px; }
.oc-note code { font-size: 10.5px; background: var(--color-background-secondary); padding: 1px 5px; border-radius: 4px; }
.owner-connect input { width: 100%; padding: 10px 12px; border: 1px solid var(--color-border-tertiary);
  border-radius: 8px; font-size: 12.5px; margin-bottom: 8px; font-family: inherit;
  background: var(--color-background-primary); color: var(--color-text-primary); }
.oc-err { font-size: 12px; color: var(--red-fg, #B3261E); margin-top: 8px; }
.demo-pill { background: var(--amber-bg); color: var(--amber-fg); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; padding: 4px 10px; border-radius: 999px; margin-left: 10px; flex-shrink: 0; }

/* ═══════════ Wave 1: search, notes, exports ═══════════ */
.topbar-search { position: relative; }
.search-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 95;
  background: var(--color-background-primary); border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg); box-shadow: 0 20px 48px -16px rgba(10,37,64,0.35);
  max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; }
.sr-group { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-text-secondary); padding: 8px 10px 4px; }
.sr-item { display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.sr-item:hover, .sr-item:focus { background: var(--color-background-secondary); }
.sr-item b { display: block; font-size: 12.5px; font-weight: 500; color: var(--color-text-primary); }
.sr-item small { font-size: 11px; color: var(--color-text-secondary); }
.sr-empty { padding: 16px 10px; font-size: 12px; color: var(--color-text-secondary); text-align: center; }

.bm-btn { display: inline-flex; align-items: center; gap: 6px; background: none;
  border: 1px solid var(--color-border-tertiary); border-radius: 999px; padding: 6px 14px;
  font-size: 12px; font-weight: 600; color: var(--color-text-secondary); cursor: pointer;
  font-family: inherit; transition: color .2s, border-color .2s, background .2s; }
.bm-btn svg { width: 14px; height: 14px; }
.bm-btn[aria-pressed="true"] { color: var(--amber-fg); border-color: var(--amber-fg);
  background: var(--amber-bg); }
.bm-btn[aria-pressed="true"] svg { fill: currentColor; }
.note-area { width: 100%; border: 1px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-md); padding: 12px; font-family: inherit; font-size: 13px;
  line-height: 1.7; resize: vertical; background: var(--color-background-primary);
  color: var(--color-text-primary); }
.note-area:focus { outline: 2px solid var(--cyan, #00A3B4); outline-offset: -1px; }
.note-hint { font-size: 11px; color: var(--color-text-secondary); margin-top: 6px; min-height: 15px; }
.note-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--color-border-tertiary); cursor: pointer; }
.note-row:last-child { border-bottom: none; }
.note-row .nr-star { color: var(--amber-fg); flex-shrink: 0; width: 15px; margin-top: 2px; }
.note-row .nr-star svg { width: 15px; height: 15px; fill: currentColor; }
.note-row b { display: block; font-size: 12.5px; font-weight: 500; }
.note-row p { font-size: 11.5px; color: var(--color-text-secondary); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.export-btn { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.export-btn svg { width: 14px; height: 14px; }
.cert-code { font-size: 10px; letter-spacing: 0.08em; color: rgba(255,255,255,0.45);
  margin-bottom: 10px; font-variant-numeric: tabular-nums; }

/* ═══════════ Wave 2: reviews, rubric, attendance, analytics ═══════════ */
.star-row { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.star-row button { background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--color-border-secondary); transition: transform .15s, color .15s; }
.star-row button svg { width: 30px; height: 30px; fill: currentColor; stroke: currentColor; }
.star-row button.lit { color: var(--amber-fg); }
.star-row button:hover { transform: scale(1.15); }
.rate-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
  font-weight: 600; color: var(--amber-fg); }
.rate-badge svg { width: 12px; height: 12px; fill: currentColor; }
.rate-btn { background: none; border: none; font-size: 11px; color: var(--cyan, #00A3B4);
  cursor: pointer; font-weight: 600; font-family: inherit; padding: 0; }
.rubric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rubric-grid label { font-size: 10.5px; font-weight: 600; color: var(--color-text-secondary);
  display: flex; flex-direction: column; gap: 4px; }
.rubric-grid input { width: 100%; padding: 9px 10px; border: 1px solid var(--color-border-tertiary);
  border-radius: 8px; font-family: inherit; font-size: 13px; text-align: center;
  background: var(--color-background-primary); color: var(--color-text-primary); }
.rubric-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rubric-chips span { font-size: 10.5px; font-weight: 600; background: var(--blue-bg);
  color: var(--blue-fg); padding: 3px 9px; border-radius: 999px; }
.checkin-btn { font-size: 11px; padding: 6px 12px; margin-top: 8px; }
.checkin-btn.done { background: var(--lime-bg); color: var(--lime-fg); border: none; cursor: default; }
.funnel-chip { flex: 1; min-width: 90px; text-align: center; background: var(--color-background-secondary);
  border-radius: var(--border-radius-md); padding: 12px 8px; }
.funnel-chip b { display: block; font-size: 20px; font-weight: 600; }
.funnel-chip small { font-size: 10.5px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .06em; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--color-border-tertiary); font-size: 12.5px; }
.top-row:last-child { border-bottom: none; }
.top-row .rank { width: 20px; font-weight: 700; color: var(--color-text-secondary); }
.top-row .pts { margin-left: auto; font-weight: 600; color: var(--cyan, #00A3B4); }

/* Wave 3: shortcuts help */
.kbd-row { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--color-border-tertiary); font-size: 12.5px; }
.kbd-row:last-child { border-bottom: none; }
kbd { background: var(--color-background-secondary); border: 1px solid var(--color-border-tertiary);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; font-family: inherit;
  font-size: 11px; font-weight: 600; }

/* Wave 6: classroom era */
.classroom-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
  font-weight: 600; color: var(--lime-fg); text-decoration: none; }
.classroom-chip svg { width: 12px; height: 12px; }
.classroom-chip:hover { text-decoration: underline; }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
#view-classes .btn-sm svg { width: 13px; height: 13px; vertical-align: -2px; }

/* In-app recording player */
.rec-frame { position: relative; width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: var(--border-radius-md); overflow: hidden; }
.rec-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rec-note { font-size: 11px; color: var(--color-text-secondary); margin-top: 10px; text-align: center; }
.rec-note a { color: var(--cyan, #00A3B4); }

/* ═══ The live stage: docked INSIDE the dashboard ═══
   Expanded: fills the content area (sidebar + topbar stay usable).
   Minimised: floats bottom-right so teaching continues while you
   grade, check members, or browse — the stream never reloads. */
.live-stage { position: fixed; z-index: 120; background: #0A1420; display: none;
  flex-direction: column; border-radius: 0;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.6); overflow: hidden; }
.live-stage.open { display: flex; top: 58px; left: var(--sidebar-w); right: 0; bottom: 0; }
.live-stage.open.mini { top: auto; left: auto; right: 16px; bottom: 76px;
  width: min(380px, calc(100vw - 32px)); height: 260px; border-radius: 16px; }
.live-stage.mini .live-panel { display: none; }
.live-stage.mini .live-head small, .live-stage.mini #live-elapsed { display: none; }
@media (max-width: 860px) { .live-stage.open { left: 0; top: 54px; bottom: 62px; } }
.live-head { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 14px; color: #fff; background: #0A2540; flex-shrink: 0; }
.lh-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #FF5A5A;
  animation: livepulse 1.6s infinite; flex-shrink: 0; }
@keyframes livepulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }
.live-head b { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-head small { font-size: 10.5px; color: rgba(255,255,255,0.55); }
.lh-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.live-elapsed { font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.7); }
.live-body { flex: 1; display: flex; min-height: 0; }
#live-container { flex: 1; min-width: 0; }
#live-container iframe { width: 100%; height: 100%; border: 0; }
.live-panel { width: 190px; flex-shrink: 0; background: #0E1B2C; color: #fff;
  padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
@media (max-width: 1020px) { .live-panel { display: none; } }
.lp-stat b { font-size: 22px; font-weight: 600; display: block; color: var(--cyan, #00A3B4); }
.lp-stat small { font-size: 10px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.08em; }
.lp-roster-title { font-size: 10px; color: rgba(255,255,255,0.5); text-transform: uppercase;
  letter-spacing: 0.08em; margin-top: 6px; }
.lp-roster { display: flex; flex-direction: column; gap: 6px; }
.lp-roster span { font-size: 11.5px; color: rgba(255,255,255,0.85); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }

/* Publish-recording modal */
.recu-drop { display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px dashed var(--color-border-secondary); border-radius: var(--border-radius-md);
  padding: 22px 14px; cursor: pointer; text-align: center; transition: border-color .2s; }
.recu-drop:hover { border-color: var(--cyan, #00A3B4); }
.recu-drop svg { width: 22px; height: 22px; color: var(--cyan, #00A3B4); }
.recu-drop b { font-size: 13px; }
.recu-drop small { font-size: 11px; color: var(--color-text-secondary); }
.recu-progress { height: 6px; background: var(--color-background-secondary);
  border-radius: 999px; margin-top: 10px; overflow: hidden; }
.recu-progress div { height: 100%; width: 0; background: var(--cyan, #00A3B4); transition: width .3s; }
.rec-frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

.live-error[hidden] { display: none !important; }   /* author display beats [hidden] otherwise */
.live-error { position: absolute; inset: 48px 0 0; z-index: 5; background: #0A1420;
  color: #fff; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; text-align: center; padding: 24px; }
.live-error b { font-size: 15px; }
.live-error p { font-size: 12px; color: rgba(255,255,255,0.6); max-width: 420px; line-height: 1.7; }
.live-error code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 4px; font-size: 11px; }

/* ═══ Talenth Live: the built-in classroom ═══ */
.tl-grid { position: absolute; inset: 0 0 64px; display: grid; gap: 6px; padding: 6px;
  grid-template-columns: 1fr; background: #0A1420; }
.tl-grid[data-n="2"] { grid-template-columns: 1fr 1fr; }
.tl-grid[data-n="3"], .tl-grid[data-n="4"] { grid-template-columns: 1fr 1fr; }
.tl-grid[data-n="5"], .tl-grid[data-n="6"] { grid-template-columns: repeat(3, 1fr); }
.tl-grid[data-n="7"], .tl-grid[data-n="8"], .tl-grid[data-n="9"] { grid-template-columns: repeat(3, 1fr); }
.tl-tile { position: relative; background: #10233A; border-radius: 12px; overflow: hidden; min-height: 0; }
.tl-tile video { width: 100%; height: 100%; object-fit: cover; }
.tl-tile video.tl-mirror { transform: scaleX(-1); }
.tl-tile.tl-off video { visibility: hidden; }
.tl-tile.tl-off::after { content: "Camera off"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: rgba(255,255,255,0.45); font-size: 12px; }
.tl-name { position: absolute; left: 8px; bottom: 8px; background: rgba(10,20,32,0.7);
  color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 999px; }
.tl-controls { position: absolute; left: 0; right: 0; bottom: 0; height: 64px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(transparent, rgba(10,20,32,0.9)); }
.tl-btn { min-width: 44px; height: 44px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 17px; padding: 0 14px;
  transition: background .2s; font-family: inherit; }
.tl-btn:hover { background: rgba(255,255,255,0.22); }
.tl-btn[aria-pressed="false"] { background: rgba(255,90,90,0.85); }
.tl-rec { font-size: 12.5px; font-weight: 600; }
.tl-rec[aria-pressed="true"] { background: #E5484D; animation: livepulse 1.6s infinite; }
#live-container { position: relative; }
.recu-captured { display: flex; gap: 10px; align-items: center; background: var(--lime-bg);
  color: var(--lime-fg); border-radius: var(--border-radius-md); padding: 12px; margin-bottom: 12px; }
.recu-captured svg { width: 18px; height: 18px; flex-shrink: 0; }
.recu-captured b { font-size: 12.5px; display: block; }
.recu-captured small { font-size: 11px; }
.tl-tile.tl-wait::after { content: "Connecting…"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5); font-size: 12px; }

/* Live-learning spine */
.att-chip { display: inline-block; margin-left: 8px; font-size: 11px;
  background: rgba(0,163,180,0.14); color: var(--cyan, #00A3B4);
  padding: 3px 10px; border-radius: 999px; }
.att-chip b { font-weight: 600; }
.mat-slot { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.mat-chip { font-size: 11px; text-decoration: none; color: var(--color-text-primary);
  background: var(--color-background-secondary); border: 1px solid var(--color-border-tertiary);
  padding: 3px 10px; border-radius: 999px; }
.mat-chip:hover { border-color: var(--cyan, #00A3B4); }

/* Materials Studio */
.mat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mat-tile { display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1.5px dashed var(--color-border-secondary); border-radius: var(--border-radius-md);
  padding: 18px 10px; cursor: pointer; text-align: center; background: none;
  font-family: inherit; color: inherit; transition: border-color .2s; }
.mat-tile:hover { border-color: var(--cyan, #00A3B4); }
.mat-tile[aria-pressed="true"] { border-color: #E5484D; background: rgba(229,72,77,0.06); }
.mat-tile[aria-pressed="true"] .mat-ico { animation: livepulse 1.4s infinite; }
.mat-ico { font-size: 20px; }
.mat-tile b { font-size: 12.5px; }
.mat-tile small { font-size: 10.5px; color: var(--color-text-secondary); }
.mat-preview { display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--color-background-secondary); border-radius: var(--border-radius-md); padding: 10px 12px; }
.mat-preview b { font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-preview small { font-size: 10.5px; color: var(--color-text-secondary); }

/* Avatar uploader + avatar rendering */
.settings-av-wrap { position: relative; cursor: pointer; display: inline-block; }
.settings-av-edit { position: absolute; right: -4px; bottom: -4px; font-size: 12px;
  background: var(--color-background-primary); border: 1px solid var(--color-border-tertiary);
  border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.user-av img, .lboard-av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.online-row { display: flex; align-items: center; gap: 8px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #0F6E56; flex-shrink: 0; }

/* Enrolment gate — payment is part of registration */
.gate { position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  background: var(--color-background-secondary); padding: 28px 18px 48px; }
.gate[hidden] { display: none; }
.gate-card { max-width: 760px; margin: 0 auto; background: var(--color-background-primary);
  border: 1px solid var(--color-border-tertiary); border-radius: 18px; padding: 26px; }
.gate-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gate-logo { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.gate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.gate-course { border: 1.5px solid var(--color-border-tertiary); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .2s, box-shadow .2s; }
.gate-course:hover { border-color: var(--cyan); }
.gate-course.picked { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,163,180,.12); }
.gate-course .gc-school { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); font-weight: 600; }
.gate-course .gc-title { font-size: 14.5px; font-weight: 600; }
.gate-course .gc-tools { font-size: 11px; color: var(--color-text-secondary); }
.gate-course .gc-fee { font-size: 18px; font-weight: 600; margin-top: 4px; }
.gate-course .btn { margin-top: auto; }


/* ═══════════ MOBILE & NATIVE-APP POLISH (portal) ═══════════ */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
img, video { max-width: 100%; height: auto; }

@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-stats { grid-template-columns: 1fr !important; }
  .gate-grid { grid-template-columns: 1fr !important; }
  .card { padding: 16px !important; border-radius: 16px !important; }
  input, select, textarea { font-size: 16px !important; min-height: 46px; }
  button, .btn { min-height: 44px; }
  /* Bottom navigation clears the home indicator */
  .bottom-nav { padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important; }
  .view, .main { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
  /* Modals behave like native sheets */
  .modal-card { max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    border-radius: 18px 18px 0 0; }
  .gate { padding: 18px 14px calc(28px + env(safe-area-inset-bottom)); }
  .gate-card { padding: 18px; border-radius: 16px; }
}

@media (hover: none) {
  button:active, .card[role="button"]:active, .nav-item:active { transform: scale(.985); }
  button, .nav-item { transition: transform .12s ease; }
}

/* Clickable dashboard cards */
.stat-card.stat-link { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.stat-card.stat-link:hover { transform: translateY(-2px); border-color: var(--cyan);
  box-shadow: 0 12px 28px -18px rgba(10,37,64,.5); }
.stat-card.stat-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.stat-card.stat-link::after { content: "›"; position: absolute; top: 12px; right: 14px;
  font-size: 16px; color: var(--color-text-secondary); opacity: 0; transition: opacity .15s ease; }
.stat-card.stat-link:hover::after { opacity: 1; }
.stat-card { position: relative; }

/* ═══════════ Wave 22: facilitators, webinars, first-run tour ═══════════ */
.fac-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.fac-h { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.fac-note { font-size: 13px; color: var(--color-text-secondary); margin: 0; line-height: 1.55; }
.fac-note-warn { color: #8A2A22; }
.fac-sub { font-size: 12px; color: var(--color-text-secondary); display: block; }
.fac-row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fac-select { font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--color-border-tertiary); background: var(--color-background-primary); color: var(--color-text-primary); max-width: 320px; }
.fac-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fac-stat { border: 1px solid var(--color-border-tertiary); border-radius: 12px; padding: 12px 14px; background: var(--color-background-primary); }
.fac-stat b { display: block; font-size: 22px; font-weight: 600; }
.fac-stat span { font-size: 12px; color: var(--color-text-secondary); }
.fac-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fac-tab { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border-tertiary); background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.fac-tab.on { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.fac-list { border: 1px solid var(--color-border-tertiary); border-radius: 14px; overflow: hidden; background: var(--color-background-primary); }
.fac-row { display: grid; grid-template-columns: 28px minmax(180px, 1.6fr) minmax(140px, 1.2fr) 130px 110px minmax(200px, 1.5fr); gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--color-border-tertiary); font-size: 13.5px; }
.fac-row:first-child { border-top: 0; }
.fac-head-row { background: var(--color-background-secondary); font-size: 12px; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.fac-team-row { grid-template-columns: minmax(180px, 1.6fr) minmax(140px, 1.2fr) 100px 150px 100px minmax(240px, 2fr); }
.fac-reg-row { grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(160px, 1.2fr) 150px; }
.fac-who b { display: block; }
.fac-score { font-size: 18px; }
.fac-flags { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fac-courses { line-height: 1.5; }
.fac-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fac-actions .btn { font-size: 12px; }
.fac-field { margin-bottom: 12px; }
.fac-field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--color-text-secondary); }
.fac-field input, .fac-field textarea { width: 100%; font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--color-border-tertiary); background: var(--color-background-primary); color: var(--color-text-primary); }
.cred-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.cred-table th, .cred-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--color-border-tertiary); vertical-align: top; }
.cred-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-secondary); }
.cred-pw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--color-background-secondary); padding: 3px 7px; border-radius: 6px; user-select: all; }

.fac-tour { position: fixed; inset: 0; background: rgba(10, 37, 64, .45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; z-index: 900; }
.fac-tour-card { background: var(--color-background-primary); color: var(--color-text-primary); border-radius: 18px; padding: 20px; width: 100%; max-width: 440px; box-shadow: 0 18px 48px rgba(10, 37, 64, .3); }
.fac-tour-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--color-text-secondary); }
.fac-tour-skip { background: none; border: 0; color: var(--color-text-secondary); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.fac-tour-ico { width: 52px; height: 52px; border-radius: 14px; background: #E6F7F9; color: var(--cyan); display: flex; align-items: center; justify-content: center; font-size: 22px; margin: 14px 0 10px; }
.fac-tour-card h3 { font-size: 18px; margin: 0 0 6px; font-weight: 600; }
.fac-tour-card p { font-size: 14px; line-height: 1.6; margin: 0 0 12px; color: var(--color-text-secondary); }
.fac-tour-dots { display: flex; gap: 6px; margin-bottom: 14px; }
.fac-tour-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--color-border-tertiary); }
.fac-tour-dots span.on { background: var(--cyan); }
.fac-tour-nav { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.fac-tour-nav .btn { font-size: 13px; }

@media (max-width: 900px) {
  .fac-row, .fac-team-row, .fac-reg-row { grid-template-columns: 1fr; gap: 6px; padding: 14px; }
  .fac-head-row { display: none; }
  .fac-row input[type=checkbox] { justify-self: start; }
}
