/* Smart A+ — Premium prototype styles */
:root {
  --navy-950: #061B3F;
  --navy-900: #082A63;
  --navy-800: #0B3478;
  --navy-700: #143F90;
  --blue-600: #2388D9;
  --blue-500: #3B9BE5;
  --blue-100: #EAF6FF;
  --blue-50:  #F4FAFF;
  --gold-600: #E59A00;
  --gold-500: #FFB703;
  --gold-400: #FFC83D;
  --gold-100: #FFF4D3;
  --gold-50:  #FFFAE8;
  --green-500: #19A974;
  --green-100: #DCF7EC;
  --red-500: #EF4444;
  --red-100: #FEE2E2;
  --slate-900: #0F172A;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;
  --white: #FFFFFF;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 32px;
  --r-full: 999px;

  --shadow-xs: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.04);
  --shadow-sm: 0 2px 6px rgba(15,23,42,.05), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 10px 24px -12px rgba(15,23,42,.12), 0 4px 10px -6px rgba(15,23,42,.08);
  --shadow-lg: 0 24px 60px -24px rgba(8,42,99,.25), 0 8px 20px -10px rgba(8,42,99,.15);
  --shadow-gold: 0 14px 28px -12px rgba(255,183,3,.45);

  --font: 'Urbanist', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-weight: 500;
  color: var(--slate-900);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-300); background-clip: padding-box; border: 2px solid transparent; }

/* utility */
.sa-row { display: flex; align-items: center; }
.sa-col { display: flex; flex-direction: column; }
.sa-gap-2 { gap: 8px; } .sa-gap-3 { gap: 12px; } .sa-gap-4 { gap: 16px; } .sa-gap-6 { gap: 24px; } .sa-gap-8 { gap: 32px; }

/* Cards */
.sa-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}
.sa-card-padded { padding: 22px; }

/* Buttons */
.sa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r-full);
  font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.sa-btn:active { transform: translateY(1px); }
.sa-btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--navy-950); box-shadow: var(--shadow-gold);
}
.sa-btn-primary:hover { filter: brightness(1.03); }
.sa-btn-navy {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
}
.sa-btn-ghost {
  background: #fff; color: var(--navy-900); border: 1px solid var(--slate-200);
}
.sa-btn-ghost:hover { background: var(--slate-50); }
.sa-btn-soft { background: var(--blue-100); color: var(--navy-900); }
.sa-btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.sa-btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }
.sa-btn-block { width: 100%; }

/* Chips / Badges */
.sa-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--slate-100); color: var(--slate-700);
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
}
.sa-chip-gold { background: var(--gold-50); color: var(--gold-600); }
.sa-chip-blue { background: var(--blue-100); color: var(--navy-800); }
.sa-chip-green { background: var(--green-100); color: var(--green-500); }
.sa-chip-red { background: var(--red-100); color: var(--red-500); }
.sa-chip-navy { background: var(--navy-950); color: var(--gold-400); }

/* Headings */
.sa-h1 { font-size: clamp(40px, 5.4vw, 68px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; margin: 0; color: var(--navy-950); }
.sa-h2 { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.1; letter-spacing: -0.025em; font-weight: 800; margin: 0; color: var(--navy-950); }
.sa-h3 { font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; margin: 0; color: var(--navy-950); }
.sa-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--navy-700); }
.sa-muted { color: var(--slate-500); }

