/* ============================================================
   تجويد — Teacher Assessment Tool
   Calm Tajweed palette: deep teal-green + warm gold accents.
   Arabic-first, RTL. Vanilla CSS, no build step.
   ============================================================ */

:root {
  /* Greens / teal */
  --teal-900: #093d37;
  --teal-800: #0f5e54;
  --teal-700: #14756a;
  --teal-600: #1c8c7f;
  --teal-500: #2aa697;
  --teal-100: #d6ede9;
  --teal-50:  #eef7f5;

  /* Warm gold accents */
  --gold-600: #b7892f;
  --gold-500: #d4a23c;
  --gold-400: #e3bb63;
  --gold-100: #f7ecd2;

  /* Neutrals — warm paper */
  --ink-900: #1d2b29;
  --ink-700: #3c504d;
  --ink-500: #6b7c79;
  --ink-300: #aab6b3;
  --paper:   #f7f4ec;
  --paper-2: #fffdf8;
  --line:    #e4ddcd;

  /* Semantic */
  --pass:    #1c8c7f;
  --pass-bg: #def0ec;
  --fail:    #b8453a;
  --fail-bg: #f7e2df;

  --radius:   16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(9, 61, 55, .06), 0 1px 3px rgba(9, 61, 55, .08);
  --shadow-md: 0 6px 22px rgba(9, 61, 55, .10), 0 2px 6px rgba(9, 61, 55, .06);
  --shadow-lg: 0 18px 50px rgba(9, 61, 55, .16);

  --font-ui: "Tajawal", system-ui, "Segoe UI", sans-serif;
  --font-quran: "Amiri", "Tajawal", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink-900);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--teal-50), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--gold-100), transparent 55%),
    var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app { min-height: 100vh; }

/* ---------- Typographic rhythm ---------- */
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 800; letter-spacing: -.2px; }
h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
h3 { font-size: 1.12rem; font-weight: 700; }
p  { margin: 0; }

/* ============================================================
   Buttons & form controls
   ============================================================ */
.btn {
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: .8rem 1.4rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--gold-400); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, var(--teal-600), var(--teal-700));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--teal-500), var(--teal-600)); box-shadow: var(--shadow-md); }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-600));
  color: #2a2008;
  box-shadow: var(--shadow-sm);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.04); box-shadow: var(--shadow-md); }

.btn-ghost {
  background: transparent;
  color: var(--teal-800);
  border: 1.5px solid var(--teal-100);
}
.btn-ghost:hover:not(:disabled) { background: var(--teal-50); border-color: var(--teal-500); }

.btn-block { width: 100%; }
.btn-sm { padding: .5rem .9rem; font-size: .92rem; }

label.field-label {
  display: block;
  font-weight: 700;
  color: var(--ink-700);
  margin-bottom: .5rem;
  font-size: .98rem;
}

input[type="tel"],
input[type="text"],
input[type="number"] {
  font-family: inherit;
  font-size: 1.1rem;
  width: 100%;
  padding: .85rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink-900);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 4px var(--teal-50);
}

/* OTP code box — large, spaced digits */
.otp-input {
  text-align: center;
  letter-spacing: .7em;
  font-weight: 800;
  font-size: 1.6rem;
  padding-inline-start: .7em; /* compensate for letter-spacing trailing */
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 253, 248, .82);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--teal-700), var(--teal-900));
  display: grid; place-items: center;
  color: var(--gold-400);
  font-family: var(--font-quran);
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.brand-text strong { display: block; font-size: 1.18rem; font-weight: 800; color: var(--teal-900); }
.brand-text span { font-size: .8rem; color: var(--ink-500); }

.topbar-user { display: flex; align-items: center; gap: .8rem; }
.user-chip {
  font-size: .9rem;
  color: var(--ink-700);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  padding: .4rem .8rem;
  border-radius: 999px;
  direction: ltr;
  unicode-bidi: plaintext;
}

/* ============================================================
   Layout containers
   ============================================================ */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2.4rem) clamp(1rem, 4vw, 2.5rem) 4rem;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.page-head .sub { color: var(--ink-500); margin-top: .35rem; }

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.2rem, 2.5vw, 1.9rem);
}
.card + .card { margin-top: 1.4rem; }

.section-label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  color: var(--teal-800);
  font-size: 1.05rem;
  margin-bottom: .25rem;
}
.section-label .pill {
  font-size: .72rem;
  font-weight: 700;
  background: var(--gold-100);
  color: var(--gold-600);
  border-radius: 999px;
  padding: .15rem .6rem;
}

