/* =========================================================================
   CODE Platform — Feuille de style principale v2
   Palette : Orangé / Blanc / Noir (NARSA)
   Principes : WCAG 2.1 AA, Cognitive Load Theory, Spaced Learning, RTL natif
   ========================================================================= */

/* ── Design tokens ────────────────────────────────────────────────────── */
:root {
  /* Palette principale */
  --orange-50:  #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --orange-900: #7c2d12;

  /* Surfaces (lumière naturelle — repose les yeux) */
  --bg:         #fafaf9;        /* fond page, légèrement chaud */
  --surface:    #ffffff;
  --surface-1:  #ffffff;
  --surface-2:  #f5f5f4;
  --surface-3:  #e8e5e0;        /* hover subtil */
  --border:     #e7e5e4;
  --border-strong: #a8a29e;
  --glass-border:  #e7e5e4;

  /* Texte — contraste élevé sans noir pur (moins fatiguant) */
  --text:       #1c1917;        /* 95 % noir → warm */
  --text-soft:  #44403c;
  --muted:      #78716c;

  /* Couleurs fonctionnelles */
  --primary:        #ea580c;    /* orange-600 — CTA principal */
  --primary-strong: #c2410c;   /* orange-700 — hover */
  --primary-soft:   #fff7ed;   /* orange-50  — fond sélection */
  --primary-mid:    #fed7aa;   /* orange-200 — bordure sélection */
  --on-primary:     #ffffff;
  --accent:         var(--primary); /* اسم قديم مستعمل فبزاف ديال القواعد */

  --success:      #15803d;
  --success-soft: #f0fdf4;
  --success-mid:  #bbf7d0;

  --danger:       #b91c1c;
  --danger-soft:  #fef2f2;
  --danger-mid:   #fecaca;

  --warning:      #92400e;
  --warning-soft: #fffbeb;
  --warning-mid:  #fde68a;

  --info:         #1d4ed8;
  --info-soft:    #eff6ff;
  --info-mid:     #bfdbfe;

  /* Header (noir profond — autorité, focus) */
  --header:       #0c0a09;
  --header-text:  #fafaf9;
  --header-muted: #a8a29e;

  /* Ombres douces */
  --shadow-xs:  0 1px 2px rgb(28 25 23 / .05);
  --shadow-sm:  0 1px 3px rgb(28 25 23 / .08), 0 1px 2px rgb(28 25 23 / .06);
  --shadow:     0 4px 6px rgb(28 25 23 / .07), 0 2px 4px rgb(28 25 23 / .05);
  --shadow-md:  0 10px 15px rgb(28 25 23 / .08), 0 4px 6px rgb(28 25 23 / .05);
  --shadow-lg:  0 20px 25px rgb(28 25 23 / .10), 0 8px 10px rgb(28 25 23 / .06);

  /* Radius cohérent */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs:  6px;

  /* Focus ring orange */
  --focus: 0 0 0 3px rgb(234 88 12 / .35);

  /* Typographie (Cairo لعناوين وKPIs، IBM Plex Sans Arabic للنصوص والأسئلة) */
  --font-heading: 'Cairo', 'Tajawal', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font: var(--font-body);

  /* Taille de base augmentée (accessibilité + lisibilité) */
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;

  /* Transitions douces */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur:  150ms;

  color-scheme: light;
}

/* ── Mode sombre Permicode Standard (#0E1013 / #161920 / #272B36) ────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0E1013;
    --surface:      #161920;
    --surface-1:    #161920;
    --surface-2:    #1E222B;
    --surface-3:    #272B36;
    --border:       #272B36;
    --border-strong:#383E4D;
    --glass-border: #272B36;
    --text:         #F9FAFB;
    --text-soft:    #E5E7EB;
    --muted:        #9CA3AF;
    --primary:      #FF7A00;
    --primary-strong:#EA6C00;
    --primary-soft: rgb(255 122 0 / .14);
    --primary-mid:  rgb(255 122 0 / .3);
    --orange-500:   #FF7A00;
    --orange-600:   #EA6C00;
    --on-primary:   #0E1013;
    --success:      #22C55E;
    --success-soft: rgb(34 197 94 / .15);
    --success-mid:  rgb(34 197 94 / .35);
    --danger:       #EF4444;
    --danger-soft:  rgb(239 68 68 / .15);
    --danger-mid:   rgb(239 68 68 / .35);
    --warning:      #F59E0B;
    --warning-soft: rgb(245 158 11 / .15);
    --warning-mid:  rgb(245 158 11 / .35);
    --info:         #3B82F6;
    --info-soft:    rgb(59 130 246 / .15);
    --info-mid:     rgb(59 130 246 / .35);
    --header:       #0E1013;
    --header-text:  #F9FAFB;
    --header-muted: #9CA3AF;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-sm: 0 1px 3px rgb(0 0 0 / .5), 0 1px 2px rgb(0 0 0 / .4);
    --shadow:    0 4px 6px rgb(0 0 0 / .5), 0 2px 4px rgb(0 0 0 / .4);
    --shadow-md: 0 10px 15px rgb(0 0 0 / .6), 0 4px 6px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:           #0E1013;
  --surface:      #161920;
  --surface-1:    #161920;
  --surface-2:    #1E222B;
  --surface-3:    #272B36;
  --border:       #272B36;
  --border-strong:#383E4D;
  --glass-border: #272B36;
  --text:         #F9FAFB;
  --text-soft:    #E5E7EB;
  --muted:        #9CA3AF;
  --primary:      #FF7A00;
  --primary-strong:#EA6C00;
  --primary-soft: rgb(255 122 0 / .14);
  --primary-mid:  rgb(255 122 0 / .3);
  --orange-500:   #FF7A00;
  --orange-600:   #EA6C00;
  --on-primary:   #0E1013;
  --success:      #22C55E;
  --success-soft: rgb(34 197 94 / .15);
  --success-mid:  rgb(34 197 94 / .35);
  --danger:       #EF4444;
  --danger-soft:  rgb(239 68 68 / .15);
  --danger-mid:   rgb(239 68 68 / .35);
  --warning:      #F59E0B;
  --warning-soft: rgb(245 158 11 / .15);
  --warning-mid:  rgb(245 158 11 / .35);
  --info:         #3B82F6;
  --info-soft:    rgb(59 130 246 / .15);
  --info-mid:     rgb(59 130 246 / .35);
  --header:       #0E1013;
  --header-text:  #F9FAFB;
  --header-muted: #9CA3AF;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .5);
  --shadow:    0 4px 6px rgb(0 0 0 / .5);
  --shadow-md: 0 10px 15px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* ── Reset & base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;              /* Interline généreux — réduit fatigue de lecture */
  font-size: var(--text-base);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
}
img, svg, video, canvas, iframe, picture {
  max-width: 100%;
  height: auto;
  display: block;
  box-sizing: border-box;
}

/* ── Global Zero-Overflow Containment ── */
main,
#app,
.main-content,
.view-container,
.app-shell,
.pg,
.pg-narrow,
.dash,
.chat-page,
.signs-page,
.champ-page,
.schools-view,
.admin-view,
.lessons-container,
.axis-detail-view,
.pre-series-page,
.exam-intro,
.results {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Flex and Grid Items zero-overflow shrink rules */
.pg > *,
.pg-narrow > *,
.dash > *,
.grid > *,
.row > *,
.page-head > *,
.page-header > *,
.card,
.card-simple,
.axis-wide-card,
.series-tile,
.cat-tile,
.sign-card,
.scenario-card,
.lx-card,
.lesson-card,
.axis-flow-section,
.dash-kpis > *,
.school-stats-row > *,
.axis-cards-grid > *,
.cat-grid > *,
.series-tile-grid > *,
.dash-signs-grid > *,
.extra-signs-grid > *,
.signs-grid > *,
.axis-signs-grid > *,
.scenarios-grid > *,
.dash-four-grid > *,
.qa-grid > *,
.dash-stats > *,
.res-counts > *,
.exam-facts > *,
.home-steps > *,
.stu-counts > *,
.simple-grid > *,
.pre-series-grid > *,
.pre-activity-kpis > *,
.pre-timer-options > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Global Media, Tables, Modals, Tabs Zero-Overflow Containment ── */
table,
.table-wrap,
.admin-table-wrap,
.prose table {
  max-width: 100%;
  box-sizing: border-box;
}
.table-wrap,
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.modal,
.modal-overlay .modal,
.qcard-modal-wrap,
.rv-modal,
.um-modal,
.champ-modal,
.res-modal-wrap,
#signs-modal-content,
dialog {
  min-width: 0;
  max-width: min(100%, calc(100vw - 32px)) !important;
  box-sizing: border-box !important;
}
@media (max-width: 480px) {
  .modal,
  .modal-overlay .modal,
  .qcard-modal-wrap,
  .rv-modal,
  .um-modal,
  .champ-modal,
  .res-modal-wrap,
  #signs-modal-content,
  dialog {
    max-width: calc(100vw - 16px) !important;
    padding: 16px 14px !important;
  }
}
.tabs,
.filter-pills-wrap,
.signs-tabs,
.lessons-axis-tabs,
.il-axis-pills {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
a { color: var(--primary); }
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.3;
  margin: 0 0 .5em;
  font-weight: 800;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h2 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }
.dash-kpi strong, .stat-value, .rd-ring-label, .ticket-name, .ticket-stub strong,
.qa strong, .simple-card strong, .stat-tile strong, .cat-head strong {
  font-family: var(--font-heading);
}
.question-text, .q-text, .nrs-q-text, .nrs-q-main, .nrs-sub-label {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-weight: 700;
  line-height: 1.55;
  color: #FFFFFF;
}
.prose {
  font-family: var(--font-body);
}
.quiz, .quiz-layout, .qz-window, .qcard, .practice, .series-tile-grid, .exam-intro {
  font-family: 'Tajawal', 'Cairo', sans-serif;
}
.q-option, .q-option-text, .nrs-opt, .nrs-opt-text {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-weight: 600;
  line-height: 1.45;
}

/* فرض حد أدنى 44px لمناطق اللمس (44px+ minimum touch targets) */
.btn, .icon-btn, .nav-item, .main-nav a, .staff-side a, .side-toggle, .side-open-btn,
.qa, .simple-card, .choice-btn, .opt-btn, .nrs-choice-btn, .nrs-btn-ok, .nrs-btn-stop, .nrs-btn-correct,
.topbar-mode-btn, .lang-picker-btn, .user-dropdown-item, .user-menu-btn {
  min-height: 44px;
  box-sizing: border-box;
}
.icon-btn, .side-toggle, .side-open-btn, .topbar-mode-btn, .user-menu-btn {
  min-width: 44px;
}
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -100px; background: var(--primary); color: var(--on-primary); padding: .6rem 1.2rem; border-radius: 8px; z-index: 200; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 1rem; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ── En-tête ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--header);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 0 rgb(255 255 255 / .06), 0 4px 20px rgb(0 0 0 / .3);
  padding-top: env(safe-area-inset-top, 0px);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Logo & marque */
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: transparent;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgb(0 0 0 / .2);
  flex: none;
  overflow: hidden;
}
.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.brand small { display: block; font-weight: 500; font-size: .7rem; color: var(--header-muted); margin-top: 1px; }

/* Navigation */
.main-nav { display: flex; gap: 2px; margin-inline-start: 20px; }
.main-nav a {
  color: #d6d3d1;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .93rem;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.main-nav a:hover { background: rgb(255 255 255 / .08); color: #fff; }
.main-nav a[aria-current="page"] {
  background: rgb(234 88 12 / .2);
  color: #fb923c;
}

/* Actions header */
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: rgb(255 255 255 / .07);
  color: #e7e5e4;
  border: 1px solid rgb(255 255 255 / .12);
  border-radius: 10px;
  height: 44px; min-width: 44px; padding: 0 12px;
  cursor: pointer;
  font: inherit; font-weight: 700; font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: rgb(255 255 255 / .14); border-color: rgb(255 255 255 / .2); }

/* Mobile nav */
.menu-toggle { display: none; }
.mobile-nav { display: none; }
@media (max-width: 960px) {
  .main-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .mobile-nav.open {
    display: flex; flex-direction: column;
    background: var(--header);
    padding: 8px 16px 20px;
    border-top: 1px solid rgb(255 255 255 / .08);
    gap: 2px;
  }
  .mobile-nav a {
    color: #d6d3d1; padding: 12px 14px; text-decoration: none;
    border-radius: 10px; font-weight: 600; font-size: 1rem;
    transition: background var(--dur) var(--ease);
  }
  .mobile-nav a[aria-current="page"] { background: rgb(234 88 12 / .2); color: #fb923c; }
  .brand small { display: none; }
  .header-inner { height: 60px; }
}

/* ── Mise en page principale ─────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
main:focus { outline: none; }
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 24px 20px;
  text-align: center;
  background: var(--surface);
}
.site-footer a { color: var(--muted); }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 14px; margin-bottom: 24px;
}
.page-head p { color: var(--muted); margin: 0; }
/* alias pour pages qui utilisent encore .page-header */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-header p { color: var(--muted); margin: 0; }
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* Grilles */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.muted  { color: var(--muted); }
.small  { font-size: var(--text-sm); }

/* ── Cartes ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card h3 { margin-bottom: .4em; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

/* Carte stat (dashboard) */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { color: var(--muted); font-size: var(--text-sm); font-weight: 600; }

/* ── Hero section ────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0c0a09 0%, #1c1917 50%, #2d1a0a 100%);
  color: #fafaf9;
  border-radius: 20px;
  padding: clamp(28px, 5vw, 56px);
  position: relative;
  overflow: hidden;
  border: 1px solid rgb(234 88 12 / .2);
  box-shadow: var(--shadow-md);
}
/* Décoration géométrique subtile */
.hero::before {
  content: '';
  position: absolute;
  inset-inline-end: -60px;
  top: -60px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(234 88 12 / .15) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset-inline-start: -40px;
  bottom: -80px;
  width: 250px; height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(251 146 60 / .08) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 { color: #fff; max-width: 760px; margin-top: 14px; }
.hero p  { color: #d6d3d1; max-width: 680px; font-size: 1.08rem; }
.hero .pill { background: rgb(234 88 12 / .2); color: #fb923c; border-color: rgb(234 88 12 / .4); }
.feature-icon { font-size: 1.8rem; line-height: 1; margin-bottom: 10px; }

/* ── Pastilles ───────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.pill-primary  { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-mid); }
.pill-success  { background: var(--success-soft); color: var(--success); border-color: var(--success-mid); }
.pill-danger   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-mid); }
.pill-warning  { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-mid); }
.pill-info     { background: var(--info-soft);    color: var(--info);    border-color: var(--info-mid); }

/* ── Boutons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .95rem;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  min-height: 46px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 3px rgb(234 88 12 / .3), 0 4px 12px rgb(234 88 12 / .2);
}
.btn-primary:hover {
  background: var(--primary-strong);
  box-shadow: 0 1px 3px rgb(194 65 12 / .4), 0 6px 16px rgb(194 65 12 / .25);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-ghost   { background: transparent; color: var(--primary); border-color: transparent; }
.btn-ghost:hover { background: var(--primary-soft); }

.btn-sm { padding: 7px 14px; min-height: 44px; font-size: var(--text-sm); border-radius: 8px; }
.btn-lg { padding: 14px 26px; font-size: 1.08rem; min-height: 52px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Formulaires ─────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label { font-weight: 700; font-size: .9rem; }
.field .hint { color: var(--muted); font-size: .8rem; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  min-height: 46px;
  width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea { min-height: 120px; resize: vertical; }
input[type="checkbox"], input[type="radio"] {
  width: 20px; height: 20px; min-height: 0;
  accent-color: var(--primary);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(234 88 12 / .2);
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin-bottom: 16px;
  border: 1px solid var(--danger-mid);
}
.auth-card { max-width: 440px; margin: 28px auto; }

/* ── Barres de progression ───────────────────────────────────────────── */
.progress {
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--orange-400));
  border-radius: inherit;
  transition: width .4s var(--ease);
}
.progress.warn > span { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress.bad  > span { background: linear-gradient(90deg, #dc2626, #f87171); }

/* Anneau circulaire */
.ring {
  --v: 0; --c: var(--primary);
  width: 136px; height: 136px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-2) 0);
  display: grid; place-items: center; flex: none;
  box-shadow: var(--shadow-sm);
}
.ring > div {
  width: 108px; height: 108px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  text-align: center;
  font-weight: 800; font-size: 1.7rem; line-height: 1.1;
}
.ring small { display: block; font-size: .68rem; color: var(--muted); font-weight: 600; }

/* ── Tableaux ────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: start; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 800; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface-2); }

/* ── Leçons (prose) ──────────────────────────────────────────────────── */
.prose { max-width: 820px; font-size: 1.05rem; line-height: 1.8; }
.prose h2 { margin-top: 1.8em; padding-bottom: .35em; border-bottom: 2px solid var(--border); }
.prose h3 { margin-top: 1.4em; color: var(--primary); }
.prose ul, .prose ol { padding-inline-start: 1.5em; }
.prose li { margin-bottom: .4em; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 14px 18px;
  background: var(--warning-soft);
  border-inline-start: 4px solid #f59e0b;
  border-radius: 10px;
  color: var(--warning);
}
.prose blockquote p { margin: 0; }
.prose table { margin: 1.2em 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: block; overflow-x: auto; }
.prose code { background: var(--surface-2); padding: 2px 7px; border-radius: 5px; font-size: .88em; }

/* Mise en avant des règles importantes (boîte d'encadré) */
.rule-box {
  background: var(--primary-soft);
  border: 1.5px solid var(--primary-mid);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 1em 0;
  font-weight: 700;
  color: var(--primary-strong);
}
.rule-box::before { content: '⚠️ '; }

/* ── Simulateur d'examen / Quiz ──────────────────────────────────────── */
.quiz {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) { .quiz { grid-template-columns: 1fr; } }

.quiz-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Minuteur */
.timer {
  --p: 100;
  position: relative;
  width: 68px; height: 68px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.timer::before {
  content: '';
  position: absolute;
  inset: 7px;
  background: var(--surface);
  border-radius: 50%;
}
.timer span { position: relative; }
.timer.low {
  background: conic-gradient(var(--danger) calc(var(--p) * 1%), var(--surface-2) 0);
  color: var(--danger);
  animation: pulse-timer 1s ease-in-out infinite;
}
@keyframes pulse-timer { 0%, 100% { box-shadow: var(--shadow-sm); } 50% { box-shadow: 0 0 0 4px rgb(185 28 28 / .25); } }

/* Zone visuelle (image/scène) */
.scene {
  background: #0c0a09;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  max-height: 360px;
  width: 100%;
  display: grid; place-items: center;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.scene-svg  { width: 100%; height: 100%; }
.scene-photo { width: 100%; height: 100%; object-fit: contain; background: #0c0a09; }

/* Texte de question — hiérarchie cognitive claire */
.question-text {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.5;
  color: var(--text);
}

/* Options de réponse — design épuré, espacé */
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font: inherit; font-size: 1.05rem; font-weight: 600;
  color: var(--text);
  text-align: start;
  width: 100%;
  min-height: 60px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.option:hover:not([disabled]) {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(-2px);
  box-shadow: var(--shadow-sm);
}

/* Numéro d'option */
.option .num {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  font-weight: 800;
  font-size: .95rem;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}

/* Sélectionnée */
.option[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary-mid);
}
.option[aria-pressed="true"] .num {
  background: var(--primary);
  color: var(--on-primary);
  border-color: transparent;
}

/* Résultats */
.option.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}
.option.is-correct .num { background: var(--success); color: #fff; border-color: transparent; }
.option.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.option.is-wrong .num { background: var(--danger); color: #fff; border-color: transparent; }
.option .mark { margin-inline-start: auto; font-weight: 800; font-size: 1.1rem; }
.option[disabled] { cursor: default; }

/* Feedback — psychologie positive : séparation claire succès/échec */
.feedback {
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  animation: fade-in .2s var(--ease);
}
.feedback.ok {
  background: var(--success-soft);
  border-color: var(--success-mid);
}
.feedback.ko {
  background: var(--danger-soft);
  border-color: var(--danger-mid);
}
.feedback strong { display: block; margin-bottom: 6px; font-size: 1rem; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.quiz-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* Navigation questions (mini grille) */
.qnav { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.qnav button, .qnav span {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font: inherit; font-size: .78rem; font-weight: 800;
  color: var(--muted);
  display: grid; place-items: center; padding: 0;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.qnav button { cursor: pointer; }
.qnav button:hover { background: var(--surface-3); }
.qnav .cur  { outline: 2.5px solid var(--primary); color: var(--text); }
.qnav .done { background: var(--surface-3); color: var(--text-soft); }
.qnav .ok   { background: var(--success-soft); color: var(--success); border-color: var(--success-mid); }
.qnav .ko   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-mid); }

.kbd {
  display: inline-block;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--surface-2);
}

/* ── Résultats ───────────────────────────────────────────────────────── */
.result-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.result-hero.pass { border-color: var(--success); }
.result-hero.fail { border-color: var(--danger); }

/* Score verdict (grand affichage — impact psychologique positif/négatif) */
.verdict-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius);
  font-weight: 800; font-size: 1.1rem;
}
.verdict-banner.pass {
  background: var(--success-soft);
  border: 1.5px solid var(--success-mid);
  color: var(--success);
}
.verdict-banner.fail {
  background: var(--danger-soft);
  border: 1.5px solid var(--danger-mid);
  color: var(--danger);
}

.review-item { border-inline-start: 4px solid var(--border); padding-inline-start: 14px; }
.review-item.ok { border-inline-start-color: var(--success); }
.review-item.ko { border-inline-start-color: var(--danger); }
.review-item .scene { max-height: 200px; max-width: 320px; }

.answers-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 7px; }
.answers-list li {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .95rem;
}
.answers-list li.c {
  background: var(--success-soft);
  border-color: var(--success-mid);
  font-weight: 700;
  color: var(--success);
}
.answers-list li.w {
  background: var(--danger-soft);
  border-color: var(--danger-mid);
  text-decoration: line-through;
  color: var(--muted);
}

/* ── Tabs / Admin ────────────────────────────────────────────────────── */
.tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tabs a {
  padding: 10px 16px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: color var(--dur), border-color var(--dur), background var(--dur);
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; margin-bottom: 16px;
}
.toolbar input, .toolbar select { width: auto; min-width: 160px; flex: 1 1 160px; }

.thumb {
  width: 72px; height: 58px; border-radius: 10px;
  overflow: hidden; background: #0c0a09; flex: none;
  border: 1px solid var(--border);
}
.thumb svg, .thumb img { width: 100%; height: 100%; object-fit: cover; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.picker-list {
  max-height: 50vh; overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.picker-list label {
  display: flex; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; align-items: flex-start;
  transition: background var(--dur);
}
.picker-list label:hover { background: var(--surface-2); }

/* ── Toasts ──────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom, 20px)); inset-inline-start: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1100; width: min(92vw, 420px);
}
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast {
  background: #1c1917; color: #fafaf9;
  padding: 13px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  animation: toast-in .2s var(--ease);
  border: 1px solid rgb(255 255 255 / .08);
}
.toast.error { background: #450a0a; border-color: var(--danger-mid); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Dialogues ───────────────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(94vw, 720px);
  max-height: 90vh;
  max-height: 90dvh;
  box-shadow: var(--shadow-lg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
dialog::backdrop { background: rgb(12 10 9 / .7); backdrop-filter: blur(4px); }
.dialog-body { padding: 24px; overflow: auto; max-height: calc(90vh - 80px); }
.dialog-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 0 0 20px 20px;
}

/* ── États vides / chargement ────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .big { font-size: 2.8rem; margin-bottom: 12px; }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); gap: 16px; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilitaires ─────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.font-bold   { font-weight: 700; }
.font-black  { font-weight: 800; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.mt-auto { margin-top: auto; }
.w-full  { width: 100%; }

/* ── Badge de catégorie (محاور NARSA) ────────────────────────────────── */
.cat-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .8rem; font-weight: 700;
  border: 1px solid;
}
.cat-road     { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.cat-traffic  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.cat-driver   { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.cat-vehicle  { background: #faf5ff; color: #7c3aed; border-color: #e9d5ff; }
.cat-offences { background: #fff1f2; color: #be123c; border-color: #fecdd3; }

/* ── Dashboard — accent orange sur les cartes de stats ───────────────── */
.stat-card-primary { border-top: 3px solid var(--primary); }
.stat-card-success  { border-top: 3px solid var(--success); }
.stat-card-warning  { border-top: 3px solid #d97706; }

/* ── Section étapes (pédagogie) ──────────────────────────────────────── */
.steps-grid { counter-reset: step; }
.step-card {
  counter-increment: step;
  position: relative;
  padding-top: 10px;
}
.step-card::before {
  content: counter(step);
  position: absolute;
  top: -16px; inset-inline-start: 20px;
  width: 32px; height: 32px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: .9rem;
  box-shadow: 0 2px 8px rgb(234 88 12 / .3);
}

/* ── Barre de progression globale (SRS) ──────────────────────────────── */
.mastery-bar { position: relative; }
.mastery-bar .bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.mastery-bar .fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange-500), var(--orange-400));
  transition: width .6s var(--ease);
}

/* ── Responsive helpers ──────────────────────────────────────────────── */

/* ── Tablette (641px – 960px) ──────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 960px) {
  main { padding: 20px 18px 56px; }
  .header-inner { padding: 0 16px; }
  .hero { padding: 32px 24px; }
  .card { padding: 18px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-sidebar { position: static; }
  .q-nav-grid { grid-template-columns: repeat(10, 1fr); }
  .verdict-card { padding: 24px; }
  .table-wrap { font-size: .88rem; }
  th, td { padding: 9px 12px; }
}

/* ── Mobile standard (max 640px) ──────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 14px 12px 56px; }
  .header-inner { height: 56px; padding: 0 12px; gap: 8px; }
  .brand { font-size: 1rem; gap: 8px; }
  .brand-logo { width: 36px; height: 36px; border-radius: 10px; }
  .brand small { display: none; }
  .header-actions { gap: 6px; }
  .icon-btn { height: 36px; min-width: 36px; padding: 0 10px; font-size: .8rem; }

  .card { padding: 14px; border-radius: 12px; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; }
  .hero { padding: 20px 16px; border-radius: 14px; }
  .hero p { font-size: 1rem; }
  .question-text { font-size: 1.05rem; }
  .btn-lg { font-size: 1rem; padding: 12px 18px; min-height: 48px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }

  .page-head { gap: 10px; margin-bottom: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .stat-value { font-size: 1.6rem; }
  .ring { width: 110px; height: 110px; }
  .ring > div { width: 86px; height: 86px; font-size: 1.4rem; }

  /* Tableaux — scroll horizontal + taille réduite */
  .table-wrap { border-radius: 10px; font-size: .82rem; }
  th { font-size: .72rem; padding: 8px 10px; }
  td { padding: 8px 10px; }

  /* Toolbar empilée */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { min-width: 100%; flex: none; }

  /* Tabs scrollables */
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
          scrollbar-width: none; gap: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; padding: 9px 13px; font-size: .88rem; }

  /* Dialog plein écran sur mobile */
  dialog { width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0;
           position: fixed; bottom: 0; margin: 0; max-height: 92vh; }
  .dialog-body { padding: 18px 16px; }
  .dialog-foot { padding: 14px 16px; }

  /* Toasts plus larges */
  .toasts { width: 96vw; bottom: 16px; }
  .toast { padding: 12px 16px; font-size: .9rem; }

  /* Auth card */
  .auth-card { margin: 16px auto; }
}

/* ── Très petit mobile (max 400px) ────────────────────────────────── */
@media (max-width: 400px) {
  main { padding: 12px 10px 52px; }
  .header-inner { padding: 0 10px; }
  .card { padding: 12px; }
  h1 { font-size: 1.25rem; }
  .hero { padding: 16px 12px; }
  .btn { padding: 10px 14px; font-size: .9rem; }
  .icon-btn { height: 34px; min-width: 34px; padding: 0 8px; font-size: .78rem; }
}

/* ── Large desktop (> 1240px) ────────────────────────────────────── */
@media (min-width: 1240px) {
  main { max-width: 1360px; padding: 32px 32px 72px; }
  .header-inner { max-width: 1360px; padding: 0 32px; }
  .hero { padding: 60px 48px; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════
   QUIZ & EXAM — Design spécialisé pour l'interface d'examen
   Principes : focus total, hiérarchie optique, réduction distractions
   ══════════════════════════════════════════════════════════════════════ */

/* ── Barre supérieure du quiz ──────────────────────────────────────── */
.quiz-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.quiz-header .quiz-title {
  font-size: 1rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px;
}
.quiz-mode-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-mid);
}
.quiz-mode-badge.exam-mode {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-mid);
}

/* ── Layout grille quiz ────────────────────────────────────────────── */
.quiz-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  direction: rtl; /* السايدبار يمين، المحتوى يسار */
}
/* عناصر داخل quiz-layout تعود للاتجاه الطبيعي */
.quiz-layout > * { direction: rtl; }
@media (max-width: 1000px) { .quiz-layout { grid-template-columns: 1fr; direction: rtl; } }

/* ── Carte question principale ─────────────────────────────────────── */
.qcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.qcard-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.qcard-body { padding: 24px 20px; }

/* ── Question Card Preview Modal (unified NARSA-style) ──────────── */
.qcard-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.qcard-modal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  width: 100%; max-width: 600px; max-height: 90vh;
  overflow: hidden;
}
.qcard-modal-wrap--wide { max-width: 860px; }
.qcard-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.qcard-modal-title {
  font-size: .85rem; font-weight: 700; color: var(--text);
  margin: 0;
}
.qcard-modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.3rem; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: color .15s, background .15s;
}
.qcard-modal-close:hover { color: var(--text); background: var(--hover); }
.qcard-modal-body {
  flex: 1; overflow-y: auto;
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 18px;
}

/* ── Question card inside modal ─────────────────────────────────── */
.qcard-modal-body .qcard-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.qcard-id {
  background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 800;
  padding: 2px 8px; border-radius: 999px;
  letter-spacing: .04em;
}
.qcard-cat {
  background: var(--surface-2); color: var(--muted);
  font-size: .72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border);
}
.qcard-badge {
  background: #f59e0b22; color: #d97706;
  font-size: .72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid #f59e0b44;
}
.qcard-media {
  border-radius: 8px; overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.qcard-media img, .qcard-media video {
  width: 100%; display: block; border-radius: 8px;
}
.qcard-media--empty {
  font-size: 2.5rem; color: var(--muted);
  opacity: .35; padding: 24px;
}
.qcard-explanation {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .82rem; color: var(--muted);
  line-height: 1.6;
}
.qcard-explanation strong {
  display: block; margin-bottom: 4px;
  color: var(--text); font-size: .78rem; font-weight: 700;
}
.qcard-series-more {
  text-align: center; color: var(--muted);
  font-size: .8rem; padding: 8px 0 4px;
  border-top: 1px solid var(--border);
}

/* ── Numéro de question (grand, lisible) ──────────────────────────── */
.q-number {
  font-size: .78rem; font-weight: 800;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Texte de la question (cœur cognitif) ─────────────────────────── */
.q-text {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 20px;
}
/* Indice multi-réponse — subtil, non distrayant */
.q-hint {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 700;
  color: var(--info);
  background: var(--info-soft);
  border: 1px solid var(--info-mid);
  padding: 3px 10px; border-radius: 999px;
  margin-bottom: 14px;
}

/* ── Options de réponse — design épuré et espacé ──────────────────── */
.q-options { display: grid; gap: 10px; margin-bottom: 20px; }

.q-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font: inherit; font-size: 1.05rem; font-weight: 600;
  color: var(--text);
  text-align: start; width: 100%; min-height: 60px;
  transition: border-color var(--dur) var(--ease),
              background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  position: relative;
}
.q-option:hover:not([disabled]) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary-mid) inset;
}
/* Chiffre indicateur */
.q-option-num {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  font-weight: 800; font-size: .92rem;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
  color: var(--text-soft);
}
.q-option-text { flex: 1; line-height: 1.45; white-space: normal; word-break: break-word; }

/* Sélectionné */
.q-option[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary-mid) inset;
}
.q-option[aria-pressed="true"] .q-option-num {
  background: var(--primary);
  color: var(--on-primary);
  border-color: transparent;
}

/* Révélation — Correct */
.q-option.opt-correct {
  border-color: var(--success);
  background: var(--success-soft);
  box-shadow: 0 0 0 1px var(--success-mid) inset;
}
.q-option.opt-correct .q-option-num {
  background: var(--success); color: #fff; border-color: transparent;
}
/* Révélation — Incorrect sélectionné */
.q-option.opt-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 0 0 1px var(--danger-mid) inset;
}
.q-option.opt-wrong .q-option-num {
  background: var(--danger); color: #fff; border-color: transparent;
}

.q-option-mark { margin-inline-start: auto; font-size: 1.1rem; font-weight: 800; flex: none; }
.q-option[disabled] { cursor: default; }

/* ── Feedback (résultat de la réponse) ─────────────────────────────── */
.q-feedback {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  animation: slide-up .2s var(--ease);
  border: 1.5px solid;
}
.q-feedback.fb-ok {
  background: var(--success-soft);
  border-color: var(--success-mid);
  color: var(--success);
}
.q-feedback.fb-ko {
  background: var(--danger-soft);
  border-color: var(--danger-mid);
  color: var(--danger);
}
.q-feedback-title {
  font-weight: 800; font-size: 1rem; margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.q-feedback-explain {
  color: var(--text-soft); font-weight: 500; line-height: 1.65; font-size: .95rem;
}
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Actions (boutons bas de carte) ───────────────────────────────── */
.q-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.q-actions .spacer { flex: 1; }

/* ── Sous-questions (double) ──────────────────────────────────────── */
.sub-q-block {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}
.sub-q-label {
  padding: 10px 16px;
  background: var(--surface-2);
  font-size: .82rem; font-weight: 800;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sub-q-label .sub-q-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: .7rem; font-weight: 800;
  display: grid; place-items: center; flex: none;
}
.sub-q-text {
  padding: 14px 16px 0;
  font-size: 1.08rem; font-weight: 700; line-height: 1.5;
  color: var(--text);
}
.sub-q-options { padding: 10px 12px 12px; display: grid; gap: 8px; }

/* ── Panneau latéral (navigation + timer) ──────────────────────────── */
.quiz-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 88px; /* hauteur header fixe + marge */
}
.quiz-sidebar h3 {
  font-size: .78rem; font-weight: 800;
  color: var(--muted); letter-spacing: .06em; text-transform: uppercase;
  margin: 0 0 10px;
}

/* Minuteur amélioré */
.q-timer-wrap {
  display: flex; justify-content: center; align-items: center;
  margin-bottom: 20px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.q-timer {
  --p: 100;
  position: relative;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  transition: background .1s;
}
.q-timer::before {
  content: '';
  position: absolute;
  inset: 8px;
  background: var(--surface);
  border-radius: 50%;
}
.q-timer-val {
  position: relative; z-index: 1;
  font-weight: 800; font-size: 1.4rem;
  line-height: 1;
}
.q-timer-label {
  position: absolute; bottom: -20px; inset-inline: 0;
  text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted);
}
.q-timer.timer-low {
  background: conic-gradient(var(--danger) calc(var(--p) * 1%), var(--surface-2) 0);
  color: var(--danger);
  animation: pulse-ring 1s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: 0 0 0 5px rgb(185 28 28 / .2); }
}

/* Grille navigation questions */
.q-nav-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 14px; }
.q-nav-grid button, .q-nav-grid span {
  aspect-ratio: 1; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font: inherit; font-size: .75rem; font-weight: 800;
  color: var(--muted);
  display: grid; place-items: center; padding: 0;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.q-nav-grid button:hover { background: var(--surface-3); }
.q-nav-grid .nav-cur {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-mid);
}
.q-nav-grid .nav-done { background: var(--surface-3); color: var(--text-soft); border-color: var(--border-strong); }
.q-nav-grid .nav-ok   { background: var(--success-soft); color: var(--success); border-color: var(--success-mid); }
.q-nav-grid .nav-ko   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-mid); }

/* Barre de progression globale */
.quiz-progress-wrap { margin-bottom: 16px; }
.quiz-progress-info {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; font-weight: 700; color: var(--muted);
  margin-bottom: 6px;
}
.quiz-progress-bar {
  height: 6px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.quiz-progress-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--orange-400));
  transition: width .4s var(--ease);
}

/* ── Page résultats — verdict principal ───────────────────────────── */
.verdict-card {
  border-radius: var(--radius);
  padding: 32px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 28px;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.verdict-card.v-pass {
  background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);
  border: 1.5px solid var(--success-mid);
}
.verdict-card.v-fail {
  background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
  border: 1.5px solid var(--danger-mid);
}
.verdict-card.v-neutral {
  background: linear-gradient(135deg, #0c0a09 0%, #1c1917 100%);
  border: 1.5px solid var(--border);
}
.verdict-score-ring {
  --v: 0; --c: var(--primary);
  width: 148px; height: 148px; flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), rgb(255 255 255 / .08) 0);
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .08);
}
.verdict-score-inner {
  width: 116px; height: 116px; border-radius: 50%;
  background: rgb(0 0 0 / .4);
  display: grid; place-items: center;
  text-align: center;
  font-weight: 800; font-size: 2rem; color: #fff; line-height: 1.1;
}
.verdict-score-inner small { display: block; font-size: .7rem; color: rgb(255 255 255 / .6); font-weight: 600; }
.verdict-info { flex: 1; min-width: 220px; color: #fff; }
.verdict-label {
  font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.verdict-sub { color: rgb(255 255 255 / .6); font-size: .95rem; margin-bottom: 16px; }
.verdict-pass-mark { font-size: 1.1rem; font-weight: 700; opacity: .9; margin-bottom: 20px; }

/* Feux de catégories sur résultats */
.cat-result-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cat-result-row:last-child { border-bottom: 0; }
.cat-result-label { flex: 1; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.cat-result-score {
  font-weight: 800; font-size: .92rem;
  min-width: 56px; text-align: end;
  color: var(--text-soft);
}
.cat-result-bar { flex: 2; }

/* Élément de révision individuel */
.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur);
}
.review-card:hover { box-shadow: var(--shadow-sm); }
.review-card-header {
  padding: 12px 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.review-card.rc-ok .review-card-header { background: var(--success-soft); border-color: var(--success-mid); }
.review-card.rc-ko .review-card-header { background: var(--danger-soft);  border-color: var(--danger-mid); }
.review-card-body { padding: 18px 20px; }

/* Liste de réponses améliorée */
.ans-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 7px; }
.ans-list li {
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .95rem; display: flex; align-items: center; gap: 8px;
}
.ans-list li.ans-c {
  background: var(--success-soft); border-color: var(--success-mid);
  font-weight: 700; color: var(--success);
}
.ans-list li.ans-w {
  background: var(--danger-soft); border-color: var(--danger-mid);
  color: var(--muted); text-decoration: line-through;
}
.ans-list-num {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  background: var(--border); display: grid; place-items: center;
  font-weight: 800; font-size: .78rem;
}
.ans-c .ans-list-num { background: var(--success); color: #fff; }
.ans-w .ans-list-num { background: var(--danger);  color: #fff; }

/* Explication */
.q-explain {
  background: var(--warning-soft);
  border: 1px solid var(--warning-mid);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: .93rem; line-height: 1.6;
  margin-top: 10px; color: var(--text-soft);
  display: flex; gap: 10px;
}
.q-explain-icon { flex: none; font-size: 1rem; margin-top: 2px; }

/* ── Intro Examen ──────────────────────────────────────────────────── */
.exam-intro-card {
  max-width: 640px; margin: 0 auto;
}
.exam-rule {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: .95rem;
}
.exam-rule:last-child { border-bottom: 0; }
.exam-rule-icon {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary-soft); border: 1px solid var(--primary-mid);
  display: grid; place-items: center; font-size: .95rem;
}

/* ── Responsive quiz — tablette ──────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1000px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-sidebar { position: static; }
  .q-nav-grid { grid-template-columns: repeat(10, 1fr); }
  .quiz-header { padding: 12px 16px; }
}

/* ── Responsive quiz — mobile ─────────────────────────────────────── */
@media (max-width: 640px) {
  .quiz-header { padding: 10px 12px; border-radius: 10px; gap: 8px; }
  .quiz-header .quiz-title { font-size: .9rem; }
  .qcard-body { padding: 14px 12px; }
  .qcard-header { padding: 10px 12px; }
  .q-text { font-size: 1.08rem; }
  .q-number { font-size: .72rem; }
  .q-option { padding: 11px 12px; min-height: 52px; font-size: .97rem; gap: 10px; }
  .q-option-num { width: 32px; height: 32px; border-radius: 8px; font-size: .85rem; }
  .q-feedback { padding: 12px 14px; }
  .q-actions { gap: 8px; padding-top: 12px; }
  .q-actions .btn { flex: 1; justify-content: center; }

  /* Sidebar en bas sur mobile */
  .quiz-sidebar { position: static; padding: 14px 12px; border-radius: 10px; }
  .quiz-sidebar h3 { font-size: .72rem; }
  .q-nav-grid { grid-template-columns: repeat(8, 1fr); gap: 4px; }
  .q-nav-grid button, .q-nav-grid span { font-size: .7rem; border-radius: 6px; }
  .q-timer-wrap { margin-bottom: 14px; padding-bottom: 14px; }
  .q-timer { width: 68px; height: 68px; }
  .q-timer-val { font-size: 1.2rem; }

  /* Résultats */
  .verdict-card { padding: 18px 14px; gap: 18px; border-radius: 14px; }
  .verdict-label { font-size: 1.3rem; }
  .verdict-score-ring { width: 110px; height: 110px; }
  .verdict-score-inner { width: 86px; height: 86px; font-size: 1.5rem; }
  .verdict-info { min-width: unset; }

  /* Sous-questions double */
  .sub-q-text { font-size: 1rem; padding: 12px 12px 0; }
  .sub-q-options { padding: 8px 10px 10px; }

  /* Navigation quiz */
  .quiz-layout { gap: 14px; }

  /* Scène image */
  .scene { max-height: 240px; border-radius: 10px; margin-bottom: 14px; }
}

/* ══ Results page ═══════════════════════════════════════════════════ */
/* ملخص سريع */
.results-summary {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin-bottom: 24px;
}
.summary-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 24px; min-width: 90px;
  box-shadow: var(--shadow-sm);
}
.summary-num {
  font-size: 2rem; font-weight: 800; line-height: 1;
}
.summary-lbl {
  font-size: .78rem; color: var(--muted); font-weight: 600;
}
.summary-ok .summary-num { color: var(--success); }
.summary-ko .summary-num { color: var(--danger); }
.summary-skip .summary-num { color: var(--muted); }
.summary-score .summary-num { color: var(--primary); }

/* نتائج حسب المحور */
.cat-results-grid {
  display: flex; flex-direction: column; gap: 10px;
}
.cat-result-row {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px; align-items: center;
  box-shadow: var(--shadow-sm);
}
.cat-result-row.cat-ok { border-inline-start: 4px solid var(--success); }
.cat-result-row.cat-mid { border-inline-start: 4px solid var(--warning); }
.cat-result-row.cat-ko { border-inline-start: 4px solid var(--danger); }
.cat-result-info {
  display: flex; align-items: center; gap: 10px;
}
.cat-result-icon { font-size: 1.1rem; }
.cat-result-name { font-weight: 600; font-size: .95rem; flex: 1; }
.cat-result-pct { font-weight: 800; font-size: .95rem; }
.cat-ok .cat-result-pct { color: var(--success); }
.cat-mid .cat-result-pct { color: var(--warning); }
.cat-ko .cat-result-pct { color: var(--danger); }
.cat-result-track {
  grid-column: 1; height: 6px; background: var(--border);
  border-radius: 100px; overflow: hidden;
}
.cat-result-bar {
  height: 100%; border-radius: 100px; transition: width .6s ease;
  background: var(--primary);
}
.cat-ok .cat-result-bar { background: var(--success); }
.cat-mid .cat-result-bar { background: var(--warning); }
.cat-ko .cat-result-bar { background: var(--danger); }
.cat-result-detail {
  grid-column: 2; grid-row: 1 / 3;
  font-size: .82rem; color: var(--muted); align-self: center;
}

/* أزرار الإجراءات */
.results-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; margin-bottom: 32px;
}

/* رأس بطاقة المراجعة */
.review-card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; flex-wrap: wrap;
}
.review-verdict-ok { margin-inline-start: auto; color: var(--success); font-weight: 800; font-size: 1.1rem; }
.review-verdict-ko { margin-inline-start: auto; color: var(--danger);  font-weight: 800; font-size: 1.1rem; }

/* قائمة الإجابات */
.ans-list {
  list-style: none; padding: 0; margin: 10px 0 0;
  display: flex; flex-direction: column; gap: 6px;
}
.ans-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  background: var(--surface-2); font-size: .93rem;
  border: 1.5px solid transparent;
}
.ans-list li.ans-c {
  background: color-mix(in srgb, var(--success) 8%, transparent);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}
.ans-list li.ans-w {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}
.ans-num {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  background: var(--border); display: grid; place-items: center;
  font-weight: 800; font-size: .78rem;
}
.ans-c .ans-num { background: var(--success); color: #fff; }
.ans-w .ans-num { background: var(--danger); color: #fff; }
.ans-mark { margin-inline-start: auto; font-weight: 800; font-size: .9rem; }

/* فلاتر المراجعة */
.filter-btn { opacity: .65; }
.filter-btn.active { opacity: 1; background: var(--surface-2); border-color: var(--border); }

/* قسم عنوان */
.section-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  margin: 0 0 16px; padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-mid);
}

/* responsive results */
@media (max-width: 640px) {
  .results-summary { gap: 8px; justify-content: space-between; }
  .summary-item { padding: 12px 10px; min-width: 70px; flex: 1; }
  .summary-num { font-size: 1.5rem; }
  .summary-lbl { font-size: .7rem; }
  .results-actions { flex-direction: column; align-items: stretch; }

  /* Révision mobile */
  .review-card-body { padding: 14px 12px; }
  .review-card-header { padding: 10px 12px; }
  .cat-result-row { padding: 10px 12px; border-radius: 10px; }
  .cat-result-name { font-size: .88rem; }
  .section-title { font-size: 1rem; margin-bottom: 12px; }
}

@media (min-width: 641px) and (max-width: 960px) {
  .results-summary { justify-content: center; gap: 10px; }
  .results-actions { justify-content: center; }
}

/* ══════════════════════════════════════════════════════════════════════
   ADMIN — Responsive amélioré
   ══════════════════════════════════════════════════════════════════════ */

/* Boutons d'action en ligne (statut questions) */
.q-status-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 8px; border-radius: 6px;
  font-size: .78rem; font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer; min-height: 30px;
  transition: background var(--dur), border-color var(--dur);
  white-space: nowrap;
}
.q-status-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }

/* Tablette admin */
@media (min-width: 641px) and (max-width: 960px) {
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { min-width: 130px; }
  th { font-size: .74rem; padding: 8px 10px; }
  td { padding: 8px 10px; font-size: .88rem; }
  .thumb { width: 56px; height: 46px; }
  .tabs a { padding: 9px 13px; font-size: .9rem; }
}

/* Mobile admin */
@media (max-width: 640px) {
  /* Tableau admin scrollable, colonnes moins larges */
  .table-wrap table { min-width: 540px; }
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Boutons statut plus petits */
  .q-status-btn { padding: 3px 6px; font-size: .72rem; min-height: 26px; }

  /* Toolbar admin empilée */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar input, .toolbar select { width: 100%; min-width: auto; flex: none; }
  .toolbar .row { flex-wrap: nowrap; overflow-x: auto; gap: 6px; }

  /* Vignette plus petite */
  .thumb { width: 48px; height: 40px; border-radius: 8px; }

  /* Page head admin */
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head .row { width: 100%; }
  .page-head .btn { width: 100%; justify-content: center; }

  /* Tabs admin scrollables */
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .tabs a { white-space: nowrap; }

  /* Formulaire édition question */
  .auth-card { max-width: 100%; margin: 10px 0; }

  /* Paginateur */
  .pager { flex-wrap: wrap; gap: 6px; }
  .pager .btn { padding: 8px 12px; min-height: 38px; }

  /* Verdict card résultats admin */
  .verdict-card { flex-direction: column; align-items: center; text-align: center; }
}

/* Très petit mobile admin */
@media (max-width: 400px) {
  .table-wrap table { min-width: 480px; }
  .q-status-btn { padding: 2px 5px; font-size: .68rem; }
  .thumb { width: 40px; height: 34px; }
}

/* ── إبراز الحقل الخاطئ في النماذج ──────────────────────────────── */
.field-error-msg {
  color: var(--danger);
  font-size: .8rem;
  font-weight: 700;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: fade-in .2s var(--ease);
}
[data-field-error] {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgb(185 28 28 / .18) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   نظام تتبع امتحانات رخصة السياقة — Exam Journey System
   ═══════════════════════════════════════════════════════════════════════ */

/* ── الشارات (badges) ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: var(--surface-2, #f1f5f9); color: var(--text-2, #64748b); }
[data-theme="dark"] .badge-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-error   { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-info    { background: #1e3a5f; color: #93c5fd; }

/* ── واجهة الامتحانات العامة ── */
.exams-view { max-width: 860px; margin: 0 auto; }
.exams-view .page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.exams-view .page-header h2 { margin: 0; font-size: 1.3rem; }

/* ── تبويبات الامتحانات ── */
.exam-tabs {
  display: flex; gap: 4px; border-bottom: 2px solid var(--border, #e2e8f0);
  margin-bottom: 20px; overflow-x: auto;
}
.exam-tabs .tab-btn {
  padding: 8px 18px; border: none; background: transparent; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--text-2, #64748b);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: all .15s;
}
.exam-tabs .tab-btn.active,
.exam-tabs .tab-btn:hover {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
}

/* ── لوحات التبويبات ── */
.exam-panel { animation: fade-in .2s var(--ease); }
.exam-panel.hidden { display: none; }

/* ── بطاقة مسار الامتحان ── */
.exam-journey-card {
  background: var(--card, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 14px;
  transition: box-shadow .15s;
}
.exam-journey-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.exam-journey-card--archived { opacity: .85; border-style: dashed; }

.exam-journey-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.exam-student-name { display: block; font-weight: 700; font-size: 1rem; }
.exam-student-email { font-size: .8rem; color: var(--text-2, #64748b); }

/* ── خطوات المسار ── */
.exam-steps { display: flex; flex-direction: column; gap: 10px; }

.exam-step {
  background: var(--surface-2, #f8fafc); border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px; padding: 10px 14px;
}
.exam-step--next {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}
.exam-step--done { background: var(--surface, #f0fdf4); }

.exam-step-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.exam-step-header strong { font-size: .9rem; }

.exam-step-date {
  font-size: .82rem; color: var(--text-2, #64748b);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.exam-step-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── عنوان تاريخ اليوم ── */
.exam-day-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 14px;
  color: var(--primary, #2563eb);
}

/* ── قسم الأرشيف ── */
.archive-section-title {
  font-size: 1rem; font-weight: 700; margin: 18px 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--border, #e2e8f0);
}

/* ── الحالة النهائية ── */
.exam-final-status {
  margin-top: 20px; padding: 18px; border-radius: 12px; text-align: center;
  font-size: 1.3rem; font-weight: 800;
}
.exam-final-status.licensed { background: #d1fae5; color: #065f46; }
.exam-final-status.not-licensed { background: #fee2e2; color: #991b1b; }

/* ── الخطوة القادمة (تاغ) ── */
.next-step-tag {
  font-size: .78rem; background: #eff6ff; color: #1d4ed8;
  padding: 2px 8px; border-radius: 6px; font-weight: 600;
}

/* ── ملاحظة ── */
.exam-note {
  margin-top: 10px; font-size: .82rem; color: var(--text-2, #64748b);
  font-style: italic;
}
.exam-enroll-hint { font-size: .82rem; margin-top: 10px; }

/* ── تأكيد النتيجة في المودال ── */
.exam-result-confirm-value { font-size: 1.2rem; font-weight: 800; margin: 10px 0; }
.text-success { color: #059669; }
.text-error   { color: #dc2626; }

/* ── النموذج المودال (مشترك) ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
  animation: fade-in .15s var(--ease);
}
.modal-overlay .modal {
  background: var(--card, #fff); border-radius: 14px; padding: 28px 24px;
  max-width: 440px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: slide-up .18s var(--ease);
}
.modal-overlay .modal h3 { margin: 0 0 18px; font-size: 1.1rem; }
.modal-overlay .modal-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.temp-pwd-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.temp-pwd-box code { font-size: 1rem; letter-spacing: .05em; color: var(--primary); font-weight: 700; }
.temp-pwd-box .field-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-error { color: var(--danger, #dc2626); font-size: .82rem; margin-top: 8px; }
.form-error.hidden { display: none; }

/* ── Btn utilitaires ── */
.btn-xs { padding: 3px 8px; font-size: .75rem; min-height: 26px; border-radius: 5px; }
.btn-success {
  background: #059669; color: #fff; border: none; cursor: pointer;
  font-weight: 600; border-radius: 7px; padding: 6px 14px; transition: background .15s;
}
.btn-success:hover { background: #047857; }
.btn-error {
  background: #dc2626; color: #fff; border: none; cursor: pointer;
  font-weight: 600; border-radius: 7px; padding: 6px 14px; transition: background .15s;
}
.btn-error:hover { background: #b91c1c; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .exam-journey-top { flex-direction: column; }
  .exam-step-actions { flex-direction: column; }
  .exam-tabs { gap: 2px; }
  .exam-tabs .tab-btn { padding: 7px 10px; font-size: .8rem; }
}

[data-theme="dark"] .exam-journey-card { background: var(--surface); border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .exam-step { background: rgba(255,255,255,.04); }
[data-theme="dark"] .exam-step--done { background: rgba(5,150,105,.1); }
[data-theme="dark"] .modal-overlay .modal { background: var(--surface); border: 1px solid rgba(255,255,255,.08); }
[data-theme="dark"] .exam-final-status.licensed { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .exam-final-status.not-licensed { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .next-step-tag { background: #1e3a5f; color: #93c5fd; }

/* ═══════════════════════════════════════════════════════════════════════
   مؤسسات تعليم السياقة — Schools Management
   ═══════════════════════════════════════════════════════════════════════ */
.schools-view { max-width: 960px; margin: 0 auto; }

/* إحصاءات سريعة */
.school-stats-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0;
}
.school-stat {
  flex: 1; min-width: 100px;
  background: var(--surface-2, #f8fafc); border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px; padding: 14px 16px; text-align: center;
}
.school-stat strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary, #2563eb); }
.school-stat span { font-size: .82rem; color: var(--text-2, #64748b); }

/* قسم داخل تفاصيل المؤسسة */
.school-section { margin-top: 24px; }
.school-section h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--border, #e2e8f0);
}

/* نتائج البحث في مودال النسب */
.enroll-result-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border, #e2e8f0); font-size: .88rem;
}
.enroll-result-row:last-child { border-bottom: none; }
.enroll-result-row:hover { background: var(--surface-2, #f8fafc); }

/* حقل صف (checkbox + label) */
.field-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }

[data-theme="dark"] .school-stat { background: var(--surface); border-color: rgba(255,255,255,.08); }

/* نموذج NARSA — شبكة حقلين بجانب بعض */
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .field-row-2 { grid-template-columns: 1fr; } }
.narsa-section { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.narsa-form { overflow-y: auto; max-height: 85vh; }

/* ── نافذة مراجعة سؤال (صفحة النتائج) ── */
.rv-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.rv-modal { background: var(--surface, #fff); color: var(--text, inherit); border-radius: 16px; width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.rv-body { overflow-y: auto; padding: 14px; flex: 1; }
.rv-body .review-card { margin: 0; box-shadow: none; }
.rv-foot { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border, #e5e7eb); }
[data-theme="dark"] .rv-modal { background: var(--surface); border: 1px solid rgba(255,255,255,.08); }

/* ── نافذة السلسلة المنبثقة (الأسئلة + مكان الإجابة) ── */
.qz-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(15,23,42,.62); display: flex; align-items: center; justify-content: center; padding: 14px; }
.qz-window { background: var(--bg, #f8fafc); width: min(1120px, 100%); height: min(100%, 940px); border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.4); display: flex; flex-direction: column; overflow: hidden; }
.qz-window > .quiz-header { flex: none; margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.qz-window > .quiz-layout { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; align-items: start; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.qz-window .quiz-sidebar { position: static; }
/* تابلت */
@media (max-width: 1000px) {
  .qz-overlay { padding: 8px; }
  .qz-window { height: 100%; }
  .qz-window > .quiz-layout { padding: 12px; }
}
/* هاتف: ملء الشاشة وأزرار الإجابة ثابتة بالأسفل */
@media (max-width: 640px) {
  .qz-overlay { padding: 0; }
  .qz-window { width: 100%; height: 100dvh; border-radius: 0; }
  .qz-window > .quiz-layout { padding: 10px; gap: 12px; }
  .qz-window .quiz-progress-wrap { display: none; }
  .qz-window .qcard { overflow: visible; }
  .qz-window .q-actions { position: sticky; bottom: -1px; background: var(--surface); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); margin-top: 12px; border-top: 1px solid var(--border); z-index: 2; }
}

/* ── الشريط الجانبي المبسّط: الوقت + رقم السؤال فقط ── */
.q-current { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 2px; }
.q-current-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.q-current-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; color: var(--text); }
@media (max-width: 1000px) {
  .qz-window .quiz-sidebar { display: flex; flex-direction: row; align-items: center; justify-content: space-around; gap: 16px; padding: 10px 14px; }
  .qz-window .quiz-sidebar .q-timer-wrap { margin: 0; padding: 0; border: 0; }
  .qz-window .quiz-sidebar .q-current { padding: 0; }
}

/* ══ نافذة السلسلة: السؤال + الأجوبة كلها في شاشة واحدة بدون تمرير ══ */
.qz-window > .quiz-header { padding: 8px 14px; gap: 8px; }
.qz-window > .quiz-layout {
  overflow: hidden; padding: 12px; gap: 12px; align-items: stretch;
  grid-template-columns: minmax(0, 1fr) 150px; grid-template-rows: minmax(0, 1fr);
}
.qz-window .qcard { height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.qz-window .qcard-header { flex: none; padding: 6px 12px; }
.qz-window .qcard-body { flex: 1; min-height: 0; padding: 12px 14px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.qz-window .qcard-body.has-media { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.qz-window .qz-media { min-height: 0; display: flex; align-items: center; justify-content: center; }
.qz-window .qz-media .scene {
  margin: 0 !important; width: 100%; height: 100%; max-height: none; aspect-ratio: auto;
  display: flex; align-items: center; justify-content: center;
}
.qz-window .qz-media .scene img, .qz-window .qz-media .scene svg, .qz-window .qz-media .scene video, .qz-window .qz-media .scene iframe { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.qz-window .qz-main { min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; }
.qz-window .q-number { margin: 0; }
.qz-window .q-text { font-size: clamp(1rem, 1.5vw, 1.25rem); margin: 0; line-height: 1.5; }
.qz-window .q-options, .qz-window .sub-q-options { gap: 8px; }
.qz-window .q-option { min-height: 44px; height: auto; overflow: visible; line-height: 1.45; padding: 8px 12px; }
.qz-window .q-actions { margin-top: auto; padding-top: 8px; position: sticky; bottom: 0; background: var(--surface); }
/* الشريط الجانبي المصغّر */
.qz-window .quiz-sidebar { padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; align-self: start; }
.qz-window .quiz-sidebar .q-timer-wrap { margin: 0; padding: 0 0 10px; width: 100%; flex-direction: column; border-bottom: 1px solid var(--border); }
.qz-window .quiz-sidebar .q-timer { width: 72px; height: 72px; }
.qz-window .q-current-num { font-size: 1.4rem; }

/* تابلت وهاتف: الشريط في الأعلى، الصورة فوق السؤال بارتفاع محدود */
@media (max-width: 1000px) {
  .qz-window > .quiz-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); padding: 8px; gap: 8px; }
  .qz-window .quiz-sidebar { order: -1; flex-direction: row; justify-content: space-around; width: 100%; padding: 6px 10px; align-self: stretch; }
  .qz-window .quiz-sidebar .q-timer-wrap { flex-direction: row; width: auto; padding: 0; border: 0; gap: 10px; }
  .qz-window .quiz-sidebar .q-timer { width: 48px; height: 48px; }
  .qz-window .quiz-sidebar .q-timer::before { inset: 5px; }
  .qz-window .quiz-sidebar .q-timer-val { font-size: 1rem; }
  .qz-window .q-current { flex-direction: row; gap: 8px; padding: 0; }
  .qz-window .q-current-num { font-size: 1.15rem; }
  .qz-window .qcard-body, .qz-window .qcard-body.has-media { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 32%) minmax(0, 1fr); gap: 8px; padding: 8px 10px; }
  .qz-window .qcard-body:not(.has-media) { grid-template-rows: minmax(0, 1fr); }
  .qz-window .q-option { min-height: 40px; padding: 6px 10px; font-size: .95rem; }
  .qz-window .q-option-num { width: 28px; height: 28px; }
}
@media (max-width: 640px) {
  .qz-window .qcard { overflow: hidden; }
  .qz-window .q-actions { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}
.qz-window .q-timer-label { position: static; display: block; margin-top: 6px; text-align: center; }
@media (max-width: 1000px) { .qz-window .q-timer-label { display: none; } }

/* الصورة في الأعلى والسؤال + الأجوبة في الأسفل (كل الشاشات) */
.qz-window .qcard-body.has-media { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 44%) minmax(0, 1fr); gap: 10px; }
.qz-window .qcard-body:not(.has-media) { grid-template-rows: minmax(0, 1fr); }
@media (min-width: 1001px) {
  .qz-window .qz-main .q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ── لوحة أرقام الجواب في الشريط الجانبي ── */
.q-pad-wrap { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.q-pad-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.q-pad-label { font-weight: 800; font-size: .8rem; color: var(--muted); }
.q-pad { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.q-pad-btn { width: 42px; height: 42px; border-radius: 10px; border: 2px solid var(--border-strong, var(--border)); background: var(--surface); color: var(--text); font-size: 1.05rem; font-weight: 800; cursor: pointer; transition: transform .08s, background .12s; }
.q-pad-btn:hover:not([disabled]) { background: var(--surface-3, var(--surface-2)); }
.q-pad-btn:active:not([disabled]) { transform: scale(.94); }
.q-pad-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.q-pad-btn.opt-correct { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.q-pad-btn.opt-wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.q-pad-btn[disabled] { cursor: default; }
/* صورة أوضح في الأعلى */
.qz-window .qcard-body.has-media { grid-template-rows: minmax(0, 50%) minmax(0, 1fr); }
@media (max-width: 1000px) {
  .qz-window .quiz-sidebar { flex-wrap: wrap; }
  .qz-window .q-pad-wrap { width: auto; padding: 0; border: 0; flex-direction: row; }
  .qz-window .q-pad-btn { width: 36px; height: 36px; font-size: .95rem; }
}
@media (max-width: 1000px) { .qz-window .qcard-body.has-media { grid-template-rows: minmax(0, 36%) minmax(0, 1fr); } }

/* ── لوحة الجواب: مكان ثابت لا يتحرك، الأرقام 1..4 في خانات ثابتة ── */
.q-pad-wrap { flex: none; }
.q-pad { display: grid; grid-template-columns: repeat(2, 42px); grid-auto-rows: 42px; gap: 6px; justify-content: center; align-content: start; min-height: 90px; flex-wrap: nowrap; }
.q-pad-btn { width: 42px; height: 42px; }
.q-pad-wrap:has(.q-pad-label) .q-pad { grid-template-columns: repeat(4, 34px); grid-auto-rows: 34px; gap: 4px; min-height: 34px; }
.q-pad-wrap:has(.q-pad-label) .q-pad-btn { width: 34px; height: 34px; font-size: .9rem; }
.q-pad-wrap:has(.q-pad-label) .q-pad-row { gap: 4px; flex-wrap: nowrap; }
@media (max-width: 1000px) {
  .q-pad { grid-template-columns: repeat(4, 36px); grid-auto-rows: 36px; min-height: 36px; }
  .q-pad-btn { width: 36px; height: 36px; }
}

/* Actions unifiées des listes d'administration */
.list-table td { vertical-align: middle; }
.act-row { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
.list-table td:last-child { white-space: nowrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; min-height: 32px;
  border: 1px solid var(--border, #ddd); border-radius: 8px; background: var(--surface, #fff);
  color: inherit; font: inherit; font-size: .8rem; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.act-btn:hover { background: var(--primary-soft, #eef); border-color: var(--primary-mid, #99f); }
.act-btn:disabled { opacity: .45; cursor: not-allowed; }
.act-btn.act-danger { color: var(--danger, #c00); }
.act-btn.act-danger:hover { background: var(--danger-soft, #fee); border-color: var(--danger-mid, #f99); }
@media (max-width: 760px) { .act-btn .act-lbl { display: none; } .act-btn { padding: 6px 9px; } }

/* ── قائمة المؤسسة الجانبية ───────────────────────────────────────────── */
.school-side {
  position: fixed; inset-block-start: var(--hdr-h, 70px); inset-block-end: 0; inset-inline-start: 0;
  width: 230px; padding: 18px 12px; overflow: auto; z-index: 30;
  background: var(--surface, #fff); border-inline-end: 1px solid var(--border, #ddd);
}
.school-side .side-title { font-weight: 800; margin: 0 8px 12px; color: var(--muted, #64748b); font-size: .8rem; letter-spacing: .04em; }
.school-side nav { display: flex; flex-direction: column; gap: 4px; }
.school-side a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: inherit; text-decoration: none; font-weight: 600; font-size: .92rem;
}
.school-side a:hover { background: var(--primary-soft, #fef3ee); }
.school-side a[aria-current="page"] { background: var(--primary, #c2410c); color: #fff; }

/* ── لوحة إحصائيات المؤسسة ─────────────────────────────────────────────── */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.dash-kpi {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; text-decoration: none; color: inherit;
  background: var(--surface, #fff); border: 1px solid var(--border, #ddd); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.dash-kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / .1); border-color: var(--primary, #c2410c); }
.dash-kpi.no-link { cursor: default; }
.dash-kpi.no-link:hover { transform: none; box-shadow: none; border-color: var(--border, #ddd); }
.dash-kpi strong { font-size: 1.7rem; line-height: 1.1; }
.dash-kpi-ic { font-size: 1.3rem; }
.dash-h { margin: 0 0 12px; font-size: 1rem; }
.dash-seg { display: inline-flex; border: 1px solid var(--border, #ddd); border-radius: 10px; overflow: hidden; }
.dash-seg button { border: 0; background: transparent; padding: 7px 14px; font: inherit; font-size: .85rem; cursor: pointer; color: inherit; }
.dash-seg button.on { background: var(--primary, #c2410c); color: #fff; }
.dash-bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-bottom: 2px; }
.dash-bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 26px; flex: 1; cursor: default; }
.dash-bar-col .small { font-size: .62rem; margin-top: 4px; white-space: nowrap; }
.dash-bar { width: 100%; max-width: 30px; min-height: 4px; display: flex; flex-direction: column; border-radius: 5px 5px 0 0; overflow: hidden; flex: none; align-self: center; margin-top: auto; }
.dash-hrow { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; text-decoration: none; color: inherit; }
.dash-hrow:hover { background: var(--primary-soft, #fef3ee); }
.dash-track { flex: 1; height: 10px; border-radius: 99px; background: var(--border, #e5e7eb); overflow: hidden; }
.dash-track i { display: block; height: 100%; border-radius: 99px; transition: width .4s; }
.dash-stack { display: flex; height: 22px; border-radius: 99px; overflow: hidden; background: var(--border, #e5e7eb); }
.dash-stack i { display: block; transition: flex .3s; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dash-lg { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border, #ddd); background: transparent; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: .82rem; cursor: pointer; color: inherit; }
.dash-lg.off { opacity: .4; text-decoration: line-through; }
.dash-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline: 4px 2px; }
.dash-day { margin-bottom: 12px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-chip { display: flex; flex-direction: column; gap: 1px; min-width: 110px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: inherit; border: 1px solid var(--border, #ddd); background: var(--surface, #fff); }
.dash-chip:hover { border-color: var(--primary, #c2410c); }
.dash-chip.is-full { border-color: var(--danger, #dc2626); background: var(--danger-soft, #fee2e2); }
.dash-tip { position: fixed; z-index: 9999; pointer-events: none; background: #111827; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .8rem; max-width: 280px; box-shadow: 0 4px 14px rgb(0 0 0 / .3); }

/* ═══ Unified User Modal (.um-*) ═══════════════════════════════════════════════ */
.um-modal { width: min(700px, 100%); }
.um-head { display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--border,#e5e7eb); }
.um-head h3 { margin:0; font-size:1.1rem; }
.um-x { background:0; border:0; cursor:pointer; font-size:1.2rem; color:var(--muted); padding:4px 8px; border-radius:6px; }
.um-x:hover { background:var(--border,#e5e7eb); }
.um-body { max-height: 60vh; overflow-y: auto; }
.um-meta { display:flex; gap:8px; margin-bottom:14px; }
.um-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px 16px; }
.um-row { display:flex; flex-direction:column; gap:2px; padding:5px 0; border-bottom:1px solid var(--border-soft,#f1f5f9); }
.um-row span { font-size:.74rem; color:var(--muted); }
.um-row b { font-size:.9rem; word-break:break-word; }
.um-prog { margin-bottom:12px; padding-bottom:12px; border-bottom:1px solid var(--border,#e5e7eb); }
.dash-track { height:8px; border-radius:99px; background:var(--border,#ddd); overflow:hidden; margin-top:4px; }
.dash-track i { display:block; height:100%; border-radius:inherit; }
[data-view] { cursor:pointer; color:var(--primary,#c2410c); text-decoration:underline; text-underline-offset:2px; }
[data-view]:hover { opacity:.8; }
@media (max-width:540px) { .um-grid { grid-template-columns:1fr; } .um-modal { width:100%; border-radius:12px 12px 0 0; align-self:flex-end; } }
/* Staff sidebar — works for school, instructor, admin */
.staff-side { position:fixed; top:var(--hdr-h,64px); inset-inline-start:0; bottom:0; width:224px; overflow-y:auto; padding:16px 10px; background:var(--surface,#fff); border-inline-end:1px solid var(--border,#e5e7eb); z-index:200; }
.staff-side .side-title { font-weight:800; margin:0 8px 12px; color:var(--muted,#64748b); font-size:.8rem; letter-spacing:.04em; }
.staff-side .side-title:empty { display:none; margin:0; }
.staff-side nav { display:flex; flex-direction:column; gap:4px; }
.staff-side a { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px; color:var(--text); text-decoration:none; font-size:.9rem; }
.staff-side a:hover { background:var(--primary-soft,#fef3ee); }
.staff-side a[aria-current="page"] { background:var(--primary,#c2410c); color:#fff; }

/* ══════════════════════════════════════════════════════════════════════════
   واجهة الامتحان — الشكل الكلاسيكي لشاشة NARSA
   (لوحة جانبية على اليسار، صورة فوق صندوق أسود، شريط سفلي من أربع خانات)
   بدون تأثيرات زجاجية أو بطاقات: ألوان مسطحة وزوايا صغيرة كما في الأصل.
   ══════════════════════════════════════════════════════════════════════════ */
.nrs-overlay {
  position: fixed; inset: 0; z-index: 950;
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  align-items: stretch;
  justify-content: center;
  background-color: #12131c;
  padding: 0.6rem;
  overflow: hidden;
  --nrs-serif: 'Tajawal', 'Cairo', sans-serif;
  --nrs-font: 'Tajawal', 'Cairo', sans-serif;
  --nrs-ui: 'Tajawal', 'Cairo', Tahoma, 'Segoe UI', Arial, sans-serif;
  --exam-font-size: clamp(1.2rem, 2.2vw, 1.75rem);
  font-family: 'Tajawal', 'Cairo', sans-serif;
}
.nrs-window {
  direction: ltr;                        /* نبقيو LTR على المستوى العلوي — RTL يتطبق فقط على nrs-content-row */
  display: flex;
  flex-flow: column nowrap;
  flex: 1 1 0%;
  height: 100%;
  max-height: 100%;
  justify-content: flex-start;
  width: 100%;
  background-color: #181926;
  border-radius: 0.8rem;
  overflow: hidden;
  box-shadow: rgba(0,0,0,0.5) 0 8px 30px;
}

/* الصف الرئيسي: السايدبار يسار والشاشة الرئيسية يمين في RTL */
.nrs-content-row {
  display: flex;
  flex-direction: row;
  direction: rtl;
  gap: 0.6rem;
  align-items: stretch;
  flex: 1 1 0%;
  min-height: 0;
  padding: 0.6rem;
  overflow: hidden;
}

/* ── الشاشة الرئيسية: الصورة ثم لوحة الأسئلة ── */
.nrs-main {
  order: 1;
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #000;
  border-radius: 0.6rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
/* الصورة: تناسب متوازن ومريح */
.nrs-media {
  flex: 0 0 52%;
  max-height: 54%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}
.nrs-media img, .nrs-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.nrs-media.has-video > * { width: 100%; height: 100%; margin: 0 !important; max-height: none !important; }
.nrs-img-wrap { width: 100%; height: 100%; display: flex; }
.nrs-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.nrs-img-wrap svg { width: 100%; height: 100%; }
.nrs-no-media { display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 5rem; width: 100%; height: 100%; background: rgb(255,255,255); }

/* لوحة النص: تأخذ المساحة المتبقية وتملأها بشكل مريح */
.nrs-text-panel {
  flex: 1 1 0%; min-height: 0;
  background: rgb(34,34,34);
  padding: 16px 16px 14px;
  padding-inline: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  scrollbar-width: thin; scrollbar-color: #555 rgb(34,34,34);
  font-family: 'Tajawal', 'Cairo', sans-serif;
  color: #F8FAFC;
  box-sizing: border-box;
}
.nrs-text-panel.has-result { overflow-y: auto; }

/* نص السؤال: أبيض مكبَّر وواضح */
.nrs-q-main {
  color: #FFFFFF;
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.55;
  text-align: right;
  direction: rtl;
  margin: 0 0 0.4rem;
  padding: 2px 2px 6px;
  flex-shrink: 0;
}
.nrs-sub-label {
  color: #FFFFFF;
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 700;
  line-height: 1.55;
  margin: 4px 0 2px;
}
.nrs-q-main,
.nrs-sub-label,
.nrs-text-panel .nrs-q-main,
.nrs-text-panel .nrs-sub-label {
  color: #FFFFFF !important;
}
/* كتلة الاختيارات: تملأ العرض والارتفاع كاملاً */
.nrs-block {
  width: 100%;
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 10px;
  min-height: 0;
}
.nrs-opts-list {
  display: flex; flex-direction: column;
  gap: 8px; flex: 1 1 0%;
  justify-content: space-evenly;
  min-height: 0;
}
.nrs-opts-row {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 6%;
  flex: 1 1 0%; align-content: space-around; gap: 10px;
}

/* ═══ سطر خيار NARSA الأصلي ═══
   التصميم: 1  ————————————  نَعَمْ
   DOM: [nrs-opt-n] [nrs-opt-line] [nrs-opt-text]
   direction:ltr → رقم يسار | خط يمتد | نص يمين */
/* سطر الخيار */
.nrs-opt {
  display: flex;
  flex-direction: row;
  direction: ltr;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: clamp(1.05rem, 1.8vw, 1.4rem);
  font-weight: 600;
  line-height: 1.45;
  color: #FFFFFF;
  cursor: pointer;
  overflow: visible;
  min-height: 44px;
  height: auto;
  flex: 1 1 auto;
}
.nrs-opt:last-child { border-bottom: none; }
.nrs-opt.sub-on { background: rgba(255,255,255,0.06); border-radius: 3px; }

/* الرقم: يسار — أبيض */
.nrs-opt-n {
  color: #FFFFFF;
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: 1em;
  font-weight: 700;
  flex: 0 0 auto;
  min-width: 1.8em;
  text-align: left;
  direction: ltr;
}
/* الخط الأفقي الأبيض الممتد — مثل الصورة الأصلية */
.nrs-opt-dots {
  flex: 1 1 auto;
  height: 2px;
  background: rgba(255,255,255,0.7);
  margin: 0 8px;
  border: none;
  border-bottom: none;
  transform: none;
  align-self: center;
}
/* النص العربي: أبيض، يمين */
.nrs-opt-text {
  color: #F8FAFC;
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-weight: 600;
  line-height: 1.45;
  flex: 0 1 auto;
  white-space: normal;
  word-break: break-word;
  text-align: right;
  direction: rtl;
  min-width: 0;
  max-width: 75%;
}
/* حالة الإجابة الصحيحة/الخاطئة */
.nrs-opt.sub-ok .nrs-opt-text,
.nrs-opt.sub-ok .nrs-opt-n { color: #4ade6e; }
.nrs-opt.sub-wrong .nrs-opt-text,
.nrs-opt.sub-wrong .nrs-opt-n { color: #ff7a70; }

/* السؤال المزدوج: عنوان كل جزء — مثل الصورة */
.nrs-sub-label { color: #FFFFFF; font-family: 'Tajawal', 'Cairo', sans-serif; font-size: clamp(1.2rem, 2.2vw, 1.75rem); font-weight: 700; line-height: 1.55; text-align: right; direction: rtl; padding: 6px 0 2px; border-top: 1px solid rgba(255,255,255,0.15); margin-top: 8px; }
.nrs-sub-label:first-child { border-top: none; margin-top: 0; }
/* التصحيح في وضع التمرين: نص بسيط داخل الصندوق الأسود */
.nrs-fb { margin-top: 8px; padding-top: 6px; border-top: 1px solid #444; font-size: clamp(1.05rem, 1.9vw, 1.35rem); font-weight: 700; text-align: right; }
.nrs-fb.is-ok { color: #4ade6e; } .nrs-fb.is-ko { color: #ff7a70; }
/* ظهور تدريجي ناعم لسطر التصحيح والشرح */
@keyframes nrs-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.nrs-fb { animation: nrs-fade .4s ease both; }
.nrs-fb-text { animation: nrs-fade .4s ease .12s both; }
@media (prefers-reduced-motion: reduce) { .nrs-fb, .nrs-fb-text { animation: none; } }
.nrs-fb-text { color: #f2f2f2; font-size: clamp(1rem, 1.7vw, 1.2rem); line-height: 1.6; text-align: right; }


/* ══════════════════════════════════════════════════════════════════════════
   Desktop / Web (>= 769px and landscape): Classic NARSA Metallic Console
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (orientation: landscape) {
  .nrs-topbar {
    display: none !important;
  }

  .nrs-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    padding: 6px;
    background: #11141c;
    display: flex;
    align-items: stretch;
    justify-content: center;
    box-sizing: border-box;
  }

  /* الإطار الخارجي الفضي المعدني ثلاثي الأبعاد (3D Bevel Frame) */
  .nrs-window {
    direction: ltr;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(145deg, #e5e7eb 0%, #d1d5db 45%, #9ca3af 100%);
    border: 3px solid #9ca3af;
    border-radius: 8px;
    box-shadow:
      inset 2px 2px 0 rgba(255, 255, 255, 0.8),
      inset -2px -2px 0 rgba(75, 85, 99, 0.7),
      0 8px 24px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
  }

  /* الصف الرئيسي الأفقي (Main Screen + Side Keypad) */
  .nrs-content-row {
    direction: rtl;
    display: flex;
    flex-direction: row;
    flex: 1 1 0%;
    min-height: 0;
    padding: 4px 6px 3px;
    gap: 8px;
    overflow: hidden;
    align-items: stretch;
  }

  /* ── الشاشة الرئيسية (تأخذ كامل المساحة المتبقية على اليسار): أسود نقي #000 ── */
  .nrs-main {
    order: 2;
    flex: 1 1 0%;
    min-width: 0;
    width: auto;
    max-width: none;
    background: #000;
    border-radius: 8px;
    border: 3px solid #111;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.95), 0 4px 12px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .nrs-media {
    flex: 0 0 47%;
    height: 47%;
    max-height: 48%;
    min-height: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 2px solid #1e2029;
  }

  .nrs-media img,
  .nrs-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .nrs-text-panel {
    flex: 0 0 53%;
    height: 53%;
    min-height: 0;
    background: #000;
    padding: 6px 16px;
    padding-inline: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    color: #F8FAFC;
    box-sizing: border-box;
  }

  .nrs-q-main {
    color: #FFFFFF;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(0.95rem, 1.4vw, 1.25rem);
    font-weight: 700;
    line-height: 1.35;
    text-align: right;
    margin: 0;
    padding: 0 0 2px;
    flex-shrink: 0;
  }

  .nrs-sub-label {
    color: #FFFFFF;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(0.85rem, 1.25vw, 1.15rem);
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    padding: 2px 0 1px;
    flex-shrink: 0;
    display: block;
  }

  .nrs-block {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 4px;
    min-height: 0;
  }

  .nrs-opts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
    justify-content: space-evenly;
    min-height: 0;
  }

  .nrs-opts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    flex: 0 0 auto;
    min-height: 0;
    align-items: center;
  }

  .nrs-opt {
    display: flex;
    direction: ltr;
    align-items: center;
    padding: 2px 0;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(0.85rem, 1.25vw, 1.15rem);
    font-weight: 600;
    line-height: 1.45;
    color: #FFFFFF;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: 38px;
    height: auto;
    overflow: visible;
  }

  .nrs-opt-n {
    color: #FFFFFF;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: 1.05em;
    font-weight: 700;
    min-width: 1.5em;
  }

  .nrs-opt-dots {
    flex: 1 1 auto;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.6);
    margin: 0 8px;
  }

  .nrs-opt-text {
    color: #F8FAFC;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    direction: rtl;
    text-align: right;
    font-weight: 600;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
  }

  /* ── اللوحة الجانبية الزرقاء (~100px–115px / ~11% العرض على اليمين): كونسول التحكم ── */
  .nrs-side {
    order: 1;
    flex: 0 0 clamp(100px, 11%, 115px);
    width: clamp(100px, 11%, 115px);
    max-width: clamp(100px, 11%, 115px);
    height: 100%;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 4px;
    justify-content: space-between;
    box-sizing: border-box;
    position: relative;
  }

  /* إخفاء البطاقات والعناصر المكررة التي كانت تسبب التداخل */
  .nrs-side-head,
  .nrs-info-box,
  .nrs-btn-stop,
  .nrs-ctrl-col {
    display: none !important;
  }

  /* أعلى اللوحة: 4 خانات LED رقمية صغيرة ومدمجة */
  .nrs-indicators {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    background: #0f172a;
    border: 1.5px solid #334155;
    border-radius: 6px;
    padding: 2px 3px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9), 0 2px 4px rgba(0, 0, 0, 0.2);
    flex: 0 0 24px;
    height: 24px;
    min-height: 22px;
    max-height: 26px;
    box-sizing: border-box;
  }

  .nrs-ind {
    height: 100%;
    min-height: 0;
    border-radius: 3px;
    background: #1e293b;
    color: #475569;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: clamp(0.72rem, 1.4vh, 0.88rem);
    font-weight: 900;
    display: grid;
    place-items: center;
    border: 1px solid #334155;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
    transition: all 0.15s ease;
  }

  .nrs-ind:not(.nrs-ind-on):not(.nrs-ind-ok)::after {
    content: "-";
    color: #475569;
  }

  .nrs-ind.nrs-ind-on {
    background: #0c4a6e;
    color: #38bdf8;
    border-color: #38bdf8;
    text-shadow: 0 0 10px #0284c7;
    box-shadow: inset 0 0 8px rgba(56, 189, 248, 0.4);
  }

  .nrs-ind.nrs-ind-ok {
    background: #064e3b;
    color: #4ade80;
    border-color: #4ade80;
    text-shadow: 0 0 10px #16a34a;
  }

  .nrs-ind.nrs-ind-wrong {
    background: #7f1d1d;
    color: #f87171;
    border-color: #f87171;
    text-shadow: 0 0 10px #dc2626;
  }

  /* لوحة الأزرار الزرقاء الملكية: تأخذ كامل المساحة المتبقية بالتناسب */
  .nrs-panel {
    width: 100%;
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 4px;
    padding: 5px 4px;
    border-radius: 10px;
    background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
    border: 2px solid #60a5fa;
    box-shadow:
      inset 0 2px 4px rgba(255, 255, 255, 0.35),
      inset 0 -2px 4px rgba(0, 0, 0, 0.45),
      0 4px 14px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
  }

  /* الأزرار الـ6 البيضاوية متناسقة في عمود رأسي واحد (تصحيح، 1، 2، 3، 4، موافق) */
  /* 1. زر تصحيح الأحمر البيضاوي */
  .nrs-btn-correct {
    width: 100%;
    flex: 1 1 0%;
    min-height: 0;
    border-radius: 9999px;
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
    border: 1.5px solid #fee2e2;
    color: #fff;
    font-weight: 800;
    font-size: clamp(0.72rem, 1.4vh, 0.88rem);
    box-shadow: 0 2px 5px rgba(185, 28, 28, 0.45);
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .nrs-btn-correct:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
  }

  .nrs-btn-correct:active:not(:disabled) {
    transform: scale(0.97);
  }

  /* 2-5. أزرار 1-4 الزرقاء البيضاوية في عمود رأسي واحد */
  .nrs-choices {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    flex: 4 1 0%;
    min-height: 0;
    padding: 0;
    margin: 0;
    align-items: stretch;
    box-sizing: border-box;
  }

  .nrs-choice-btn {
    width: 100%;
    flex: 1 1 0%;
    height: auto;
    min-height: 0;
    border-radius: 9999px;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    border: 1.5px solid #bfdbfe;
    color: #fff;
    font-size: clamp(0.95rem, 2.2vh, 1.4rem);
    font-weight: 900;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.1s, filter 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .nrs-choice-btn:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
  }

  .nrs-choice-btn:active:not(:disabled) {
    transform: scale(0.96);
  }

  .nrs-choice-btn.choice-on {
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
    border-color: #fef3c7;
    color: #451a03;
    box-shadow: 0 0 0 2px #fff inset, 0 3px 10px rgba(217, 119, 6, 0.5);
  }

  .nrs-choice-btn.choice-correct {
    background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    color: #fff;
  }

  .nrs-choice-btn.choice-wrong {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
  }

  /* 6. زر موافق الأخضر البيضاوي */
  .nrs-btn-ok {
    width: 100%;
    flex: 1 1 0%;
    min-height: 0;
    border-radius: 9999px;
    background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    border: 1.5px solid #dcfce7;
    color: #fff;
    font-weight: 800;
    font-size: clamp(0.75rem, 1.5vh, 0.92rem);
    box-shadow: 0 2px 6px rgba(21, 128, 61, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    margin: 0;
    transition: filter 0.15s, transform 0.1s;
    box-sizing: border-box;
  }

  .nrs-btn-ok .ok-ic {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nrs-btn-ok .ok-ic svg {
    width: 13px;
    height: 13px;
  }

  .nrs-btn-ok:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
  }

  .nrs-btn-ok:active {
    transform: scale(0.97);
  }

  .nrs-btn-ok.is-next {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #bfdbfe;
    box-shadow: 0 3px 8px rgba(29, 78, 216, 0.45);
  }

  .nrs-btn-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 10px;
    display: grid;
    place-items: center;
    z-index: 5;
  }

  /* ── شريط الحالة السفلي المعدني النحيف (~28px–32px عبر العرض بالكامل) ── */
  .nrs-footer {
    display: flex !important;
    direction: rtl;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 30px;
    flex: 0 0 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 2px 8px;
    gap: 6px;
    background: linear-gradient(180deg, #d1d5db 0%, #9ca3af 100%);
    border-top: 1.5px solid #858d98;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.6);
    box-sizing: border-box;
    overflow: hidden;
  }

  .nrs-footer-item {
    flex: 1 1 0%;
    min-width: 0;
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 8px;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 5px;
    border: 1px solid #94a3b8;
    box-shadow:
      inset 1px 1px 2px rgba(0, 0, 0, 0.2),
      0 1px 0 rgba(255, 255, 255, 0.7);
    box-sizing: border-box;
  }

  /* محاذاة الصنف أسفل لوحة المفاتيح الزرقاء في اليمين تماماً (~100px–115px) */
  .nrs-footer-item.nrs-cat-seg {
    order: 1;
    flex: 0 0 clamp(100px, 11%, 115px);
    width: clamp(100px, 11%, 115px);
    max-width: clamp(100px, 11%, 115px);
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    padding: 1px 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1px;
  }

  .nrs-footer-label {
    font-size: clamp(9.5px, 1vw, 11px);
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
  }

  .nrs-footer-item.nrs-cat-seg .nrs-footer-label {
    font-size: 8.5px;
    line-height: 1;
  }

  .nrs-footer-val {
    font-size: clamp(10px, 1.05vw, 12px);
    font-weight: 900;
    color: #0f172a;
    font-family: var(--nrs-ui);
    white-space: nowrap;
    line-height: 1;
  }

  .nrs-footer-item.nrs-cat-seg .nrs-footer-val {
    font-size: 10px;
    line-height: 1;
  }

  .nrs-footer-val.cat-red {
    color: #dc2626 !important;
    font-style: italic;
    font-weight: 900;
  }

  .nrs-vol-ctrl {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
  }

  .nrs-vol-dots {
    display: flex;
    gap: 2px;
  }

  .nrs-vol-dot {
    width: 12px;
    height: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    color: #475569;
    padding: 0;
  }

  .nrs-vol-dot.on {
    color: #0284c7;
    font-weight: 900;
  }

  .nrs-voice-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    border-radius: 3px;
    padding: 1px 4px;
    cursor: pointer;
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
  }

  .nrs-timer-val {
    color: #1d4ed8 !important;
    font-size: 12px;
    font-weight: 900;
    font-family: 'Consolas', monospace;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   أخطائي: محاور NARSA الخمسة + شبكة بطاقات الأخطاء + نافذة التصحيح
   ══════════════════════════════════════════════════════════════════════════ */

/* بطاقات المحاور الخمسة (Top 5 Category Hub Cards) */
.cat-hub-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}

@media (max-width: 1024px) {
  .cat-hub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cat-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 400px) {
  .cat-hub-grid {
    grid-template-columns: 1fr;
  }
}

.cat-hub-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.cat-hub-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.cat-hub-card.is-active {
  border-color: var(--primary);
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow);
}

.cat-hub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cat-hub-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.cat-hub-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.cat-hub-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  font-family: var(--font-heading);
  margin: 0;
  line-height: 1.35;
}

.cat-hub-btn {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.cat-hub-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* شريط تصفية الأخطاء */

/* نافذة التصحيح المنبثقة (Correction Popup Modal) */

.modal-opts-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.modal-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: all 0.15s ease;
}

.modal-opt.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--success);
}

.modal-opt-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--surface-3);
  color: var(--text);
  flex-shrink: 0;
}

.modal-opt.is-correct .modal-opt-num {
  background: var(--success);
  color: #fff;
}

.modal-opt-text {
  flex: 1;
  font-size: 0.95rem;
}

.modal-opt-badge {
  background: var(--success);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.modal-sub-q {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-sub-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}

.explanation-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--primary-strong);
  margin-bottom: 6px;
  font-family: var(--font-heading);
}

.explanation-body {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   بطل الكود: الأسئلة المزدوجة (Champion Double Questions)
   ══════════════════════════════════════════════════════════════════════════ */
.ch-double-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}

.ch-sub-block {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.ch-sub-title {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.45;
}

.ch-sub-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* =========================================================================
   واجهة المترشح — نمط Apple (HIG)
   مفعّلة بـ body.ui-apple (المترشح والزائر فقط). لوحات الإدارة وواجهة امتحان
   NARSA (.nrs-overlay) لا تتأثر.
   ========================================================================= */
body.ui-apple {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #f2f2f4; --surface-3: #e8e8ed;
  --border: rgb(0 0 0 / .08); --border-strong: rgb(0 0 0 / .22);
  --text: #1d1d1f; --text-soft: #424245; --muted: #6e6e73;
  --radius: 24px; --radius-sm: 16px; --radius-xs: 10px;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .04);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .04), 0 4px 14px rgb(0 0 0 / .04);
  --shadow:    0 2px 6px rgb(0 0 0 / .05), 0 10px 28px rgb(0 0 0 / .06);
  --shadow-md: 0 6px 16px rgb(0 0 0 / .06), 0 20px 44px rgb(0 0 0 / .09);
  --glass: rgb(255 255 255 / .72); --glass-border: rgb(0 0 0 / .08);
  --header-text: #1d1d1f; --header-muted: #6e6e73;
  --ease: cubic-bezier(.25, .1, .25, 1); --dur: 220ms;
  --spring: cubic-bezier(.34, 1.3, .64, 1);
  -webkit-font-smoothing: antialiased;
}
/* الوضع الليلي الموحّد: #0E1013 للخلفية، #161920 للبطاقات، #272B36 للحدود */
:root[data-theme="dark"] body.ui-apple {
  --bg: #0E1013; --surface: #161920; --surface-1: #161920; --surface-2: #1E222B; --surface-3: #272B36;
  --border: #272B36; --border-strong: #383E4D;
  --text: #F9FAFB; --text-soft: #D1D5DB; --muted: #9CA3AF;
  --primary: #FF7A00; --primary-strong: #EA6C00;
  --success: #22C55E; --danger: #EF4444;
  --shadow-xs: none; --shadow-sm: 0 1px 0 rgb(255 255 255 / .03) inset; --shadow: 0 10px 30px rgb(0 0 0 / .5); --shadow-md: 0 20px 50px rgb(0 0 0 / .6);
  --glass: rgb(22 25 32 / .88); --glass-border: #272B36;
  --header-text: #F9FAFB; --header-muted: #9CA3AF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.ui-apple {
    --bg: #0E1013; --surface: #161920; --surface-1: #161920; --surface-2: #1E222B; --surface-3: #272B36;
    --border: #272B36; --border-strong: #383E4D;
    --text: #F9FAFB; --text-soft: #D1D5DB; --muted: #9CA3AF;
    --primary: #FF7A00; --primary-strong: #EA6C00;
    --success: #22C55E; --danger: #EF4444;
    --shadow-xs: none; --shadow-sm: 0 1px 0 rgb(255 255 255 / .03) inset; --shadow: 0 10px 30px rgb(0 0 0 / .5); --shadow-md: 0 20px 50px rgb(0 0 0 / .6);
    --glass: rgb(22 25 32 / .88); --glass-border: #272B36;
    --header-text: #F9FAFB; --header-muted: #9CA3AF;
  }
}
/* واجهة امتحان NARSA تبقى مطابقة للأصل */
body.ui-apple .nrs-overlay { --muted: #78716c; --surface-2: #f5f5f4; }

/* ── الهيدر الزجاجي ── */
body.ui-apple .site-header {
  background: var(--glass); color: var(--header-text);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 1px 0 var(--glass-border);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { body.ui-apple .site-header { background: var(--surface); } }
body.ui-apple .brand { color: var(--header-text); }
body.ui-apple .brand-logo { border-radius: 13px; }
body.ui-apple .main-nav a { color: var(--text-soft); border-radius: 999px; padding: 7px 14px; }
body.ui-apple .main-nav a:hover { background: var(--surface-3); color: var(--text); }
body.ui-apple .main-nav a[aria-current="page"] { background: var(--text); color: var(--bg); }
body.ui-apple .icon-btn { background: transparent; color: var(--text-soft); border-color: var(--border); border-radius: 999px; }
body.ui-apple .icon-btn:hover { background: var(--surface-3); border-color: var(--border); }
@media (max-width: 960px) {
  body.ui-apple .mobile-nav.open { background: transparent; border-top-color: var(--glass-border); }
  body.ui-apple .mobile-nav a { color: var(--text); border-radius: 14px; }
  body.ui-apple .mobile-nav a[aria-current="page"] { background: var(--surface-3); color: var(--text); }
}
body.ui-apple .site-footer { background: transparent; border-top-color: var(--border); }

/* ── عناصر عامة ── */
body.ui-apple main { padding-top: 36px; }
body.ui-apple h1, body.ui-apple h2, body.ui-apple h3 { letter-spacing: -.02em; }
body.ui-apple .card { border-color: var(--border); padding: 24px; }
body.ui-apple .btn { border-radius: 999px; padding-inline: 22px; transition: transform var(--dur) var(--spring), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
body.ui-apple .btn:active { transform: scale(.96); }
body.ui-apple .btn-sm { border-radius: 999px; }
body.ui-apple .btn-secondary { background: var(--surface-2); border-color: transparent; box-shadow: none; }
body.ui-apple .btn-secondary:hover { background: var(--surface-3); border-color: transparent; box-shadow: none; }
body.ui-apple input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), body.ui-apple select, body.ui-apple textarea { border-radius: 14px; }
body.ui-apple .pill { border-radius: 999px; }

/* انتقال سلس عند تغيير الصفحة */
@keyframes ui-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
body.ui-apple #app > * { animation: ui-rise .42s var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  body.ui-apple #app > *, body.ui-apple .rd-arc { animation: none !important; }
  body.ui-apple .btn, body.ui-apple .qa, body.ui-apple .ticket { transition: none; }
}

/* ── لوحة المترشح ── */
.dash { display: grid; gap: 32px; max-width: 1080px; margin: 0 auto; }
.dash-hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.dash-hello h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.dash-eyebrow { margin: 0 0 2px; font-size: .8rem; font-weight: 700; color: var(--muted); }
/* مقيّدة بصفحات المترشح: .dash-h و .dash-chips مستعملتان أيضاً في لوحات الإدارة بتنسيق آخر */
.dash .dash-h, .pg .dash-h { font-size: 1.3rem; margin: 0 0 14px; }
.dash-h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dash-link { font-weight: 700; font-size: .9rem; text-decoration: none; }
.dash-link:hover { text-decoration: underline; }

.dash-top { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.dash-ready { display: flex; align-items: center; gap: 24px; }
.dash-ready-text { min-width: 0; }
.dash-ready-meta { margin: 0; color: var(--text-soft); }
.rd-title { margin: 2px 0 6px; font-size: 1.35rem; }
.rd-title.rd-good { color: var(--success); }

/* حلقة الجاهزية */
.rd-ring { position: relative; width: 148px; height: 148px; flex: none; }
.rd-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.rd-track { fill: none; stroke: var(--surface-3); stroke-width: 13; }
.rd-arc { fill: none; stroke-width: 13; stroke-linecap: round; stroke-dashoffset: var(--rd-off); animation: rd-draw 1.1s cubic-bezier(.2, .8, .2, 1) both; filter: drop-shadow(0 2px 6px rgb(0 0 0 / .18)); }
@keyframes rd-draw { from { stroke-dashoffset: var(--rd-full); } }
.rd-low  .rd-stop-a { stop-color: #ff375f; } .rd-low  .rd-stop-b { stop-color: #ff6b3d; }
.rd-mid  .rd-stop-a { stop-color: #ff9f0a; } .rd-mid  .rd-stop-b { stop-color: #ffd60a; }
.rd-good .rd-stop-a { stop-color: #30d158; } .rd-good .rd-stop-b { stop-color: #a8f05a; }
.rd-ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.rd-ring-label strong { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; }
.rd-ring-label strong span { font-size: 1rem; font-weight: 700; color: var(--muted); margin-inline-start: 1px; }
.rd-ring-label small { font-size: .78rem; font-weight: 700; color: var(--muted); }

/* بطاقة الموعد (نمط تذكرة Wallet) */
.ticket {
  --t-notch: 12px;
  display: flex; align-items: stretch; min-height: 172px; position: relative;
  border-radius: var(--radius, 24px); color: #fff; text-decoration: none; overflow: hidden;
  background: linear-gradient(135deg, #ff8a3d 0%, #ea580c 55%, #b93a06 100%);
  box-shadow: 0 14px 34px rgb(234 88 12 / .28);
  transition: transform .3s var(--spring, ease), box-shadow .3s ease;
  /* ثقبان نصف دائريان بين جسم التذكرة والكعب */
  -webkit-mask: radial-gradient(circle var(--t-notch) at var(--t-x) 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle var(--t-notch) at var(--t-x) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
          mask: radial-gradient(circle var(--t-notch) at var(--t-x) 0, #0000 98%, #000) top / 100% 51% no-repeat, radial-gradient(circle var(--t-notch) at var(--t-x) 100%, #0000 98%, #000) bottom / 100% 51% no-repeat;
  --t-x: 118px;
}
[dir="ltr"] .ticket { --t-x: calc(100% - 118px); }
.ticket:hover { transform: translateY(-3px); box-shadow: 0 20px 44px rgb(234 88 12 / .34); }
.ticket-main { flex: 1; min-width: 0; padding: 22px 24px; display: flex; flex-direction: column; gap: 4px; }
.ticket-kicker { font-size: .74rem; font-weight: 700; opacity: .82; letter-spacing: .02em; }
.ticket-name { font-size: 1.4rem; font-weight: 800; line-height: 1.3; }
.ticket-hint { margin: 4px 0 0; font-size: .9rem; opacity: .9; }
.ticket-fields { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 26px; }
.ticket-fields small { display: block; font-size: .68rem; font-weight: 700; opacity: .75; }
.ticket-fields span { font-weight: 700; font-size: .95rem; }
.ticket-stub { width: 118px; flex: none; display: grid; place-content: center; text-align: center; gap: 2px; border-inline-start: 2px dashed rgb(255 255 255 / .45); background: rgb(0 0 0 / .1); }
.ticket-stub strong { font-size: 2.8rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.ticket-stub small { font-size: .76rem; font-weight: 700; opacity: .9; }
.ticket-add { font-size: 2.2rem; font-weight: 300; line-height: 1; }
.ticket-empty { background: linear-gradient(135deg, #48484a, #2c2c2e); box-shadow: 0 14px 34px rgb(0 0 0 / .18); }
.ticket-empty:hover { box-shadow: 0 20px 44px rgb(0 0 0 / .24); }

/* الإجراءات السريعة */
.qa-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .qa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 500px) { .qa-grid { grid-template-columns: 1fr; } }
.qa {
  display: flex; flex-direction: column; gap: 3px; min-height: 148px; padding: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 24px);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform .3s var(--spring, ease), box-shadow .3s ease;
}
.qa:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.qa:active { transform: scale(.97); }
.qa strong { font-size: 1.05rem; font-weight: 800; line-height: 1.35; margin-top: auto; }
.qa small { color: var(--muted); font-size: .84rem; font-weight: 500; }
.qa-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; margin-bottom: 14px; box-shadow: 0 6px 14px rgb(0 0 0 / .14); }
.qa-icon svg { width: 24px; height: 24px; }
.qa-exam .qa-icon     { background: linear-gradient(145deg, #ff9f0a, #ea580c); }
.qa-practice .qa-icon { background: linear-gradient(145deg, #5ac8fa, #0a84ff); }
.qa-ai .qa-icon       { background: linear-gradient(145deg, #bf5af2, #5e5ce6); }
.dash .dash-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.chip { font: inherit; font-weight: 700; font-size: .88rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; min-height: 42px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background .2s ease, transform .2s ease; }
.chip:hover:not(:disabled) { background: var(--surface-2); }
.chip:active:not(:disabled) { transform: scale(.97); }
.chip:disabled { opacity: .5; cursor: default; }
.chip b { background: var(--surface-3); border-radius: 999px; padding: 1px 9px; font-size: .8rem; }

/* أرقام مختصرة */
.dash-stats { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .dash-stats { grid-template-columns: 1fr; } }
.stat-tile { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px !important; }
.stat-tile strong { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-tile strong span { font-size: 1rem; color: var(--muted); font-weight: 700; }
.stat-tile small { color: var(--muted); font-size: .84rem; font-weight: 600; }

/* قوائم مجمّعة (نمط إعدادات iOS) */
.dash-list { padding: 4px 20px !important; }
.cat-row, .recent-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cat-row:last-child, .recent-row:last-child { border-bottom: 0; }
.cat-icon { width: 44px; height: 44px; flex: none; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.3rem; }
.cat-body { flex: 1; min-width: 0; display: grid; gap: 5px; }
.cat-head { display: flex; justify-content: space-between; gap: 10px; }
.cat-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.recent-row { color: var(--text); text-decoration: none; }
.recent-row > div { flex: 1; min-width: 0; display: grid; }
.row-chevron, .simple-card-cta { color: var(--muted); display: grid; }
.row-chevron svg, .simple-card-cta svg { width: 18px; height: 18px; }
.simple-card-cta { color: var(--primary); }
[dir="rtl"] .row-chevron svg, [dir="rtl"] .simple-card-cta svg { transform: scaleX(-1); }
@media (max-width: 560px) {
  .dash { gap: 26px; }
  .dash-ready { flex-direction: column; text-align: center; }
  .ticket { --t-x: 96px; } [dir="ltr"] .ticket { --t-x: calc(100% - 96px); }
  .ticket-stub { width: 96px; }
  .cat-row { flex-wrap: wrap; } .cat-row .btn { margin-inline-start: 58px; }
}
/* main يأخذ التركيز برمجياً بعد كل تنقل: لا نرسم حوله حلقة تركيز */
body.ui-apple main:focus-visible { box-shadow: none; outline: none; }
@media (max-width: 560px) {
  .cat-row .cat-body { flex: 1 1 calc(100% - 60px); }
  .cat-row .btn { margin-inline-start: 58px; }
}
@media (max-width: 480px) {
  body.ui-apple .header-inner { padding: 0 12px; gap: 8px; }
  body.ui-apple .header-actions { gap: 4px; }
  body.ui-apple .icon-btn { height: 36px; min-width: 36px; padding: 0 9px; font-size: .78rem; }
  body.ui-apple .brand-logo { width: 36px; height: 36px; }
}
/* على الشاشات الضيقة رابط «حسابي» موجود في القائمة ☰ */
@media (max-width: 480px) { body.ui-apple .header-actions a.icon-btn[href="/profile"] { display: none; } }

/* ── صفحات المترشح: هيكل مشترك ── */
.pg { display: grid; gap: 32px; max-width: 1080px; margin: 0 auto; }
.pg > * { min-width: 0; }
.pg-narrow { max-width: 780px; }
.pg-head h1 { margin: 0 0 4px; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.pg-head p { margin: 0; color: var(--muted); }
.pg-help { margin: -8px 0 14px; color: var(--muted); font-size: .92rem; }
.list-title { font-size: .86rem; font-weight: 700; color: var(--muted); margin: 0 0 8px; padding-inline: 20px; }
.cat-bar.bar-good i { background: var(--success); }

/* ── /practice & /lessons: شبكة 6 بطاقات موحدة 3×2 والتصميم الموحد للبطاقات ── */
.cat-grid,
.axis-cards-grid,
.axis-lessons-grid,
.lessons-vgrid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 900px) {
  .cat-grid,
  .axis-cards-grid,
  .axis-lessons-grid,
  .lessons-vgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}
@media (max-width: 520px) {
  .cat-grid,
  .axis-cards-grid,
  .axis-lessons-grid,
  .lessons-vgrid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.cat-tile,
.axis-wide-card {
  font: inherit;
  text-align: start;
  cursor: pointer;
  color: var(--text) !important;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 148px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius, 20px);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--spring, ease), box-shadow 0.25s ease, border-color 0.2s ease;
  user-select: none;
  position: relative;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.cat-tile:hover:not(:disabled),
.axis-wide-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary, #FF7A00);
  box-shadow: var(--shadow);
}
.cat-tile:active:not(:disabled),
.axis-wide-card:active {
  transform: scale(0.97);
}
.cat-tile:disabled {
  opacity: 0.6;
  cursor: progress;
}
.cat-tile.is-selected,
.axis-wide-card.is-active,
.axis-wide-card.is-selected {
  border-color: var(--primary, #FF7A00) !important;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--primary, #FF7A00), var(--shadow-sm) !important;
}

.cat-tile strong,
.cat-tile-title,
.axis-card-title {
  margin-top: auto;
  margin-bottom: 2px;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  font-family: var(--font-heading);
}
.cat-tile small,
.cat-tile-sub,
.axis-card-sub {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
}
.cat-tile-icon,
.axis-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  margin-bottom: 0;
  flex-shrink: 0;
  background: var(--surface-2);
  transition: transform 0.2s ease;
}
.cat-tile:hover .cat-tile-icon,
.axis-wide-card:hover .axis-card-icon {
  transform: scale(1.08);
}
.tone-blue .cat-tile-icon,   .tone-blue .axis-card-icon   { background: rgba(10, 132, 255, 0.14); }
.tone-orange .cat-tile-icon, .tone-orange .axis-card-icon { background: rgba(255, 159, 10, 0.18); }
.tone-purple .cat-tile-icon, .tone-purple .axis-card-icon { background: rgba(191, 90, 242, 0.16); }
.tone-green .cat-tile-icon,  .tone-green .axis-card-icon  { background: rgba(48, 209, 88, 0.16); }
.tone-red .cat-tile-icon,    .tone-red .axis-card-icon    { background: rgba(255, 55, 95, 0.14); }
.tone-amber .cat-tile-icon,  .tone-amber .axis-card-icon  { background: rgba(255, 122, 0, 0.16); color: #FF7A00; }
.tone-cyan .cat-tile-icon,   .tone-cyan .axis-card-icon   { background: rgba(6, 182, 212, 0.16); color: #0891b2; }

.cat-tile-head,
.axis-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}
.cat-tile-badge,
.axis-pct-badge {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  line-height: 1.2;
}
.tone-blue .cat-tile-badge,   .tone-blue .axis-pct-badge   { background: rgba(10, 132, 255, 0.12); color: #0a84ff; border-color: rgba(10, 132, 255, 0.25); }
.tone-orange .cat-tile-badge, .tone-orange .axis-pct-badge { background: rgba(255, 159, 10, 0.14); color: #f08c00; border-color: rgba(255, 159, 10, 0.25); }
.tone-purple .cat-tile-badge, .tone-purple .axis-pct-badge { background: rgba(191, 90, 242, 0.14); color: #a855f7; border-color: rgba(191, 90, 242, 0.25); }
.tone-green .cat-tile-badge,  .tone-green .axis-pct-badge  { background: rgba(48, 209, 88, 0.14); color: #22a447; border-color: rgba(48, 209, 88, 0.25); }
.tone-red .cat-tile-badge,    .tone-red .axis-pct-badge    { background: rgba(255, 55, 95, 0.12); color: #ef4466; border-color: rgba(255, 55, 95, 0.25); }
.tone-amber .cat-tile-badge,  .tone-amber .axis-pct-badge  { background: rgba(255, 122, 0, 0.14); color: #FF7A00; border-color: rgba(255, 122, 0, 0.3); }
.tone-cyan .cat-tile-badge,   .tone-cyan .axis-pct-badge   { background: rgba(6, 182, 212, 0.14); color: #0891b2; border-color: rgba(6, 182, 212, 0.25); }

.cat-tile-badge.is-done,
.axis-pct-badge.is-done {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #16a34a !important;
  border-color: rgba(34, 197, 94, 0.28) !important;
}

.cat-tile-progress,
.axis-card-progress {
  height: 5px;
  width: 100%;
  border-radius: 999px;
  background: var(--surface-3, rgba(255, 255, 255, 0.08));
  overflow: hidden;
  margin-top: auto;
}
.cat-tile-progress i,
.axis-card-progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary, #FF7A00);
  transition: width 0.6s ease;
}
.tone-blue .cat-tile-progress i,   .tone-blue .axis-card-progress i   { background: #0a84ff; }
.tone-orange .cat-tile-progress i, .tone-orange .axis-card-progress i { background: #ff9f0a; }
.tone-purple .cat-tile-progress i, .tone-purple .axis-card-progress i { background: #bf5af2; }
.tone-green .cat-tile-progress i,  .tone-green .axis-card-progress i  { background: #30d158; }
.tone-red .cat-tile-progress i,    .tone-red .axis-card-progress i    { background: #ff375f; }
.tone-amber .cat-tile-progress i,  .tone-amber .axis-card-progress i  { background: #FF7A00; }
.tone-cyan .cat-tile-progress i,   .tone-cyan .axis-card-progress i   { background: #0891b2; }
.series-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.series-row:last-child { border-bottom: 0; }
.series-num, .lesson-num { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; color: var(--text-soft); }
.series-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.series-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 640px) {
  .series-row { flex-wrap: wrap; }
  .series-body { flex: 1 1 calc(100% - 60px); }
  .series-actions { width: 100%; padding-inline-start: 54px; }
  .series-actions .btn { flex: 1; }
}

/* ── /lessons: قوائم مجمّعة + عارض الدرس ── */
.lessons-progress { display: grid; gap: 10px; padding: 18px 20px !important; }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover strong { color: var(--primary); }
.lesson-num.is-done { background: var(--success); color: #fff; }
.lesson-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.lesson-body .muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-meta { flex: none; white-space: nowrap; }
@media (max-width: 480px) { .lesson-meta { display: none; } }
.reader { gap: 16px; }
.reader-back { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; text-decoration: none; justify-self: start; }
.reader-back .row-chevron { color: inherit; }
.reader-card { padding: clamp(22px, 5vw, 44px) !important; }
.reader-head { margin-bottom: 22px; }
.reader-head h1 { margin: 14px 0 6px; font-size: clamp(1.6rem, 4vw, 2.3rem); }
.reader-head p { margin: 0; font-size: 1.05rem; }
body.ui-apple .prose { max-width: none; font-size: 1.08rem; line-height: 1.95; }
body.ui-apple .prose h2 { border-bottom: 0; padding-bottom: 0; margin-top: 2em; }
body.ui-apple .prose h3 { color: var(--text); }
body.ui-apple .prose blockquote { border-radius: 16px; }
body.ui-apple .prose img { border-radius: 16px; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }
.reader-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reader-nav-link { display: grid; gap: 2px; padding: 16px 20px !important; color: var(--text); text-decoration: none; transition: transform .3s var(--spring, ease), box-shadow .3s ease; }
.reader-nav-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.reader-nav-link small { color: var(--muted); font-weight: 700; font-size: .78rem; }
.reader-nav-link strong { font-size: .98rem; line-height: 1.4; }
.reader-nav-link.is-next { text-align: end; }
@media (max-width: 480px) { .reader-nav { grid-template-columns: 1fr; } .reader-nav > span { display: none; } .reader-nav-link.is-next { text-align: start; } }

/* ── /assistant: محادثة بنمط iMessage ── */
.chat-page { gap: 18px; }
.chat { display: flex; flex-direction: column; min-height: min(62vh, 640px); }
.chat-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chat-bar select { width: auto; min-height: 36px; padding-block: 4px; }
.chat-messages { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 8px 2px 20px; }
.ai-empty { margin: auto; text-align: center; display: grid; justify-items: center; gap: 10px; padding: 24px 0; }
.ai-empty p { margin: 0; }
.chat-avatar { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 1.8rem; color: #fff; background: linear-gradient(145deg, #bf5af2, #5e5ce6); box-shadow: 0 10px 24px rgb(94 92 230 / .3); }
.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 560px); animation: msg-in .32s var(--spring, ease) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
/* رسائل المترشح دائماً على اليمين وأجوبة المساعد على اليسار (عربي وفرنسي) */
.msg-user { align-self: flex-start; align-items: flex-start; }
.msg-assistant { align-self: flex-end; align-items: flex-end; }
[dir="ltr"] .msg-user { align-self: flex-end; align-items: flex-end; }
[dir="ltr"] .msg-assistant { align-self: flex-start; align-items: flex-start; }
.msg + .msg-user, .msg-user + .msg-assistant { margin-top: 8px; }
.msg-bubble { padding: 10px 16px; border-radius: 22px; line-height: 1.7; overflow-wrap: anywhere; background: var(--surface-3); color: var(--text); }
.msg-assistant .msg-bubble { border-bottom-left-radius: 6px; }
.msg-user .msg-bubble { background: #0a84ff; color: #fff; border-bottom-right-radius: 6px; }
.msg-meta { font-size: .7rem; color: var(--muted); margin-top: 3px; padding: 0 8px; }
.msg-typing { display: inline-flex; gap: 5px; padding: 15px 16px; }
.msg-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite ease-in-out; }
.msg-typing i:nth-child(2) { animation-delay: .15s; } .msg-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.chat-composer {
  position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: flex-end; gap: 8px; padding: 6px;
  border-radius: 28px; border: 1px solid var(--glass-border, var(--border)); background: var(--glass, var(--surface));
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); box-shadow: var(--shadow);
}
.chat-composer textarea, body.ui-apple .chat-composer textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; border: 0; background: transparent; box-shadow: none; padding: 8px 14px; line-height: 1.5; border-radius: 20px; }
.chat-composer textarea:focus { outline: none; box-shadow: none; }
.chat-composer:focus-within { border-color: #0a84ff; }
.chat-send { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: #0a84ff; color: #fff; cursor: pointer; display: grid; place-items: center; transition: transform .2s var(--spring, ease), opacity .2s ease; }
.chat-send svg { width: 20px; height: 20px; }
.chat-send:hover { transform: scale(1.06); } .chat-send:active { transform: scale(.92); }
.chat-send:disabled { opacity: .45; cursor: default; transform: none; }
.chat-note { margin: 14px 0 0; text-align: center; font-size: .76rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .msg, .msg-typing i { animation: none; } }

/* ── /results ── */
.res { gap: 24px; }
.res-hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 22px 28px; padding: clamp(22px, 4vw, 34px) !important; position: relative; overflow: hidden; }
.res-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; }
.res-good::before { background: radial-gradient(120% 90% at 100% 0, rgb(48 209 88 / .16), transparent 60%); }
.res-mid::before  { background: radial-gradient(120% 90% at 100% 0, rgb(255 159 10 / .16), transparent 60%); }
.res-low::before  { background: radial-gradient(120% 90% at 100% 0, rgb(255 55 95 / .13), transparent 60%); }
[dir="ltr"] .res-hero::before { transform: scaleX(-1); }
.res-hero > * { position: relative; }
.res-ring { width: 156px; height: 156px; }
.res-ring .rd-ring-label strong { font-size: 2.4rem; }
.res-ring .rd-ring-label strong span { font-size: 1.05rem; }
.res-title { margin: 2px 0 6px; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.res-good .res-title { color: var(--success); }
.res-cheer { margin: 0 0 6px; font-size: 1.05rem; color: var(--text-soft); }
.res-counts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.res-count { background: var(--surface-2); border-radius: 18px; padding: 12px 14px; display: grid; gap: 0; text-align: center; min-width: 0; }
.res-count strong { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }
.res-count small { color: var(--muted); font-weight: 600; font-size: .82rem; }
.res-count.is-ok strong { color: var(--success); } .res-count.is-ko strong { color: var(--danger); }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.res-actions .btn { flex: 1 1 auto; }
.cat-bar.bar-low i { background: var(--danger); }
.res-review-head { align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pg .res-review-head .dash-h { margin: 0; }
@media (max-width: 640px) {
  .res-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .res-counts { grid-template-columns: 1fr; width: 100%; }
}
/* تحكم مقسّم (iOS segmented control) */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-3); gap: 2px; }
.seg button { font: inherit; font-size: .84rem; font-weight: 700; color: var(--text-soft); background: transparent; border: 0; border-radius: 9px; padding: 6px 14px; min-height: 34px; cursor: pointer; transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
/* صفوف قابلة للتوسيع */
.acc { border-bottom: 1px solid var(--border); }
.acc:last-child { border-bottom: 0; }
.acc summary { display: flex; align-items: center; gap: 14px; padding: 14px 0; cursor: pointer; list-style: none; border-radius: 12px; }
.acc summary::-webkit-details-marker { display: none; }
.acc-mark { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem; color: #fff; background: var(--muted); }
.acc-mark.is-ok { background: #30b455; } .acc-mark.is-ko { background: #ff453a; }
.acc-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.acc-text small { color: var(--muted); font-size: .76rem; font-weight: 700; }
.acc-text strong { font-weight: 700; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acc[open] .acc-text strong { -webkit-line-clamp: unset; display: block; }
.acc-chevron svg { transition: transform .25s ease; transform: none !important; }
.acc[open] .acc-chevron svg { transform: rotate(180deg) !important; }
.acc-body { padding: 2px 0 18px; padding-inline-start: 44px; }
.acc-body .q-text { display: none; }               /* النص ظاهر أصلاً في رأس الصف */
.acc-body .sub-q-block .q-text { display: block; }
.acc-body .scene { border-radius: 16px !important; }
body.ui-apple .q-explain { border-radius: 16px; }
@media (max-width: 560px) { .acc-body { padding-inline-start: 0; } }

/* ── /exam ── */
.exam-hero { display: grid; justify-items: center; text-align: center; gap: 4px; padding: clamp(26px, 5vw, 44px) !important; }
.exam-hero h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); }
.exam-hero > p { margin: 0; }
.exam-hero-icon { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #ff9f0a, #ea580c); box-shadow: 0 12px 28px rgb(234 88 12 / .3); margin-bottom: 12px; }
.exam-hero-icon svg { width: 38px; height: 38px; }
.exam-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; margin: 22px 0; }
@media (max-width: 560px) { .exam-facts { grid-template-columns: repeat(2, 1fr); } }
.exam-facts > div { background: var(--surface-2); border-radius: 18px; padding: 14px 10px; display: grid; }
.exam-facts strong { font-size: 1.6rem; font-weight: 800; line-height: 1.3; letter-spacing: -.02em; }
.exam-facts strong span { font-size: .9rem; color: var(--muted); font-weight: 700; margin-inline-start: 1px; }
.exam-facts small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.exam-start { width: min(100%, 360px); min-height: 54px; font-size: 1.05rem; }
.exam-rules { list-style: none; margin: 0; }
.exam-rules li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.exam-rules li:last-child { border-bottom: 0; }
.exam-keys { text-align: center; margin: 14px 0 0; }

/* ── أخطائي / السجل ── */
.acc-mark.is-star { background: #ff9f0a; } .acc-mark.is-info { background: #0a84ff; }
.hist-counts { grid-column: auto; }

/* ── الملف الشخصي ── */
.profile { gap: 18px; }
.profile-head { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 8px 0 6px; }
.profile-head h1 { margin: 10px 0 0; font-size: clamp(1.5rem, 4vw, 2rem); }
.profile-head p { margin: 0 0 6px; overflow-wrap: anywhere; }
.profile-avatar { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; color: #fff; background: linear-gradient(145deg, #ff9f0a, #ea580c); box-shadow: 0 12px 28px rgb(234 88 12 / .28); }
.profile-link { display: flex; align-items: center; gap: 14px; padding: 14px 20px !important; color: var(--text); text-decoration: none; }
.profile-link strong { flex: 1; }
.profile h2 { font-size: 1.15rem; margin-bottom: 16px; }

/* ── الدخول والتسجيل ── */
body.ui-apple #f fieldset, body.ui-apple #f > div[style*="border"] { border-radius: 18px !important; }
@media (max-width: 520px) { body.ui-apple #f fieldset > div { grid-template-columns: 1fr !important; } }

/* ── الصفحة الرئيسية ── */
.home { gap: 56px; }
.home-hero { text-align: center; display: grid; justify-items: center; gap: 14px; padding: clamp(28px, 7vw, 72px) 0 8px; position: relative; }
.home-hero::before { content: ""; position: absolute; inset: -40px 0 auto; height: 420px; z-index: -1; pointer-events: none; background: radial-gradient(60% 70% at 50% 0, rgb(255 138 61 / .2), transparent 70%); }
.home-badge { font-size: .82rem; font-weight: 700; color: var(--primary); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; box-shadow: var(--shadow-xs); }
.home-hero h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 4.2rem); line-height: 1.2; letter-spacing: -.03em; max-width: 14ch; }
.home-hero > p { margin: 0; font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--muted); max-width: 46ch; }
.home-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.home-cta .btn { min-height: 54px; padding-inline: 30px; font-size: 1.02rem; }
.home-stats { margin-top: 26px; display: grid; grid-template-columns: repeat(3, auto); gap: 0; border-radius: 22px; border: 1px solid var(--glass-border, var(--border)); background: var(--glass, var(--surface)); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow-sm); }
.home-stats > div { padding: 16px clamp(16px, 4vw, 36px); display: grid; }
.home-stats > div + div { border-inline-start: 1px solid var(--border); }
.home-stats strong { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
.home-stats strong span { font-size: .6em; color: var(--muted); }
.home-stats small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.home-h { text-align: center; font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 6px; }
.home-sub { text-align: center; color: var(--muted); margin: 0; }
.home-disclaimer { margin: 18px auto 0; max-width: 560px; font-size: .85rem; opacity: .8; text-align: center; }
.home-h + .home-steps, .home-h + .card, .home-sub + .cat-grid { margin-top: 22px; }
.home-steps { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .home-steps { grid-template-columns: repeat(2, 1fr); } }
.home-step h3 { margin: 14px 0 4px; }
.home-step p { margin: 0; line-height: 1.7; }
.home-step .series-num { background: var(--text); color: var(--bg); }
.home-axis { cursor: default; min-height: 168px; }
.home-axis:hover { transform: none !important; box-shadow: var(--shadow-sm) !important; }
.home-axis small { line-height: 1.6; }
.home-features { max-width: 780px; margin-inline: auto; }
.home-final { text-align: center; border-radius: 32px; padding: clamp(32px, 6vw, 60px) 24px; color: #fff; background: linear-gradient(135deg, #2c2c2e, #0b0b0d); }
.home-final h2 { color: #fff !important; /* كيغلب على القاعدة العامة ديال العناوين */ font-size: clamp(1.4rem, 4vw, 2rem); margin: 0 0 8px; }
.home-final p { color: #a1a1a6; margin: 0 0 18px; }
.home-ghost { background: rgb(255 255 255 / .12); color: #fff; }
.home-ghost:hover { background: rgb(255 255 255 / .2); }

/* ══ واجهة المؤسسة والمدرب بنمط Apple (الأدمين العام خارج body.ui-apple) ══ */
body.ui-apple .staff-side {
  background: var(--glass); border-inline-end: 1px solid var(--glass-border);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  padding: 18px 12px;
}
body.ui-apple .staff-side .side-title { font-size: .78rem; margin: 0 10px 14px; }
body.ui-apple .staff-side a { border-radius: 12px; padding: 10px 12px; font-weight: 600; transition: background .2s ease; }
body.ui-apple .staff-side a:hover { background: var(--surface-3); }
body.ui-apple .staff-side a[aria-current="page"] { background: var(--text); color: var(--bg); }
body.ui-apple.has-side main { padding-top: 28px; }
body.ui-apple .dash-kpi { border-radius: 20px; border-color: var(--border); box-shadow: var(--shadow-sm); transition: transform .3s var(--spring), box-shadow .3s ease; }
body.ui-apple a.dash-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
body.ui-apple .dash-seg { border-radius: 12px; border: 0; background: var(--surface-3); padding: 3px; gap: 2px; }
body.ui-apple .dash-seg button { border-radius: 9px; font-weight: 700; }
body.ui-apple .dash-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
body.ui-apple .dash-hrow { border-radius: 12px; }
body.ui-apple .dash-hrow:hover { background: var(--surface-2); }
body.ui-apple .dash-track { background: var(--surface-3); }
body.ui-apple .dash-chip { border-radius: 14px; border-color: var(--border); }
body.ui-apple .dash-lg { border-color: var(--border); }
body.ui-apple .table th { color: var(--muted); font-size: .8rem; }
body.ui-apple .act-btn { border-radius: 10px; }
body.ui-apple .dash-tip { border-radius: 10px; }

/* لوحة المدرب */
.ins-hello { margin: 0 0 16px; font-weight: 700; font-size: 1.05rem; }
.ins-slot { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ins-slot:last-child { border-bottom: 0; }
.ins-hour { flex: none; min-width: 58px; text-align: center; font-weight: 800; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); direction: ltr; }
.ins-slot-body { flex: 1; min-width: 0; }
.ins-people { display: flex; flex-wrap: wrap; gap: 6px; }
.ins-seats { flex: none; font-weight: 700; font-size: .9rem; color: var(--muted); direction: ltr; }
.ins-seats.is-full { color: var(--danger); }
.ins-day { margin-top: 12px; } .ins-day:first-of-type { margin-top: 0; }
.ins-name { width: 150px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.ins-meta { flex: none; width: 240px; text-align: end; white-space: nowrap; }
@media (max-width: 720px) { .ins-meta { display: none; } .ins-name { width: 110px; } }

/* متابعة متعلم */
.stu-back { display: inline-block; margin-bottom: 12px; font-weight: 700; text-decoration: none; }
.stu-hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 20px 26px; }
.stu-id h2 { margin: 0 0 2px; font-size: 1.5rem; }
.stu-id p { margin: 0 0 10px; overflow-wrap: anywhere; }
.stu-counts { grid-template-columns: repeat(6, 1fr); }
.stu-hint { margin: -4px 0 8px; color: var(--warning, #b45309); font-weight: 600; }
.stu .recent-row > div { flex: 1; min-width: 0; display: grid; }
@media (max-width: 900px) { .stu-counts { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .stu-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } .stu-counts { grid-template-columns: repeat(2, 1fr); width: 100%; } .stu-id .row { justify-content: center; } }
/* عناصر الشبكة تتقلص تحت عرض محتواها (المخططات العريضة تتمرر داخل بطاقتها بدل دفع الصفحة) */
body.ui-apple .grid > * { min-width: 0; }
body.ui-apple .card:has(> .table) { padding: 8px 16px; }
body.ui-apple .table th { background: transparent; }
body.ui-apple .list-table td:first-child a { white-space: nowrap; font-weight: 700; text-decoration: none; cursor: pointer; }
body.ui-apple .list-table td:first-child a:hover { text-decoration: underline; }

.ins-loc { margin-top: 4px; }

/* ══ الأيقونات الخطية (تعوّض الإيموجي — انظر icons.js) ══ */
.ic { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; transition: transform .2s ease; }
.ic-check-circle { color: var(--success, #16a34a); }
.ic-x-circle, .ic-ban { color: var(--danger, #dc2626); }
.ic-alert { color: var(--warning, #d97706); }
.ic-star, .ic-trophy { color: #f59e0b; }
.ic-flame { color: #f97316; }
/* داخل زر أو رابط ملوّن الأيقونة تأخذ لون النص */
.btn .ic, [aria-current="page"] .ic, .pill .ic, .ticket .ic { color: inherit; }
a:hover > .ic, button:hover > .ic, a:hover > span > .ic, button:hover > span > .ic { transform: scale(1.14); }
.icon-btn .ic { width: 1.25em; height: 1.25em; vertical-align: -.25em; }
.dash-kpi-ic .ic { width: 1.5rem; height: 1.5rem; color: var(--primary); }
.cat-icon .ic, .cat-tile-icon .ic { width: 1.5rem; height: 1.5rem; color: var(--text-soft); }
.tone-blue .cat-tile-icon .ic { color: #0a84ff; } .tone-orange .cat-tile-icon .ic { color: #f08c00; } .tone-purple .cat-tile-icon .ic { color: #a855f7; }
.tone-green .cat-tile-icon .ic { color: #22a447; } .tone-red .cat-tile-icon .ic { color: #ef4466; }
.empty .big .ic { width: 3rem; height: 3rem; color: var(--muted); stroke-width: 1.5; }
@media (prefers-reduced-motion: reduce) { .ic { transition: none; } }

/* ══ الشريط الجانبي القابل للطي (حاسوب بماوس): أيقونات فقط، ويتوسع عند المرور أو التركيز ══ */
.staff-side a > span:first-child { flex: none; width: 24px; display: grid; place-items: center; font-size: 1.05rem; }
.staff-side a > span:first-child .ic { width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) { .staff-side, .staff-side .side-title, .staff-side a > span:last-child { transition: none; } }
/* تابلت أفقي / حاسوب صغير: الهيدر يضيق بدل ما يدفع الصفحة */
@media (min-width: 961px) and (max-width: 1180px) {
  body.ui-apple .main-nav { gap: 0; margin-inline-start: 10px; }
  body.ui-apple .main-nav a { padding: 6px 9px; font-size: .84rem; }
  body.ui-apple .brand small { display: none; }
  body.ui-apple .header-actions { gap: 4px; }
}

/* ══ قائمة المتعلم: أيقونة لكل رابط + Monitor AI بارز ══ */
.nav-link { display: inline-flex; align-items: center; gap: 7px; }
.nav-ic { display: inline-grid; place-items: center; }
.nav-ic .ic { width: 18px; height: 18px; vertical-align: 0; transition: transform .25s cubic-bezier(.34, 1.3, .64, 1); }
.nav-link:hover .nav-ic .ic { transform: translateY(-1px) scale(1.12); }
.nav-link[aria-current="page"] .nav-ic .ic { transform: none; }
/* Monitor AI: كبسولة متدرجة مع لمعة خفيفة */
body.ui-apple .main-nav a.nav-ai, body.ui-apple .mobile-nav a.nav-ai {
  color: #fff; font-weight: 800; margin-inline-start: 4px;
  background: linear-gradient(135deg, #bf5af2 0%, #7c5cff 55%, #4f7cff 100%);
  box-shadow: 0 6px 18px rgb(124 92 255 / .35);
  position: relative; overflow: hidden;
}
body.ui-apple .main-nav a.nav-ai:hover, body.ui-apple .mobile-nav a.nav-ai:hover { color: #fff; background: linear-gradient(135deg, #c86af7 0%, #8a6cff 55%, #5d88ff 100%); box-shadow: 0 8px 22px rgb(124 92 255 / .45); }
body.ui-apple .main-nav a.nav-ai[aria-current="page"], body.ui-apple .mobile-nav a.nav-ai[aria-current="page"] { color: #fff; background: linear-gradient(135deg, #a83fe0 0%, #6a48f5 55%, #3d68f0 100%); box-shadow: 0 0 0 3px rgb(124 92 255 / .28), 0 6px 18px rgb(124 92 255 / .4); }
.nav-ai::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgb(255 255 255 / .38) 50%, transparent 65%); transform: translateX(-120%); animation: nav-ai-shine 5s ease-in-out 1.2s infinite; pointer-events: none; }
@keyframes nav-ai-shine { 0%, 70% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.nav-ai .nav-ic .ic { animation: nav-ai-twinkle 2.8s ease-in-out infinite; }
@keyframes nav-ai-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.15) rotate(8deg); } }
/* زر Monitor AI السريع في الهيدر: يظهر على الهاتف والتابلت (القائمة مخفية في ☰) */
.ai-quick { display: none; }
@media (max-width: 960px) {
  body.ui-apple .ai-quick { display: inline-grid; place-items: center; color: #fff; border: 0; background: linear-gradient(135deg, #bf5af2, #5e5ce6); box-shadow: 0 4px 14px rgb(124 92 255 / .4); }
  body.ui-apple .ai-quick .ic { width: 1.2em; height: 1.2em; }
  body.ui-apple .mobile-nav a.nav-link { display: flex; }
}

/* ── زر تحدي اليوم في الهيدر ── */
.hdr-challenge-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 36px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  border: none;
  box-shadow: 0 2px 10px rgb(249 115 22 / .4);
  transition: box-shadow .2s, transform .15s;
  white-space: nowrap;
  cursor: pointer;
}
.hdr-challenge-btn:hover {
  box-shadow: 0 4px 16px rgb(249 115 22 / .6);
  transform: translateY(-1px);
  color: #fff;
}
.hdr-challenge-btn[aria-current="page"] {
  background: linear-gradient(135deg, #c2410c 0%, #b91c1c 100%);
}
/* أزرار دخول/تسجيل في الرأس (للزوار فقط) */
.hdr-auth-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.hdr-auth-login {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
}
.hdr-auth-login:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}
.hdr-auth-register {
  background: var(--accent);
  border: 1.5px solid var(--accent);
  color: #fff;
}
.hdr-auth-register:hover { opacity: .88; }
@media (max-width: 540px) {
  .hdr-auth-register { display: none; }
  .hdr-auth-login { padding: 5px 11px; font-size: .8rem; }
}

.hdr-ch-ic {
  font-size: 1em;
  animation: hdr-ch-pulse 2s ease-in-out infinite;
}
@keyframes hdr-ch-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
/* الهاتف الصغير: أيقونة فقط */
@media (max-width: 540px) {
  .hdr-ch-lbl { display: none; }
  .hdr-challenge-btn { padding: 0 10px; }
}
/* حاسوب صغير / تابلت أفقي: أيقونات فقط (الاسم في التلميح)، إلا الصفحة الحالية و Monitor AI */
@media (min-width: 961px) and (max-width: 1180px) {
  body.ui-apple .main-nav a.nav-link:not(.nav-ai):not([aria-current="page"]) .nav-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.ui-apple .main-nav a.nav-link:not(.nav-ai):not([aria-current="page"]) { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) { .nav-ai::after, .nav-ai .nav-ic .ic { animation: none; } .nav-link .ic { transition: none; } }

/* ══ v56: شريط جانبي تفاعلي للمتعلم (نفس تصميم الإدارة) ══ */
.staff-side a.side-ai > span:first-child {
  width: 30px; height: 30px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, #bf5af2 0%, #8a6cff 55%, #5d88ff 100%);
  box-shadow: 0 4px 14px rgb(124 92 255 / .45);
}
.staff-side a.side-ai > span:first-child .ic { width: 18px; height: 18px; animation: nav-ai-twinkle 2.8s ease-in-out infinite; }
.staff-side a.side-ai > span:last-child { font-weight: 700; background: linear-gradient(135deg, #a83fe0, #3d68f0); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.ui-apple .staff-side a.side-ai[aria-current="page"] { background: linear-gradient(135deg, rgb(168 63 224 / .18), rgb(61 104 240 / .18)); color: var(--text); box-shadow: inset 0 0 0 1px rgb(124 92 255 / .35); }
.staff-side a > span:first-child .ic { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.staff-side a:hover > span:first-child .ic { transform: scale(1.15); }

@media (prefers-reduced-motion: reduce) { .staff-side a.side-ai > span:first-child .ic, .staff-side a > span:first-child .ic { animation: none; transition: none; } }

/* ══ v57: مفاتيح Monitor AI في الإعدادات ══ */
.ai-keys { max-width: 720px; }
.ai-key-row { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--border); }
.ai-key-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-key-badge { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ai-key-badge.on { background: rgb(52 199 89 / .15); color: #248a3d; }
.ai-key-badge.off { background: var(--surface-3, #eee); color: var(--muted); }
[data-theme="dark"] .ai-key-badge.on { color: #30d158; }
.ai-key-meta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ai-key-meta code { background: var(--surface-3, #f2f2f7); padding: 1px 6px; border-radius: 6px; }
.ai-key-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-key-actions a { margin-inline-start: auto; }
.ai-key-result:empty { display: none; }
.ai-key-result { padding: 8px 12px; border-radius: 10px; background: var(--surface-3, #f2f2f7); overflow-wrap: anywhere; }
.ai-key-result.ok { background: rgb(52 199 89 / .14); }
.ai-key-result.err { background: rgb(255 59 48 / .12); }
/* AI quota note */
.chat-quota span { font-weight: 600; color: var(--accent, #007aff); }
/* Admin AI controls toggle */
.toggle-label input[type="checkbox"] { width: 44px; height: 26px; appearance: none; -webkit-appearance: none; background: var(--border); border-radius: 999px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle-label input[type="checkbox"]::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; }
.toggle-label input[type="checkbox"]:checked { background: var(--accent, #007aff); }
.toggle-label input[type="checkbox"]:checked::after { inset-inline-start: calc(100% - 23px); }

/* ══ الشريط الجانبي — شريط أيقونات عمودي مضغوط (56px) في الوضع المتقدم مع درج تراكب ══ */
.side-toggle { display: none; }
.side-open-btn { display: none; }

/* الشريط الجانبي في الوضع المتقدم: شريط أيقونات عمودي ضيق (56px) على الشاشات الكبيرة فقط */
@media (min-width: 769px) {
  body:not(.dash-simple-active) .staff-side,
  body:not(.dash-simple-active).ui-apple .staff-side,
  body:not(.dash-simple-active) .staff-side.learner,
  body:not(.dash-simple-active) .sidebar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: var(--hdr-h, 64px);
    bottom: 0;
    inset-inline-start: 0;
    width: 56px;
    padding: 10px 4px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: nowrap;
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
    background: var(--surface);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    z-index: 300;
    margin-inline-start: 0 !important;
    visibility: visible !important;
    box-shadow: none;
    transition: width .25s cubic-bezier(.25, 1, .5, 1), box-shadow .25s ease;
  }

  /* قائمة الروابط داخل شريط الأيقونات */
  body:not(.dash-simple-active) .staff-side nav,
  body:not(.dash-simple-active) .sidebar nav {
    display: flex;
    flex-direction: column;
    overflow-x: visible;
    gap: 4px;
  }

  /* عناصر الروابط في حالة شريط الأيقونات */
  body:not(.dash-simple-active) .staff-side a,
  body:not(.dash-simple-active).ui-apple .staff-side a,
  body:not(.dash-simple-active) .sidebar a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    border-radius: 10px;
    width: 100%;
    color: var(--text);
    text-decoration: none;
    font-size: .9rem;
    min-height: 44px;
    transition: background .2s ease, color .2s ease;
  }
  body:not(.dash-simple-active) .staff-side a:hover,
  body:not(.dash-simple-active).ui-apple .staff-side a:hover,
  body:not(.dash-simple-active) .sidebar a:hover {
    background: var(--surface-2);
  }
  body:not(.dash-simple-active) .staff-side a[aria-current="page"],
  body:not(.dash-simple-active).ui-apple .staff-side a[aria-current="page"],
  body:not(.dash-simple-active) .sidebar a[aria-current="page"] {
    background: var(--primary, #FF7A00);
    color: var(--on-primary, #ffffff);
  }
  body:not(.dash-simple-active) .staff-side a > span:first-child,
  body:not(.dash-simple-active) .sidebar a > span:first-child {
    flex: none;
    width: 24px;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
  }
  body:not(.dash-simple-active) .staff-side a > span:first-child .ic,
  body:not(.dash-simple-active) .sidebar a > span:first-child .ic {
    width: 20px;
    height: 20px;
  }
  /* إخفاء العناوين والنصوص في حالة شريط الأيقونات */
  body:not(.dash-simple-active) .staff-side .side-title,
  body:not(.dash-simple-active) .staff-side a > span:last-child,
  body:not(.dash-simple-active) .sidebar .side-title,
  body:not(.dash-simple-active) .sidebar a > span:last-child {
    display: none;
  }

  /* زر التبديل ☰ في أعلى شريط الأيقونات (النمط الكلاسيكي) */
  body:not(.dash-simple-active) .side-toggle {
    display: grid !important;
    place-items: center;
    width: 44px;
    height: 40px;
    margin: 0 auto 8px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    flex: none;
    transition: background .2s ease;
  }
  body:not(.dash-simple-active) .side-toggle:hover {
    background: var(--surface-3);
  }
  body:not(.dash-simple-active) .side-toggle .ic {
    width: 20px;
    height: 20px;
  }

  /* حالة الفتح: درج تراكب متمدد بكامل النصوص كـ Overlay على الشاشات الكبيرة */
  body:not(.dash-simple-active) .staff-side.open,
  body:not(.dash-simple-active).ui-apple .staff-side.open,
  body:not(.dash-simple-active) .sidebar.open {
    width: 250px !important;
    max-width: 85vw !important;
    padding: 14px 10px;
    z-index: 400;
    background: var(--surface);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  }
  body:not(.dash-simple-active) .staff-side.open .side-toggle,
  body:not(.dash-simple-active) .sidebar.open .side-toggle {
    margin-inline: 4px auto;
  }
  body:not(.dash-simple-active) .staff-side.open .side-title,
  body:not(.dash-simple-active) .sidebar.open .side-title {
    display: block !important;
    margin: 4px 10px 10px;
    font-weight: 800;
    font-size: .8rem;
    color: var(--muted);
    letter-spacing: .04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body:not(.dash-simple-active) .staff-side.open a,
  body:not(.dash-simple-active).ui-apple .staff-side.open a,
  body:not(.dash-simple-active) .sidebar.open a {
    justify-content: flex-start !important;
    padding: 10px 12px !important;
    gap: 12px !important;
    width: auto;
  }
  body:not(.dash-simple-active) .staff-side.open a > span:last-child,
  body:not(.dash-simple-active) .sidebar.open a > span:last-child {
    display: inline !important;
    opacity: 1 !important;
  }

  /* إزاحة المحتوى للشريط الأيقوني 56px في الوضع المتقدم */
  body:not(.dash-simple-active).has-side main,
  body:not(.dash-simple-active).has-side .site-footer {
    margin-inline-start: 56px !important;
    max-width: calc(100% - 56px) !important;
    box-sizing: border-box;
  }

  /* زر ⋮ في الرأس يظهر فقط في الوضع المتقدم على الشاشات الكبيرة */
  body:not(.dash-simple-active).has-side .side-open-btn {
    display: grid !important;
    place-items: center;
  }
  body.has-side .menu-toggle { display: none !important; }
  body.has-side .mobile-nav { display: none !important; }
}

/* ══ الهواتف (<= 768px): إزالة الشريط الجانبي والهمبرغر وتعطيل الوضع المبسط ══ */
@media (max-width: 768px) {
  /* تعطيل الوضع المبسط على الهاتف: إخفاء أزرار التبديل */
  #topbar-mode-btn,
  .topbar-mode-btn,
  #mode-toggle,
  .dash-mode-toggle {
    display: none !important;
  }

  /* إخفاء بطاقات وقسم الوضع المبسط دائماً على الهاتف */
  [data-simple-only],
  .dash-simple [data-simple-only],
  .dash-simple-actions {
    display: none !important;
  }

  /* إظهار جميع مكونات التجربة الكاملة على الهاتف */
  .dash-simple [data-full-only] {
    display: revert !important;
  }
  .dash-simple section.dash-top[data-full-only],
  .dash-simple section.dash-stats[data-full-only] {
    display: grid !important;
  }

  /* إخفاء زر القائمة ☰ في الهيدر على الهاتف */
  .menu-toggle,
  #menu-btn,
  body.has-side .menu-toggle {
    display: none !important;
  }

  /* إخفاء الشريط الجانبي ودرج التراكب والخلفية تماماً على الهاتف */
  .staff-side,
  .staff-side.learner,
  .sidebar,
  #staff-side,
  .side-backdrop,
  body:not(.dash-simple-active) .staff-side,
  body:not(.dash-simple-active).ui-apple .staff-side,
  body:not(.dash-simple-active) .staff-side.learner,
  body:not(.dash-simple-active) .sidebar,
  .staff-side.open,
  .staff-side.learner.open,
  .sidebar.open,
  body:not(.dash-simple-active) .staff-side.open,
  body:not(.dash-simple-active).ui-apple .staff-side.open,
  body:not(.dash-simple-active) .staff-side.learner.open,
  body:not(.dash-simple-active) .sidebar.open {
    display: none !important;
    visibility: hidden !important;
  }

  /* المحتوى يمتد بعرض 100% بدون أي هامش جانبي */
  body:not(.dash-simple-active).has-side main,
  body:not(.dash-simple-active).has-side .site-footer,
  body.has-side main,
  body.has-side .site-footer,
  main,
  #app,
  .main-content {
    margin-inline-start: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* الوضع البسيط: إخفاء الشريط الجانبي وشريط الأيقونات وزر ⋮ والخلفية تماماً */
body.dash-simple-active .side-open-btn,
body.dash-simple-active .staff-side,
body.dash-simple-active #staff-side,
body.dash-simple-active .side-toggle,
body.dash-simple-active .side-backdrop {
  display: none !important;
}
body.dash-simple-active.has-side main,
body.dash-simple-active.has-side .site-footer {
  margin-inline-start: 0 !important;
  max-width: 100% !important;
}

/* خلفية الدرج الداكنة عند التمدد التراكبي */
.side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 390;
  background: rgb(0 0 0 / 0);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  transition: background .25s ease;
}
.side-backdrop.visible {
  display: block;
  background: rgb(0 0 0 / .45);
}

@media (prefers-reduced-motion: reduce) {
  .staff-side { transition: none !important; }
  .side-backdrop { transition: none !important; }
}

/* ══ قائمة المستخدم المنسدلة (Profile & Secondary Toggles) ══ */
.user-menu-wrap {
  position: relative;
  display: inline-flex;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 14px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 500;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: dropdown-pop .18s cubic-bezier(.25, 1, .5, 1);
}
.user-dropdown[hidden] {
  display: none !important;
}
.user-dropdown-header {
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-dropdown-header strong {
  font-size: .92rem;
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-header small {
  font-size: .78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: start;
  min-height: 44px;
  transition: background .15s ease, color .15s ease;
  box-sizing: border-box;
}
.user-dropdown-item:hover {
  background: var(--surface-2);
}
.user-dropdown-item .ud-ic {
  font-size: 1.1rem;
  flex: none;
  width: 20px;
  display: grid;
  place-items: center;
}
.user-dropdown-logout {
  color: var(--danger, #EF4444);
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px;
}
.user-dropdown-logout:hover {
  background: var(--danger-soft, rgb(239 68 68 / .15));
  color: var(--danger, #EF4444);
}
@keyframes dropdown-pop {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══ قيود النوافذ المنسدلة في الهيدر (Exclusive Popovers Constraints) ══ */
.user-dropdown,
.notif-dropdown,
.lang-dropdown {
  max-width: calc(100vw - 24px) !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  .user-dropdown {
    position: fixed !important;
    top: calc(var(--hdr-h, 56px) + 6px) !important;
    inset-inline-end: 12px !important;
    inset-inline-start: auto !important;
    width: min(280px, calc(100vw - 24px)) !important;
    max-height: calc(100vh - var(--hdr-h, 56px) - 24px) !important;
    overflow-y: auto !important;
    z-index: 600 !important;
  }
  .notif-dropdown {
    position: fixed !important;
    top: calc(var(--hdr-h, 56px) + 6px) !important;
    inset-inline-end: 12px !important;
    inset-inline-start: auto !important;
    width: min(360px, calc(100vw - 24px)) !important;
    max-height: calc(100vh - var(--hdr-h, 56px) - 24px) !important;
    overflow-y: auto !important;
    z-index: 600 !important;
  }
  .lang-dropdown {
    position: fixed !important;
    top: calc(var(--hdr-h, 56px) + 6px) !important;
    inset-inline-end: 12px !important;
    inset-inline-start: auto !important;
    width: min(220px, calc(100vw - 24px)) !important;
    max-height: calc(100vh - var(--hdr-h, 56px) - 24px) !important;
    overflow-y: auto !important;
    z-index: 600 !important;
  }
}

/* ══ غرفة الامتحان (Quiz Room) في نمط خالٍ من التشتت (Distraction-Free) ══ */
body.quiz-active .site-header,
body.quiz-active .staff-side,
body.quiz-active #staff-side,
body.quiz-active .side-open-btn,
body.quiz-active .side-backdrop,
body.quiz-active .site-footer {
  display: none !important;
}
body.quiz-active main {
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
}

/* ══ بطاقات الوضع البسيط (عمود واحد + حلقة الجاهزية + 3 إجراءات أساسية) ══ */
.simple-grid--single {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 680px;
  margin: 16px auto 0;
}
.simple-card--large {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius, 20px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--spring, ease), border-color .2s ease, box-shadow .2s ease;
  min-height: 84px;
  box-sizing: border-box;
}
.simple-card--large:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgb(255 122 0 / .16);
}
.simple-card--large:active {
  transform: scale(.98);
}
.simple-card-start {
  display: flex;
  align-items: center;
  gap: 18px;
}
.simple-card-start .simple-emoji {
  font-size: 2.2rem;
  line-height: 1;
  flex: none;
}
.simple-card-start strong {
  display: block;
  font-size: 1.18rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
}
.simple-card-start small {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
}
.simple-card-cta {
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
  white-space: nowrap;
  flex: none;
}
.dash-ready--simple {
  max-width: 680px;
  margin: 0 auto 16px;
}

/* الـ page-header لا يتداخل */
.page-header { flex-wrap: wrap; gap: 10px; }
.page-header-actions { flex-wrap: wrap; gap: 6px; }

/* ══ الحماية من التجاوز والتكبير على الهاتف (Mobile Responsiveness & Zoom-out Prevention) ══ */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
body, .app-shell, #app, .topbar, .site-header, .main-content, main {
  min-width: 0;
  box-sizing: border-box;
}
.site-header, .topbar {
  max-width: 100%;
  width: 100%;
}
.main-content, main {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
}
.card, .card-simple, form, .form-group, .dash-kpi, .dash-hero, .dash-kpis {
  max-width: 100%;
  box-sizing: border-box;
}
input, select, textarea, button {
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .site-header, .topbar {
    max-width: 100%;
    overflow-x: clip;
  }
  .header-inner {
    height: 56px;
    padding: 0 10px;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .brand {
    font-size: .95rem;
    gap: 6px;
    flex-shrink: 0;
  }
  .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
  .brand small {
    display: none !important;
  }
  .header-actions {
    margin-inline-start: auto;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
    flex-wrap: nowrap;
  }
  .header-actions .icon-btn {
    height: 44px;
    min-width: 44px;
    padding: 0 8px;
    font-size: .85rem;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .header-actions .icon-btn svg,
  .header-actions .icon-btn .ic {
    width: 19px;
    height: 19px;
  }
  /* إخفاء الأزرار الثانوية على الجوال — موجودة في قائمة المستخدم */
  .hdr-desktop-only {
    display: none !important;
  }
  .side-open-btn {
    display: none !important;
  }
  .menu-toggle,
  #menu-btn {
    display: none !important;
  }
  main, .main-content {
    padding: 14px 10px 56px;
  }
  .card {
    padding: 14px;
    border-radius: 12px;
  }
  .dash-kpis {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
  }
  .dash-chips {
    gap: 6px;
  }
  .dash-chip {
    min-width: 0;
    flex: 1 1 calc(50% - 6px);
  }
  .table-wrap, .admin-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 769px) {
  .ud-mobile-only {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 6px;
    gap: 4px;
  }
  .header-actions {
    gap: 4px;
  }
  .header-actions .icon-btn {
    height: 44px;
    min-width: 44px;
    padding: 0 6px;
  }
  .brand > span:last-child {
    font-size: .88rem;
  }
}

/* ══ v67: الجداول تتحول إلى بطاقات على الهاتف واللوحة (أندرويد/آيفون/iPad) ══ */
@media (max-width: 1100px) {
  .table-wrap table.rtable, .admin-table-wrap table.rtable { min-width: 0; }
  .table-wrap:has(table.rtable), .card:has(> table.rtable) { border: 0; background: transparent; box-shadow: none; padding: 0 !important; overflow: visible; }
  table.rtable, table.rtable tbody, table.rtable tr, table.rtable td { display: block; width: 100%; }
  table.rtable thead { display: none; }
  table.rtable tr {
    margin: 0 0 12px; padding: 4px 14px; border: 1px solid var(--border); border-radius: 16px;
    background: var(--surface); box-shadow: var(--shadow-sm, none);
  }
  table.rtable tr:hover td { background: transparent; }
  table.rtable td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px solid var(--border); white-space: normal !important; text-align: end; min-width: 0;
    overflow-wrap: anywhere;
  }
  table.rtable td:last-child { border-bottom: 0; }
  table.rtable td::before {
    content: attr(data-label); flex: 0 0 auto; max-width: 45%; text-align: start;
    font-weight: 700; font-size: .78rem; color: var(--muted);
  }
  table.rtable td[data-label=""]::before { display: none; }
  table.rtable td[data-label=""] { justify-content: flex-start; }
  /* الخانة الأولى (العنوان/النص) بعرض كامل وخط أوضح */
  table.rtable td:first-child { display: block; text-align: start; font-weight: 700; font-size: .98rem; }
  table.rtable td:first-child::before { display: block; max-width: none; margin-bottom: 4px; font-size: .74rem; }
  table.rtable td:first-child a { white-space: normal !important; }
  table.rtable td .row, table.rtable td .btn-row { flex-wrap: wrap; justify-content: flex-end; }
  table.rtable input.input { max-width: 140px; }
  table.rtable td.td-empty { display: none; }
}
/* اللوحات: بطاقتان في الصف */
@media (min-width: 600px) and (max-width: 1100px) {
  table.rtable tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
  table.rtable tr { margin: 0; }
}

/* الحواسيب: الجدول لا يخرج عن البطاقة، والأزرار تلتف بدل أن تُقص */
.card:has(> table.rtable), .table-wrap:has(table.rtable) { overflow-x: auto; }
.list-table td:last-child { white-space: normal; }
.list-table td:last-child > * { flex-wrap: wrap; }

/* ══ v67: آيفون/أندرويد — منع التكبير التلقائي عند الكتابة، واحترام حواف الشاشة (notch) ══ */
@media (max-width: 1100px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px; }
}
@media (max-width: 1023px) {
  .staff-side { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  html[dir="rtl"] .staff-side { padding-right: calc(12px + env(safe-area-inset-right, 0px)); }
  html[dir="ltr"] .staff-side { padding-left: calc(12px + env(safe-area-inset-left, 0px)); }
}
/* أهداف لمس مريحة (44px) على شاشات اللمس */
@media (pointer: coarse) {
  .staff-side a, .act-btn, .icon-btn { min-height: 44px; }
}

/* ══ v68: الدروس التفاعلية — التعلم النشط ══ */
.lx-pill { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-inline-end: 6px;
  background: rgb(124 92 255 / .12); color: #6a48f5; }
[data-theme="dark"] .lx-pill { color: #b9a6ff; background: rgb(124 92 255 / .22); }
.lx-continue { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); padding: 16px 18px !important; margin-bottom: 18px;
  transition: transform .25s var(--spring, ease), box-shadow .25s ease; }
.lx-continue:hover { transform: translateY(-2px); box-shadow: var(--shadow, 0 10px 30px rgb(0 0 0 / .1)); }
.lx-continue-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--primary, #f97316), #c2410c); }
.lx-continue-ic svg { width: 20px; height: 20px; }
[dir="rtl"] .lx-continue-ic svg { transform: scaleX(-1); }
.lx-continue-body { flex: 1; display: grid; gap: 2px; min-width: 0; }
.lx-continue-body small { color: var(--muted); font-weight: 600; }
.lx-review-help { margin: -4px 4px 10px; }

.lx-mode { margin-inline-start: auto; border: 0; background: var(--surface-3, #f2f2f7); color: var(--text); font: inherit; font-size: .8rem; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.lx-progress { display: flex; gap: 5px; margin: 4px 0 8px; }
.lx-seg { flex: 1; height: 22px; padding: 8px 0; border: 0; background: none; cursor: pointer; }
.lx-seg i { display: block; height: 6px; border-radius: 999px; background: var(--surface-3, #e5e5ea); transition: background .3s ease; }
.lx-seg.is-done i { background: var(--success, #34c759); }
.lx-seg.is-cur i { background: var(--primary, #f97316); }
.lx-seg:disabled { cursor: default; }
.lx-step-meta { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
.lx-step { outline: none; animation: lx-in .35s ease both; }
@keyframes lx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lx-step-title { font-size: clamp(1.25rem, 3.5vw, 1.6rem); margin: 6px 0 12px; }
.lx-step .prose { margin-bottom: 8px; }
.lx-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.lx-nav .btn { display: inline-flex; align-items: center; gap: 6px; }
.lx-nav .btn svg { width: 18px; height: 18px; }
[dir="ltr"] .lx-nav .btn svg { transform: scaleX(-1); }
.lx-gate { text-align: center; margin: 10px 0 0; }

/* الأنشطة */
.lx { margin: 20px 0; padding: 18px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface-2, #f7f7f8); }
.lx-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 800; letter-spacing: .02em; padding: 4px 10px 4px 12px; border-radius: 999px; margin-bottom: 10px; }
.lx-tag svg { width: 15px; height: 15px; }
.lx-quiz .lx-tag { background: rgb(0 122 255 / .12); color: #0a64d6; }
.lx-scenario .lx-tag { background: rgb(255 149 0 / .14); color: #b35c00; }
.lx-reveal .lx-tag { background: rgb(175 82 222 / .13); color: #8e3fc0; }
[data-theme="dark"] .lx-quiz .lx-tag { color: #64a8ff; }
[data-theme="dark"] .lx-scenario .lx-tag { color: #ffb44d; }
[data-theme="dark"] .lx-reveal .lx-tag { color: #d29bf5; }
.lx-q { font-weight: 700; font-size: 1.05rem; line-height: 1.7; margin: 0 0 12px; }
.lx-hint { font-size: .82rem; color: var(--muted); margin: -6px 0 10px; }
.lx-opts { display: grid; gap: 8px; }
.lx-opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: start; font: inherit; color: var(--text); cursor: pointer;
  padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface, #fff);
  transition: border-color .2s ease, background .2s ease, transform .15s ease; }
.lx-opt:not(:disabled):hover { border-color: var(--primary, #f97316); }
.lx-opt:not(:disabled):active { transform: scale(.99); }
.lx-mark { flex: none; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--border-strong, #c7c7cc); display: grid; place-items: center; }
.lx-opt[role="checkbox"] .lx-mark { border-radius: 6px; }
.lx-opt.is-picked .lx-mark { border-color: var(--primary, #f97316); background: var(--primary, #f97316); box-shadow: inset 0 0 0 3px var(--surface, #fff); }
.lx-opt-body { display: grid; gap: 4px; }
.lx-why { font-size: .86rem; color: var(--text-soft, var(--muted)); font-weight: 500; }
.lx-opt:disabled { cursor: default; }
.lx-opt.is-correct { border-color: #34c759; background: rgb(52 199 89 / .1); }
.lx-opt.is-correct .lx-mark { border-color: #34c759; background: #34c759; box-shadow: none; }
.lx-opt.is-correct .lx-mark::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.lx-opt.is-wrong { border-color: #ff3b30; background: rgb(255 59 48 / .08); }
.lx-opt.is-wrong .lx-mark { border-color: #ff3b30; background: #ff3b30; box-shadow: none; }
.lx-opt.is-muted { opacity: .55; }
.lx-confirm { margin-top: 12px; }
.lx-verdict { margin-top: 12px; padding: 12px 14px; border-radius: 14px; display: grid; gap: 4px; animation: lx-in .3s ease both; }
.lx-verdict.ok { background: rgb(52 199 89 / .14); }
.lx-verdict.ok strong { color: #248a3d; }
.lx-verdict.ko { background: rgb(255 149 0 / .14); }
.lx-verdict.ko strong { color: #b35c00; }
[data-theme="dark"] .lx-verdict.ok strong { color: #30d158; }
[data-theme="dark"] .lx-verdict.ko strong { color: #ffb44d; }
.lx-reveal-btn { margin-top: 2px; }
.lx-reveal.is-open .lx-reveal-btn { display: none; }
.lx-answer { padding: 12px 14px; border-radius: 14px; background: var(--surface, #fff); border: 1px dashed rgb(175 82 222 / .45); animation: lx-flip .45s cubic-bezier(.2, .8, .2, 1) both; }
.lx-answer p { margin: 0; }
@keyframes lx-flip { from { opacity: 0; transform: perspective(600px) rotateX(-12deg); } to { opacity: 1; transform: none; } }

/* الخلاصة */
.lx-final { display: grid; gap: 18px; }
.lx-score { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 18px; background: var(--surface-2, #f7f7f8); }
.lx-score.is-perfect { background: rgb(52 199 89 / .12); }
.lx-score-num { flex: none; font-size: 2rem; font-weight: 800; line-height: 1; }
.lx-score-num span { font-size: 1rem; color: var(--muted); }
.lx-score p { margin: 0; }
.lx-summary { padding: 18px; border-radius: 18px; border: 1px solid var(--border); }
.lx-summary h3 { margin: 0 0 10px; font-size: 1rem; }
.lx-summary ul { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 8px; line-height: 1.7; }
.lx-final-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 600px) {
  .lx { padding: 14px; margin: 16px -4px; }
  .lx-final-actions .btn { flex: 1 1 100%; justify-content: center; }
  .lx-nav .btn { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .lx-step, .lx-verdict, .lx-answer { animation: none; } }
.lx-final > * { min-width: 0; }
.lx-final-actions .btn { white-space: normal; text-align: center; }
.lx-stepper, .lx-step { min-width: 0; }

/* ══ شاشة الامتحان على الهاتف واللوحة ══ */
/* الشريط العلوي والأيقونات — مخفية على الحاسوب، تظهر على الهاتف */
.nrs-topbar, .nrs-btn-ok .ok-ic { display: none; }

/* الشريط العلوي — مرئي فقط على الهاتف */
.nrs-topbar {
  position: relative; display: none; align-items: center; gap: 10px; direction: rtl;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 12px;
  background: linear-gradient(180deg, #0f3e9e 0%, #0b2f7a 100%);
  box-shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 6px 18px rgb(0 0 0 / .35);
  font-family: var(--nrs-ui);
}
.nrs-tb-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 14px; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: rgb(255 255 255 / .12); transition: background .2s ease, transform .15s ease;
}
.nrs-tb-btn svg { width: 22px; height: 22px; }
.nrs-tb-btn:active { transform: scale(.94); background: rgb(255 255 255 / .22); }
.nrs-tb-btn[aria-pressed="false"] { opacity: .7; }
.nrs-tb-pills { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nrs-tb-pill {
  display: inline-flex; align-items: baseline; gap: 2px; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  background: rgb(0 0 0 / .32); color: #fff; font-weight: 800; font-size: 1rem; line-height: 1.2;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .08) inset;
}
.nrs-tb-title { flex: 1 1 auto; min-width: 0; justify-content: center; overflow: hidden; text-overflow: ellipsis; display: block; text-align: center; font-weight: 700; }
.nrs-tb-timer { color: #ffd34d; font-variant-numeric: tabular-nums; }
.nrs-tb-timer[hidden] { display: none; }
.nrs-tb-timer small { font-size: .72em; opacity: .85; }
.nrs-tb-timer.timer-warn { color: #ffb020; }
.nrs-tb-timer.timer-low { color: #fff; background: #e5302a; animation: nrs-pulse 1s ease-in-out infinite; }
@keyframes nrs-pulse { 50% { transform: scale(1.06); } }
.nrs-tb-count { font-variant-numeric: tabular-nums; }
.nrs-tb-progress { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: rgb(255 255 255 / .12); }
.nrs-tb-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd34d, #ffb020); transition: width .35s ease; margin-inline-start: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   تخطيط الامتحان على الهاتف المحمول فقط (<= 768px):
   - تخطيط عمودي يملأ 100dvh تماماً بدون تمرير
   - لوحة أزرار سفلية مكبرة بحجم لوحة مفاتيح الهاتف (~28dvh–32dvh)
   - حجم خط واضح وكبير للسؤال والخيارات
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .nrs-topbar { display: flex; }
  .nrs-overlay {
    padding: 0;
    background: #111;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .nrs-overlay .nrs-window {
    flex-flow: column nowrap;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    background: #111;
  }
  /* التخطيط العمودي: الشاشة الرئيسية بالأعلى، الأزرار بالأسفل */
  .nrs-overlay .nrs-content-row {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }
  .nrs-overlay .nrs-main {
    order: 1;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    background: #000;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    box-shadow: none;
  }
  .nrs-overlay .nrs-media {
    flex: 0 0 32%;
    max-height: 35%;
    min-height: 0;
    overflow: hidden;
    background: #000;
  }
  .nrs-overlay .nrs-media img,
  .nrs-overlay .nrs-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .nrs-overlay .nrs-text-panel,
  .nrs-overlay .nrs-text-panel.has-result {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px 10px;
    background: rgb(34,34,34);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    color: #F8FAFC;
  }
  .nrs-overlay .nrs-block {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 8px;
    min-height: 0;
  }
  .nrs-overlay .nrs-q-main {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(1.1rem, 4.4vw, 1.5rem);
    line-height: 1.55;
    margin: 0;
    padding: 2px 0 6px;
    flex-shrink: 0;
    font-weight: 700;
    color: #FFFFFF;
  }
  .nrs-overlay .nrs-sub-label {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(1rem, 4vw, 1.3rem);
    line-height: 1.55;
    margin: 3px 0 2px;
    font-weight: 700;
    color: #FFFFFF;
  }
  .nrs-overlay .nrs-opt {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(1.05rem, 4.2vw, 1.35rem);
    line-height: 1.45;
    padding: 8px 0;
    flex: 1 1 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    color: #FFFFFF;
    min-height: 44px;
    height: auto;
    overflow: visible;
  }
  .nrs-overlay .nrs-opt:last-child {
    border-bottom: none;
  }
  .nrs-overlay .nrs-opt-n {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: 1.18em;
    font-weight: 700;
    min-width: 2em;
    color: #FFFFFF;
  }
  .nrs-overlay .nrs-opt-dots {
    height: 2px;
    background: rgba(255, 255, 255, 0.55);
    margin: 0 10px;
  }
  .nrs-overlay .nrs-opt-text {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-weight: 600;
    line-height: 1.45;
    color: #F8FAFC;
    max-width: 85%;
    white-space: normal;
    word-break: break-word;
  }
  .nrs-overlay .nrs-opts-list {
    flex: 1 1 0%;
    gap: 6px;
    justify-content: space-evenly;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .nrs-overlay .nrs-opts-row {
    flex: 1 1 0%;
    align-content: space-around;
    gap: 8px;
  }

  /* إخفاء عناصر الديسكتوب في الموبايل */
  .nrs-overlay .nrs-side-head { display: none !important; }
  .nrs-overlay .nrs-info-box { display: none !important; }
  .nrs-overlay .nrs-btn-stop { display: none !important; }
  .nrs-overlay .nrs-indicators { display: none !important; }
  .nrs-overlay .nrs-footer { display: none !important; }
  .nrs-overlay .nrs-btn-close { display: none !important; }

  /* السايدبار يصبح الحاوية السفلية للأزرار */
  .nrs-overlay .nrs-side {
    order: 2;
    width: 100%;
    max-width: none;
    height: auto;
    flex: 0 0 auto;
    background: #1a1a2e;
    border-radius: 0;
    box-shadow: none;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid rgb(95,87,229);
  }
  .nrs-overlay .nrs-ctrl-col {
    flex: 1 1 auto;
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    flex-flow: row nowrap;
    gap: 8px;
    align-items: stretch;
    min-height: 0;
  }

  /* لوحة الأزرار بحجم لوحة مفاتيح الهاتف: ~28dvh–32dvh (230px–270px) */
  .nrs-overlay .nrs-panel {
    direction: ltr;
    width: 100%;
    flex: 1 1 auto;
    height: clamp(230px, 30dvh, 270px);
    display: grid;
    grid-template-columns: minmax(64px, 18%) 1fr minmax(64px, 18%);
    grid-template-areas: "clear choices ok";
    gap: 8px;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  /* زر تصحيح ✕ الأحمر */
  .nrs-overlay .nrs-btn-correct {
    grid-area: clear;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    font-size: clamp(0.85rem, 3.6vw, 1.15rem);
    font-weight: 900;
    padding: 6px 2px;
    background: linear-gradient(180deg, #ff5a4f 0%, #d6271d 100%);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 4px 12px rgb(214 39 29 / .4);
  }

  /* شبكة أزرار 1-4 الزرقاء */
  .nrs-overlay .nrs-choices {
    grid-area: choices;
    direction: rtl;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 1fr;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 0;
  }
  .nrs-overlay .nrs-choice-btn {
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    max-height: none;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 14px;
    display: grid;
    place-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, #3a5fe0 0%, #1a3abf 100%);
    color: #fff;
    box-shadow: 0 2px 0 rgb(255 255 255 / .25) inset,
                0 -4px 0 rgb(0 0 0 / .25) inset,
                0 6px 14px rgb(0 0 0 / .35);
    transition: transform .1s ease, filter .15s ease;
    font-size: clamp(2rem, 7.5vw, 2.9rem);
    font-weight: 900;
  }
  .nrs-overlay .nrs-choice-sep { margin: 0; }
  .nrs-overlay .nrs-choice-num {
    font-family: var(--nrs-ui);
    font-size: 1em;
    font-weight: 900;
    line-height: 1;
    color: inherit;
  }
  .nrs-overlay .nrs-choice-sq { display: none; }
  .nrs-overlay .nrs-choice-btn:active:not([disabled]) { transform: scale(.93); filter: brightness(1.15); }
  .nrs-overlay .nrs-choice-btn.choice-on {
    background: linear-gradient(180deg, #ffd34d 0%, #f59e0b 100%);
    color: #1a1300;
    box-shadow: 0 0 0 3px #fff inset, 0 6px 16px rgb(245 158 11 / .4);
  }
  .nrs-overlay .nrs-choice-btn.choice-on .nrs-choice-num { color: #1a1300; }
  .nrs-overlay .nrs-choice-btn.choice-correct { background: linear-gradient(180deg, #3ad16b 0%, #16a34a 100%); color: #fff; }
  .nrs-overlay .nrs-choice-btn.choice-wrong { background: linear-gradient(180deg, #ff5a4f 0%, #d6271d 100%); color: #fff; }
  .nrs-overlay .nrs-choice-btn[disabled]:not(.choice-correct):not(.choice-wrong) { filter: saturate(.3) brightness(.55); }

  /* زر موافق الأخضر */
  .nrs-overlay .nrs-btn-ok {
    grid-area: ok;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 6px 2px;
    border: none;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    font-family: var(--nrs-ui);
    box-shadow: 0 2px 0 rgb(255 255 255 / .25) inset,
                0 -4px 0 rgb(0 0 0 / .25) inset,
                0 6px 14px rgb(21 128 61 / .4);
    transition: transform .1s ease, filter .15s ease;
  }
  .nrs-overlay .nrs-btn-ok.is-next { background: linear-gradient(180deg, #3a5fe0 0%, #1a3abf 100%); }
  .nrs-overlay .nrs-btn-ok .ok-ic { display: block; line-height: 0; }
  .nrs-overlay .nrs-btn-ok .ok-ic svg { width: clamp(28px, 8vw, 40px); height: clamp(28px, 8vw, 40px); }
  .nrs-overlay .nrs-btn-ok .ok-lbl { font-size: clamp(0.85rem, 3.6vw, 1.15rem); font-weight: 900; }
  .nrs-overlay .nrs-btn-ok:active { transform: scale(.93); filter: brightness(1.15); }
}

/* ══════════════════════════════════════════════════════════════════════════
   Desktop-mode Portrait (>= 769px and orientation: portrait):
   - تكبير لوحة المفاتيح السفلية (~30dvh / 230px–270px)
   - تخطيط عمودي يملأ الشاشة 100dvh تماماً بدون تمرير وبدون ضغط أفقي
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (orientation: portrait) {
  .nrs-topbar { display: flex; }
  .nrs-overlay {
    padding: 0;
    background: #111;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .nrs-overlay .nrs-window {
    flex-flow: column nowrap;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    background: #111;
  }
  .nrs-overlay .nrs-content-row {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }
  .nrs-overlay .nrs-main {
    order: 1;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    background: #000;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    box-shadow: none;
  }
  .nrs-overlay .nrs-media {
    flex: 0 0 34%;
    max-height: 36%;
    min-height: 0;
    overflow: hidden;
    background: #000;
  }
  .nrs-overlay .nrs-media img,
  .nrs-overlay .nrs-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .nrs-overlay .nrs-text-panel,
  .nrs-overlay .nrs-text-panel.has-result {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px 10px;
    background: rgb(34,34,34);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    color: #F8FAFC;
  }
  .nrs-overlay .nrs-block {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 8px;
    min-height: 0;
  }
  .nrs-overlay .nrs-q-main {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(1.1rem, 2.5vw, 1.55rem);
    line-height: 1.55;
    margin: 0;
    padding: 2px 0 6px;
    flex-shrink: 0;
    font-weight: 700;
    color: #FFFFFF;
  }
  .nrs-overlay .nrs-sub-label {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    line-height: 1.55;
    margin: 3px 0 2px;
    font-weight: 700;
    color: #FFFFFF;
  }
  .nrs-overlay .nrs-opt {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: clamp(1.05rem, 2.4vw, 1.4rem);
    line-height: 1.45;
    padding: 8px 0;
    flex: 1 1 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    color: #FFFFFF;
    min-height: 44px;
    height: auto;
    overflow: visible;
  }
  .nrs-overlay .nrs-opt:last-child {
    border-bottom: none;
  }
  .nrs-overlay .nrs-opt-n {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-size: 1.18em;
    font-weight: 700;
    min-width: 2em;
    color: #FFFFFF;
  }
  .nrs-overlay .nrs-opt-dots {
    height: 2px;
    background: rgba(255, 255, 255, 0.55);
    margin: 0 10px;
  }
  .nrs-overlay .nrs-opt-text {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    font-weight: 600;
    line-height: 1.45;
    color: #F8FAFC;
    max-width: 85%;
    white-space: normal;
    word-break: break-word;
  }
  .nrs-overlay .nrs-opts-list {
    flex: 1 1 0%;
    gap: 6px;
    justify-content: space-evenly;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .nrs-overlay .nrs-opts-row {
    flex: 1 1 0%;
    align-content: space-around;
    gap: 8px;
  }

  /* إخفاء عناصر الديسكتوب في الوضع العمودي */
  .nrs-overlay .nrs-side-head { display: none !important; }
  .nrs-overlay .nrs-info-box { display: none !important; }
  .nrs-overlay .nrs-btn-stop { display: none !important; }
  .nrs-overlay .nrs-indicators { display: none !important; }
  .nrs-overlay .nrs-footer { display: none !important; }
  .nrs-overlay .nrs-btn-close { display: none !important; }

  /* السايدبار يصبح الحاوية السفلية للأزرار */
  .nrs-overlay .nrs-side {
    order: 2;
    width: 100%;
    max-width: none;
    height: auto;
    flex: 0 0 auto;
    background: #1a1a2e;
    border-radius: 0;
    box-shadow: none;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid rgb(95,87,229);
  }
  .nrs-overlay .nrs-ctrl-col {
    flex: 1 1 auto;
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    flex-flow: row nowrap;
    gap: 8px;
    align-items: stretch;
    min-height: 0;
  }

  /* تكبير لوحة الأزرار السفلية: ~30dvh / 230px–270px */
  .nrs-overlay .nrs-panel {
    direction: ltr;
    width: 100%;
    flex: 1 1 auto;
    height: clamp(230px, 30dvh, 270px);
    display: grid;
    grid-template-columns: minmax(70px, 18%) 1fr minmax(70px, 18%);
    grid-template-areas: "clear choices ok";
    gap: 8px;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  /* زر تصحيح ✕ الأحمر */
  .nrs-overlay .nrs-btn-correct {
    grid-area: clear;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    font-size: clamp(0.95rem, 2vw, 1.2rem);
    font-weight: 900;
    padding: 6px 2px;
    background: linear-gradient(180deg, #ff5a4f 0%, #d6271d 100%);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 4px 12px rgb(214 39 29 / .4);
    cursor: pointer;
  }

  /* شبكة أزرار 1-4 الزرقاء */
  .nrs-overlay .nrs-choices {
    grid-area: choices;
    direction: rtl;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 1fr;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 0;
  }
  .nrs-overlay .nrs-choice-btn {
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    max-height: none;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 14px;
    display: grid;
    place-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, #3a5fe0 0%, #1a3abf 100%);
    color: #fff;
    box-shadow: 0 2px 0 rgb(255 255 255 / .25) inset,
                0 -4px 0 rgb(0 0 0 / .25) inset,
                0 6px 14px rgb(0 0 0 / .35);
    transition: transform .1s ease, filter .15s ease;
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 900;
  }
  .nrs-overlay .nrs-choice-sep { margin: 0; }
  .nrs-overlay .nrs-choice-num {
    font-family: var(--nrs-ui);
    font-size: 1em;
    font-weight: 900;
    line-height: 1;
    color: inherit;
  }
  .nrs-overlay .nrs-choice-sq { display: none; }
  .nrs-overlay .nrs-choice-btn:active:not([disabled]) { transform: scale(.93); filter: brightness(1.15); }
  .nrs-overlay .nrs-choice-btn.choice-on {
    background: linear-gradient(180deg, #ffd34d 0%, #f59e0b 100%);
    color: #1a1300;
    box-shadow: 0 0 0 3px #fff inset, 0 6px 16px rgb(245 158 11 / .4);
  }
  .nrs-overlay .nrs-choice-btn.choice-on .nrs-choice-num { color: #1a1300; }
  .nrs-overlay .nrs-choice-btn.choice-correct { background: linear-gradient(180deg, #3ad16b 0%, #16a34a 100%); color: #fff; }
  .nrs-overlay .nrs-choice-btn.choice-wrong { background: linear-gradient(180deg, #ff5a4f 0%, #d6271d 100%); color: #fff; }
  .nrs-overlay .nrs-choice-btn[disabled]:not(.choice-correct):not(.choice-wrong) { filter: saturate(.3) brightness(.55); }

  /* زر موافق الأخضر */
  .nrs-overlay .nrs-btn-ok {
    grid-area: ok;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 6px 2px;
    border: none;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    font-family: var(--nrs-ui);
    box-shadow: 0 2px 0 rgb(255 255 255 / .25) inset,
                0 -4px 0 rgb(0 0 0 / .25) inset,
                0 6px 14px rgb(21 128 61 / .4);
    transition: transform .1s ease, filter .15s ease;
  }
  .nrs-overlay .nrs-btn-ok.is-next { background: linear-gradient(180deg, #3a5fe0 0%, #1a3abf 100%); }
  .nrs-overlay .nrs-btn-ok .ok-ic { display: block; line-height: 0; }
  .nrs-overlay .nrs-btn-ok .ok-ic svg { width: clamp(28px, 5.5vw, 42px); height: clamp(28px, 5.5vw, 42px); }
  .nrs-overlay .nrs-btn-ok .ok-lbl { font-size: clamp(0.85rem, 2vw, 1.15rem); font-weight: 900; }
  .nrs-overlay .nrs-btn-ok:active { transform: scale(.93); filter: brightness(1.15); }
}

/* ══ زر موافق معطل ورمادي مصمت أثناء تشغيل الصوت في وضع الامتحان ══ */
.nrs-overlay .nrs-btn-ok:disabled,
.nrs-overlay .nrs-btn-ok[disabled],
.nrs-overlay .nrs-btn-ok.is-waiting-audio,
.nrs-btn-ok:disabled,
.nrs-btn-ok[disabled],
.nrs-btn-ok.is-waiting-audio {
  background: linear-gradient(180deg, #6B7280 0%, #4B5563 100%) !important;
  background-color: #4B5563 !important;
  border-color: #6B7280 !important;
  color: #D1D5DB !important;
  box-shadow: none !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  filter: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.nrs-overlay .nrs-btn-ok:disabled *,
.nrs-overlay .nrs-btn-ok[disabled] *,
.nrs-overlay .nrs-btn-ok.is-waiting-audio *,
.nrs-btn-ok:disabled *,
.nrs-btn-ok[disabled] *,
.nrs-btn-ok.is-waiting-audio * {
  pointer-events: none !important;
  color: #D1D5DB !important;
}

/* ══ بطل الكود — Champion Card ══════════════════════════════════════════════ */
.champ-hero { display:flex; align-items:center; gap:14px; padding:4px 0 12px; border-bottom:1px solid var(--border); margin-bottom:12px; }
.champ-avatar { width:52px; height:52px; border-radius:50%; object-fit:cover; }
.champ-avatar-ph { width:52px; height:52px; border-radius:50%; background:var(--surface-2); display:flex; align-items:center; justify-content:center; font-size:1.4rem; }
.champ-crown { font-size:.75rem; font-weight:700; color:var(--accent); letter-spacing:.03em; }
.champ-name { font-size:1.05rem; font-weight:700; }
.champ-score { font-size:.82rem; color:var(--muted); }
.champ-empty { color:var(--muted); font-size:.9rem; padding:8px 0 12px; border-bottom:1px solid var(--border); margin-bottom:12px; }
.champ-mine { font-size:.9rem; padding:10px 0; border-bottom:1px solid var(--border); margin-bottom:10px; }
.champ-cta { text-align:center; padding:12px 0 4px; }
.champ-school-board, .champ-global-board { margin-top:4px; }
.champ-board-title { font-size:.78rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
.champ-board-row { display:flex; align-items:center; gap:10px; padding:7px 0; border-bottom:1px solid var(--border); font-size:.88rem; }
.champ-board-row:last-child { border-bottom:none; }
.champ-board-row.is-me { background:color-mix(in srgb,var(--accent) 8%,transparent); border-radius:8px; padding-inline:8px; }
.champ-rank { min-width:24px; font-weight:700; text-align:center; font-size:.82rem; }
.champ-mini-av { width:28px; height:28px; border-radius:50%; object-fit:cover; font-size:.85rem; display:flex; align-items:center; justify-content:center; background:var(--surface-2); }
.champ-board-name { flex:1; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.champ-board-score { font-weight:700; color:var(--accent); }
.champ-board-time { margin-inline-start:4px; }

/* ── Modal التحدي ───────────────────────────────────────────────────────── */
.champ-modal { max-width:520px; width:94vw; }
.ch-body { padding:0 4px 8px; }
.ch-progress { display:flex; justify-content:space-between; align-items:center; font-size:.82rem; color:var(--muted); margin-bottom:14px; padding-top:4px; }
.ch-timer { font-variant-numeric:tabular-nums; font-weight:700; color:var(--accent); }
.ch-q-text { font-size:1rem; font-weight:600; margin-bottom:12px; line-height:1.5; }
.ch-q-img { width:100%; max-height:200px; object-fit:cover; border-radius:10px; margin-bottom:12px; }
.ch-options { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; }
.ch-opt { background:var(--surface-2); border:2px solid var(--border); border-radius:10px; padding:12px 16px; text-align:start; font-size:.9rem; cursor:pointer; transition:border-color .15s, background .15s; }
.ch-opt:hover { border-color:var(--accent); }
.ch-opt.sel { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 12%,transparent); font-weight:600; }
.ch-next { width:100%; }
.ch-result { text-align:center; padding:24px 0 8px; }
.ch-result-score { font-size:3.5rem; font-weight:900; color:var(--accent); line-height:1; }
.ch-result-score span { font-size:1.6rem; color:var(--muted); }
.ch-result-label { font-size:.9rem; color:var(--muted); margin:4px 0 10px; }
.ch-result-time { font-size:.88rem; }

/* ══════════════════════════════════════════════
   AUTH — صفحة موحدة (تبويبان: دخول / تسجيل)
══════════════════════════════════════════════ */

/* ── الحاوية الكلية ─────────────────────────── */
.auth-wrap {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}
.auth-wrap--narrow {
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px 16px;
}
/* صفحة دخول/تسجيل بدون لوحة ديكور جانبية */
.auth-wrap--simple {
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 32px 16px 48px;
}
.auth-wrap--simple .auth-form-area {
  width: 100%;
  max-width: 460px;
  padding: 0;
  align-items: center;
}
.auth-wrap--simple .auth-card-box {
  width: 100%;
}

/* ── لوحة الديكور (يسار/أعلى) ───────────────── */
.auth-deco-panel {
  position: relative;
  flex: 0 0 400px;
  background: linear-gradient(145deg, #0d4f4a 0%, #0a7c6e 50%, #0d6e62 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
}
.auth-deco-shapes { position: absolute; inset: 0; pointer-events: none; }
.adeco {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.adeco-tl { width: 240px; height: 240px; top: -80px; inset-inline-start: -60px; }
.adeco-tr { width: 160px; height: 160px; top: 40px; inset-inline-end: -40px; background: rgba(255,255,255,.05); border-radius: 30px; transform: rotate(25deg); }
.adeco-br { width: 300px; height: 300px; bottom: -100px; inset-inline-end: -80px; }
.adeco-bl { width: 120px; height: 120px; bottom: 80px; inset-inline-start: 20px; background: rgba(255,255,255,.04); }
.adeco-c3 { width: 200px; height: 200px; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(255,255,255,.03); border-radius: 40px; rotate: 15deg; }

.auth-deco-body {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 28px;
  color: #fff; width: 100%;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand-icon {
  width: 46px; height: 46px;
  background: rgba(255,255,255,.18);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.auth-brand-name { font-size: 1.25rem; font-weight: 800; letter-spacing: .04em; }

.auth-deco-h {
  font-size: 1.75rem; font-weight: 800; line-height: 1.25; margin: 0 0 8px;
}
.auth-deco-p { font-size: .92rem; opacity: .82; line-height: 1.6; margin: 0; }

.auth-feats { display: flex; flex-direction: column; gap: 10px; }
.auth-feat {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .88rem;
  font-weight: 500;
}
.auth-feat-icon { font-size: 1.1rem; }

/* ── منطقة النموذج (يمين/أسفل) ──────────────── */
.auth-form-area {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  background: var(--bg);
}
.auth-card-box {
  width: 100%; max-width: 420px;
}
.auth-card-box--center {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  text-align: center;
}

/* ── التبويبات ──────────────────────────────── */
.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.auth-tab.active {
  background: var(--accent);
  color: #fff;
}
.auth-tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface-1);
}

/* ── لوحات المحتوى ──────────────────────────── */
.auth-pane { animation: fadeIn .2s ease; }
.auth-pane.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── حقول النموذج ───────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-submit { width: 100%; margin-top: 4px; }

.auth-form .field > label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.auth-forgot-link {
  font-size: .78rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.auth-forgot-link:hover { text-decoration: underline; }

.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0; color: var(--muted); font-size: .82rem;
}
.auth-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); margin: 0; }

.auth-google-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-1);
  font-size: .93rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  color: var(--text);
}
.auth-google-btn:hover { background: var(--surface-2); border-color: var(--accent); }

.auth-name-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 12px;
}
.auth-pass-hint {
  font-size: .78rem; color: var(--muted);
  background: var(--surface-2); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 10px; line-height: 1.4;
}

/* OTP */
.auth-otp-icon { font-size: 3rem; margin-bottom: 12px; }
.auth-otp-input {
  font-size: 1.5rem !important; letter-spacing: .3em;
  text-align: center; font-variant-numeric: tabular-nums;
}
.auth-form-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
.auth-form-sub { margin: 0 0 20px; font-size: .88rem; }
.auth-switch-link {
  text-align: center; margin-top: 18px; font-size: .88rem; color: var(--muted);
}
.auth-switch-link a { color: var(--accent); font-weight: 600; }

/* ── Mobile ─────────────────────────────────── */
@media (max-width: 768px) {
  .auth-wrap { flex-direction: column; min-height: 100dvh; }
  .auth-deco-panel {
    flex: none; padding: 24px 20px;
    min-height: auto;
  }
  .auth-deco-body { gap: 14px; }
  .auth-deco-h { font-size: 1.2rem; margin-bottom: 4px; }
  .auth-deco-p { font-size: .85rem; }
  .auth-feats { flex-direction: row; gap: 8px; }
  .auth-feat { flex: 1; padding: 8px 10px; font-size: .78rem; }
  .auth-form-area { padding: 20px 16px 48px; align-items: flex-start; }
  .auth-card-box { max-width: 100%; }
  .auth-name-row { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 400px) {
  .auth-deco-panel { padding: 18px 14px; }
  .auth-feats { display: none; }
  .auth-form-area { padding: 16px 12px 40px; }
}

/* ══════════════════════════════════════════════
   CHAMPION public page
══════════════════════════════════════════════ */
.champ-page { max-width: 740px; margin: 0 auto; padding: 32px 16px 60px; }

/* hero */
.champ-page-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #0d4f4a 0%, #0a7c6e 60%, #12a089 100%);
  color: #fff;
  padding: 48px 40px 40px;
  margin-bottom: 28px;
  text-align: center;
}
.champ-page-hero .adeco { pointer-events:none; }
.champ-page-hero-icon {
  font-size: 3.5rem;
  margin-bottom: 10px;
  position: relative;
  z-index:1;
}
.champ-page-hero h1 {
  font-size: 2rem;
  font-weight: 900;
  margin: 0 0 8px;
  position: relative;
  z-index:1;
}
.champ-page-hero p {
  opacity: .82;
  font-size: .97rem;
  margin: 0 0 24px;
  position: relative;
  z-index:1;
}
.champ-page-hero-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index:1;
}
.btn-champ-hero {
  padding: 12px 28px;
  border-radius: 12px;
  font-size: .97rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
  transition: background .15s;
}
.btn-champ-hero.primary {
  background: #fff;
  color: #0a7c6e;
  border-color: #fff;
}
.btn-champ-hero:hover { background: rgba(255,255,255,.3); }
.btn-champ-hero.primary:hover { background: #e8f8f5; }

/* today's champion block */
.champ-page-winner {
  background: var(--surface-1);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.champ-page-winner-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.champ-page-winner-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.champ-page-av {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  display: flex; align-items:center; justify-content:center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.champ-page-winner-name {
  font-size: 1.2rem;
  font-weight: 800;
}
.champ-page-winner-school {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 2px;
}
.champ-page-winner-score {
  margin-inline-start: auto;
  text-align: center;
}
.champ-page-winner-score strong { font-size: 1.5rem; color: var(--accent); }
.champ-page-winner-score span { font-size: .78rem; color: var(--muted); display:block; }

/* my result (after completing) */
.champ-page-mine {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.champ-page-mine-score { font-size: 1.8rem; font-weight: 900; color: var(--accent); }
.champ-page-mine-label { font-size: .85rem; color: var(--muted); }

/* leaderboard */
.champ-page-board {
  background: var(--surface-1);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
}
.champ-page-board-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.champ-page-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.champ-page-row:last-child { border-bottom: none; }
.champ-page-row.is-me {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 10px;
  padding-inline: 10px;
  margin-inline: -10px;
}
.champ-page-rk { min-width: 28px; font-weight: 800; font-size: .88rem; text-align:center; }
.champ-page-pav {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  display:flex; align-items:center; justify-content:center;
  font-size: .95rem;
  flex-shrink:0;
}
.champ-page-pname { flex: 1; font-weight: 500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.champ-page-pschool { font-size: .78rem; color: var(--muted); }
.champ-page-pscore { font-weight: 800; color: var(--accent); }
.champ-page-ptime { font-size: .78rem; color: var(--muted); margin-inline-start: 4px; }

/* champion.js extra classes */
.champ-page-wrap { min-height: 60vh; }
.champ-page-loading { text-align:center; padding:60px 20px; }
.champ-page-hero-deco { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.cpd { position:absolute; border-radius:50%; background:rgba(255,255,255,.07); }
.cpd-1 { width:200px; height:200px; top:-60px; right:-40px; }
.cpd-2 { width:120px; height:120px; bottom:20px; left:-30px; }
.cpd-3 { width:80px; height:80px; top:40%; right:60px; border-radius:20px; rotate:20deg; }
.cpd-4 { width:50px; height:50px; top:20%; left:80px; }
.champ-page-hero-content { position:relative; z-index:1; }
.champ-page-badge { font-size:.85rem; font-weight:700; opacity:.8; letter-spacing:.05em; margin-bottom:8px; }
.champ-page-title { font-size:2rem; font-weight:900; margin:0 0 8px; }
.champ-page-sub { opacity:.8; font-size:.97rem; margin:0 0 6px; }
.champ-page-date { font-size:.82rem; opacity:.65; margin-bottom:20px; }
.champ-page-winner {
  display:flex; align-items:center; gap:14px;
  background:rgba(255,255,255,.12); border-radius:14px; padding:14px 16px;
  margin-bottom:16px;
}
.champ-page-av-ph { background:rgba(255,255,255,.15); }
.champ-page-crown { font-size:.75rem; font-weight:700; opacity:.75; letter-spacing:.04em; }
.champ-page-wname { font-size:1.1rem; font-weight:800; }
.champ-page-school { }
.champ-page-wscore { font-size:.85rem; opacity:.75; margin-top:2px; }
.champ-page-nochamp { background:rgba(255,255,255,.1); border-radius:12px; padding:12px 16px; font-size:.9rem; opacity:.8; margin-bottom:16px; }
.champ-page-cta { text-align:center; padding:8px 0; }
.champ-page-cta-hint { margin:0 0 14px; opacity:.8; font-size:.9rem; }
.champ-page-cta-btns { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
.champ-page-mine {
  background:rgba(255,255,255,.12); border-radius:12px; padding:12px 16px;
  margin-bottom:16px; font-size:.92rem;
}
.champ-page-lb { margin-top:8px; }
.champ-page-lb-title { font-size:1.1rem; font-weight:800; margin:0 0 16px; }
.champ-page-lb-list { }
.champ-page-empty { padding:24px; text-align:center; }

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS — Bell icon + dropdown
   ═══════════════════════════════════════════════════════════════════════════ */
.notif-wrap { position: relative; display: inline-flex; }

/* أيقونة الجرس */
.notif-bell-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; border-radius: 50%;
  color: var(--text); transition: background .15s;
  font-size: 1.15rem;
}
.notif-bell-btn:hover { background: var(--surface-2); }

/* Badge عدد غير المقروء */
.notif-badge {
  position: absolute; top: 2px; inset-inline-end: 2px;
  min-width: 16px; height: 16px; border-radius: 999px;
  background: #ef4444; color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 16px;
  text-align: center; padding: 0 3px;
  pointer-events: none;
  animation: notif-pop .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes notif-pop { from { transform: scale(0); } to { transform: scale(1); } }

/* Dropdown */
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(360px, 95vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 999;
  overflow: hidden;
  animation: notif-slide .18s ease;
}
@keyframes notif-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-dropdown.open { display: block; }

.notif-dd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.notif-dd-title { font-weight: 700; font-size: .95rem; }
.notif-read-all-btn {
  font-size: .78rem; color: var(--accent); background: none; border: none;
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.notif-read-all-btn:hover { text-decoration: underline; }

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}
.notif-empty {
  padding: 28px 16px; text-align: center; color: var(--muted); font-size: .9rem;
}

/* صف إشعار واحد */
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 16px; cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-item.unread:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.notif-icon {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; background: var(--surface-2);
}
.notif-icon.type-challenge { background: #fff3e0; }
.notif-icon.type-result    { background: #e8f5e9; }
.notif-icon.type-success   { background: #e8f5e9; }
.notif-icon.type-warning   { background: #fff8e1; }
.notif-icon.type-admin     { background: #e3f2fd; }
.notif-icon.type-info      { background: var(--surface-2); }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: .88rem; margin-bottom: 2px; }
.notif-body  { font-size: .82rem; color: var(--muted); line-height: 1.4;
               display: -webkit-box; -webkit-line-clamp: 2;
               -webkit-box-orient: vertical; overflow: hidden; }
.notif-time  { font-size: .73rem; color: var(--muted); margin-top: 4px; }

.notif-unread-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TRANSLATE BUTTON — زر الترجمة في صفحة الاختبار
   ═══════════════════════════════════════════════════════════════════════════ */
.translate-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px 4px;
}
.translate-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  cursor: pointer; transition: background .15s;
}
.translate-btn:hover { background: rgba(255,255,255,.22); }
.translate-btn.active { background: var(--accent); border-color: var(--accent); }
.translate-btn:disabled { opacity: .5; cursor: wait; }

.translate-result {
  margin: 4px 12px 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  font-size: .9rem; color: #e2e8f0; line-height: 1.6;
  direction: auto;
}
.translate-loading {
  text-align: center; padding: 10px; color: var(--muted); font-size: .85rem;
}

/* ═══════════════ LIVE SESSIONS ════════════════════════════════════════════ */
/* زر الانضمام في الهيدر */
.live-join-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 20px; border: none; cursor: pointer;
  font-size: .85rem; font-weight: 600; font-family: inherit;
  transition: transform .15s, box-shadow .15s;
}
.live-join-btn.is-live {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff; box-shadow: 0 2px 10px rgba(34,197,94,.4);
  animation: live-pulse 2s ease-in-out infinite;
}
.live-join-btn.is-waiting {
  background: var(--surface2, #f3f4f6); color: var(--text-soft);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; flex: none;
}
.is-live .live-dot { background: #fff; animation: dot-blink 1s step-end infinite; }
@keyframes live-pulse {
  0%,100% { box-shadow: 0 2px 10px rgba(34,197,94,.4); }
  50%      { box-shadow: 0 2px 20px rgba(34,197,94,.7); }
}
@keyframes dot-blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* صفحة الحصة */
.live-page { max-width: 760px; margin: 0 auto; padding: 24px 16px; }
.live-loading, .live-waiting-room, .live-ended-wrap {
  text-align: center; padding: 60px 20px;
}
.live-pulse { font-size: 3rem; animation: pulse 2s ease-in-out infinite; }
.live-ended-ic { font-size: 3.5rem; margin-bottom: 12px; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

.live-q-wrap { background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: 0 2px 12px rgba(0,0,0,.07); }

/* شريط التقدم */
.live-progress {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.live-q-num { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.live-prog-bar {
  flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
  min-width: 80px;
}
.live-prog-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  transition: width .4s ease;
}
.live-answered-label { font-size: .82rem; color: var(--muted); }

.live-q-img { max-width: 100%; border-radius: 10px; margin-bottom: 16px; }
.live-q-text { font-size: 1.15rem; line-height: 1.6; margin-bottom: 20px; }

/* خيارات الإجابة */
.live-opts { display: flex; flex-direction: column; gap: 10px; }
.live-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px; cursor: pointer; text-align: start;
  border: 2px solid var(--border); background: var(--surface2);
  transition: border-color .15s, background .15s, transform .1s;
  font-family: inherit; font-size: .95rem;
}
.live-opt:not(:disabled):hover { border-color: var(--accent); transform: translateX(-2px); }
.live-opt-letter {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--accent-pale, rgba(234,88,12,.1)); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.live-opt.correct { border-color: #22c55e; background: rgba(34,197,94,.08); }
.live-opt.correct .live-opt-letter { background: #22c55e; color: #fff; }
.live-opt.wrong   { border-color: #ef4444; background: rgba(239,68,68,.08); }
.live-opt.wrong   .live-opt-letter { background: #ef4444; color: #fff; }

/* ردود الفعل */
.live-feedback {
  margin-top: 16px; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; font-size: 1rem;
}
.live-feedback.correct { background: rgba(34,197,94,.12); color: #15803d; }
.live-feedback.wrong   { background: rgba(239,68,68,.12); color: #b91c1c; }
.live-explanation {
  margin-top: 12px; padding: 12px 16px; border-radius: 10px;
  background: var(--surface2); font-size: .9rem; line-height: 1.6;
  border-inline-start: 3px solid var(--accent);
}

/* لوحة المؤسسة */
.admin-live-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.live-active-card {
  background: var(--surface); border-radius: 14px; padding: 20px;
  border: 2px solid #22c55e; margin-bottom: 24px; box-shadow: 0 2px 12px rgba(34,197,94,.12);
}
.live-active-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.live-active-progress { font-size: 1.1rem; font-weight: 600; margin-bottom: 14px; color: var(--accent); }
.live-active-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* شريط تحكم المؤسسة الثابت أسفل الشاشة */
.live-instructor-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--surface);
  border-top: 2px solid var(--border);
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.12);
}
/* padding للمحتوى كي لا يختبئ خلف الشريط */
#live-student-wrap:has(.live-instructor-bar) #live-main { padding-bottom: 80px; }
.live-badge {
  padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700;
}
.live-badge.live, .live-badge.is-live { background: rgba(34,197,94,.15); color: #15803d; }
.live-badge.waiting { background: rgba(234,179,8,.15); color: #92400e; }
.live-badge.ended   { background: var(--border); color: var(--muted); }
.live-sessions-list { display: flex; flex-direction: column; gap: 10px; }
.live-sess-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--surface); border-radius: 12px; border: 1px solid var(--border); flex-wrap: wrap;
}
.live-sess-info { flex: 1; display: flex; align-items: center; gap: 8px; }
.live-sess-meta { font-size: .82rem; color: var(--muted); }

/* ═══════════════ ERROR MAP (خريطة الأسئلة 1-40) ═══════════════════════════════ */
.res-error-map { margin-bottom: 20px; }
.err-dots-wrap {
  display: grid;
  grid-template-columns: repeat(10, 1fr); /* 10 cols on desktop */
  gap: 8px;
  margin: 16px 0 12px;
}
@media (max-width: 768px) {
  .err-dots-wrap {
    grid-template-columns: repeat(8, 1fr); /* 8 cols on tablet / large mobile */
    gap: 6px;
  }
}
@media (max-width: 480px) {
  .err-dots-wrap {
    grid-template-columns: repeat(5, 1fr); /* 5 cols on mobile */
    gap: 6px;
  }
}
.err-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1.35 / 1;
  min-height: 38px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease, box-shadow .15s ease;
  user-select: none;
  background: var(--surface);
  text-decoration: none;
  padding: 0;
}
.err-dot:hover, .err-dot:focus-visible {
  transform: translateY(-2px) scale(1.05);
  filter: brightness(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  outline: 2px solid var(--accent, #6366f1);
  outline-offset: 1px;
}
.err-dot:active {
  transform: scale(0.96);
}
.err-dot.ok {
  background: #16a34a; /* Green for correct */
  border-color: #15803d;
}
.err-dot.ko, .err-dot.hard, .err-dot.med {
  background: #dc2626; /* Red for wrong */
  border-color: #b91c1c;
}
.err-dot.skip {
  background: #4b5563; /* Grey for skipped */
  border-color: #374151;
  color: #d1d5db;
}
.err-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-soft);
  align-items: center;
}
.err-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.err-legend-item i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: none;
  display: inline-block;
}
.err-legend-item i.ok { background: #16a34a; }
.err-legend-item i.ko { background: #dc2626; }
.err-legend-item i.skip { background: #4b5563; }

details.acc.highlight-target {
  outline: 2px solid var(--accent, #6366f1);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
  transition: all .3s ease;
}

/* ══════════════════════════════════════════════════════════════════════════
   Live Sessions — SSE / Leaderboard UI  (Phase 1)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.live-top-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.live-prog-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.live-q-num { font-weight: 600; font-size: .9rem; white-space: nowrap; color: var(--text); min-width: 80px; }

/* Connection dot */
.live-connection-dot { font-size: .65rem; cursor: default; transition: color .3s; color: var(--muted); }
.live-connection-dot.connected   { color: #22c55e; }
.live-connection-dot.error       { color: #ef4444; }

/* ── Leaderboard toggle button ───────────────────────────────────────────── */
.live-lb-toggle {
  background: none; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 4px 10px; font-size: 1.1rem; cursor: pointer; line-height: 1;
  transition: border-color .2s, background .2s;
}
.live-lb-toggle:hover { border-color: var(--accent); background: var(--orange-50); }

/* ── Leaderboard panel (slide-in overlay) ───────────────────────────────── */
.live-lb-panel {
  position: fixed; inset-block: 0; inset-inline-end: 0;
  width: min(320px, 90vw);
  background: var(--surface); border-inline-start: 1.5px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.1);
  display: flex; flex-direction: column; z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.live-lb-panel.hidden { transform: translateX(-110%); }
[dir="rtl"] .live-lb-panel.hidden { transform: translateX(110%); }

.live-lb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 1rem;
}
.live-lb-close {
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: var(--muted); line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.live-lb-close:hover { background: var(--surface-2); color: var(--text); }

.live-lb-list {
  flex: 1; overflow-y: auto; list-style: none; padding: 8px 0; margin: 0;
}
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.lb-row:hover { background: var(--surface-2); }
.lb-row.is-me { background: var(--orange-50); }

.lb-medal { font-size: 1.3rem; min-width: 28px; text-align: center; }
.lb-name  { flex: 1; font-size: .92rem; }
.lb-score { font-weight: 700; color: var(--accent); font-size: .92rem; }
.lb-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: .9rem; }

/* Entry animation for new leaderboard rows */
@keyframes lb-pop {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
.lb-row { animation: lb-pop .22s ease both; }

/* ── Waiting room ────────────────────────────────────────────────────────── */
.live-waiting-room {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 60px 20px; text-align: center; min-height: 320px;
  animation: wr-in .4s ease;
}
@keyframes wr-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.live-waiting-anim {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.live-waiting-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent, #6366f1); opacity: .3;
  animation: wd-pulse 1.4s ease-in-out infinite;
}
.live-waiting-dot:nth-child(2) { animation-delay: .2s; }
.live-waiting-dot:nth-child(3) { animation-delay: .4s; }
@keyframes wd-pulse {
  0%, 100% { opacity: .25; transform: scale(.85); }
  50%       { opacity: 1;   transform: scale(1.15); }
}
.live-waiting-icon { font-size: 3rem; animation: live-pulse 2.5s ease-in-out infinite; }
.live-waiting-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.live-waiting-desc  { color: var(--muted); margin: 0; max-width: 340px; line-height: 1.6; }
.live-waiting-hint  {
  color: var(--accent, #6366f1); font-size: .82rem; font-weight: 600;
  letter-spacing: .03em; margin: 0;
  animation: wd-pulse 2s ease-in-out infinite;
}

/* ── Launching transition ────────────────────────────────────────────────── */
.live-launching {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 60px 20px; text-align: center; min-height: 320px;
  animation: launch-in .3s ease;
}
@keyframes launch-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.live-launching-icon { font-size: 3.5rem; animation: launch-bounce .6s ease-in-out infinite alternate; }
@keyframes launch-bounce { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.live-launching h2 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--accent, #6366f1); }

/* ── Ended screen ────────────────────────────────────────────────────────── */
.live-ended-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 60px 20px; text-align: center;
}
.live-ended-ic { font-size: 3.5rem; }
.live-ended-wrap h2 { font-size: 1.4rem; margin: 0; }
.live-ended-wrap p  { color: var(--muted); margin: 0; }

/* ── نتائج مفصّلة بعد انتهاء الحصة ──────────────────────────────────────── */
.live-results-full {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.live-results-score {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 2px solid var(--border);
}
.live-results-num  { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.live-results-label{ font-size: .9rem; color: var(--muted); }
.live-results-q {
  border-radius: 12px;
  border: 1.5px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.live-results-q.correct { border-color: #22c55e; background: rgba(34,197,94,.04); }
.live-results-q.wrong   { border-color: #ef4444; background: rgba(239,68,68,.04); }
.live-results-q-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.live-results-q-num   { font-weight: 700; color: var(--muted); flex-shrink: 0; }
.live-results-q-ic    { flex-shrink: 0; }
.live-results-q-text  { font-size: .9rem; line-height: 1.5; }
.live-results-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: .88rem;
}
.live-results-opt.correct { border-color: #22c55e; background: rgba(34,197,94,.08); }
.live-results-opt.correct .live-opt-letter { background: #22c55e; color: #fff; }
.live-results-opt.wrong   { border-color: #ef4444; background: rgba(239,68,68,.08); }
.live-results-opt.wrong   .live-opt-letter { background: #ef4444; color: #fff; }
.live-results-explain {
  font-size: .84rem;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
}

/* ── Selected pending (waiting for ack) ─────────────────────────────────── */
.live-opt.selected-pending {
  border-color: #a78bfa;
  background: rgba(167,139,250,.1);
  animation: opt-pending .8s ease infinite alternate;
}
@keyframes opt-pending {
  from { opacity: .7; } to { opacity: 1; }
}
.live-opt-tick { margin-inline-start: auto; color: #22c55e; font-weight: 700; }

/* ── Selected confirmed (answer recorded, awaiting reveal) ───────────────── */
.live-opt.selected-confirmed {
  border-color: #60a5fa;
  background: rgba(96,165,250,.1);
}
.live-opt.selected-confirmed .live-opt-letter {
  background: #60a5fa;
  color: #fff;
}

/* ── Recorded feedback (neutral, during session) ─────────────────────────── */
.live-feedback.recorded {
  background: rgba(96,165,250,.1);
  color: #1d4ed8;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  margin-top: 12px;
}

/* ── Instructor preview (admin view, inside active card) ─────────────────── */
.instructor-q-preview {
  background: var(--surface-2); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px;
}
.live-opts.readonly .live-opt { cursor: default; }
.live-opts.readonly .live-opt:hover { transform: none; border-color: var(--border); }
.live-opts.readonly .live-opt.correct { border-color: #22c55e; background: rgba(34,197,94,.08); }

/* ── Admin live panel (leaderboard card) ─────────────────────────────────── */
.live-admin-lb {
  margin-top: 20px;
  .live-lb-list { max-height: 320px; overflow-y: auto; }
}


/* بانر الحصة الجماعية */
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 4px 20px rgba(194,65,12,.35); }
  50% { box-shadow: 0 4px 32px rgba(194,65,12,.6), 0 0 0 3px rgba(255,255,255,.2); }
}

/* ══════════════════════════════════════════════════════════════════════════════
   رسائل التحفيز حسب نقطة الامتحان (Score Feedback Banner)
   ══════════════════════════════════════════════════════════════════════════════ */
.score-feedback {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  margin-bottom: 4px;
  animation: sf-in .5s cubic-bezier(.22,1,.36,1) both;
}
@keyframes sf-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.score-feedback.sf-low  { background: rgba(239,68,68,.07);  border-color: rgba(239,68,68,.2);  }
.score-feedback.sf-mid  { background: rgba(234,179,8,.07);  border-color: rgba(234,179,8,.25); }
.score-feedback.sf-high { background: rgba(34,197,94,.07);  border-color: rgba(34,197,94,.2);  }
.sf-emoji { font-size: 2.2rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.sf-text  { display: flex; flex-direction: column; gap: 4px; }
.sf-title { font-size: 1.05rem; font-weight: 700;
  color: var(--fg); }
.sf-body  { font-size: .9rem; color: var(--muted); margin: 0; line-height: 1.6; }
.score-feedback.sf-low  .sf-title { color: #b91c1c; }
.score-feedback.sf-mid  .sf-title { color: #92400e; }
.score-feedback.sf-high .sf-title { color: #15803d; }

/* ══════════════════════════════════════════════════════════════════════════════
   إشعارات الترحيب المنبثقة (Login Welcome Popups) — بطاقة "مرحباً مجدداً!"
   ══════════════════════════════════════════════════════════════════════════════ */
.welcome-popup {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 24px;
  z-index: 10000;
  max-width: 360px;
  width: calc(100vw - 48px);
  background: var(--surface);
  border-radius: 16px;
  border: 1.5px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 16px;
  animation: wp-in .45s cubic-bezier(.22,1,.36,1) both;
  transition: opacity .35s, transform .35s;
}
@keyframes wp-in {
  from { opacity: 0; transform: translateY(28px) scale(.95); }
  to   { opacity: 1; transform: translateY(0)     scale(1);  }
}
.welcome-popup--hidden { display: none; }
body.quiz-active .welcome-popup,
body.live-fullscreen .welcome-popup { display: none; }
.welcome-popup--out    { opacity: 0; transform: translateY(16px) scale(.96); pointer-events: none; }

/* ألوان حسب النوع */
.welcome-popup.tone-welcome  { border-color: rgba(96,165,250,.4); }
.welcome-popup.tone-progress { border-color: rgba(167,139,250,.4); }
.welcome-popup.tone-live     { border-color: rgba(249,115,22,.5);
  box-shadow: 0 8px 32px rgba(249,115,22,.2); animation: wp-live-pulse 1.8s ease infinite; }
@keyframes wp-live-pulse {
  0%,100% { box-shadow: 0 8px 32px rgba(249,115,22,.2); }
  50%      { box-shadow: 0 8px 48px rgba(249,115,22,.45); }
}

.wp-close {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .2s;
}
.wp-close:hover { background: var(--surface-2); }

.wp-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.wp-emoji {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.wp-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.wp-title { font-size: 1rem; font-weight: 700; color: var(--fg); }
.wp-body  { font-size: .85rem; color: var(--muted); margin: 0; line-height: 1.55; }
.wp-cta   { margin-top: 10px; font-size: .85rem; padding: 7px 14px; }

/* استجابة بطاقة الترحيب على الموبايل (<= 768px): فوق .bottom-nav مباشرة بدون قص */
@media (max-width: 768px) {
  .welcome-popup {
    inset-inline: 12px;
    inset-inline-start: 12px;
    inset-inline-end: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    z-index: 10000;
    padding: 12px 14px;
    transform: none;
  }
  .welcome-popup--out {
    transform: translateY(12px) scale(.96);
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Admin Live Results Page  —  /admin/live/:id/results
   ══════════════════════════════════════════════════════════════════════════ */
.admin-live-results { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }

.alr-header {
  display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.alr-title h1 { margin: 0; font-size: 1.3rem; }
.alr-title .muted { display: block; margin-top: 2px; }

/* إحصاءات سريعة */
.alr-stats {
  display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap;
}
.alr-stat-card {
  flex: 1; min-width: 110px; background: var(--card-bg, #fff);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; text-align: center;
}
.alr-stat-num  { display: block; font-size: 2rem; font-weight: 800; color: var(--accent, #6366f1); }
.alr-stat-label { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* أقسام */
.alr-section { margin-bottom: 32px; }
.alr-section-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 14px; }

/* لوحة الترتيب */
.alr-lb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alr-lb-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg, #fff); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px;
}
.alr-lb-item.top { border-color: var(--accent, #6366f1); background: color-mix(in srgb, var(--accent,#6366f1) 6%, transparent); }
.alr-lb-rank  { font-size: 1.1rem; min-width: 28px; text-align: center; }
.alr-lb-name  { flex: 1; font-size: .9rem; }
.alr-lb-score { font-weight: 700; font-size: .95rem; color: var(--accent, #6366f1); }

/* تحليل الأسئلة */
.alr-q-list { display: flex; flex-direction: column; gap: 10px; }
.alr-q-item {
  background: var(--card-bg, #fff); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
}
.alr-q-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.alr-q-num  { font-weight: 600; font-size: .9rem; }
.alr-q-rate { font-size: .82rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.alr-q-rate.high-err { background: #fee2e2; color: #b91c1c; }
.alr-q-rate.mid-err  { background: #fef3c7; color: #92400e; }
.alr-q-rate.low-err  { background: #d1fae5; color: #065f46; }
.alr-q-count { margin-right: auto; color: var(--muted); font-size: .82rem; }
.alr-wrong-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.alr-wrong-tag {
  background: #fee2e2; color: #991b1b; border-radius: 20px;
  padding: 2px 10px; font-size: .78rem;
}
.alr-wrong-more { color: var(--muted); font-size: .78rem; align-self: center; }

/* ══════════════════════════════════════════════════════════════════════════
   Live Session — NARSA-style student view overrides
   ══════════════════════════════════════════════════════════════════════════ */

/* Wrapper: use full NARSA window layout */
/* nrs-window للحصة: ارتفاع ثابت = 100dvh — شاشة واحدة لا تتمدد */
#live-student-wrap.nrs-window {
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  --exam-font-size: clamp(1.1rem, 2vw, 1.6rem);
}

/* Connection indicator inside topbar */
.live-conn-wrap { display: flex; align-items: center; justify-content: center; width: 40px; }
.live-conn-wrap .live-connection-dot { font-size: .65rem; }

/* Main content area for NARSA layout — ارتفاع ثابت لا يتغير */
.live-nrs-main {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.live-nrs-main .nrs-content-row {
  flex: 1 1 0%;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* nrs-side: ثابتة — لا تتمدد ولا تُزاح */
#live-student-wrap .nrs-side {
  flex-shrink: 0;
  overflow: hidden;
}

/* nrs-main: لا تتجاوز حدودها — خلفية بيضاء (منطقة الصورة) مثل التصميم المرجعي */
#live-student-wrap .nrs-main {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: rgb(255,255,255);
}

/* الصورة: 55% من nrs-main — مطابق للتصميم المرجعي */
#live-student-wrap .nrs-media {
  flex: 0 0 auto;
  height: calc(55% - 1.25rem);
  min-height: 0;
  max-height: none;
  background: rgb(255,255,255);
}

/* لوحة النص: 45% من nrs-main — خلفية رمادية داكنة (apprtl-875zbh) */
#live-student-wrap .nrs-text-panel {
  flex: 0 0 auto;
  height: calc(45% - 1.25rem);
  min-height: 0;
  overflow-y: auto;
  background: rgb(34,34,34);
}

/* Waiting / launching screens inside NARSA shell */
.live-nrs-main .live-waiting-room,
.live-nrs-main .live-launching,
.live-nrs-main .live-ended-wrap {
  flex: 1;
  min-height: 60dvh;
}

/* NARSA choice button — confirmed (neutral, no correct/wrong reveal) */
.nrs-choice-btn.selected-confirmed {
  background: var(--accent, #6366f1) !important;
  border-color: var(--accent, #6366f1) !important;
}
.nrs-choice-btn.selected-confirmed .nrs-choice-num {
  color: #fff !important;
}

/* Recorded feedback inside nrs-text-panel */
#nrs-text-panel .live-feedback.recorded {
  margin-top: 10px;
  font-size: .85rem;
}

/* نص السؤال داخل اللوحة الداكنة */
.nrs-q-text {
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.6;
  padding: 10px 12px 0;
}

/* Results screen inside NARSA shell */
.live-nrs-main .live-results-full {
  margin: 0;
  padding: 16px;
  overflow-y: auto;
}

/* ── واجهة المؤسسة في الحصة الجماعية (NARSA shell) ─────────────────────── */

/* padding إضافي لتعويض شريط التحكم الثابت أسفل الشاشة */
.inst-live-wrap #live-main { padding-bottom: 80px; }

/* زر لوحة الترتيب في الشريط العلوي */
.live-lb-toggle-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.live-lb-toggle-btn:hover { background: rgba(255,255,255,.12); }

/* معلومات وأزرار شريط المؤسسة */
.inst-bar-info {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; overflow: hidden;
}
.inst-bar-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .9rem;
}
.inst-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* أزرار NARSA للمؤسسة: غير قابلة للنقر (عرض فقط) */
.nrs-choice-btn.inst-choice {
  opacity: .7;
  cursor: default !important;
  pointer-events: none;
}

/* الشريط العلوي للمؤسسة: pills قابلة للالتفاف */
.inst-live-wrap .nrs-tb-pills { flex-wrap: wrap; justify-content: flex-start; }

/* ══════════════════════════════════════════════════════════════════════════
   Live Session — Fullscreen / Immersive Mode
   يُفعَّل عبر body.live-fullscreen على routes الحصة الجماعية
   ══════════════════════════════════════════════════════════════════════════ */

/* إخفاء Header + Footer + Sidebar تاماً */
body.live-fullscreen .site-header,
body.live-fullscreen .site-footer,
body.live-fullscreen #staff-side { display: none !important; }

/* إلغاء كل padding/margin ناتج عن الـ sidebar والـ header */
body.live-fullscreen {
  --hdr-h: 0px;
  --side-w: 0px;
}
body.live-fullscreen #app {
  margin: 0 !important;
  padding: 0 !important;
  inset-inline-start: 0 !important;
  width: 100% !important;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* nrs-window يملأ الشاشة كاملاً — ارتفاع ثابت */
body.live-fullscreen .nrs-window {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  max-width: 100% !important;
  border-radius: 0 !important;
  border: none !important;
}

/* شريط المؤسسة: ثابت في الأسفل — live-nrs-main يأخذ المساحة المتبقية */
body.live-fullscreen .inst-live-wrap .live-nrs-main {
  /* الارتفاع = 100dvh - topbar(≈52px) - instructor-bar(≈64px) */
  height: calc(100dvh - 52px - 64px);
  max-height: calc(100dvh - 52px - 64px);
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════════
   تصميم الموبايل / التابلت للحصة الجماعية
   صورة + سؤال في الأعلى — أزرار (1-4) + موافق في الأسفل
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* nrs-content-row: عمودي — nrs-main (صورة+سؤال) أعلى، aside (أزرار) أسفل */
  #live-student-wrap .live-nrs-main,
  #live-student-wrap .live-nrs-main .nrs-content-row,
  #live-student-wrap #live-q-wrap {
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
  }

  /* aside (الأزرار) — يظهر في الأسفل عبر order */
  #live-student-wrap .nrs-side {
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 8px !important;
    order: 2;                  /* ← الأسفل دائماً */
    flex-shrink: 0;
    border-top: 2px solid rgb(95,87,229) !important;
    background: #1a1a2e !important;
  }

  /* nrs-ctrl-col: كل شيء في صف واحد */
  #live-student-wrap .nrs-ctrl-col {
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    flex: 1;
  }

  /* المؤشرات: 4 نقاط صغيرة عمودية */
  #live-student-wrap .nrs-indicators {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    flex-shrink: 0;
  }

  #live-student-wrap .nrs-ind {
    width: 20px !important;
    height: 20px !important;
    font-size: 0.65rem !important;
  }

  /* لوحة الأزرار: grid 2×2 + موافق جانبه */
  #live-student-wrap .nrs-panel {
    flex: 1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
  }

  /* nrs-choices: grid 2×2 */
  #live-student-wrap .nrs-choices {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    flex: 1;
  }

  /* أزرار الاختيار: مربعة وكبيرة */
  #live-student-wrap .nrs-choice-btn {
    width: 100% !important;
    min-height: 54px !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    aspect-ratio: unset !important;
  }

  /* موافق: عمودي بجانب الـ grid */
  #live-student-wrap .nrs-btn-ok {
    flex-direction: column !important;
    width: 58px !important;
    min-height: 116px !important;
    padding: 6px 4px !important;
    font-size: 0.72rem !important;
    gap: 4px !important;
    flex-shrink: 0;
  }

  #live-student-wrap .nrs-btn-ok .ok-ic svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* nrs-info-box: مخفية على الموبايل */
  #live-student-wrap .nrs-info-box {
    display: none !important;
  }

  /* nrs-main: يأخذ المساحة المتبقية في الأعلى */
  #live-student-wrap .nrs-main {
    order: 1;                  /* ← الأعلى دائماً */
    flex: 1 1 0% !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: rgb(255,255,255) !important;
  }

  /* الصورة: 32% من nrs-main لإفساح مجال للنص */
  #live-student-wrap .nrs-media {
    width: 100% !important;
    flex: 0 0 32% !important;
    min-height: 100px !important;
    max-height: 35% !important;
    background: rgb(255,255,255) !important;
  }

  #live-student-wrap .nrs-media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 0 !important;
  }

  #live-student-wrap .nrs-no-media {
    flex: 0 0 32% !important;
    min-height: 80px !important;
    max-height: 35% !important;
    font-size: 2rem !important;
    background: rgb(255,255,255) !important;
  }

  /* لوحة النص: بدون تمرير — كل شيء في صفحة واحدة */
  #live-student-wrap .nrs-text-panel {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 8px 12px 6px !important;
    background: rgb(34,34,34) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-evenly !important;
  }

  /* نص السؤال: مضغوط ليتسع في الشاشة */
  #live-student-wrap .nrs-q-main {
    font-size: clamp(0.78rem, 3.2vw, 1rem) !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
    flex-shrink: 0 !important;
  }

  /* خيارات النص: مضغوطة */
  #live-student-wrap .nrs-opt {
    padding: 3px 8px !important;
    font-size: clamp(0.75rem, 3vw, 0.95rem) !important;
    gap: 6px !important;
  }

  #live-student-wrap .nrs-opts-list {
    gap: 0 !important;
    flex: 1 1 0% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-evenly !important;
  }

  /* شريط التقدم أسفل الصفحة */
  #live-student-wrap .nrs-footer {
    display: flex !important;
    padding: 6px 12px !important;
    min-height: 36px !important;
    flex-shrink: 0;
  }
}

/* الهاتف الصغير جداً (< 420px) */
@media (max-width: 420px) {
  #live-student-wrap .nrs-choice-btn {
    min-height: 46px !important;
    font-size: 1.4rem !important;
  }

  #live-student-wrap .nrs-btn-ok {
    width: 50px !important;
    min-height: 100px !important;
  }

  #live-student-wrap .nrs-media {
    min-height: 130px !important;
    max-height: 38vw !important;
  }
}

/* التابلت (769px – 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  #live-student-wrap .nrs-choice-btn {
    min-height: 60px !important;
    font-size: 1.5rem !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   أزرار Stop / تصحيح — الحصص الجماعية (طالب + مؤسسة)
   ════════════════════════════════════════════════════════════════════════ */
.live-student-ctrl-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}

.live-ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border: none;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  min-height: 44px;
  transition: background 0.15s, transform 0.1s;
  line-height: 1.2;
}
.live-ctrl-btn:active { transform: scale(0.95); }

.live-ctrl-ic { font-size: 1rem; }
.live-ctrl-lbl { font-size: 0.6rem; letter-spacing: 0.03em; }

/* Stop — أحمر */
.live-ctrl-stop {
  background: #d32f2f;
  color: #fff;
}
.live-ctrl-stop:hover { background: #b71c1c; }

/* تصحيح — برتقالي */
.live-ctrl-reset {
  background: #e65100;
  color: #fff;
}
.live-ctrl-reset:hover { background: #bf360c; }

/* زر موافق المؤسسة — مشابه للطالب لكن دائماً مفعّل */
.inst-ok-btn {
  opacity: 1 !important;
  cursor: pointer !important;
}

/* نتيجة الطالب بعد انتهاء الحصة */
.live-score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
}
.live-score-ic { font-size: 2rem; }
.live-wrong-count {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 6px;
  color: #ef4444;
}
.live-wrong-count.correct-all { color: #22c55e; }

/* ─── Language Picker ──────────────────────────────────────────────────────── */
.lang-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.lang-picker-btn:hover { background: var(--surface-2, rgba(0,0,0,.06)); }
.lang-picker-btn[aria-expanded="true"] { border-color: var(--primary, #4f46e5); }

.lang-current-flag { font-size: 1.1rem; line-height: 1; }
.lang-current-code { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }

.lang-caret {
  width: 12px;
  height: 12px;
  opacity: 0.6;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.lang-picker-btn[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }

/* Dropdown */
.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 190px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 999;
  overflow: hidden;
  animation: fadeDown 0.15s ease;
}
.lang-dropdown.open { display: block; }

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lang-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  color: inherit;
  text-align: start;
  transition: background 0.1s;
}
.lang-opt:hover { background: var(--surface-2, rgba(0,0,0,.05)); }
.lang-opt.active { font-weight: 700; color: var(--primary, #4f46e5); }

.lang-opt-flag { font-size: 1.15rem; flex-shrink: 0; }
.lang-opt-name { flex: 1; }
.lang-opt-check { opacity: 0; font-size: 0.85rem; }
.lang-opt.active .lang-opt-check { opacity: 1; }

/* Translation progress toast */
.tr-progress-toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
  padding: 12px 20px;
  min-width: 220px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}
.tr-prog-label { text-align: center; color: var(--text, #1e293b); }
.tr-prog-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2, #e2e8f0);
  border-radius: 99px;
  overflow: hidden;
}
.tr-prog-fill {
  height: 100%;
  background: var(--primary, #4f46e5);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* ══════════════════════════════════════════════════════════════
   الوضع البسيط — Simple Mode
   ══════════════════════════════════════════════════════════════ */

/* زر التبديل */
.dash-mode-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  font-size: .82rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-soft);
  border: 1.5px solid var(--border); cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.dash-mode-toggle:hover { background: var(--primary-soft, #ede9fe); color: var(--primary); border-color: var(--primary); }
.dash-simple .dash-mode-toggle { background: var(--primary); color: #fff; border-color: var(--primary); }
.mode-toggle-icon { font-size: 1rem; }

/* إخفاء الأقسام التفصيلية في الوضع البسيط على شاشات الكمبيوتر فقط */
@media (min-width: 769px) {
  .dash-simple [data-full-only] { display: none !important; }
  .dash-simple [data-simple-only] { display: block; }
}
/* إظهار أقسام الوضع البسيط فقط عند تفعيله */
[data-simple-only] { display: none; }

/* شبكة بطاقات الوضع البسيط */
.simple-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px) { .simple-grid { grid-template-columns: repeat(3, 1fr); } }

/* بطاقة الوضع البسيط */
.simple-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 8px; padding: 20px 18px; border-radius: 18px;
  background: var(--surface); border: 1.5px solid var(--border);
  text-decoration: none; color: var(--text); cursor: pointer;
  transition: transform .2s var(--spring, cubic-bezier(.34,1.56,.64,1)),
              box-shadow .2s ease, border-color .2s;
  box-shadow: var(--shadow-sm, 0 1px 4px rgb(0 0 0/.06));
  min-height: 120px;
}
.simple-card:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgb(0 0 0/.1);
  border-color: var(--primary);
}
.simple-card:disabled { opacity: .5; cursor: not-allowed; }
.simple-emoji { font-size: 2rem; line-height: 1; }
.simple-card strong { font-size: 1rem; font-weight: 800; line-height: 1.3; }
.simple-card small { font-size: .8rem; color: var(--text-soft); font-weight: 500; }

/* ألوان مميزة لكل بطاقة */
.simple-exam   { border-top: 3px solid #ea580c; }
.simple-practice { border-top: 3px solid #0a84ff; }
.simple-lessons  { border-top: 3px solid #34d399; }
.simple-ai      { border-top: 3px solid #bf5af2; }
.simple-review  { border-top: 3px solid #f59e0b; text-align: start; width: 100%; }

/* Apple-style تحسينات */
body.ui-apple .simple-card { border-radius: 20px; }
body.ui-apple .dash-mode-toggle { border-radius: 22px; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE ADDITIONS — Cross-device UI Consistency Pass
   Added: 100dvh fixes, safe-area, touch targets, TV/4K breakpoints,
          focus-visible, clamp typography, horizontal overflow guard
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Focus-visible: keyboard / TV remote navigation ─────────────────────── */
:focus-visible {
  outline: 3px solid var(--primary, #ea580c) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgb(234 88 12 / .25) !important;
  border-radius: 6px;
}
/* Larger focus ring for coarse pointer (TV remotes, touch) */
@media (pointer: coarse) {
  :focus-visible {
    outline-width: 4px !important;
    box-shadow: 0 0 0 7px rgb(234 88 12 / .25) !important;
  }
}

/* العناصر اللي كيتعطاها التركيز برمجياً (main#app بعد كل تنقل) ماشي بالكلافيي: بلا إطار */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* ── Minimum touch targets on coarse-pointer devices ────────────────────── */
@media (pointer: coarse) {
  .btn, .btn-sm, .btn-lg,
  .icon-btn, .notif-bell-btn,
  .auth-tab, .auth-google-btn,
  .live-opt, .live-ctrl-btn,
  .lang-opt, .lang-picker-btn,
  .act-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ── TV / Large-screen (≥ 1440px) content width cap ─────────────────────── */
@media (min-width: 1440px) {
  .pg, .dash, .live-page, .champ-page, .admin-live-results {
    max-width: 1400px;
    margin-inline: auto;
  }
  .header-inner {
    max-width: 1440px;
  }
}

/* ── TV / 4K (≥ 1600px) typography & layout scale ───────────────────────── */
@media (min-width: 1600px) {
  :root {
    --text-base: clamp(1rem, 1.1vw, 1.25rem);
  }
  h1 { font-size: clamp(1.75rem, 2.8vw, 3rem); }
  h2 { font-size: clamp(1.3rem, 1.8vw, 2rem); }
  h3 { font-size: clamp(1.1rem, 1.3vw, 1.5rem); }

  .pg, .dash, .live-page, .champ-page, .admin-live-results {
    max-width: 1600px;
    padding-inline: 48px;
  }
  .header-inner { max-width: 1600px; }

  /* Larger touch/remote targets */
  .btn      { min-height: 52px; padding: 14px 28px; }
  .btn-sm   { min-height: 44px; }
  .icon-btn { height: 52px; min-width: 52px; }

  /* Quiz/exam option readability */
  .option { min-height: 72px; font-size: 1.15rem; }
  .nrs-overlay { --exam-font-size: clamp(1.4rem, 1.8vw, 2rem); }
}

/* ── 4K / Ultra-wide (≥ 2560px) ─────────────────────────────────────────── */
@media (min-width: 2560px) {
  .pg, .dash, .live-page, .champ-page, .admin-live-results {
    max-width: 2000px;
  }
  .header-inner { max-width: 2000px; }
}

/* ── iOS safe-area: fixed bottom bars ───────────────────────────────────── */
/* welcome-popup safe-area on mobile: kept consistently above .bottom-nav */
@media (max-width: 480px) {
  .welcome-popup {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
}

/* tr-progress-toast safe-area */
.tr-progress-toast {
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
}

/* notif-bell size bump to 44px */
.notif-bell-btn {
  width: 44px;
  height: 44px;
}

/* ── Prevent horizontal scroll on small mobile ───────────────────────────── */
html {
  overflow-x: hidden;
}

/* ── Responsive image aspect-ratio guard (exam images) ───────────────────── */
.nrs-media img,
.live-q-img,
.q-image img {
  aspect-ratio: auto;
  object-fit: contain;
  max-width: 100%;
  height: auto;
}

/* ── Admin / instructor rtable horizontal scroll guard ───────────────────── */
@media (max-width: 767px) {
  .rtable-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rtable-scroll table {
    min-width: 600px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   VISUAL & UX ENHANCEMENTS PASS (CONTRAST, SKELETONS, TABS, SIGNS, QUIZ)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Card Polish & Theme Consistency Across All Roles ────────────────── */
.card, .dash-kpi, .school-stat, .exam-journey-card, .stu-hero, .dash-ready, .qa, .stat-tile, .sign-card, .simple-card--large {
  border: 1px solid var(--border) !important;
  background-color: var(--surface) !important;
  color: var(--text);
  border-radius: var(--radius, 18px) !important;
  padding: 24px;
  box-sizing: border-box;
  transition: border-color var(--dur, .2s) var(--ease, ease), box-shadow var(--dur, .2s) var(--ease, ease), transform var(--dur, .2s) var(--ease, ease);
}
.card:hover, .dash-kpi:hover, .school-stat:hover, .exam-journey-card:hover, .stu-hero:hover, .dash-ready:hover, .qa:hover, .stat-tile:hover, .sign-card:hover {
  border-color: rgba(255, 122, 0, 0.4) !important;
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.12) !important;
}

@media (max-width: 768px) {
  .card:not(.table-wrap):not(.dash-kpi):not(.stat-tile),
  .exam-journey-card,
  .stu-hero {
    padding: 16px !important;
  }
}

/* Headings & typography standardization across all roles */
.page-head h1, .page-header h2, .dash-h, .shell-head h1, .shell-head h2, h1, h2, h3 {
  font-family: var(--font-heading) !important;
  color: var(--text) !important;
}

/* Responsive table wrappers across all roles */
.table-wrap,
.admin-table-wrap,
.card:has(> table),
.card:has(> .table),
.card:has(> .table-wrap) {
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.dash-ready-text p.muted,
.dash-ready-text .small {
  color: var(--muted) !important;
  font-size: 0.94rem !important;
  line-height: 1.55 !important;
}
.dash-ready-meta {
  color: var(--text-soft) !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
}
.ticket-kicker {
  opacity: 0.95 !important;
  font-weight: 800 !important;
  letter-spacing: .03em !important;
}
.ticket-name {
  font-size: 1.45rem !important;
  font-weight: 900 !important;
  letter-spacing: -.01em !important;
}
.ticket-fields small {
  color: #fff !important;
  opacity: 0.88 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
}
.ticket-fields span {
  font-weight: 800 !important;
  font-size: 1.05rem !important;
  color: #FFFFFF !important;
}
.ticket-hint {
  color: #E5E7EB !important;
  opacity: 1 !important;
}
.ticket-stub strong {
  font-size: 3rem !important;
  font-weight: 900 !important;
  letter-spacing: -.03em !important;
}
.ticket-stub small {
  font-size: 0.85rem !important;
  font-weight: 800 !important;
  opacity: 0.95 !important;
}
.qa strong {
  color: var(--text) !important;
  font-size: 1.08rem !important;
}
.qa small {
  color: var(--muted) !important;
  font-size: 0.86rem !important;
}
.stat-tile {
  padding: 22px 20px !important;
}
.stat-tile strong {
  font-size: 1.9rem !important;
  font-weight: 900 !important;
  color: var(--text) !important;
}
.stat-tile small {
  color: var(--muted) !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
}
.cat-head strong {
  color: var(--text) !important;
  font-size: 1.02rem !important;
}
.cat-head .muted {
  color: var(--muted) !important;
  font-weight: 700 !important;
}

/* في الوضع الداكن: تحسين التباين وحدود شفافة خفيفة عبر كافة البطاقات والأدوار */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card,
  :root:not([data-theme="light"]) .dash-kpi,
  :root:not([data-theme="light"]) .school-stat,
  :root:not([data-theme="light"]) .exam-journey-card,
  :root:not([data-theme="light"]) .stu-hero,
  :root:not([data-theme="light"]) .dash-ready,
  :root:not([data-theme="light"]) .qa,
  :root:not([data-theme="light"]) .stat-tile,
  :root:not([data-theme="light"]) .sign-card,
  :root:not([data-theme="light"]) .simple-card--large,
  :root:not([data-theme="light"]) table.rtable tr {
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background-color: var(--surface) !important;
  }
}
[data-theme="dark"] .card,
[data-theme="dark"] .dash-kpi,
[data-theme="dark"] .school-stat,
[data-theme="dark"] .exam-journey-card,
[data-theme="dark"] .stu-hero,
[data-theme="dark"] .dash-ready,
[data-theme="dark"] .qa,
[data-theme="dark"] .stat-tile,
[data-theme="dark"] .sign-card,
[data-theme="dark"] .simple-card--large,
[data-theme="dark"] table.rtable tr {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background-color: var(--surface) !important;
}

/* ── 2. Skeleton Loaders (شاشات التحميل الناعمة) ────────────────────────── */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s infinite ease-in-out;
  border-radius: var(--radius-sm, 10px);
}
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 20px);
  padding: 24px;
  box-sizing: border-box;
}
.skel-line {
  height: 16px;
  margin-bottom: 10px;
  border-radius: 6px;
}
.skel-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex: none;
}
.skel-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── 3. Mobile Bottom Tab Bar ────────────────────────────────────────────── */
.mobile-tabbar,
.bottom-nav {
  display: none;
}
@media (max-width: 768px) {
  /* منع أي خاصية transform أو perspective أو filter من كسر position: fixed على المتصفحات المحمولة */
  html, body, .app-shell, #app {
    transform: none !important;
    perspective: none !important;
    filter: none !important;
  }

  body.has-bottom-bar .bottom-nav,
  body.has-bottom-bar .mobile-tabbar,
  .bottom-nav.is-visible,
  .mobile-tabbar.is-visible {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    inset-inline: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 2px 0 env(safe-area-inset-bottom, 0px);
    padding-inline: 6px !important;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    align-items: center;
    justify-content: space-around;
    box-sizing: border-box;
    will-change: transform;
  }
  body.has-bottom-bar main,
  body.has-bottom-bar #app,
  body.has-bottom-bar .main-content {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.has-bottom-bar .site-footer {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.quiz-active .bottom-nav,
  body.quiz-active .mobile-tabbar,
  body.live-fullscreen .bottom-nav,
  body.live-fullscreen .mobile-tabbar {
    display: none !important;
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bottom-nav,
  :root:not([data-theme="light"]) .mobile-tabbar {
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
}
[data-theme="dark"] .bottom-nav,
[data-theme="dark"] .mobile-tabbar {
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  height: 48px;
  padding: 3px 1px;
  color: var(--muted, #9CA3AF);
  text-decoration: none;
  border-radius: 8px;
  transition: color .2s ease, transform .15s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.tabbar-item:active {
  transform: scale(0.92);
}
.tabbar-item svg,
.tabbar-item .ic {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  stroke-width: 2;
  transition: transform .2s ease, stroke .2s ease;
}
.tabbar-item span {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  text-align: center;
  letter-spacing: -0.01em;
}
.tabbar-item.active {
  color: var(--primary, #FF7A00) !important;
}
.tabbar-item.active svg,
.tabbar-item.active .ic {
  stroke: var(--primary, #FF7A00) !important;
  transform: translateY(-1px);
}
.tabbar-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 16px;
  height: 2.5px;
  background: var(--primary, #FF7A00);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(255, 122, 0, 0.6);
}

/* ── 4. بطاقات التشوير الطرقي البصرية (Road Signs Categories) ─────────────── */
.dash-signs-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}
@media (max-width: 900px) {
  .dash-signs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .dash-signs-grid {
    grid-template-columns: 1fr;
  }
}
.sign-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 18px);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--spring, ease), border-color .2s ease, box-shadow .2s ease;
  min-height: 80px;
}
.sign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.sign-card:active {
  transform: scale(0.98);
}
.sign-badge {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  flex: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.sign-card-danger .sign-badge {
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  color: #fff;
}
.sign-card-danger:hover { border-color: #EF4444 !important; }

.sign-card-interdiction .sign-badge {
  background: linear-gradient(135deg, #F43F5E, #BE123C);
  color: #fff;
}
.sign-card-interdiction:hover { border-color: #F43F5E !important; }

.sign-card-obligation .sign-badge {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #fff;
}
.sign-card-obligation:hover { border-color: #3B82F6 !important; }

.sign-card-indication .sign-badge {
  background: linear-gradient(135deg, #0EA5E9, #0369A1);
  color: #fff;
}
.sign-card-indication:hover { border-color: #0EA5E9 !important; }

.sign-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 2px;
}
.sign-card-info strong {
  font-family: var(--font-heading);
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--text);
}
.sign-card-info small {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
}
.sign-card-arrow {
  color: var(--muted);
  font-size: 1.15rem;
  flex: none;
  display: flex;
  align-items: center;
  transition: transform .2s ease, color .2s ease;
}
[dir="rtl"] .sign-card-arrow {
  transform: scaleX(-1);
}
.sign-card:hover .sign-card-arrow {
  color: var(--primary);
  transform: translateX(4px);
}
[dir="rtl"] .sign-card:hover .sign-card-arrow {
  transform: scaleX(-1) translateX(4px);
}

/* ── 5. لمسات محاكي الامتحان NARSA (المؤقت الزمني والأزرار المضيئة) ───────── */
.nrs-timer-val {
  transition: color 0.3s ease, transform 0.3s ease;
}
.nrs-timer-val.timer-warn {
  color: #F59E0B !important;
}
.nrs-timer-val.timer-low {
  color: #EF4444 !important;
  font-weight: 900 !important;
  animation: nrs-timer-urgent 0.8s ease-in-out infinite alternate;
}
@keyframes nrs-timer-urgent {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px #EF4444); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8)); }
}

.nrs-tb-timer.timer-warn {
  color: #1a1300 !important;
  background: #F59E0B !important;
  border-color: #F59E0B !important;
}
.nrs-tb-timer.timer-low {
  color: #fff !important;
  background: #EF4444 !important;
  border-color: #DC2626 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.8) !important;
  animation: nrs-tb-urgent 0.7s ease-in-out infinite alternate !important;
}
@keyframes nrs-tb-urgent {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); box-shadow: 0 0 22px rgba(239, 68, 68, 1); }
}

/* زر الاختيار مع إطار مضيء #F96302 وتأثير ضغط ناعم */
.nrs-choice-btn {
  transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease !important;
  -webkit-tap-highlight-color: transparent;
}
.nrs-choice-btn:active:not([disabled]) {
  transform: scale(0.94) !important;
}
.nrs-choice-btn.choice-on,
.nrs-overlay .nrs-choice-btn.choice-on {
  background: #F96302 !important;
  color: #FFFFFF !important;
  border: 2px solid #FFFFFF !important;
  box-shadow: 0 0 0 3px #F96302, 0 0 20px rgba(249, 99, 2, 0.75), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  transform: scale(1.02);
}
.nrs-choice-btn.choice-on .nrs-choice-num,
.nrs-overlay .nrs-choice-btn.choice-on .nrs-choice-num {
  color: #FFFFFF !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ══ قائمة "المزيد" للأدمن على الهاتف (Admin More Bottom Sheet) ══ */
.admin-more-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.admin-more-sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.admin-more-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  z-index: 510;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.admin-more-sheet-backdrop.open .admin-more-sheet {
  transform: translateY(0);
}
[data-theme="dark"] .admin-more-sheet {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
}
.admin-more-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .admin-more-sheet-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-more-sheet-title {
  font-family: var(--font-heading) !important;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.admin-more-sheet-close {
  background: var(--surface-2);
  border: 0;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
}
.admin-more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.admin-more-grid.has-2 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 440px;
  margin-inline: auto;
}
@media (max-width: 380px) {
  .admin-more-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.admin-more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  min-height: 80px;
  box-sizing: border-box;
}
[data-theme="dark"] .admin-more-item {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-more-item:hover, .admin-more-item:active {
  background: var(--surface-3);
  border-color: rgba(255, 122, 0, 0.4);
  transform: scale(0.98);
}
.admin-more-item.active {
  background: var(--surface-3);
  border-color: var(--primary, #FF7A00);
  color: var(--primary, #FF7A00);
  box-shadow: 0 0 0 1px var(--primary, #FF7A00);
}
.admin-more-item .ic, .admin-more-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  color: var(--primary);
}

/* ══ التنسيق المتجاوب لصفحات الإدارة والمؤسسات والمدربين على الشاشات المتوسطة والضيقة ══ */
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
  }
  .dash-kpis,
  .school-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 768px) {
  /* انهيار الشبكات متعددة الأعمدة إلى عمود واحد كامل العرض */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* بطاقات المؤشرات (KPIs) في لوحة الإدارة ولوحة المؤسسة */
  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  /* صف إحصاءات المؤسسة السريعة */
  .school-stats-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .school-stat {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* رؤوس الصفحات وأشرطة الفلترة والبحث */
  .page-head, .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .page-head > div:first-child,
  .page-header > div:first-child {
    width: 100% !important;
  }
  .page-head .row,
  .page-header .row,
  .page-header-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .page-head select,
  .page-head input,
  .page-header select,
  .page-header input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* الحاويات والجداول بعرض 100% كامل دون تجاوز أفقي */
  .schools-view,
  .exams-view,
  .table-wrap,
  .admin-table-wrap,
  .card:has(> table),
  .card:has(> .table),
  .card:has(> .table-wrap) {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* بطاقات مسار الامتحانات */
  .exam-journey-top {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .exam-step-header {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .exam-step-actions {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

@media (max-width: 480px) {
  .dash-kpis,
  .school-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  #app:has(.page-head) {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}



/* ── النقطة الخضراء النابضة لمؤشر متصلون الآن ── */
.pulsing-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse-dot 1.8s infinite;
  vertical-align: middle;
}
@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}


/* ═════════════════════════════════════════════════════════════════════════
   v70: NARSA 5 Modules, Exam Series Cards & Lesson Reader Polish (Law 52.05)
   ═════════════════════════════════════════════════════════════════════════ */

/* ── Banner علامات التشوير الطرقي ── */
.signs-guide-banner {
  margin-bottom: 22px;
  padding: 18px 22px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(239, 68, 68, 0.06));
  border: 1.5px solid rgba(59, 130, 246, 0.28);
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}
.signs-guide-banner:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.signs-guide-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.signs-guide-banner-icon {
  font-size: 2.2rem;
  line-height: 1;
}
.signs-guide-banner-title {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
  margin-bottom: 2px;
}
.signs-guide-banner-sub {
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 500;
}

/* ── بطاقات محاور NARSA الخمسة (الوحدات والدروس) ── */
.narsa-modules {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.narsa-module-card {
  padding: 0 !important;
  overflow: hidden;
  border: 1.5px solid var(--border);
  border-radius: var(--radius, 16px);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.narsa-module-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.narsa-module-head {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.narsa-module-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}
.narsa-module-icon {
  font-size: 2rem;
  line-height: 1;
  flex: none;
}
.narsa-module-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.narsa-module-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.narsa-module-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
}
.narsa-module-sub {
  color: var(--muted);
}
.narsa-module-badge-wrap {
  flex: none;
}
.narsa-module-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.narsa-module-badge.is-complete {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
[data-theme="dark"] .narsa-module-badge.is-complete {
  background: rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
  border-color: rgba(5, 150, 105, 0.4);
}
.narsa-module-badge.is-in-progress {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}
[data-theme="dark"] .narsa-module-badge.is-in-progress {
  background: rgba(234, 88, 12, 0.2);
  color: #fdba74;
  border-color: rgba(234, 88, 12, 0.4);
}
.narsa-module-bar-wrap {
  padding: 10px 20px 0;
}
.narsa-module-list {
  padding: 0;
  border: none;
  background: transparent;
}
.narsa-module-list .lesson-row {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.narsa-module-list .lesson-row:last-child {
  border-bottom: none;
}
.narsa-module-list .lesson-row:hover {
  background: var(--surface-2);
}

/* ── شبكة السلاسل بتصميم البلاطات المربعة (Series Square-Tile Grid) ── */
.series-tile-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)); /* 4-5 cols on desktop */
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 1200px) {
  .series-tile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }
}
@media (max-width: 900px) {
  .series-tile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
}
@media (max-width: 600px) {
  .series-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}
@media (max-width: 340px) {
  .series-tile-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.series-tile {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  aspect-ratio: 1 / 1;
  min-height: 120px;
  cursor: pointer;
  position: relative;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  text-decoration: none;
}
.series-tile:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--primary, #5f57e5);
  box-shadow: 0 8px 20px rgba(95, 87, 229, 0.15);
  background: var(--surface-2);
}
.series-tile:active {
  transform: scale(0.97);
}

.series-tile-num {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s ease;
}
.series-tile:hover .series-tile-num {
  background: var(--primary, #5f57e5);
  color: #fff;
  border-color: var(--primary, #5f57e5);
}

.series-tile-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 2px 0;
}
.series-tile-title {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.series-tile-count {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--muted);
}

.series-tile-badge {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.series-tile-badge.badge-pass {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.series-tile-badge.badge-training {
  background: rgba(37, 99, 235, 0.15);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.3);
}
.series-tile-badge.badge-new {
  background: var(--border);
  color: var(--muted);
  border: 1px solid transparent;
}

.series-tile.is-passed {
  border-color: rgba(22, 163, 74, 0.35);
}
.series-tile.is-passed .series-tile-num {
  border-color: rgba(22, 163, 74, 0.4);
  color: #16a34a;
}

/* ═══════════════ RESULTS QUESTION MODAL POPUP ═══════════════════════════════ */
.res-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: resModalFadeIn .18s ease-out;
}
@keyframes resModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.res-modal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow: hidden;
  animation: resModalSlideUp .2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes resModalSlideUp {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.res-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.res-modal-head-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.res-modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}
.res-modal-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}
.res-modal-badge.is-ok {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.res-modal-badge.is-ko {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
}
.res-modal-badge.is-skip {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}
.res-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .15s ease;
}
.res-modal-close:hover {
  color: var(--text);
  background: var(--hover);
}
.res-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px;
  min-height: 0;
}
.res-modal-body .qcard {
  border: none;
  background: none;
  box-shadow: none;
  padding: 0;
}
.res-modal-body .qcard-body {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.res-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.res-modal-counter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-soft);
}
.res-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all .12s ease;
}
.res-modal-btn:hover:not([disabled]) {
  background: var(--hover);
  border-color: var(--accent);
}
.res-modal-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── ترقية قارئ الدروس والنصوص التنظيمية (Lesson Reader & Typography) ── */
.reader-card {
  padding: 24px 28px !important;
}
@media (max-width: 640px) {
  .reader-card { padding: 18px 16px !important; }
}

.reader-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 16px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-mid);
  width: fit-content;
  transition: all 0.2s;
}
.reader-back:hover {
  background: var(--surface-3);
  transform: translateX(3px);
}

.reader-head {
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1.5px solid var(--border);
}
.reader-head h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
  margin: 12px 0 6px;
}

/* تباعد وقراءة مريحة للنصوص داخل الدرس */
.lx-step .prose {
  font-size: 1.04rem;
  line-height: 1.85;
  color: var(--text);
}
.lx-step .prose h2,
.reader-card .prose h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  padding-bottom: 0.35em;
  border-bottom: 1.5px solid var(--border);
}
.lx-step .prose h3,
.reader-card .prose h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 1.3em;
  margin-bottom: 0.4em;
}
.lx-step .prose p,
.reader-card .prose p {
  margin-bottom: 1em;
}

/* مربعات التأطير القانوني والقواعد الرسمية (Law 52.05 Callout Boxes) */
.prose blockquote,
.reader-card blockquote {
  margin: 1.4em 0;
  padding: 16px 20px;
  background: var(--surface-2);
  border-inline-start: 5px solid var(--primary);
  border-radius: 12px;
  border: 1px solid var(--border);
  border-inline-start-width: 5px;
  border-inline-start-color: var(--primary);
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.75;
  box-shadow: var(--shadow-xs);
}
.prose blockquote strong,
.reader-card blockquote strong {
  color: var(--primary-strong);
  font-weight: 800;
}
[data-theme="dark"] .prose blockquote,
[data-theme="dark"] .reader-card blockquote {
  background: #1a1e27;
  border-color: rgba(255, 255, 255, 0.08);
  border-inline-start-color: var(--primary);
  color: #f1f5f9;
}

/* جداول المقادير والسرعات والمخالفات */
.prose table,
.reader-card table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.prose th,
.reader-card th {
  background: var(--surface-2);
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
  border-bottom: 2px solid var(--border);
  text-align: right;
}
.prose td,
.reader-card td {
  padding: 12px 14px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}
.prose tr:last-child td,
.reader-card tr:last-child td {
  border-bottom: none;
}
.prose tr:hover td,
.reader-card tr:hover td {
  background: var(--surface-2);
}

/* ══ الوضع البسيط والكامل في لوحة التحكم ══ */
[data-simple-only] {
  display: none;
}
.dash-simple [data-simple-only] {
  display: block;
}
.dash-simple [data-full-only] {
  display: none !important;
}

/* ══ إزالة زر القائمة وزر الدرج العلويين (⋮ و ☰) عبر جميع الشاشات ══ */
#side-open-btn,
.side-open-btn,
#menu-btn,
.menu-toggle,
.side-toggle {
  display: none !important;
}

/* ══ إخفاء زر المظهر في الرأس وعرضه داخل قائمة الحساب (👤) ══ */
#theme-btn,
.hdr-desktop-only#theme-btn {
  display: none !important;
}

.user-dropdown #ud-theme-btn,
#user-dropdown #ud-theme-btn,
#ud-theme-btn {
  display: flex !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   INTERACTIVE LESSON PLAYER & PRACTICAL WIDGETS (PERMICODE)
   Step-by-step cards, audio equalizer, visual diagrams, speed slider,
   lights selector, and Law 52.05 points simulator (Mobile-first & Dark Mode)
   ══════════════════════════════════════════════════════════════════════════ */

.il-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.il-pill-badge {
  background: var(--primary, #ea580c);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
}
.il-tools-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 640px) {
  .il-tools-row {
    grid-template-columns: 1fr;
  }
}
.il-widgets-banner {
  border-right: 4px solid #0ea5e9 !important;
}

/* ── Player Layout & Stepper ── */
.il-player-page {
  padding-bottom: 60px;
}
.il-top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.il-axis-pill {
  background: rgba(234, 88, 12, 0.12);
  color: var(--primary, #ea580c);
  font-weight: 700;
}
.il-pill-done {
  background: rgba(52, 199, 89, 0.15);
  color: #248a3d;
  font-weight: 700;
}
[data-theme="dark"] .il-pill-done {
  color: #30d158;
}

.il-player-card {
  padding: 24px;
  border-radius: 20px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  position: relative;
}
@media (max-width: 600px) {
  .il-player-card {
    padding: 16px;
    border-radius: 16px;
  }
}

.il-player-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.il-step-indicator-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.il-step-count-badge {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--primary, #ea580c);
  background: rgba(234, 88, 12, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
}
.il-step-pct {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--muted);
}

.il-stepper-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.il-stepper-seg {
  flex: 1;
  height: 24px;
  padding: 8px 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.il-stepper-seg:hover {
  transform: scaleY(1.3);
}
.il-stepper-seg i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2, #e5e7eb);
  transition: background 0.25s ease, height 0.2s ease;
}
.il-stepper-seg.is-done i {
  background: var(--success, #22c55e);
}
.il-stepper-seg.is-cur i {
  background: var(--primary, #ea580c);
  height: 8px;
}
[data-theme="dark"] .il-stepper-seg i {
  background: #374151;
}
[data-theme="dark"] .il-stepper-seg.is-done i {
  background: #10b981;
}

.il-lesson-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}
@media (max-width: 600px) {
  .il-lesson-title {
    font-size: 1.25rem;
  }
}

/* ── Current Slide ── */
.il-slide-container {
  outline: none;
  animation: ilSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes ilSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.il-slide-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--text);
}

/* ── Audio Control Card ── */
.il-audio-control-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.il-audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary, #ea580c);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(234, 88, 12, 0.28);
}
.il-audio-play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(234, 88, 12, 0.35);
}
.il-audio-play-btn:active {
  transform: translateY(1px);
}
.il-audio-btn-icon svg {
  width: 18px;
  height: 18px;
}
.il-audio-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  padding: 0 4px;
}
.il-wave {
  width: 3.5px;
  height: 6px;
  background: var(--primary, #ea580c);
  border-radius: 999px;
  transition: height 0.2s ease;
}
.il-audio-control-card.is-playing .il-wave {
  animation: ilWaveAnim 1s ease-in-out infinite;
}
.il-audio-control-card.is-playing .il-wave:nth-child(2) { animation-delay: 0.2s; }
.il-audio-control-card.is-playing .il-wave:nth-child(3) { animation-delay: 0.4s; }
.il-audio-control-card.is-playing .il-wave:nth-child(4) { animation-delay: 0.6s; }

@keyframes ilWaveAnim {
  0%, 100% { height: 5px; }
  50% { height: 20px; }
}

/* ── Visual Media Showcase ── */
.il-visual-showcase {
  margin-bottom: 22px;
}
.il-visual-media-box {
  background: var(--surface-2, #f9fafb);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  min-height: 180px;
  max-height: 380px;
}
.il-visual-img {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 10px;
  transition: transform 0.25s ease;
}
.il-visual-img:hover {
  transform: scale(1.02);
}
.il-visual-caption {
  text-align: center;
  margin-top: 8px;
}

/* ── Darija, Rule & Tip Cards ── */
.il-darija-card,
.il-rule-card,
.il-tip-card {
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 18px;
  position: relative;
}
.il-card-tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.il-darija-card {
  background: rgba(234, 88, 12, 0.06);
  border: 1.5px solid rgba(234, 88, 12, 0.22);
}
.il-darija-card .il-card-tag {
  background: rgba(234, 88, 12, 0.15);
  color: #c2410c;
}
[data-theme="dark"] .il-darija-card {
  background: rgba(234, 88, 12, 0.12);
  border-color: rgba(234, 88, 12, 0.35);
}
[data-theme="dark"] .il-darija-card .il-card-tag {
  color: #fb923c;
}
.il-darija-text {
  font-size: 1.05rem;
  line-height: 1.75;
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.il-rule-card {
  background: rgba(14, 165, 233, 0.06);
  border: 1.5px solid rgba(14, 165, 233, 0.22);
}
.il-rule-card .il-card-tag {
  background: rgba(14, 165, 233, 0.15);
  color: #0369a1;
}
[data-theme="dark"] .il-rule-card {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.35);
}
[data-theme="dark"] .il-rule-card .il-card-tag {
  color: #38bdf8;
}
.il-rule-text {
  font-size: 0.98rem;
  line-height: 1.7;
  margin: 0;
  color: var(--text);
}

.il-tip-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1.5px solid rgba(245, 158, 11, 0.25);
}
.il-tip-card .il-card-tag {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}
[data-theme="dark"] .il-tip-card {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}
[data-theme="dark"] .il-tip-card .il-card-tag {
  color: #fbbf24;
}
.il-tip-text {
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0;
  color: var(--text);
}

/* ── Footer Navigation ── */
.il-player-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.il-footer-pos {
  font-weight: 700;
}
.il-player-footer .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: center;
}
.il-player-footer .btn svg {
  width: 18px;
  height: 18px;
}
@media (max-width: 480px) {
  .il-player-footer .btn {
    min-width: 100px;
    padding: 10px 14px;
    font-size: 0.88rem;
  }
}

/* ── Final Screen ── */
.il-final-view {
  text-align: center;
  padding: 30px 16px;
}
.il-celebrate-badge {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 800;
  color: #15803d;
  background: rgba(34, 197, 94, 0.15);
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.il-final-view h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 10px;
}
.il-final-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   PRACTICAL WIDGETS STYLES
   ══════════════════════════════════════════════════════════════════════════ */
.il-widget {
  background: var(--surface-2, #f9fafb);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin: 24px 0 16px;
}
@media (max-width: 600px) {
  .il-widget {
    padding: 14px;
    border-radius: 14px;
  }
}
.il-widget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.il-widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
}
.il-widget-icon {
  font-size: 1.3rem;
}

/* Road Toggle */
.il-road-toggle {
  display: inline-flex;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}
.il-road-btn {
  border: 0;
  background: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.il-road-btn.active {
  background: var(--primary, #ea580c);
  color: #fff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

/* Speed Slider */
.il-speed-slider-wrap {
  margin-bottom: 20px;
}
.il-speed-val-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.il-speed-display {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--primary, #ea580c);
}
.il-speed-display small {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.il-speed-slider {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  outline: none;
  background: var(--surface, #e5e7eb);
  cursor: pointer;
  accent-color: var(--primary, #ea580c);
}
.il-speed-presets {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
}
.il-preset-btn {
  flex: 1;
  padding: 6px 0;
  border: 1px solid var(--border);
  background: var(--surface, #ffffff);
  color: var(--text);
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.il-preset-btn:hover,
.il-preset-btn.active {
  background: var(--primary, #ea580c);
  color: #ffffff;
  border-color: var(--primary, #ea580c);
}

/* Metrics Grid */
.il-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 640px) {
  .il-metrics-grid {
    grid-template-columns: 1fr;
  }
}
.il-metric-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
}
.il-metric-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.il-metric-info {
  display: grid;
  gap: 2px;
}
.il-metric-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.il-metric-val {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.2;
}
.il-metric-val strong {
  color: var(--text);
}
.il-metric-val small {
  font-size: 0.8rem;
  color: var(--muted);
}
.metric-react { border-right: 4px solid #f59e0b; }
.metric-safety { border-right: 4px solid #10b981; }
.metric-stop { border-right: 4px solid #ef4444; }

/* Visual Road Track */
.il-track-container {
  margin-bottom: 18px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  overflow: hidden;
}
.il-track-road {
  position: relative;
  height: 60px;
  background: #334155;
  border-radius: 10px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}
.il-track-road.is-wet {
  background: linear-gradient(90deg, #1e293b, #0f172a);
  border: 1.5px solid #38bdf8;
}
.il-track-road::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  border-top: 2px dashed rgba(255, 255, 255, 0.35);
  transform: translateY(-50%);
  pointer-events: none;
}
.il-track-mark-react {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgba(245, 158, 11, 0.35);
  transition: width 0.25s ease;
  z-index: 1;
}
.il-track-mark-stop {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgba(239, 68, 68, 0.28);
  transition: width 0.25s ease;
  z-index: 1;
}
.il-track-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  line-height: 1.2;
}
.il-badge-react {
  position: absolute;
  top: 4px;
  left: 8px;
  background: rgba(180, 83, 9, 0.9);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  z-index: 2;
  pointer-events: none;
}
.il-badge-stop {
  display: inline-block;
  background: rgba(220, 38, 38, 0.92);
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.il-track-car {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.35rem;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}
.il-track-obstacle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  white-space: nowrap;
  transition: left 0.25s ease;
}
.il-track-stop-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}
@media (max-width: 480px) {
  .il-track-road {
    height: 64px;
  }
  .il-badge-react {
    display: none;
  }
  .il-track-stop-icon {
    font-size: 1.15rem;
  }
  .il-badge-stop {
    font-size: 0.64rem;
    padding: 1.5px 5px;
  }
}

/* Darija Box */
.il-darija-box {
  background: rgba(234, 88, 12, 0.05);
  border: 1px solid rgba(234, 88, 12, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 14px;
}
.il-box-tag {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--primary, #ea580c);
  margin-bottom: 4px;
}
.il-darija-box p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text);
}

/* Lights Selector */
.il-scenarios-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.il-scenario-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface, #ffffff);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}
.il-scenario-btn:hover {
  border-color: var(--primary, #ea580c);
  transform: translateY(-1px);
}
.il-scenario-btn.active {
  background: var(--primary, #ea580c);
  color: #fff;
  border-color: var(--primary, #ea580c);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.28);
}
.il-lights-display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.il-light-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  display: grid;
  gap: 4px;
}
.il-light-card.is-mandatory {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}
.il-light-card.is-forbidden {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
.il-light-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.il-light-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.il-light-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 6px;
  display: inline-block;
  width: fit-content;
}
.il-light-badge.is-mandatory { background: rgba(34, 197, 94, 0.18); color: #15803d; }
.il-light-badge.is-allowed { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
.il-light-badge.is-forbidden { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.il-light-badge.is-none { background: var(--surface-2, #e5e7eb); color: var(--muted); }

/* Law 52.05 Widget */
.il-law-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.il-tab-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface, #ffffff);
  color: var(--text);
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.il-tab-btn.active {
  background: var(--primary, #ea580c);
  color: #fff;
  border-color: var(--primary, #ea580c);
}
.il-license-type-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.il-points-status-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.il-gauge-circle {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-2, #f3f4f6);
  border: 3px solid var(--primary, #ea580c);
}
.il-gauge-circle strong {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text);
}
.il-gauge-circle small {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 700;
}
.il-gauge-info {
  flex: 1;
  display: grid;
  gap: 4px;
}
.il-gauge-title {
  font-size: 1.05rem;
  font-weight: 800;
}
.il-points-status-card.is-good .il-gauge-circle { border-color: #22c55e; }
.il-points-status-card.is-danger .il-gauge-circle { border-color: #f59e0b; }
.il-points-status-card.is-revoked .il-gauge-circle { border-color: #ef4444; }

.il-infractions-checklist {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.il-inf-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}
.il-inf-item:hover {
  border-color: var(--primary, #ea580c);
}
.il-inf-item.is-checked {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.35);
}
.il-inf-item input {
  accent-color: #ef4444;
  width: 18px;
  height: 18px;
}
.il-inf-text {
  flex: 1;
  display: grid;
  gap: 2px;
}
.il-pts-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.il-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.il-doc-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.il-doc-card.is-highlight {
  border-color: var(--primary, #ea580c);
  background: rgba(234, 88, 12, 0.05);
}
.il-doc-icon {
  font-size: 1.8rem;
}

.il-fines-table-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  margin-bottom: 16px;
}
.il-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}
.il-table th, .il-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.il-table th {
  background: var(--surface-2, #f3f4f6);
  font-weight: 800;
}
.il-badge-good {
  color: #15803d;
  background: rgba(34, 197, 94, 0.15);
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
}


/* ══════════════════════════════════════════════════════════════════════════
   UNIFIED LEARNER DESIGN SYSTEM & COHESIVE TOKENS
   Standardized 16px radius, surface contrast, filter pills, mobile RTL spacing
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Universal Spacing above Mobile Bottom Bar ── */
@media (max-width: 768px) {
  body.learner-side main,
  body.has-bottom-bar main,
  body.has-bottom-bar #app,
  .pg,
  .pg-narrow,
  .lessons-page-wrap,
  .signs-page,
  .chat-page {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 16px)) !important;
  }
}

/* ── 2. Unified Page Headers & Eyebrows ── */
.pg-head {
  margin-bottom: 24px;
}
.pg-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-mid);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.pg-head h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 3.8vw, 2.25rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.28;
}
.pg-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 680px;
}

/* ── 3. Unified Filter Pills ── */
.filter-pills-wrap,
.signs-tabs,
.lessons-axis-tabs,
.il-axis-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 22px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-pills-wrap::-webkit-scrollbar,
.signs-tabs::-webkit-scrollbar,
.lessons-axis-tabs::-webkit-scrollbar,
.il-axis-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill,
.signs-tab,
.axis-tab,
.lessons-axis-tab,
.il-axis-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
}
.filter-pill:hover,
.signs-tab:hover,
.axis-tab:hover,
.lessons-axis-tab:hover,
.il-axis-pill-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.filter-pill.active,
.signs-tab.active,
.axis-tab.active,
.lessons-axis-tab.active,
.il-axis-pill-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 3px 12px rgba(234, 88, 12, 0.28);
}

/* ── 4. Unified Card System (Consistent 16px Radius) ── */
.card,
.cat-card,
.dash-ready,
.dash-kpi,
.narsa-module-card,
.series-tile,
.il-lesson-card,
.cat-hub-card,
.sign-card,
.il-hub-progress-card {
  border-radius: 16px !important;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* ── 5. Lessons Hub: Compact Progress & Quick Strip & Uniform Cards ── */
.il-hub-progress-card {
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
@media (max-width: 680px) {
  .il-hub-progress-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
}
.il-hub-progress-info {
  flex: 1;
}
.il-hub-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.il-hub-progress-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.il-hub-progress-pct {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--primary-mid);
}
.il-hub-progress-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.il-hub-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #fb923c);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.il-hub-progress-sub {
  font-size: 0.85rem;
  color: var(--muted);
}
.il-hub-continue-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 12px 22px;
  font-size: 0.96rem;
  font-weight: 800;
  border-radius: 12px;
}

/* Quick Access Strip */
.il-quick-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 640px) {
  .il-quick-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.il-quick-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}
.il-quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.il-quick-card-start {
  display: flex;
  align-items: center;
  gap: 12px;
}
.il-quick-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.il-quick-card-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 2px;
}
.il-quick-card-sub {
  font-size: 0.8rem;
  color: var(--muted);
}
.il-quick-card-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Uniform Lessons Grid & Cards */
.il-lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.il-lesson-card {
  padding: 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.il-lesson-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.il-lesson-card.is-done {
  border-color: rgba(34, 197, 94, 0.35);
}
.il-lesson-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.il-lesson-card-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.il-lesson-card-status-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.il-lesson-card-status-badge.done {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}
[data-theme=dark] .il-lesson-card-status-badge.done {
  color: #22c55e;
}
.il-lesson-card-status-badge.in-progress {
  background: var(--primary-soft);
  color: var(--primary);
}
.il-lesson-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.35;
}
.il-lesson-card-summary {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.il-lesson-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}
.il-badge-audiovisual {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--text-soft);
}
.il-lesson-card-action {
  font-weight: 800;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── 6. Lesson Player: Sticky Stepper & Visual Showcase ── */
.il-sticky-stepper {
  position: sticky;
  top: var(--hdr-h, 0px);
  z-index: 25;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
}
.il-sticky-stepper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.il-sticky-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-2);
}
.il-sticky-back-btn:hover {
  color: var(--primary);
  background: var(--surface-3);
}
.il-sticky-counter {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--primary-mid);
}

/* Centered Visual Showcase */
.il-visual-showcase {
  margin-bottom: 22px;
  text-align: center;
}
.il-visual-media-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  max-height: 380px;
  margin: 0 auto;
}
.il-visual-img {
  max-width: 100%;
  max-height: 350px;
  width: auto;
  object-fit: contain;
  border-radius: 10px;
}
.il-visual-caption {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Scannable Explanation Cards */
.il-darija-card {
  background: rgba(234, 88, 12, 0.06);
  border: 1px solid rgba(234, 88, 12, 0.22);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
[data-theme=dark] .il-darija-card {
  background: rgba(255, 122, 0, 0.08);
  border-color: rgba(255, 122, 0, 0.25);
}
.il-card-tag {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.il-darija-text {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
  font-weight: 500;
}
.il-rule-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.il-rule-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}
.il-tip-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.il-tip-text {
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  line-height: 1.6;
}

/* Navigation Footer */
.il-player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}
.il-player-footer .btn {
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 12px;
}

/* 5 Axis Hub Cards */
.cat-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.cat-hub-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cat-hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.cat-hub-card.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.15);
}
.cat-hub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cat-hub-icon {
  font-size: 1.8rem;
}
.cat-hub-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}
.cat-hub-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}
.cat-hub-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-hub-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Modal Options & Correction State */
.modal-opt.is-correct {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: #22c55e !important;
}
.modal-opt.is-wrong {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
}
.modal-opt-badge-wrong {
  font-size: 0.76rem;
  font-weight: 800;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}
.modal-understood-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #10b981;
  color: #fff;
  border: 0;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-understood-btn:hover {
  background: #059669;
  transform: translateY(-1px);
}


/* ═══════════════════════════════════════════════════════════════════════
   SIMPLIFIED DASHBOARD & MODERN LESSONS READER (Low Reading Proficiency)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Learner Dashboard ── */
.dash-simplified {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.dash-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.dash-greeting-text h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  line-height: 1.3;
}

.dash-badge-b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--primary-soft, rgba(234, 88, 12, 0.1));
  border: 1.5px solid var(--primary-mid, rgba(234, 88, 12, 0.25));
  color: var(--primary, #ea580c);
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Top Readiness Hero Card */
.dash-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 30px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
  transition: border-color 0.2s ease;
}

.dash-hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.dash-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.dash-hero-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.dash-hero-action {
  margin-top: 10px;
}

.dash-hero-progress-side {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-hero-info-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.dash-hero-kicker {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.dash-hero-cta {
  margin-top: 10px;
}

.btn-hero-orange {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #FF7A00 0%, #E66A00 100%);
  color: #ffffff !important;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 14px 34px;
  border-radius: 14px;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 122, 0, 0.38);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-hero-orange:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.48);
  color: #ffffff !important;
  text-decoration: none !important;
}

.btn-hero-orange .btn-arrow {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.btn-hero-orange:hover .btn-arrow {
  transform: translateX(-4px);
}

.btn-hero-orange svg {
  width: 22px;
  height: 22px;
}

.dash-ring-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.dash-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dash-ring-pct span {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.dash-ring-pct small {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

@media (max-width: 640px) {
  .dash-hero-card {
    flex-direction: column-reverse;
    text-align: center;
    padding: 20px 18px;
    gap: 18px;
  }
  .dash-hero-content {
    align-items: center;
  }
  .btn-hero-orange {
    width: 100%;
  }
}

/* 4 Large Visual Cards Grid */
.dash-four-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  .dash-four-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.dash-big-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-radius: 20px;
  text-decoration: none !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1.5px solid transparent;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  position: relative;
  overflow: hidden;
}

.dash-big-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  text-decoration: none !important;
}

.dash-card-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.dash-big-card:hover .dash-card-icon {
  transform: scale(1.08);
}

.dash-card-emoji {
  font-size: 1.9rem;
  line-height: 1;
  display: block;
}

.dash-card-icon svg {
  width: 30px;
  height: 30px;
}

.dash-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dash-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
}

.dash-card-sub {
  font-size: 0.88rem;
  opacity: 0.88;
  line-height: 1.35;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-card-arrow {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

.dash-big-card:hover .dash-card-arrow {
  opacity: 1;
  color: var(--primary, #FF7A00);
  transform: translateX(-4px);
}

/* Card 1: الدروس (Soft Blue) */
.card-lessons {
  background: #f0f7ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}
.card-lessons .dash-card-icon {
  background: #dbeafe;
  color: #1d4ed8;
}
.card-lessons .dash-card-title { color: #1e3a8a; }

/* Card 2: العلامات (Soft Amber) */
.card-signs {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}
.card-signs .dash-card-icon {
  background: #fef3c7;
  color: #b45309;
}
.card-signs .dash-card-title { color: #78350f; }

/* Card 3: التمارين (Soft Green) */
.card-practice {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
}
.card-practice .dash-card-icon {
  background: #dcfce7;
  color: #15803d;
}
.card-practice .dash-card-title { color: #14532d; }

/* Card 4: الامتحان (Soft Purple) */
.card-exam {
  background: #faf5ff;
  border-color: #e9d5ff;
  color: #581c87;
}
.card-exam .dash-card-icon {
  background: #f3e8ff;
  color: #7e22ce;
}
.card-exam .dash-card-title { color: #581c87; }

/* Card 5: بنك الأخطاء (Soft Rose) */

/* Card 6: المساعد الذكي (Soft Orange / Permicode Amber) */
.card-ai {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.card-ai .dash-card-icon {
  background: #ffedd5;
  color: #ea580c;
}
.card-ai .dash-card-title { color: #9a3412; }

/* Dark Mode Overrides for Big Cards */
[data-theme="dark"] .card-lessons {
  background: rgba(30, 58, 138, 0.22);
  border-color: rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}
[data-theme="dark"] .card-lessons .dash-card-icon {
  background: rgba(59, 130, 246, 0.28);
  color: #93c5fd;
}
[data-theme="dark"] .card-lessons .dash-card-title { color: #dbeafe; }

[data-theme="dark"] .card-signs {
  background: rgba(120, 53, 15, 0.22);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}
[data-theme="dark"] .card-signs .dash-card-icon {
  background: rgba(245, 158, 11, 0.28);
  color: #fcd34d;
}
[data-theme="dark"] .card-signs .dash-card-title { color: #fef3c7; }

[data-theme="dark"] .card-practice {
  background: rgba(20, 83, 45, 0.22);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}
[data-theme="dark"] .card-practice .dash-card-icon {
  background: rgba(34, 197, 94, 0.28);
  color: #86efac;
}
[data-theme="dark"] .card-practice .dash-card-title { color: #dcfce7; }

[data-theme="dark"] .card-exam {
  background: rgba(88, 28, 135, 0.22);
  border-color: rgba(168, 85, 247, 0.35);
  color: #e9d5ff;
}
[data-theme="dark"] .card-exam .dash-card-icon {
  background: rgba(168, 85, 247, 0.28);
  color: #d8b4fe;
}
[data-theme="dark"] .card-exam .dash-card-title { color: #f3e8ff; }

[data-theme="dark"] .card-ai {
  background: rgba(154, 52, 18, 0.22);
  border-color: rgba(251, 146, 60, 0.35);
  color: #fed7aa;
}
[data-theme="dark"] .card-ai .dash-card-icon {
  background: rgba(234, 88, 12, 0.28);
  color: #fdba74;
}
[data-theme="dark"] .card-ai .dash-card-title { color: #ffedd5; }

/* Dashboard Recent Activity Strip */
.dash-recent-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.dash-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-recent-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.dash-recent-viewall {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.dash-recent-viewall:hover {
  text-decoration: underline;
}

.dash-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.dash-recent-item:hover {
  background: var(--surface-3);
}

.dash-recent-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dash-recent-item-title {
  font-weight: 700;
  color: var(--text);
}

.dash-recent-item-time {
  font-size: 0.8rem;
  color: var(--muted);
}

.dash-recent-score {
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.86rem;
  flex-shrink: 0;
}

.dash-recent-score.score-pass {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

.dash-recent-score.score-fail {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.dash-recent-empty {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Dashboard Recent Activity Pill Rows */
.dash-recent-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-row-clean {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: all 0.18s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.recent-row-clean:hover {
  background: var(--surface-2);
  border-color: var(--primary, #FF7A00);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-decoration: none !important;
  color: var(--text) !important;
}

.recent-row-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.recent-row-title-wrap strong {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-row-title-wrap .small {
  font-size: 0.82rem;
  color: var(--muted);
}

.recent-row-badge-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.recent-row-badge-wrap .row-chevron {
  font-size: 1rem;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.18s ease;
}

.recent-row-clean:hover .recent-row-badge-wrap .row-chevron {
  color: var(--primary, #FF7A00);
  transform: translateX(-3px);
}

.dash-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary, #FF7A00) !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease, transform 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.dash-link:hover {
  opacity: 0.85;
  transform: translateX(-2px);
  text-decoration: none !important;
}

/* School Link Card */
.dash-school-link {
  margin-top: 10px;
}

.dash-school-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}

.dash-school-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.dash-school-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.dash-school-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}

.dash-school-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Lessons Grid View ── */
.lessons-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.lessons-vhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.lessons-vtitle {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}

.lessons-vsub {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.lessons-vprogress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.lessons-vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.lesson-vcard {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.lesson-vcard:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.lesson-vcard-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.lesson-vcard-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.lesson-vcard-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.3;
}

.lesson-vcard-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.lesson-vcard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.lesson-vcard-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #16a34a;
  font-weight: 700;
}

/* ── Modern Lesson Reader ── */
.lesson-reader-page {
  max-width: 840px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}

.lesson-reader-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
  flex-wrap: wrap;
}

.lesson-reader-nav-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lesson-reader-header {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1.5px solid var(--border);
}

.lesson-reader-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  margin: 8px 0 4px;
  line-height: 1.3;
}

.lesson-reader-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.lesson-visual-banner {
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  text-align: center;
}

.lesson-visual-banner img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

/* Section Box */
.lesson-section-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

.lesson-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.lesson-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.lesson-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 122, 0, 0.15);
  color: var(--primary, #FF7A00);
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.lesson-section-heading {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}

/* Audio Narration Button */
.lesson-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.lesson-audio-btn:hover {
  border-color: var(--primary, #FF7A00);
  color: var(--primary, #FF7A00);
  transform: translateY(-1px);
}

.lesson-audio-btn.is-playing {
  background: rgba(255, 122, 0, 0.15);
  border-color: var(--primary, #FF7A00);
  color: var(--primary, #FF7A00);
  animation: audioPulse 1.8s infinite;
}

@keyframes audioPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(255, 122, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0); }
}

/* Visual Media Container */
.lesson-visual-media {
  border-radius: 16px;
  overflow: hidden;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  text-align: center;
  background: var(--surface-2);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lesson-visual-diagram {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Paired signs comparison (e.g. ممنوع الوقوف والتوقف vs ممنوع التوقف فقط) */
.signs-pair-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: var(--surface-2);
  padding: 18px;
  border-radius: 16px;
}

.sign-pair-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}

.sign-pair-box img {
  max-width: 130px;
  max-height: 130px;
  object-fit: contain;
}

.sign-pair-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

/* Callouts: Full-width Header Pill ABOVE Text Block */
.lesson-callouts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-callout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  width: 100%;
  box-sizing: border-box;
}

.callout-header-pill {
  display: flex;
  align-items: center;
  width: 100%;
}

.callout-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  width: fit-content;
}

.callout-body {
  width: 100%;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
  font-weight: 500;
  word-break: break-word;
}

.callout-darija {
  background: rgba(234, 88, 12, 0.08);
  border-color: rgba(234, 88, 12, 0.22);
}
.callout-darija .callout-tag {
  background: rgba(234, 88, 12, 0.16);
  color: #c2410c;
}

.callout-rule {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.22);
}
.callout-rule .callout-tag {
  background: rgba(14, 165, 233, 0.16);
  color: #0369a1;
}

.callout-tip {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.22);
}
.callout-tip .callout-tag {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

/* Dark Mode Overrides for Callouts */
[data-theme="dark"] .callout-darija {
  background: rgba(234, 88, 12, 0.16);
  border-color: rgba(234, 88, 12, 0.38);
}
[data-theme="dark"] .callout-darija .callout-tag {
  background: rgba(234, 88, 12, 0.26);
  color: #fb923c;
}

[data-theme="dark"] .callout-rule {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.38);
}
[data-theme="dark"] .callout-rule .callout-tag {
  background: rgba(14, 165, 233, 0.26);
  color: #38bdf8;
}

[data-theme="dark"] .callout-tip {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.38);
}
[data-theme="dark"] .callout-tip .callout-tag {
  background: rgba(16, 185, 129, 0.26);
  color: #34d399;
}

/* Interactive Lesson Widgets */
.lesson-widget-box {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-top: 16px;
}

.calc-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calc-slider {
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 700;
}

.calc-slider input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 8px;
  cursor: pointer;
}

.calc-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.calc-stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
}

.calc-stat-pill strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.calc-stat-pill span {
  font-size: 0.8rem;
  color: var(--muted);
}

.calc-total-banner {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.calc-total-banner strong {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary);
}

.calc-total-banner span {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

.priority-visual-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prio-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prio-rule-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.prio-rule-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Lesson Completion Box */
.lesson-completion-box {
  text-align: center;
  padding: 36px 24px;
  border-radius: 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  margin-top: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.lesson-completion-emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 12px;
}

.lesson-completion-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
}

.lesson-completion-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Footer Action */
.lesson-reader-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1.5px solid var(--border);
}

.btn-lesson-complete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #10b981;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 14px 32px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.btn-lesson-complete:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* ── Responsive Mobile (<= 768px) & Desktop (>= 769px) Tuning for Lessons ── */
@media (max-width: 768px) {
  .lesson-reader-page {
    padding: 14px 12px 48px;
  }
  .lesson-section-box {
    padding: 16px 14px;
    border-radius: 16px;
    margin-bottom: 16px;
  }
  .lesson-section-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
  }
  .lesson-section-heading {
    font-size: 1.1rem;
    line-height: 1.35;
  }
  .lesson-section-badge {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    border-radius: 8px;
  }
  .lesson-audio-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
  .signs-pair-container {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  .sign-pair-box img {
    max-width: 100px;
    max-height: 100px;
  }
  .lesson-visual-diagram {
    max-height: 180px;
  }
  .lesson-callout {
    padding: 12px 14px;
    border-radius: 14px;
  }
  .callout-body {
    font-size: 0.95rem;
    line-height: 1.6;
  }
  .calc-stats-grid {
    grid-template-columns: 1fr;
  }
  .lesson-completion-buttons .btn {
    width: 100%;
  }
}

@media (min-width: 769px) {
  .lesson-reader-page {
    max-width: 860px;
  }
  .lesson-section-box {
    padding: 24px 28px;
  }
}

/* ── قسم علامات التشوير الإضافية (Extra Signs - Official Nomenclature) ── */
.extra-signs-section {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.extra-signs-card {
  padding: 0 !important;
  border: 1.5px solid var(--border);
  border-radius: var(--radius, 16px);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.extra-signs-head {
  padding: 20px 24px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.extra-signs-eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.extra-signs-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.extra-signs-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.extra-signs-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(234, 88, 12, 0.1);
  color: var(--primary);
  border: 1px solid rgba(234, 88, 12, 0.25);
}
.extra-signs-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.extra-signs-controls {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
}
.extra-signs-search {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s;
}
.extra-signs-search:focus {
  border-color: var(--primary);
}
.extra-signs-cat-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.extra-signs-cat-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.extra-signs-cat-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.extra-signs-cat-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.extra-signs-body {
  padding: 24px;
}
.extra-signs-group {
  margin-bottom: 28px;
}
.extra-signs-group:last-child {
  margin-bottom: 0;
}
.extra-signs-group-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}
.extra-signs-group-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
}
.extra-signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}
.extra-sign-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  position: relative;
  overflow: hidden;
}
.extra-sign-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.extra-sign-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.extra-sign-code-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--primary);
  border: 1px solid var(--border);
  font-family: monospace;
}
.extra-sign-img-wrap {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px;
}
.extra-sign-img {
  max-width: 100%;
  max-height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}
.extra-sign-fallback-icon {
  font-size: 2.2rem;
  color: var(--muted);
}
.extra-sign-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.extra-sign-name-ar {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.extra-sign-name-fr {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  direction: ltr;
  text-align: right;
  margin-top: 2px;
}
@media (max-width: 640px) {
  .extra-signs-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
    gap: 10px;
  }
  .extra-sign-img-wrap {
    height: 85px;
  }
  .extra-signs-head {
    padding: 16px;
  }
  .extra-signs-controls {
    padding: 12px 16px;
  }
  .extra-signs-body {
    padding: 16px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   LESSONS VIEW UPGRADE — Axes Cards, Law 52.05 Reference & Q&A Accordion
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Main Hub Navigation Tabs ── */
.lessons-main-nav-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 26px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lessons-main-nav-tabs::-webkit-scrollbar {
  display: none;
}
.lessons-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
.lessons-nav-tab:hover {
  background: var(--surface-2);
  border-color: var(--primary, #FF7A00);
  transform: translateY(-1px);
}
.lessons-nav-tab.active {
  background: var(--primary, #FF7A00);
  border-color: var(--primary, #FF7A00);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(255, 122, 0, 0.35);
}
.lessons-nav-tab .tab-emoji {
  font-size: 1.15rem;
  line-height: 1;
}
.lessons-nav-tab .tab-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
}
.lessons-nav-tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

/* ── 2. Top View: 6 Official Axes Cards (محاور التكوين صنف B) ── */
.lessons-axes-section {
  margin-bottom: 30px;
}
.lessons-axes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lessons-axes-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary, #FF7A00);
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 2px;
}
.lessons-axes-heading {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
  margin: 0;
}
/* (تم توحيد .axis-cards-grid و .axis-wide-card أعلاه مع .cat-grid و .cat-tile بتصميم متطابق وشبكة 3×2) */

/* ── Axis Detail Sub-page (Single Vertical Flow, No Inner Tabs) ── */
.axis-detail-view {
  animation: fadeIn 0.25s ease;
}
.axis-detail-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--border);
  flex-wrap: wrap;
}
.axis-detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-family: var(--font-heading);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.9rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}
.axis-detail-back-btn:hover {
  background: var(--primary, #FF7A00);
  border-color: var(--primary, #FF7A00);
  color: #fff;
  transform: translateX(2px);
}
.axis-detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 24px;
  border-radius: 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  position: relative;
  overflow: hidden;
}
.axis-detail-hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary, #FF7A00), #FFA048);
}
@media (max-width: 640px) {
  .axis-detail-hero {
    flex-direction: column;
    padding: 18px 20px;
    gap: 14px;
  }
}
.axis-detail-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
}
.axis-detail-hero-content {
  flex: 1;
}
.axis-detail-hero-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary, #FF7A00);
  margin-bottom: 4px;
}
.axis-detail-hero-title {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: var(--font-heading);
  color: var(--text);
  margin: 0 0 6px;
}
.axis-detail-hero-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 12px;
}
.axis-detail-hero-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.axis-detail-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
}
.axis-hero-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1.5px solid var(--primary, #FF7A00);
  color: var(--primary, #FF7A00);
  background: rgba(255, 122, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}
.axis-hero-audio-btn:hover {
  background: var(--primary, #FF7A00);
  color: #fff;
}

/* ── 4 Logical Sections Vertical Flow ── */
.axis-vertical-flow {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 16px;
}
.axis-flow-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 24px 26px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease;
}
.axis-flow-section:hover {
  border-color: rgba(255, 122, 0, 0.3);
}
.axis-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--border);
  flex-wrap: wrap;
}
.axis-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.axis-section-icon {
  font-size: 1.55rem;
  line-height: 1;
}
.axis-section-title {
  font-size: 1.22rem;
  font-weight: 900;
  font-family: var(--font-heading);
  color: var(--text);
  margin: 0;
}
.axis-section-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary, #FF7A00);
  border: 1px solid var(--border);
}
.axis-section-lead-text {
  font-size: 0.92rem;
  color: var(--muted);
  margin: -6px 0 18px;
  line-height: 1.5;
}
.axis-section-content {
  display: flex;
  flex-direction: column;
}

/* ── Interactive Tap-to-Reveal Scenario Cards ── */
.scenarios-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.scenario-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease;
}
.scenario-card:hover {
  border-color: rgba(255, 122, 0, 0.4);
}
.scenario-card.is-revealed {
  border-color: var(--primary, #FF7A00);
  box-shadow: 0 6px 22px rgba(255, 122, 0, 0.1);
}

.scenario-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}
.scenario-head:hover {
  background: var(--surface-2);
}
.scenario-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.scenario-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.scenario-head-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scenario-badge {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--primary, #FF7A00);
}
.scenario-title {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
  margin: 0;
}
.scenario-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.scenario-audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}
.scenario-audio-btn:hover {
  border-color: var(--primary, #FF7A00);
  color: var(--primary, #FF7A00);
  transform: scale(1.06);
}
.scenario-audio-btn.is-playing {
  background: var(--primary, #FF7A00);
  border-color: var(--primary, #FF7A00);
  color: #fff;
  animation: pulseAudio 1.5s infinite;
}
.scenario-reveal-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-heading);
  border: 1.5px solid var(--primary, #FF7A00);
  background: rgba(255, 122, 0, 0.08);
  color: var(--primary, #FF7A00);
  cursor: pointer;
  transition: all 0.2s ease;
}
.scenario-reveal-toggle-btn:hover {
  background: var(--primary, #FF7A00);
  color: #fff;
}
.scenario-card.is-revealed .scenario-reveal-toggle-btn {
  background: var(--primary, #FF7A00);
  color: #fff;
}
.scenario-reveal-toggle-btn .reveal-toggle-arrow {
  display: inline-block;
  font-size: 0.72rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.scenario-card.is-revealed .reveal-toggle-arrow {
  transform: rotate(180deg);
}

.scenario-situation-box {
  padding: 16px 20px 12px;
}
.scenario-situation-box .situation-callout {
  margin: 0;
}

/* Collapsible tap-to-reveal drawer with smooth grid animation */
.scenario-revealed-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease;
  opacity: 0;
}
.scenario-card.is-revealed .scenario-revealed-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
}
.scenario-revealed-inner {
  overflow: hidden;
  padding: 0 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.scenario-card.is-revealed .scenario-revealed-inner {
  animation: scenarioContentFadeIn 0.35s ease forwards;
}

@keyframes scenarioContentFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Horizontal Markings and Traffic Hierarchy Helpers ── */
.marking-visual-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}
.marking-svg-wrap {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}
.traffic-hierarchy-banner {
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.08), rgba(10, 132, 255, 0.08));
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 24px;
}
.axis-signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}
.signs-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)) !important;
  gap: 16px !important;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 900px) {
  .signs-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)) !important;
    gap: 14px !important;
  }
}
@media (max-width: 600px) {
  .signs-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)) !important;
    gap: 10px !important;
  }
}
@media (max-width: 340px) {
  .signs-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}
.axis-sign-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}
.axis-sign-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #FF7A00);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.axis-sign-img-wrap {
  height: 130px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.axis-sign-code {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--primary, #FF7A00);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.axis-sign-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.axis-sign-name-ar {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.axis-sign-name-fr {
  font-size: 0.8rem;
  color: var(--muted);
  direction: ltr;
  text-align: right;
  margin-bottom: 8px;
}
.axis-sign-rule {
  font-size: 0.76rem;
  color: var(--text-soft);
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 8px;
  margin-top: auto;
  line-height: 1.4;
}

/* ── Axis Law Cards ── */
.axis-law-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.axis-law-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  border-right: 4px solid var(--primary, #FF7A00);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.axis-law-item:hover {
  transform: translateX(-2px);
  border-color: rgba(255, 122, 0, 0.4);
}
.axis-law-item-title {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text);
  margin: 0 0 6px;
}
.axis-law-item-text {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 0;
}

/* ── Responsive Adaptations for Mobile (<= 768px) and Desktop (>= 769px) ── */
@media (max-width: 768px) {
  .axis-flow-section {
    padding: 16px 14px;
    border-radius: 18px;
  }
  .axis-section-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
  }
  .axis-section-title {
    font-size: 1.1rem;
  }
  .scenario-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .scenario-head-left {
    width: 100%;
  }
  .scenario-head-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }
  .scenario-reveal-toggle-btn {
    flex: 1;
    justify-content: center;
    min-height: 40px;
  }
  .scenario-situation-box {
    padding: 12px 14px 10px;
  }
  .scenario-revealed-inner {
    padding: 0 14px 14px;
  }
  .axis-signs-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
    gap: 10px;
  }
  .axis-sign-img-wrap {
    height: 100px;
    padding: 8px;
  }
  .axis-sign-info {
    padding: 10px;
  }
  .axis-sign-name-ar {
    font-size: 0.88rem;
  }
}

@media (min-width: 769px) {
  .axis-flow-section {
    padding: 26px 28px;
  }
  .scenario-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  }
  .scenario-card.is-revealed:hover {
    box-shadow: 0 10px 28px rgba(255, 122, 0, 0.15);
  }
}

/* Dark mode overrides for Axis components */
[data-theme="dark"] .axis-wide-card,
[data-theme="dark"] .axis-detail-hero,
[data-theme="dark"] .axis-subtab-btn,
[data-theme="dark"] .scenario-card,
[data-theme="dark"] .axis-sign-card,
[data-theme="dark"] .axis-law-item,
[data-theme="dark"] .axis-detail-back-btn {
  background: #1E222B;
  border-color: #272B36;
}
[data-theme="dark"] .axis-wide-card.is-active {
  background: rgba(255, 122, 0, 0.12);
  border-color: var(--primary, #FF7A00);
}
[data-theme="dark"] .axis-card-icon,
[data-theme="dark"] .axis-thin-bar,
[data-theme="dark"] .axis-detail-hero-icon,
[data-theme="dark"] .axis-detail-progress-pill,
[data-theme="dark"] .axis-sign-img-wrap,
[data-theme="dark"] .axis-sign-rule,
[data-theme="dark"] .axis-pct-badge {
  background: #161920;
}

/* ── 3. Moroccan Law 52.05 Reference Cards (المخالفات والنقط) ── */
.law-ref-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}
.law-ref-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}
.law-ref-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}
.law-ref-card.is-expanded {
  border-color: var(--primary, #FF7A00);
}
.law-ref-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background 0.15s ease;
}
.law-ref-header:hover {
  background: var(--surface-2);
}
.law-ref-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.law-ref-icon {
  font-size: 1.7rem;
  line-height: 1;
  flex-shrink: 0;
}
.law-ref-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.law-ref-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.law-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
}
.law-badge-blue { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.law-badge-red { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.law-badge-orange { background: rgba(249, 115, 22, 0.12); color: #ea580c; }
.law-badge-amber { background: rgba(234, 179, 8, 0.14); color: #b45309; }
.law-badge-green { background: rgba(16, 185, 129, 0.12); color: #059669; }
.law-badge-purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }

.law-ref-title {
  font-family: var(--font-heading);
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.law-ref-summary {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}
.law-ref-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--muted);
  transition: transform 0.25s ease, background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}
.law-ref-card.is-expanded .law-ref-arrow {
  transform: rotate(180deg);
  background: var(--primary, #FF7A00);
  color: #ffffff;
}
.law-ref-body {
  display: none;
  padding: 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.law-ref-card.is-expanded .law-ref-body {
  display: block;
}
.law-fines-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.law-fine-pill {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill-red { background: rgba(239, 68, 68, 0.1); color: #dc2626; border-color: rgba(239, 68, 68, 0.25); }
.pill-orange { background: rgba(249, 115, 22, 0.1); color: #c2410c; border-color: rgba(249, 115, 22, 0.25); }
.pill-amber { background: rgba(234, 179, 8, 0.1); color: #b45309; border-color: rgba(234, 179, 8, 0.25); }
.pill-green { background: rgba(16, 185, 129, 0.1); color: #047857; border-color: rgba(16, 185, 129, 0.25); }
.pill-purple { background: rgba(124, 58, 237, 0.1); color: #6d28d9; border-color: rgba(124, 58, 237, 0.25); }
.pill-points { background: var(--surface); color: var(--primary, #FF7A00); border-color: var(--primary, #FF7A00); font-weight: 800; }

.law-cases-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
}
.law-cases-list strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 8px;
}
.law-cases-list ul {
  margin: 0;
  padding-inline-start: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text);
}
.law-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.law-detail-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.law-box-head {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary, #FF7A00);
  margin-bottom: 8px;
}
.law-detail-box p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text);
}

/* Dark Mode Overrides for Law Cards */
[data-theme="dark"] .law-badge-blue { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
[data-theme="dark"] .law-badge-red { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .law-badge-orange { background: rgba(249, 115, 22, 0.25); color: #fdba74; }
[data-theme="dark"] .law-badge-amber { background: rgba(234, 179, 8, 0.25); color: #fde047; }
[data-theme="dark"] .law-badge-green { background: rgba(16, 185, 129, 0.25); color: #6ee7b7; }
[data-theme="dark"] .law-badge-purple { background: rgba(124, 58, 237, 0.25); color: #c4b5fd; }

[data-theme="dark"] .pill-red { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
[data-theme="dark"] .pill-orange { background: rgba(249, 115, 22, 0.2); color: #fdba74; border-color: rgba(249, 115, 22, 0.35); }
[data-theme="dark"] .pill-amber { background: rgba(234, 179, 8, 0.2); color: #fde047; border-color: rgba(234, 179, 8, 0.35); }
[data-theme="dark"] .pill-green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); }
[data-theme="dark"] .pill-purple { background: rgba(124, 58, 237, 0.2); color: #c4b5fd; border-color: rgba(124, 58, 237, 0.35); }
[data-theme="dark"] .pill-points { background: var(--surface); color: var(--primary, #FF7A00); border-color: var(--primary, #FF7A00); }

/* ── 4. Candidate Q&A Accordion (ركن الأسئلة والأجوبة) ── */
.qa-accordion-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}
.qa-accordion-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.qa-accordion-card:hover {
  border-color: var(--border-strong);
}
.qa-accordion-card.is-expanded {
  border-color: var(--primary, #FF7A00);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}
.qa-accordion-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background 0.15s ease;
}
.qa-accordion-head:hover {
  background: var(--surface-2);
}
.qa-accordion-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.qa-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary, #FF7A00);
  color: #ffffff !important;
  font-size: 0.92rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.qa-question-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}
.qa-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform 0.25s ease, background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}
.qa-accordion-card.is-expanded .qa-arrow {
  transform: rotate(180deg);
  background: var(--primary, #FF7A00);
  color: #ffffff;
}
.qa-accordion-body {
  display: none;
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-direction: column;
  gap: 12px;
}
.qa-accordion-card.is-expanded .qa-accordion-body {
  display: flex;
}



/* ═══════════════ PRE-SERIES LAUNCH SCREEN ═══════════════════════════════ */
.pre-series-page {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px 40px;
}
.pre-series-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 14px;
}
.pre-series-back-btn {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary, #FF7A00);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.pre-series-back-btn:hover {
  background: var(--primary-soft, rgba(255, 122, 0, 0.12));
  color: var(--primary-strong, #EA6C00);
}

.pre-series-header {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.pre-series-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.badge-series-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-soft, rgba(255, 122, 0, 0.14));
  color: var(--primary, #FF7A00);
  border: 1px solid var(--primary-mid, rgba(255, 122, 0, 0.3));
}
.badge-target {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.28);
}
.pre-series-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.3;
}
.pre-series-subtitle {
  font-size: 0.92rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pre-series-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 900px) {
  .pre-series-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.pre-series-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.pre-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--text);
}
.pre-card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.pre-card-head-row .pre-card-title {
  margin: 0;
}

/* بطاقات اختيار الوضع */
.pre-mode-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pre-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.pre-mode-card:hover {
  border-color: var(--primary-mid, rgba(255, 122, 0, 0.4));
  background: var(--surface);
  transform: translateY(-1px);
}
.pre-mode-card:focus-visible {
  outline: 2px solid var(--primary, #FF7A00);
  outline-offset: 2px;
}
.pre-mode-card.is-active {
  border-color: var(--primary, #FF7A00);
  background: var(--primary-soft, rgba(255, 122, 0, 0.1));
  box-shadow: 0 4px 14px rgba(255, 122, 0, 0.15);
}
.pre-mode-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s ease;
}
.pre-mode-card.is-active .pre-mode-radio {
  border-color: var(--primary, #FF7A00);
  background: #FF7A00;
}
.pre-mode-radio .radio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.2s ease;
}
.pre-mode-card.is-active .pre-mode-radio .radio-dot {
  background: #ffffff;
}

.pre-mode-content {
  flex: 1;
}
.pre-mode-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.pre-mode-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}
.pre-mode-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.pre-mode-tag.tag-review {
  background: rgba(255, 122, 0, 0.14);
  color: #FF7A00;
  border-color: rgba(255, 122, 0, 0.3);
}
.pre-mode-desc {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* اختيار المؤقت */
.pre-timer-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 360px) {
  .pre-timer-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.pre-timer-btn {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 12px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}
.pre-timer-btn:hover {
  border-color: var(--primary-mid, rgba(255, 122, 0, 0.4));
  background: var(--surface);
}
.pre-timer-btn strong {
  font-size: 0.95rem;
  font-weight: 800;
}
.pre-timer-btn small {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.pre-timer-btn.is-active {
  border-color: var(--primary, #FF7A00);
  background: var(--primary, #FF7A00);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.3);
}
.pre-timer-btn.is-active small {
  color: rgba(255, 255, 255, 0.88);
}

/* ── School QR Learner Login ─────────────────────────────────────────── */
.auth-qr-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.auth-qr-trigger:hover {
  border-color: var(--primary, #FF7A00);
  color: var(--primary, #FF7A00);
}
.qr-login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 8px 0 4px;
}
.qr-login-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.qr-login-sub {
  margin: 0;
}
.qr-svg-wrap {
  display: grid;
  place-items: center;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 244px;
  min-height: 244px;
}
.qr-svg-wrap svg {
  display: block;
  max-width: 100%;
  height: auto;
}
.qr-status-msg {
  font-weight: 600;
  color: var(--muted);
}
.qr-status-msg.is-ok {
  color: var(--success, #16a34a);
}
.qr-status-msg.is-expired {
  color: var(--danger, #dc2626);
}
.qr-token-code {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}
.qr-token-code code {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  word-break: break-all;
  user-select: all;
}
.qr-login-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
.school-qr-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.school-qr-controls select {
  flex: 1 1 240px;
  min-width: 0;
}
.school-qr-scanner {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.school-qr-cam-wrap {
  position: relative;
  width: 100%;
  max-width: 340px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.school-qr-cam-wrap video {
  display: block;
  width: 100%;
  height: auto;
}
.school-qr-frame {
  position: absolute;
  inset: 18%;
  border: 2px solid var(--primary, #FF7A00);
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
}
.school-qr-manual {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.school-qr-manual input {
  flex: 1 1 220px;
  min-width: 0;
}
.school-qr-feedback {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}
.school-qr-feedback.is-success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success, #16a34a);
}
.school-qr-feedback.is-error {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger, #dc2626);
}

/* زر البدء */
.pre-cta-wrap {
  margin-top: 18px;
}
.pre-start-cta {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  width: 100%;
  padding: 16px 24px;
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--primary, #FF7A00);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 122, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.pre-start-cta:hover {
  background: var(--primary-strong, #EA6C00);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.45);
}
.pre-start-cta:active {
  transform: scale(0.98);
}
.cta-arrow {
  font-size: 1.3rem;
  line-height: 1;
}

/* نشاط السلسلة KPIs */
.pre-activity-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 520px) {
  .pre-activity-kpis {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.pre-kpi-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.pre-kpi-label {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 700;
}
.pre-kpi-val-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pre-kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.pre-kpi-value.text-pass {
  color: #16a34a !important;
}
.pre-kpi-value.text-fail {
  color: #ea580c !important;
}
.pre-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  display: inline-block;
}
.pre-badge-pass {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.pre-badge-fail {
  background: rgba(234, 88, 12, 0.15);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.3);
}
.pre-badge-new {
  background: var(--border);
  color: var(--muted);
}

/* رسم بياني لتتبع المستوى */
.pre-chart-card {
  position: relative;
}
.chart-container {
  position: relative;
  padding: 8px 0 4px;
}
.chart-plot-area {
  position: relative;
  height: 140px;
  margin-top: 26px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border);
}
.chart-threshold-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 80%;
  height: 0;
  border-top: 2px dashed #16a34a;
  z-index: 3;
  pointer-events: none;
}
.chart-threshold-badge {
  position: absolute;
  inset-inline-end: 0;
  top: -12px;
  background: var(--surface);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.35);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.chart-cols-row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 8px;
  z-index: 2;
}
.chart-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  max-width: 48px;
}
.chart-score-bubble {
  position: absolute;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition: bottom 0.3s ease;
  z-index: 4;
}
.score-pass {
  color: #16a34a;
}
.score-fail {
  color: #ea580c;
}
.chart-bar-fill {
  width: 100%;
  min-width: 22px;
  border-radius: 8px 8px 0 0;
  position: relative;
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-pass {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.bar-fail {
  background: linear-gradient(180deg, #FF7A00, #ea580c);
  box-shadow: 0 2px 8px rgba(255, 122, 0, 0.3);
}
.chart-col-empty .chart-placeholder-bar {
  width: 100%;
  min-width: 22px;
  height: 100%;
  border: 1.5px dashed var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: rgba(0, 0, 0, 0.02);
}
.chart-col-label {
  position: absolute;
  top: calc(100% + 6px);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.chart-empty-state {
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: var(--surface-2);
  border-radius: 14px;
  margin-top: 10px;
  border: 1.5px dashed var(--border);
  padding: 16px;
}

/* ── Dark Mode Overrides for Pre-Series View ── */
[data-theme="dark"] .chart-threshold-line {
  border-top-color: #22c55e;
}
[data-theme="dark"] .chart-threshold-badge {
  background: var(--surface-1);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}
[data-theme="dark"] .score-pass {
  color: #4ade80;
}
[data-theme="dark"] .score-fail {
  color: #fb923c;
}
[data-theme="dark"] .pre-kpi-value.text-pass {
  color: #4ade80 !important;
}
[data-theme="dark"] .pre-kpi-value.text-fail {
  color: #fb923c !important;
}
[data-theme="dark"] .pre-badge-pass {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}
[data-theme="dark"] .pre-badge-fail {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.35);
}
[data-theme="dark"] .chart-col-empty .chart-placeholder-bar {
  background: rgba(255, 255, 255, 0.03);
}
/* ── Axis & Topic Detail View Enhancements ── */
.topic-detail-view .axis-detail-hero {
  border-right: 5px solid var(--primary, #FF7A00);
}

.topic-steps-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topic-step-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-step-card:hover {
  box-shadow: var(--shadow);
}

.topic-signs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface-2);
  padding: 12px 14px;
  border-radius: 14px;
}

.topic-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.topic-complete-btn {
  font-weight: 800;
  padding: 10px 22px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topic-next-btn {
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hierarchy-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .topic-step-card {
    padding: 16px;
    border-radius: 16px;
  }
  .topic-bottom-bar {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .topic-bottom-bar button {
    width: 100%;
    justify-content: center;
  }
  .hierarchy-flow-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode overrides for Topic components */
[data-theme="dark"] .topic-step-card,
[data-theme="dark"] .topic-bottom-bar {
  background: #1E222B;
  border-color: #272B36;
}
[data-theme="dark"] .topic-signs-row {
  background: #161920;
}

/* ════════════════════════════════════════════════════════════
   المصادر — Sources Section (Super Admin only)
   ════════════════════════════════════════════════════════════ */
.sources-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 900px) {
  .sources-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1300px) {
  .sources-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.src-card { padding: 20px 24px; }
.src-card-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding-bottom: 10px;
}

/* ── Stats row ── */
.src-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.src-stat {
  background: var(--bg-alt, #f8fafc);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.src-stat-val {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary, #2563eb);
}
.src-stat-lbl {
  display: block;
  font-size: .72rem;
  color: var(--muted, #6b7280);
  margin-top: 2px;
}

/* ── Keys table ── */
.src-table-wrap { overflow-x: auto; margin-bottom: 14px; }
.src-key-table { width: 100%; font-size: .875rem; }
.src-key-mono { font-family: monospace; letter-spacing: .05em; }
.src-key-actions { white-space: nowrap; text-align: left; }
.src-badge { font-size: .72rem; padding: 2px 7px; }
.btn-xs { padding: 3px 8px; font-size: .78rem; }

/* ── Actions bar ── */
.src-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Inline form ── */
.src-inline-form {
  background: var(--bg-alt, #f8fafc);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.src-form-actions { display: flex; gap: 8px; }

/* ── Result / progress box ── */
.src-result-box {
  background: var(--bg-alt, #f8fafc);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .875rem;
  line-height: 1.6;
  margin-top: 10px;
}
.src-test-line { padding: 2px 0; }
.src-test-line.ok  { color: var(--success, #16a34a); }
.src-test-line.fail { color: var(--danger, #dc2626); }
.src-error { color: var(--danger, #dc2626); font-weight: 600; }

/* ── Notice box ── */
.src-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .875rem;
  line-height: 1.5;
  color: #1e40af;
}
[data-theme="dark"] .src-notice {
  background: #1e3a5f;
  border-color: #2563eb;
  color: #93c5fd;
}
.src-notice-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── File input ── */
.src-file-input { cursor: pointer; }

/* ── Sources list (card 3) ── */
.src-source-list { display: flex; flex-direction: column; gap: 12px; }
.src-source-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-alt, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb);
}
.src-source-item > div { flex: 1; }
.src-source-icon { font-size: 1.5rem; flex-shrink: 0; }
.src-pill-sm { font-size: .7rem; padding: 2px 8px; white-space: nowrap; }

/* ── Pill colours (ensure pill-ok / pill-warn / pill-danger exist) ── */
.pill-ok   { background: #dcfce7; color: #15803d; }
.pill-warn { background: #fef9c3; color: #854d0e; }

/* ── Dark mode ── */
[data-theme="dark"] .src-stat,
[data-theme="dark"] .src-inline-form,
[data-theme="dark"] .src-result-box,
[data-theme="dark"] .src-source-item {
  background: #1e222b;
  border-color: #272b36;
}
[data-theme="dark"] .src-stat-val { color: #60a5fa; }

/* ════════════════════════════════════════════════════════════
   نافذة تفاصيل علامة التشوير — Sign Detail Modal (/signs & /lessons Axis 7)
   ════════════════════════════════════════════════════════════ */
.sdm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(5px);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sdm-dialog {
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border-radius: 22px;
  border: 1.5px solid var(--border, #e2e8f0);
  max-width: 520px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: sdmPop 0.18s ease-out;
}

@keyframes sdmPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.sdm-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 20px 10px;
  background: var(--surface-2, #f8fafc);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.sdm-badge {
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary, #2563eb);
  background: var(--primary-soft, rgba(37, 99, 235, 0.1));
  padding: 4px 10px;
  border-radius: 999px;
}

.sdm-counter {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted, #64748b);
}

.sdm-img-wrap {
  background: var(--surface-2, #f8fafc);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 185px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.sdm-img-wrap img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12));
}

.sdm-body {
  padding: 20px 22px 22px;
}

.sdm-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin: 0 0 4px;
  color: var(--text, #0f172a);
  line-height: 1.35;
}

.sdm-title-fr {
  font-size: 0.88rem;
  color: var(--muted, #64748b);
  direction: ltr;
  text-align: right;
  margin-bottom: 12px;
}

.sdm-placement {
  background: var(--surface-2, #f8fafc);
  border-right: 4px solid var(--primary, #2563eb);
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
}

.sdm-desc {
  font-size: 0.92rem;
  color: var(--text-soft, #334155);
  line-height: 1.65;
  margin: 0 0 12px;
}

.sdm-darija {
  background: rgba(234, 88, 12, 0.08);
  border: 1px solid rgba(234, 88, 12, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.sdm-audio-row {
  margin-bottom: 14px;
}

.sdm-listen-btn {
  width: 100%;
  justify-content: center;
  font-weight: 800;
  gap: 8px;
}

.sdm-listen-btn.is-playing {
  opacity: 0.92;
}

/* Sign audio not yet generated — show "قريباً" muted placeholder */
.sdm-listen-btn.sdm-no-audio {
  opacity: 0.55;
  cursor: default;
  background: var(--surface-3, #e2e8f0);
  color: var(--muted, #64748b);
  border-color: var(--border, #e2e8f0);
  pointer-events: none;
}

.sdm-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.sdm-nav-btn,
.sdm-close-btn {
  justify-content: center;
  font-weight: 700;
}

.extra-sign-card {
  cursor: pointer;
}
.extra-sign-card:hover,
.sign-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 8px 20px rgba(0, 0, 0, 0.08));
}

@media (max-width: 480px) {
  .sdm-body { padding: 16px; }
  .sdm-title { font-size: 1.15rem; }
  .sdm-img-wrap { min-height: 150px; padding: 16px; }
  .sdm-img-wrap img { width: 120px; height: 120px; }
}


/* ══════════════════════════════════════════════════════════════════════
   UNIFIED STAFF VIEWS — School / Instructor / Admin / Auth / Live
   Design system: matches Learner UI (#161920 dark, #FF7A00 primary,
   Cairo headings, IBM Plex Sans Arabic body, 44px+ touch targets)
   ══════════════════════════════════════════════════════════════════════ */

/* ── Staff shell page-head ───────────────────────────────────────────── */
.page-head h1,
.page-header h1,
.page-head h2,
.page-header h2 {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text);
  margin: 0;
}
.page-head,
.page-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ── Dash KPI tiles ──────────────────────────────────────────────────── */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dash-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
  min-height: 100px;
  min-width: 0;
  overflow: hidden;
}
.dash-kpi:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.dash-kpi.no-link { cursor: default; }
.dash-kpi.no-link:hover { transform: none; border-color: var(--border); box-shadow: var(--shadow-sm); }
.dash-kpi-ic {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 4px;
}
.dash-kpi .muted { font-size: .78rem; font-weight: 600; color: var(--muted); }
.dash-kpi strong {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

/* ── Dash section heading ──────────────────────────────────────────── */
.dash-h {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.01em;
}

/* ── Dash horizontal bar charts ───────────────────────────────────── */
.dash-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  padding: 0 4px;
  margin-bottom: 8px;
}
.dash-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  min-width: 0;
}
.dash-bar {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.dash-bar i {
  display: block;
  width: 100%;
  min-height: 2px;
}
.dash-bar-col .small.muted {
  font-size: .65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Horizontal row charts (progress / load) */
.dash-hrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  min-width: 0;
  transition: background var(--dur) var(--ease), padding var(--dur) var(--ease);
  border-radius: 6px;
}
.dash-hrow:last-child { border-bottom: 0; }
.dash-hrow:hover { background: var(--surface-2); padding-inline: 8px; }
.dash-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 0;
}
.dash-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width .4s var(--ease);
}
.dash-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
}

/* ── Dash day slots (school schedule) ────────────────────────────── */
.dash-day { margin-bottom: 16px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dash-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text);
  min-width: 100px;
  transition: border-color var(--dur), box-shadow var(--dur);
  font-size: .85rem;
}
.dash-chip:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.dash-chip.is-full { opacity: .75; border-color: var(--danger-mid); background: var(--danger-soft); }
.dash-chip b { font-family: var(--font-heading); font-size: .95rem; }

/* ── Dash legend / seg ────────────────────────────────────────────── */
.dash-seg {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.dash-seg button {
  padding: 6px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
  min-height: 36px;
  white-space: nowrap;
}
.dash-seg button.on,
.dash-seg button:hover {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.dash-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.dash-stack {
  display: flex;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 4px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.dash-stack i {
  display: block;
  height: 100%;
  transition: flex .4s var(--ease);
}
.dash-lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: opacity var(--dur), background var(--dur);
  min-height: 36px;
}
.dash-lg.off { opacity: .4; }
.dash-lg:hover { background: var(--surface-2); }
.dash-tip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 999;
  pointer-events: none;
  color: var(--text);
  max-width: 280px;
  white-space: nowrap;
}

/* ── Instructor home ──────────────────────────────────────────────── */
.ins { display: flex; flex-direction: column; gap: 0; }
.ins-hello {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 20px;
  color: var(--text);
}
.ins-slot {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  min-width: 0;
}
.ins-slot:last-child { border-bottom: 0; }
.ins-hour {
  font-family: var(--font-heading);
  font-size: .95rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 56px;
  flex: none;
}
.ins-slot-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ins-people { display: flex; flex-wrap: wrap; gap: 6px; }
.ins-loc { font-size: .8rem; color: var(--muted); }
.ins-seats {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 8px;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.ins-seats.is-full { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-mid); }
.ins-day { margin-bottom: 16px; }
.ins-name { font-weight: 700; flex: none; min-width: 90px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-meta { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* ── Pulsing live dot ─────────────────────────────────────────────── */
.pulsing-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 40%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 0%, transparent); }
}

/* ── Action buttons row (admin tables) ───────────────────────────── */
.act-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.act-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.act-btn.act-danger { color: var(--danger); border-color: var(--danger-mid); }
.act-btn.act-danger:hover { background: var(--danger-soft); }
.act-lbl { font-size: .72rem; }
@media (max-width: 640px) { .act-lbl { display: none; } }

/* ── List table ──────────────────────────────────────────────────── */
.list-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.list-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 14px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.list-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-table tr:last-child td { border-bottom: 0; }
.list-table tr:hover td { background: var(--surface-2); }
.list-table a { color: var(--primary); font-weight: 600; text-decoration: none; }
.list-table a:hover { text-decoration: underline; }

/* ── Input unified style ──────────────────────────────────────────── */
.input {
  font: inherit;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
  width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  box-sizing: border-box;
  font-size: .95rem;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
select.input { appearance: auto; cursor: pointer; }

/* ── Auth view ───────────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 60vh;
  padding: 24px 16px 48px;
}
.auth-wrap--simple { align-items: center; }
.auth-wrap--narrow { align-items: center; }
.auth-form-area { width: 100%; max-width: 440px; }
.auth-card-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}
.auth-card-box--center { text-align: center; }
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 9px 16px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
  min-height: 44px;
  white-space: nowrap;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.auth-tab:hover:not(.active) { color: var(--text); }
.auth-pane { animation: fade-in .2s var(--ease); }
.auth-pane.hidden { display: none; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .field label { font-weight: 700; font-size: .88rem; display: block; margin-bottom: 5px; }
.auth-submit {
  width: 100%;
  margin-top: 4px;
  font-size: 1rem;
  min-height: 48px;
  border-radius: 10px;
  font-weight: 800;
}
.auth-name-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.auth-pass-hint {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .84rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.auth-divider hr { flex: 1; border: 0; border-top: 1px solid var(--border); }
.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  padding: 10px 16px;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
  margin-bottom: 4px;
}
.auth-google-btn:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  background: var(--surface-2);
}
.auth-google-btn svg { flex: none; }
.auth-qr-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  margin-top: 12px;
  padding: 10px 16px;
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.auth-qr-trigger:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.auth-otp-icon { font-size: 2.5rem; margin-bottom: 12px; }
.auth-form-title { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 800; margin: 0 0 8px; color: var(--text); }
.auth-form-sub { color: var(--muted); font-size: .92rem; margin: 0 0 20px; }
.auth-otp-input {
  text-align: center;
  letter-spacing: .3em;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  min-height: 56px;
  border-radius: 12px;
}
.auth-switch-link {
  text-align: center;
  font-size: .88rem;
  color: var(--muted);
  margin-top: 16px;
}

/* QR login */
.qr-login-box { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 8px 0; }
.qr-login-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 800; margin: 0; text-align: center; }
.qr-login-sub { text-align: center; margin: 0; }
.qr-svg-wrap {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  width: 100%;
}
.qr-svg-wrap svg { max-width: 220px; border-radius: 8px; }
.qr-status-msg {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  min-height: 24px;
  font-weight: 600;
}
.qr-status-msg.is-ok { color: var(--success); }
.qr-status-msg.is-expired { color: var(--danger); }
.qr-token-code {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
}
.qr-token-code code {
  font-size: .8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  letter-spacing: .1em;
  color: var(--primary);
  font-weight: 700;
}
.qr-login-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }

/* ── School QR login section ─────────────────────────────────────── */
.school-qr-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.school-qr-controls .input { flex: 1; min-width: 180px; }
.school-qr-scanner {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.school-qr-cam-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
  max-height: 280px;
}
.school-qr-cam-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.school-qr-frame {
  position: absolute;
  inset: 20%;
  border: 3px solid var(--primary);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35);
}
.school-qr-manual {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.school-qr-manual .input { flex: 1; min-width: 160px; }
.school-qr-feedback {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: .88rem;
}
.school-qr-feedback.is-success { background: var(--success-soft); border-color: var(--success-mid); color: var(--success); }
.school-qr-feedback.is-error { background: var(--danger-soft); border-color: var(--danger-mid); color: var(--danger); }

/* ── Live session join button ────────────────────────────────────── */
.live-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1.5px solid;
  font: inherit;
  font-weight: 800;
  font-size: .88rem;
  cursor: pointer;
  min-height: 44px;
  transition: all var(--dur) var(--ease);
}
.live-join-btn.is-live {
  background: var(--success-soft);
  border-color: var(--success-mid);
  color: var(--success);
  animation: live-pulse 2s ease-in-out infinite;
}
.live-join-btn.is-waiting {
  background: var(--warning-soft);
  border-color: var(--warning-mid);
  color: var(--warning);
}
.live-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); }
}

/* ── Live admin toolbar ──────────────────────────────────────────── */
#live-instructor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.live-badge.live {
  background: var(--success-soft);
  border-color: var(--success-mid);
  color: var(--success);
}
.live-badge.waiting {
  background: var(--warning-soft);
  border-color: var(--warning-mid);
  color: var(--warning);
}
.live-connection-dot { font-size: 1rem; color: var(--muted); }
.live-connection-dot.connected { color: var(--success); }
.live-connection-dot.error { color: var(--danger); }
.live-conn-wrap { display: flex; align-items: center; gap: 6px; }

/* Live leaderboard */
.live-lb-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
}
.live-lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  font-size: .9rem;
}
.live-lb-row:last-child { border-bottom: 0; }
.live-lb-rank { font-family: var(--font-heading); font-weight: 800; min-width: 28px; color: var(--muted); }
.live-lb-name { flex: 1; font-weight: 600; }
.live-lb-score { font-family: var(--font-heading); font-weight: 800; color: var(--primary); }

/* Live results */
.live-results-full {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}
.live-results-score {
  text-align: center;
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.live-score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
}
.live-score-ic { font-size: 1.8rem; }
.live-results-num {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
}
.live-results-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.live-wrong-count { margin-top: 8px; font-size: .88rem; font-weight: 700; color: var(--danger); }
.live-wrong-count.correct-all { color: var(--success); }
.live-results-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.live-results-q.correct { border-color: var(--success-mid); }
.live-results-q.wrong { border-color: var(--danger-mid); }
.live-results-q-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.live-results-q.correct .live-results-q-header { background: var(--success-soft); border-color: var(--success-mid); }
.live-results-q.wrong .live-results-q-header { background: var(--danger-soft); border-color: var(--danger-mid); }
.live-results-q-num { font-weight: 800; font-size: .85rem; color: var(--muted); flex: none; }
.live-results-q-ic { font-size: .9rem; flex: none; }
.live-results-q-text { font-size: .9rem; font-weight: 600; }
.live-results-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.live-results-opt:last-child { border-bottom: 0; }
.live-results-opt.correct { background: var(--success-soft); color: var(--success); font-weight: 700; }
.live-results-opt.wrong { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.live-opt-letter {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 800; font-size: .78rem;
  flex: none;
}
.live-results-opt.correct .live-opt-letter { background: var(--success); border-color: transparent; color: #fff; }
.live-results-opt.wrong .live-opt-letter { background: var(--danger); border-color: transparent; color: #fff; }

/* Live waiting/ended */
.live-waiting-room {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
}
.live-waiting-anim { display: flex; gap: 8px; margin-bottom: 4px; }
.live-waiting-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: wave 1.4s ease-in-out infinite;
}
.live-waiting-dot:nth-child(2) { animation-delay: .2s; }
.live-waiting-dot:nth-child(3) { animation-delay: .4s; }
@keyframes wave { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-8px); } }
.live-waiting-icon { font-size: 2.5rem; }
.live-waiting-title { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 800; margin: 0; }
.live-waiting-desc { color: var(--text-soft); margin: 0; }
.live-waiting-hint { color: var(--muted); font-size: .85rem; margin: 0; }
.live-ended-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
}
.live-ended-ic { font-size: 2.5rem; }
.live-recorded {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--success-soft);
  border: 1px solid var(--success-mid);
  border-radius: 10px;
  color: var(--success);
  font-weight: 700;
  font-size: .88rem;
  margin-top: 12px;
}

/* Student control buttons in live */
.live-student-ctrl-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.live-ctrl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.live-ctrl-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.live-ctrl-stop:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-mid); }
.live-ctrl-ic { font-size: 1rem; }

/* ── Responsive adjustments for staff views ──────────────────────── */
@media (max-width: 768px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #live-instructor-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .auth-card-box { padding: 20px 16px; }
  .auth-name-row { grid-template-columns: 1fr; }
  .school-qr-controls { flex-direction: column; align-items: stretch; }
  .school-qr-controls .input { min-width: auto; }
  .dash-chip { min-width: 80px; font-size: .8rem; }
}
@media (max-width: 400px) {
  .dash-kpis { grid-template-columns: 1fr; }
  .dash-kpi { padding: 12px 14px; }
}
@media (min-width: 901px) {
  .dash-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
  .ins-name { max-width: 160px; }
}

/* ── Profile Google Link UI ─────────────────────────────────────────── */
.profile-email-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 6px;
}
.badge-google-linked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--success-soft, rgba(16, 185, 129, 0.12));
  color: var(--success, #10b981);
  border: 1px solid var(--success-mid, rgba(16, 185, 129, 0.28));
  line-height: 1.4;
}
.profile-google-card {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border, #272B36);
  background: var(--surface, #161920);
  margin-top: 16px;
  transition: border-color var(--dur);
}
.profile-google-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.profile-google-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  background: var(--surface-2, #1b1e28);
  border: 1px solid var(--border, #272B36);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}
.profile-google-text {
  flex: 1;
  min-width: 0;
}
.profile-google-text h2 {
  font-size: 1.15rem;
  margin: 0 0 4px 0;
  color: var(--text);
  font-family: var(--font-heading, 'Cairo', sans-serif);
}
.profile-google-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.btn-google-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: .95rem;
  font-family: var(--font-body, 'IBM Plex Sans Arabic', sans-serif);
  background: var(--surface-2, #1b1e28);
  color: var(--text, #fff);
  border: 1px solid var(--border-strong, #373c4d);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;
  max-width: 100%;
}
.btn-google-link:hover {
  background: var(--surface-3, #222634);
  border-color: var(--primary, #FF7A00);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.15);
}
@media (max-width: 520px) {
  .profile-google-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .btn-google-link {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   EUROPEAN MICRO-LEARNING (GDE) CARD-DECK LESSON MODEL — AXIS 1
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Axis 1 Lesson List View ── */
.axis1-lessons-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}
.axis1-lesson-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface, #161920);
  border: 1.5px solid var(--border, #272B36);
  border-radius: 16px;
  padding: 18px 22px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: var(--text, #fff);
  position: relative;
  min-height: 88px;
}
.axis1-lesson-card:hover {
  border-color: var(--primary, #FF7A00);
  background: var(--surface-2, #1d212b);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.12);
}
.axis1-lesson-card:active {
  transform: scale(0.99);
}
.axis1-lesson-num {
  font-family: var(--font-heading, 'Cairo', sans-serif);
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--primary, #FF7A00);
  line-height: 1;
  min-width: 44px;
  text-align: center;
  background: rgba(255, 122, 0, 0.12);
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 122, 0, 0.25);
}
.axis1-lesson-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.axis1-lesson-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text, #fff);
  margin: 0;
  line-height: 1.4;
  font-family: var(--font-heading, 'Cairo', sans-serif);
}
.axis1-lesson-sub {
  font-size: 0.85rem;
  color: var(--text-soft, #94a3b8);
  margin: 0;
  line-height: 1.5;
  white-space: normal;
}
.axis1-lesson-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.axis1-badge-duration {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--surface-2, #1e222c);
  color: var(--text-soft, #94a3b8);
  border: 1px solid var(--border, #272B36);
}
.axis1-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  min-height: 36px;
  transition: all 0.2s ease;
}
.axis1-badge-status.is-done {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.axis1-badge-status.not-done {
  background: rgba(255, 122, 0, 0.14);
  color: #FF7A00;
  border: 1px solid rgba(255, 122, 0, 0.3);
}

/* ── 2. Distraction-Free Micro-Card Player ── */
.micro-card-player {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 32px;
  box-sizing: border-box;
}

/* Player Top Bar */
.micro-player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.micro-player-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  min-height: 40px;
}
.micro-player-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  min-width: 160px;
}
.micro-player-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  font-family: var(--font-heading, 'Cairo', sans-serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.micro-player-counter {
  font-size: 0.82rem;
  font-weight: 900;
  padding: 3px 10px;
  background: rgba(255, 122, 0, 0.15);
  color: #FF7A00;
  border-radius: 999px;
  border: 1px solid rgba(255, 122, 0, 0.3);
  letter-spacing: 0.05em;
}
.micro-player-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  min-height: 40px;
  background: var(--surface-2, #1d212b);
  border: 1.5px solid var(--border, #272B36);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}
.micro-player-audio-btn.is-playing {
  background: rgba(255, 122, 0, 0.2);
  border-color: #FF7A00;
  color: #FF7A00;
  box-shadow: 0 0 12px rgba(255, 122, 0, 0.25);
  animation: audioPulse 1.6s infinite ease-in-out;
}
@keyframes audioPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 122, 0, 0); }
}

/* 4-Step Progress Bar */
.micro-progress-wrap {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 4px 0 8px;
}
.micro-progress-seg {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3, #222634);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.micro-progress-seg.is-active,
.micro-progress-seg.is-done {
  background: #FF7A00;
  box-shadow: 0 0 8px rgba(255, 122, 0, 0.4);
}

/* The Micro-Card Container */
.micro-card-stage {
  background: var(--surface, #161920);
  border: 1.5px solid var(--border, #272B36);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.28s ease-out;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Header & Tag */
.micro-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.micro-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.badge-rule      { background: rgba(14, 165, 233, 0.14); color: #0ea5e9; border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-practical { background: rgba(255, 122, 0, 0.14); color: #FF7A00; border: 1px solid rgba(255, 122, 0, 0.3); }
.badge-quiz      { background: rgba(168, 85, 247, 0.14); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-summary   { background: rgba(16, 185, 129, 0.14); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }

.micro-card-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
  font-family: var(--font-heading, 'Cairo', sans-serif);
}

/* Card 1: Rule Callout & Vector Graphic */
.micro-rule-box {
  background: var(--surface-2, #1c202a);
  border: 1px solid var(--border, #272B36);
  border-right: 4px solid var(--primary, #FF7A00);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}
.micro-svg-visual {
  width: 100%;
  max-width: 100%;
  border-radius: 14px;
  background: var(--surface-2, #181c25);
  border: 1px solid var(--border, #272B36);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}
.micro-svg-visual svg {
  max-width: 100%;
  height: auto;
  display: block;
}
.micro-gauge-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
}
.micro-gauge-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft, #94a3b8);
  text-align: center;
  line-height: 1.5;
  width: 100%;
}
.micro-gauge-subtitle strong {
  color: var(--text, #ffffff);
}
.micro-gauge-badges {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}
.micro-gauge-badge {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.micro-gauge-badge.badge-fail {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.micro-gauge-badge.badge-pass {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Card 2: Interactive Practical Widgets */
.interactive-widget-box {
  background: var(--surface-2, #1a1e27);
  border: 1px solid var(--border, #272B36);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.interactive-widget-desc {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.6;
}

/* NARSA Keypad Console Widget */
.narsa-keypad-console {
  background: #0d1017;
  border: 2px solid #272b36;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}
.narsa-screen {
  background: #07090e;
  border: 1px solid #1f2430;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.narsa-screen-title {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 700;
}
.narsa-screen-digits {
  display: flex;
  gap: 8px;
}
.narsa-digit-pill {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #0ea5e9;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}
.narsa-screen-empty {
  font-size: 0.85rem;
  color: #475569;
  font-style: italic;
}

.narsa-keys-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.narsa-btn-num {
  height: 52px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 1.35rem;
  font-weight: 900;
  font-family: var(--font-heading, 'Cairo', sans-serif);
  background: #1e2433;
  color: #fff;
  border: 2px solid #333a4d;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #121620;
}
.narsa-btn-num:hover {
  background: #2b3347;
  border-color: #0ea5e9;
  color: #0ea5e9;
}
.narsa-btn-num:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #121620;
}
.narsa-btn-num.is-selected {
  background: #0ea5e9;
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 2px 0 #0284c7, 0 0 12px rgba(14, 165, 233, 0.5);
}

.narsa-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.narsa-btn-corr {
  height: 48px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  background: #c2410c;
  color: #fff;
  border: 2px solid #ea580c;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 0 #7c2d12;
}
.narsa-btn-corr:hover { background: #ea580c; }
.narsa-btn-corr:active { transform: translateY(2px); box-shadow: 0 2px 0 #7c2d12; }

.narsa-btn-valider {
  height: 48px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  background: #15803d;
  color: #fff;
  border: 2px solid #16a34a;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 0 #14532d;
}
.narsa-btn-valider:hover { background: #16a34a; }
.narsa-btn-valider:active { transform: translateY(2px); box-shadow: 0 2px 0 #14532d; }

/* 30s Countdown Bar Widget */
.narsa-timer-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0d1017;
  border: 1px solid #272b36;
  border-radius: 12px;
  padding: 12px 14px;
}
.narsa-timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.narsa-timer-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-soft);
}
.narsa-timer-digits {
  font-size: 1.15rem;
  font-weight: 900;
  font-family: monospace;
  color: #FF7A00;
}
.narsa-timer-track {
  height: 8px;
  border-radius: 999px;
  background: #1e2433;
  overflow: hidden;
}
.narsa-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #FF7A00);
  transition: width 0.9s linear;
}

/* Score Simulator Widget (Lesson 1) */
.score-sim-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-bottom: 4px;
  width: 100%;
}
.score-sim-btn {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  background: var(--surface, #161920);
  border: 1.5px solid var(--border, #272B36);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: all 0.15s ease;
}
.score-sim-btn:hover {
  border-color: #FF7A00;
}
.score-sim-btn.is-active {
  background: rgba(255, 122, 0, 0.16);
  border-color: #FF7A00;
  color: #FF7A00;
}
.score-sim-card {
  padding: 16px 18px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}
.score-sim-card.pass {
  background: rgba(16, 185, 129, 0.12);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
}
.score-sim-card.fail {
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
}

/* Dual Question Widget (Lesson 3) */
.dual-q-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dual-part-card {
  background: var(--surface, #161920);
  border: 1px solid var(--border, #272B36);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dual-part-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}
.dual-part-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dual-opt-btn {
  height: 44px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.9rem;
  background: var(--surface-2, #1c202a);
  border: 1.5px solid var(--border, #272B36);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dual-opt-btn:hover { border-color: #0ea5e9; }
.dual-opt-btn.is-active {
  background: #0ea5e9;
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}

/* Card 3: Quick Check Question */
.qc-question-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qc-question-text {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}
.qc-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qc-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--surface-2, #1b1e27);
  border: 1.5px solid var(--border, #272B36);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 48px;
  width: 100%;
}
.qc-option-btn:hover:not(:disabled) {
  border-color: #a855f7;
  background: var(--surface-3, #222634);
}
.qc-option-btn.is-correct {
  background: rgba(16, 185, 129, 0.16) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.2);
}
.qc-option-btn.is-wrong {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}
.qc-feedback-box {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.92rem;
  line-height: 1.6;
  animation: cardFadeIn 0.2s ease;
}
.qc-feedback-box.correct {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}
.qc-feedback-box.wrong {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Card 4: Summary Takeaways & Complete Button */
.summary-takeaways-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.summary-takeaway-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface-2, #1b1e27);
  border: 1px solid var(--border, #272B36);
  border-radius: 14px;
  padding: 14px 16px;
  line-height: 1.6;
  font-size: 0.92rem;
  color: var(--text);
}
.summary-item-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.summary-complete-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.btn-complete-micro-lesson {
  min-height: 52px;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FF7A00, #ea580c);
  box-shadow: 0 6px 20px rgba(255, 122, 0, 0.3);
  border: none;
  cursor: pointer;
  color: #fff;
  transition: all 0.2s ease;
}
.btn-complete-micro-lesson:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.45);
}

/* Micro-Player Bottom Navigation */
.micro-player-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.micro-nav-btn {
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.micro-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.micro-nav-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}
.micro-nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-3, #2a2f3e);
  cursor: pointer;
  transition: all 0.2s ease;
}
.micro-nav-dot.is-active {
  background: #FF7A00;
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(255, 122, 0, 0.4);
}

/* ── Zero-Overflow Responsiveness (< 768px and < 480px) ── */
@media (max-width: 768px) {
  .axis1-lesson-card {
    padding: 14px 16px;
    gap: 14px;
  }
  .axis1-lesson-num {
    font-size: 1.5rem;
    padding: 8px 6px;
    min-width: 38px;
  }
  .axis1-lesson-title {
    font-size: 0.98rem;
  }
  .micro-card-stage {
    padding: 18px 16px;
    border-radius: 16px;
  }
  .micro-card-title {
    font-size: 1.15rem;
  }
}
@media (max-width: 480px) {
  .axis1-lesson-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .axis1-lesson-meta {
    width: 100%;
    justify-content: space-between;
  }
  .micro-player-topbar {
    gap: 8px;
  }
  .micro-player-title {
    display: none;
  }
  .narsa-keys-grid {
    gap: 8px;
  }
  .narsa-btn-num {
    height: 48px;
    font-size: 1.2rem;
  }
}

/* Anti-scrape selection lock */
.quiz-card, .question-card, .lesson-card, .micro-card, .sign-card, .mc-card {
  -webkit-user-select: none;
  user-select: none;
}
.quiz-card img, .question-card img, .lesson-card img, .micro-card img, .sign-card img {
  -webkit-user-drag: none;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════
   2026-12 — Responsive pass + staff screens aligned on the learner design
   (admin / school / instructor use the same page titles, tiles and cards
   as the student pages; mobile tables become compact two-column cards)
   ══════════════════════════════════════════════════════════════════════ */

/* Page titles: same as the learner .pg-head */
.page-head,
.page-header {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 24px;
  gap: 12px;
}
.page-head h1,
.page-header h1 {
  font-size: clamp(1.6rem, 3.8vw, 2.25rem);
  line-height: 1.28;
}
.page-head p,
.page-header p { font-size: .98rem; line-height: 1.6; }

/* KPI tiles: learner-style tiles, two per row on phones */
.dash-kpis { gap: 12px; padding-bottom: 0 !important; }
.dash-kpi { min-height: 0; }
@media (max-width: 480px) {
  .dash-kpi { padding: 12px 14px; gap: 2px; }
  .dash-kpi-ic { font-size: 1.2rem; margin-bottom: 2px; }
  .dash-kpi strong { font-size: 1.35rem; }
  .dash-kpi .muted { font-size: .74rem; line-height: 1.35; }
}

/* Live sessions list (no active session) sits in the normal staff layout */
.admin-live-wrap { max-width: 1080px; margin: 0 auto; }
.admin-live-header { margin-bottom: 24px; }
@media (max-width: 640px) {
  .admin-live-header .btn { width: 100%; justify-content: center; }
  .live-sess-card { flex-wrap: wrap; gap: 10px; }
}

/* Phone/tablet: a card that only wraps a card-table must not draw a second card around the rows */
@media (max-width: 1100px) {
  .card:has(> table.rtable),
  .card:has(> .table-wrap > table.rtable) {
    border: 0 !important; background: transparent !important; box-shadow: none !important;
    padding: 0 !important; overflow: visible !important;
  }
}
/* Odd number of KPI tiles on phones: the last one takes the full row */
@media (max-width: 480px) {
  .dash-kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ── Phone/tablet tables → clean list rows ─────────────────────────────
   title on top, status pill in the corner, details as one compact line,
   action icons in a footer. Same card look as the learner lists. */
@media (max-width: 1100px) {
  table.rtable tr {
    position: relative;
    display: flex; flex-wrap: wrap; align-items: baseline;
    gap: 6px 14px;
    padding: 14px 16px;
    margin: 0 0 10px;
    border: 1px solid var(--border); border-radius: 16px;
    background: var(--surface); box-shadow: var(--shadow-sm, none);
  }
  table.rtable td {
    display: inline-flex; flex-direction: row; align-items: baseline; flex-wrap: wrap;
    gap: 5px; width: auto; min-width: 0;
    padding: 0; margin: 0; border: 0;
    font-size: .84rem; font-weight: 500; color: var(--text); text-align: start;
    overflow-wrap: anywhere;
  }
  table.rtable td::before {
    display: inline; max-width: none; margin: 0;
    font-size: .74rem; font-weight: 600; color: var(--muted);
  }
  table.rtable td:first-child { display: inline-flex; font-size: .84rem; font-weight: 500; }
  table.rtable td:first-child::before { display: inline; margin: 0; font-size: .74rem; }

  /* Title */
  table.rtable td.td-title {
    order: -2; flex: 1 1 100%;
    display: block; font-size: .98rem; font-weight: 700; line-height: 1.5; color: var(--text);
    margin-bottom: 2px;
  }
  table.rtable tr.has-pill td.td-title { padding-inline-end: 92px; }
  table.rtable td.td-title::before { display: none; }
  table.rtable td.td-title a { color: var(--text); text-decoration: none; }
  table.rtable td.td-title a:hover { color: var(--primary); }

  /* Id "#60" goes with the details */
  table.rtable td[data-label="#"] { order: 1; color: var(--muted); }
  table.rtable td[data-label="#"]::before { content: "#"; font-size: .84rem; font-weight: 500; }

  /* Status pill in the top corner */
  table.rtable td.td-pill { position: absolute; top: 12px; inset-inline-end: 14px; }
  table.rtable td.td-pill::before { display: none; }

  /* Actions footer */
  table.rtable td.td-actions {
    order: 10; flex: 1 1 100%;
    display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px;
    margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border);
  }
  table.rtable td.td-actions::before { display: none; }
  table.rtable td.td-actions .row,
  table.rtable td.td-actions .btn-row,
  table.rtable td.td-actions > div { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  table.rtable td .progress, table.rtable td .bar { width: 80px; }
}
@media (min-width: 600px) and (max-width: 1100px) {
  table.rtable tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
  table.rtable tr { margin: 0; align-content: flex-start; }
}

/* KPI tiles: icon in a soft badge, like the learner dashboard tiles */
.dash-kpi-ic {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 1.15rem; margin-bottom: 8px;
}
.dash-kpi-ic svg { width: 20px; height: 20px; }
@media (max-width: 480px) {
  .dash-kpi-ic { width: 32px; height: 32px; border-radius: 10px; font-size: 1rem; margin-bottom: 6px; }
  .dash-kpi-ic svg { width: 18px; height: 18px; }
}
@media (max-width: 1100px) {
  table.rtable td .pill, table.rtable td .badge { font-size: .74rem; }
}

/* 2026-12-03 — صفحة المستخدمين: خانات حسب النوع (متعلمون / مدارس / أدمين) */
.users-seg { display: flex; width: 100%; max-width: 520px; margin: 0 0 14px; }
.users-seg button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.users-seg .seg-n { font-size: .72rem; font-weight: 800; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2, rgb(0 0 0 / .06)); color: var(--muted); }
.users-seg button[aria-pressed="true"] .seg-n { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 640px) { .users-seg { max-width: none; } .users-seg button { padding: 6px 8px; } }

/* ==========================================================================
   2026-12-03 — Interactive lesson scenes («الموقف بالصورة») — lessonScenes.js
   ========================================================================== */
.sc { margin: 16px 0 4px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--primary); background: var(--primary-soft, rgb(234 88 12 / .1)); padding: 4px 10px; border-radius: 999px; }
.sc-play { display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; font: inherit; font-size: .82rem; font-weight: 800; color: #fff; background: var(--primary); padding: 7px 14px; border-radius: 999px; min-height: 36px; }
.sc-play:hover { filter: brightness(1.06); }
.sc-play:focus-visible, .sc-chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.sc-title { margin: 10px 2px 8px; font-weight: 800; font-size: .98rem; color: var(--text); }
.sc-stage { border-radius: 12px; overflow: hidden; background: #eef2f7; line-height: 0; }
.sc.is-night .sc-stage { background: #1b2232; }
.sc-stage svg { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

/* hotspots */
.sc-spot { cursor: pointer; outline: none; }
.sc-spot .sc-hit { fill: transparent; }
.sc-spot .sc-dot { fill: var(--tone); stroke: #fff; stroke-width: 2.4; transform-box: fill-box; transform-origin: center; transition: transform .15s ease; }
.sc-spot text { fill: #fff; font: 900 12px system-ui, sans-serif; pointer-events: none; }
.sc-spot .sc-pulse { fill: var(--tone); opacity: .45; transform-box: fill-box; transform-origin: center; animation: sc-pulse 1.8s ease-out infinite; }
.sc-spot.is-active .sc-dot { transform: scale(1.2); stroke: #fde047; stroke-width: 3; }
.sc-spot:focus-visible .sc-dot { stroke: #fde047; stroke-width: 3.5; }
.sc.has-active .sc-spot:not(.is-active) .sc-pulse { animation: none; opacity: 0; }
@keyframes sc-pulse { 0% { transform: scale(1); opacity: .5; } 80%, 100% { transform: scale(2); opacity: 0; } }

/* highlighted element of the scene */
.sc [data-hl] { transition: opacity .2s ease, filter .2s ease; }
.sc [data-hl].sc-hl { filter: drop-shadow(0 0 3px #fde047) drop-shadow(0 0 6px #f59e0b); }

/* chips + explanation */
.sc-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: none; }
.sc-chips::-webkit-scrollbar { display: none; }
.sc-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .8rem; font-weight: 700; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px 5px 6px; cursor: pointer; min-height: 34px; }
[dir="rtl"] .sc-chip, .sc[dir="rtl"] .sc-chip { padding: 5px 6px 5px 10px; }
.sc-chip b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--tone); color: #fff; font-size: .75rem; }
.sc-chip.is-active { border-color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, var(--surface)); }
.sc-info { margin-top: 8px; min-height: 64px; }
.sc-hint { margin: 0; padding: 10px 12px; font-size: .86rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; }
.sc-card { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--tone) 9%, var(--surface)); border-inline-start: 4px solid var(--tone); animation: sc-in .2s ease; }
.sc-card strong { display: flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--text); }
.sc-card strong b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--tone); color: #fff; font-size: .75rem; flex: 0 0 auto; }
.sc-card p { margin: 6px 0 0; font-size: .9rem; line-height: 1.75; color: var(--text); }
@keyframes sc-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* timed effects (run while .is-playing) */
.sc-blink { animation: sc-blink 1s steps(2, start) infinite; }
@keyframes sc-blink { to { opacity: .15; } }
.sc-flash { opacity: 0; }
.sc.is-playing .sc-flash { animation: sc-flash .7s ease var(--d, 0ms) both; }
@keyframes sc-flash { 0%, 100% { opacity: 0; } 45% { opacity: .85; } }
.sc.is-playing .sc-show { animation: sc-show .35s ease var(--d, 0ms) both; }
@keyframes sc-show { from { opacity: 0; } to { opacity: 1; } }
.sc .sc-hide { transition: opacity .3s; }
.sc.is-playing .sc-hide { animation: sc-hide .4s ease var(--d, 0ms) both; }
@keyframes sc-hide { from { opacity: .35; } to { opacity: 0; } }
.sc .sc-grow { transform-box: fill-box; transform-origin: left center; }
.sc.is-playing .sc-grow { animation: sc-grow var(--t, 1s) linear var(--d, 0ms) both; }
@keyframes sc-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.sc .sc-count { stroke-dashoffset: 0; }
.sc.is-playing .sc-count { animation: sc-count 6s linear var(--d, 0ms) both; }
@keyframes sc-count { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 188.5; } }
/* low beam only appears during the scene */
.sc:not(.is-playing) [data-hl="low"] .sc-show { opacity: 0; }

.sc.is-recap { margin-top: 0; margin-bottom: 14px; }

@media (max-width: 480px) {
  .sc { padding: 10px; margin-inline: -4px; }
  .sc-title { font-size: .92rem; }
  .sc-play { padding: 6px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-spot .sc-pulse, .sc-blink { animation: none !important; }
  .sc.is-playing .sc-show, .sc.is-playing .sc-hide, .sc.is-playing .sc-grow, .sc.is-playing .sc-count, .sc.is-playing .sc-flash { animation-duration: .01ms !important; animation-delay: 0ms !important; }
}

/* ═══ 2026-12-03 · Series tiles: big number over an axis illustration ═══ */
.series-tile.series-tile--scene {
  padding: 0;
  aspect-ratio: auto;
  min-height: 0;
  overflow: hidden;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
}
.series-tile.series-tile--scene:hover { background: var(--surface); }
.series-tile--scene .series-tile-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  isolation: isolate;
}
.series-tile--scene .series-tile-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, .58) 0%, rgba(15, 23, 42, .38) 55%, rgba(15, 23, 42, .18) 100%);
  transition: background .2s ease;
}
.series-tile--scene:hover .series-tile-hero::before {
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, .66) 0%, rgba(15, 23, 42, .46) 55%, rgba(15, 23, 42, .26) 100%);
}
.series-tile--scene .series-tile-kicker {
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  opacity: .95;
}
.series-tile--scene .series-tile-num,
.series-tile--scene:hover .series-tile-num {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: none;
  color: #fff;
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .5);
}
.series-tile--scene .series-tile-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 12px;
  border-top: 3px solid var(--scene-accent, var(--primary));
}
.series-tile--scene .series-tile-count { font-size: .8rem; }
.series-tile--scene.scene-road     { --scene-accent: #2563eb; }
.series-tile--scene.scene-traffic  { --scene-accent: #f59e0b; }
.series-tile--scene.scene-driver   { --scene-accent: #9333ea; }
.series-tile--scene.scene-vehicle  { --scene-accent: #16a34a; }
.series-tile--scene.scene-offences { --scene-accent: #e11d48; }
.series-tile--scene.scene-exam     { --scene-accent: #ea580c; }
.series-tile--scene.is-passed .series-tile-num { color: #fff; }
.series-tile--scene.is-passed .series-tile-hero::after {
  content: '✓';
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
@media (max-width: 600px) {
  .series-tile--scene .series-tile-foot { padding: 8px 6px 10px; }
  .series-tile--scene .series-tile-badge { font-size: .7rem; }
}

/* ═══ 2026-12-03 — Statistics pages: calmer, easier to read (admin / school / instructor) ═══
   One row = label + value on one line, thin full-width bar under it.
   Hardest questions: rank, 2-line text, small #id meta, coloured % pill. */
.st-card { padding: 18px 18px 8px; }
.st-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.st-head .dash-h { margin: 0; }
.st-hint { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.st-list { display: flex; flex-direction: column; }
.st-empty { color: var(--muted); font-size: .9rem; padding: 10px 0; margin: 0; }

.st-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none; border-radius: 8px;
  transition: background var(--dur, .2s);
}
.st-list > :last-child { border-bottom: 0; }
a.st-row:hover { background: var(--surface-2); }
.st-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.st-label { font-weight: 600; font-size: .95rem; line-height: 1.4; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-val { flex: none; font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; color: var(--text); }
.st-bar { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.st-bar i { display: block; height: 100%; border-radius: inherit; transition: width .5s var(--ease, ease); }
.st-sub { font-size: .78rem; color: var(--muted); line-height: 1.3; }

.t-brand { background: var(--primary, #ea580c); }
.t-good  { background: #16a34a; }
.t-mid   { background: #f59e0b; }
.t-bad   { background: #e5484d; }

.st-q {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none; border-radius: 8px;
  transition: background var(--dur, .2s);
}
.st-q:hover { background: var(--surface-2); }
.st-rank {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted);
  font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.st-q-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st-q-text {
  font-size: .92rem; line-height: 1.5; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.st-q-meta { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-pill {
  min-width: 50px; padding: 4px 8px; border-radius: 99px; text-align: center;
  font-size: .82rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff;
}
.st-pill.t-bad  { background: #fde8e8; color: #b42318; }
.st-pill.t-mid  { background: #fef3c7; color: #92400e; }
.st-pill.t-good { background: #dcfce7; color: #166534; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .st-pill.t-bad  { background: rgba(229,72,77,.18); color: #ff9b9e; }
  :root:not([data-theme="light"]) .st-pill.t-mid  { background: rgba(245,158,11,.18); color: #fcd34d; }
  :root:not([data-theme="light"]) .st-pill.t-good { background: rgba(22,163,74,.18); color: #86efac; }
}
:root[data-theme="dark"] .st-pill.t-bad  { background: rgba(229,72,77,.18); color: #ff9b9e; }
:root[data-theme="dark"] .st-pill.t-mid  { background: rgba(245,158,11,.18); color: #fcd34d; }
:root[data-theme="dark"] .st-pill.t-good { background: rgba(22,163,74,.18); color: #86efac; }

@media (max-width: 600px) {
  .st-card { padding: 14px 14px 4px; }
  .st-grid { gap: 14px; }
  .st-q { grid-template-columns: 24px 1fr auto; gap: 10px; }
  .st-rank { width: 24px; height: 24px; font-size: .75rem; }
  .st-q-text { font-size: .9rem; }
}

/* ══ 2026-12-03 — قوائم المحتوى في الإدارة: بحث فوري + بطاقات مدمجة ══ */
.al-bar { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; }
.al-search {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  min-height: 46px; padding-inline: 12px 6px; transition: border-color .15s, box-shadow .15s;
}
.al-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.al-search-ic { display: inline-flex; color: var(--muted); flex: none; }
.al-search-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.al-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 10px 10px;
}
.al-search input::-webkit-search-cancel-button { display: none; }
.al-clear {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font-size: .8rem; cursor: pointer;
}
.al-clear:hover { color: var(--text); }
.al-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.al-select {
  font: inherit; font-size: 16px; color: var(--text); min-height: 42px; width: 100%;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 6px 10px;
}
.al-seg { display: flex; width: 100%; max-width: 420px; }
.al-seg button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.al-seg .seg-n { font-size: .72rem; font-weight: 800; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.al-seg button[aria-pressed="true"] .seg-n { background: var(--primary-soft); color: var(--primary); }
.al-count { margin: 0 2px 8px; font-size: .8rem; color: var(--muted); }

/* القائمة: بطاقة واحدة، صفوف مفصولة بخط رفيع (نفس روح صفحة الإحصائيات) */
.al-list {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; box-shadow: var(--shadow-sm, none);
}
#q-results.is-busy, #s-results.is-busy { opacity: .55; transition: opacity .15s; }
.al-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.al-item:last-child { border-bottom: 0; }
.al-item:hover { background: var(--surface-2); }
.al-item.is-off .al-main, .al-item.is-off .al-num { opacity: .6; }
.al-num {
  flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px;
  border-radius: 10px; background: var(--primary-soft); color: var(--primary);
  font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums;
}
.al-item.is-off .al-num { background: var(--surface-2); color: var(--muted); }
.al-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.al-title {
  color: var(--text); font-weight: 700; font-size: .95rem; line-height: 1.5; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.al-title:hover { color: var(--primary); }
.al-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .78rem; color: var(--muted); }
.al-meta b { color: var(--text); font-weight: 700; }
.al-id { font-variant-numeric: tabular-nums; }
.al-tag, .al-state {
  font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}
.al-tag { background: #fef3c7; color: #92400e; }
.al-state { background: var(--surface-2); color: var(--text-soft, var(--muted)); border: 1px solid var(--border); }
.al-item .act-row { flex: none; flex-wrap: nowrap; gap: 4px; }
.al-item .act-btn { min-height: 36px; min-width: 36px; padding: 4px 8px; justify-content: center; }
.al-item .act-lbl { display: none; }
.al-pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; }
.al-empty { text-align: center; padding: 28px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 16px; }
.al-empty span { display: inline-flex; opacity: .5; }
.al-empty svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
.al-empty p { margin: 6px 0 0; font-size: .9rem; }
.al-rowempty { margin-bottom: 12px; }
tr[hidden] { display: none !important; }

@media (max-width: 640px) {
  .al-item { flex-wrap: wrap; gap: 8px 10px; padding: 12px; }
  .al-item .act-row { flex: 1 1 100%; justify-content: flex-end; }
  .al-item:has(.al-num) .act-row { padding-inline-start: 44px; }
  .al-title { font-size: .92rem; }
}
@media (min-width: 900px) {
  .al-bar { flex-direction: row; align-items: center; }
  .al-bar .al-search { flex: 1; }
  .al-bar .al-filters { flex: 0 0 auto; grid-template-columns: repeat(2, minmax(170px, 220px)); }
  .al-bar .al-seg { width: auto; }
}

/* معاينة السلسلة: لائحة مدمجة لكل الأسئلة، الضغط على سؤال كيفتح بطاقته كاملة */
.qcard-modal-body > * { flex-shrink: 0; }
.sq-count { font-weight: 600; color: var(--muted); font-size: .78rem; margin-inline-start: 6px; }
.sq-hint { margin: 0; font-size: .8rem; color: var(--muted); }
.sq-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sq-row { border-bottom: 1px solid var(--border); }
.sq-row:last-child { border-bottom: 0; }
.sq-head {
  width: 100%; display: grid; grid-template-columns: auto 56px minmax(0, 1fr) auto; grid-template-areas: "n th tx ch" "n th mt ch";
  align-items: center; gap: 2px 10px; padding: 10px 12px; text-align: start;
  background: transparent; border: 0; color: var(--text); font: inherit; cursor: pointer;
}
.sq-head:hover { background: var(--surface-2); }
.sq-n { grid-area: n; min-width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: .8rem; }
.sq-thumb { grid-area: th; width: 56px; height: 42px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 1.1rem; }
.sq-thumb img, .sq-thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.sq-text { grid-area: tx; font-size: .9rem; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sq-meta { grid-area: mt; font-size: .74rem; color: var(--muted); }
.sq-chev { grid-area: ch; color: var(--muted); transition: transform .2s; }
.sq-head[aria-expanded="true"] .sq-chev { transform: rotate(180deg); }
.sq-head[aria-expanded="true"] { background: var(--surface-2); }
.sq-body { padding: 10px 12px 14px; background: var(--surface-2); }
.sq-body .qcard { box-shadow: none; }
.sq-body .qcard-body { display: grid; gap: 12px; padding: 12px; }
.sq-body .qcard-media { min-height: 0; max-height: 240px; }
.sq-body .qcard-media img { max-height: 240px; object-fit: contain; }
@media (min-width: 700px) { .sq-body .qcard-body.has-media { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 480px) {
  .sq-modal { max-height: 92vh; }
  .sq-head { grid-template-columns: auto 48px minmax(0, 1fr) auto; gap: 2px 8px; padding: 10px; }
  .sq-thumb { width: 48px; height: 38px; }
}
/* نافذة المعاينة فوق شريط التنقل السفلي ديال الهاتف */
.qcard-modal-overlay { z-index: 10001; }
.qcard-modal-wrap { max-height: min(90vh, 90dvh); }
.al-search input, .al-search input:focus, .al-search input:focus-visible {
  border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; min-height: 0;
}

/* 2026-12-03 — إدارة أسئلة السلسلة: سطر مدمج لكل سؤال مع معاينة/تعديل/استبدال/حذف */
.sq-manage { margin-inline-start: auto; margin-inline-end: 8px; }
.sp-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sp-row { display: grid; grid-template-columns: auto 52px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sp-row:last-child { border-bottom: 0; }
.sp-row.is-replacing { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.sp-row.is-flash { animation: sp-flash 1.6s ease; }
@keyframes sp-flash { 0%, 40% { background: color-mix(in srgb, var(--success, #16a34a) 18%, transparent); } 100% { background: var(--surface); } }
.sp-n { min-width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: .8rem; }
.sp-thumb { width: 52px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.sp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sp-text { font-size: .9rem; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-meta { font-size: .74rem; color: var(--muted); }
.sp-acts { display: flex; gap: 4px; flex-wrap: nowrap; }
.sp-acts .act-btn { min-height: 34px; min-width: 34px; padding: 4px 6px; justify-content: center; }
.sp-acts .act-btn:disabled { opacity: .35; }
.sp-banner { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--primary-soft); color: var(--text); font-size: .86rem; }
@media (max-width: 700px) {
  .sp-row { grid-template-columns: auto 48px minmax(0, 1fr); }
  .sp-acts { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
  .sp-thumb { width: 48px; height: 38px; }
}

/* 2026-12-03 — تحديد جماعي فلوائح الإدارة (إخفاء / إظهار / حذف) */
.al-checkwrap { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; cursor: pointer; }
.al-check { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.al-item.is-sel { background: var(--primary-soft); }
.al-item.is-sel .al-main, .al-item.is-sel .al-num { opacity: 1; }
.al-pickold { margin: 0 0 10px; }
.al-selbar {
  position: fixed; z-index: 10000; inset-inline: 12px; bottom: 16px;
  max-width: 720px; margin-inline: auto;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border-strong, var(--border));
  box-shadow: 0 10px 30px rgb(0 0 0 / .18);
}
.al-selbar[hidden] { display: none; }
.al-seln { font-size: .9rem; }
.al-seln b { color: var(--primary); font-size: 1rem; }
.al-selbar .act-btn { min-height: 40px; padding: 6px 12px; }
.al-selbar .act-lbl { display: inline !important; font-size: .82rem; }
.al-list.has-sel { margin-bottom: 90px; }
@media (max-width: 768px) {
  body.has-bottom-bar .al-selbar { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .al-selbar .act-btn { padding: 6px 9px; }
}
@media (max-width: 640px) {
  .al-item:has(.al-checkwrap):has(.al-num) .act-row { padding-inline-start: 0; }
}

/* 2026-12-03 — محاور الأسئلة كأزرار ظاهرة مع العدد */
.al-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.al-chips::-webkit-scrollbar { display: none; }
.al-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font: inherit; font-size: .85rem; font-weight: 700; color: var(--text-soft, var(--text));
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; min-height: 38px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.al-chip:hover { border-color: var(--border-strong, var(--border)); }
.al-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.al-chip-n { font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.al-chip[aria-pressed="true"] .al-chip-n { background: rgb(255 255 255 / .25); color: #fff; }
.al-filters--one { grid-template-columns: 1fr; }
@media (min-width: 900px) { .al-bar .al-filters--one { grid-template-columns: minmax(170px, 220px); } }
@media (min-width: 900px) { .al-chips { flex-wrap: wrap; overflow: visible; } }
/* صنف الرخصة فلائحة السلاسل + تحذير تجاوز الحد */
.al-tag--cat { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.al-state--warn { background: #fde8e8; color: #b42318; border-color: #f5c2c0; }
#picked-title.is-over { color: var(--danger, #b42318); }

/* 2026-12-03 — إحصائيات المدرسة: بطاقات أرقام مدمجة (أيقونة + عنوان فسطر، الرقم تحت) */
.dash-kpis--compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.dash-kpis--compact .dash-kpi {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic lb" "val val" "sub sub";
  align-items: center; gap: 2px 8px; padding: 12px 14px; min-height: 0;
}
.dash-kpis--compact .dash-kpi-ic { grid-area: ic; width: 30px; height: 30px; border-radius: 9px; font-size: .95rem; margin: 0; }
.dash-kpis--compact .dash-kpi-ic svg { width: 16px; height: 16px; }
.dash-kpis--compact .dash-kpi-ic + span { grid-area: lb; font-size: .8rem; line-height: 1.3; }
.dash-kpis--compact .dash-kpi strong { grid-area: val; font-size: 1.4rem; line-height: 1.2; margin-top: 4px; }
.dash-kpis--compact .dash-kpi strong + .small { grid-area: sub; font-size: .72rem; line-height: 1.35; }
@media (max-width: 480px) {
  .dash-kpis--compact { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-kpis--compact .dash-kpi { padding: 10px 12px; }
  .dash-kpis--compact .dash-kpi strong { font-size: 1.25rem; }
  .dash-kpis--compact > :last-child:nth-child(odd) { grid-column: auto; }
}
#qr-host .school-qr-card { margin-top: 0; }
.school-qr-scanner[hidden], .school-qr-cam-wrap[hidden], .school-qr-feedback[hidden] { display: none !important; }

/* ══ 2026-12-03 — صفحات الإدارة/المؤسسة/المدرب: نفس الترتيب فكل صفحة ══
   العنوان + زر واحد فنفس السطر، تحتو شريط البحث والفلاتر، ومن بعد المحتوى. */
.page-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; }
.page-head > div:first-child { flex: 1 1 auto; min-width: 0; width: auto; }
.page-head h1 { margin: 0; }
.page-head > .btn, .page-head > .row > .btn { width: auto; flex: 0 0 auto; }
@media (max-width: 760px) {
  .page-head, .page-header { flex-direction: row !important; align-items: center !important; gap: 10px !important; margin-bottom: 16px; }
  .page-head > div:first-child { width: auto !important; flex: 1 1 auto; }
  .page-head h1 { font-size: 1.5rem; }
  .page-head > .btn, .page-head > .row > .btn {
    width: auto !important; min-height: 38px; padding: 8px 14px; font-size: .88rem; border-radius: 12px; white-space: nowrap;
  }
  .page-head > .dash-seg { flex: 0 0 auto; }
}
/* أدوات بجانب البحث (فلتر الحالة، QR…) */
.al-tools { display: flex; gap: 8px; align-items: center; }
.al-tools .input { flex: 1 1 auto; width: auto; min-height: 44px; }
.al-tools .btn { flex: 0 0 auto; min-height: 44px; white-space: nowrap; }
@media (min-width: 700px) { .al-bar .al-tools { flex: 0 0 auto; } .al-tools .input { min-width: 160px; } }
/* تبويبات متابعة الامتحانات بنفس شكل باقي التبويبات */
.exam-tabs.seg { border-bottom: 0; margin: 0 0 14px; }
.exam-tabs.seg .tab-btn { border: 0; border-radius: 9px; margin: 0; }
.exam-tabs.seg .tab-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .14); border: 0; }
/* صفحة الحصص الجماعية: نفس الهوامش ديال باقي الصفحات */
.admin-live-wrap { padding: 0; max-width: none; }
.page-head > .row { width: auto !important; flex: 0 0 auto; }

/* ══ 2026-12-03 — التقدم العام فالرئيسية (30% دروس + 70% سلاسل) ══ */
.dash-overall { margin-bottom: 20px; }
.dash-overall-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.dash-overall-parts a {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px;
  background: var(--surface-2); color: inherit; text-decoration: none; border: 1px solid var(--border);
}
.dash-overall-parts a:hover { border-color: var(--primary); }
.dash-overall-parts span { font-size: .85rem; font-weight: 700; }
.dash-overall-parts strong { font-size: 1.25rem; color: var(--primary); }
.dash-overall-parts small { font-size: .72rem; color: var(--muted); }
/* ==========================================================================
   2026-12-03 — Synced narration (narrator.js): words highlighted as spoken,
   auto-advance bar, sign modal auto mode
   ========================================================================== */
.nw { border-radius: 4px; transition: opacity .18s ease, background-color .18s ease, color .18s ease; }
.is-narrating .nw { opacity: .5; }
.is-narrating .nw.is-said { opacity: 1; }
.nw.is-cur { opacity: 1; color: var(--primary); background: var(--primary-soft, rgb(234 88 12 / .12)); box-shadow: 0 0 0 2px var(--primary-soft, rgb(234 88 12 / .12)); }
.nr-start-btn { display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 4px; }
.nr-bar { position: sticky; top: 64px; z-index: 20; display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 10px 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 4px 14px rgb(0 0 0 / .08); font-weight: 800; font-size: .9rem; color: var(--text); }
.nr-bar-text { flex: 1; min-width: 0; }
.nr-bar-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); animation: nr-dot 1.2s ease-in-out infinite; flex: 0 0 auto; }
@keyframes nr-dot { 50% { transform: scale(.6); opacity: .5; } }
.nr-block-on { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 14px; transition: outline-color .2s; }
.sdm-audio-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.sdm-auto-btn.is-on { background: var(--primary-soft, rgb(234 88 12 / .12)); color: var(--primary); border-color: var(--primary); }
.sdm-img-wrap.is-speaking { animation: nr-glow 1.6s ease-in-out infinite; border-radius: 16px; }
@keyframes nr-glow { 0%, 100% { box-shadow: 0 0 0 0 rgb(234 88 12 / 0); } 50% { box-shadow: 0 0 0 8px rgb(234 88 12 / .25); } }
@media (prefers-reduced-motion: reduce) { .nr-bar-dot, .sdm-img-wrap.is-speaking { animation: none; } .nw { transition: none; } }

/* ── 2026-12-03: question photos always shown whole inside their frame ──────
   The photo keeps its proportions (contain) and never spills out of its box;
   a blurred copy of the same photo fills the empty sides instead of black bars. */
.nrs-media { position: relative; }
.nrs-media .nrs-img-wrap {
  position: relative; width: 100%; height: 100%; min-height: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.nrs-media .nrs-img-wrap.has-photo::before {
  content: ''; position: absolute; inset: -24px;
  background: var(--nrs-bg) center / cover no-repeat;
  filter: blur(18px) brightness(.55); transform: scale(1.1);
}
.nrs-media .nrs-img-wrap img {
  position: relative; z-index: 1;
  width: 100% !important; height: 100% !important;
  max-width: 100% !important; max-height: 100% !important;
  object-fit: contain !important; background: transparent !important;
}
.qcard-media img { max-height: min(52vh, 420px); object-fit: contain; }

/* ══════════════════════════════════════════════════════════════════════
   2026-12 — Lesson card on one screen (calm reading layout)
   The player fills the screen under the header (height set in JS). Inside
   the card: text on one side, picture on the other (stacked on phones),
   both the same height, and the Previous / Next bar always at the bottom.
   If a small screen still can't hold a card, only the card scrolls.
   ══════════════════════════════════════════════════════════════════════ */
.mp-back-short { display: none; }
.pg.micro-card-player {
  max-width: 1200px;
  gap: 10px;
  padding: 6px 0 6px !important;
  min-height: 0;
  overflow: hidden;
}
body:has(.micro-card-player) .site-footer { display: none; }
body:has(.micro-card-player) main,
body:has(.micro-card-player) #app { padding-bottom: 0 !important; }

/* Top bar: one quiet line */
.micro-card-player .micro-player-topbar { flex-wrap: nowrap; padding: 0; gap: 10px; flex: 0 0 auto; }
.micro-card-player .micro-player-center { min-width: 0; }
.micro-card-player .micro-player-title { font-size: .95rem; font-weight: 700; color: var(--muted); }
.micro-card-player .micro-player-back-btn,
.micro-card-player .micro-player-audio-btn { min-height: 38px; padding: 6px 12px; white-space: nowrap; flex: 0 0 auto; }
.micro-card-player .micro-progress-wrap { margin: 0; flex: 0 0 auto; gap: 6px; }
.micro-card-player .micro-progress-seg { height: 4px; box-shadow: none; }

/* The card */
.micro-card-player .micro-card-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 24px 20px;
  gap: 12px;
  border-radius: 18px;
}
.micro-card-player .micro-card-stage > * { flex: 0 0 auto; }
.micro-card-player .micro-card-head { gap: 10px; }
.micro-card-player .micro-card-title { font-size: 1.3rem; line-height: 1.45; }

/* Text side and picture side (built in splitCard()) */
.micro-card-player .micro-card-stage > .mc-split { flex: 1 0 auto; display: flex; flex-direction: column; gap: 14px; }
.micro-card-player .mc-split.media-first { flex-direction: column-reverse; }
.micro-card-player .mc-body { display: flex; flex-direction: column; gap: 12px; flex: 0 0 auto; }
.micro-card-player .mc-body:empty, .micro-card-player .mc-media:empty { display: none; }
.micro-card-player .mc-media { flex: 1 0 auto; display: flex; flex-direction: column; gap: 10px; }

/* Reading text: larger, airy, no box-in-box */
.micro-card-player .micro-rule-box {
  background: var(--surface-2);
  border: 0;
  border-inline-start: 3px solid var(--primary, #FF7A00);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1.02rem;
  line-height: 1.95;
}
.micro-card-player .micro-svg-visual { background: var(--surface-2); border: 0; padding: 12px; gap: 8px; border-radius: 12px; }
.micro-card-player .micro-svg-visual > svg, .micro-card-player .micro-svg-visual > div > svg { max-height: 150px; width: auto; }
.micro-card-player .micro-gauge-footer { margin-top: 0 !important; gap: 8px !important; }
.micro-card-player .interactive-widget-box { background: transparent; border: 0; padding: 0; gap: 12px; }
.micro-card-player .interactive-widget-desc { font-size: 1rem; line-height: 1.8; color: var(--text); }
.micro-card-player .score-sim-btn { min-height: 40px; padding: 6px 14px; }
.micro-card-player .score-sim-card { padding: 12px 14px; gap: 6px; }
.micro-card-player .qc-question-text { font-size: 1.08rem; line-height: 1.7; }
.micro-card-player .qc-options-list { gap: 8px; }
.micro-card-player .qc-option-btn { min-height: 46px; padding: 10px 16px; font-size: 1rem; }
.micro-card-player .qc-feedback-box { padding: 10px 14px; }
.micro-card-player .summary-takeaways-list { gap: 10px; }
.micro-card-player .summary-takeaway-item { padding: 12px 14px; gap: 12px; font-size: 1rem; line-height: 1.75; background: var(--surface-2); border: 0; }
/* The bottom bar's button already completes the lesson on the last card */
.micro-card-player .summary-complete-wrap { display: none; }

/* Picture: flat, fills its side, keeps its shape */
.micro-card-player .mc-media > .sc { flex: 1 0 0; }
.micro-card-player .sc {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(120px, 1fr) auto auto;
  column-gap: 10px;
}
.micro-card-player .sc-head { display: contents; }
.micro-card-player .sc-tag { display: none; }
.micro-card-player .sc-play { grid-column: 2; grid-row: 1; align-self: center; min-height: 34px; padding: 6px 14px; }
.micro-card-player .sc-title { grid-column: 1; grid-row: 1; margin: 0; font-size: .95rem; color: var(--muted); align-self: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.micro-card-player .sc-stage { grid-column: 1 / -1; grid-row: 2; margin-top: 8px; position: relative; border-radius: 14px; }
.micro-card-player .sc-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
[data-theme="dark"] .micro-card-player .sc-stage { background: #e6ebf2; }
[data-theme="dark"] .micro-card-player .sc-stage svg { filter: brightness(.93); }
.micro-card-player .sc-chips { grid-column: 1 / -1; grid-row: 3; padding: 10px 0 0; flex-wrap: wrap; overflow: visible; gap: 6px; }
.micro-card-player .sc-info { grid-column: 1 / -1; grid-row: 4; margin-top: 8px; min-height: 0; }
.micro-card-player .sc-info .sc-hint { display: none; }
.micro-card-player .sc-card { padding: 8px 12px; }
.micro-card-player .sc-card strong { font-size: .92rem; }
.micro-card-player .sc-card p { margin: 3px 0 0; font-size: .88rem; line-height: 1.6; }

/* Bottom bar */
.micro-card-player .micro-player-nav { flex: 0 0 auto; margin: 0; padding-bottom: env(safe-area-inset-bottom, 0); }
.micro-card-player .micro-nav-btn { min-height: 46px; padding: 10px 22px; font-size: 1rem; }
.micro-card-player #micro-nav-next { min-width: 140px; justify-content: center; box-shadow: none; }

/* Wide screens: text and picture side by side, same height, text centred */
@media (min-width: 1000px) {
  .micro-card-player .micro-card-stage { padding: 20px 28px 22px; }
  .micro-card-player .micro-card-stage > .mc-split,
  .micro-card-player .micro-card-stage > .mc-split.media-first {
    display: grid;
    flex: 1 1 0;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
  }
  .micro-card-player .mc-split.no-media { grid-template-columns: minmax(0, 760px); justify-content: center; }
  .micro-card-player .micro-card-stage > .mc-split.no-body { grid-template-columns: minmax(0, 980px); justify-content: center; }
  .micro-card-player .mc-body { min-height: 0; overflow-y: auto; justify-content: center; padding-block: 4px; }
  .micro-card-player .mc-media { min-height: 0; }
  .micro-card-player .mc-media > .sc { flex: 1 1 0; min-height: 0; }
  .micro-card-player .sc { grid-template-rows: auto minmax(0, 1fr) auto auto; }
}

/* Phones */
@media (max-width: 600px) {
  .pg.micro-card-player { padding: 2px 0 4px !important; gap: 6px; }
  .mp-back-long { display: none; }
  .mp-back-short { display: inline; }
  .micro-card-player .micro-card-head .muted { display: none; }
  .micro-card-player .micro-card-stage { padding: 12px 14px; gap: 8px; border-radius: 14px; }
  .micro-card-player .micro-card-title { font-size: 1.1rem; }
  .micro-card-player .mc-split { gap: 10px; }
  .micro-card-player .micro-rule-box { font-size: .94rem; line-height: 1.8; padding: 10px 12px; }
  .micro-card-player .interactive-widget-desc,
  .micro-card-player .summary-takeaway-item,
  .micro-card-player .qc-option-btn { font-size: .92rem; }
  .micro-card-player .summary-takeaway-item { padding: 9px 12px; line-height: 1.6; }
  .micro-card-player .qc-option-btn { min-height: 42px; padding: 8px 12px; }
  .micro-card-player .score-sim-btn { min-height: 34px; padding: 4px 10px; font-size: .88rem; }
  .micro-card-player .sc { grid-template-rows: auto minmax(110px, 1fr) auto auto; }
  .micro-card-player .sc-chips { display: none; }
  .micro-card-player .sc-card p { font-size: .84rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .micro-card-player .micro-svg-visual:has(.micro-gauge-footer) > :not(.micro-gauge-footer) { display: none !important; }
  .micro-card-player .micro-nav-btn { padding: 10px 16px; }
}

/* Dashboard: key progress numbers inside the progress card */
.dash-hero-facts {
  list-style: none;
  margin: 14px 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.dash-hero-facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}
.dash-hero-facts strong { font-size: 1.15rem; font-weight: 800; color: var(--text); direction: ltr; text-align: right; unicode-bidi: isolate; }
.dash-hero-facts span { font-size: .82rem; color: var(--muted); }
@media (max-width: 768px) {
  .dash-hero-card .dash-hero-progress-side { order: 1; }
  .dash-hero-facts li { flex: 1 1 calc(50% - 10px); min-width: 0; }
}

/* Lesson scene: the light box hugs the picture (no wide white bands), and on
   short screens the label row goes (the numbered dots on the picture stay) */
.micro-card-player .sc-stage {
  justify-self: center;
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 360 / 220;
}
@media (max-height: 900px) {
  .micro-card-player .sc-chips { display: none; }
}

/* Long lesson texts stay in the page for the narration timing but are not
   shown: the synced animation explains the card */
.micro-card-player .mc-hidden { display: none !important; }
@media (max-width: 600px) {
  .micro-card-player .sc-stage { width: 100%; height: auto; max-height: 100%; align-self: center; }
}

/* Quick-check cards: on phones the question and its answers stay on the
   same screen; the scene gets smaller and its caption box goes */
@media (max-width: 760px) {
  .micro-card-player .mc-split.is-quiz .sc-info { display: none; }
  .micro-card-player .mc-split.is-quiz .mc-media { max-height: 26vh; display: flex; justify-content: center; }
  .micro-card-player .mc-split.is-quiz .sc-stage { height: 24vh; width: auto; max-width: 100%; aspect-ratio: 360 / 220; }
  .micro-card-player .mc-split.is-quiz .qc-question-text { font-size: 1rem; line-height: 1.5; }
  .micro-card-player .mc-split.is-quiz .qc-option-btn { padding-block: 9px; }
}
/* ═══════════════ PRE-SERIES — compact one-screen layout ═══════════════ */
.ps-page { max-width: 560px; padding: 8px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.ps-back {
  align-self: flex-start; background: none; border: 0; padding: 4px 2px; cursor: pointer;
  font: inherit; font-size: .9rem; font-weight: 700; color: var(--primary);
}
.ps-card { padding: 16px; border-radius: 16px; margin: 0; }
.ps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ps-title { font-size: 1.35rem; font-weight: 800; margin: 0; color: var(--text); line-height: 1.3; }
.ps-pill {
  font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-mid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%;
}
.ps-sub { margin: 4px 0 12px; font-size: .85rem; color: var(--muted); }
.ps-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ps-stat {
  background: var(--surface-2); border-radius: 12px; padding: 8px 6px; text-align: center;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.ps-stat span { font-size: .72rem; color: var(--muted); }
.ps-stat strong { font-size: 1rem; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-stat strong.text-pass { color: var(--success); }
.ps-stat strong.text-fail { color: var(--primary); }
.ps-chart {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  height: 64px; margin-top: 12px;
}
.ps-chart-line {
  position: absolute; inset-inline: 0; bottom: calc(80% * 44 / 64); border-top: 1.5px dashed var(--success);
  opacity: .6; pointer-events: none;
}
.ps-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; }
.ps-bar-val { font-size: .7rem; font-weight: 700; color: var(--muted); line-height: 1; }
.ps-bar-val.is-pass { color: var(--success); }
.ps-bar-track { width: 100%; max-width: 28px; height: 44px; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.ps-bar-fill { width: 100%; background: var(--orange-400); border-radius: 6px; }
.ps-bar-fill.is-pass { background: var(--success); }
.ps-label { font-size: .82rem; font-weight: 700; color: var(--text-soft); margin: 0 0 6px; }
.ps-seg {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 12px;
}
.ps-seg-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; }
.ps-opt {
  border: 0; background: transparent; border-radius: 9px; padding: 9px 4px; cursor: pointer;
  font: inherit; font-size: .92rem; font-weight: 700; color: var(--muted); transition: background .15s, color .15s;
}
.ps-opt.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }
.ps-opt:focus-visible { outline: 2px solid var(--primary-mid); outline-offset: 1px; }
.ps-hint { margin: 6px 2px 12px; font-size: .8rem; color: var(--muted); }
.ps-start { width: 100%; border-radius: 14px; padding: 13px; font-size: 1.05rem; font-weight: 800; }

/* Live lesson: the caption is the sentence the voice is saying; points the
   voice does not talk about on this card are not shown */
.sc .sc-spot.sc-off, .sc .sc-chip.sc-off { display: none; }
.sc-card.is-said { --tone: var(--tone, #64748b); }
.sc-card.is-said:not([style]) { --tone: #94a3b8; }
.sc-card.is-said p { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.sc-card.is-said p b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--tone); color: #fff; font-size: .75rem; flex: 0 0 auto; margin-top: 3px; }

/* Axis 7 reference pages: animated scenes in the lesson style */
.marking-scene { padding: 12px 12px 4px; }
.marking-scene .sc { margin: 0; }
.marking-scene .sc-stage { width: 100%; height: auto; aspect-ratio: 360 / 220; }

/* ── صفحة الدروس فالتيليفون: كلشي فشاشة وحدة (نفس الكارطات ونفس الألوان، غير أصغر) ── */
@media (max-width: 520px) {
  .lessons-hub-wrap { gap: 12px; }
  .lessons-hub-wrap .pg-head { margin-bottom: 0; }
  .lessons-hub-wrap .pg-head h1 { font-size: 1.35rem; margin-bottom: 2px; }
  .lessons-hub-wrap .pg-head p { font-size: 0.78rem; line-height: 1.45; }

  .lessons-hub-wrap .il-hub-progress-card { padding: 10px 12px; gap: 8px; margin-bottom: 0; }
  .lessons-hub-wrap .il-hub-progress-head { margin-bottom: 6px; gap: 2px 8px; flex-wrap: wrap; }
  .lessons-hub-wrap .il-hub-progress-head > .muted { font-size: 0.72rem; white-space: nowrap; }
  .lessons-hub-wrap .il-hub-progress-title { font-size: 0.86rem; gap: 6px; white-space: nowrap; }
  .lessons-hub-wrap .il-hub-progress-pct { font-size: 0.76rem; padding: 1px 7px; }
  .lessons-hub-wrap .il-hub-progress-bar { height: 6px; margin-bottom: 0; }
  .lessons-hub-wrap .il-hub-progress-sub { display: none; }
  .lessons-hub-wrap .il-hub-continue-btn { padding: 7px 14px; font-size: 0.86rem; min-height: 0; }

  .lessons-hub-wrap .axis-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .lessons-hub-wrap .axis-wide-card { min-height: 0; padding: 9px 11px; gap: 2px; border-radius: 14px; }
  .lessons-hub-wrap .cat-tile-head { margin-bottom: 4px; }
  .lessons-hub-wrap .cat-tile-icon { width: 30px; height: 30px; border-radius: 9px; font-size: 1rem; }
  .lessons-hub-wrap .cat-tile-icon .ic { width: 1.05rem; height: 1.05rem; }
  .lessons-hub-wrap .cat-tile-badge { font-size: 0.68rem; padding: 2px 7px; }
  .lessons-hub-wrap .cat-tile-title { font-size: 0.84rem; line-height: 1.3; margin-bottom: 0; }
  .lessons-hub-wrap .cat-tile-sub { font-size: 0.68rem; line-height: 1.3; margin-bottom: 4px; }
  .lessons-hub-wrap .cat-tile-progress { height: 4px; }
  /* المحور السابع بوحدو: ياخد السطر كامل */
  .lessons-hub-wrap .axis-cards-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }

  .lessons-hub-wrap .lessons-bottom-guides { margin-top: 8px !important; gap: 20px !important; }
}
