/*!
 * theme.css — redesign layer for the exam platform (dark professional, light switchable)
 * Generated 2026-09-18 from theme-tokens.css + theme-utilities.js + theme-components.css
 * Loaded AFTER offline.css; it re-points the legacy CSS variables and supplies the
 * utility classes the markup always referenced but which were never shipped.
 */


@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/plex-arabic-400-arabic-1.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/plex-arabic-400-latin-2.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/plex-arabic-500-arabic-3.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/plex-arabic-500-latin-4.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/plex-arabic-600-arabic-5.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/plex-arabic-600-latin-6.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/plex-arabic-700-arabic-7.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/plex-arabic-700-latin-8.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================================
   Design tokens, base layer and typography — dark-first professional theme.
   Loaded after offline.css: the token block below re-points the variables the old
   stylesheet already consumes (--ink, --line, --muted, --navy, --teal ...), which
   converts a large part of the legacy rules to the new palette automatically.
   ============================================================================ */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #0a0406;
  --bg-elevated: #150809;
  --surface: #1b0a0d;
  --surface-2: #241014;
  --surface-3: #2e1319;

  /* lines & text */
  --border: #3a181d;
  --border-strong: #4a1d23;
  --text: #f6ecec;
  --text-muted: #c2a9ac;
  --text-dim: #9a7c80;

  /* light content surfaces — the menu and every section panel stay white in both
     themes, with dark text inside them (contrast is decided by the surface, not the
     page). */
  --panel-bg: #ffffff;
  --panel-soft: #faf6f6;
  --panel-soft-2: #f7f0f0;
  --panel-border: #eddede;
  --panel-text: #1a0c0f;
  --panel-text-muted: #6b5a5c;
  /* 4.9:1 on white — the previous #7c8aa0 sat at 3.5:1 and failed AA for normal text */
  --panel-text-dim: #8a7678;
  --primary-on-panel: #8b1a1a;
  --success-on-panel: #8b1a1a;
  --warning-on-panel: #b45309;
  --danger-on-panel: #b42318;
  --info-on-panel: #6d28d9;

  /* سطح نافذة الاختبار — سطح ثالث غير اللوحة وغير الصفحة: كريميّ دافئ، لأن
     ورقة الاختبار تُقرأ كالورق لا كشاشة. وهذه القيم كانت مكتوبة بصيغة سداسية
     في 53 قاعدة `body:has(.exam-question)`، فكان أي مكوّن جديد يخترع لونه.
     والآن مصدر واحد: كل مكوّن داخل السؤال يأخذ من هنا. */
  --exam-surface: #FFFFFF;
  --exam-surface-alt: #f2faf8;
  --exam-surface-pick: #E6F4F1;
  --exam-border: #E3EAED;
  --exam-border-strong: #E3EAED;
  --exam-border-soft: #d8c9ab;
  --exam-ink: #0B1B22;
  --exam-muted: #5C737C;
  --exam-accent: var(--primary-strong, #0E8C9B);
  --exam-card: #fff;
  --exam-chip: #f7f1f1;
  --exam-chip-ink: #4a3a3c;
  --exam-ok: #0F7A5A;
  --exam-ok-deep: #14532d;
  --exam-warn: #f59e0b;
  --exam-warn-deep: #b45309;

  /* brand + semantics */
  --primary: #c8283a;
  --primary-strong: #0E8C9B;
  --primary-soft: rgba(200, 40, 58, .14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --info: #a78bfa;
  --info-soft: rgba(167, 139, 250, .14);
  --on-accent: #14060a;

  /* derived borders / hover fills — plain tokens so no browser needs color-mix() */
  --primary-border: rgba(200, 40, 58, .45);
  --primary-hover: rgba(200, 40, 58, .22);
  --success-border: rgba(52, 211, 153, .40);
  --warning-border: rgba(251, 191, 36, .38);
  --danger-border: rgba(248, 113, 113, .42);
  --danger-hover: rgba(248, 113, 113, .22);

  /* legacy tokens consumed by offline.css. They are re-pointed at the white content
     surfaces on purpose: offline.css uses them inside the sidebar, tables and panels.
     Rules that live on the dark chrome (header, tooltips, toasts) are given their own
     colour in the component layer. */
  --ink: var(--panel-text);
  --muted: var(--panel-text-muted);
  --line: var(--panel-border);
  --panel: var(--panel-bg);
  --navy: #150809;
  --teal: var(--primary-on-panel);
  --gold: var(--warning-on-panel);
  --surface-soft: var(--panel-soft);
  --shadow-soft: 0 10px 28px rgba(2, 8, 20, .45);
  --shadow-hover: 0 16px 34px rgba(2, 8, 20, .55);

  /* geometry */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --ring: 0 0 0 3px rgba(200, 40, 58, .35);

  /* مقابض يكتبها الجافاسكربت وقت التشغيل (exam-shell.js ومقبض الدرج). أُعلنت هنا
     ليكون الافتراضيّ في موضع واحد، فلا يظهر الرمز يتيمًا في التدقيق. */
  --exam-font-scale: 1;
  --drawer-top: 5rem;
  --exam-bar-bottom: 0px;
}

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

body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

body::before { opacity: .06 !important; }

h1, h2, h3, h4, h5, h6, strong, b, th { font-weight: 600; }
h1, h2, h3, h4 { letter-spacing: -.01em; line-height: 1.35; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }

::selection { background: var(--primary-soft); color: var(--text); }

/* scrollbars */
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: content-box; }

/* focus visibility everywhere */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* theme switch control (injected by theme.js into the dashboard header) */