/* ============================================================
   LOGIN screen
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.2rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: clamp(1.6rem, 4vw, 2.6rem);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset-block-start: -60px;
  inset-inline-end: -60px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, var(--gold-100), transparent 70%);
  pointer-events: none;
}
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--teal-700), var(--teal-900));
  display: grid; place-items: center;
  color: var(--gold-400);
  font-family: var(--font-quran);
  font-size: 2.1rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-md);
}
.auth-card h1 { margin-bottom: .4rem; color: var(--teal-900); }
.auth-card .lede { color: var(--ink-500); margin-bottom: 1.6rem; font-size: .98rem; }
.auth-form .field { margin-bottom: 1.1rem; }
.auth-back {
  background: none;
  border: none;
  color: var(--teal-700);
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  padding: .4rem 0;
  margin-top: 1rem;
}
.auth-back:hover { text-decoration: underline; }

.phone-input { direction: ltr; text-align: left; }

/* Dev OTP hint */
.dev-hint {
  margin-top: 1.1rem;
  background: var(--gold-100);
  border: 1px dashed var(--gold-500);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  font-size: .9rem;
  color: var(--gold-600);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.dev-hint code {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--teal-900);
  background: #fff;
  padding: .1rem .5rem;
  border-radius: 6px;
  letter-spacing: .15em;
}

/* New-number registration hint (shown above the code field) */
.register-hint {
  margin-bottom: 1.1rem;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--teal-800);
}

/* ============================================================
   Students list
   ============================================================ */
.add-row { display: flex; gap: .7rem; flex-wrap: wrap; }
.add-row input { flex: 1 1 220px; }

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}
.student-card {
  text-align: start;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.student-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--teal-500); }
.student-card:focus-visible { outline: 3px solid var(--gold-400); outline-offset: 2px; }
.student-card .s-top { display: flex; align-items: center; gap: .8rem; }
.student-avatar {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--teal-100), var(--teal-50));
  color: var(--teal-800);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  flex: 0 0 auto;
}
.student-card .s-name { font-weight: 800; font-size: 1.12rem; color: var(--ink-900); }
.student-card .s-meta { display: flex; gap: .5rem; flex-wrap: wrap; }

.badge {
  font-size: .8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .25rem .7rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid transparent;
}
.badge-level { background: var(--teal-50); color: var(--teal-800); border-color: var(--teal-100); }
.badge-progress { background: var(--gold-100); color: var(--gold-600); }
.badge-done { background: var(--pass-bg); color: var(--pass); }
.badge-assigned { background: var(--teal-50); color: var(--teal-800); border-color: var(--teal-100); }

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-500);
}
.empty .emoji { font-size: 2.6rem; display: block; margin-bottom: .6rem; }

/* ============================================================
   Student detail
   ============================================================ */
.crumbs {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .92rem;
  color: var(--ink-500);
  margin-bottom: 1rem;
}
.crumbs button {
  background: none; border: none; color: var(--teal-700);
  font-family: inherit; font-weight: 700; cursor: pointer; padding: 0; font-size: .92rem;
}
.crumbs button:hover { text-decoration: underline; }

.detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}
.detail-head .student-avatar { width: 58px; height: 58px; font-size: 1.5rem; border-radius: 18px; }
.detail-head h1 { color: var(--teal-900); }

/* Placement / Qaida image */
.qaida-frame {
  margin: 1rem 0 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.qaida-frame img { display: block; width: 100%; height: auto; }

.score-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.score-row .field { flex: 0 0 160px; }
.score-input-wrap { position: relative; }
.score-input-wrap .of10 {
  position: absolute;
  inset-inline-end: 1rem;
  inset-block-start: 50%;
  transform: translateY(-50%);
  color: var(--ink-300);
  font-weight: 700;
  pointer-events: none;
}
.score-current {
  margin-inline-start: auto;
  text-align: center;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-sm);
  padding: .7rem 1.2rem;
  min-width: 120px;
}
.score-current .num { font-size: 1.9rem; font-weight: 800; color: var(--teal-800); line-height: 1; }
.score-current .lbl { font-size: .8rem; color: var(--ink-500); }