/* Progress ring + bar */
.sa-bar { height: 8px; background: var(--slate-100); border-radius: 999px; overflow: hidden; }
.sa-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); border-radius: 999px; }
.sa-bar-blue > i { background: linear-gradient(90deg, var(--blue-600), var(--blue-500)); }
.sa-bar-green > i { background: linear-gradient(90deg, var(--green-500), #2ED39A); }

/* Sidebar */
.sa-sidebar {
  width: 260px;
  background: linear-gradient(190deg, var(--navy-950), var(--navy-900) 60%, #050f2e);
  color: #cbd6f1;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden; /* outer never scrolls */
}
.sa-side-top {
  padding: 22px 14px 8px;
  flex-shrink: 0;
}
.sa-side-scroll {
  flex: 1 1 auto;
  min-height: 0; /* critical for flex children to scroll */
  overflow-y: auto;
  padding: 0 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sa-side-scroll::-webkit-scrollbar { width: 6px; }
.sa-side-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 999px; }
.sa-side-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }
.sa-side-foot {
  padding: 12px 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.18));
}
.sa-side-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 14px;
  color: #cbd6f1; font-weight: 600; font-size: 14px; letter-spacing: -0.005em;
  transition: background .15s ease, color .15s ease;
}
.sa-side-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sa-side-item.sa-active { background: rgba(255,183,3,.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,183,3,.28); }
.sa-side-item .sa-side-ico { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--gold-400); }
.sa-side-section { font-size: 11px; color: #6e7fa6; padding: 16px 14px 6px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }

/* Topbar */
.sa-topbar {
  height: 72px; background: #fff; border-bottom: 1px solid var(--slate-200);
  padding: 0 28px; display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 30;
}
.sa-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--slate-50); border: 1px solid var(--slate-200);
  border-radius: var(--r-full); padding: 0 16px; height: 42px; min-width: 320px;
  color: var(--slate-500);
}
.sa-search input { border: none; background: transparent; outline: none; flex: 1; color: var(--slate-900); font-weight: 500; }

/* Mobile drawer toggle — hidden on desktop, revealed at <=980px */
.sa-burger {
  display: none;
  align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: 0 0 auto;
  border: 1px solid var(--slate-200); border-radius: 12px;
  background: #fff; color: var(--slate-700); cursor: pointer;
}
.sa-burger:hover { background: var(--slate-50); }
.sa-side-backdrop {
  position: fixed; inset: 0; z-index: 35;
  background: rgba(6,27,63,.45);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}
.sa-side-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }

/* Layout shell */
.sa-app { display: flex; min-height: 100vh; background: var(--slate-50); }
.sa-main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 260px; }
.sa-content { padding: 28px 36px 60px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* Toast */
.sa-toast-wrap { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.sa-toast {
  background: var(--navy-950); color: #fff; padding: 14px 18px; border-radius: 16px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px;
  font-weight: 600; min-width: 260px; animation: sa-toast-in .25s ease both;
  border: 1px solid rgba(255,255,255,.06);
}
.sa-toast .sa-toast-ico { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gold-500); color: var(--navy-950); }
@keyframes sa-toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal */
.sa-modal-back { position: fixed; inset: 0; background: rgba(6,27,63,.45); backdrop-filter: blur(6px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .2s ease both; }
.sa-modal { background: #fff; border-radius: 24px; padding: 28px; max-width: 520px; width: 100%; box-shadow: var(--shadow-lg); animation: pop .25s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* Stat card */
.sa-stat {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--r-xl);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.sa-stat .sa-stat-icon {
  position: absolute; right: 14px; top: 14px;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--blue-100); color: var(--navy-800);
  display: inline-flex; align-items: center; justify-content: center;
}
.sa-stat .sa-stat-label { color: var(--slate-500); font-size: 13px; font-weight: 600; }
.sa-stat .sa-stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.025em; color: var(--navy-950); }
.sa-stat .sa-stat-delta { font-size: 12.5px; font-weight: 700; color: var(--green-500); }
.sa-stat-gold .sa-stat-icon { background: var(--gold-50); color: var(--gold-600); }
.sa-stat-green .sa-stat-icon { background: var(--green-100); color: var(--green-500); }
.sa-stat-red .sa-stat-icon { background: var(--red-100); color: var(--red-500); }

/* Grids */
.sa-grid { display: grid; gap: 18px; }
/* Equal-height rows for the dashboard stat grid (so cards with a delta line match those without). */
.sa-stat-scroll { grid-auto-rows: 1fr; }
.sa-grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.sa-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.sa-grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.sa-grid-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
@media (max-width: 1100px) {
  .sa-grid-4, .sa-grid-6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sa-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .sa-grid-2, .sa-grid-3, .sa-grid-4, .sa-grid-6 { grid-template-columns: 1fr; }
  .sa-content { padding: 18px; }
  .sa-topbar { padding: 0 16px; }
  .sa-search { min-width: 0; flex: 1; }
}

/* Table */
.sa-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.sa-table th, .sa-table td { text-align: left; padding: 14px 16px; font-size: 14px; }
.sa-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--slate-500); font-weight: 700; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); }
.sa-table tbody tr { border-bottom: 1px solid var(--slate-100); }
.sa-table tbody tr:hover { background: var(--blue-50); }
.sa-table-wrap { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--r-xl); overflow: hidden; }