/* ---------- utility layer (spacing, color, layout, typography) ---------- */
.p-0 { padding: 0; }
.p-1 { padding: .25rem; }
.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }
.px-0 { padding-inline: 0; }
.px-1 { padding-inline: .25rem; }
.px-2 { padding-inline: .5rem; }
.px-3 { padding-inline: .75rem; }
.px-4 { padding-inline: 1rem; }
.px-5 { padding-inline: 1.25rem; }
.px-6 { padding-inline: 1.5rem; }
.px-8 { padding-inline: 2rem; }
.px-10 { padding-inline: 2.5rem; }
.px-12 { padding-inline: 3rem; }
.py-0 { padding-block: 0; }
.py-1 { padding-block: .25rem; }
.py-2 { padding-block: .5rem; }
.py-3 { padding-block: .75rem; }
.py-4 { padding-block: 1rem; }
.py-5 { padding-block: 1.25rem; }
.py-6 { padding-block: 1.5rem; }
.py-8 { padding-block: 2rem; }
.py-10 { padding-block: 2.5rem; }
.py-12 { padding-block: 3rem; }
.pt-0 { padding-top: 0; }
.pt-1 { padding-top: .25rem; }
.pt-2 { padding-top: .5rem; }
.pt-3 { padding-top: .75rem; }
.pt-4 { padding-top: 1rem; }
.pt-5 { padding-top: 1.25rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pt-10 { padding-top: 2.5rem; }
.pt-12 { padding-top: 3rem; }
.pb-0 { padding-bottom: 0; }
.pb-1 { padding-bottom: .25rem; }
.pb-2 { padding-bottom: .5rem; }
.pb-3 { padding-bottom: .75rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-5 { padding-bottom: 1.25rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pb-8 { padding-bottom: 2rem; }
.pb-10 { padding-bottom: 2.5rem; }
.pb-12 { padding-bottom: 3rem; }
.pl-0 { padding-left: 0; }
.pl-1 { padding-left: .25rem; }
.pl-2 { padding-left: .5rem; }
.pl-3 { padding-left: .75rem; }
.pl-4 { padding-left: 1rem; }
.pl-5 { padding-left: 1.25rem; }
.pl-6 { padding-left: 1.5rem; }
.pl-8 { padding-left: 2rem; }
.pl-10 { padding-left: 2.5rem; }
.pl-12 { padding-left: 3rem; }
.pr-0 { padding-right: 0; }
.pr-1 { padding-right: .25rem; }
.pr-2 { padding-right: .5rem; }
.pr-3 { padding-right: .75rem; }
.pr-4 { padding-right: 1rem; }
.pr-5 { padding-right: 1.25rem; }
.pr-6 { padding-right: 1.5rem; }
.pr-8 { padding-right: 2rem; }
.pr-10 { padding-right: 2.5rem; }
.pr-12 { padding-right: 3rem; }
.m-0 { margin: 0; }
.m-1 { margin: .25rem; }
.m-2 { margin: .5rem; }
.m-3 { margin: .75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }
.m-10 { margin: 2.5rem; }
.m-12 { margin: 3rem; }
.mx-0 { margin-inline: 0; }
.mx-1 { margin-inline: .25rem; }
.mx-2 { margin-inline: .5rem; }
.mx-3 { margin-inline: .75rem; }
.mx-4 { margin-inline: 1rem; }
.mx-5 { margin-inline: 1.25rem; }
.mx-6 { margin-inline: 1.5rem; }
.mx-8 { margin-inline: 2rem; }
.mx-10 { margin-inline: 2.5rem; }
.mx-12 { margin-inline: 3rem; }
.my-0 { margin-block: 0; }
.my-1 { margin-block: .25rem; }
.my-2 { margin-block: .5rem; }
.my-3 { margin-block: .75rem; }
.my-4 { margin-block: 1rem; }
.my-5 { margin-block: 1.25rem; }
.my-6 { margin-block: 1.5rem; }
.my-8 { margin-block: 2rem; }
.my-10 { margin-block: 2.5rem; }
.my-12 { margin-block: 3rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.ml-0 { margin-left: 0; }
.ml-1 { margin-left: .25rem; }
.ml-2 { margin-left: .5rem; }
.ml-3 { margin-left: .75rem; }
.ml-4 { margin-left: 1rem; }
.ml-5 { margin-left: 1.25rem; }
.ml-6 { margin-left: 1.5rem; }
.ml-8 { margin-left: 2rem; }
.ml-10 { margin-left: 2.5rem; }
.ml-12 { margin-left: 3rem; }
.mr-0 { margin-right: 0; }
.mr-1 { margin-right: .25rem; }
.mr-2 { margin-right: .5rem; }
.mr-3 { margin-right: .75rem; }
.mr-4 { margin-right: 1rem; }
.mr-5 { margin-right: 1.25rem; }
.mr-6 { margin-right: 1.5rem; }
.mr-8 { margin-right: 2rem; }
.mr-10 { margin-right: 2.5rem; }
.mr-12 { margin-right: 3rem; }
.gap-0 { gap: 0; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.space-y-1 > * + * { margin-top: .25rem; }
.space-x-1 > * + * { margin-inline-start: .25rem; }
.space-y-2 > * + * { margin-top: .5rem; }
.space-x-2 > * + * { margin-inline-start: .5rem; }
.space-y-3 > * + * { margin-top: .75rem; }
.space-x-3 > * + * { margin-inline-start: .75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-x-4 > * + * { margin-inline-start: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-x-5 > * + * { margin-inline-start: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-x-6 > * + * { margin-inline-start: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-x-8 > * + * { margin-inline-start: 2rem; }
.space-y-10 > * + * { margin-top: 2.5rem; }
.space-x-10 > * + * { margin-inline-start: 2.5rem; }
.space-y-12 > * + * { margin-top: 3rem; }
.space-x-12 > * + * { margin-inline-start: 3rem; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }
.inline { display: inline; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-1 { flex: 1 1 0%; min-width: 0; }
.flex-none { flex: none; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.max-h-60 { max-height: 15rem; overflow-y: auto; }
.mx-auto { margin-inline: auto; }
.table-auto { table-layout: auto; }
.table-fixed { table-layout: fixed; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.pointer-events-none { pointer-events: none; }
.select-none { user-select: none; }
.whitespace-nowrap { white-space: nowrap; }
.break-words { overflow-wrap: anywhere; }
.container { width: 100%; max-width: 1200px; margin-inline: auto; }
.object-contain { object-fit: contain; }
.bg-white { background-color: var(--panel-bg); color: var(--panel-text); }
.bg-slate-50 { background-color: var(--panel-soft); }
.bg-gray-50 { background-color: var(--panel-soft); }
.bg-slate-100 { background-color: var(--panel-soft-2); }
.bg-gray-100 { background-color: var(--panel-soft-2); }
.bg-gray-200 { background-color: var(--panel-soft-2); }
.bg-slate-200 { background-color: var(--surface-3); }
.bg-slate-300 { background-color: var(--panel-soft-2); }
.bg-gray-700 { background-color: var(--surface-3); }
.bg-gray-800 { background-color: var(--bg-elevated); }
.bg-brand-ink { background-color: var(--surface-3); }
.bg-slate-800 { background-color: var(--bg-elevated); }
.bg-slate-900 { background-color: var(--navy); }
/* تعريف واحد لـ .bg-brand-red. كان ثلاثة متعارضة (--primary-strong ثم --primary ثم
   --info) من استبدالٍ آليّ للأدوات الزرقاء، والفائز كان --info أي بنفسجي — ثم كان
   يُجبَر بالحرف في طبقة لاحقة. رمز واحد يُتبع البالِت بلا إجبار. */
.bg-brand-red { background-color: var(--primary-strong); color: var(--on-accent); }
.bg-brand-soft { background-color: var(--primary-soft); color: var(--primary); }
.bg-red-600 { background-color: var(--danger); color: #fff; }
.bg-red-500 { background-color: var(--danger); color: #fff; }
.bg-red-300 { background-color: var(--danger-soft); color: var(--danger); }
.bg-green-600 { background-color: var(--success); color: #14060a; }
.bg-amber-500 { background-color: var(--warning); color: #2b1c04; }
.bg-orange-600 { background-color: var(--warning-on-panel); color: #fff; }
.bg-orange-500 { background-color: var(--warning); color: #2b1c04; }
.bg-teal-600 { background-color: var(--success-on-panel); color: #fff; }
.bg-cyan-600 { background-color: var(--primary-on-panel); color: #fff; }
.bg-emerald-700 { background-color: var(--success-on-panel); color: #fff; }
.bg-emerald-600 { background-color: var(--success-on-panel); color: #fff; }
.bg-purple-600 { background-color: var(--info-on-panel); color: #fff; }
.bg-violet-600 { background-color: var(--info-on-panel); color: #fff; }
.text-white { color: #fff; }
.text-black { color: #0a0406; }
.text-brand-muted { color: var(--panel-text-muted); }
.text-slate-600 { color: var(--panel-text-muted); }
.text-slate-700 { color: var(--panel-text); }
.text-gray-500 { color: var(--panel-text-muted); }
.text-gray-600 { color: var(--panel-text-muted); }
.text-slate-900 { color: var(--panel-text); }
.text-red-600 { color: var(--danger); }
.text-red-500 { color: var(--danger); }
.text-green-600 { color: var(--success); }
.text-brand-red { color: var(--primary); }
.text-brand-red { color: var(--info); }
.border-red-500 { border-color: var(--danger); }
.border-green-500 { border-color: var(--success); }
.border-brand-red { border-color: var(--primary); }
.text-xs { font-size: .75rem; }
.text-sm { font-size: .875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.rounded { border-radius: var(--radius-sm); }
.rounded-sm { border-radius: 6px; }
.rounded-md { border-radius: 10px; }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: var(--radius-lg); }
.rounded-2xl { border-radius: 20px; }
.rounded-full { border-radius: var(--radius-pill); }
.opacity-50 { opacity: .5; }
.opacity-60 { opacity: .6; }
.opacity-70 { opacity: .7; }
.opacity-75 { opacity: .75; }
.opacity-80 { opacity: .8; }
.opacity-90 { opacity: .9; }
.opacity-100 { opacity: 1; }
.leading-tight { line-height: 1.3; }
.leading-normal { line-height: 1.6; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.border { border: 1px solid var(--panel-border); }
.border-t { border-t: 1px solid var(--panel-border); }
.border-b { border-b: 1px solid var(--panel-border); }
.border-l { border-l: 1px solid var(--panel-border); }
.border-r { border-r: 1px solid var(--panel-border); }
.border-0 { border: 0; }
.border-2 { border-width: 2px; border-style: solid; border-color: var(--border); }
.shadow-sm { box-shadow: 0 1px 2px rgba(2, 8, 20, .35); }
.shadow { box-shadow: var(--shadow-soft); }
.shadow-lg { box-shadow: var(--shadow-hover); }
.shadow-xl { box-shadow: 0 22px 45px rgba(2, 8, 20, .5); }
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:flex-row { flex-direction: row; }
}

/* ============================================================================
   Component layer.
   Layout rule of the redesign: the PAGE is dark (background + header); the MENU and
   every SECTION PANEL are white with dark text. Contrast therefore follows the
   surface, never the theme.
   The menu is a slide-in drawer: hidden until the header button is pressed, and it
   closes again as soon as a section is chosen.
   ============================================================================ */

/* ---------------- shell: single column + overlay drawer ---------------- */
.dashboard-shell {
  display: block !important;
  width: min(calc(100% - 2rem), var(--content-width, 1400px)) !important;
  margin-inline: auto;
  padding-block: 1rem;
}
.dashboard-shell #statsSection { grid-column: auto; }

.dashboard-sidebar {
  position: fixed !important;
  top: var(--drawer-top, 5rem) !important;
  bottom: 0 !important;
  right: 0 !important;
  left: auto !important;
  width: min(88vw, 330px) !important;
  max-height: none !important;
  z-index: 900 !important;
  display: grid !important;
  align-content: start;
  /* compact enough that all 16 sections fit without scrolling on a 900px-high screen */
  gap: .16rem;
  padding: .7rem !important;
  margin: 0 !important;
  background: var(--panel-bg) !important;
  color: var(--panel-text) !important;
  border: 1px solid var(--panel-border) !important;
  border-inline-end: 0 !important;
  border-radius: 18px 0 0 18px !important;
  box-shadow: -22px 0 55px rgba(2, 8, 20, .5) !important;
  overflow-y: auto !important;
  transform: translateX(102%);
  opacity: 0;
  visibility: hidden;
  transition: transform 280ms cubic-bezier(.22, .61, .36, 1), opacity 200ms ease, visibility 0s linear 280ms;
}
body:not(.sidebar-collapsed) .dashboard-sidebar {
  transform: none;
  opacity: 1;
  visibility: visible;
  padding: .85rem !important;
  border-width: 1px !important;
  transition: transform 280ms cubic-bezier(.22, .61, .36, 1), opacity 200ms ease;
}

/* The scrim only has to separate the menu from the page — at 0.55 it washed the white
   panels to grey and read as a broken design, so it is much lighter now. */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 880;
  background: rgba(3, 7, 18, .32);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 0s linear 200ms;
}
body.drawer-open .drawer-scrim { opacity: 1; visibility: visible; transition: opacity 200ms ease; }

.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .1rem .15rem .55rem; border-bottom: 1px solid var(--panel-border); margin-bottom: .45rem; }
.drawer-head strong { color: var(--panel-text); font-size: .95rem; }
.drawer-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; padding: 0;
  border: 1px solid var(--panel-border); border-radius: 10px;
  background: var(--panel-soft); color: var(--panel-text-muted); cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.drawer-close:hover { background: var(--panel-soft-2); color: var(--panel-text); transform: rotate(90deg); }
.drawer-close svg { width: 1rem; height: 1rem; }

/* ---------------- menu items (on white) ---------------- */
#sections, .dashboard-sidebar {
  background: var(--panel-bg) !important;
  border-color: var(--panel-border) !important;
  box-shadow: none !important;
}
.section-button {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .45rem .6rem !important;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--panel-text-muted) !important;
  font: inherit;
  font-size: .87rem;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.section-button:hover { background: var(--panel-soft); color: var(--panel-text) !important; transform: translateX(-3px); }
.section-button.is-active,
.section-button.active {
  background: var(--panel-soft-2) !important;
  color: var(--primary-on-panel) !important;
  font-weight: 600;
  box-shadow: inset -3px 0 0 0 var(--primary-on-panel);
}
.section-button svg, .section-button [data-lucide] { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
.sidebar-guide-separator { border-top: 1px dashed var(--panel-border); margin: .4rem .15rem; }
.sidebar-guide-button { color: var(--panel-text-dim) !important; }

/* ---------------- content panel (white) ---------------- */
.dashboard-shell #content {
  background: var(--panel-bg) !important;
  color: var(--panel-text) !important;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(2, 8, 20, .35);
  padding: 1.15rem;
}
.dashboard-shell #content h1, .dashboard-shell #content h2,
.dashboard-shell #content h3, .dashboard-shell #content h4, .dashboard-shell #content strong { color: var(--panel-text); }
.dashboard-shell #content small { color: var(--panel-text-muted); }

#statsSection > div {
  background: var(--panel-bg) !important;
  color: var(--panel-text) !important;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(2, 8, 20, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}
#statsSection > div:hover { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(2, 8, 20, .38); }

.quick-navigation {
  background: var(--panel-soft) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: 14px;
  color: var(--panel-text);
}
.quick-navigation strong { color: var(--panel-text); }
.quick-navigation small { color: var(--panel-text-muted); display: block; }
.quick-navigation-links { display: flex; flex-wrap: wrap; gap: .45rem; }

/* ============================================================================
   Contrast guard: wording must always be the opposite of the surface it sits on.
   A `text-white` inside a white panel that carries no colour of its own would be
   invisible, so it flips to the panel ink. Elements that do bring their own coloured
   background keep their white wording.
   ============================================================================ */
.dashboard-shell #content .text-white:not([class*="bg-"]):not(.btn-primary):not(.btn-danger):not(.btn-icon-text):not(.icon-primary):not(.icon-delete):not(.icon-success):not(.icon-only-btn),
.dashboard-sidebar .text-white:not([class*="bg-"]) ,
#statsSection .text-white:not([class*="bg-"]),
.chart-panel .text-white:not([class*="bg-"]),
#modal .text-white:not([class*="bg-"]):not(.btn-primary):not(.btn-danger),
.login-card .text-white:not([class*="bg-"]),
.report-document-section .text-white:not([class*="bg-"]),
.survey-question .text-white:not([class*="bg-"]),
.exam-question .text-white:not([class*="bg-"]) { color: var(--panel-text) !important; }

/* the same problem wherever it happens: white wording inside a white container is
   invisible, no matter which page the container sits on */
.bg-white .text-white:not([class*="bg-"]),
[class*="bg-white"] .text-white:not([class*="bg-"]) { color: var(--panel-text) !important; }

/* the mirror case: dark ink dropped on the dark chrome */
.dashboard-page > header .text-slate-900:not([class*="bg-"]),
.dashboard-page > header .text-black:not([class*="bg-"]),
.platform-rights-bar .text-slate-900:not([class*="bg-"]) { color: var(--text) !important; }

/* ---------------- buttons (soft corners, tactile) ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .58rem 1.05rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
  color: var(--panel-text);
  font: inherit;
  font-weight: 600;
  font-size: .87rem;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(58, 24, 29, .07);
  transition: transform .16s ease, box-shadow .2s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(58, 24, 29, .16); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); box-shadow: 0 2px 6px rgba(58, 24, 29, .12); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }

.btn-primary { background: linear-gradient(135deg, var(--primary-strong), var(--primary)); border-color: transparent; color: #fff; box-shadow: 0 8px 18px rgba(161, 30, 42, .3); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 28px rgba(161, 30, 42, .38); }
.btn-secondary { background: var(--panel-soft); border-color: var(--panel-border); color: var(--panel-text); }
.btn-secondary:hover:not(:disabled) { background: var(--panel-bg); }
.btn-danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-on-panel); }
.btn-danger:hover:not(:disabled) { background: #fdecea; }

/* a labelled button that also shows its icon */
.btn-icon-text { display: inline-flex; align-items: center; gap: .5rem; }

/* buttons that never got the .btn class still lose their hard corners */
button:not(.icon-action-btn):not(.section-button):not(.password-toggle):not(.theme-toggle):not(.drawer-close):not(.quick-navigation-link):not(.login-link) { border-radius: 12px; }

/* ---------------- form controls (white surfaces) ---------------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
  color: var(--panel-text);
  font: inherit;
  font-size: .9rem;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--panel-text-dim); }
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus { border-color: var(--primary-strong); box-shadow: 0 0 0 3px rgba(200, 40, 58, .28); outline: none; }
input[type="checkbox"], input[type="radio"] { width: 1.05rem; height: 1.05rem; accent-color: var(--primary-strong); vertical-align: middle; }
input[type="file"] { color: var(--panel-text-muted); font-size: .85rem; }
option { background: #fff; color: var(--panel-text); }
label > span:first-child { color: var(--panel-text-muted); font-size: .82rem; }
fieldset { border: 1px solid var(--panel-border); border-radius: 14px; padding: 1rem; }
.inline-field { display: inline-flex; flex-direction: column; gap: .25rem; min-width: 150px; }
.inline-field > span, .inline-field > label { color: var(--panel-text-muted); font-size: .78rem; }

/* ---------------- header (dark chrome) ---------------- */
.dashboard-page > header {
  background: linear-gradient(180deg, var(--header-from, #14070a), var(--header-to, #0a0406)) !important;
  border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  /* the header is dark, so anything inheriting inside it must be light: without this
     a new text node with no colour class of its own would be unreadable */
  color: #f8efef;
}
.dashboard-page header h1, .dashboard-page header h1 > * { color: #f8efef !important; }
#identity { color: rgba(226, 235, 250, .72) !important; }
#platformLogo { background: none !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; box-shadow: none !important; }

.header-icon-button, .header-action-button {
  background: rgba(255, 255, 255, .07) !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  color: #f6ecec !important;
  border-radius: 12px;
  transition: background .16s ease, transform .16s ease, border-color .16s ease;
}
.header-icon-button:hover, .header-action-button:hover { background: rgba(255, 255, 255, .14) !important; transform: translateY(-1px); }
.header-logout-button { background: var(--primary, #c8283a) !important; border: 1px solid var(--primary-strong, #0E8C9B) !important; color: #fff !important; border-radius: 12px; font-weight: 700; padding: .45rem .95rem !important; }
.header-logout-button:hover { background: var(--primary-strong, #0E8C9B) !important; }
.header-action-button span { background: #f87171 !important; color: #210505 !important; }
#notificationMenu { background: var(--panel-bg) !important; color: var(--panel-text) !important; border: 1px solid var(--panel-border) !important; border-radius: 14px; box-shadow: 0 24px 50px rgba(2, 8, 20, .45) !important; }

/* ---------------- tables (white) ---------------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th, th {
  background: var(--panel-soft) !important;
  color: var(--panel-text-muted) !important;
  font-size: .78rem;
  font-weight: 600;
  padding: .7rem .6rem !important;
  border-bottom: 1px solid var(--panel-border) !important;
  text-align: start;
}
td { color: var(--panel-text) !important; padding: .7rem .6rem !important; border-bottom: 1px solid var(--panel-border); background: transparent; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: var(--panel-soft) !important; }
tbody tr:last-child td { border-bottom: 0; }
td, th { vertical-align: middle; }
.question-bank-table thead th:last-child { background: #14070a !important; color: #f6ecec !important; }
.question-bank-table .actions-cell { background: var(--panel-bg) !important; box-shadow: 4px 0 12px rgba(58, 24, 29, .10) !important; }
.question-bank-pagination { color: var(--panel-text-muted); }
.question-bank-pagination span { color: var(--panel-text-muted) !important; }

.status-active {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .16rem .6rem; border-radius: 999px;
  background: var(--success-soft); color: var(--success-on-panel);
  font-size: .75rem; font-weight: 600;
}

/* ---------------- icon action buttons ---------------- */
.actions-cell { min-width: 0 !important; }
.icon-action-btn {
  width: 2.3rem; height: 2.3rem;
  border: 1px solid var(--panel-border) !important;
  border-radius: 12px !important;
  background: var(--panel-soft) !important;
  color: var(--panel-text-muted) !important;
  box-shadow: none;
  transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .18s ease;
}
.icon-action-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(58, 24, 29, .16); }
.icon-action-btn.icon-edit { background: var(--warning-soft) !important; color: var(--warning-on-panel) !important; border-color: var(--warning-border) !important; }
.icon-action-btn.icon-delete { background: var(--danger-soft) !important; color: var(--danger-on-panel) !important; border-color: var(--danger-border) !important; }
.icon-action-btn.icon-success { background: var(--success-soft) !important; color: var(--success-on-panel) !important; border-color: var(--success-border) !important; }
.icon-action-btn.icon-warning { background: var(--warning-soft) !important; color: var(--warning-on-panel) !important; border-color: var(--warning-border) !important; }
.icon-action-btn.icon-primary { background: var(--primary-soft) !important; color: var(--primary-on-panel) !important; border-color: var(--primary-border) !important; }
.icon-action-btn.icon-secondary { background: var(--panel-soft) !important; color: var(--panel-text-muted) !important; }

/* ---------------- messages, panels, modal ---------------- */
.exam-message { padding: .85rem 1rem; border-radius: 14px; border: 1px solid var(--panel-border); background: var(--panel-soft); color: var(--panel-text); }
.exam-message.error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-on-panel); }
.exam-message.success { background: var(--success-soft); border-color: var(--success-border); color: var(--success-on-panel); }

.report-document-section, .survey-donut, .survey-question, .exam-question, .report-directory {
  background: var(--panel-bg) !important;
  color: var(--panel-text) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}
.report-document-header, .report-document-footer { color: var(--panel-text) !important; }
.report-toolbar { background: var(--panel-soft) !important; border: 1px solid var(--panel-border) !important; border-radius: 14px; }

#modal { background: rgba(3, 7, 18, .68) !important; }
#modal > div, #modal .modal-card, #modal .modal-content, #modal > form {
  background: var(--panel-bg) !important;
  color: var(--panel-text) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: 18px !important;
  box-shadow: 0 30px 70px rgba(2, 8, 20, .55) !important;
}
#modal h2, #modal h3, #modal strong { color: var(--panel-text); }
#modal input, #modal select, #modal textarea { background: var(--panel-bg); color: var(--panel-text); }
.modal-close { background: var(--panel-soft) !important; color: var(--panel-text-muted) !important; border: 1px solid var(--panel-border) !important; border-radius: 10px; }

/* ---------------- toast + tooltip (dark floating) ---------------- */
.toast { background: #1f0c10 !important; color: #f6ecec !important; border: 1px solid #3a181d !important; border-right: 4px solid var(--primary) !important; border-radius: 14px; box-shadow: 0 22px 44px rgba(2, 8, 20, .55); }
.toast svg { color: var(--primary) !important; }
.toast-success { border-right-color: #34d399 !important; }
.toast-success svg { color: #34d399 !important; }
.toast-warning { border-right-color: #fbbf24 !important; }
.toast-warning svg { color: #fbbf24 !important; }
.toast-error { border-right-color: #f87171 !important; }
.toast-error svg { color: #f87171 !important; }
.toast button { background: transparent; border: 0; color: #c2a9ac; font-size: 1.1rem; cursor: pointer; }
.ui-tooltip { background: #1f0c10 !important; color: #f6ecec !important; border: 1px solid #3a181d !important; border-radius: 10px; box-shadow: 0 16px 32px rgba(2, 8, 20, .55) !important; }
.icon-action-btn[data-label]:hover::after, .icon-action-btn[data-label]:focus-visible::after { background: #1f0c10 !important; color: #f6ecec !important; border: 1px solid #3a181d; border-radius: 8px; }
.icon-action-btn[data-label]:hover::before, .icon-action-btn[data-label]:focus-visible::before { border-top-color: #1f0c10 !important; }

/* ---------------- rights bar (chrome) ---------------- */
.platform-rights-bar { background: var(--bg, #0a0406) !important; border-top: 1px solid rgba(255, 255, 255, .08) !important; color: rgba(246, 236, 236, .72); }
.platform-rights-text, .platform-credit-text { color: rgba(246, 236, 236, .72) !important; }

/* ---------------- login (dark page, white card) ---------------- */
.login-page { background: radial-gradient(circle at 20% -10%, #12304d 0, var(--bg) 55%, #060c16 100%) !important; }
.login-card {
  background: var(--panel-bg) !important;
  color: var(--panel-text) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: 20px !important;
  box-shadow: 0 30px 70px rgba(2, 8, 20, .5) !important;
}
.login-card h2 { color: var(--panel-text) !important; }
.login-card p { color: var(--panel-text-muted) !important; }
.login-brand-panel h1 { color: #f8efef !important; }
.login-brand-panel p { color: rgba(226, 235, 250, .75) !important; }
.login-submit { background: linear-gradient(135deg, #16a34a, #0F7A5A) !important; color: #fff !important; border-radius: 12px !important; box-shadow: 0 10px 24px rgba(22, 163, 74, .32) !important; }
.login-submit:hover:not(:disabled) { box-shadow: 0 16px 30px rgba(22, 163, 74, .44) !important; }

/* The password reveal and "forget saved name" controls are deliberately static on the
   login page: no hover fill, no colour shift, no transition. Keyboard focus is still
   outlined so the controls stay reachable without a mouse. */
.password-toggle {
  color: var(--panel-text-muted);
  background: transparent !important;
  transition: none !important;
}
/* No hover treatment on the reveal button.
   offline.css ships a global micro-interaction — `button:hover:not(:disabled)` and
   `button:active:not(:disabled)` set `transform: translateY(-1px)/translateY(0)` —
   which would override the centring transform of this absolutely positioned button
   and make it jump 17px the moment the pointer touches it. Pinning the transform to
   its centring value is what keeps the control still, so it is restated here. */
.password-toggle:hover,
.password-toggle:active {
  background: transparent !important;
  color: var(--panel-text-muted) !important;
  transform: translateY(-50%) !important;
}
.password-toggle:focus-visible { background: transparent !important; outline: none; box-shadow: var(--ring) !important; }

/* Same global rule nudges the forget-name control 1px; it is an inline element, so
   its resting transform (none) is pinned instead. */
.login-link,
.login-link:hover,
.login-link:active { color: var(--primary-strong, #0E8C9B) !important; transition: none !important; transform: none !important; }

/* The rights footer is a fixed full-width bar on every page, the login page included.
   offline.css declares `.login-page > * { position: relative }` AFTER the fixed bar
   rule, which left the login footer unpinned and only as wide as its text — re-pin it
   with more weight than that wildcard. */
.login-page .platform-rights-bar {
  position: fixed !important;
  inset: auto 0 0 0 !important;
  width: 100% !important;
  max-width: none !important;
  z-index: 80 !important;
  font-size: .78rem;
}
.login-page .platform-rights-text,
.login-page .platform-credit-text { color: rgba(246, 236, 236, .75) !important; }
.login-page .platform-credit-text { opacity: 1 !important; }

/* ---------------- exam / survey runtime ---------------- */
.exam-nav { background: var(--panel-soft) !important; border: 1px solid var(--panel-border) !important; border-radius: 14px; }

/* ---- a question that carries an image: statement + options on the right, image on
   the left (in RTL the first grid column sits on the right), so the whole question is
   readable without scrolling ---- */
.question-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.question-layout.has-image { grid-template-columns: minmax(0, 1fr) minmax(0, 38%); }
.question-main, .question-media { min-width: 0; }
.question-media .question-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: #fff;
  cursor: zoom-in;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(58, 24, 29, .10);
  transition: box-shadow .16s ease, transform .16s ease;
}
.question-media .question-image-button:hover { box-shadow: 0 12px 26px rgba(58, 24, 29, .18); transform: translateY(-2px); }
.question-media .question-image { display: block; width: 100%; max-height: 44vh; object-fit: contain; }
.question-media small { display: block; padding: .35rem .5rem; color: var(--panel-text-muted); font-size: .72rem; }
@media (max-width: 900px) {
  .question-layout.has-image { grid-template-columns: minmax(0, 1fr); }
  .question-media .question-image { max-height: 32vh; }
}

/* ---- the exam action bar: pinned to the bottom, so previous / next / submit are
   always on screen on a desktop without scrolling. #exam keeps the page clear of it. ---- */
.exam-action-bar {
  position: fixed;
  inset-inline: 0;
  /* lifted by the height of the fixed rights footer (set from JS) so the two never
     overlap, and above it in the stacking order so the buttons stay clickable */
  bottom: var(--exam-bar-bottom, 0px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem clamp(.75rem, 3vw, 2.5rem);
  background: #1f0c10;
  border-top: 1px solid #3a181d;
  box-shadow: 0 -10px 30px rgba(2, 8, 20, .45);
}
.exam-action-bar-nav { display: flex; gap: .6rem; flex-wrap: wrap; }
.exam-action-bar .exam-nav {
  min-height: 2.45rem;
  padding: .5rem 1.15rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .18s ease, background .15s ease;
}
.exam-action-bar .exam-nav.secondary { background: rgba(255, 255, 255, .10) !important; border: 1px solid rgba(255, 255, 255, .18) !important; color: #f6ecec !important; }
.exam-action-bar .exam-nav.secondary:hover:not(:disabled) { background: rgba(255, 255, 255, .18) !important; }
.exam-action-bar .exam-nav.primary { background: linear-gradient(135deg, var(--primary-strong), var(--primary)) !important; border: 0 !important; color: #06121f !important; box-shadow: 0 8px 18px rgba(161, 30, 42, .32); }
.exam-action-bar .exam-nav.primary:hover:not(:disabled) { box-shadow: 0 12px 24px rgba(161, 30, 42, .42); }
.exam-action-bar .exam-nav:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.exam-action-bar #submit {
  min-height: 2.45rem;
  padding: .5rem 1.4rem;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #16a34a, #22c55e) !important;
  color: #04220f !important;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(34, 197, 94, .3);
}
.exam-action-bar #submit:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
#exam { padding-bottom: 4.5rem; }
.option-row { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: .55rem .7rem; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.option-row:hover { border-color: var(--primary-border); background: var(--panel-soft); transform: translateX(-3px); }
.selection-cell { background: transparent; }
hr { border: 0; border-top: 1px solid var(--panel-border); }
code, pre { background: var(--panel-soft); border: 1px solid var(--panel-border); border-radius: 10px; color: var(--panel-text); }

/* ============================================================================
   KPI strip: the summary counters sit on ONE row.
   ============================================================================ */
#statsSection {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  gap: .7rem !important;
  overflow-x: auto;
  margin-bottom: 1rem;
}
#statsSection > div {
  position: relative;
  flex: 1 1 0 !important;
  min-width: 0;
  min-height: 0 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  padding: .75rem .9rem 1rem !important;
  border-top: 0 !important;
  border-radius: 14px !important;
}
#statsSection > div > span {
  color: var(--panel-text-muted) !important;
  font-size: .8rem !important;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#statsSection > div > strong {
  font-size: 1.35rem !important;
  line-height: 1 !important;
  color: var(--panel-text) !important;
  flex: 0 0 auto;
}
#statsSection .kpi-bar {
  position: absolute;
  inset-inline: .6rem;
  bottom: .5rem;
  height: 4px !important;
  margin: 0 !important;
  background: var(--panel-soft-2) !important;
}
#statsSection .kpi-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary-strong), var(--primary)); }

/* ============================================================================
   Native control rendering: the white surfaces must not inherit the dark
   colour-scheme, otherwise checkboxes and dropdowns paint dark on white.
   ============================================================================ */
.dashboard-shell #content,
.dashboard-sidebar,
#modal > div, #modal > form, #modal .modal-card, #modal .modal-content,
.login-card,
#notificationMenu { color-scheme: light; }

.dashboard-shell input[type="checkbox"],
.dashboard-shell input[type="radio"],
#modal input[type="checkbox"], #modal input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  border: 1.5px solid #e0d2d2;
  border-radius: 6px;
  background: #fff;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  transition: background .15s ease, border-color .15s ease;
}
.dashboard-shell input[type="radio"], #modal input[type="radio"] { border-radius: 50%; }
.dashboard-shell input[type="checkbox"]:hover, .dashboard-shell input[type="radio"]:hover,
#modal input[type="checkbox"]:hover, #modal input[type="radio"]:hover { border-color: var(--primary-strong); }
.dashboard-shell input[type="checkbox"]:checked,
#modal input[type="checkbox"]:checked,
#maintenanceModal input[type="checkbox"]:checked,
.exam-builder-overlay input[type="checkbox"]:checked { background: var(--primary-strong); border-color: var(--primary-strong); }
.dashboard-shell input[type="checkbox"]:checked::after,
#modal input[type="checkbox"]:checked::after,
#maintenanceModal input[type="checkbox"]:checked::after,
.exam-builder-overlay input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  inset-inline-start: .3rem;
  top: .14rem;
  width: .3rem;
  height: .58rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.dashboard-shell input[type="radio"]:checked,
#modal input[type="radio"]:checked { background: #fff; border-color: var(--primary-strong); border-width: 5px; }

/* dropdowns get a chevron so they stop looking like plain boxes */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b83' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left .6rem center;
  background-size: 1rem 1rem;
  padding-left: 2rem;
}

/* ============================================================================
   Table legibility on white: a real header divider and visible row separators.
   ============================================================================ */
.dashboard-shell #content table thead th,
.dashboard-shell table thead th {
  background: var(--panel-soft) !important;
  border-bottom: 2px solid #d8e1ee !important;
}
.dashboard-shell #content table td,
.dashboard-shell table td { border-bottom: 1px solid #e8eef7 !important; }
.dashboard-shell table tbody tr:hover td { background: var(--panel-soft) !important; }

/* The sticky actions header keeps its dark plate; the rule above is more specific
   than the earlier `.question-bank-table thead th:last-child`, so it has to be
   restated here with matching weight or the cell ends up light text on light. */
.dashboard-shell #content .question-bank-table thead th:last-child,
.dashboard-shell #content table.question-bank-table thead th:last-child,
.dashboard-shell #content .actions-cell-header { background: #14070a !important; color: #f6ecec !important; }

/* ============================================================================
   Quick action row: the home and menu buttons live under the header, not in it.
   ============================================================================ */
.quick-actions-bar {
  width: min(calc(100% - 2rem), var(--content-width, 1400px));
  margin: .8rem auto 0;
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.quick-actions-bar .qa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  height: 2.5rem;
  padding: 0 .95rem;
  border-radius: 12px;
  font-size: .87rem;
  font-weight: 600;
  /* a solid plate with a clear edge: the old 7 %-white fill was invisible against the
     dark page (1.3:1), so the buttons read as floating icons rather than controls */
  background: rgba(255, 255, 255, .12) !important;
  border: 1px solid rgba(255, 255, 255, .22) !important;
  color: #f6ecec !important;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease, box-shadow .18s ease;
}
.quick-actions-bar .qa-btn:hover { background: rgba(255, 255, 255, .16) !important; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .35); }
.quick-actions-bar .qa-btn:active { transform: translateY(0) scale(.985); }
.quick-actions-bar .qa-btn svg { width: 1.05rem; height: 1.05rem; }
.quick-actions-bar .qa-label { line-height: 1; }

/* The dark page keeps its light ink no matter what surface utility a wrapper carries —
   offline.css also ships `button, .btn, a[class*="bg-"] { min-height: 2.9rem }`, and a
   page wrapper with a light tint must not turn the page text dark. */
body { color: var(--text) !important; }

/* offline.css makes every button 2.9rem tall, which pushed the last drawer entries out
   of view; the menu items are compact controls and state their own height. */
.section-button { min-height: 2.05rem !important; }
/* the menu button shows that the drawer is open */
#sidebarToggle[aria-expanded="true"] { background: var(--primary-strong) !important; border-color: transparent !important; color: #fff !important; }

/* the scrim must not swallow clicks while the drawer is closed */
.drawer-scrim { pointer-events: none; }
body.drawer-open .drawer-scrim { pointer-events: auto; }

/* when a section is picked the menu vanishes in the same frame */
body.drawer-instant .dashboard-sidebar,
body.drawer-instant .drawer-scrim { transition: none !important; }

/* ============================================================================
   Icon-only buttons: a control that carried an icon AND a word keeps the icon and
   shrinks to it. The wording is hidden — not deleted — so scripts that still hold a
   reference to the label keep working, and screen readers still read aria-label.
   ============================================================================ */
.icon-only-btn {
  font-size: 0 !important;
  gap: 0 !important;
  width: 2.3rem !important;
  min-width: 2.3rem !important;
  max-width: 2.3rem !important;
  height: 2.3rem !important;
  min-height: 2.3rem !important;
  padding: 0 !important;
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
}
.icon-only-btn > span,
.icon-only-btn > b,
.icon-only-btn > strong,
.icon-only-btn > small,
.icon-only-btn > em { font-size: 0 !important; line-height: 0 !important; }
.icon-only-btn > svg,
.icon-only-btn > i[data-lucide] { width: 1.05rem !important; height: 1.05rem !important; }
.icon-only-btn[data-label]:hover::after,
.icon-only-btn[data-label]:focus-visible::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + .4rem);
  right: 50%;
  transform: translateX(50%);
  background: #1f0c10;
  color: #f6ecec;
  border: 1px solid #3a181d;
  padding: .3rem .6rem;
  border-radius: 8px;
  font-size: .72rem;
  line-height: 1.2;
  white-space: nowrap;
  z-index: 40;
  pointer-events: none;
}
.icon-only-btn { position: relative; }

/* ============================================================================
   The legacy sheet forces `min-height: 2.7rem` on every button and field, which
   stretched the square controls into tall rectangles. Anything that is meant to be
   square states its own box explicitly.
   ============================================================================ */
.icon-action-btn, .icon-only-btn, .drawer-close, .password-toggle, .theme-toggle,
.header-icon-button, .header-action-button, .qa-btn { min-height: 0; flex: 0 0 auto; }
.drawer-close { min-height: 2.1rem !important; height: 2.1rem !important; }
.password-toggle { min-height: 2.15rem !important; height: 2.15rem !important; }
.header-icon-button, .header-action-button { min-height: 2.55rem !important; }
.qa-btn { min-height: 2.3rem !important; }
.icon-action-btn { flex: 0 0 auto !important; }

/* checkboxes and radios stay square whatever the legacy field rules say */
input[type="checkbox"], input[type="radio"] {
  box-sizing: border-box;
  width: 1.15rem !important;
  height: 1.15rem !important;
  min-width: 1.15rem !important;
  min-height: 1.15rem !important;
  max-width: 1.15rem !important;
  max-height: 1.15rem !important;
  flex: 0 0 auto !important;
  align-self: center;
}

/* ============================================================================
   Dashboard charts (inline SVG, no external library)
   ============================================================================ */
.charts-host { margin-bottom: 1rem; }
.charts-host[hidden] { display: none; }
.chart-panel {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
  padding: 1rem 1.15rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(2, 8, 20, .28);
  color: var(--panel-text);
}
.chart-figure { display: flex; flex-direction: column; align-items: center; }
.chart-title { margin: 0 0 .4rem; font-size: .95rem; font-weight: 600; color: var(--panel-text); text-align: center; }
.chart-donut { width: 100%; max-width: 210px; height: auto; overflow: visible; }
/* visible on white: the previous tint read at 1.09:1 and the ring looked missing */
.chart-donut-track { stroke: #d7e0ec; }
.chart-slice {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-width .15s ease;
  cursor: pointer;
  /* the entrance is a pure CSS animation: the arc geometry is written immediately, so
     the donut is correct even if the browser throttles animation frames */
  animation: chart-slice-in .55s ease-out both;
}
@keyframes chart-slice-in { from { opacity: 0; } to { opacity: 1; } }
.chart-slice:hover, .chart-slice.is-active, .chart-slice:focus-visible { stroke-width: 29; outline: none; }
.chart-donut-value { fill: var(--panel-text); font-size: 30px; font-weight: 700; }
.chart-donut-label { fill: var(--panel-text-muted); font-size: 12px; }
.chart-donut-hint { fill: var(--panel-text-dim); font-size: 11px; }
.chart-legend-item.is-empty { opacity: .8; }
.chart-legend-item.is-empty .chart-share { color: var(--panel-text-dim); }
.chart-side { display: grid; gap: .75rem; min-width: 0; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.chart-legend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background .15s ease, border-color .15s ease;
}
.chart-legend-item:hover, .chart-legend-item:focus-visible { background: var(--panel-soft); border-color: var(--panel-border); outline: none; }
.chart-dot { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; }
.chart-legend-label { color: var(--panel-text-muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-legend-item strong { color: var(--panel-text); }
.chart-share { color: var(--panel-text-dim); font-size: .78rem; min-width: 2.4rem; text-align: left; }
.chart-subtitle { margin: .2rem 0 0; font-size: .82rem; color: var(--panel-text-muted); font-weight: 600; }
.chart-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.chart-bar-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--panel-text-muted); margin-bottom: .25rem; }
.chart-bar-head strong { color: var(--panel-text); }
.chart-bar-track { height: 8px; border-radius: 999px; background: var(--panel-soft-2); overflow: hidden; }
.chart-bar-fill { display: block; height: 100%; border-radius: 999px; transition: width .7s cubic-bezier(.22, .61, .36, 1); }
@media (prefers-reduced-motion: reduce) { .chart-slice, .chart-bar-fill { transition: none; } }

/* ============================================================================
   Tablet and phone: the KPI strip wraps, wide tables scroll inside the panel.
   ============================================================================ */
@media (max-width: 900px) {
  #statsSection { flex-wrap: wrap !important; }
  #statsSection > div { flex: 1 1 calc(50% - .5rem) !important; }
  .chart-panel { grid-template-columns: minmax(0, 1fr); }
  .dashboard-shell { width: calc(100% - 1rem) !important; }
  .quick-actions-bar { width: calc(100% - 1rem); }
  .dashboard-shell #content { padding: .9rem; overflow-x: auto; }
  .dashboard-shell #content table { min-width: 620px; }
}
@media (max-width: 600px) {
  #statsSection > div { flex: 1 1 100% !important; }
  .dashboard-page > header { padding-inline: .6rem !important; }
  .dashboard-shell #content { padding: .75rem; border-radius: 14px; }
  .chart-panel { padding: .8rem; gap: .8rem; }
  .chart-donut { max-width: 170px; }
}

/* ---------------- print stays light ---------------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  thead th, th { background: #eadcdc !important; color: #000 !important; }
  td { color: #000 !important; }
}


/* exam window polish — طلب صاحب المنصة */
/* (١) إشعار الحفظ التلقائي: توست عائم صغير أسفل الشاشة بدل شريط فوق شريط التقدم */
.exam-message.success {
    position: fixed;
    inset-inline-start: 1rem;
    bottom: 4.6rem;
    z-index: 95;
    min-height: 0;
    max-width: min(22rem, calc(100vw - 2rem));
    margin: 0;
    padding: .45rem .9rem;
    border-radius: 999px;
    background: rgba(6, 78, 59, .96);
    color: #ecfdf5;
    font-size: .85rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(2, 44, 34, .4);
    animation: examToastIn .18s ease-out;
}
@keyframes examToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* رسالة بداية الاختبار والتنبيه الجدي: تبقى شريطًا ثابتًا مقروءًا لا يختفي */
.exam-message.info { position: static; background: #eef6ff; color: #0f4c81; border: 1px solid #cfe4f7; }
.exam-message.error { position: static; }
body:has(.exam-question) #message { margin-bottom: 0 !important; }
body:has(.exam-question) #message:has(.exam-message.error),
body:has(.exam-question) #message:has(.exam-message.info) { margin-bottom: .55rem !important; }

/* (٢) تسليم الاختبار بالأحمر: في الشريط السفلي وفي آخر سؤال */
.exam-action-bar #submit,
.exam-action-bar .exam-nav.submit {
    background: linear-gradient(135deg, #b91c1c, #dc2626) !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: 0 8px 18px rgba(220, 38, 38, .38);
}
.exam-action-bar #submit:hover:not(:disabled),
.exam-action-bar .exam-nav.submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #991b1b, #b91c1c) !important;
    transform: translateY(-1px);
}

/* (٣) أزرار أصغر + شريط أنحف */
.exam-action-bar { padding: .4rem clamp(.6rem, 2.5vw, 1.5rem); gap: .5rem; }
.exam-action-bar .exam-action-bar-nav { gap: .5rem; }
.exam-action-bar .exam-nav { min-height: 2.05rem; padding: .35rem .95rem; border-radius: 10px; font-size: .9rem; }
.exam-action-bar #submit { min-height: 2.05rem; padding: .35rem 1.1rem; border-radius: 10px; font-size: .9rem; }

/* نافذة السؤال تملأ المساحة المتاحة حتى شريط الأزرار (والشريط ثابت فلا تمرير للوصول إليه) */
body:has(.exam-question) { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 0; }
body:has(.exam-question) main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
body:has(.exam-question) #exam { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; padding-bottom: 3.4rem; }
/* نفس المظهر في صفحة «التجربة الفعلية» (بلا شريط سفلي ثابت، فالحشوة أصغر) */
body:has(.exam-question) #previewExam { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; padding-bottom: 3.4rem; }
body:has(.exam-question) .exam-question.current { flex: 1 0 auto; display: flex; flex-direction: column; margin-bottom: 0; }
body:has(.exam-question) .exam-question.current .question-layout { flex: 1 0 auto; min-height: 0; }
/* بلا تمرير داخلي: تكبر النافذة وتظهر كل الخيارات (الصفحة نفسها تُمرَّر عند الطول الشديد فقط) */
body:has(.exam-question) .question-layout .question-body,
body:has(.exam-question) .question-layout .question-main { max-height: none !important; overflow: visible !important; }
@media (max-height: 560px) {
    body:has(.exam-question) .question-layout .question-body,
    body:has(.exam-question) .question-layout .question-main { max-height: calc(100dvh - 14rem) !important; overflow-y: auto !important; }
}


/* exam window identity — طلب صاحب المنصة */
/* خلفية بيج فاتحة + نقشة متكررة (طبقة بيج شبه شفافة فوق النقشة تحفظ وضوح النص) */
body:has(.exam-question) {
    background-color: #f7ecdc;
    background-image: linear-gradient(rgba(250, 243, 231, .8), rgba(250, 243, 231, .8)), url('/img/exam-texture.jpg');
    background-repeat: repeat, repeat;
    background-size: auto, 240px 240px;
    color: #3f3221;
}
/* شريط التقدم كان نصًا فاتحًا على خلفية داكنة، فيصبح داكنًا على البيج */
body:has(.exam-question) .exam-progress { color: var(--exam-muted); font-weight: 600; }
body:has(.exam-question) .exam-track { background: var(--exam-border-soft); }
/* بطاقة السؤال تبقى بيضاء بظل واضح لتفصل عن النقشة */
body:has(.exam-question) .exam-question.current {
    background: #fff;
    border-color: #e6d9c2;
    box-shadow: 0 14px 34px rgba(90, 68, 38, .18);
}


/* exam light theme — نافذة اختبار فاتحة بنصوص غامقة */
/* ---------- الترويسة: فاتحة بدل الكحلي ---------- */
body:has(.exam-question) .exam-header {
    background: #fffdf8 !important;
    color: #1a0c0f !important;
    border-bottom: 2px solid #E3EAED;
    box-shadow: 0 2px 10px rgba(90, 68, 38, .08);
    padding: .5rem .9rem;
}
body:has(.exam-question) .exam-header strong { color: var(--exam-ink) !important; font-size: 1.05rem; }
body:has(.exam-question) .exam-header .text-white { color: var(--exam-ink) !important; }
body:has(.exam-question) #timer { color: var(--exam-ink) !important; font-weight: 800; font-variant-numeric: tabular-nums; }
body:has(.exam-question) .timer-warning { color: #b91c1c !important; }
body:has(.exam-question) .connection-status { background: var(--exam-chip) !important; color: var(--exam-chip-ink) !important; }
body:has(.exam-question) .connection-status.offline { background: #fee2e2 !important; color: #991b1b !important; }
body:has(.exam-question) .connection-status.syncing { background: #fef3c7 !important; color: #92400e !important; }
body:has(.exam-question) .connection-status.saved { background: #dcfce7 !important; color: #166534 !important; }

/* ---------- شريط التقدم انتقل إلى الترويسة بجانب الساعة ---------- */
body:has(.exam-question) .exam-header-progress { flex: 0 1 380px; min-width: 180px; margin-inline: .6rem; }
body:has(.exam-question) .exam-header .exam-progress { color: var(--exam-muted) !important; font-size: .8rem; margin-bottom: .2rem; }
body:has(.exam-question) .exam-header .exam-track { background: var(--exam-border); height: 6px; margin-bottom: 0; }
body:has(.exam-question) .exam-header .exam-track span { background: var(--primary-strong, #0E8C9B); }
body:has(.exam-question) #exam .exam-progress, body:has(.exam-question) #previewExam .exam-progress { color: var(--exam-muted) !important; }

/* ---------- شريط الأزرار السفلي: فاتح وواضح ---------- */
body:has(.exam-question) .exam-action-bar {
    background: #fffdf8 !important;
    border-top: 2px solid #E3EAED;
    box-shadow: 0 -8px 22px rgba(90, 68, 38, .12);
}
body:has(.exam-question) .exam-action-bar .exam-nav.secondary { background: #f1f5f9 !important; border: 1px solid #e0d2d2 !important; color: var(--exam-ink) !important; }
body:has(.exam-question) .exam-action-bar .exam-nav.secondary:hover:not(:disabled) { background: #eadcdc !important; }
body:has(.exam-question) .exam-action-bar .exam-nav.primary { background: var(--primary-strong, #0E8C9B) !important; color: #fff !important; }
body:has(.exam-question) .exam-action-bar .exam-nav.primary:hover:not(:disabled) { background: #8b1a1a !important; }
body:has(.exam-question) .exam-review-hint { color: #5C737C; font-size: .78rem; line-height: 1.5; max-width: 32rem; }

/* ---------- نافذة السؤال: عرض ثابت لكل الأسئلة ---------- */
body:has(.exam-question) main { width: min(100% - 1rem, 1100px) !important; max-width: none !important; }
body:has(.exam-question) .exam-question.current { background: var(--exam-card); border-color: var(--exam-border-strong); box-shadow: 0 14px 34px rgba(90, 68, 38, .14); width: 100%; }
body:has(.exam-question) .question-heading h2 { color: var(--exam-ink); }
body:has(.exam-question) .exam-option { background: var(--exam-surface); border-color: var(--exam-border); color: var(--exam-ink); }
body:has(.exam-question) .exam-option:hover { background: var(--exam-surface-alt); border-color: var(--exam-accent); }
body:has(.exam-question) .exam-option:has(input:checked) { background: var(--exam-surface-pick); border-color: var(--exam-accent); }
body:has(.exam-question) .essay-answer { background: var(--exam-surface); border-color: var(--exam-border); color: var(--exam-ink); }

/* ---------- صور الأسئلة: أكبر ---------- */
body:has(.exam-question) .question-layout .question-aside,
body:has(.exam-question) .question-layout .question-media { flex: 0 0 360px; max-width: 42vw; }
body:has(.exam-question) .question-layout .question-aside .question-image,
body:has(.exam-question) .question-layout .question-media .question-image { max-height: 320px; }
body:has(.exam-question) .question-media .question-image { max-height: 320px; }
@media (max-height: 760px) {
    body:has(.exam-question) .question-media .question-image { max-height: 240px; }
}
@media (max-height: 620px) {
    body:has(.exam-question) .question-media .question-image { max-height: 170px; }
}
@media (max-width: 900px) {
    body:has(.exam-question) .question-layout .question-aside,
    body:has(.exam-question) .question-layout .question-media { flex: 0 0 auto; max-width: 100%; }
}

/* ---------- نوافذ منبثقة: تعليمات البداية + تأكيد التسليم ---------- */
.exam-modal-overlay { position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(26, 12, 15, .5); backdrop-filter: blur(3px); }
.exam-modal-card { width: min(560px, 96vw); max-height: 86vh; overflow-y: auto; background: #fffdf8; color: #23201a; border: 1px solid #E3EAED; border-radius: 16px; padding: 1.2rem 1.25rem; box-shadow: 0 24px 60px rgba(26, 12, 15, .32); }
.exam-modal-card h2 { margin: 0 0 .6rem; color: #1a0c0f; font-size: 1.12rem; }
.exam-modal-card p { margin: 0; color: #4b5563; line-height: 1.8; }
.exam-modal-body { white-space: pre-wrap; line-height: 1.9; color: #33302b; max-height: 55vh; overflow-y: auto; }
.exam-modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
.exam-modal-close { width: 100%; margin-top: 1rem; padding: .6rem 1rem; border: 0; border-radius: 10px; background: var(--primary-strong, #0E8C9B); color: #fff; font-weight: 700; cursor: pointer; }
.exam-modal-cancel, .exam-modal-confirm { padding: .55rem 1.1rem; border: 0; border-radius: 10px; font-weight: 700; cursor: pointer; }
.exam-modal-cancel { background: #eadcdc; color: #1f2937; }
.exam-modal-confirm { background: #dc2626; color: #fff; }


/* survey modal styles — نافذة إنشاء الاستبيان: أنواع متعددة + بنك الأسئلة */
.sv-fieldset {
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    padding: .6rem .7rem;
    margin: .7rem 0;
}
.sv-fieldset legend {
    font-weight: 700;
    font-size: .9rem;
    padding: 0 .35rem;
    color: #1f2937;
}
.sv-type-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: .35rem;
}
.sv-type-item,
.sv-bank-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .4rem .5rem;
    border: 1px solid #eadcdc;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    font-size: .88rem;
}
.sv-type-item:hover,
.sv-bank-item:hover { background: #f1f5f9; }
.sv-type-item input,
.sv-bank-item input { margin-top: .2rem; }
.sv-type-item:has(input:checked),
.sv-bank-item:has(input:checked) { background: #E6F4F1; border-color: var(--primary-strong, #0E8C9B); }
.sv-bank-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: .35rem;
    max-height: 16rem;
    overflow-y: auto;
    padding: .2rem;
}
.sv-new-questions { margin-top: .6rem; }
.sv-new-questions textarea {
    width: 100%;
    border: 1px solid #e0d2d2;
    border-radius: 8px;
    padding: .45rem .6rem;
    color: #1f2937;
}


/* survey chart cards — رسوم أنواع الاستبيانات في الداشبورد + مخطط أصغر */
.dashboard-chart.compact { margin-top: 1rem; padding: .7rem .8rem; }
.dashboard-chart.compact h3 { font-size: .95rem; margin-bottom: .6rem; }
.dashboard-chart.compact .chart-bars { height: 118px; gap: .5rem; }
.dashboard-chart.compact .chart-column { width: min(30px, 62%); border-radius: 6px 6px 0 0; }
.dashboard-chart.compact .chart-value { font-size: .8rem; }
.dashboard-chart.compact .chart-item small { font-size: .68rem; }
.survey-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .55rem; }
.survey-card { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: .55rem .65rem; }
.survey-card header { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.survey-card h4 { margin: 0; font-size: .82rem; font-weight: 700; color: var(--navy); line-height: 1.5; }
.survey-card .survey-percent { font-weight: 800; font-size: .95rem; color: var(--primary-on-panel, #8b1a1a); }
.survey-track { height: 6px; border-radius: 999px; background: #e8eef4; overflow: hidden; margin: .4rem 0 .3rem; }
.survey-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary, #c8283a), var(--primary-on-panel, #8b1a1a)); transition: width .4s ease; }
.survey-card small { display: block; color: var(--muted); font-size: .7rem; line-height: 1.6; }


/* dashboard chart fixes — مخطط أفقي مدمج وبطاقات رضا واضحة */
.dashboard-chart.compact .chart-bars {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-around !important;
    gap: .45rem !important;
    height: 96px !important;
    border-bottom: 1px solid var(--line) !important;
}
.dashboard-chart.compact .chart-item {
    display: flex !important;
    flex: 1 1 0 !important;
    height: 100% !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: .25rem !important;
    text-align: center !important;
}
.dashboard-chart.compact .chart-column { width: min(26px, 55%) !important; }
.dashboard-chart.compact .chart-value { font-size: .78rem !important; line-height: 1.2 !important; }
.dashboard-chart.compact .chart-item small { font-size: .64rem !important; line-height: 1.35 !important; }

/* رأس بطاقة نوع الاستبيان: القاعدة العامة header تأخذ خلفية داكنة بـ!important ⇒ تُبطَل هنا */
.survey-card header {
    display: flex !important;
    align-items: baseline !important;
    justify-content: space-between !important;
    gap: .4rem !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 .2rem !important;
    min-height: 0 !important;
}
.survey-card h4 { color: #1f2937 !important; }
.survey-card .survey-percent { color: #8b1a1a !important; }
.survey-charts { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)) !important; }


/* question points chip — درجة السؤال أمام رقمه في صفحة الاختبار والتجربة */
.question-heading { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.question-points { display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 999px; background: #e6f4f1 !important; color: #8b1a1a !important; font-size: .75rem !important; font-weight: 700 !important; white-space: nowrap; }
@media print { .question-points { border: 1px solid #8b1a1a; } }


/* ===== Commercial theme: blood-black with edge glow ===== */
:root {
  --blood-1: #0a0406;
  --blood-2: #150809;
  --blood-3: #8b1a1a;
  --blood-4: #b3202a;
}
body, .login-page {
  background-color: var(--bg) !important;
  background-image:
    radial-gradient(120% 90% at 50% 0%,   rgba(179,32,42,.16) 0%, rgba(179,32,42,0) 55%),
    radial-gradient(100% 80% at 50% 100%, rgba(139,26,26,.14) 0%, rgba(139,26,26,0) 60%),
    radial-gradient(70% 60% at 0% 50%,    rgba(179,32,42,.10) 0%, rgba(179,32,42,0) 55%),
    radial-gradient(70% 60% at 100% 50%,  rgba(179,32,42,.10) 0%, rgba(179,32,42,0) 55%) !important;
  background-attachment: fixed !important;
}
.login-page::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  box-shadow: inset 0 0 160px 30px rgba(139,26,26,.35),
              inset 0 0 60px 6px rgba(179,32,42,.22);
}
.login-page > * { position: relative; z-index: 1; }
.login-logo-glow img { filter: drop-shadow(0 0 14px rgba(179,32,42,.55)); }
.platform-rights-bar { border-top: 1px solid var(--border-strong, rgba(179,32,42,.35)) !important; background: var(--bg, #0a0406) !important; }
.credit-wa { display: inline-flex; align-items: center; vertical-align: -4px; margin-inline-start: 6px; }
.credit-wa svg { width: 18px; height: 18px; fill: #25D366; transition: transform .15s ease; }
.credit-wa:hover svg, .credit-wa:focus-visible svg { transform: scale(1.15); }


/* ================= BLOOD CHROME OVERRIDES ================= */
.dashboard-page > header {
  background: linear-gradient(180deg, var(--header-from, #17080b) 0%, var(--header-to, #0a0406) 100%) !important;
  border-bottom: 1px solid rgba(200, 40, 58, .35) !important;
  box-shadow: 0 1px 0 rgba(200,40,58,.18), 0 8px 26px -14px rgba(200,40,58,.45) !important;
}
.exam-header, .exam-header.bg-slate-900, .bg-slate-900 {
  background: linear-gradient(180deg, var(--header-from, #17080b), var(--header-to, #0a0406)) !important;
  color: #f6ecec !important;
}
.bg-slate-800 { background-color: var(--surface-2, #241014) !important; }
.bg-brand-ink { background-color: var(--surface-3, #2e1319) !important; }
.from-slate-900 { --tw-gradient-from: var(--header-from, #17080b) !important; }
.to-slate-800   { --tw-gradient-to: var(--header-to, #0a0406) !important; }
.text-brand-accent, .text-cyan-400, .text-brand-red { color: #e2566a !important; }
/* حُذف تكرار .bg-brand-red هنا: كان مكرّرًا ثلاثًا، ومُلغًى بقاعدة لاحقة لها الخصوصية
   نفسها والأهمية نفسها — فكان سطرًا ميتًا يوهم بوجود مصدر ثانٍ. */
.border-brand-red { border-color: var(--primary-on-panel, #8b1a1a) !important; }

/* scrollbars -> blood */
* { scrollbar-color: #c08a2e transparent !important; scrollbar-width: thin !important; }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: transparent !important; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e0b055, #a9761f) !important;
  border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
  min-height: 44px;
}
*::-webkit-scrollbar-thumb:hover { background: #e2566a !important; background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent !important; }
/* keep the bar on every page, including one whose content fits */
html { overflow-y: scroll; scrollbar-gutter: stable; }

/* keypad / chips / tabs that used sky */
.chip, .tab, .role-chip, .badge-info { border-color: rgba(200,40,58,.35); }


/* ===== brand utility colours (replaced blue utilities) ===== */
.bg-brand-red   { background-color: var(--primary-strong, #0E8C9B) !important; color: #fff !important; }
.bg-brand-red:hover { background-color: var(--primary, #c8283a) !important; }
.text-brand-red { color: var(--primary, #c8283a) !important; }
.bg-brand-ink   { background-color: #4a1d23 !important; color: #fff !important; }
.text-brand-muted { color: #b09a9c !important; }
.bg-brand-red *, .bg-brand-ink * { color: #fff !important; }


/* ===== fixed commercial brand in the footer (hardcoded, never printed) ===== */
.platform-rights-bar, footer, .platform-footer { position: relative; }
.codifica-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  letter-spacing: .22em;
  font-size: 13px;
  line-height: 1;
  color: #d9ab63;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
@media print { .codifica-brand { display: none !important; } }


/* ===== card-header-guard: page-header styles must never leak into card headers ===== */
.dashboard-page article > header,
.dashboard-page .survey-card > header,
.dashboard-page .survey-card header,
.dashboard-page .stat-card > header,
.dashboard-page .stat-card header,
.dashboard-page .card > header,
.dashboard-page .card header,
.dashboard-page .panel > header,
.dashboard-page .panel header {
  background: transparent !important;
  background-image: none !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
}

/* survey cards: readable text on the white card */
.survey-card { background: #ffffff !important; border: 1px solid #e6d9d9 !important; }
.survey-card h4 { color: #1a0c0f !important; }
.survey-card .survey-percent { color: #0E8C9B !important; }
.survey-card small { color: #6b5a5c !important; }
.survey-track { background: #f1e6e6 !important; border-radius: 999px; overflow: hidden; }
.survey-track > span { background: linear-gradient(90deg, #0E8C9B, #e2566a) !important; display: block; height: 100%; }

/* dashboard chart headings should follow the brand, not the old navy */
.dashboard-chart h3 { color: #1a0c0f !important; }
.dashboard-chart.compact h3 { border-bottom-color: #eedcdc !important; }


/* ================= LOGO SIZING =================
   The HEADER logo keeps its original size (h-9 / max-w-32 from the markup).
   Only the login mark, the report mark and the SETTINGS preview are scaled. */
.login-logo-glow img,
#loginLogo {
  height: 7rem !important;
  max-height: 7rem !important;
  width: auto !important;
  max-width: 14rem !important;
  object-fit: contain !important;
}
.report-print-logo { max-height: 64px !important; max-width: 180px !important; object-fit: contain !important; }

/* the Settings screen: tidy preview instead of a full-size image */
#content .settings-logo,
#content #setLogoPreview,
#content img.settings-logo {
  height: 56px !important;
  max-height: 56px !important;
  width: auto !important;
  max-width: 170px !important;
  object-fit: contain !important;
  background: #faf6f6;
  border: 1px solid #eddede;
  border-radius: 10px;
  padding: 4px;
}
@media (max-width: 640px) {
  .login-logo-glow img, #loginLogo { height: 5rem !important; max-height: 5rem !important; max-width: 10rem !important; }
}



/* ===== login-link-plain: "نسيان الاسم المحفوظ" must read as plain text, not a button =====
   It is a <button> only for accessibility; visually it is an inline link. */
.login-link,
button.login-link,
#clearSaved {
  display: inline !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  background-image: none !important;
  border: 0 !important;
  outline: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
  transform: none !important;
  font: inherit !important;
  font-size: .95rem !important;
  font-weight: 600 !important;
  color: #0E8C9B !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 3px !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
.login-link:hover,
button.login-link:hover,
#clearSaved:hover {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  color: var(--primary, #c8283a) !important;
  text-decoration-thickness: 2px !important;
}
.login-link:active,
button.login-link:active,
#clearSaved:active { transform: none !important; box-shadow: none !important; }
.login-link:focus-visible,
#clearSaved:focus-visible { outline: 2px solid var(--primary, #c8283a) !important; outline-offset: 3px !important; }
.login-link.hidden,
#clearSaved.hidden { display: none !important; }


/* ===== settings-logo-real: Tailwind classes (max-h-24, max-w-full) are NOT loaded,
   so the settings preview must be sized with real CSS ===== */
.settings-logo,
#setLogoPreview,
#content img[alt="شعار المنصة"] {
  height: 96px !important;
  max-height: 96px !important;
  width: auto !important;
  max-width: 220px !important;
  object-fit: contain !important;
  display: block;
  background: #faf6f6;
  border: 1px solid #eddede;
  border-radius: 12px;
  padding: 6px;
  margin-bottom: .75rem;
}

/* ============================================================================
   The student's "بدء الاختبار" call to action: a real green button that keeps
   its wording (the icon converter used to replace the label with a play glyph).
   ============================================================================ */
.exam-start-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  background: #16a34a !important;
  color: #fff !important;
  border: 1px solid #0F7A5A !important;
  border-radius: 12px !important;
  padding: .55rem 1.1rem !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  box-shadow: 0 8px 18px rgba(22, 163, 74, .28) !important;
  transition: background .16s ease, transform .16s ease, box-shadow .18s ease;
}
.exam-start-btn svg { width: 1.05rem; height: 1.05rem; }
.exam-start-btn:hover { background: #0F7A5A !important; transform: translateY(-1px); box-shadow: 0 12px 24px rgba(22, 163, 74, .36) !important; }

/* ============================================================================
   The login button keeps its wording; the white label used to be enforced by
   ".bg-brand-red *", which was removed - pin the colour on the button and its
   children so the span can never inherit a dark colour again.
   ============================================================================ */
.login-submit,
.login-submit *,
.login-submit span,
.login-submit svg {
  color: #ffffff !important;
  fill: none;
  stroke: currentColor;
}

/* ============================================================================
   The platform rights bar belongs to the SCREEN, not to the end of the page.
   theme.css used to set "position: relative" here, which cancelled the
   "position: fixed; bottom: 0" declared in offline.css. Pages that must not show
   it (the exam window) opt out in arabic-ui.js.
   ============================================================================ */
.platform-rights-bar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 80 !important;
}
body.has-rights-bar { padding-bottom: 2.25rem !important; }

/* ============================================================================
   The login form's own rules set a dark colour on the button element itself, so
   pin it by id (id beats any class selector) to guarantee white wording forever.
   ============================================================================ */
#loginSubmit,
#loginSubmit span,
#loginSubmit svg,
#loginSubmit i {
  color: #ffffff !important;
  stroke: currentColor;
}

/* ============================================================================
   A single question's mark is never shown to a student, anywhere.
   ============================================================================ */
.question-points,
.exam-question .question-points,
.question-heading .question-points {
  display: none !important;
}

/* ===================== لوحة الاشتراك (سوبر أدمن) ===================== */
.subscription-admin { display: grid; gap: 16px; }
.sub-card { background: var(--panel-bg, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; padding: 16px 18px; }
.sub-card h3 { margin-bottom: 12px; font-weight: 800; }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.sub-grid small { display: block; color: var(--muted, #6b7280); margin-bottom: 4px; }
.sub-grid strong { font-size: 17px; }
.sub-field { display: grid; gap: 6px; }
.sub-field > span { font-weight: 700; font-size: 14px; }
.sub-field input { padding: 9px 11px; border: 1px solid var(--line, #d1d5db); border-radius: 10px; font: inherit; }
.sub-months, .sub-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sub-check { display: flex; align-items: center; gap: 9px; margin: 8px 0; font-weight: 600; }
.sub-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }


/* ===================================================================== DAYLIGHT
   The shell, in light. Everything inside a panel is already white with dark ink in
   both modes, so this block only touches the page, the header and the hairlines.
   The accent is left alone on purpose: the brand does not change with the light. */
html[data-mode="light"][data-palette] {
  color-scheme: light;

  --bg: #F1F6F9;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #EAF7FD;
  --surface-3: #F1F6F9;

  --border: #D6E4EC;
  --border-strong: #B9CEDC;

  --text: #0A1520;
  --text-muted: #3D5563;
  --text-dim: #5A7383;

  --primary: #0A7C94;
  --primary-strong: #08657A;
  --primary-soft: rgba(10, 124, 148, .10);
  --primary-border: rgba(10, 124, 148, .35);
  --primary-hover: rgba(10, 124, 148, .08);
  --on-accent: #ffffff;

  --success: #0f7a55;
  --warning: #a15c05;
  --danger: #b42318;
  --info: #5b3bb5;
  --success-soft: rgba(15, 122, 85, .10);
  --warning-soft: rgba(161, 92, 5, .10);
  --danger-soft: rgba(180, 35, 24, .09);
  --info-soft: rgba(91, 59, 181, .10);

  /* the header takes its gradient from these two, so they are the whole change */
  --header-from: #ffffff;
  --header-to: #F1F6F9;
  --blood-1: #f6f4f3;
  --blood-2: #ffffff;
  --blood-3: #8b1a1a;
  --blood-4: #b3202a;
}

/* the glow belongs to the dark room; in daylight it is a smear */
html[data-mode="light"][data-palette] body,
html[data-mode="light"][data-palette] .login-page {
  background-image: none !important;
  background-color: var(--bg) !important;
}
html[data-mode="light"][data-palette] .login-page::before { box-shadow: none !important; }
html[data-mode="light"][data-palette] .login-logo-glow img { filter: none; }

/* the header classes hard-code dark text and dark gradients */
html[data-mode="light"][data-palette] .dashboard-page > header {
  background: linear-gradient(180deg, var(--header-from) 0%, var(--header-to) 100%) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 10px 24px -18px rgba(0,0,0,.25) !important;
}
html[data-mode="light"][data-palette] .exam-header,
html[data-mode="light"][data-palette] .exam-header.bg-slate-900,
html[data-mode="light"][data-palette] .bg-slate-900 {
  background: linear-gradient(180deg, var(--header-from), var(--header-to)) !important;
  color: var(--text) !important;
}
html[data-mode="light"][data-palette] .bg-slate-800 { background-color: var(--surface-2) !important; }
html[data-mode="light"][data-palette] .bg-brand-ink { background-color: var(--surface-3) !important; }
html[data-mode="light"][data-palette] .from-slate-900 { --tw-gradient-from: var(--header-from) !important; }
html[data-mode="light"][data-palette] .to-slate-800 { --tw-gradient-to: var(--header-to) !important; }
html[data-mode="light"][data-palette] .text-brand-accent,
html[data-mode="light"][data-palette] .text-cyan-400,
html[data-mode="light"][data-palette] .text-brand-red { color: #0A7C94 !important; }
html[data-mode="light"][data-palette] .platform-rights-bar {
  background: var(--bg-elevated) !important;
  border-top: 1px solid var(--border) !important;
}
html[data-mode="light"][data-palette] * { scrollbar-color: #c9b9b6 transparent !important; }

/* ---------------------------------------------------------------- the switch */
.pt-mode-btn {
  position: fixed;
  /* inset-inline-END, which is the left in Arabic: the right side already holds
     the fullscreen button and the two were measured sitting on top of each other. */
  inset-inline-end: 14px;
  inset-block-end: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 6px 18px -10px rgba(0,0,0,.45);
  transition: transform .15s ease, background .15s ease;
}
.pt-mode-btn:hover { transform: translateY(-1px); }
.pt-mode-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pt-mode-btn svg { width: 20px; height: 20px; }
@media print { .pt-mode-btn { display: none; } }


/* ------------------------------------------------- the three hard-coded colours
   These are not tokenised, so no amount of raising the shell's variables reaches
   them; they were near-white for a dark page and stay near-white on a light one,
   which reads as invisible text. Named explicitly, with !important because the
   originals carry it too, and with the stronger selector because two of them are
   !important in a later stylesheet as well. */
html[data-mode="light"][data-palette] .login-brand-panel h1,
html[data-mode="light"][data-palette] .dashboard-page header h1,
html[data-mode="light"][data-palette] .dashboard-page header h1 > * { color: var(--text) !important; }

html[data-mode="light"][data-palette] .login-brand-panel p,
html[data-mode="light"][data-palette] #identity { color: var(--text-muted) !important; }

html[data-mode="light"][data-palette] .platform-rights-text,
html[data-mode="light"][data-palette] .platform-credit-text,
html[data-mode="light"][data-palette] .login-page .platform-credit-text { color: var(--text-muted) !important; }

/* ============================================================================
   ⚠ تنبيه: أي عنصر نموذج خلفيّته بيضاء يجب أن يكون نصّه داكنًا.
   ملف offline.css يفرض background:#fff على كل select و input و textarea، ولون
   النصّ يرث --text — وهو في القشرة الداكنة #f8f9fa أي شبه أبيض. فصار أبيض على
   أبيض، واختفى اسم المقرّر من القوائم تمامًا. وقد رُصد بصريًّا في ثلاث شاشات:
   التأليف والمخرجات وتقرير التحقيق.
   والإصلاح مقصود ومحصور: من فُرضت عليه خلفية بيضاء فليكن نصّه داكنًا — ولا يمسّ
   هذا أي عنصر لم تُفرض عليه خلفية.
   ========================================================================== */
/* ⚠ و!important هنا **ضروري لا تزيّد**: في هذا الملف نفسه سطر ١١٩١
   body { color: var(--text) !important; } — والإلحاح يُقارَن قبل الوراثة في سلّم
   التخصيص، فقاعدةٌ مباشرة **عادية** تخسر أمام !important موروثة من body.
   وقد خسرت فعلًا أوّل مرّة: القاعدة كانت مخدومة واللون بقي #f8f9fa. */
select, input, textarea { color: #1a1c20 !important; }
select option { color: #1a1c20 !important; background: #fff; }
/* وحماية الاقتران داخل النوافذ: #modal يضبط لونه على خلفية لوحته، وهي داكنة في
   القشرة الداكنة — فبدون هذا السطر ينقلب العيب داكنًا على داكن. */
#modal select, #modal input, #modal textarea { color: var(--panel-text) !important; }

/* ============================================================================
   إصلاح تباين أزرار الترويسة في الوضع الفاتح — 2026-10-09
   القاعدة العامّة أعلاه (color:#f6ecec على خلفيّة شبه شفّافة) مصمَّمة للترويسة
   الداكنة، وفي الفاتح صارت غير مرئيّة تقريبًا (1.16:1). نُعيد تصميم offline.css
   الفاتح بمُحدِّد أعلى أولويّة. زرّ الخروج يبقى كما هو (4.86:1 ✓).
   ============================================================================ */
html[data-mode="light"][data-palette] .header-icon-button,
html[data-mode="light"][data-palette] .header-action-button {
  background: #ffffff !important;
  border: 1px solid var(--border-strong, #B9CEDC) !important;
  color: var(--text, #0A1520) !important;
}
html[data-mode="light"][data-palette] .header-icon-button:hover,
html[data-mode="light"][data-palette] .header-action-button:hover {
  background: var(--surface-2, #EAF7FD) !important;
  border-color: var(--primary, #0A7C94) !important;
  color: var(--primary, #0A7C94) !important;
}
html[data-mode="light"][data-palette] .header-icon-button svg,
html[data-mode="light"][data-palette] .header-action-button svg {
  stroke: currentColor;
}

/* ── ex-palette: توحيد اللون الأساسي على هوية ex ─────────────────────────── */
:root{
  --primary-strong:#0E8C9B;
  --exam-accent:#0E8C9B;
}
/* ── شريط الحقوق: خلفيته داكنة، فلا يجوز أن يرث نصًّا داكنًا ─────────────────
   المسح اللوني وحّد النصّ على #0B1B22، فصار الشريط يقرأ 1.04:1 — أي أسود على
   أسود. والعلاج هنا موضعي: سطح داكن واحد يأخذ نصًّا فاتحًا. */
.platform-rights-bar,
.platform-rights-bar a,
.platform-rights-bar span,
.platform-rights-bar p { color: #D7E3E7 !important; }
.platform-rights-bar a:hover { color: #FFFFFF !important; }
.platform-xlinks a,
.platform-xlinks span,
footer a { color: #D7E3E7 !important; }
.platform-xlinks a:hover { color: #FFFFFF !important; }
/* ── بوّابة السياسات (policy-gate) ──────────────────────────────────────────
   تُبنى في نافذة بيضاء لكنها ترث لون نصّ الصفحة الفاتح (#f8f9fa)، فيصير
   المحتوى كاملًا غير مرئي — 1.05:1. والسطح أبيض، فالنصّ يجب أن يكون داكنًا. */
#policyGateHost { background: #FFFFFF !important; }
#policyGateHost, #policyGateHost * { color: #0B1B22 !important; }
#policyGateHost .btn, #policyGateHost button {
    background: #0E8C9B !important; color: #FFFFFF !important;
}

/* زرّ ذهبي بنصّ أبيض: 2.40:1 — يُقرأ بالنصّ الداكن */
.platform-rights-bar .btn, footer .btn { color: #0B1B22 !important; }

/* ── الرأس: قاعدتان لسطحين ──────────────────────────────────────────────────
   الشريط في صفحات الإدارة تدرّج داكن → نصّ فاتح.
   وفي جلسة الاختبار صار أبيض بعد توحيد اللوحة → نصّ داكن.
   وقاعدة واحدة كانت تُنتج 1.03:1 على أحد السطحين دائمًا. */
.exam-header,
body:not(:has(.nt-wrap)) .exam-header *:not(button):not(.btn):not([class*="badge"]):not([class*="chip"]):not(.ch-menu):not(.ch-menu *) {
    color: #F2F7F8 !important;
}
.exam-header button, .exam-header .btn {
    background: #0E8C9B !important; color: #FFFFFF !important; border-color: #0E8C9B !important;
}
.exam-header [class*="badge"], .exam-header [class*="chip"] {
    background: #DDF1F4 !important; color: #0B5C66 !important;
}

/* جلسة الاختبار: سطح فاتح */
body:has(.exam-question) .exam-header,
body:has(.exam-question) .exam-header *:not(button):not(.btn):not([class*="badge"]):not([class*="chip"]):not(.ch-menu):not(.ch-menu *) {
    color: #0B1B22 !important;
}
body:has(.exam-question) .exam-header { background: #FFFFFF !important; border-bottom: 1px solid #E3EAED !important; }
body:has(.exam-question) .exam-progress,
body:has(.exam-question) .exam-progress span,
body:has(.exam-question) #connectionStatus { color: #425A63 !important; }

/* زر التسليم المعطّل: كان أبيض على أبيض */
#submit:disabled, .exam-header button:disabled {
    background: #C7D6DB !important; color: #38505A !important; border-color: #C7D6DB !important;
}
/* شارة الترتيب: كانت بيضاء على سطح فاتح (1.13). غير المختارة داكنة، والمختارة بيضاء. */
.es-badge, .es-card .es-badge { color: #0B5C66 !important; }
.es-card.is-picked .es-badge { color: #FFFFFF !important; }
/* الشفافية 45% على زرّ معطّل تُسقط التباين إلى 1.97 مهما كان اللون صحيحًا.
   والزرّ المعطّل يجب أن يُقرأ ليُفهم أنه معطّل، لا أن يختفي. */
body:has(.exam-question) #submit:disabled,
body:has(.exam-question) #previousQuestion:disabled,
body:has(.exam-question) .btn:disabled,
body:has(.exam-question) .exam-action-bar button:disabled {
    opacity: 1 !important;
    background: #E3EAED !important;
    color: #38505A !important;
    border-color: #CBD8DD !important;
}

/* شارة العلامة: ذهبي على بيج = 1.80 */
body:has(.exam-question) .id-chip,
body:has(.exam-question) .id-chip i { color: #0B5C66 !important; }
/* أزرار التنقّل في الجلسة: تغميق درجة واحدة (4.01 → ≈5.3)
   مع إبقاء #0E8C9B للعلامة والحدود، فالفارق البصري غير محسوس. */
body:has(.exam-question) .exam-action-bar .btn:not(:disabled),
body:has(.exam-question) .exam-action-bar button:not(:disabled),
body:has(.exam-question) #nextQuestion:not(:disabled) {
    background: #0B7A86 !important;
    border-color: #0B7A86 !important;
    color: #FFFFFF !important;
}
body:has(.exam-question) .exam-action-bar .btn:not(:disabled):hover,
body:has(.exam-question) .exam-action-bar button:not(:disabled):hover {
    background: #0A6C77 !important;
    border-color: #0A6C77 !important;
}
/* ── جوال ───────────────────────────────────────────────────────────────────
   ثلاثة عيوب مقيسة على 390px:
   1) button.burger يقف على left:-56 → خارج الشاشة وغير قابل للنقر، ويدفع
      المستند 56px أفقيًا (431 بدل 375).
   2) .platform-rights-text عرضه 949px فلا يلتف، فيمتد إلى 665.
   3) body.scrollWidth=587 في صفحة الإشعارات مع أن المستند 380 — أي انسكاب
      مخفيّ كان سيصير تمريرًا لو تغيّر overflow. */
@media (max-width: 640px) {
    button.burger,
    .burger {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        margin-inline-start: auto !important;
        display: inline-grid !important;
        place-items: center !important;
        flex: 0 0 auto !important;
    }

    .platform-rights-bar,
    .platform-rights-inner {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding-inline: 10px !important;
    }
    .platform-rights-text,
    .platform-xlinks,
    .header-actions {
        white-space: normal !important;
        max-width: 100% !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        position: static !important;
    }
    .platform-rights-text { font-size: 10.5px !important; line-height: 1.6 !important; }

    body { overflow-x: hidden !important; }
}
/* الزرّ في رأس الإدارة معرّفه #burger (بلا صنف)، فقاعدة .burger لم تصبه.
   وهو يقف على left:-56 فيدفع المستند 56px ويصير غير قابل للنقر. */
@media (max-width: 640px) {
    #burger {
        position: static !important;
        inset: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        margin-inline-start: auto !important;
        display: inline-grid !important;
        place-items: center !important;
        flex: 0 0 auto !important;
        z-index: 5 !important;
    }
    .hd-in { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 10px !important; max-width: 100% !important; }
    .langsw { position: static !important; transform: none !important; }
}
@media (max-width: 640px) {
    /* روابط سطح المكتب هي مصدر الفائض (151px)؛ على الجوال تُحجب ويحلّ البرغر */
    .hd-links, .hd-in nav, .hd-in .nav-links { display: none !important; }

    .hd-in {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
    .langsw { max-width: 62px !important; overflow: hidden !important; flex: 0 1 auto !important; }
    #burger { flex: 0 0 38px !important; }
}