/* Level progress stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 1rem 0 1.6rem;
}
.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.step-dot {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  border: 2px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-300);
  position: relative;
  z-index: 1;
}
.step.is-current .step-dot { border-color: var(--teal-600); color: var(--teal-800); background: var(--teal-50); box-shadow: 0 0 0 4px var(--teal-50); }
.step.is-passed .step-dot { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }
.step-label { font-size: .82rem; color: var(--ink-500); font-weight: 700; }
.step.is-current .step-label { color: var(--teal-800); }
.step-line { flex: 0 0 auto; width: 100%; height: 2px; }

.step-rail {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 1.7rem;
}
.step-rail::before {
  content: "";
  position: absolute;
  inset-inline: 22px;
  top: 20px;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

/* Tajweed question cards */
.q-list { display: flex; flex-direction: column; gap: .9rem; margin-top: 1.2rem; }
.q-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transition: border-color .2s ease, background .2s ease;
}
.q-card.marked-pass { border-color: var(--pass); background: var(--pass-bg); }
.q-card.marked-fail { border-color: var(--fail); background: var(--fail-bg); }
.q-num {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--teal-800);
  color: var(--gold-400);
  display: grid; place-items: center;
  font-weight: 800;
  font-family: var(--font-quran);
  font-size: 1.2rem;
}
.q-body { flex: 1 1 260px; min-width: 0; }
.q-text {
  font-family: var(--font-quran);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.7;
}
.q-points { font-size: .85rem; color: var(--ink-500); margin-top: .25rem; }