/* Avatar */
.sa-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-100); display: inline-flex; align-items: center; justify-content: center; color: var(--navy-800); font-weight: 800; font-size: 14px; overflow: hidden; }
.sa-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sa-avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* Subject cards image */
.sa-subject-cover {
  height: 130px; border-radius: 18px; position: relative; overflow: hidden;
  display: flex; align-items: flex-end; padding: 14px; color: #fff;
}

/* Sparkle */
@keyframes sa-sparkle { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.1); } }
.sa-sparkle { animation: sa-sparkle 2.4s ease-in-out infinite; transform-origin: center; }

/* Landing-specific */
.sa-landing { background: #fff; }
/* Trusted-by-schools marquee: seamless right→left loop, pauses on hover/touch. */
.sa-marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.sa-marquee-track { display: flex; width: max-content; animation: sa-marquee 26s linear infinite; }
.sa-marquee:hover .sa-marquee-track, .sa-marquee:active .sa-marquee-track { animation-play-state: paused; }
.sa-mq-group { display: flex; align-items: center; gap: 32px; padding-right: 32px; flex-shrink: 0; color: #94A3B8; font-weight: 800; font-size: 14px; letter-spacing: -0.01em; white-space: nowrap; }
.sa-mq-dot { opacity: .6; }
@keyframes sa-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .sa-marquee-track { animation: none; } }
/* Hero trust-bar: wraps on desktop, single horizontal swipe-scroll on mobile. */
.sa-hero-grid > div { min-width: 0; }
.sa-hero-trust { display: flex; gap: 36px; flex-wrap: wrap; max-width: 100%; }
@media (max-width: 720px) {
  .sa-hero-trust { flex-wrap: nowrap; gap: 26px; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; scrollbar-width: none; -ms-overflow-style: none; }
  .sa-hero-trust > div { flex: 0 0 auto; scroll-snap-align: start; }
  .sa-hero-trust::-webkit-scrollbar { display: none; }
}
/* Landing top-nav: collapse into a hamburger dropdown on mobile. */
.sa-land-nav { display: flex; gap: 28px; align-items: center; font-weight: 600; color: #334155; font-size: 14.5px; }
.sa-land-burger { display: none; background: none; border: none; cursor: pointer; color: var(--navy-800); padding: 6px; border-radius: 10px; }
@media (max-width: 860px) {
  .sa-land-burger { display: inline-flex; }
  .sa-land-nav {
    position: absolute; top: calc(100% + 1px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fff; border-bottom: 1px solid var(--slate-200);
    padding: 12px 24px 18px; box-shadow: 0 24px 48px -24px rgba(6,27,63,.4);
    display: none;
  }
  .sa-land-nav.open { display: flex; }
  .sa-land-nav > a { padding: 13px 10px; border-radius: 12px; font-size: 16px; }
  .sa-land-nav > a:hover { background: var(--slate-50); }
  .sa-land-nav > a.sa-btn { justify-content: center; margin-top: 8px; }
}
.sa-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; }

/* Quiz */
.sa-quiz-option {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: 18px; border: 1.5px solid var(--slate-200);
  background: #fff; cursor: pointer; transition: all .15s ease; font-weight: 600;
}
.sa-quiz-option:hover { border-color: var(--blue-500); background: var(--blue-50); }
.sa-quiz-option .sa-quiz-letter {
  width: 36px; height: 36px; border-radius: 12px; background: var(--slate-100); color: var(--navy-900);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.sa-quiz-option.sel { border-color: var(--navy-900); background: var(--navy-950); color: #fff; }
.sa-quiz-option.sel .sa-quiz-letter { background: var(--gold-500); color: var(--navy-950); }
.sa-quiz-option.correct { border-color: var(--green-500); background: var(--green-100); color: var(--navy-950); }
.sa-quiz-option.correct .sa-quiz-letter { background: var(--green-500); color: #fff; }
.sa-quiz-option.wrong { border-color: var(--red-500); background: var(--red-100); color: var(--navy-950); }
.sa-quiz-option.wrong .sa-quiz-letter { background: var(--red-500); color: #fff; }

/* Login */
.sa-auth-bg {
  min-height: 100vh; position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 10% -10%, #1a3f9a 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 110%, #ffb70333 0%, transparent 60%),
              linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);
  color: #fff;
}

/* Confetti dots when earning points */
@keyframes sa-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1;} 100% { transform: scale(1); opacity: 1; } }
.sa-pop { animation: sa-pop .4s ease both; }

/* Calendar dots for solat */
.sa-solat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.sa-solat-cell { aspect-ratio: 1/1; border-radius: 12px; background: var(--slate-100); display:flex; align-items:center; justify-content:center; font-size: 12px; font-weight: 700; color: var(--slate-500); }
.sa-solat-cell.done { background: var(--green-100); color: var(--green-500); }
.sa-solat-cell.partial { background: var(--gold-50); color: var(--gold-600); }
.sa-solat-cell.today { box-shadow: inset 0 0 0 2px var(--navy-900); color: var(--navy-900); }

/* Daily prayer checklist rows (student solat) */
.sa-prayer-row { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; flex-wrap: wrap; }
.sa-prayer-id { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; }
.sa-prayer-check { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.sa-prayer-name { font-weight: 800; color: var(--navy-950); font-size: 16px; line-height: 1.2; }
.sa-prayer-time { color: var(--slate-500); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sa-prayer-locs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sa-prayer-loc { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--slate-200); background: #fff; color: var(--slate-600); white-space: nowrap; }
.sa-prayer-loc.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.sa-prayer-hint { color: var(--slate-500); font-size: 12px; font-weight: 600; flex-shrink: 0; }
@media (max-width: 600px) {
  /* Drop the location pills onto their own line, indented under the prayer name. */
  .sa-prayer-locs { width: 100%; justify-content: flex-start; padding-left: 50px; }
}

/* Ranking personal hero: center the headline, stats, and rank ring once it stacks. */
@media (max-width: 980px) {
  .sa-rank-hero { text-align: center; gap: 22px; }
  .sa-rank-hero .sa-rank-stats { justify-content: center; gap: 26px; }
  .sa-rank-hero > *:last-child { justify-self: center; }
}

/* Auth (login/signup): once the split-screen stacks, drop the marketing blurb and center the form. */
@media (max-width: 980px) {
  .sa-login-blurb { display: none !important; }
  .sa-login-grid { max-width: 480px !important; gap: 0 !important; }
}

/* ---- Live classroom ---- */
.sa-stage { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden;
  background: radial-gradient(120% 90% at 100% 0%, #143F90 0%, transparent 55%), linear-gradient(135deg, #061B3F, #0B3478);
  box-shadow: var(--shadow-lg); }
.sa-stage > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #061B3F; }
.sa-stage-grad { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(6,27,63,.45) 0%, transparent 26%, transparent 58%, rgba(6,27,63,.88) 100%); }
.sa-stage-tl { position: absolute; top: 16px; left: 16px; display: flex; gap: 10px; align-items: center; }
.sa-stage-tr { position: absolute; top: 16px; right: 16px; }
.sa-stage-teacher { position: absolute; left: 18px; bottom: 18px; display: flex; align-items: center; gap: 12px; color: #fff; }
.sa-live-badge { display: inline-flex; align-items: center; gap: 7px; background: #EF4444; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .06em; padding: 7px 13px; border-radius: 999px; }
.sa-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: sa-pulse 1.4s infinite; }
.sa-stage-pill { display: inline-flex; align-items: center; gap: 7px; background: rgba(6,27,63,.55); backdrop-filter: blur(6px); color: #fff; font-weight: 700; font-size: 12.5px; padding: 7px 13px; border-radius: 999px; }
@keyframes sa-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.6); } }
.sa-stage-bar { position: absolute; left: 0; right: 0; bottom: 16px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 0 14px; }
.sa-ctrl { width: 48px; height: 48px; border-radius: 14px; border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(6px); transition: background .15s ease, transform .12s ease; }
.sa-ctrl:hover { background: rgba(255,255,255,.3); }
.sa-ctrl:active { transform: scale(.94); }
.sa-ctrl.off { background: #EF4444; }
.sa-ctrl-leave { width: auto; padding: 0 18px; gap: 8px; font-weight: 800; font-size: 13.5px; background: #EF4444; }
.sa-ctrl-leave:hover { background: #DC2626; }
.sa-react-pop { position: absolute; bottom: 76px; left: 50%; transform: translateX(-50%); display: none; gap: 6px; background: rgba(6,27,63,.7); backdrop-filter: blur(8px); padding: 8px; border-radius: 16px; }
.sa-react-pop.open { display: flex; }
.sa-react-pop button { background: none; border: none; font-size: 22px; cursor: pointer; line-height: 1; padding: 4px; border-radius: 10px; transition: transform .1s ease; }
.sa-react-pop button:hover { transform: scale(1.25); }
.sa-react-float { position: absolute; bottom: 80px; font-size: 30px; pointer-events: none; animation: sa-float-up 1.8s ease-out forwards; }
@keyframes sa-float-up { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-220px) scale(1.3); } }
.sa-panel-body { max-height: 460px; overflow-y: auto; }
.sa-chat-msg { display: flex; gap: 10px; margin-bottom: 12px; }
.sa-chat-bubble { background: var(--slate-50); border-radius: 14px; padding: 9px 13px; font-size: 13.5px; color: var(--navy-950); font-weight: 500; }
.sa-chat-msg.host .sa-chat-bubble { background: var(--blue-50); }
.sa-chat-name { font-size: 11.5px; font-weight: 800; color: var(--slate-600); margin-bottom: 3px; }
.sa-chat-name .host-tag { color: var(--gold-600); margin-left: 6px; }
@media (max-width: 980px) {
  .sa-ctrl { width: 44px; height: 44px; }
  .sa-stage-teacher { display: none; }
}

/* Medal */
.sa-medal { width: 28px; height: 28px; border-radius: 50%; display:inline-flex; align-items:center; justify-content:center; font-weight: 800; color: #fff; font-size: 12px; }
.sa-medal-1 { background: linear-gradient(135deg, #FFD86B, #E59A00); }
.sa-medal-2 { background: linear-gradient(135deg, #DCE3EE, #94A3B8); }
.sa-medal-3 { background: linear-gradient(135deg, #E8A87C, #B36A3A); }

/* Tab pills */
.sa-tabs { display: inline-flex; padding: 5px; background: var(--slate-100); border-radius: 999px; gap: 4px; }
.sa-tab { padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--slate-600); }
.sa-tab.active, .sa-tab.sa-active { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-xs); }

/* Segmented selector (parent child-switcher pills) */
.sa-seg { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.sa-segbtn { padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; background: #fff; color: var(--slate-600); border: 1px solid var(--slate-200); cursor: pointer; }
.sa-segbtn:hover { border-color: var(--navy-700); color: var(--navy-900); }
.sa-segbtn.sa-active { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

/* Empty image fallback: subject covers */
.cover-math   { background: linear-gradient(135deg, #2388D9 0%, #082A63 100%); }
.cover-sci    { background: linear-gradient(135deg, #19A974 0%, #064E3B 100%); }
.cover-eng    { background: linear-gradient(135deg, #FFB703 0%, #B45309 100%); }
.cover-islam  { background: linear-gradient(135deg, #7C3AED 0%, #312E81 100%); }
.cover-bm     { background: linear-gradient(135deg, #EF4444 0%, #7C1D1D 100%); }

/* Generic input */
.sa-input {
  height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--slate-200); background: #fff;
  font-size: 14.5px; font-weight: 500; outline: none;
  color: var(--navy-950);
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
.sa-input::placeholder { color: #94A3B8; opacity: 1; }
/* Signup role picker: compact 3-across tiles (class-based so it stays 3-col on mobile). */
.sa-role-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.sa-role-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 16px; text-align: center; background: #fff; border: 1.5px solid var(--slate-200); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.sa-role-ico { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.sa-input:focus { border-color: var(--navy-700); box-shadow: 0 0 0 4px rgba(11,52,120,.08); }
.sa-label { font-size: 13px; font-weight: 700; color: var(--slate-700); letter-spacing: -.005em; }

/* Sidebar app brand */
.sa-brand-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px 14px; }
.sa-brand-text { color: #fff; font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
.sa-brand-sub { color: #93a5cb; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }

/* Role switcher in topbar */
.sa-role-switch { display: inline-flex; padding: 4px; background: var(--slate-100); border-radius: 999px; gap: 2px; }
.sa-role-switch button { padding: 7px 13px; border-radius: 999px; font-weight: 700; font-size: 12.5px; color: var(--slate-600); }
.sa-role-switch button.on { background: var(--navy-950); color: var(--gold-400); }

/* Notification dot */
.sa-bell { position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--slate-50); border: 1px solid var(--slate-200); display:inline-flex; align-items:center; justify-content:center; color: var(--slate-700); }
.sa-bell::after { content: ''; position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-500); border: 2px solid #fff; }

/* Section header */
.sa-sec-h { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }

/* For animated bg blobs on hero */
.sa-hero-wrap { position: relative; overflow: hidden; }

/* Live indicator */
.sa-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--red-500); text-transform: uppercase; letter-spacing: .1em; }
.sa-live::before { content:''; width: 8px; height: 8px; background: var(--red-500); border-radius: 50%; animation: sa-pulse 1.4s ease infinite; }
@keyframes sa-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .4; } }

/* Responsive refinement pass - mobile, tablet and desktop */
/* overflow-x: clip (not hidden) prevents horizontal scroll WITHOUT creating a
   scroll container — so position:sticky headers keep working. */
html { width: 100%; overflow-x: clip; }
body { width: 100%; overflow-x: clip; }
img, svg, video, canvas { max-width: 100%; }
.sa-card, .sa-stat, .sa-table-wrap { min-width: 0; }
.sa-row { min-width: 0; }
.sa-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sa-table { min-width: 720px; }
.sa-sec-h { gap: 12px; flex-wrap: wrap; }
.sa-sec-h > * { min-width: 0; }
.sa-tabs { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sa-tab { white-space: nowrap; }

@media (min-width: 1441px) {
  .sa-content { max-width: 1500px; }
}

@media (max-width: 1180px) {
  .sa-content { padding: 24px 26px 52px; }
  .sa-sidebar { width: 238px; }
  .sa-main { margin-left: 238px; }
  .sa-topbar { padding: 0 20px; }
  .sa-role-switch button { padding: 7px 10px; }
}

@media (max-width: 980px) {
  /* Override inline desktop grid layouts so pages do not squeeze on tablet/mobile. */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  [style*="gridTemplateColumns"] { grid-template-columns: 1fr !important; }

  .sa-app { display: block; }
  /* Sidebar becomes an off-canvas slide-in drawer instead of disappearing. */
  .sa-burger { display: inline-flex; order: 0; }
  .sa-sidebar {
    width: 280px; max-width: 86vw; z-index: 50;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  .sa-sidebar.open { transform: translateX(0); }
  .sa-main { width: 100%; margin-left: 0; }
  .sa-content { padding: 22px 20px 54px; max-width: 100%; }
  .sa-topbar {
    min-height: 72px;
    height: auto;
    padding: 12px 16px;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .sa-topbar > div[style*="flex:1"] { display: none; }
  .sa-search { order: 1; flex: 1 1 auto; min-width: 0; }
  .sa-role-switch { order: 9; flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sa-role-switch button { white-space: nowrap; }
  .sa-bell { order: 3; flex: 0 0 auto; }
  .sa-topbar > div[style*="border-left"] { order: 4; border-left: 0 !important; padding-left: 0 !important; }
  .sa-topbar > a[title="Back to landing"] { order: 5; }
  .sa-card-padded { padding: 20px; }
}

@media (max-width: 720px) {
  :root { --r-xl: 22px; --r-2xl: 26px; }
  .sa-h1 { font-size: clamp(34px, 11vw, 46px); line-height: 1.04; }
  .sa-h2 { font-size: clamp(24px, 7vw, 30px); }
  .sa-h3 { font-size: 19px; }
  .sa-content { padding: 18px 14px 44px; }
  .sa-card-padded { padding: 16px; }
  .sa-btn { width: auto; max-width: 100%; white-space: normal; min-height: 44px; height: auto; padding-top: 11px; padding-bottom: 11px; text-align: center; }
  .sa-btn-lg { min-height: 50px; }
  .sa-grid { gap: 14px; }
  .sa-stat { padding: 16px; }
  .sa-stat .sa-stat-value { font-size: 24px; }
  .sa-subject-cover { height: 112px; }
  .sa-modal-back { padding: 14px; align-items: flex-end; }
  .sa-modal { padding: 20px; border-radius: 22px; max-height: 90vh; overflow-y: auto; }
  .sa-toast-wrap { left: 12px; right: 12px; bottom: 12px; }
  .sa-toast { min-width: 0; width: 100%; }

  /* Make dense horizontal rows wrap instead of overflowing. */
  div[style*="display: flex"], div[style*="display:flex"] { min-width: 0; }
  div[style*="justify-content: space-between"], div[style*="justifyContent"] { gap: 12px; }

  .sa-auth-bg { overflow-y: auto; }
  .sa-auth-bg .sa-card { width: 100%; }
  .sa-blob { transform: scale(.72); filter: blur(55px); }
}

@media (max-width: 540px) {
  .sa-topbar { padding: 10px 12px; }
  .sa-role-switch { width: 100%; display: flex; justify-content: flex-start; }
  .sa-role-switch button { padding: 7px 11px; font-size: 12px; }
  .sa-search { height: 40px; padding: 0 12px; }
  .sa-search span { display: none !important; }
  .sa-topbar > div[style*="border-left"] > div:not(.sa-avatar) { display: none; }
  .sa-content { padding-left: 12px; padding-right: 12px; }
  .sa-chip { height: auto; min-height: 26px; padding: 5px 10px; }
  .sa-table th, .sa-table td { padding: 12px; font-size: 13px; }
  .sa-table { min-width: 620px; }

  /* Inline fixed-width QR and decorative blocks need to shrink on phones. */
  div[style*="width: 180px"] { width: min(180px, 100%) !important; height: auto !important; aspect-ratio: 1 / 1; }
  div[style*="min-width"] { min-width: 0 !important; }
}

@media (max-width: 380px) {
  .sa-content { padding-left: 10px; padding-right: 10px; }
  .sa-card-padded { padding: 14px; }
  .sa-role-switch button { padding-left: 9px; padding-right: 9px; }
}

/* On mobile, turn a stat grid into a horizontal swipe-scroll instead of a long vertical stack. */
@media (max-width: 980px) {
  .sa-stat-scroll {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    margin-left: -2px;
    margin-right: -2px;
  }
  .sa-stat-scroll > * {
    flex: 0 0 70%;
    max-width: 260px;
    scroll-snap-align: start;
  }
  .sa-stat-scroll::-webkit-scrollbar { height: 5px; }
  .sa-stat-scroll::-webkit-scrollbar-thumb { background: rgba(8,42,99,.18); border-radius: 999px; }
}