/* اجتاز / لم يجتاز toggle */
.mark-toggle {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--paper);
  flex: 0 0 auto;
}
.mark-toggle button {
  font-family: inherit;
  font-weight: 800;
  font-size: .92rem;
  border: none;
  background: transparent;
  color: var(--ink-500);
  padding: .5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mark-toggle button.active-pass { background: var(--pass); color: #fff; }
.mark-toggle button.active-fail { background: var(--fail); color: #fff; }
.mark-toggle button:focus-visible { outline: 2px solid var(--gold-400); outline-offset: 1px; }

.level-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
  padding-top: 1.3rem;
  border-top: 1px dashed var(--line);
}
.pass-tally { color: var(--ink-500); font-size: .95rem; }
.pass-tally strong { color: var(--teal-800); font-size: 1.05rem; }

/* Result banner */
.result-banner {
  margin-top: 1.4rem;
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  font-weight: 700;
  animation: rise .35s ease;
}
.result-banner.ok { background: var(--pass-bg); border: 1px solid var(--pass); color: #0c5a4f; }
.result-banner.no { background: var(--fail-bg); border: 1px solid var(--fail); color: #8a3128; }
.result-banner .ico { font-size: 1.5rem; }

/* Celebratory terminal banner */
.celebrate {
  margin: 1rem 0 1.6rem;
  border-radius: 24px;
  padding: 2.2rem 1.6rem;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(700px 300px at 50% -30%, rgba(227,187,99,.45), transparent 70%),
    linear-gradient(145deg, var(--teal-700), var(--teal-900));
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: rise .4s ease;
}
.celebrate .crown { font-size: 2.8rem; margin-bottom: .6rem; }
.celebrate h2 {
  font-family: var(--font-quran);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: var(--gold-400);
  margin-bottom: .5rem;
}
.celebrate p { color: rgba(255,255,255,.85); }

/* Informational terminal banner — a diagnostic FAIL outcome (assigned level).
   Deliberately calm/informational, NOT celebratory (no gold crown, no dark hero). */
.diagnostic-result {
  margin: 1rem 0 1.6rem;
  border-radius: 24px;
  padding: 1.8rem 1.6rem;
  text-align: center;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  box-shadow: var(--shadow-sm);
  animation: rise .35s ease;
}
.diagnostic-result .dr-ico { font-size: 2.2rem; line-height: 1; margin-bottom: .4rem; }
.diagnostic-result h2 {
  color: var(--teal-900);
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  margin-bottom: .4rem;
}
.diagnostic-result p { color: var(--ink-700); }
.diagnostic-result .dr-level {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .8rem;
  font-weight: 800;
  color: var(--teal-800);
  background: var(--paper-2);
  border: 1px solid var(--teal-100);
  border-radius: 999px;
  padding: .45rem 1.1rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Results summary
   ============================================================ */
.results-grid { display: flex; flex-direction: column; gap: 1rem; }
.result-level {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
}
.result-level .rl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.2rem;
  background: var(--teal-50);
  border-bottom: 1px solid var(--teal-100);
}
.result-level .rl-head h3 { color: var(--teal-900); }
.rl-status { font-size: .85rem; font-weight: 800; border-radius: 999px; padding: .3rem .8rem; }
.rl-status.pass { background: var(--pass); color: #fff; }
.rl-status.fail { background: var(--fail); color: #fff; }
.rl-status.pending { background: var(--line); color: var(--ink-500); }
.rl-q {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .7rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.rl-q:last-child { border-bottom: none; }
.rl-q .mk {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .85rem; font-weight: 800; color: #fff;
}
.rl-q .mk.pass { background: var(--pass); }
.rl-q .mk.fail { background: var(--fail); }
.rl-q .qt { font-family: var(--font-quran); font-size: 1.1rem; flex: 1; }
.rl-when { font-size: .78rem; color: var(--ink-300); direction: ltr; }

.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.stat .v { font-size: 1.7rem; font-weight: 800; color: var(--teal-800); line-height: 1.1; }
.stat .k { font-size: .85rem; color: var(--ink-500); margin-top: .2rem; }

.rl-head-meta { display: flex; align-items: center; gap: .7rem; }

/* ============================================================
   Assessment wizard (step-by-step)
   ============================================================ */
.wizard-rail {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  margin-bottom: 1.4rem;
}
.wizard-rail .step-rail { margin: 0; }

/* Current-level chip on the level step */
.level-indicator {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 1.1rem 0 .2rem;
  font-weight: 800;
  font-size: .95rem;
  color: var(--teal-800);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: 999px;
  padding: .35rem .9rem;
}
.level-indicator span { color: var(--ink-500); font-weight: 700; }

/* Post-submit interstitial (advanced / failed) */
.outcome-panel {
  text-align: center;
  border-radius: var(--radius);
  padding: 2.2rem 1.4rem;
  margin: 1.2rem 0 .2rem;
  animation: rise .35s ease;
}
.outcome-panel.ok { background: var(--pass-bg); border: 1px solid var(--pass); }
.outcome-panel.no { background: var(--fail-bg); border: 1px solid var(--fail); }
.outcome-ico { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.outcome-panel h2 { font-size: clamp(1.2rem, 3vw, 1.55rem); margin-bottom: .4rem; }
.outcome-panel.ok h2 { color: #0c5a4f; }
.outcome-panel.no h2 { color: #8a3128; }
.outcome-panel .muted { color: var(--ink-500); }
.outcome-panel .btn { margin-top: 1.3rem; }

/* Per-step footer (رجوع للطلاب / عرض النتيجة) */
.wizard-foot {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--line);
}

/* Result-step actions row */
.result-actions {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
  padding-top: 1.3rem;
  border-top: 1px dashed var(--line);
}

.fineprint { font-size: .85rem; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-region {
  position: fixed;
  inset-block-end: 1.4rem;
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  pointer-events: none;
  z-index: 100;
}
.toast {
  pointer-events: auto;
  background: var(--ink-900);
  color: #fff;
  padding: .8rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .95rem;
  box-shadow: var(--shadow-lg);
  animation: rise .25s ease;
  max-width: 90vw;
}
.toast.err { background: var(--fail); }
.toast.ok  { background: var(--teal-700); }

/* ============================================================
   Utility / states
   ============================================================ */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.dark { border-color: var(--teal-100); border-top-color: var(--teal-700); }
@keyframes spin { to { transform: rotate(360deg); } }

.center-load {
  min-height: 50vh;
  display: grid;
  place-items: center;
}
.muted { color: var(--ink-500); }
.mt-1 { margin-top: .6rem; }
.mt-2 { margin-top: 1.2rem; }
.hidden { display: none !important; }

@media (max-width: 560px) {
  .q-card { gap: .8rem; }
  .mark-toggle button { padding: .5rem .85rem; }
  .level-foot { flex-direction: column; align-items: stretch; }
  .level-foot .btn { width: 100%; }
}

/* ============================================================
   Admin dashboard (لوحة المشرف)
   ============================================================ */
.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: .8rem;
  font-weight: 800;
  color: var(--gold-600);
  background: var(--gold-100);
  border: 1px solid var(--gold-500);
  border-radius: 999px;
  padding: .2rem .7rem;
  margin-inline-start: .5rem;
  vertical-align: middle;
}
/* In the topbar the badge sits to the start of the user chip — no leading gap. */
.topbar-user .role-badge { margin-inline-start: 0; }

/* Prominent "active now" hero */
.admin-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 1.4rem;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(700px 300px at 50% -40%, rgba(227, 187, 99, .4), transparent 70%),
    linear-gradient(145deg, var(--teal-700), var(--teal-900));
  box-shadow: var(--shadow-lg);
  animation: rise .35s ease;
}
.admin-hero-num {
  font-size: clamp(2.8rem, 8vw, 4rem);
  font-weight: 800;
  line-height: 1;
  color: var(--gold-400);
}
.admin-hero-label { font-size: 1.1rem; font-weight: 800; margin-top: .5rem; }
.admin-hero-cap { font-size: .9rem; color: rgba(255, 255, 255, .82); margin-top: .35rem; }

/* Gold-highlighted stat — the "passed all levels / no Tajweed needed" count */
.stat.stat-gold {
  background: var(--gold-100);
  border-color: var(--gold-500);
}
.stat.stat-gold .v,
.stat.stat-gold .k { color: var(--gold-600); }
