/* ===== offline.css ===== */
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Tahoma, Arial, sans-serif; color: #1a0c0f; }
.container { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.block { display: block; }
.hidden { display: none; }
.flex { display: flex; }
.grid { display: grid; }
.flex-wrap { flex-wrap: wrap; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-xl { max-width: 36rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-7xl { max-width: 80rem; }
.max-h-\[90vh\] { max-height: 90vh; }
.min-h-screen { min-height: 100vh; }
.min-h-80 { min-height: 20rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-3 > * + * { margin-top: .75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.m-0 { margin: 0; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.border { border: 1px solid #e0d2d2; }
.border-b { border-bottom: 1px solid #eadcdc; }
.rounded { border-radius: .25rem; }
.rounded-lg { border-radius: .5rem; }
.rounded-xl { border-radius: .75rem; }
.shadow { box-shadow: 0 1px 3px rgba(26, 12, 15, .15); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(26, 12, 15, .2); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: .875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-white { color: #fff; }
.text-red-600 { color: #dc2626; }
.text-slate-300 { color: #e0d2d2; }
.text-brand-muted { color: #4b5563; }
.text-slate-900 { color: #1a0c0f; }
.bg-white { background: #fff; }
.bg-black\/50 { background: rgba(0, 0, 0, .5); }
.bg-gray-100 { background: #f3f4f6; }
.bg-gray-500 { background: #6b7280; }
.bg-gray-700 { background: #374151; }
.bg-brand-red { background: #c8283a; }
.bg-brand-red { background: #0E8C9B; }
.bg-green-500 { background: #22c55e; }
.bg-green-600 { background: #16a34a; }
.bg-emerald-600 { background: #059669; }
.bg-brand-red { background: #4f46e5; }
.bg-amber-500 { background: #f59e0b; }
.bg-yellow-400 { background: #facc15; color: #422006; }
.bg-orange-600 { background: #ea580c; }
.bg-orange-600 { background: #ea580c; }
.bg-red-600 { background: #dc2626; }
.bg-red-100 { background: #fee2e2; }
.bg-slate-200 { background: #eadcdc; }
.bg-brand-ink { background: #5b4648; }
.bg-brand-ink { background: #4a3a3c; }
.text-red-700 { color: #b91c1c; }
.text-emerald-700 { color: #047857; }
.text-amber-900 { color: #78350f; }
.bg-slate-100 { background: #f1f5f9; }
.bg-slate-900 { background: var(--navy, #1a0c0f); }
.hover\:bg-brand-red:hover { background: #8b1a1a; }
.z-50 { z-index: 50; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; min-height: 2.7rem; }
button, .btn, a[class*="bg-"] { border-radius: 10px; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(15,118,110,.22); outline-offset: 2px; }
html, body { direction: rtl; text-align: right; }
button, input, select, textarea { direction: rtl; text-align: right; }
button, a { direction: rtl; }
input, select, textarea { border: 1px solid #e0d2d2; border-radius: .375rem; padding: .65rem .75rem; }
table { border-collapse: collapse; }
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

:root {
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --panel: #ffffff;
  --navy: #102a43;
  --teal: #8b1a1a;
  --gold: #d97706;
  --danger: #b42318;
  --surface-soft: #f8fafc;
  --shadow-soft: 0 10px 28px rgba(58, 24, 29, .07);
  --shadow-hover: 0 14px 30px rgba(58, 24, 29, .12);
}
html { min-height: 100%; overflow-y: auto; }
body { visibility: visible !important; min-height: 100%; background: #fbf7f7; color: var(--ink); font-family: "Segoe UI", Tahoma, Arial, sans-serif; line-height: 1.6; overflow-x: hidden; overflow-y: auto; }
.page-loading { visibility: hidden !important; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .18; background-image: radial-gradient(var(--primary-soft, rgba(15,118,110,.12)) 1px, transparent 1px); background-size: 24px 24px; z-index: -1; }
header { background: rgba(255,255,255,.94) !important; color: var(--ink) !important; border-bottom: 1px solid var(--line); box-shadow: 0 6px 22px rgba(58, 24, 29, .06); }
header .text-slate-300 { color: var(--muted); }
header .bg-brand-ink { background: #edf2f7; color: var(--ink); border: 1px solid var(--line); }
header .bg-red-600 { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
header .bg-red-600:hover { background: #ffe4e6; }
main { position: relative; }
#sections { padding: .55rem; background: rgba(255,255,255,.82); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 18px rgba(58, 24, 29, .045); }
.section-button { border: 1px solid transparent; color: var(--ink); transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.section-button:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(58, 24, 29, .1); }
.section-button.bg-brand-red { background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(200, 40, 58, .35); }
.section-button.bg-slate-200 { background: transparent; }
#content { border: 1px solid var(--line); box-shadow: var(--shadow-soft); background: rgba(255,255,255,.96); }
#content > div:first-child { border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
#content h2 { color: var(--navy); letter-spacing: 0; }
#statsSection > div { border: 1px solid var(--line); border-top: 3px solid var(--teal); min-height: 92px; transition: transform .18s ease, box-shadow .18s ease; background: linear-gradient(145deg, #fff, #f8fbfd); }
#statsSection > div:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.kpi-bar { height: 5px; margin-top: .75rem; overflow: hidden; border-radius: 999px; background: #e8eef4; }
.kpi-bar span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .4s ease; }
.dashboard-welcome { border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.dashboard-loading { min-height: 12rem; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.platform-check-loading { min-height: 12rem; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.platform-check-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.platform-check-head button { display: inline-flex; align-items: center; gap: .45rem; }
.platform-check-head svg { width: 1rem; height: 1rem; }
.platform-check-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: var(--muted); }
.platform-check-summary strong { color: #166534; }
.platform-check-summary .platform-check-warn { color: #9a3412; }
.platform-check-summary .platform-check-fail { color: #991b1b; }
.platform-check-list { display: grid; gap: .65rem; }
.platform-check-card { display: flex; align-items: flex-start; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-inline-start: 4px solid #16a34a; border-radius: 10px; background: #fff; }
.platform-check-card h3 { margin: 0 0 .25rem; font-size: 1rem; }
.platform-check-card h3 span { margin-inline-start: .4rem; font-size: .75rem; font-weight: 700; }
.platform-check-card p { margin: 0; color: var(--muted); }
.platform-check-icon { display: grid; flex: 0 0 1.8rem; width: 1.8rem; height: 1.8rem; place-items: center; border-radius: 50%; background: #dcfce7; color: #166534; font-weight: 800; }
.platform-check-warn { border-inline-start-color: #f59e0b; background: #fffaf0; }
.platform-check-warn .platform-check-icon { background: #ffedd5; color: #9a3412; }
.platform-check-fail { border-inline-start-color: #dc2626; background: #fff7f7; }
.platform-check-fail .platform-check-icon { background: #fee2e2; color: #991b1b; }
.review-workspace-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.review-workspace-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.review-filter-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: .82rem; }
.review-filter-toolbar input { min-width: min(100%, 260px); }
.review-filter-toolbar span { padding: .25rem .5rem; border-radius: 999px; background: #f1f5f9; }
.review-pagination { display: flex; justify-content: center; gap: .6rem; padding: 1rem 0; }
.support-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.support-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-panel); background: #f8fafc; }
.support-toolbar input { flex: 1 1 18rem; }
.support-ticket-list { display: grid; gap: .75rem; }
.support-ticket-card { padding: 1rem; border: 1px solid var(--line); border-inline-start: 4px solid var(--teal); border-radius: var(--radius-panel); background: #fff; box-shadow: 0 6px 16px rgba(58, 24, 29, .05); }
.support-ticket-card h3 { margin: .65rem 0 .3rem; }
.support-ticket-card p { margin: 0 0 .8rem; color: var(--muted); white-space: pre-wrap; }
.support-ticket-meta, .support-ticket-footer { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.support-ticket-meta small { color: var(--muted); }
.support-ticket-footer { justify-content: space-between; padding-top: .7rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.ticket-priority { display: inline-flex; padding: .2rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.priority-urgent { background: #fee2e2; color: #991b1b; }.priority-high { background: #ffedd5; color: #9a3412; }.priority-normal { background: #e0f2fe; color: #075985; }.priority-low { background: #eadcdc; color: #5b4648; }
.support-thread { display: grid; gap: .55rem; max-height: 55vh; overflow: auto; padding: .2rem; }
.support-message { padding: .7rem; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.support-message strong, .support-message small { display: block; }.support-message small { color: var(--muted); font-size: .75rem; }.support-message p { margin: .35rem 0 0; white-space: pre-wrap; }
.notification-center-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.notification-center-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.notification-center-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-panel); background: #f8fafc; }
.notification-center-toolbar input { flex: 1 1 18rem; }
.notification-center-list { display: grid; gap: .7rem; }
.notification-center-card { padding: 1rem; border: 1px solid #bfdbfe; border-inline-start: 4px solid #0E8C9B; border-radius: var(--radius-panel); background: #eff6ff; }
.notification-center-card.is-read { border-color: var(--line); border-inline-start-color: #b09a9c; background: #fff; }
.notification-center-card-head, .notification-center-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.notification-center-card-head small, .notification-center-card-foot { color: var(--muted); font-size: .78rem; }
.notification-center-card p { margin: .6rem 0; white-space: pre-wrap; }
.review-workspace-toolbar label { display: grid; gap: .25rem; min-width: min(100%, 320px); }
.review-results-table { width: 100%; min-width: 760px; border-collapse: collapse; background: #fff; }
.review-results-table th, .review-results-table td { padding: .7rem; border-bottom: 1px solid var(--line); text-align: right; }
.review-results-table th { background: var(--navy); color: #fff; }
.review-status { display: inline-flex; padding: .25rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.review-status-APPROVED { background: #dcfce7; color: #166534; }
.review-status-DRAFT { background: #ffedd5; color: #9a3412; }
.review-status-NONE { background: #eadcdc; color: #5b4648; }
.dashboard-chart { margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.dashboard-chart h3 { margin: 0 0 1rem; color: var(--navy); }
.chart-bars { display: flex; align-items: end; justify-content: space-around; gap: 1rem; height: 190px; border-bottom: 1px solid var(--line); }
.chart-item { display: flex; flex: 1; height: 100%; align-items: center; flex-direction: column; justify-content: end; gap: .35rem; text-align: center; color: var(--muted); }
.chart-column { width: min(48px, 70%); min-height: 8px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #c8283a, #8b1a1a); transition: height .4s ease; }
.chart-value { color: var(--ink); font-weight: 700; }
table { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th { font-weight: 600; white-space: nowrap; background: #eef3f7 !important; color: var(--ink) !important; border-bottom: 1px solid var(--line); }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f7fafc; }
tbody tr:nth-child(even) { background: #fbfdff; }
thead th { position: sticky; top: 0; z-index: 1; }
td, th { vertical-align: middle; }
.actions-cell { min-width: 220px; }
.actions-cell button, td button { margin: .15rem; border: 0; font-size: .82rem; transition: filter .15s ease, transform .15s ease; }
.actions-cell button:hover, td button:hover, .btn:hover { filter: brightness(.93); transform: translateY(-1px); }
.btn { border: 0; font-weight: 700; transition: filter .15s ease, transform .15s ease; }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 3px 8px rgba(15,118,110,.16); }
.btn-primary:hover, .btn-secondary:hover, button[class*="bg-"]:hover, a[class*="bg-"]:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(58, 24, 29, .12); }
.question-image { display: block; max-width: min(100%, 680px); max-height: 360px; object-fit: contain; margin: 1rem auto 1.25rem; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; padding: .4rem; }
.question-image-button { display: block; width: min(100%, 680px); margin: 1rem auto 1.25rem; border: 0; background: transparent; color: var(--muted); text-align: center; }
.question-image-button .question-image { max-width: 100%; max-height: 230px; margin: 0 auto .3rem; cursor: zoom-in; }
/* the question image viewer now ships its own styles with /js/image-viewer.js */
.exam-message { min-height: 2rem; padding: .7rem .9rem; border-radius: 8px; font-weight: 600; }
.exam-message:empty { display: none; }
.exam-message.success { background: #ecfdf5; color: #047857; }
.exam-message.error { background: #fef2f2; color: #b91c1c; }
.timer-warning { color: #fca5a5; animation: timer-pulse 1.2s ease-in-out infinite; }
.exam-header { gap: 1rem; align-items: center; }
.exam-header-status { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.connection-status { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; background: rgba(255,255,255,.12); color: #d1fae5; font-size: .78rem; white-space: nowrap; }
.connection-status::before { content: ''; width: .45rem; height: .45rem; border-radius: 50%; background: #34d399; }
.connection-status.offline { background: rgba(127,29,29,.6); color: #fecaca; }
.connection-status.offline::before { background: #f87171; }
.connection-status.syncing { background: rgba(146,64,14,.65); color: #fed7aa; }
.connection-status.syncing::before { background: #fbbf24; animation: timer-pulse 1s ease-in-out infinite; }
.connection-status.saved { background: rgba(6,78,59,.7); color: #a7f3d0; }
.monitor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius-panel); background: rgba(255,255,255,.78); }
.monitor-last-updated { margin-inline-start: auto; color: var(--muted); font-size: .8rem; }
.monitor-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.monitor-summary article { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-panel); background: #fff; box-shadow: 0 6px 16px rgba(58, 24, 29, .05); }
.monitor-summary strong { color: var(--navy); font-size: 1.5rem; }
.monitor-summary span { color: var(--muted); font-size: .85rem; }
.monitor-time-remaining { color: var(--navy); font-variant-numeric: tabular-nums; }
.exam-progress { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.exam-track { height: 7px; border-radius: 999px; background: #d9e2ec; overflow: hidden; margin-bottom: 1rem; }
.exam-track span { display: block; height: 100%; background: var(--teal); transition: width .2s ease; }
.exam-question { display: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; box-shadow: 0 8px 22px rgba(58, 24, 29, .07); }
.exam-question.current { display: block; animation: question-in .18s ease-out; }
.question-heading { display: flex; align-items: flex-start; gap: .75rem; }
.question-heading h2 { margin: .1rem 0 1rem; line-height: 1.8; font-size: 1.12rem; }
.question-number { flex: 0 0 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700; }
.question-body { display: grid; gap: .65rem; }
.exam-option { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.exam-option:hover { border-color: var(--teal); background: #f0fdfa; }
.exam-option:has(input:checked) { border-color: var(--teal); background: #ecfdf5; box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
.exam-option input { margin-top: .25rem; accent-color: var(--teal); }
.essay-answer { width: 100%; resize: vertical; line-height: 1.8; }
.exam-navigation { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.exam-nav { border: 0; border-radius: 8px; padding: .75rem 1.1rem; font-weight: 700; }
.exam-nav.primary { background: var(--teal); color: #fff; }
.exam-nav.secondary { background: #eadcdc; color: var(--ink); }
.exam-nav:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary { background: #eadcdc; color: var(--ink); border: 0; padding: .55rem .85rem; border-radius: 8px; }
.quick-student-form { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: .65rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.quick-student-form input { min-width: 0; }
.report-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.report-toolbar h2 { flex: 1 1 100%; }
.inline-field { display: grid; gap: .25rem; min-width: 190px; font-size: .85rem; font-weight: 700; }
.report-output { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .5rem; }
.report-table th, .report-table td { padding: .65rem; border-bottom: 1px solid var(--line); text-align: right; }
.report-table th { background: var(--navy); color: #fff; white-space: nowrap; }
.survey-progress { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: .6rem; font-size: .9rem; }
.survey-question { display: none; border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; background: #fff; }
.survey-question.current { display: block; animation: question-in .18s ease-out; }
.survey-question h2 { margin: 0 0 1rem; line-height: 1.8; font-size: 1.1rem; }
.survey-ratings { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; }
.survey-rating { display: grid; justify-items: center; gap: .3rem; padding: .8rem .4rem; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.survey-rating:hover, .survey-rating.selected { background: #ecfdf5; color: #047857; border-color: var(--teal); transform: translateY(-2px); }
.survey-rating input { position: absolute; opacity: 0; pointer-events: none; }
.survey-rating strong { font-size: 1.25rem; color: inherit; }
.survey-submit { margin-top: 1rem; width: 100%; }
.question-builder-card { border: 1px solid var(--line) !important; background: #fbfdff !important; box-shadow: 0 6px 18px rgba(58, 24, 29, .05); transition: border-color .18s ease, box-shadow .18s ease; }
.question-builder-card:focus-within { border-color: var(--teal) !important; box-shadow: 0 0 0 4px rgba(15,118,110,.08); }
.option-builder-row { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.option-builder-row input { min-width: 0; flex: 1 1 12rem; }
.option-builder-row > * { min-width: 0; }
.option-builder-row { flex-wrap: wrap; }
.option-builder-row .correct-option { flex: 0 1 auto; }
.correct-option { display: flex; align-items: center; gap: .3rem; white-space: nowrap; color: var(--muted); }
.remove-option-btn { border: 0; background: #fee2e2; color: #991b1b; border-radius: 50%; width: 1.7rem; height: 1.7rem; font-weight: 700; }
@media (max-width: 767px) { .quick-student-form { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .survey-ratings { gap: .3rem; } .survey-rating { padding: .65rem .15rem; font-size: .72rem; } }
@media print { .report-toolbar { display: none !important; } .report-output { border: 0; } .report-table th { background: #eadcdc !important; color: #000 !important; } }
@media print { body:not(.print-score-bands) .score-band { background: #fff !important; border-inline-start-color: transparent !important; color: #000 !important; } }
@keyframes question-in { from { opacity: .2; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes timer-pulse { 50% { opacity: .65; } }
@media print {
  body { background: #fff !important; }
  header, #sections, #statsSection, .quick-student-form, #quickStudentMessage, #backCourses, #printCourseStudents, .actions-cell, .ui-tooltip { display: none !important; }
  main { padding: 0 !important; max-width: none !important; }
  #content { border: 0; box-shadow: none; padding: 0 !important; }
  #courseStudentsTable th { background: #eadcdc !important; color: #000 !important; }
}
.role-badge, .status-active, .status-inactive { display: inline-flex; align-items: center; border-radius: 999px; padding: .25rem .6rem; font-size: .76rem; font-weight: 700; }
.role-badge { background: #e6fffa; color: #115e59; }
.status-active { background: #dcfce7; color: #166534; }
.status-inactive { background: #fee2e2; color: #991b1b; }
.score-green { background: #ecfdf5 !important; border-color: #86efac !important; color: #166534; }
.score-orange { background: #fff7ed !important; border-color: #fdba74 !important; color: #9a3412; }
.score-red { background: #fef2f2 !important; border-color: #fca5a5 !important; color: #991b1b; }
.score-neutral { background: #f8fafc !important; border-color: var(--line) !important; color: var(--muted); }
.result-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.result-card small { color: inherit; opacity: .8; }
.report-print-header { margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); background: #f8fafc; text-align: center; }
.report-print-header h2 { margin-bottom: .5rem; font-size: 1.25rem; font-weight: 700; }
.report-print-header p { margin: .25rem 0; }
.report-print-header-row td { padding: 1rem; background: #f8fafc; text-align: center; font-weight: 600; }
.report-print-logo { display: block; max-height: 64px; max-width: 180px; margin: 0 auto .5rem; object-fit: contain; }
.report-signatures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); text-align: center; }
.report-print-footer-text { grid-column: 1 / -1; margin-top: 1rem; color: var(--muted); font-size: .8rem; }
.platform-rights-bar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 80; min-height: 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem 1rem; border-top: 1px solid rgba(200, 40, 58, .35); background: rgba(255,255,255,.94); color: var(--muted); font-size: .78rem; text-align: center; box-shadow: 0 -4px 16px rgba(200, 40, 40, .10); backdrop-filter: blur(8px); direction: rtl; }
.platform-rights-text { flex: 1 1 50%; text-align: right; overflow-wrap: anywhere; }
.platform-credit-text { flex: 1 1 50%; text-align: left; white-space: nowrap; color: #1a0c0f; font-size: .68rem; font-weight: 700; opacity: .5; }
body.has-rights-bar { padding-bottom: 2.25rem; }
@media (max-width: 640px) { .platform-rights-bar { align-items: stretch; flex-direction: column; gap: .15rem; padding: .3rem .65rem; } .platform-rights-text, .platform-credit-text { flex-basis: auto; text-align: center; white-space: normal; } }
.ticket-status { display: inline-flex; padding: .25rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.ticket-open { color: #9a3412; background: #ffedd5; }
.ticket-replied { color: #166534; background: #dcfce7; }
.ticket-closed { color: #5b4648; background: #eadcdc; }
.survey-print-footer { grid-column: 1 / -1; margin-top: 1rem; color: var(--muted); font-size: .8rem; }
@media print { .survey-print-meta { border: 0; background: #fff; } .survey-print-signatures { display: grid !important; } }
/* الأسطح البيضاء تُثبّت لون نصها: بدون ذلك يرث النص لون الهيكل الداكن فيظهر باهتًا على الأبيض
   (هذا ما جعل نص السؤال وعنوان الاختبار في صفحة المراجعة شبه غير مقروء) */
.student-review { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 1rem; color: var(--panel-text, #1a0c0f); }
.student-review h2, .student-review h3, .student-review h4 { color: var(--panel-text, #1a0c0f); }
.review-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; margin: 1rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: var(--panel-text, #1a0c0f); }
.review-actions label { display: grid; gap: .25rem; min-width: 130px; font-size: .82rem; }
.review-actions input, .review-actions select { min-width: 130px; }
.student-review h2 { margin-bottom: .5rem; }
.review-question { padding: .9rem; margin-top: .7rem; border: 1px solid var(--line); border-right: 4px solid var(--teal); border-radius: 9px; background: #fbfdff; color: var(--panel-text, #1a0c0f); }
.review-question h3 { margin: 0 0 .45rem; font-size: 1rem; color: var(--panel-text, #1a0c0f); font-weight: 700; }
.review-question p { margin: .25rem 0; color: var(--panel-text-muted, #6b5a5c); }
.review-question strong { color: var(--panel-text, #1a0c0f); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15,118,110,.16); border-color: var(--teal); }
select, input, textarea { background: #fff; }
label { display: inline-block; max-width: 100%; font-weight: 600; }
button:disabled { cursor: not-allowed; }
button, a[class*="bg-"] { touch-action: manipulation; }
.login-page { background: radial-gradient(circle at top, var(--header-from, #164e63) 0, var(--header-to, #1a0c0f) 55%, var(--bg, #020617) 100%); }
.login-page::after { content: ''; position: fixed; inset: .65rem; z-index: 0; pointer-events: none; border: 1px solid var(--border-strong, rgba(45,212,191,.16)); border-radius: 18px; box-shadow: 0 0 18px var(--primary-soft, rgba(45,212,191,.08)), inset 0 0 18px var(--primary-soft, rgba(45,212,191,.04)); animation: login-edge-glow 7s ease-in-out infinite; }
.login-page > * { position: relative; z-index: 1; }
.login-shell { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(250px, 1fr) 1px minmax(320px, 400px); align-items: center; width: min(100%, 900px); min-height: 31rem; margin-inline: auto; direction: ltr; }
.login-brand-panel { grid-column: 1; display: grid; justify-items: center; gap: 1rem; padding: 2rem; color: #fff; text-align: center; direction: rtl; }
.login-brand-panel h1 { margin: 0; color: #fff; font-size: clamp(1.6rem, 2vw, 2.25rem); }
.login-brand-panel p { margin: 0; color: var(--text-muted, #a8c1d4); }
.login-logo-glow { position: relative; display: grid; place-items: center; min-height: 9rem; }
.login-logo-glow::before { content: ''; position: absolute; width: 10rem; height: 10rem; border-radius: 50%; background: var(--primary-soft, rgba(45,212,191,.15)); filter: blur(24px); animation: login-logo-pulse 5s ease-in-out infinite; }
.login-logo-glow img { position: relative; z-index: 1; filter: drop-shadow(0 0 12px rgba(255,255,255,.35)); }
.login-logo-glow img { height: 14rem; max-width: 26rem; }
.login-brand-divider { width: 5rem; height: 2px; border-radius: 999px; background: linear-gradient(90deg, transparent, var(--primary, #5eead4), transparent); box-shadow: 0 0 14px var(--primary, rgba(94,234,212,.75)); }
.login-rights { display: grid; gap: .25rem; width: min(100%, 26rem); margin-top: .8rem; padding: .55rem .8rem; border-top: 1px solid rgba(148,163,184,.28); border-bottom: 1px solid rgba(148,163,184,.18); color: #a8c1d4; font-size: .72rem; line-height: 1.5; text-align: center; }
.login-rights-text { color: #e0d2d2; }
.login-credit-text { color: #b09a9c; font-size: .68rem; opacity: .9; }
.login-panel-separator { grid-column: 2; width: 1px; height: 15rem; background: linear-gradient(180deg, transparent, rgba(94,234,212,.72), transparent); box-shadow: 0 0 16px rgba(45,212,191,.38); }
.login-card { grid-column: 3; width: 100%; margin-inline: auto; padding: 2rem !important; text-align: center; direction: rtl; }
.login-form { width: 100%; max-width: 300px; margin-inline: auto; text-align: right; }
.login-form label { display: block; }
.login-form input { text-align: center; }
.login-form button { display: flex; align-items: center; justify-content: center; margin-inline: auto; }
.login-card { border: 1px solid rgba(255,255,255,.7); box-shadow: 0 24px 70px rgba(2,6,23,.32); }
.login-card .login-form button { min-height: 3.1rem; font-weight: 800; box-shadow: 0 8px 18px rgba(161, 30, 42, .22); }
@media (max-width: 520px) {
  .login-shell { display: flex; flex-direction: column; width: min(100%, calc(100vw - 2rem)); min-height: auto; gap: .4rem; direction: rtl; }
  .login-brand-panel { padding: 1rem .5rem; gap: .55rem; }
  .login-logo-glow { min-height: 6rem; }
  .login-logo-glow img { height: 10rem; }
  .login-logo-glow::before { width: 6rem; height: 6rem; }
  .login-panel-separator { width: 8rem; height: 1px; }
  .login-card { width: 100%; padding: 1.35rem !important; }
}
@keyframes login-edge-glow { 0%, 100% { opacity: .45; box-shadow: 0 0 14px var(--primary-soft, rgba(45,212,191,.05)), inset 0 0 14px var(--primary-soft, rgba(45,212,191,.02)); } 50% { opacity: 1; box-shadow: 0 0 28px var(--primary-soft, rgba(45,212,191,.2)), inset 0 0 22px var(--primary-soft, rgba(45,212,191,.07)); } }
@keyframes login-logo-pulse { 0%, 100% { opacity: .55; transform: scale(.92); } 50% { opacity: .95; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .login-page::after { animation: none; opacity: .7; } }
#modal { backdrop-filter: blur(4px); background: rgba(58, 24, 29, .48); }
#modal > div { border: 1px solid rgba(255,255,255,.7); animation: modal-in .18s ease-out; }
#modalTitle { color: var(--navy); }
#modalClose { width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%; background: #f1f5f9; line-height: 1; }
#modalClose:hover { background: #fee2e2; color: var(--danger); }
#notificationMenu { animation: menu-in .14s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.ui-tooltip { position: fixed; z-index: 1000; max-width: 280px; padding: .5rem .7rem; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(58, 24, 29, .94); color: #fff; direction: rtl; text-align: right; font-size: .78rem; line-height: 1.5; box-shadow: 0 8px 22px rgba(58, 24, 29, .16); opacity: 0; transform: translateY(-3px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.ui-tooltip.visible { opacity: 1; transform: translateY(0); }
.has-ui-tooltip:focus-visible { outline: 3px solid rgba(217,119,6,.38); outline-offset: 2px; }
.toast-host { position: fixed; top: 1.1rem; left: 1.1rem; z-index: 1100; display: grid; gap: .65rem; width: min(380px, calc(100vw - 2rem)); direction: rtl; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .65rem; padding: .8rem .9rem; border: 1px solid var(--line); border-right: 4px solid var(--teal); border-radius: 12px; background: rgba(255,255,255,.97); color: var(--ink); box-shadow: 0 12px 30px rgba(58, 24, 29, .16); animation: toast-in .2s ease-out; font-size: .9rem; }
.toast svg { width: 1.15rem; height: 1.15rem; color: var(--teal); }
.toast button { border: 0; background: transparent; color: var(--muted); font-size: 1.25rem; line-height: 1; }
.toast-success { border-right-color: #16a34a; }.toast-success svg { color: #16a34a; }
.toast-warning { border-right-color: var(--gold); }.toast-warning svg { color: var(--gold); }
.toast-error { border-right-color: var(--danger); }.toast-error svg { color: var(--danger); }
.exam-builder-overlay { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(58, 24, 29, .52); backdrop-filter: blur(5px); }
.exam-builder-modal { width: min(1120px, 96vw); height: min(900px, 94vh); overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(58, 24, 29, .25); animation: modal-in .2s ease-out; }
.exam-builder-modal-head { height: 3.5rem; display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; border-bottom: 1px solid var(--line); color: var(--navy); }
.exam-builder-modal-head button { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: #f1f5f9; color: var(--muted); font-size: 1.4rem; }
.exam-builder-modal iframe { width: 100%; height: calc(100% - 3.5rem); border: 0; }
.bank-picker-modal { height: min(760px, 88vh); }.bank-picker-body { display: grid; gap: 1rem; padding: 1rem; height: calc(100% - 3.5rem); overflow: auto; }.bank-question-list { display: grid; gap: .5rem; overflow: auto; }.bank-question-row { display: flex; gap: .65rem; align-items: flex-start; padding: .8rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }.bank-question-row:hover { border-color: var(--teal); background: #f0fdfa; }.bank-question-row span { display: grid; gap: .25rem; }.bank-question-row small { color: var(--muted); }.bank-source-badge { display: inline-block; color: #8b1a1a; background: #ccfbf1; border-radius: 999px; padding: .2rem .55rem; font-size: .75rem; margin-bottom: .5rem; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 767px) {
  header { padding: .85rem 1rem; }
  header .gap-4 { gap: .5rem; }
  header h1 { font-size: 1rem; }
  header #identity { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding: 1rem; }
  #sections { overflow-x: auto; flex-wrap: nowrap; padding: .3rem; }
  .section-button { flex: 0 0 auto; white-space: nowrap; }
  #content { padding: 1rem; }
  #content > div:first-child { align-items: stretch; }
  #content > div:first-child > div { width: 100%; flex-wrap: wrap; }
  #tableSearch { flex: 1 1 100%; min-width: 0; }
  .actions-cell { min-width: 180px; }
  .report-toolbar { position: static; }
  .report-toolbar .inline-field { min-width: min(100%, 220px); flex: 1 1 100%; }
  #notificationMenu { position: fixed !important; top: 4.2rem !important; left: .75rem !important; right: .75rem; width: auto !important; }
}

.dashboard-shell { display: grid; grid-template-columns: minmax(190px, 230px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.dashboard-shell #statsSection { grid-column: 1 / -1; }
.dashboard-page { min-height: 100dvh; height: auto; overflow-x: hidden; overflow-y: auto; }
.dashboard-page > header { flex: 0 0 auto; }
.dashboard-page .dashboard-shell { grid-template-rows: auto minmax(0, 1fr); min-height: calc(100dvh - 5.25rem); overflow: visible; }
.dashboard-sidebar { grid-column: 1; grid-row: 2; min-height: 0; position: relative; display: grid; align-content: start; gap: .35rem; padding: .65rem; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.dashboard-shell #content { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow-y: visible; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.question-bank-table-wrap { width: 100%; max-width: 100%; overflow-x: auto !important; overflow-y: visible; }
.question-bank-table { width: 100% !important; min-width: 980px; table-layout: fixed !important; }
.question-bank-table th, .question-bank-table td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; color: var(--ink) !important; opacity: 1 !important; }
.question-bank-table th:first-child, .question-bank-table td.selection-cell { width: 3rem; min-width: 3rem; text-align: center; }
.question-bank-table th:nth-child(2), .question-bank-table td:nth-child(2) { width: 37%; min-width: 18rem; line-height: 1.8; }
.question-bank-table th:nth-child(3), .question-bank-table td:nth-child(3) { width: 16%; min-width: 10rem; }
.question-bank-table th:nth-child(4), .question-bank-table td:nth-child(4) { width: 8rem; min-width: 7rem; white-space: nowrap; }
.question-bank-table th:nth-child(5), .question-bank-table td:nth-child(5) { width: 8rem; min-width: 7rem; white-space: nowrap; }
.question-bank-table th:last-child, .question-bank-table td.actions-cell { width: 13rem; min-width: 13rem; white-space: nowrap; }
.question-bank-table tbody tr { min-height: 3.5rem; }
.question-bank-table tbody td { display: table-cell !important; visibility: visible !important; }
.question-bank-table td:nth-child(2) { vertical-align: middle; }
.question-bank-table .actions-cell { position: sticky; left: 0; z-index: 3; background: var(--panel); box-shadow: 4px 0 8px rgba(200, 40, 40, .10); }
.question-bank-table thead th:last-child { position: sticky; left: 0; z-index: 4; background: var(--navy); }
.question-bank-table .actions-cell button { display: inline-flex; align-items: center; justify-content: center; min-width: 4.5rem; white-space: nowrap; }
.question-bank-pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem 0; direction: rtl; }
.question-bank-pagination span { color: var(--muted); font-weight: 600; }
.question-bank-pagination button:disabled { cursor: not-allowed; opacity: .45; }
.dashboard-shell #content > * { min-width: 0; max-width: 100%; }
.dashboard-shell table { table-layout: fixed; }
.dashboard-shell th, .dashboard-shell td { overflow-wrap: anywhere; }
.section-button { display: flex; align-items: center; gap: .65rem; width: 100%; border: 1px solid transparent; color: var(--ink); background: transparent; padding: .72rem .8rem; border-radius: 9px; text-align: right; transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.section-button svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
.section-button:hover, .section-button.is-active { transform: translateX(-2px); background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(200, 40, 58, .35); }
.sidebar-guide-separator { height: 1px; margin: .8rem .4rem .35rem; background: var(--line); }
.sidebar-guide-button { color: var(--navy); background: #f8fafc; border-color: var(--line); }
.user-guide { animation: content-enter 220ms ease-out both; }
.user-guide-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.user-guide-head h2 { margin: .2rem 0; }
.user-guide-head p { color: var(--muted); }
.user-guide ol { display: grid; gap: .75rem; margin: 0; padding-inline-start: 1.5rem; }
.user-guide ol li { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-control); background: #f8fafc; }
.user-guide-links { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.user-guide-links > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.quick-navigation { display: grid; gap: .75rem; margin-top: 1.6rem; padding: 1rem; border-top: 1px solid var(--line); border-radius: var(--radius-panel); background: #f8fafc; }
.quick-navigation > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.quick-navigation > div:first-child strong { color: var(--navy); }
.quick-navigation > div:first-child small { color: var(--muted); }
.quick-navigation-links { display: flex; flex-wrap: wrap; gap: .45rem; }
.quick-navigation-link { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.35rem; padding: .4rem .65rem; font-size: .82rem; }
.quick-navigation-link svg { width: .95rem; height: .95rem; }
.report-document-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-panel); background: #fff; box-shadow: var(--shadow-soft); }
.report-eyebrow { margin: 0; color: var(--teal); font-size: .8rem; font-weight: 800; }
.report-document-header h1 { margin: .3rem 0; }
.report-document-header p { margin: 0; color: var(--muted); }
.report-document-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.report-document-section { margin-bottom: 1rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius-panel); background: #fff; box-shadow: var(--shadow-soft); }
.report-document-section h2 { margin-top: 0; color: var(--navy); }
.report-facts, .report-directory { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.report-facts article, .report-directory article { padding: .9rem; border: 1px solid var(--line); border-radius: var(--radius-control); background: #f8fafc; }
.report-facts strong, .report-facts span { display: block; }.report-facts span, .report-directory p { color: var(--muted); }
.report-directory h3 { margin: 0 0 .3rem; }.report-directory p { margin: 0; font-size: .9rem; }
.report-steps { display: grid; gap: .55rem; }.report-document-footer { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .8rem; padding: .75rem 0; }
@media print { .no-print, .platform-rights-bar { display: none !important; } .report-document-section, .report-document-header { box-shadow: none; break-inside: avoid; } body { background: #fff !important; } }
.header-icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 2.35rem; height: 2.35rem; border: 1px solid var(--line); border-radius: 8px; background: #edf2f7; color: var(--ink); }
.header-icon-button svg { width: 1.15rem; height: 1.15rem; }
.header-actions { min-width: 0; }
#platformLogo { flex: 0 0 auto; height: 6.9rem; width: auto; max-width: 22.5rem; object-fit: contain; background: none; padding: 0; }
.dashboard-page > header { flex-wrap: nowrap; min-height: 7.6rem; }
.dashboard-page > header > div:first-child { flex-wrap: nowrap; }
.header-action-button, .header-logout-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line); color: var(--ink); font-weight: 700; }
.header-action-button { position: relative; width: 2.55rem; min-height: 2.55rem; padding: 0; background: #edf2f7; }
.header-action-button svg, .header-logout-button svg { width: 1.1rem; height: 1.1rem; }
.header-action-button span { position: absolute; top: -.35rem; left: -.35rem; display: grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .2rem; border-radius: 999px; background: var(--gold); color: #fff; font-size: .68rem; line-height: 1; }
.header-logout-button { min-height: 2.55rem; padding: .45rem .75rem; background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.header-logout-button:hover { background: #ffe4e6; }
.dashboard-shell { transition: grid-template-columns 240ms ease, gap 240ms ease; }
.dashboard-sidebar { transition: width 240ms ease, opacity 200ms ease, padding 200ms ease, border-color 200ms ease; }
body.sidebar-collapsed .dashboard-sidebar { width: 0; min-width: 0; padding: 0; border-width: 0; opacity: 0; overflow: hidden; pointer-events: none; }
body.sidebar-collapsed .dashboard-shell { grid-template-columns: 0 minmax(0, 1fr); gap: 0; }
/* Compact icon-only action buttons with a hover tooltip showing the action name. */
.actions-cell, .icon-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.icon-action-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.15rem; height: 2.15rem; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 8px; background: #f7f1f1; color: var(--ink); flex: 0 0 auto; }
.icon-action-btn svg { width: 1.05rem; height: 1.05rem; }
.icon-action-btn:hover { filter: brightness(.96); }
.icon-action-btn.icon-edit { background: #fef3c7; color: #92400e; }
.icon-action-btn.icon-delete { background: #fee2e2; color: #b91c1c; }
.icon-action-btn.icon-success { background: #dcfce7; color: #166534; }
.icon-action-btn.icon-warning { background: #ffedd5; color: #9a3412; }
.icon-action-btn.icon-primary { background: #dbeafe; color: #8b1a1a; }
.icon-action-btn.icon-secondary { background: #eadcdc; color: #4a3a3c; }
.icon-action-btn[title]:hover::after, .icon-action-btn[title]:focus-visible::after { content: attr(title); position: absolute; bottom: calc(100% + .4rem); right: 50%; transform: translateX(50%); background: #1a0c0f; color: #fff; padding: .3rem .6rem; border-radius: 6px; font-size: .72rem; line-height: 1.2; white-space: nowrap; box-shadow: 0 8px 18px rgba(26, 12, 15,.28); z-index: 40; pointer-events: none; }
.icon-action-btn[title]:hover::before, .icon-action-btn[title]:focus-visible::before { content: ''; position: absolute; bottom: 100%; right: 50%; transform: translateX(50%); border: 5px solid transparent; border-top-color: #1a0c0f; z-index: 40; pointer-events: none; }
.survey-donut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.survey-donut { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.survey-donut-ring { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--score, 0) * 20%), #eadcdc 0); position: relative; }
.survey-donut-ring::after { content: ''; position: absolute; width: 64px; height: 64px; border-radius: 50%; background: #fbfdff; }
.survey-donut-ring strong { position: relative; z-index: 1; font-size: .9rem; }
.subject-manager { display: grid; gap: 1rem; }
.subject-manager-list { display: grid; gap: .5rem; max-height: 22rem; overflow: auto; }
.subject-manager-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.subject-manager-row > span:last-child { display: flex; gap: .4rem; }
.workspace-page, body:has(#exam), body:has(#surveyForm) { min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
.workspace-page .container, .workspace-page main { width: min(100% - 2rem, 1120px); min-width: 0; }
.workspace-page .grid > *, .workspace-page form > *, .workspace-page section > * { min-width: 0; }
.exam-builder-page .question-builder-card { overflow: hidden; }
.exam-builder-page .question-builder-card textarea, .exam-builder-page .question-builder-card input, .exam-builder-page .question-builder-card select { max-width: 100%; }
.reports-page .report-controls { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(170px, 1.25fr); gap: .65rem; align-items: end; }
.reports-page .report-controls > * { min-width: 0; }
.reports-page .report-controls button { min-height: 2.7rem; }
.reports-page .report-controls .wide-action { grid-column: span 1; }
.reports-page .report-output, .reports-page .table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; }
.reports-page table { width: 100%; table-layout: fixed; }
.reports-page th, .reports-page td { overflow-wrap: anywhere; word-break: break-word; }
.reports-page .essay-score { width: min(100%, 9rem); }
.reports-page .save-essay { margin-top: .5rem; }
.exam-builder-form > .mt-6 { display: flex; flex-wrap: wrap; gap: .65rem; }
.exam-builder-form > .mt-6 button { min-width: 10rem; }
.score-band { border-inline-start: 5px solid transparent; }
.score-band.score-green { border-inline-start-color: #16a34a !important; }
.score-band.score-orange { border-inline-start-color: #f59e0b !important; }
.score-band.score-red { border-inline-start-color: #dc2626 !important; }
.result-modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 1rem; background: rgba(26, 12, 15,.58); }
.result-modal-card { width: min(440px, 100%); padding: 2rem; border: 1px solid rgba(255,255,255,.7); border-radius: 18px; background: #fff; color: var(--ink); text-align: center; box-shadow: 0 24px 70px rgba(26, 12, 15,.24); }
.result-modal-card h2 { margin: 0 0 .75rem; color: var(--navy); }
.result-modal-score { margin: 1rem 0; font-size: 2rem; font-weight: 800; }
@media (max-width: 767px) {
  .dashboard-shell { display: block; padding: .8rem; }
  .dashboard-page { height: auto; min-height: 100dvh; overflow: auto; }
  .dashboard-page .dashboard-shell { height: auto; min-height: 0; overflow: visible; }
  .header-actions { gap: .35rem; }
  .header-logout-button { width: 2.55rem; padding: 0; }
  .header-logout-button span { display: none; }
  .dashboard-sidebar { position: relative; z-index: 1; max-height: 70vh; overflow-y: auto; overflow-x: hidden; background: #fff; margin-bottom: 1rem; transition: max-height 240ms ease, opacity 200ms ease, margin-bottom 200ms ease, padding 200ms ease; }
  .dashboard-shell #content { margin-top: 0; }
  .dashboard-shell #content { max-height: none; overflow: visible; }
  body.sidebar-collapsed .dashboard-sidebar { max-height: 0; opacity: 0; margin-bottom: 0; padding: 0; border-width: 0; overflow: hidden; pointer-events: none; }
  .col-span-2 { grid-column: 1; }
  .workspace-page .container, .workspace-page main, body:has(#exam) main, body:has(#surveyForm) main { width: min(100% - 1rem, 1120px); padding: .75rem; }
  .workspace-page h1, body:has(#exam) h1, body:has(#surveyForm) h1 { font-size: 1.5rem; line-height: 1.4; }
  .reports-page .report-controls { grid-template-columns: 1fr; }
  .reports-page .report-controls .wide-action { grid-column: auto; }
  .reports-page .report-controls button, .reports-page .report-controls select, .reports-page .report-controls input { width: 100%; }
  button, .btn, a[class*="bg-"] { min-height: 2.9rem; }
  table { font-size: .88rem; }
  th, td { padding: .55rem .45rem; }
  .exam-header { align-items: flex-start; padding: .8rem 1rem; }
  .exam-header-status { align-items: flex-end; flex-direction: column; gap: .25rem; }
  .connection-status { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
}

  /* Keep question-bank filters and actions above the table instead of forcing a horizontal toolbar. */
  #content:has(#bankTextFilter) > div:first-child { display: block; }
  #content:has(#bankTextFilter) > div:first-child > h2 { margin-bottom: 1rem; }
  #content:has(#bankTextFilter) > div:first-child > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; width: 100%; }
  #content:has(#bankTextFilter) #bankTextFilter { grid-column: 1 / -1; min-width: 0; width: 100%; }
  #content:has(#bankTextFilter) #tableSearch { grid-column: 1 / -1; min-width: 0; width: 100%; }
  #content:has(#bankTextFilter) > .overflow-auto { overflow-x: hidden; margin-top: 1rem; }
  #content:has(#bankTextFilter) table { table-layout: fixed; width: 100%; }
  #content:has(#bankTextFilter) th, #content:has(#bankTextFilter) td { overflow-wrap: anywhere; word-break: break-word; }
  #content:has(#bankTextFilter) th:first-child, #content:has(#bankTextFilter) td.selection-cell { width: 5%; text-align: center; }
  #content:has(#bankTextFilter) th:nth-child(2), #content:has(#bankTextFilter) td:nth-child(2) { width: 36%; }
  #content:has(#bankTextFilter) th:nth-child(3), #content:has(#bankTextFilter) td:nth-child(3) { width: 16%; }
  #content:has(#bankTextFilter) th:nth-child(4), #content:has(#bankTextFilter) td:nth-child(4) { width: 9%; }
  #content:has(#bankTextFilter) th:nth-child(5), #content:has(#bankTextFilter) td:nth-child(5) { width: 9%; }
  #content:has(#bankTextFilter) th:last-child, #content:has(#bankTextFilter) td.actions-cell { width: 25%; min-width: 13rem; }
  #content:has(#bankTextFilter) .actions-cell button { display: inline-flex; align-items: center; justify-content: center; min-width: 4.5rem; }
  @media (max-width: 767px) {
    #content:has(#bankTextFilter) > div:first-child > div { grid-template-columns: 1fr 1fr; }
    #content:has(#bankTextFilter) #bankTextFilter, #content:has(#bankTextFilter) #tableSearch { grid-column: 1 / -1; }
    #content:has(#bankTextFilter) > .overflow-auto { overflow-x: hidden; }
    #content:has(#bankTextFilter) table { font-size: .82rem; }
    #content:has(#bankTextFilter) th, #content:has(#bankTextFilter) td { padding: .55rem .35rem; }
    #content:has(#bankTextFilter) .actions-cell button { min-width: 0; width: 100%; margin: .15rem 0; }
  }

/* Unified layout layer: keeps every workspace calm, readable, and responsive. */
:root {
  --space-1: .35rem;
  --space-2: .65rem;
  --space-3: .9rem;
  --space-4: 1.2rem;
  --space-5: 1.6rem;
  --space-6: 2rem;
  --radius-control: 9px;
  --radius-panel: 14px;
  --content-width: 1280px;
  --transition-ui: 180ms cubic-bezier(.2,.7,.2,1);
}
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body { font-size: clamp(.92rem, .2vw + .87rem, 1rem); line-height: 1.65; }
h1, h2, h3, h4 { line-height: 1.35; text-wrap: balance; }
h1 { font-size: clamp(1.45rem, 1.2vw + 1rem, 2rem); }
h2 { font-size: clamp(1.2rem, .7vw + .95rem, 1.55rem); }
h3 { font-size: clamp(1rem, .35vw + .9rem, 1.2rem); }
button, .btn, input, select, textarea { border-radius: var(--radius-control); }
button, .btn, a[class*="bg-"] { transition: transform var(--transition-ui), box-shadow var(--transition-ui), background-color var(--transition-ui), color var(--transition-ui), border-color var(--transition-ui); }
button:hover:not(:disabled), .btn:hover, a[class*="bg-"]:hover { transform: translateY(-1px); }
button:active:not(:disabled), .btn:active { transform: translateY(0); }
input, select, textarea { min-height: 2.7rem; transition: border-color var(--transition-ui), box-shadow var(--transition-ui); }
input::placeholder, textarea::placeholder { color: #8aa0b5; }
table { border-spacing: 0; }
th { letter-spacing: .01em; }
td, th { line-height: 1.55; }
#content { border-radius: var(--radius-panel); transition: box-shadow var(--transition-ui), border-color var(--transition-ui); }
#content > * { animation: content-enter 220ms ease-out both; }
.dashboard-shell { width: min(calc(100% - 2rem), var(--content-width)); margin-inline: auto; grid-template-columns: minmax(210px, 250px) minmax(0, 1fr); gap: var(--space-5); }
.dashboard-sidebar { padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-panel); background: rgba(255,255,255,.78); box-shadow: 0 8px 24px rgba(58, 24, 29, .05); }
.section-button { min-height: 2.8rem; padding: .65rem .75rem; border-radius: var(--radius-control); }
.dashboard-page > header { min-height: 4.6rem; padding-inline: max(1rem, calc((100vw - var(--content-width)) / 2)); }
.dashboard-page > header > div:first-child { min-width: 0; }
.dashboard-page > header h1 { max-width: 32rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-page > header img { flex: 0 0 auto; }
.dashboard-page #statsSection > div { border-radius: var(--radius-panel); padding: var(--space-4); }
.dashboard-page #statsSection strong { font-size: clamp(1.35rem, 1vw + 1rem, 2rem); }
.workspace-page .container, .workspace-page main { width: min(calc(100% - 2rem), var(--content-width)); margin-inline: auto; }
.workspace-page .container > h1, .workspace-page main > h1 { margin-bottom: var(--space-5); }
.workspace-page form, .workspace-page .report-output, .workspace-page .student-review { border-radius: var(--radius-panel); }
.report-toolbar, .review-workspace-toolbar, .platform-check-head, .review-workspace-head { gap: var(--space-3); }
.report-toolbar { padding: var(--space-3); border-radius: var(--radius-panel); background: rgba(255,255,255,.72); }
.exam-question, .survey-question, .result-card { border-radius: var(--radius-panel); }
.exam-question { padding: clamp(1rem, 2vw, 1.6rem); }
.exam-navigation { position: sticky; bottom: .75rem; z-index: 5; padding: .45rem; border: 1px solid rgba(217,226,236,.8); border-radius: var(--radius-panel); background: rgba(255,255,255,.9); box-shadow: 0 8px 22px rgba(58, 24, 29, .1); backdrop-filter: blur(8px); }
.platform-rights-bar { min-height: 2.15rem; }
@keyframes content-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 900px) {
  .dashboard-shell { grid-template-columns: minmax(180px, 210px) minmax(0, 1fr); gap: var(--space-3); }
  .dashboard-page > header { padding-inline: 1rem; }
}
@media (max-width: 767px) {
  .dashboard-shell { width: 100%; padding: var(--space-3); }
  .dashboard-page > header { min-height: 4.35rem; }
  .dashboard-page > header h1 { max-width: 42vw; font-size: 1rem; }
  .dashboard-sidebar { border-radius: var(--radius-panel); padding: var(--space-2); box-shadow: 0 16px 36px rgba(58, 24, 29, .16); }
  #content { border-radius: var(--radius-panel); padding: var(--space-4); }
  .workspace-page .container, .workspace-page main { width: calc(100% - 1rem); padding: var(--space-3); }
  .workspace-page .flex.justify-between { align-items: stretch; flex-direction: column; gap: var(--space-3); }
  .workspace-page .flex.justify-between > a { align-self: flex-start; }
  .report-toolbar, .review-workspace-toolbar, .platform-check-head, .review-workspace-head { align-items: stretch; flex-direction: column; }
  .report-toolbar button, .report-toolbar select, .report-toolbar input, .review-workspace-toolbar select, .review-workspace-toolbar button { width: 100%; }
  .exam-navigation { bottom: .4rem; }
  .monitor-summary { grid-template-columns: 1fr; }
  .monitor-last-updated { width: 100%; margin-inline-start: 0; }
  .monitor-toolbar select, .monitor-toolbar button { flex: 1 1 100%; width: 100%; }
}

/* ==== 2026-09-18 :: development pass ============================================
   1. Icon-only action buttons now take their tooltip from data-label instead of
      title, so the browser's native tooltip no longer duplicates the styled one.
   2. Login page: password reveal, remember-username row, caps-lock warning and a
      busy state for the submit button.
   ============================================================================= */
.icon-action-btn[data-label]:hover::after,
.icon-action-btn[data-label]:focus-visible::after { content: attr(data-label); position: absolute; bottom: calc(100% + .4rem); right: 50%; transform: translateX(50%); background: #1a0c0f; color: #fff; padding: .3rem .6rem; border-radius: 6px; font-size: .72rem; line-height: 1.2; white-space: nowrap; box-shadow: 0 8px 18px rgba(26, 12, 15,.28); z-index: 40; pointer-events: none; }
.icon-action-btn[data-label]:hover::before,
.icon-action-btn[data-label]:focus-visible::before { content: ''; position: absolute; bottom: 100%; right: 50%; transform: translateX(50%); border: 5px solid transparent; border-top-color: #1a0c0f; z-index: 40; pointer-events: none; }

.password-field { position: relative; display: block; }
.password-field input { padding-left: 2.9rem; }
.password-toggle { position: absolute; left: .45rem; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 2.15rem; height: 2.15rem; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #64748b; cursor: pointer; }
.password-toggle:hover { background: #f1f5f9; color: #1a0c0f; }
.password-toggle:focus-visible { outline: 3px solid rgba(161, 30, 42, .35); outline-offset: 1px; }
.password-toggle svg { width: 1.1rem; height: 1.1rem; }

.login-options { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .84rem; }
.login-remember { display: inline-flex; align-items: center; gap: .45rem; margin: 0; color: #5b4648; cursor: pointer; }
.login-remember input { width: 1rem; height: 1rem; margin: 0; accent-color: #0E8C9B; cursor: pointer; }
.login-link { padding: 0; border: 0; background: none; color: #0E8C9B; font-size: .8rem; text-decoration: underline; cursor: pointer; }
.login-link:hover { color: #8b1a1a; }

.field-warning { margin: 0; padding: .45rem .6rem; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; color: #b45309; font-size: .8rem; text-align: center; }

.login-submit { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.login-submit svg { width: 1.15rem; height: 1.15rem; }
.login-submit[disabled] { opacity: .75; cursor: progress; }
.login-submit[aria-busy="true"] svg { animation: login-submit-spin 1s linear infinite; }
@keyframes login-submit-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .login-submit[aria-busy="true"] svg { animation: none; } }

.login-form input:focus-visible { outline: 3px solid rgba(161, 30, 42, .35); outline-offset: 1px; }

/* ==== 2026-09-18 (2) :: question-bank action buttons ===========================
   The actions cell forced every button to min-width 4.5rem, which stretched the
   icon-only buttons into wide pills and made the pair look like one blurred block.
   Icon buttons are now compact 2.15rem squares and sit closer together.
   The two question-bank actions also carry their own colours so they stay readable
   before the icon layer runs, and so no utility class can turn the delete icon
   white on a pale background.
   ============================================================================= */
.actions-cell { gap: .25rem; }
.actions-cell .icon-action-btn,
.question-bank-table .actions-cell .icon-action-btn,
#content:has(#bankTextFilter) .actions-cell .icon-action-btn {
    width: 2.15rem;
    min-width: 2.15rem;
    height: 2.15rem;
    min-height: 2.15rem;
    margin: .1rem 0;
    padding: 0;
    flex: 0 0 auto;
}
.actions-cell .edit-image-question { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.actions-cell .delete-image-question { background: #fee2e2; color: #b91c1c; border: 1px solid #fecdd3; }
.actions-cell .edit-image-question:hover { background: #fde68a; }
.actions-cell .delete-image-question:hover { background: #fecdd3; }
.actions-cell .edit-image-question svg,
.actions-cell .delete-image-question svg { color: inherit; }

/* ===========================================================
   ورشة مراجعة نتائج الطلاب (public/js/review-workspace.js)
   =========================================================== */
.rw-workspace { display: block; }
.rw-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.rw-banner { display: flex; gap: .5rem; align-items: center; margin-bottom: .75rem; padding: .65rem .85rem; border: 1px solid var(--line); border-inline-start: 4px solid var(--teal); border-radius: 9px; background: var(--surface-soft); color: var(--ink); }
.rw-banner-warn { border-inline-start-color: var(--gold); background: #fffbeb; }
.rw-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.rw-card { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-soft); }
.rw-card span { display: block; color: var(--muted); font-size: .8rem; }
.rw-card strong { display: block; font-size: 1.45rem; color: var(--navy); line-height: 1.3; }
.rw-card small { color: var(--muted); }
.rw-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .85rem; border-bottom: 1px solid var(--line); }
.rw-tab { padding: .55rem 1rem; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-soft); color: var(--muted); font-weight: 700; cursor: pointer; }
.rw-tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.rw-note { margin-bottom: .75rem; padding: .65rem .85rem; border: 1px dashed var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: .85rem; }
.rw-subtitle { margin: 1.25rem 0 .6rem; font-weight: 700; color: var(--navy); }
.rw-table th { white-space: nowrap; }
.rw-table td { vertical-align: middle; }
.rw-question-cell { max-width: 420px; }
.rw-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.rw-status { display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.rw-status-ACTIVE, .rw-status-CORRECT { background: #dcfce7; color: #166534; }
.rw-status-SUBMITTED { background: #dbeafe; color: #8b1a1a; }
.rw-status-IN_PROGRESS { background: #fef3c7; color: #92400e; }
.rw-status-NOT_STARTED, .rw-status-EMPTY, .rw-status-OTHER { background: #eadcdc; color: #5b4648; }
.rw-status-WRONG { background: #fee2e2; color: #b42318; }
.rw-status-GRANTED { background: #ede9fe; color: #5b21b6; }
.rw-status-VOIDED { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.rw-thumb { margin-inline-start: .35rem; padding: .1rem .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--teal); font-size: .72rem; font-weight: 700; cursor: pointer; }
.rw-error { color: var(--danger); font-weight: 700; }

/* ورقة إجابة الطالب */
.rw-sheet-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.rw-sheet { padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-soft); }
.rw-sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; padding-bottom: .85rem; margin-bottom: .85rem; border-bottom: 2px solid var(--navy); }
.rw-sheet-head h3 { margin: 0 0 .35rem; font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.rw-sheet-head p { margin: .15rem 0; color: var(--muted); font-size: .85rem; }
.rw-sheet-total { min-width: 190px; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); text-align: center; }
.rw-sheet-total span { display: block; color: var(--muted); font-size: .78rem; }
.rw-sheet-total strong { display: block; font-size: 1.35rem; color: var(--navy); }
.rw-sheet-total em { display: block; font-style: normal; font-weight: 800; }
.rw-sheet-total small { display: block; color: var(--muted); font-size: .72rem; }
.rw-pass { color: #166534; }
.rw-fail { color: var(--danger); }
.rw-sheet-stats { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.rw-sheet-stats span { padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .78rem; color: var(--muted); }
.rw-sheet-stats strong { color: var(--navy); }
.rw-sheet-foot { margin-top: .85rem; padding-top: .55rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; text-align: center; }

/* نافذة إلغاء السؤال */
.rw-modal { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(6,11,22,.7); }
.rw-modal-card { display: flex; flex-direction: column; width: min(900px, 96vw); max-height: 92vh; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 24px 60px rgba(2,6,16,.4); }
.rw-modal-card header { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.rw-modal-card header h3 { margin: 0; font-weight: 800; color: var(--navy); }
.rw-modal-close { width: 2.2rem; height: 2.2rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.rw-modal-body { flex: 1 1 auto; overflow: auto; padding: 1rem; display: grid; gap: .75rem; }
.rw-modal-question { margin: 0; font-weight: 700; color: var(--navy); }
.rw-modal-meta { margin: 0; color: var(--muted); font-size: .82rem; }
.rw-choices { display: grid; gap: .5rem; }
.rw-choice { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.rw-choice:has(input:checked) { border-color: var(--teal); background: #f0fdfa; }
.rw-choice span { display: block; }
.rw-choice strong { display: block; color: var(--navy); }
.rw-choice small { display: block; color: var(--muted); font-size: .78rem; }
.rw-preview { padding: .75rem; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-soft); }
.rw-preview-head { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; font-size: .82rem; color: var(--muted); }
.rw-preview-head strong { color: var(--navy); }
.rw-preview-notes { margin: 0 0 .5rem; padding-inline-start: 1.1rem; color: var(--muted); font-size: .8rem; }
.rw-preview-table { width: 100%; border-collapse: collapse; margin-bottom: .5rem; font-size: .8rem; background: #fff; }
.rw-preview-table th, .rw-preview-table td { padding: .35rem .5rem; border: 1px solid var(--line); text-align: right; }
.rw-preview-table th { background: var(--surface-soft); color: var(--navy); }
.rw-modal-card footer { display: flex; justify-content: flex-start; gap: .5rem; padding: .85rem 1rem; border-top: 1px solid var(--line); background: var(--surface-soft); }

/* الطباعة: زرّا الطباعة في ورشة المراجعة يضيفان rw-printing على <body> ثم يطبعان،
   فيخرج الجدول وحده (ورقة إجابة أو قائمة طلاب) بلا قوائم المنصة ولا أزرار الإجراءات. */
@page { size: A4; margin: 12mm; }
@media print {
    body.rw-printing .dashboard-sidebar,
    body.rw-printing > header,
    /* ui-enhance.js moves the home/menu buttons into their own bar right after the header,
       so hiding the header alone would still leave those two buttons on the paper */
    body.rw-printing .quick-actions-bar,
    body.rw-printing #statsSection,
    body.rw-printing .rw-head-actions,
    body.rw-printing .rw-tabs,
    body.rw-printing .review-workspace-toolbar,
    body.rw-printing .review-workspace-head,
    body.rw-printing .review-filter-toolbar,
    body.rw-printing .rw-cards,
    body.rw-printing .rw-sheet-actions,
    body.rw-printing .rw-modal,
    body.rw-printing .rw-actions,
    body.rw-printing .exam-message,
    body.rw-printing .platform-rights-bar { display: none !important; }
    body.rw-printing #content { box-shadow: none !important; border: 0 !important; padding: 0 !important; }
    body.rw-printing .rw-sheet { border: 0; border-radius: 0; box-shadow: none; padding: 0; }
    body.rw-printing .rw-sheet-table, body.rw-printing .rw-table { min-width: 0; font-size: 11px; }
    body.rw-printing .rw-sheet-table th, body.rw-printing .rw-table th { background: #eadcdc !important; color: #1a0c0f !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body.rw-printing .rw-thumb, body.rw-printing .rw-status { border: 0; }
}

/* ===========================================================
   جدول الطلاب: عمود «تحديد» كان يأخذ مساحة كبيرة فيُهدر مكان الاسم
   =========================================================== */
.student-select-head { display: block; width: 62px; }
td:has(> .student-selection) { width: 62px; }
.student-select-head + *, td:has(> .student-selection) + td { white-space: nowrap; }
/* بطاقة اختبار سلّمه الطالب: لا دخول بعد التسليم */
.exam-locked-note { margin-top: .5rem; padding: .35rem .6rem; border: 1px solid var(--line); border-inline-start: 4px solid var(--teal); border-radius: 8px; background: var(--surface-soft); color: var(--panel-text, #1a0c0f); font-weight: 700; }

/* ===========================================================
   إجراءات المراجعة القديمة (legacy review actions) لم نعد بحاجة إليها:
   التنفيذ يتم الآن فورًا من «مراجعة نتائج الطلاب» مع تنبيه «تم»، ويُطبَّق على نتائج
   الطلاب مباشرة — فلا خطوة اعتماد ولا سجل تدقيق يدوي ولا إعادة تصحيح ولا منح يدوي.
   الإخفاء بـCSS حتى تظل معالجات الأزرار في reports.js سليمة بلا أخطاء.
   =========================================================== */
.review-actions,
#regradeReports,
#approveAllReviews,
#approveReview,
#applyAdjustment,
#reviewAudit,
#reviewTotalForm { display: none !important; }

/* ===========================================================
   student answers must stay black: كانت إجابات الطالب تُورّث لون الهيكل الداكن فتبدو
   شبه شفافة على البطاقة البيضاء. القاعدة التالية تُلزمها بلون أسود معتم بلا شفافية.
   =========================================================== */
.student-review,
.review-question,
.review-question p,
.review-question h3,
.student-answer,
.essay-answer,
.answer-text,
#essayAnswers,
#essayAnswers *,
.essay-card,
.essay-question,
.rw-modal-body,
.rw-modal-body p,
.rw-modal-body span,
.rw-modal-body div,
.rw-modal-body h4,
.rw-modal-body label { color: #1a0c0f !important; opacity: 1 !important; }
.essay-answer { margin: .5rem 0 .9rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 1rem; line-height: 1.9; white-space: normal; }
.essay-meta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.essay-meta strong { color: #1a0c0f; }
.essay-state { padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.essay-state.is-graded { background: #dcfce7; color: #166534; }
.essay-state.is-pending { background: #fef3c7; color: #92400e; }
.essay-question { margin: .75rem 0 .25rem; color: #1a0c0f; font-weight: 700; }
.essay-score { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.essay-score input { width: 8rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; color: #1a0c0f; background: #fff; }
.essay-head-tools { display: flex; align-items: center; gap: .6rem; }
.essay-progress { font-weight: 700; color: var(--navy); }
.essay-hint { flex: 1 1 auto; color: #5b4648; font-size: .8rem; }
.essay-done { display: grid; gap: .35rem; padding: 1rem; color: #1a0c0f; }

/* ===========================================================
   quick-navigation must never print: «المسارات المتاحة لك» وروابط دليل المستخدم
   كانت تُطبع أسفل التقارير — تُخفى في الطباعة دائمًا.
   =========================================================== */
@media print {
    .quick-navigation,
    .user-guide-links { display: none !important; }
}
.rw-sheet-signatures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; margin: 1.2rem 0 .8rem; padding-top: .8rem; border-top: 1px solid var(--line); text-align: center; color: #1a0c0f; }
.review-filter-wrap { display: flex; align-items: center; gap: .5rem; }
.review-filter-wrap input { width: 16rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; color: #1a0c0f; background: #fff; }
.review-filter-count { font-weight: 700; color: var(--navy); }

/* ===========================================================
   report header must span the full width and stay centred: الشعار واسم المنصة ومسمى
   الاختبار في كل تقرير مطبوع يمتدان على عرض الصفحة ويُوسَّطان، وكذلك التواقيع تُرتب
   بالتساوي من الإعدادات.
   =========================================================== */
.report-print-header { display: block !important; width: 100% !important; max-width: 100% !important; text-align: center !important; margin: 0 auto 1.25rem !important; padding-bottom: .9rem; border-bottom: 2px solid var(--navy); }
.report-print-header h2 { display: block; width: 100%; margin: .4rem 0 .6rem; text-align: center; font-size: 1.5rem; font-weight: 800; color: #1a0c0f; }
.report-print-logo { display: block; margin: 0 auto .5rem; max-height: 96px; width: auto; }
.report-print-header p { margin: .2rem 0; text-align: center; color: #1a0c0f; }
.report-signatures { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; width: 100%; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); text-align: center; color: #1a0c0f; }
.report-signatures > div { text-align: center; }
@media print {
    .report-print-header { page-break-inside: avoid; }
    .report-signatures { page-break-inside: avoid; }
}

/* ===========================================================
   print polish: official and tidy reports — أزرار الواجهة (الهوم/القائمة/الإشعارات) لا تُطبع،
   وبلا ظلال ولا زوايا دائرية ولا خلفيات داكنة، والجداول بحدود واضحة وترويسة فاتحة.
   القواعد عامة لأن التقارير تُطبع من الصفحة مباشرة (Ctrl+P) بلا أي صنف خاص.
   =========================================================== */
@media print {
    .quick-actions-bar,
    .header-icon-button,
    #sidebarToggle,
    #homeButton,
    #notificationButton,
    .notification-button,
    .dashboard-sidebar,
    body > header,
    .top-header,
    .nav-actions,
    .quick-navigation,
    .user-guide-links,
    .report-actions,
    .rw-head-actions,
    .review-filter-toolbar {
        display: none !important;
    }
    *, *::before, *::after {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    body, #content, main, .dashboard-shell,
    .report-print-header, .report-signatures,
    table, thead, tbody, tr, td, th,
    .rw-sheet, .student-review, .rw-modal-card, .report-card {
        background: #fff !important;
        color: #1a0c0f !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    #content {
        border: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    th, td {
        border: 1px solid #64748b !important;
        padding: .35rem .5rem !important;
    }
    th {
        background: #eadcdc !important;
        color: #1a0c0f !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .report-print-header {
        border-bottom: 2px solid #1a0c0f !important;
    }
    .report-signatures {
        border-top: 1px solid #64748b !important;
        margin-top: 2rem !important;
    }
    .report-signatures > div {
        border: 0 !important;
    }
    tr, .report-print-header, .report-signatures {
        page-break-inside: avoid;
    }
    thead {
        display: table-header-group;
    }
    @page { size: A4; margin: 12mm; }
}

/* رأس التقرير الذي يظهر في المطبوع فقط (بلا تأثير على الشاشة) */
.rw-print-only { display: none; }
@media print {
    .rw-print-only { display: block !important; }
}
.report-print-header h3 { display: block; width: 100%; margin: .1rem 0 .5rem; text-align: center; font-size: 1.15rem; font-weight: 700; color: #1a0c0f; }

/* ===========================================================
   list print: no actions column — في طباعة قائمة الطلاب لا يُطبع عمود «الإجراءات»
   ولا أزراره، ولا التنبيهات ولا بطاقات الملخص ولا التبويبات ولا شريط التصفية.
   =========================================================== */
@media print {
    .rw-banner,
    .rw-note,
    .exam-message,
    .review-filter-toolbar,
    .rw-cards,
    .rw-tabs,
    .rw-actions,
    .rw-head-actions { display: none !important; }
    /* آخر عمود في جداول القوائم (الإجراءات) — وليس في ورقة إجابة الطالب */
    .rw-table:not(.rw-sheet-table) th:last-child,
    .rw-table:not(.rw-sheet-table) td:last-child { display: none !important; }
}

/* ===========================================================
   sheet header must sit on white: ترويسة ورقة الإجابة داخل البطاقة البيضاء، بخلفية بيضاء
   ونص غامق على الشاشة والطباعة، ومعلومات الطالب تُطبع مع الورقة.
   =========================================================== */
.rw-sheet .report-print-header { background: #fff !important; color: #1a0c0f !important; border-radius: 0; }
.rw-sheet .report-print-header h2,
.rw-sheet .report-print-header h3,
.rw-sheet .report-print-header p { color: #1a0c0f !important; }
@media print {
    .rw-sheet .report-print-header { background: #fff !important; color: #1a0c0f !important; }
    .rw-sheet-head { display: flex !important; background: #fff !important; color: #1a0c0f !important; }
    .rw-sheet-head h3, .rw-sheet-head p, .rw-sheet-total span, .rw-sheet-total strong, .rw-sheet-total small { color: #1a0c0f !important; }
}

/* ===========================================================
   report brand header must always print: ترويسة التقرير (الشعار + اسم المنصة + مسمى
   التقرير) وترويسة ورقة الطالب والتواقيع تُطبع دائمًا. السبب: قواعد إخفاء واجهة المنصة
   كانت تستهدف عنصر <header> نفسه فتُخفي معه ترويسة التقرير؛ الآن الإخفاء محصور في
   body > header (شريط المنصة)، وهذه القواعد تضمن ظهور الترويسة والتواقيع داخل المطبوع.
   =========================================================== */
@media print {
    body.rw-printing #content .report-print-header,
    body.rw-printing #content .rw-sheet-head,
    body.rw-printing #content .rw-print-only,
    body.rw-printing #content .report-signatures,
    body.print-report #content .report-print-header,
    body.print-report #content .rw-sheet-head,
    body.print-report #content .rw-print-only,
    body.print-report #content .report-signatures,
    .platform-report-page .report-document-header {
        display: block !important;
        visibility: visible !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    body.rw-printing #content .report-signatures,
    body.print-report #content .report-signatures {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 2.5rem !important;
        text-align: center !important;
        color: #1a0c0f !important;
    }
    body.rw-printing #content .rw-sheet-head,
    body.print-report #content .rw-sheet-head { display: flex !important; }
    /* نص الورقة المطبوعة غامق دائمًا على الخلفية البيضاء — لا نص باهت على الورق */
    body.rw-printing #content .rw-sheet,
    body.print-report #content .rw-sheet,
    body.rw-printing #content .report-print-header,
    body.print-report #content .report-print-header { color: #1a0c0f !important; opacity: 1 !important; }
    body.rw-printing #content .rw-table td,
    body.rw-printing #content .rw-table th,
    body.print-report #content .rw-table td,
    body.print-report #content .rw-table th { color: #1a0c0f !important; opacity: 1 !important; }
    /* تقرير كشف طلاب الدورة: بلا عمود إجراءات وبلا أزرار ونماذج إدخال على الورق */
    body.print-report .actions-cell,
    body.print-report .actions-head,
    body.print-report .no-print { display: none !important; }
}

/* ===========================================================
   بطاقة نتيجة الاختبار: كبيرة، متكيّفة مع حجم الشاشة، تُظهر درجة الاختبار ودرجة النجاح،
   ولونها حسب الدرجة (أحمر أقل من النجاح، برتقالي من النجاح، أخضر من ٨٠)، مع تأثير احتفالي
   من ٨٠ وأعلى. لا تعتمد على أي ملف خارجي فتعمل على الشبكة الداخلية بلا إنترنت.
   =========================================================== */
.result-modal { position: fixed; inset: 0; z-index: 1400; display: grid; place-items: center; padding: clamp(.75rem, 3vw, 2rem); background: rgba(26, 12, 15,.62); }
.result-modal-card { position: relative; overflow: hidden; width: min(620px, 100%); border-radius: 22px; padding: clamp(1.25rem, 4vw, 2.5rem); text-align: center; border: 1px solid rgba(26, 12, 15,.08); box-shadow: 0 24px 60px rgba(26, 12, 15,.28); }
.result-card-body { position: relative; z-index: 2; display: grid; gap: clamp(.5rem, 1.5vw, 1rem); justify-items: center; }
.result-modal-card h2 { margin: 0; font-size: clamp(1.05rem, 2.4vw, 1.5rem); color: inherit; }
.result-modal-score { font-size: clamp(3.2rem, 11vw, 6.5rem); font-weight: 900; line-height: 1.02; letter-spacing: -.02em; }
.result-verdict { margin: 0; font-size: clamp(1.4rem, 4vw, 2.4rem); font-weight: 800; }
.result-modal-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(.75rem, 3vw, 2rem); font-size: clamp(.95rem, 2.2vw, 1.2rem); }
.result-message { margin: 0; font-size: clamp(.9rem, 2vw, 1.05rem); opacity: .9; }
.result-badge { display: inline-block; padding: .35rem 1rem; border-radius: 999px; background: #16a34a; color: #fff; font-weight: 800; font-size: clamp(.85rem, 2vw, 1rem); }
.result-modal-close { margin-top: clamp(.5rem, 2vw, 1rem); min-width: 10rem; }

.result-modal-card.score-green { background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 100%); color: #14532d; }
.result-modal-card.score-orange { background: linear-gradient(160deg, #fff7ed 0%, #ffedd5 100%); color: #7c2d12; }
.result-modal-card.score-red { background: linear-gradient(160deg, #fef2f2 0%, #fee2e2 100%); color: #7f1d1d; }

.result-celebration { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.result-celebration span { position: absolute; top: -12%; width: .5rem; height: .9rem; border-radius: 2px; opacity: .75; animation-name: result-fall; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes result-fall { 0% { transform: translateY(-20%) rotate(0deg); } 100% { transform: translateY(620%) rotate(420deg); } }
.result-modal-card.is-excellent .result-modal-score { animation: result-pop .75s cubic-bezier(.22,1.2,.36,1) both; }
@keyframes result-pop { 0% { transform: scale(.55); opacity: 0; } 65% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .result-celebration { display: none; }
    .result-modal-card.is-excellent .result-modal-score { animation: none; }
}
@media print { .result-modal { position: static; background: none; } .result-celebration { display: none; } }


/* ============================================================================
   توزيع عناصر السؤال (باتفاق صاحب المنصة):
   النص أعلاه، وتحته الخيارات يمينًا والصورة المصغّرة يسارًا، وكل الأزرار ظاهرة
   بلا تمرير إلى أسفل الصفحة، مع الانتقال التلقائي عند الإجابة والرجوع للسابق.
   ============================================================================ */
.question-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto; /* يمين: الخيارات · يسار: الصورة */
    gap: 1rem;
    align-items: start;
}
.question-aside { width: min(220px, 32vw); }
.question-aside .question-image-button { display: block; width: 100%; }
.question-aside .question-image { max-height: 168px; width: 100%; object-fit: contain; border-radius: 12px; background: #fff; }
.question-body { display: flex; flex-direction: column; gap: .45rem; max-height: calc(100vh - 320px); overflow-y: auto; }
.exam-question.current .question-body .exam-option { padding: .5rem .7rem; }
.exam-option.is-chosen { border-color: var(--primary-strong); background: rgba(161, 30, 42, .08); }
.exam-navigation { position: sticky; bottom: 0; background: var(--panel-bg, #fff); padding-top: .6rem; }
@media (max-width: 720px) {
    .question-layout { grid-template-columns: minmax(0, 1fr); } /* على الجوال: الصورة تحت الخيارات */
    .question-aside { width: 100%; order: 2; }
    .question-body { max-height: none; }
}


/* توحيد أسماء أصناف السؤال بين صفحة الطالب (question-main/question-media) وصفحة التجربة
   (question-body/question-aside): نفس التوزيع في كل مكان — الخيارات يمينًا والصورة المصغّرة يسارًا. */
.question-main { min-width: 0; }
.question-media { width: min(220px, 32vw); }
.question-media .question-image-button { display: block; width: 100%; margin: 0; }
.question-media .question-image { max-height: 168px; width: 100%; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.question-media small { display: block; margin-top: .35rem; color: var(--muted); }
.exam-question.current .question-main .exam-option { padding: .5rem .7rem; }
@media (max-width: 720px) {
    .question-media { width: 100%; order: 2; }
}

/* ============================================================================
   تثبيت الجهات + إبقاء كل العناصر داخل الشاشة (إصلاح بعد قياس فعلي على المنصة):
   الخيارات يمينًا والصورة المصغّرة يسارًا دائمًا (لا يتبع اتجاه العنصر الأب)،
   وارتفاعا الصورة وقائمة الخيارات يتقلّصان على الشاشات القصيرة فلا يحتاج المستخدم
   إلى تمرير للوصول إلى أزرار التنقل.
   ============================================================================ */
.question-layout { direction: rtl; }
.question-media, .question-aside { align-self: start; }
@media (max-height: 760px) {
    .question-aside .question-image, .question-media .question-image { max-height: 120px; }
    .question-body { max-height: calc(100vh - 330px); }
}
@media (max-height: 620px) {
    .question-aside .question-image, .question-media .question-image { max-height: 92px; }
    .question-body { max-height: calc(100vh - 300px); }
}


/* flex layout — final override */
/* الخيارات يمينًا والصورة المصغّرة يسارًا — flex صريح لا يتأثر باتجاه العنصر الأب */
.question-aside, .question-media {
    position: static !important;
    float: none !important;
    display: block !important;
}

.question-aside .question-image-button, .question-media .question-image-button, .question-image-button {
    position: static !important;
    float: none !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.question-layout {
    display: flex !important;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    direction: rtl;
}

/* قائمة الخيارات: العنصر الأول ⇒ اليمين، وهي الوحيدة التي تُمرَّر داخليًا */
.question-layout .question-body, .question-layout .question-main {
    flex: 1 1 auto;
    min-width: 0;
    max-height: calc(100vh - 330px);
    overflow-y: auto;
}

.question-layout .question-aside, .question-layout .question-media {
    flex: 0 0 220px;
    max-width: 32vw;
    align-self: flex-start;
}

.question-layout .question-aside .question-image, .question-layout .question-media .question-image {
    max-height: 150px;
    width: 100%;
    object-fit: contain;
    background: #fff;
    border-radius: 12px;
}

@media (max-height: 620px) {
    .question-layout .question-aside .question-image, .question-layout .question-media .question-image { max-height: 96px; }
    .question-layout .question-body, .question-layout .question-main { max-height: calc(100vh - 300px); }
}

@media (max-width: 720px) {
    .question-layout { flex-direction: column; }
    .question-layout .question-aside, .question-layout .question-media { flex: 0 0 auto; width: 100%; max-width: 100%; }
}


/* vertical fit — acceptance */
/* ضبط الارتفاع: قياس فعلي اظهر تجاوز 75px على نافذة 551px (scrollHeight 626 · navBottom 566).
   تُقلَّص قائمة الخيارات فقط (وهي الوحيدة التي تُمرَّر) فيبقى شريط التنقل داخل الشاشة. */
@media (max-height: 700px) {
    .question-layout .question-body, .question-layout .question-main { max-height: calc(100vh - 380px); }
}
@media (max-height: 620px) {
    .question-layout .question-body, .question-layout .question-main { max-height: calc(100vh - 410px); }
    .exam-question.current { margin-bottom: .25rem; }
}
.exam-navigation { margin-top: .25rem; }


/* إخفاء عناصر لا يملكها الدور: زر تصحيح الأسئلة المقالية للمشرف والطالب (الصلاحية للأدمن والمعلم فقط) */
html.role-student #rwEssays { display: none !important; } /* الطالب لا يصحّح مقاله */

/* page-height fit — final */
/* على صفحات الاختبار فقط: اجعل حد الارتفاع ١٠٠vh يشمل الحشوة السفلية حتى لا يزيد المستند
   عن الشاشة بـ١٤px (وهو ما كان يجعل تمرير الصفحة مطلوبًا رغم ظهور كل الأزرار). */
body:has(.question-layout) {
    box-sizing: border-box;
    min-height: 100vh;
    padding-bottom: 22px;
}
body:has(.question-layout) .platform-rights-bar {
    margin-top: 0;
}

/* ============================================================================
   نافذة اختيار أسئلة البنك داخل منشئ الاختبار: بحث على الخادم + ترقيم صفحات
   (كانت تجلب البنك كاملًا ≈ ٥٫٤ ميجابايت لكل فتح).
   ============================================================================ */
.bank-pager { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.bank-page-info { font-size: .9rem; color: var(--muted); }
.bank-selected-note { margin: .35rem 0; font-size: .9rem; color: var(--primary-strong); font-weight: 600; }
.bank-picker-modal input[type="search"] { width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.bank-question-list { max-height: min(52vh, 420px); overflow-y: auto; }


/* نافذة درجات المشاركة (٩٠ للأسئلة + ١٠ للمشاركة) */
.participation-modal-card { width: min(880px, 96vw); background: #fff; border-radius: 14px; padding: 1rem 1.1rem; box-shadow: 0 18px 45px rgba(26, 12, 15, .35); }
.participation-state { padding: .25rem .6rem; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.participation-state.is-on { background: #dcfce7; color: #166534; }
.participation-state.is-off { background: #eadcdc; color: #4a3a3c; }
.participation-score { width: 6rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.participation-modal-card table thead th { background: #f1f5f9; color: #1a0c0f; }
.participation-modal-card tbody tr:nth-child(even) { background: #f8fafc; }


/* exam navigation — واضحة */
.exam-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    position: sticky;
    bottom: 0;
    z-index: 30;
    background: #fff;
    padding: .6rem .5rem;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 14px rgba(26, 12, 15, .06);
}
.exam-nav {
    min-width: 11rem;
    padding: .85rem 1.4rem;
    font-size: 1.02rem;
    font-weight: 800;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.exam-nav.secondary { background: #fff; color: #1a0c0f; border-color: #b09a9c; }
.exam-nav.secondary:hover:not(:disabled) { background: #f1f5f9; }
.exam-nav.primary { background: #0E8C9B; color: #fff; border-color: #8b1a1a; box-shadow: 0 8px 18px rgba(13, 148, 136, .28); }
.exam-nav.primary:hover:not(:disabled) { background: #8b1a1a; transform: translateY(-1px); }
.exam-nav.submit { background: #16a34a; color: #fff; border-color: #0F7A5A; box-shadow: 0 8px 18px rgba(22, 163, 74, .3); }
.exam-nav.submit:hover { background: #0F7A5A; transform: translateY(-1px); }
.exam-nav:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.exam-nav:focus-visible { outline: 3px solid rgba(13, 148, 136, .45); outline-offset: 2px; }
@media (max-width: 640px) { .exam-nav { min-width: 0; flex: 1; padding: .8rem .6rem; font-size: .95rem; } }

/* ===== theme.css ===== */
/*!
 * 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; }
}

/* ===== palettes.css ===== */
/* Exam Codifica Hub — 12 ready palettes. Only the dark chrome changes:
   page background, header, footer, borders, accent. White panels/tables keep dark ink. */

:root {
  --header-from: #3f0d14;
  --header-to: #140508;
}

/* barmejli — هوية Codifica Hub (السماويّ على الحبر) */
html[data-palette="barmejli"] {
  --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, .12);
  --on-accent: #ffffff;
  --header-from: #FFFFFF; --header-to: #F1F6F9;
}

/* blood — قرمزي دموي */
html[data-palette="blood"] {
  --bg: #140508;
  --bg-elevated: #24080c;
  --surface: #2e0a0f;
  --surface-2: #370c12;
  --surface-3: #430e15;
  --navy: #28090e;
  --border: #4f1018;
  --border-strong: #6f1621;
  --text: #fdf2f3;
  --text-muted: #f3bbc2;
  --text-dim: #ed99a3;
  --primary: #d92b3f;
  --primary-strong: #a92231;
  --primary-soft: rgba(217, 43, 63, .18);
  --on-accent: #0d0305;
  --header-from: #3f0d14;
  --header-to: #140508;
}

/* midnight — أزرق ليلي */
html[data-palette="midnight"] {
  --bg: #070f22;
  --bg-elevated: #0d1931;
  --surface: #101e3a;
  --surface-2: #142443;
  --surface-3: #182c4e;
  --navy: #0e1b34;
  --border: #1d3359;
  --border-strong: #284676;
  --text: #f4f8fd;
  --text-muted: #c7d8f3;
  --text-dim: #abc5ec;
  --primary: #4f86d8;
  --primary-strong: #3e69a8;
  --primary-soft: rgba(79, 134, 216, .18);
  --on-accent: #050a16;
  --header-from: #17294a;
  --header-to: #070f22;
}

/* ocean — أزرق محيطي */
html[data-palette="ocean"] {
  --bg: #04161f;
  --bg-elevated: #07212e;
  --surface: #092837;
  --surface-2: #0b2f40;
  --surface-3: #0d374b;
  --navy: #082431;
  --border: #103f56;
  --border-strong: #165573;
  --text: #f2f9fd;
  --text-muted: #bbe0f2;
  --text-dim: #99d1eb;
  --primary: #2b9fd6;
  --primary-strong: #227ca7;
  --primary-soft: rgba(43, 159, 214, .18);
  --on-accent: #030e14;
  --header-from: #0d3447;
  --header-to: #04161f;
}

/* teal — أزرق مخضر */
html[data-palette="teal"] {
  --bg: #04191b;
  --bg-elevated: #062527;
  --surface: #062d2f;
  --surface-2: #073536;
  --surface-3: #093e3f;
  --navy: #06282a;
  --border: #0a4749;
  --border-strong: #0d6061;
  --text: #f1fafa;
  --text-muted: #b5e7e7;
  --text-dim: #90dbdb;
  --primary: #17b3b3;
  --primary-strong: #128c8c;
  --primary-soft: rgba(23, 179, 179, .18);
  --on-accent: #031012;
  --header-from: #083b3c;
  --header-to: #04191b;
}

/* emerald — أخضر زمردي */
html[data-palette="emerald"] {
  --bg: #051810;
  --bg-elevated: #072418;
  --surface: #092c1e;
  --surface-2: #0a3423;
  --surface-3: #0c3d29;
  --navy: #08281a;
  --border: #0e462f;
  --border-strong: #125f40;
  --text: #f2faf7;
  --text-muted: #b8e7d4;
  --text-dim: #95dbbe;
  --primary: #22b378;
  --primary-strong: #1b8c5e;
  --primary-soft: rgba(34, 179, 120, .18);
  --on-accent: #03100a;
  --header-from: #0b3a27;
  --header-to: #051810;
}

/* forest — أخضر غابات */
html[data-palette="forest"] {
  --bg: #0c1807;
  --bg-elevated: #14240c;
  --surface: #182c0f;
  --surface-2: #1d3312;
  --surface-3: #233c15;
  --navy: #16270d;
  --border: #294519;
  --border-strong: #385d22;
  --text: #f6faf4;
  --text-muted: #d0e5c3;
  --text-dim: #b8d8a4;
  --primary: #6cae42;
  --primary-strong: #548833;
  --primary-soft: rgba(108, 174, 66, .18);
  --on-accent: #081005;
  --header-from: #213914;
  --header-to: #0c1807;
}

/* amber — عنبري ذهبي */
html[data-palette="amber"] {
  --bg: #1d1505;
  --bg-elevated: #2d2008;
  --surface: #36270a;
  --surface-2: #402e0c;
  --surface-3: #4c360f;
  --navy: #302309;
  --border: #583f11;
  --border-strong: #775518;
  --text: #fdf9f2;
  --text-muted: #f5e1bc;
  --text-dim: #f0d19b;
  --primary: #e0a02e;
  --primary-strong: #af7d24;
  --primary-soft: rgba(224, 160, 46, .18);
  --on-accent: #130e03;
  --header-from: #48340e;
  --header-to: #1d1505;
}

/* copper — نحاسي */
html[data-palette="copper"] {
  --bg: #1d1007;
  --bg-elevated: #2b180b;
  --surface: #341c0d;
  --surface-2: #3c2110;
  --surface-3: #472713;
  --navy: #2e1a0c;
  --border: #522d16;
  --border-strong: #6e3c1e;
  --text: #fcf6f3;
  --text-muted: #efd1bf;
  --text-dim: #e7ba9f;
  --primary: #cc7038;
  --primary-strong: #9f572c;
  --primary-soft: rgba(204, 112, 56, .18);
  --on-accent: #130a05;
  --header-from: #442512;
  --header-to: #1d1007;
}

/* rose — وردي عميق */
html[data-palette="rose"] {
  --bg: #1d0913;
  --bg-elevated: #2d0f1c;
  --surface: #361321;
  --surface-2: #401626;
  --surface-3: #4c1b2d;
  --navy: #30101e;
  --border: #581f33;
  --border-strong: #772b45;
  --text: #fdf5f7;
  --text-muted: #f5c8d6;
  --text-dim: #f0acc2;
  --primary: #e0537f;
  --primary-strong: #af4163;
  --primary-soft: rgba(224, 83, 127, .18);
  --on-accent: #13060c;
  --header-from: #48192b;
  --header-to: #1d0913;
}

/* plum — عنابي */
html[data-palette="plum"] {
  --bg: #180919;
  --bg-elevated: #240c1f;
  --surface: #2c0e24;
  --surface-2: #341028;
  --surface-3: #3d122c;
  --navy: #280d21;
  --border: #461431;
  --border-strong: #5f1a3e;
  --text: #faf2f6;
  --text-muted: #e7bccf;
  --text-dim: #db9bb7;
  --primary: #b32e6a;
  --primary-strong: #8c2453;
  --primary-soft: rgba(179, 46, 106, .18);
  --on-accent: #100610;
  --header-from: #3a112b;
  --header-to: #180919;
}

/* royal — بنفسجي ملكي */
html[data-palette="royal"] {
  --bg: #100a25;
  --bg-elevated: #1b1236;
  --surface: #221740;
  --surface-2: #281c4b;
  --surface-3: #302258;
  --navy: #1e143a;
  --border: #382964;
  --border-strong: #4e3986;
  --text: #f9f6ff;
  --text-muted: #ded1fd;
  --text-dim: #cdbafc;
  --primary: #9770f8;
  --primary-strong: #7657c1;
  --primary-soft: rgba(151, 112, 248, .18);
  --on-accent: #0a0618;
  --header-from: #2e2053;
  --header-to: #100a25;
}

/* graphite — جرافيت فحمي */
html[data-palette="graphite"] {
  --bg: #131518;
  --bg-elevated: #1d2024;
  --surface: #23262b;
  --surface-2: #292d32;
  --surface-3: #30353b;
  --navy: #1f2226;
  --border: #373d43;
  --border-strong: #4a525a;
  --text: #f8f9fa;
  --text-muted: #dadfe3;
  --text-dim: #c7cfd5;
  --primary: #8b9aa8;
  --primary-strong: #6c7883;
  --primary-soft: rgba(139, 154, 168, .18);
  --on-accent: #0c0e10;
  --header-from: #2d3238;
  --header-to: #131518;
}

/* palette picker swatches */
.palette-picker { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.75rem; }
.palette-chip { width:46px; height:46px; border-radius:12px; cursor:pointer; border:2px solid #e6d9d9; display:grid; place-items:center; transition: transform .12s ease, box-shadow .12s ease; }
.palette-chip:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.18); }
.palette-chip[aria-pressed="true"] { border-color:#1a0c0f; box-shadow: 0 0 0 3px rgba(0,0,0,.12); }

/* ===== mobile.css ===== */
/* ============================================================================
   Exam Codifica Hub - the phone layer.

   Loaded LAST on every page, so these rules land after theme.css and can answer
   it. Everything here is either a phone-only correction or a reservation of
   space that the fixed bars were never given, which is why they sit on top of
   the footer on a small screen.

   Three real causes are addressed, not guessed:
     1. 100vh on a phone is the height of the viewport WITH the browser bars
        hidden, so a min-height:100vh page is taller than what is on screen and
        its last rows end up underneath the fixed bottom bar. dvh is the height
        that is actually visible.
     2. A fixed bar paints over the content unless the content reserves room
        for it - including the home indicator strip on a modern iPhone, which
        is what env(safe-area-inset-bottom) measures.
     3. A phone turned sideways has very little height and plenty of width, so
        the same paddings and the same stacked header waste half of it.
   ========================================================================= */

/* ------------------------------------------------------------- 1 · dynamic height */
.min-h-screen { min-height: 100dvh !important; }
html { height: -webkit-fill-available; }

/* --------------------------------------------------- 2 · room for the fixed bars */
:root {
  --pt-bottombar: 62px;
  --pt-topbar: 56px;
  --pt-safe-b: env(safe-area-inset-bottom, 0px);
  --pt-safe-t: env(safe-area-inset-top, 0px);
  --pt-safe-l: env(safe-area-inset-left, 0px);
  --pt-safe-r: env(safe-area-inset-right, 0px);
}

/* pages that carry the rights bar / footer reserve its height plus the danger
   strip; the pages that opt out with data-no-rights-bar say so themselves */
body { padding-bottom: calc(var(--pt-bottombar) + var(--pt-safe-b)) !important; }
body[data-no-rights-bar="1"] { padding-bottom: var(--pt-safe-b) !important; }

/* the fixed bars themselves never sit inside the danger strip */
.platform-rights-bar,
.platform-footer,
body > footer,
footer.platform-footer {
  padding-bottom: calc(6px + var(--pt-safe-b)) !important;
  padding-left: max(10px, var(--pt-safe-l));
  padding-right: max(10px, var(--pt-safe-r));
}

/* the sticky top bar gets the notch strip, and the page starts below it */
.exam-header,
.sticky-actions,
header.exam-header {
  padding-top: calc(var(--pt-safe-t) + 6px) !important;
  padding-left: max(12px, var(--pt-safe-l));
  padding-right: max(12px, var(--pt-safe-r));
}

/* a last child that would otherwise hide behind the bar */
main > *:last-child,
.container > *:last-child { scroll-margin-bottom: 90px; }

/* ------------------------------------------------------------ 3 · the phone itself */
@media (max-width: 820px) {
  /* iOS zooms the whole page when a field smaller than 16px takes focus */
  input, select, textarea { font-size: 16px !important; }

  /* a table that does not fit scrolls sideways instead of pushing the layout */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  table thead, table tbody { display: table; width: 100%; }

  main, .container, .wrap { padding-left: max(12px, var(--pt-safe-l)) !important;
                            padding-right: max(12px, var(--pt-safe-r)) !important; }

  /* tap targets a thumb can actually hit */
  button, .btn, a.btn, [role="button"] { min-height: 44px; }
  .icon-only-btn { min-width: 44px; min-height: 44px; }

  /* the exam window: the question is the page, everything else steps back */
  #exam .question, .exam-question { font-size: 1.06rem; line-height: 1.9; }
  .exam-modal-overlay, .modal-overlay, .overlay { padding: 0 !important; align-items: flex-end !important; }
  .exam-modal, .modal { max-height: 92dvh; overflow-y: auto; border-radius: 14px 14px 0 0; width: 100%; }
}

/* ------------------------------------------------------------ 4 · held sideways */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --pt-bottombar: 46px; --pt-topbar: 44px; }

  .exam-header, .sticky-actions, header.exam-header {
    padding-top: max(4px, var(--pt-safe-t)) !important;
    padding-bottom: 4px !important;
    font-size: .92rem;
  }
  .exam-header-status { gap: .5rem !important; }

  main, .container, .wrap { padding-top: .6rem !important; padding-bottom: .6rem !important; }

  /* side by side is the whole point of this orientation */
  .grid, .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr 1fr !important; }
  .exam-modal, .modal { max-height: 96dvh; border-radius: 10px; }

  h1 { font-size: 1.25rem !important; }
  h2 { font-size: 1.05rem !important; }
  .mb-8 { margin-bottom: .9rem !important; }
  .p-8 { padding: .9rem !important; }
}

/* ------------------------------------------------------------ 5 · full screen button */
.pt-fs-btn {
  position: fixed;
  z-index: 2147483000;                 /* above the app's own overlays */
  /* __FS_SIDE__ ⚠ كان على inset-inline-START وهي اليمين في العربية — وهو الموضع
     الذي تقف فيه القائمة الجانبية (right: 0 · z-index: 900). و z-index الزرّ أكبر
     بمراتب، فهو **يرسم فوق القائمة** ويغطّي طرف صفٍّ فيها (قيست المساحة ٣٣×٣٣ بكسل).
     فصار على اليسار حيث زرّ الوضع أصلًا، **ومرفوعًا فوقه** فلا يتزاحمان — وهما
     اللذان قيل في تعليق سابق إنهما «قيسا فوق بعضهما». */
  inset-inline-start: auto;
  inset-inline-end: max(10px, var(--pt-safe-l));
  bottom: calc(var(--pt-bottombar) + var(--pt-safe-b) + 10px);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 40px;
  padding: 0 .7rem;
  border: 1px solid rgba(201, 162, 74, .55);
  border-radius: 999px;
  background: rgba(20, 8, 11, .82);
  color: #F6EFE2;
  font: 600 .78rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
  opacity: .92;
}
/* حلقة التركيز هنا كانت غير مرئية: --pt-safe-l قيمة طول (env(safe-area-inset-left))،
   واستعمالها لونًا يجعل التصريح باطلًا عند الحساب، والاحتياطي لا يُفعَّل عند فساد
   القيمة بل عند غيابها. ويُسقط التصريحُ الفائز تصريحَ outline العام معه. */
.pt-fs-btn:hover { opacity: 1; }
.pt-fs-btn:focus-visible { opacity: 1; outline: 2px solid var(--primary, #c8283a); outline-offset: 2px; }
.pt-fs-btn svg { width: 16px; height: 16px; }
.pt-fs-btn .lbl { white-space: nowrap; }

/* while the window is genuinely full screen there is no bar to clear.
   __FS_STACK__ ⚠ **ولا يُنسى الرفع هنا أيضًا**: القاعدة العامة رُفعت ٦٦ بكسل،
   وهذه القاعدة الخاصة **تغلبها** — فقيس الزرّ في ملء الشاشة عند ١١.٦٧ بكسل
   وتراكب مع زرّ الوضع. **ورفعُ قيمة في القاعدة العامة لا يكفي إذا كان للعنصر
   حالة خاصة تغلبها.** فيُثبَّت الترتيب في كل الحالات. */
:fullscreen .pt-fs-btn, :-webkit-full-screen .pt-fs-btn { bottom: calc(10px + var(--pt-safe-b)); }

/* a phone held sideways has no room for the label */
@media (orientation: landscape) and (max-height: 540px) {
  .pt-fs-btn .lbl { display: none; }
  .pt-fs-btn { bottom: calc(var(--pt-bottombar) + var(--pt-safe-b) + 6px); }
}

@media print { .pt-fs-btn { display: none !important; } }

/* ============================================================================
   شريط الحقوق على الجوال — عطلان مقيسان، لا مُفترَضان
   ============================================================================
   قِيس على ٣٧٥ بكسل داخل outcomes.html:

     barRect.h = 54   bodyPadBottom = 36   ⟶ نقص ١٨ بكسل من المحتوى المحجوب
     overlaps  = platform-rights-text ~ codifica-brand → 98×13 بكسل
     brandPosition = absolute

   ▸ الأوّل: «Exam Codifica Hub» مُعرَّف في theme.css بـ`position: absolute; left: 50%` متمركزًا
     فوق الشريط كله. وعلى الشاشات العريضة لا يضرّ: نصّ الحقوق يُحاذى يمينًا وسطر الشكر
     يسارًا، والوسط فارغ. أمّا قاعدة الجوال في offline.css فتُوسّط النصّين — فيمتدّ النصّ
     تحت العلامة المتمركزة ويتقاطعان. فتُخرج العلامة من الطيّ إلى صفّها الأوّل.
   ▸ والثاني: الشريط مثبَّت أسفل الشاشة، والمحجوز للجسم ٢٫٢٥rem = ٣٦ بكسل، وارتفاعه عند
     الجوال ٥٤ بكسل — فتختفي آخر ١٨ بكسل من المحتوى تحته بلا أثر ظاهر.

   وكلاهما شاشة الجوال وحدها، فالتعديل محصور في مدى ≤ ٦٤٠ بكسل ولا يمسّ سطح المكتب.

   ⚠ ودقّة في القياس لازمة هنا: مستطيل **العنصر** يتراكب على سطح المكتب أيضًا (٤١×١٣ مقيسة،
   لأن نصّ الحقوق يأخذ نصف الشريط ونصّ الشكر نصفه، فيغطّي الوسط وهما فارغاه في المحاذاة).
   والذي يجب قياسه مستطيل **النصّ** لا العنصر — يُقاس بـRange على عقدة النصّ. وبذلك:
       سطح المكتب: تراكب النصّ ‎(none)‎ — والوسط فارغ فعلًا، والعلامة تتمركز فيه.
       الجوال:      تراكب العنصر ٩٨×١٣ والنصّ متمركز تحته — وهو التراكب المرئي فعلًا.
   فلو حُكم بالمستطيل وحده لَعُدّ سطح المكتب معطوبًا وهو سليم، أو لَعُدّ الجوال سليمًا وهو معطوب.
   ============================================================================ */
@media (max-width: 640px) {
  /* ⚠ قِيس بعد أوّل محاولة: إخراج العلامة إلى صفّها أزال التراكب **لكنه** رفع الشريط
     من ٥٤ إلى ٧٢ بكسل، فبقي نقص ٨ بكسل في المساحة المحجوزة — أي أن علاج العطل الأوّل
     أنتج عطلًا ثانيًا. والقياس هو ما أظهر ذلك، لا النظر.
     وعلى ٣٧٥ بكسل لا يوجد مجال للعلامة: نصّ الحقوق متمركز بعرض الشريط كله، وسطر الشكر
     تحته، فلا مكان لجانب. وإبقاؤها يعني صفًّا ثالثًا يأكل ١٨ بكسل من ارتفاع الشاشة.
     والاسم غير مفقود عند إخفائها: سطر الحقوق نفسه يبدأ بـ«© Exam Codifica Hub».
     فتُخفى هنا وتبقى في سطح المكتب كعلامة زخرفية متمركزة. */
  .codifica-brand { display: none !important; }
  /* ٤rem = ٦٤ بكسل مقابل شريط من صفّين ارتفاعه ٥٤ ⟶ ١٠ بكسل هامش للأمان */
  body.has-rights-bar { padding-bottom: 4rem !important; }
}


/* ── أهداف اللمس على الجوّال ──────────────────────────────────────────────
   WCAG 2.5.8 (AA) يطلب ٢٤×٢٤ بكسل CSS. ولم يُغيَّر صندوق أي عنصر ولا تخطيطه:
   توسيع **منطقة الإصابة** بطبقة شفّافة فوقه — فلا يتزحزح شيء، ولا يتقاطع هدفان.
   (وأزرار القشرة الأيقونية لم تُوسَّع عمدًا: المسافة المقيسة بينها ٤ بكسل، فأي
   توسيع يتقاطع فيسرق اللاحقُ لمسةَ السابق — وذلك أسوأ من هدف صغير.) */
.credit-wa, .back-link, .guide-narration summary, label[for="rememberUsername"] { position: relative; }
.credit-wa::after { content: ''; position: absolute; inset: -3px; }
.back-link::after, label[for="rememberUsername"]::after {
    content: ''; position: absolute; inset: -1px;
}
/* أمّا summary فتوسيعه بطبقة زائفة لا يكفي: العنصر التالي يُرسم فوقه في ترتيب
   الرسم فتقع النقرة على التالي لا على العنوان (قِيس: نجح عند 375 وسقط عند 360
   في صفحتين). فيُوسَّع صندوقه نفسه — ارتفاعه 22 والمطلوب 24. */
.guide-narration summary { min-height: 24px; }

/* ===== ui-kit.css ===== */
/* Exam Codifica Hub — عدّة الواجهة المشتركة: حالات السحب، ومقابض التحريك، وحلقات التركيز.
   ملف منفصل كما exam-window.css و exam-lock.css: إضافات على الواجهة وحدها، فلا تُلمس
   theme.css العام ولا يخاطر أي شيء آخر في المنصة.

   الألوان من رموز --panel-* لا من رموز الصفحة: عناصر القوائم تعيش على لوحات بيضاء
   بنصّ داكن في الوضعين، ورمز الصفحة (--text) يعطي أبيض على أبيض في الوضع النهاري. */

/* ---------- مخفي بصريًا وظاهر لقارئ الشاشة ---------- */
.ui-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- حاوية قابلة لإعادة الترتيب ---------- */
.ui-sortable { position: relative; }

/* ---------- مقبض التحريك: ثلاث نقاط، ويظهر عند المرور أو التركيز ---------- */
.ui-grip {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 22px;
    height: 30px;
    padding: 0 6px;
    margin-inline-end: 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: grab;
    opacity: .45;
    transition: opacity .12s ease, background .12s ease;
    touch-action: none;   /* شرط عمل السحب باللمس: لا تمرير للصفحة أثناء التحريك */
    flex: none;
}
.ui-grip span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--panel-text-dim, #8a7678);
}
.ui-sortable [role="listitem"]:hover .ui-grip,
.ui-sortable [role="listitem"]:focus-within .ui-grip { opacity: 1; background: var(--panel-soft-2, #f7f0f0); }
.ui-grip:active { cursor: grabbing; }

/* مقبض محرّر الأسئلة القائم (⠿): نضيف له سلوك المسكّة لا شكله، فلا يتغيّر المنظر. */
.qed-handle {
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    padding-inline: 4px;
}
.qed-handle:active { cursor: grabbing; }

/* ---------- حالة الالتقاط (لوحة المفاتيح أو بداية السحب) ---------- */
.ui-sortable [role="listitem"].ui-grabbed {
    outline: 3px solid var(--primary, #d92b3f);
    outline-offset: 2px;
    border-radius: 10px;
    background: var(--panel-soft, #faf6f6);
}

/* ---------- حالة السحب الفعلي ---------- */
.ui-sortable [role="listitem"].ui-dragging {
    opacity: .92;
    box-shadow: 0 14px 34px rgba(2, 8, 20, .28);
    border-radius: 10px;
    z-index: 5;
    position: relative;
}

/* ---------- حلقة التركيز: لا يبقى عنصر بلا أثر مرئي للمفاتيح ---------- */
/* :focus-visible لا :focus — وإلا ظهرت الحلقة عند كل نقرة فأرة أيضًا */
.ui-sortable [role="listitem"]:focus-visible,
.ui-editable:focus-visible,
.ui-grip:focus-visible {
    outline: 3px solid var(--primary, #d92b3f);
    outline-offset: 2px;
}

/* ---------- تحرير في مكانه ---------- */
.ui-editable {
    border-radius: 8px;
    cursor: text;
    transition: background .12s ease, box-shadow .12s ease;
}
.ui-editable:hover { background: var(--panel-soft, #faf6f6); box-shadow: inset 0 0 0 1px var(--panel-border, #eddede); }
.ui-editable.ui-editing {
    background: var(--panel-bg, #ffffff);
    box-shadow: inset 0 0 0 2px var(--primary, #d92b3f);
    outline: none;
    padding-inline: 6px;
}

/* ---------- حقل التحرير المُقايَض (للأزرار التي لا تقبل contenteditable) ---------- */
.ui-inline-input {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.5;
    color: var(--panel-text, #1a0c0f);
    background: var(--panel-bg, #ffffff);
    border: 2px solid var(--primary, #d92b3f);
    border-radius: 8px;
    padding: 6px 10px;
    max-width: 100%;
    text-align: start;
    direction: rtl;
}
.ui-inline-input:focus-visible { outline: 3px solid var(--primary, #d92b3f); outline-offset: 1px; }

/* العنصر أثناء التحرير لا يجب أن يبدو زرًّا قابلًا للنقر */
.ui-editable.ui-editing {
    cursor: text;
    background: var(--panel-bg, #ffffff);
    box-shadow: inset 0 0 0 2px var(--primary, #d92b3f);
    border-radius: 8px;
}
.ui-editable.ui-editing::after { content: none; }

/* ---------- الخطّاف: تلميح صغير يشرح ما لا يُرى ---------- */
.ui-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--panel-text-muted, #6b5a5c);
}
.ui-hint kbd {
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
    border: 1px solid var(--panel-border, #eddede);
    background: var(--panel-soft-2, #f7f0f0);
    color: var(--panel-text, #1a0c0f);
}

/* ---------- رابط تجاوز إلى المحتوى ---------- */
/* مخفيّ حتى يُبلَغ بـTab، وحينها يظهر فوق كل شيء. لا يزحم البصر ولا يُحذف. */
.ui-skip-link {
    position: fixed;
    top: 8px;
    inset-inline-start: 50%;
    transform: translateX(50%) translateY(-200%);
    z-index: 1000000;
    padding: 10px 18px;
    border-radius: 0 0 10px 10px;
    background: var(--primary, #d92b3f);
    color: var(--on-accent, #0d0305);
    font-weight: 700;
    text-decoration: none;
    transition: transform .15s ease;
}
.ui-skip-link:focus-visible,
.ui-skip-link:focus {
    transform: translateX(50%) translateY(0);
    outline: 3px solid var(--panel-text, #1a0c0f);
    outline-offset: 2px;
}

/* ---------- لوحة التنقّل الموحّدة (Ctrl+K) ---------- */
/* فوق الصفحة كطبقة المنع، وتحت تنبيه المراقبة الرسمي (1000000). */
.ui-cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 900000;
    background: rgba(26, 12, 15, .62);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    overflow-y: auto;
}

.ui-cmd-panel {
    width: 100%;
    max-width: 620px;
    background: var(--panel-bg);
    color: var(--panel-text);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 20px 60px rgba(2, 8, 20, .45);
}

.ui-cmd-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--panel-text);
    background: var(--panel-soft, #faf6f6);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
}
.ui-cmd-input:focus-visible { outline: 3px solid var(--primary, #d92b3f); outline-offset: 1px; }
.ui-cmd-input::placeholder { color: var(--panel-text-dim, #8a7678); }

.ui-cmd-list {
    list-style: none;
    margin: 10px 0 6px;
    padding: 0;
    max-height: 46vh;
    overflow-y: auto;
}

.ui-cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 9px;
    cursor: pointer;
    color: var(--panel-text);
}
/* المؤشّر على العنصر النشط، لا لون واحد لكل العناصر */
.ui-cmd-item.is-active {
    background: var(--primary, #d92b3f);
    color: var(--on-accent, #0d0305);
}
.ui-cmd-item.is-active .ui-cmd-group { color: var(--on-accent, #0d0305); opacity: .85; }

.ui-cmd-label { font-weight: 600; }
.ui-cmd-group { font-size: 12.5px; color: var(--panel-text-muted, #6b5a5c); }
.ui-cmd-empty { padding: 14px 12px; color: var(--panel-text-muted, #6b5a5c); text-align: center; }

/* زرّ الفتح في الترويسة: يظهر النصّ على الشاشات الواسعة ويبقى الرمز وحده على الجوال */
.ui-cmd-trigger { display: inline-flex; align-items: center; gap: 6px; }
.ui-cmd-trigger-text { font-size: 13px; }

@media (max-width: 640px) {
    .ui-cmd-overlay { padding: 8vh 10px 10px; }
    .ui-cmd-trigger-text { display: none; }
}

@media (max-width: 640px) {
    /* حدّ اللمس المريح 44px على الجوال */
    .ui-grip { width: 30px; height: 44px; opacity: .7; }
    .ui-sortable [role="listitem"] { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .ui-grip, .ui-editable { transition: none; }
}


/* ---------- شارة تغطية المخرجات في مكتبة الاختبارات ---------- */
/* قراءة الحال من لونها وحدها لا تكفي: النصّ نفسه يقول «غير مقيس» — واللون يسرّع المسح. */
.ui-coverage {
    display: inline-block;
    margin-inline-start: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.7;
    vertical-align: middle;
    border: 1px solid var(--panel-border, #e5e0e0);
    color: var(--panel-text-muted, #6b5b5b);
    background: var(--panel-soft, #faf7f7);
}
.ui-coverage.is-ready { border-color: #1e7d4f; color: #165c39; background: #e9f6ef; }
.ui-coverage.is-unmeasured { border-color: #a8641e; color: #7d4610; background: #fdf3e6; }
.ui-coverage.is-partial { border-color: #a8641e; color: #6b4a12; background: #fdf7ec; }
.ui-coverage.is-empty { opacity: .8; }

/* ===== identity.css ===== */
/* Codifica Hub — Identity Layer v1 · تُحمَّل أخيرًا فتغلب */
html{background:radial-gradient(ellipse at 50% -10%,#0A1730 0%,#03060F 60%,#000 100%) fixed;color-scheme:dark}
:root{--id-accent:#00e5ff;--id-accent-2:#7c4dff;--id-accent-ink:#02161c;
--id-ink:#E6F7FF;--id-ink-2:#9FB6C4;--id-line:rgba(230,247,255,.12);
--id-ga:rgba(0,229,255,.17);--id-gb:rgba(124,77,255,.12);--id-gc:rgba(45,125,255,.10)}
html[data-platform="hub"]{--id-accent:#00e5ff;--id-accent-2:#7c4dff;--id-accent-ink:#02161c;--id-ga:rgba(0,229,255,.17);--id-gb:rgba(124,77,255,.12);--id-gc:rgba(45,125,255,.10)}
html[data-platform="exam"]{--id-accent:#c9a24a;--id-accent-2:#e8c979;--id-accent-ink:#1a1305;--id-ga:rgba(201,162,74,.19);--id-gb:rgba(232,201,121,.10);--id-gc:rgba(201,162,74,.09)}
html[data-platform="drill"]{--id-accent:#7c4dff;--id-accent-2:#a68bff;--id-accent-ink:#0b0620;--id-ga:rgba(124,77,255,.20);--id-gb:rgba(166,139,255,.11);--id-gc:rgba(124,77,255,.10)}
html[data-platform="app"]{--id-accent:#2d7dff;--id-accent-2:#00e5ff;--id-accent-ink:#03101f;--id-ga:rgba(45,125,255,.22);--id-gb:rgba(0,229,255,.13);--id-gc:rgba(45,125,255,.12)}
#id-bg{position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden}
#id-bg i{position:absolute;display:block;border-radius:50%;filter:blur(70px)}
#id-bg i:nth-child(1){width:54vmax;height:54vmax;left:-12vmax;top:-16vmax;background:radial-gradient(circle,var(--id-ga),transparent 66%);animation:idA 26s ease-in-out infinite alternate}
#id-bg i:nth-child(2){width:46vmax;height:46vmax;right:-10vmax;top:2vmax;background:radial-gradient(circle,var(--id-gb),transparent 68%);animation:idB 33s ease-in-out infinite alternate}
#id-bg i:nth-child(3){width:42vmax;height:42vmax;left:24vmax;bottom:-18vmax;background:radial-gradient(circle,var(--id-gc),transparent 70%);animation:idC 39s ease-in-out infinite alternate}
@keyframes idA{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(6vw,4vh,0) scale(1.16)}}
@keyframes idB{from{transform:translate3d(0,0,0) scale(1.08)}to{transform:translate3d(-5vw,5vh,0) scale(1)}}
@keyframes idC{from{transform:translate3d(0,0,0) scale(1.12)}to{transform:translate3d(-6vw,-5vh,0) scale(1)}}
@media (prefers-reduced-motion:reduce){#id-bg i{animation:none}}
#id-bg i:nth-child(4){display:none}
html[data-platform="app"] #id-bg i:nth-child(4){display:block;left:50%;top:-26vmax;width:78vmax;height:78vmax;margin-left:-39vmax;background:radial-gradient(circle,rgba(45,125,255,.30),rgba(0,229,255,.10) 46%,transparent 72%);filter:blur(90px);animation:idHalo 18s ease-in-out infinite alternate}
@keyframes idHalo{from{opacity:.72;transform:scale(1)}to{opacity:1;transform:scale(1.12)}}
#id-occ{display:none}
html[data-occasion] #id-occ{display:flex;position:relative;z-index:80;align-items:center;justify-content:center;gap:10px;padding:9px 16px;font:600 13.5px/1.45 system-ui,-apple-system,"Segoe UI",Tahoma,Arial,sans-serif;color:#fff;text-align:center;overflow:hidden;background:linear-gradient(100deg,var(--id-occ-a,#0b7285),var(--id-occ-b,#0a4b7a));box-shadow:0 8px 26px rgba(0,0,0,.4)}
html[data-occasion] #id-occ::before{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent,rgba(255,255,255,.22),transparent);transform:translateX(-100%);animation:idShim 3.6s ease-in-out infinite}
@keyframes idShim{0%{transform:translateX(-100%)}55%,100%{transform:translateX(100%)}}
#id-occ b{font-weight:800}#id-occ span{opacity:.94}
html[dir="rtl"] #id-occ{direction:rtl}
.id-chip{display:inline-flex;align-items:center;gap:5px;margin-inline-start:9px;padding:3px 9px;border-radius:999px;font:700 11px/1 system-ui,-apple-system,"Segoe UI",Tahoma,Arial,sans-serif;letter-spacing:.03em;color:var(--id-accent);background:color-mix(in srgb,var(--id-accent) 15%,transparent);border:1px solid color-mix(in srgb,var(--id-accent) 40%,transparent);vertical-align:middle;white-space:nowrap}
.id-chip i{font-style:normal;font-family:ui-monospace,Menlo,Consolas,monospace;direction:ltr;unicode-bidi:isolate}
.id-mark{display:inline-block;font-family:ui-monospace,Menlo,Consolas,monospace;font-weight:700;color:var(--id-accent);text-shadow:0 0 12px color-mix(in srgb,var(--id-accent) 60%,transparent);direction:ltr;unicode-bidi:isolate}
html[data-platform="exam"]{--primary:var(--id-accent);--primary-strong:color-mix(in srgb,var(--id-accent) 84%,#000);--primary-soft:color-mix(in srgb,var(--id-accent) 16%,transparent);--primary-border:color-mix(in srgb,var(--id-accent) 46%,transparent);--primary-hover:color-mix(in srgb,var(--id-accent) 24%,transparent)}
html[data-platform="drill"],html[data-platform="app"]{--accent:var(--id-accent);--accent-hover:color-mix(in srgb,var(--id-accent) 80%,#fff);--accent-line:color-mix(in srgb,var(--id-accent) 42%,transparent)}
html[data-platform="hub"]{--pt-brand:var(--id-accent);--pt-brand-line:color-mix(in srgb,var(--id-accent) 40%,transparent);--pt-brand-soft:color-mix(in srgb,var(--id-accent) 14%,transparent)}

/* ═══ v1.1: الخلفيّةُ على العنصر نفسه — يحلّ تغطية عناصر الصفحة للطبقة الخلفيّة ═══ */
@keyframes idDrift{
  0%{background-position:0% 0%,100% 18%,48% 100%,50% 0%}
  100%{background-position:7% 7%,93% 26%,42% 92%,50% 0%}
}
html[data-platform]{color-scheme:dark}
body{
  background-color:#03060F!important;
  background-image:
    radial-gradient(52vmax 52vmax at 12% 6%, var(--id-ga), transparent 66%),
    radial-gradient(46vmax 46vmax at 88% 20%, var(--id-gb), transparent 68%),
    radial-gradient(44vmax 44vmax at 44% 98%, var(--id-gc), transparent 70%),
    radial-gradient(ellipse at 50% -10%, #0A1730 0%, #03060F 60%, #000 100%)!important;
  background-repeat:no-repeat!important;
  background-attachment:fixed!important;
  animation:idDrift 28s ease-in-out infinite alternate;
}
html[data-platform="app"] body{
  background-image:
    radial-gradient(74vmax 48vmax at 50% -14%, rgba(45,125,255,.34), rgba(0,229,255,.10) 46%, transparent 72%),
    radial-gradient(52vmax 52vmax at 12% 6%, var(--id-ga), transparent 66%),
    radial-gradient(46vmax 46vmax at 88% 20%, var(--id-gb), transparent 68%),
    radial-gradient(ellipse at 50% -10%, #0A1730 0%, #03060F 60%, #000 100%)!important;
}
@media (prefers-reduced-motion:reduce){body{animation:none}}
.id-chip--fixed{position:fixed;bottom:14px;inset-inline-start:14px;z-index:70;opacity:.85}

/* ═══════════════════════════════════════════════════════════════════════════
   v1.2 · هيدر Codifica Hub الموحَّد — **نفس حبّة التعريفيّة العائمة**
   (top:16px · radius:999px · blur(14px) · ارتفاع ٦٢px · عرض ١١٨٠px)
   ═══════════════════════════════════════════════════════════════════════════ */
.ch-hdr{position:fixed;inset-inline:0;top:16px;z-index:95;padding-inline:16px;pointer-events:none}
.ch-hdr__in{position:relative;pointer-events:auto;max-width:1180px;margin-inline:auto;min-height:62px;
  display:flex;align-items:center;gap:14px;padding:8px 10px 8px 14px;border-radius:999px;
  border:1px solid var(--id-line);
  background:linear-gradient(180deg,rgba(10,17,27,.86),rgba(6,10,18,.72));
  -webkit-backdrop-filter:blur(14px) saturate(140%);backdrop-filter:blur(14px) saturate(140%);
  box-shadow:0 20px 50px -34px rgba(0,0,0,.9),0 0 0 1px color-mix(in srgb,var(--id-accent) 7%,transparent) inset}
.ch-brand{display:flex;align-items:center;gap:9px;flex:none;text-decoration:none}
.ch-brand__mk{width:30px;height:30px;fill:none;stroke:var(--id-accent);stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round;
  filter:drop-shadow(0 0 10px color-mix(in srgb,var(--id-accent) 55%,transparent))}
.ch-brand__nm{font-weight:700;font-size:16px;letter-spacing:.01em;color:var(--id-ink);white-space:nowrap}
.ch-nav{display:flex;align-items:center;gap:2px;margin-inline-start:10px}
.ch-nav a{padding:9px 13px;border-radius:999px;font-size:14.5px;font-weight:500;color:var(--id-ink-2);
  text-decoration:none;white-space:nowrap;transition:color .2s,background-color .2s}
.ch-nav a:hover,.ch-nav a:focus-visible{color:var(--id-ink);background:color-mix(in srgb,var(--id-accent) 10%,transparent)}
.ch-end{display:flex;align-items:center;gap:8px;margin-inline-start:auto;flex:none}
.ch-lang{width:38px;height:38px;border-radius:999px;display:grid;place-items:center;
  border:1px solid var(--id-line);background:rgba(255,255,255,.03);color:var(--id-ink-2);
  font-size:12.5px;font-weight:700;text-decoration:none}
.ch-lang:hover{color:var(--id-accent);border-color:color-mix(in srgb,var(--id-accent) 45%,transparent)}
.ch-cta{display:inline-flex;align-items:center;min-height:42px;padding:0 18px;border-radius:999px;
  font-size:14px;font-weight:700;white-space:nowrap;text-decoration:none;
  color:var(--id-accent-ink);background:linear-gradient(135deg,var(--id-accent),var(--id-accent-2));
  box-shadow:0 10px 26px -14px color-mix(in srgb,var(--id-accent) 70%,transparent)}
.ch-burger{display:none;width:42px;height:42px;border-radius:999px;border:1px solid var(--id-line);
  background:rgba(255,255,255,.03);cursor:pointer;position:relative;flex:none}
.ch-burger span{position:absolute;inset-inline:11px;height:2px;background:var(--id-ink-2);border-radius:2px;transition:transform .2s,top .2s}
.ch-burger span:nth-child(1){top:16px}
.ch-burger span:nth-child(2){top:23px}
.ch-burger[aria-expanded="true"] span:nth-child(1){top:20px;transform:rotate(45deg)}
.ch-burger[aria-expanded="true"] span:nth-child(2){top:20px;transform:rotate(-45deg)}
.ch-sp{height:96px}
@media (max-width:980px){
  .ch-nav{display:none}
  .ch-nav.is-open{display:flex;position:absolute;inset-inline:0;top:calc(100% + 10px);
    flex-direction:column;align-items:stretch;gap:4px;margin:0;padding:10px;border-radius:20px;
    border:1px solid var(--id-line);background:linear-gradient(180deg,rgba(10,17,27,.97),rgba(6,10,18,.95));
    backdrop-filter:blur(14px);box-shadow:0 24px 60px -30px #000}
  .ch-nav.is-open a{padding:12px 14px;border-radius:14px}
  .ch-burger{display:block}
  .ch-cta{display:none}
}
@media (max-width:620px){.ch-brand__nm{font-size:15px}.ch-hdr{top:10px;padding-inline:10px}.ch-sp{height:88px}}

/* ═══ v1.2 · لوحة التحكّم: طابعُ الهوية الداكن (كانت فاتحةً بألوانٍ قديمة) ═══ */
body[data-tab]{
  --bg:#04070c;--panel:rgba(9,17,27,.82);--panel-2:rgba(12,22,34,.72);
  --line:rgba(230,247,255,.14);--line-2:rgba(230,247,255,.24);
  --ink:#EAF7FD;--ink-2:#D6E9F2;--muted:#9FB6C4;
  --maroon:var(--id-accent);--maroon-2:color-mix(in srgb,var(--id-accent) 82%,#000);
  --gold:#C9A24A;--gold-soft:rgba(201,162,74,.18);
  --ok:#39D98A;--ok-bg:rgba(57,217,138,.12);
  --warn:#E8B52F;--warn-bg:rgba(232,181,47,.12);
  --danger:#FF6B7A;--danger-bg:rgba(255,107,122,.12);
  --info:#4DB8FF;--info-bg:rgba(77,184,255,.12);
  --shadow:0 24px 60px -34px rgba(0,0,0,.85);
}
body[data-tab] .panel,body[data-tab] .gate{background:var(--panel);border-color:var(--line);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
body[data-tab] input,body[data-tab] select,body[data-tab] textarea{
  background:rgba(2,6,12,.74);border-color:var(--line-2);color:var(--ink)}
body[data-tab] .tab{background:rgba(255,255,255,.04);border-color:var(--line);color:var(--ink-2)}
body[data-tab] .tab[aria-selected="true"]{background:color-mix(in srgb,var(--id-accent) 18%,transparent);
  border-color:color-mix(in srgb,var(--id-accent) 50%,transparent);color:var(--id-ink)}
body[data-tab] .mono{color:var(--id-ink-2)}
body[data-tab] a{color:var(--id-accent)}
body[data-tab] .btn{background:rgba(255,255,255,.05);border-color:var(--line);color:var(--ink)}
body[data-tab] .btn-p{background:linear-gradient(135deg,var(--id-accent),var(--id-accent-2));
  border-color:transparent;color:var(--id-accent-ink);font-weight:700}

/* ═══ v1.2 · لونُ منصّة التدريب: **زمرديّ** (بدل البنفسجيّ — أعيد النظر فيه) ═══ */
html[data-platform="drill"]{
  --id-accent:#16c79a;--id-accent-2:#8ef0cf;--id-accent-ink:#04231b;
  --id-ga:rgba(22,199,154,.20);--id-gb:rgba(142,240,207,.11);--id-gc:rgba(22,199,154,.10);
}

/* ═══ v1.3 · إصلاحاتٌ من التحقّق البصريّ ═══ */
/* الحبّةُ تُصفَّر حشوتها: قاعدةٌ قديمة `header{padding:64px…}` في المتجر كانت تُزيحها */
.ch-hdr{padding:0 16px}
.ch-sp{display:none}
/* الفاصلُ لا ينفع حين يكون `body` مُرتَّبًا مرونةً ⇒ الحشوةُ على body */
body:has(> .ch-hdr),body.ch-has-hdr{padding-top:96px}
@media (max-width:620px){
  .ch-hdr{padding:0 10px}
  body:has(> .ch-hdr),body.ch-has-hdr{padding-top:88px}
}

/* ═══ v1.3 · لوحةُ التحكّم: طابعٌ داكنٌ لا يعتمد على المتغيّرات وحدها ═══ */
body[data-tab]{
  background-color:#03060F!important;
  background-image:
    radial-gradient(52vmax 52vmax at 12% 6%, var(--id-ga), transparent 66%),
    radial-gradient(46vmax 46vmax at 88% 20%, var(--id-gb), transparent 68%),
    radial-gradient(44vmax 44vmax at 44% 98%, var(--id-gc), transparent 70%),
    radial-gradient(ellipse at 50% -10%, #0A1730 0%, #03060F 60%, #000 100%)!important;
  background-repeat:no-repeat!important;
  background-attachment:fixed!important;
}

/* ═══ v1.4 · الشريطُ مثبّتٌ في القمّة فوق الهيدر، والهيدرُ ينزل بقدر ارتفاعه ═══ */
#id-occ{display:none}
html[data-occasion] #id-occ{
  display:flex;position:fixed;inset-inline:0;top:0;z-index:120;
  align-items:center;justify-content:center;gap:10px;padding:9px 16px;
  font:600 13.5px/1.45 system-ui,-apple-system,"Segoe UI",Tahoma,Arial,sans-serif;
  color:#fff;text-align:center;overflow:hidden;
  background:linear-gradient(100deg,var(--id-occ-a,#0b7285),var(--id-occ-b,#0a4b7a));
  box-shadow:0 8px 26px rgba(0,0,0,.45)}
html[data-occasion] .ch-hdr{top:calc(16px + var(--id-occ-h,38px))}
html[data-bm][data-occasion]:root .v2-hdr{top:calc(16px + var(--id-occ-h,38px))}
html[data-occasion] body:has(> .ch-hdr),
html[data-occasion] body.ch-has-hdr{padding-top:calc(96px + var(--id-occ-h,38px))}
@media (max-width:620px){
  html[data-occasion] .ch-hdr{top:calc(10px + var(--id-occ-h,38px))}
  html[data-occasion] body:has(> .ch-hdr),
  html[data-occasion] body.ch-has-hdr{padding-top:calc(88px + var(--id-occ-h,38px))}
}

/* ═══ v1.5 · الشريط في القمّة دائمًا، وكلُّ ما هو ثابت ينزل بقدره ═══ */
html[data-occasion] #id-occ{z-index:2147483000}
html[data-occasion] body{padding-top:var(--id-occ-h,38px)}
html[data-occasion] body:has(> .ch-hdr),
html[data-occasion] body.ch-has-hdr{padding-top:calc(96px + var(--id-occ-h,38px))}
html[data-occasion] #toasts{top:calc(14px + var(--id-occ-h,38px))}
html[data-occasion] .ch-hdr{top:calc(16px + var(--id-occ-h,38px))}
@media (max-width:620px){
  html[data-occasion] .ch-hdr{top:calc(10px + var(--id-occ-h,38px))}
  html[data-occasion] body:has(> .ch-hdr),
  html[data-occasion] body.ch-has-hdr{padding-top:calc(88px + var(--id-occ-h,38px))}
}

/* ═══ v1.5 · قائمةُ المنصّة: أعمدةٌ تتوالد بعدد الأقسام (٢ · ٣ · ٤ أو أكثر) ═══ */
.ch-menu{display:none}
.ch-hdr__in .ch-menu.is-open{display:grid}
.ch-menu.is-open{
  position:absolute;inset-inline:0;top:calc(100% + 10px);
  grid-template-columns:repeat(auto-fit,minmax(186px,1fr));gap:16px;padding:16px;
  border-radius:22px;border:1px solid var(--id-line);
  background:linear-gradient(180deg,rgba(10,17,27,.98),rgba(6,10,18,.96));
  -webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);
  box-shadow:0 32px 70px -34px #000;max-height:min(72vh,580px);overflow:auto;z-index:130}
.ch-menu__c{min-width:0}
.ch-menu__c h4{margin:0 0 8px;padding-bottom:8px;border-bottom:1px solid var(--id-line);
  font:700 11.5px/1 system-ui,-apple-system,"Segoe UI",Tahoma,Arial,sans-serif;
  letter-spacing:.05em;color:var(--id-accent)}
.ch-menu__c a{display:block;padding:8px 10px;border-radius:10px;font-size:14px;
  color:var(--id-ink-2);text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-menu__c a:hover,.ch-menu__c a:focus-visible{color:var(--id-ink);background:color-mix(in srgb,var(--id-accent) 12%,transparent)}
.ch-menu__note{grid-column:1/-1;margin:0;font-size:12.5px;color:var(--id-ink-2);opacity:.85}

/* ═══ v1.7 · بحث القائمة وتمييز الصفحة الحالية ═══
   القائمة تحمل 25+ قسمًا؛ البحث يحوّلها من تمرير إلى كتابة كلمة.
   والتمييز يمنع سؤال «أين أنا؟» الذي يتكرر مع كل تنقّل. */
.ch-menu__search{grid-column:1/-1;margin:0 0 2px}
.ch-menu__search input{
  width:100%;box-sizing:border-box;padding:10px 12px;border-radius:12px;
  border:1px solid var(--id-line);background:rgba(255,255,255,.07);
  color:var(--id-ink);font:inherit;font-size:14px}
.ch-menu__search input::placeholder{color:var(--id-ink-2);opacity:.72}
.ch-menu__search input:focus{outline:2px solid var(--id-accent);outline-offset:1px}
.ch-menu__search input::-webkit-search-cancel-button{cursor:pointer}
.ch-menu__c a.is-active{
  color:var(--id-ink);font-weight:700;
  background:color-mix(in srgb,var(--id-accent) 20%,transparent);
  box-shadow:inset 3px 0 0 var(--id-accent)}
.ch-menu__empty{grid-column:1/-1;margin:6px 0 0;padding:12px;
  text-align:center;font-size:13px;color:var(--id-ink-2)}
.ch-burger{display:inline-block}
.ch-menu-btn{width:42px;height:42px;border-radius:999px;border:1px solid var(--id-line);
  background:rgba(255,255,255,.03);cursor:pointer;position:relative;flex:none;display:inline-block}
.ch-menu-btn span{position:absolute;inset-inline:11px;height:2px;background:var(--id-ink-2);border-radius:2px;transition:transform .2s,top .2s}
.ch-menu-btn span:nth-child(1){top:16px}
.ch-menu-btn span:nth-child(2){top:23px}
.ch-menu-btn[aria-expanded="true"] span:nth-child(1){top:20px;transform:rotate(45deg)}
.ch-menu-btn[aria-expanded="true"] span:nth-child(2){top:20px;transform:rotate(-45deg)}

/* ═══ v1.6 · مضيفُ قائمة الأعمدة ═══ */
.ch-menu-host{position:relative;display:inline-flex;align-items:center;flex:none}
.ch-hdr__in .ch-menu{inset-inline:0}
.ch-menu-host .ch-menu{inset-inline:auto;inset-inline-end:0;min-width:min(860px,92vw)}

/* ═══ v1.7 · فوتر الحقوق: سطرٌ واحد صغير جدًّا ═══ */
html[data-platform="exam"] .platform-rights-bar,
html[data-platform="exam"] .login-rights{
  display:flex !important;align-items:center !important;justify-content:center !important;
  gap:.5rem !important;flex-wrap:wrap !important;
  padding:.26rem .7rem !important;min-height:0 !important;
  line-height:1.1 !important;font-size:10.5px !important}
html[data-platform="exam"] .platform-rights-bar > *,
html[data-platform="exam"] .login-rights > *{
  margin:0 !important;padding:0 !important;display:inline !important;line-height:1.1 !important}
html[data-platform="exam"] .platform-rights-text,
html[data-platform="exam"] .platform-credit-text,
html[data-platform="exam"] .login-rights-text{
  font-size:10.5px !important;line-height:1.1 !important;display:inline !important}
html[data-platform="exam"] .platform-rights-bar p,
html[data-platform="exam"] .platform-rights-bar p a{
  font-size:10.5px !important;line-height:1.1 !important;margin:0 !important;display:inline !important}
/* الاسمُ التجاريّ كان يُخرَج من التدفّق ويُثبَّت في الوسط ⇒ يصير عنصرًا في السطر */
html[data-platform="exam"] .codifica-brand{
  position:static !important;transform:none !important;left:auto !important;right:auto !important;
  font-size:10.5px !important;letter-spacing:.05em !important;line-height:1.1 !important;opacity:.9}
html[data-platform="exam"] .platform-credit-text svg{
  width:11px !important;height:11px !important;vertical-align:-1.5px !important}
html[data-platform="exam"] body.has-rights-bar{padding-bottom:1.35rem !important}
html[data-platform="exam"] .exam-action-bar{bottom:var(--exam-bar-bottom,0px) !important}
@media (max-width:620px){
  html[data-platform="exam"] .platform-rights-bar,
  html[data-platform="exam"] .login-rights{gap:.3rem !important;padding:.22rem .5rem !important;font-size:10px !important}
  html[data-platform="exam"] .platform-rights-text,
  html[data-platform="exam"] .platform-credit-text,
  html[data-platform="exam"] .login-rights-text,
  html[data-platform="exam"] .codifica-brand{font-size:10px !important}
  html[data-platform="exam"] body.has-rights-bar{padding-bottom:1.25rem !important}
}

/* ═══ v1.8 · فرضُ سطرٍ واحد: بلا التفاف + فواصلُ ضيّقة + منعُ كسر النصّ ═══ */
html[data-platform="exam"] .platform-rights-bar,
html[data-platform="exam"] .login-rights{
  flex-wrap:nowrap !important;gap:.35rem !important;
  padding:.2rem .6rem !important;overflow:hidden !important}
html[data-platform="exam"] .platform-rights-bar > *,
html[data-platform="exam"] .login-rights > *{white-space:nowrap !important;flex:0 0 auto !important}
html[data-platform="exam"] .platform-rights-bar p{margin-inline-start:.35rem !important}
html[data-platform="exam"] .platform-rights-bar p::before{content:"· "}
@media (max-width:900px){
  html[data-platform="exam"] .platform-credit-text{display:none !important}
}
@media (max-width:620px){
  html[data-platform="exam"] .codifica-brand{display:none !important}
  html[data-platform="exam"] .platform-rights-bar,
  html[data-platform="exam"] .login-rights{font-size:10px !important}
}

/* ═══ v1.9 · إصلاحاتُ تحجيمٍ وتضاربٍ مقيسة ═══ */

/* (أ) حقلُ اللون: كان ينفرد إلى عرض العمود كلّه (٣٧٧×٤٨) فيبدو شريطًا */
body[data-tab] input[type="color"]{
  width:100% !important;max-width:78px !important;height:40px !important;
  padding:2px !important;border-radius:10px !important;
  background:rgba(2,6,12,.74) !important;border:1px solid rgba(230,247,255,.22) !important}
body[data-tab] input[type="color"]::-webkit-color-swatch-wrapper{padding:0}
body[data-tab] input[type="color"]::-webkit-color-swatch{border:1px solid rgba(230,247,255,.28);border-radius:8px}

/* (ب) الشريحةُ الثابتة (حين لا هيدر) لا تعلو شريطَ الحقوق الثابت */
body.has-rights-bar .id-chip--fixed{bottom:3rem !important}

/* (ج) شريطُ المناسبات في الجوال: سطرٌ واحد بلا اصطدام */
@media (max-width:620px){
  html[data-occasion] #id-occ{padding:7px 10px !important;font-size:11.5px !important;gap:6px !important;line-height:1.2 !important}
  html[data-occasion] #id-occ > span:last-of-type{display:none !important}
  html[data-occasion] #id-occ > *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:88vw}
}

/* (د) منصّة التدريب: عنوانٌ كان بلونٍ داكن على خلفيّةٍ داكنة (تبايُن ١.١٥) وبقايا ثيمٍ فاتح */
html[data-platform="drill"] h1,
html[data-platform="drill"] h2,
html[data-platform="drill"] h3,
html[data-platform="drill"] .h1,
html[data-platform="drill"] .hero h1,
html[data-platform="drill"] .hero-title{color:var(--id-ink) !important}
html[data-platform="drill"] p,html[data-platform="drill"] li{color:var(--id-ink-2)}
html[data-platform="drill"] .kick,
html[data-platform="drill"] .eyebrow,
html[data-platform="drill"] .tag{
  color:var(--id-accent) !important;background:transparent !important;border-color:color-mix(in srgb,var(--id-accent) 40%,transparent) !important}
html[data-platform="drill"] .lede,html[data-platform="drill"] .sub{color:var(--id-ink-2) !important}
html[data-platform="drill"] .btn,html[data-platform="drill"] a.btn,html[data-platform="drill"] button.btn{
  color:var(--id-accent-ink) !important}
html[data-platform="drill"] .btn--ghost,html[data-platform="drill"] a.btn--ghost{
  color:var(--id-ink) !important;background:transparent !important;border:1px solid color-mix(in srgb,var(--id-accent) 45%,transparent) !important}
/* وبطاقاتُ الثيم الفاتح المتبقّية */
html[data-platform="drill"] .card,html[data-platform="drill"] .panel{
  background:rgba(9,17,27,.78) !important;border-color:var(--id-line) !important}

/* ═══ v1.10 · إتمامُ الإصلاحات الجزئيّة ═══ */
html[data-platform="drill"] .ghost,
html[data-platform="drill"] a.ghost,
html[data-platform="drill"] button.ghost,
html[data-platform="drill"] .btn.ghost,
html[data-platform="drill"] .btn--ghost,
html[data-platform="drill"] a.btn.secondary{
  color:var(--id-ink) !important;background:transparent !important;
  border:1px solid color-mix(in srgb,var(--id-ink) 42%,transparent) !important}
html[data-platform="drill"] .ghost:hover,
html[data-platform="drill"] .btn.ghost:hover{
  background:color-mix(in srgb,var(--id-ink) 12%,transparent) !important}

body[data-tab] input[type="color"]{
  min-height:0 !important;max-height:42px !important;height:42px !important;
  align-self:center !important;box-sizing:border-box !important}

html[data-occasion] button.has-ui-tooltip,
html[data-occasion] .lang-switch,
html[data-occasion] #langToggle{
  top:calc(var(--id-occ-h,28px) + 12px) !important}

/* ═══ v1.11 · إصلاحان محكمان ═══ */
/* (١) زرّ اللغة: صنفُه فارغ ويُعرَّف بـdata-pt-lang-btn **بنمطٍ سطريّ**
       ⇒ و`!important` في ورقة المؤلّف **يتغلّب على السطريّ العاديّ** */
html[data-occasion] button[data-pt-lang-btn]{
  top:calc(var(--id-occ-h,28px) + 14px) !important}
@media (max-width:620px){
  html[data-occasion] button[data-pt-lang-btn]{
    top:calc(var(--id-occ-h,26px) + 10px) !important;font-size:12px !important}
}
/* (٢) ارتداد: قاعدةُ `.ghost` العموميّة أفسدت زرًّا في قسمٍ **فاتح** (تبايُن ١.٠٣)
       ⇒ **تُقصَر على الحاوية الداكنة**، ويُعاد للفاتح نصُّه الداكن */
html[data-platform="drill"] .hero .ghost,
html[data-platform="drill"] .hero a.ghost,
html[data-platform="drill"] .hero .btn.ghost,
html[data-platform="drill"] section.hero .ghost{color:var(--id-ink) !important}
/* وأيّ .ghost خارج الهيرو يأخذ نصًّا داكنًا على أيّ خلفيّةٍ فاتحة */
html[data-platform="drill"] .band .ghost,
html[data-platform="drill"] .band .btn.ghost,
html[data-platform="drill"] section.band .ghost{color:#0E1A20 !important;border-color:rgba(14,26,32,.35) !important}

/* ═══ v1.12 · زرُّ الشبح: رقاقةٌ داكنة تحكم القسمين (داكن/فاتح) ═══ */
html[data-platform="drill"] .hero .ghost,
html[data-platform="drill"] .hero .btn.ghost,
html[data-platform="drill"] a.btn.ghost,
html[data-platform="drill"] .band .ghost,
html[data-platform="drill"] .band .btn.ghost,
html[data-platform="drill"] section .btn.ghost,
html[data-platform="drill"] .btn.ghost{
  color:#E6F7FF !important;
  background:rgba(3,6,15,.60) !important;
  border:1px solid rgba(230,247,255,.38) !important;
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
html[data-platform="drill"] .btn.ghost:hover{
  background:rgba(3,6,15,.78) !important;border-color:var(--id-accent) !important}

/* ===== shared.css ===== */
/* ═══════════════════════════════════════════════════════════════════════════
   shared.css — هوية ex.codificahub.com مطبَّقة على كامل المنصّة.

   القيم أدناه **مقيسة** من ex.codificahub.com لا مُقدَّرة:
     html            #FFFFFF
     نصّ أساسي        rgb(11,27,34)      ثانوي rgb(92,115,124)
     تيل             rgb(14,140,155)    رابط  rgb(11,107,119)
     فاصل           rgb(227,234,237)
     بطاقة          rgba(255,255,255,.55) · نصف قطر 20px
                     · ظلّ rgba(11,27,34,.45) 0 24px 60px -40px
     الرأس          شريط داكن rgba(8,19,26,.94) بحوافّ دائرية
     الخط            Tajawal

   لماذا ملف مستقلّ؟ المنصّة طبقتان: صفحات تحمّل theme.css، وقشرة إدارة لا
   تحمّله. فأي توحيد في theme.css لا يمسّ نصف الصفحات. هذا الملف يُحقن في
   كل صفحة عند البناء (scripts/stamp-assets.js).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── الخط: Tajawal مستضاف محليًّا (بلا CDN) ───────────────────────────────── */
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/tajawal-400-1.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/tajawal-400-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+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/tajawal-500-7.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/tajawal-500-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+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/tajawal-700-3.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/tajawal-700-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+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/tajawal-800-5.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/fonts/tajawal-800-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+2212, U+FEFF, U+FFFD;
}

:root {
    --ex-teal: #0E8C9B;
    --ex-teal-deep: #0B7A86;
    --ex-teal-ink: #0B6B77;
    --ex-ink: #0B1B22;
    --ex-ink-2: #38505A;
    --ex-dim: #5C737C;
    --ex-line: #E3EAED;
    --ex-bg: #FFFFFF;
    --ex-white: #FFFFFF;
    --ex-glass: rgba(255, 255, 255, .55);
    --ex-glass-line: rgba(255, 255, 255, .75);
    --ex-shadow: 0 24px 60px -40px rgba(11, 27, 34, .45);
    --ex-shadow-sm: 0 10px 30px -22px rgba(11, 27, 34, .35);
}

/* ── الأساس: صفحة بيضاء بلمسات تيل، وخطّ ex ───────────────────────────────── */
html {
    /* نفس صبغة body: بدونه يظهر خطّ أفقي حادّ حيث ينتهي صندوق body في
       الصفحات القصيرة (قِيس فرق واضح عند y≈670 في لوحة الطالب). */
    background: #F1FAFB !important;
    color-scheme: light !important;
}
body { min-height: 100vh; }
body {
    /* صبغة تيل فاتحة: على أبيض خالص تصير البطاقات الزجاجية (أبيض .55) غير
       مرئية تقريبًا — وهذا ما ظهر فعلًا في لقطة اللوحة. ex يبرز بطاقاته لأن
       خلفيته ملوّنة، فنأخذ الصبغة نفسها لا الأبيض الناصع. */
    background-color: #F2FAFB !important;
    background-image:
        linear-gradient(180deg, #F7FCFD 0%, #F1FAFB 42%, #EDF7F9 100%),
        radial-gradient(900px 520px at 88% -6%, rgba(15, 163, 177, .16), transparent 62%),
        radial-gradient(760px 460px at -6% 12%, rgba(127, 227, 208, .18), transparent 64%),
        radial-gradient(900px 600px at 50% 108%, rgba(15, 163, 177, .10), transparent 66%) !important;
    background-attachment: fixed !important;
    color: var(--ex-ink) !important;
    font-family: 'Tajawal', 'IBM Plex Sans Arabic', system-ui, 'Segoe UI', Tahoma, Arial, sans-serif !important;
}
body *:not(code):not(pre):not(kbd):not(samp):not(.mono):not([class*="mono"]) {
    font-family: inherit;
}
h1, h2, h3 {
    font-weight: 800 !important;
    letter-spacing: -0.01em;
}
/* ex: h1 = 43.9px على 1440 — وكان عندنا 34px فيبدو العنوان أصغر من مرجعه */
.hero h1 { font-size: clamp(26px, 3vw, 44px) !important; }

/* ── الرأس: شريط داكن عائم كما في ex ────────────────────────────────────────
   تعارض حقيقي مقيس: `html[data-mode="light"][data-palette] .exam-header`
   في theme.css (تحديد 0,3,1) يفرض تدرّجًا فاتحًا **بـ!important**، فيغلب أي
   قاعدة صنف واحد — ولهذا بقي رأس المنصّة شفافًا/فاتحًا رغم كل المحاولات.
   الحل: استهداف المعرّف `#platformChromeHeader` بتحديد أعلى (1,3,1)، والتخلّي
   عن محاولة تلوين رأس الصفحة الفرعي الذي يجب أن يبقى فاتحًا بنصّ داكن.     */
#platformChromeHeader.exam-header,
html[data-mode="light"][data-palette] #platformChromeHeader.exam-header,
.hd-in {
    background: rgba(8, 19, 26, .94) !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 999px !important;
    box-shadow: 0 18px 40px -28px rgba(8, 19, 26, .60) !important;
    color: #F2F7F8 !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
#platformChromeHeader.exam-header {
    max-width: 1220px !important;
    width: calc(100% - 28px) !important;
    margin: 10px auto !important;
    inset-inline: 0;
}
.hd-in {
    max-width: 1220px !important;
    margin-inline: auto !important;
}
#platformChromeHeader,
#platformChromeHeader *:not(button):not(.btn):not([class*="badge"]):not([class*="chip"]):not(.ch-menu):not(.ch-menu *),
.hd-in,
.hd-in *:not(button):not(.burger) {
    color: #F2F7F8 !important;
}
.hd-in .brand .mark,
.exam-header .brand .mark { color: #7FE3D0 !important; }
.hd-in .brand .cmp,
.hd-in .cmp {
    background: rgba(255, 255, 255, .10) !important;
    border-color: rgba(255, 255, 255, .16) !important;
    color: #C9E9EC !important;
}
.hd-links a { color: #C6D5D9 !important; }
.hd-links a:hover { background: rgba(255, 255, 255, .10) !important; color: #FFFFFF !important; }
.langsw { background: rgba(255, 255, 255, .08) !important; }
.langsw button { color: #C6D5D9 !important; }
.langsw button.on { background: var(--ex-teal) !important; color: #FFFFFF !important; }
.burger,
#burger {
    background: rgba(255, 255, 255, .10) !important;
    border: 1px solid rgba(255, 255, 255, .16) !important;
    color: #F2F7F8 !important;
}

/* لوحة الطالب: رأسها وسمٌ مجرّد `<header>` بأنماط داخلية بيضاء، فلم يصلها
   التوحيد. أُضيف له صنف `sd-header` في الصفحة نفسها، وهذا يمنحه حبّة ex. */
header.sd-header {
    background: rgba(8, 19, 26, .94) !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 999px !important;
    box-shadow: 0 18px 40px -28px rgba(8, 19, 26, .60) !important;
    max-width: 1220px !important;
    width: calc(100% - 28px) !important;
    margin: 10px auto !important;
    padding: 10px 18px !important;
    color: #F2F7F8 !important;
}
header.sd-header *:not(button):not(.btn):not([class*="badge"]) { color: #F2F7F8 !important; }
header.sd-header .role,
header.sd-header [class*="role"],
header.sd-header small { color: #9FB6C4 !important; }
header.sd-header button {
    background: var(--ex-teal) !important;
    border-color: var(--ex-teal) !important;
    color: #FFFFFF !important;
}
header.sd-header [class*="badge"] {
    background: #DDF1F4 !important;
    color: #0B5C66 !important;
}
header.sd-header img,
header.sd-header .logo { max-height: 40px !important; width: auto !important; }
/* الحبّة سطر واحد دائمًا: صفحة `security` بلغت 90.7px لأن محتوى الرأس التفّ */
/* الحبّة حاوية كتلية لا flex: جعلها flex يجعل `.bar` عنصرًا مرنًا يتقلّص إلى
   محتواه (قِيس 345px داخل 1220px فبقي المحتوى متجمّعًا في الوسط). */
header.sd-header {
    display: block !important;
    overflow: hidden !important;
    min-height: 46px !important;
}
/* .bar داخل الحبّة عنصر flex بعرض تلقائي + margin:auto، فيتقلّص إلى محتواه
   ويتجمّع في الوسط عند تبديل اللغة إلى الإنجليزية (قِيس فراغ 500px يسارًا). */
header.sd-header > .bar {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 1080px !important;
    margin: 0 auto !important;
}
header.sd-header h1,
header.sd-header #pageTitle {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* عنوان الصفحة داخل الحبّة: كان h1 بصفحة مستقلة حجمًا كبيرًا فيتضخّم الشريط */
header.sd-header h1,
header.sd-header #pageTitle {
    font-size: 1.05rem !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}
header.sd-header .crumb,
header.sd-header .breadcrumb,
header.sd-header nav { font-size: .82rem !important; color: #9FB6C4 !important; }
header.sd-header .crumb a,
header.sd-header .breadcrumb a { color: #9FB6C4 !important; }

/* زرّ لغة شاشة الأمان: داخل الحبّة، على يسار العنوان */
header.sd-header { position: relative !important; }
header.sd-header .sec-lang {
    position: absolute;
    inset-inline-end: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .10) !important;
    border: 1px solid rgba(255, 255, 255, .18) !important;
    color: #F2F7F8 !important;
    border-radius: 999px !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    cursor: pointer;
}
header.sd-header .sec-lang:hover { background: rgba(255, 255, 255, .18) !important; }

/* أزرار الرأس: تيل صريح كما في ex */
.exam-header button:not(.ch-menu-btn):not(.burger),
.exam-header .btn {
    background: var(--ex-teal) !important;
    color: #FFFFFF !important;
    border-color: var(--ex-teal) !important;
    border-radius: 999px !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: var(--ex-ink) !important;
}
body:has(.exam-question) .exam-header {
    background: #FFFFFF !important;
    border: 1px solid var(--ex-line) !important;
    box-shadow: var(--ex-shadow-sm) !important;
}
body:has(.exam-question) .exam-action-bar .btn:not(:disabled),
body:has(.exam-question) .exam-action-bar button:not(:disabled) {
    background: var(--ex-teal-deep) !important;
    border-color: var(--ex-teal-deep) !important;
    color: #FFFFFF !important;
}

/* ── الأسطح: زجاج أبيض بحوافّ 20px وظلّ ex ─────────────────────────────────── */
.tile,
.card,
.nt-item,
.panel,
.stat-card,
.exam-card {
    background: var(--ex-glass) !important;
    /* حدود مرئية: حدود ex بيضاء، لكن على صفحة شبه بيضاء لا تُرى — فنجعلها
       فاصلاً رماديًّا فاتحًا يحفظ الشكل دون تغيير لون السطح */
    border: 1px solid rgba(227, 234, 237, .85) !important;
    border-radius: 20px !important;
    box-shadow: var(--ex-shadow) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.tile:hover,
.card:hover,
.nt-item:hover {
    background: rgba(255, 255, 255, .82) !important;
    transition: background .18s ease, transform .18s ease;
}
.tile h3,
.card h2,
.card h3,
.nt-item h3 { color: var(--ex-ink) !important; }
.tile p,
.card p,
.nt-item p { color: var(--ex-dim) !important; }

/* ── الأزرار: حبّات تيل ───────────────────────────────────────────────────── */
.btn-primary,
.btn.btn-primary,
button.btn-primary,
a.btn-primary {
    background: var(--ex-teal) !important;
    border-color: var(--ex-teal) !important;
    color: #FFFFFF !important;
    border-radius: 999px !important;
}
.btn {
    border-radius: 11px;
}
.btn:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--ex-teal) !important;
    outline-offset: 2px;
}

/* زرّ معطّل يُقرأ ولا يختفي */
button:disabled,
.btn:disabled {
    opacity: 1 !important;
    background: #E9EFF1 !important;
    color: #5C737C !important;
    border-color: #D6E0E4 !important;
}

/* ── حقول الإدخال: كانت داكنة من اللوحة القديمة ─────────────────────────────
   ظهرت في صفحة الأمان كصندوقين أسودين على صفحة فاتحة. القاعدة تشمل كل
   الصفحات لأن الحقول عنصر مشترك، وتستثني صناديق الاختيار والأزرار.       */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select,
textarea {
    background: #FFFFFF !important;
    color: var(--ex-ink) !important;
    border: 1px solid var(--ex-line) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}
input::placeholder,
textarea::placeholder { color: #8FA6AE !important; }
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: var(--ex-teal) !important;
    outline: 2px solid rgba(14, 140, 155, .22) !important;
    outline-offset: 1px;
}
input[type="checkbox"],
input[type="radio"] { accent-color: var(--ex-teal); }

/* شريط التمرير: كان بلون دافئ من اللوحة القديمة فيظهر خطّ بيج على الحافة */
/* theme.css:1717 يفرض `scrollbar-color:#c08a2e !important` (ذهبي من اللوحة
   الدافئة القديمة) فيظهر خطّ بيج على الحافة اليمنى. نُعيده رماديًّا مزرقًا. */
*,
html[data-mode="light"][data-palette] * {
    scrollbar-color: #C3D5DA transparent !important;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #EFF7F9; }
::-webkit-scrollbar-thumb { background: #C3D5DA; border-radius: 99px; border: 2px solid #EFF7F9; }
::-webkit-scrollbar-thumb:hover { background: #A8C2C9; }

/* ── التذييل: نهاري كما طُلب (ex لا يعرض شريط حقوق داكن) ───────────────────── */
footer,
.platform-footer,
.site-footer,
.platform-rights-bar,
.login-rights {
    background: #FFFFFF !important;
    color: #38505A !important;
    border-top: 1px solid var(--ex-line) !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
footer a,
footer p,
footer li,
footer span,
.platform-footer a,
.site-footer a,
.platform-rights-bar *,
.login-rights * { color: #38505A !important; }
footer h1,
footer h2,
footer h3,
footer h4,
footer strong { color: var(--ex-ink) !important; }
footer a:hover,
.platform-rights-bar a:hover { color: var(--ex-teal-ink) !important; }
footer .btn { color: var(--ex-ink) !important; }
.platform-rights-bar .platform-credit-text,
.platform-rights-bar .platform-rights-text,
.login-rights .login-rights-text { opacity: 1 !important; }

/* ── الخلفية المتحركة: طبقة واحدة ────────────────────────────────────────────
   identity.css تُنشئ 3 كرات ضبابية بعرض 42–54vmax تتجاوز الحاوية فترفع
   body.scrollWidth إلى 585px على 390. وplat-bg.js يملك الخلفية الآن.      */
body:has(#plat-bg) #id-bg { display: none !important; }

/* ── قائمة الرأس: كانت لا تُفتح إطلاقًا ──────────────────────────────────────
   `.ch-menu.is-open` في identity.css يضبط الوضع والظلّ لكن لا يضبط display؛
   القاعدة الوحيدة التي تُظهره مقيّدة بـ`.ch-hdr__in .ch-menu.is-open`، والمضيف
   الحقيقي `div.ch-menu-host`. فالنقر يضيف is-open ويقلب aria-expanded واللوحة
   تبقى 0×0 — أي زرّ قائمة في هذه الطبقة لم يعمل قط.                       */
.ch-menu-host { position: relative !important; }
.ch-menu-host .ch-menu.is-open { display: grid !important; }
.ch-menu.is-open { z-index: 9999 !important; }
#platformChromeHeader { z-index: 1200 !important; }
.exam-header { z-index: 1100 !important; }

.ch-menu {
    background: #FFFFFF !important;
    border: 1px solid var(--ex-line) !important;
    box-shadow: 0 26px 64px -32px rgba(11, 27, 34, .38) !important;
    color: var(--ex-ink) !important;
    border-radius: 20px !important;
}
.exam-header .ch-menu .ch-menu__c h4 {
    color: var(--ex-teal-ink) !important;
    border-bottom-color: var(--ex-line) !important;
}
.exam-header .ch-menu .ch-menu__c a,
.ch-menu .ch-menu__c a { color: #0B1B22 !important; }
.exam-header .ch-menu .ch-menu__c a:hover,
.exam-header .ch-menu .ch-menu__c a:focus-visible,
.ch-menu .ch-menu__c a:hover { background: #E6F4F6 !important; color: #0B5C66 !important; }
.exam-header .ch-menu .ch-menu__note,
.ch-menu .ch-menu__note { color: #5C737C !important; }
.ch-menu-btn {
    border-color: rgba(255, 255, 255, .16) !important;
    background: rgba(255, 255, 255, .10) !important;
}
.ch-menu-btn span { background: #F2F7F8 !important; }

/* ── صفحة الإشعارات: محتوى نهاري داخل هوية ex ─────────────────────────────── */
body:has(.nt-wrap) {
    background-color: #FFFFFF !important;
    color: var(--ex-ink) !important;
    min-height: 100vh;
}
body:has(.nt-wrap) .nt-item h3 { color: var(--ex-ink) !important; }
body:has(.nt-wrap) .nt-item p { color: var(--ex-ink-2) !important; }
body:has(.nt-wrap) .nt-meta { color: var(--ex-dim) !important; opacity: 1 !important; }
body:has(.nt-wrap) .nt-item.unread { border-inline-start-color: var(--ex-teal) !important; }
body:has(.nt-wrap) .chip {
    background: #E6F4F6 !important;
    border-color: #BFE0E6 !important;
    color: #0B5C66 !important;
}
body:has(.nt-wrap) .chip.new {
    background: #DDF1F4 !important;
    border-color: var(--ex-teal) !important;
    color: #0A5560 !important;
}
body:has(.nt-wrap) .nt-empty { color: var(--ex-dim) !important; }

/* شارات الحالة */
.es-badge, .es-card .es-badge { color: #0B5C66 !important; }
.es-card.is-picked .es-badge { color: #FFFFFF !important; }

/* ── جوال: 390px ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hd-links,
    .hd-in nav { display: none !important; }
    .hd-in {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .langsw { max-width: 62px !important; overflow: hidden !important; flex: 0 1 auto !important; }
    #burger,
    button.burger,
    .burger {
        position: static !important;
        inset: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        margin-inline-start: auto !important;
        flex: 0 0 38px !important;
        display: inline-grid !important;
        place-items: center !important;
        z-index: 5 !important;
    }
    .platform-rights-bar,
    .platform-rights-inner { flex-wrap: wrap !important; gap: 6px !important; padding-inline: 10px !important; }
    .platform-rights-text,
    .platform-xlinks {
        white-space: normal !important;
        max-width: 100% !important;
        overflow-wrap: anywhere !important;
        position: static !important;
        font-size: 10.5px !important;
        line-height: 1.6 !important;
    }
    body { overflow-x: hidden !important; }

    /* الرأس: brand 282 + actions 226 + burger 42 = 574 داخل 380 ⇒ انزلاق */
    .exam-header {
        flex-wrap: nowrap !important;
        gap: 8px !important;
        padding-inline: 12px !important;
        box-sizing: border-box !important;
        max-width: calc(100% - 20px) !important;
        width: calc(100% - 20px) !important;
        margin: 8px auto !important;
    }
    .exam-header .brand { flex: 1 1 0 !important; min-width: 0 !important; overflow: hidden !important; }
    .exam-header .brand .txt { min-width: 0 !important; overflow: hidden !important; display: none !important; }
    .exam-header .brand .nm,
    .exam-header .brand .brand-name {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: .95rem !important;
    }
    .exam-header .brand .tg { display: none !important; }
    .exam-header .brand .mark img,
    .exam-header #platformLogo { max-height: 30px !important; width: auto !important; }
    .exam-header .header-actions { flex: 0 0 auto !important; gap: 6px !important; margin: 0 !important; }
    .exam-header .header-icon-button,
    .exam-header .header-logout-button,
    .exam-header .header-action-button {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        padding: 0 !important;
    }
    .exam-header #guideButton { display: none !important; }
    .exam-header #platformLangSlot { flex: 0 0 auto !important; max-width: none !important; white-space: nowrap !important; }
    .exam-header #platformLangSlot * { white-space: nowrap !important; word-break: keep-all !important; }
    .exam-header .ch-menu-host { position: relative !important; flex: 0 0 auto !important; margin: 0 !important; }
    .exam-header .ch-menu-btn { width: 38px !important; height: 38px !important; }
    .exam-header .ch-menu.is-open {
        inset-inline: auto !important;
        inset-inline-end: 0 !important;
        min-width: min(92vw, 340px) !important;
        max-width: calc(100vw - 16px) !important;
        max-height: min(70vh, 520px) !important;
    }

    /* «Submitted» كانت تظهر مرّتين: شارة خفيفة + زرّ رمادي ثقيل معطّل.
       تبقى الشارة (أوضح دلالة) ويُخفى الزرّ الذي لا يفعل شيئًا. */
    .exam .go:disabled { display: none !important; }

    /* لوحة الطالب: الرأس كان يلتفّ إلى 155px على 390 (crest 52 + سطرين) */
    header.sd-header > .bar {
        flex-wrap: nowrap !important;
        padding: 8px 10px !important;
        gap: 8px !important;
    }
    header.sd-header .crest { width: 40px !important; height: 40px !important; border-radius: 10px !important; }
    header.sd-header .crest img { width: 34px !important; height: 34px !important; }
    header.sd-header .who h1 { font-size: 15px !important; }
    header.sd-header .role { display: none !important; }
    header.sd-header .tools { gap: 6px !important; }

    /* جدول النتائج: خمسة أعمدة داخل 380px كانت تُسحق */
    #resultsBox,
    .table-scroll { overflow-x: auto !important; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    #resultsBox table,
    .table-scroll table { min-width: 440px !important; width: 100% !important; font-size: 12.5px !important; }
    #resultsBox th,
    #resultsBox td,
    .table-scroll th,
    .table-scroll td { white-space: nowrap !important; padding: 8px 9px !important; }
    #resultsBox::-webkit-scrollbar,
    .table-scroll::-webkit-scrollbar { height: 6px; }
    #resultsBox::-webkit-scrollbar-thumb,
    .table-scroll::-webkit-scrollbar-thumb { background: #CBD8DD; border-radius: 99px; }
}

/* ═══ تنقّل ووصولية: تخطّي إلى المحتوى + تركيز مرئي موحّد ═══ */
.skip-to-main{
  position:absolute; inset-inline-start:-9999px; top:0; z-index:99999;
  background:#0B1B22; color:#fff; padding:10px 16px; border-radius:0 0 10px 10px;
  font:600 13px/1.4 Tajawal,system-ui,sans-serif; text-decoration:none;
}
.skip-to-main:focus{ inset-inline-start:12px; outline:2px solid #0E8C9B; outline-offset:2px; }
#content:focus{ outline:none; }
#content:focus-visible{ outline:2px solid #0E8C9B; outline-offset:4px; border-radius:10px; }

/* ═══ زر قائمة الأقسام في لوحة القيادة ═══
   القائمة تبدأ مغلقة (ui-enhance)، وكان الزر مفقودًا فلم تكن هناك وسيلة لفتحها
   على أي مقاس. الزر يعيدها ويُعلن حالته لقارئ الشاشة. */
#sidebarToggle{
  position:fixed; inset-block-start:14px; inset-inline-end:14px; z-index:80;
  display:inline-flex; align-items:center; gap:8px;
  min-height:42px; padding:0 14px; border-radius:12px;
  border:1px solid #D3DEE2; background:#fff; color:#0B1B22;
  font:700 13px/1 Tajawal,system-ui,sans-serif; cursor:pointer;
  box-shadow:0 6px 18px rgba(11,27,34,.12);
}
#sidebarToggle:hover{ background:#E8F4F6; border-color:#0E8C9B; }
#sidebarToggle:focus-visible{ outline:2px solid #0E8C9B; outline-offset:2px; }
#sidebarToggle[aria-expanded="true"]{ background:#0E8C9B; border-color:#0E8C9B; color:#fff; }
#sidebarToggle .st-txt{ white-space:nowrap; }
@media (max-width:520px){ #sidebarToggle .st-txt{ display:none; } #sidebarToggle{ padding:0 11px; } }
@media print{ #sidebarToggle{ display:none !important; } }

/* ===== nav-shell.css ===== */
﻿/* =============================================================================
   nav-shell — الهيدر وقائمة الأقسام الموحّدة
   ألوان الهوية: تيل #0E8C9B على أسطح فاتحة، وحدود #E1E9EC، ونص #0B1B22.
   ========================================================================== */

:root{
  --ns-teal:#0E8C9B;
  --ns-teal-2:#12A8B8;
  --ns-ink:#0B1B22;
  --ns-dim:#5C737C;
  --ns-line:#E1E9EC;
  --ns-soft:#EEF7F8;
  --ns-card:#FFFFFF;
}

/* ── إخفاء آليات التنقّل القديمة (تبقى في DOM، فلا يُفقد إجراء) ───────────
   لا نُخفيها إلا بعد أن ينجح بناء القائمة الجديدة: class ns-on على <html>. */
html.ns-on .ch-menu-btn,
html.ns-on .ch-menu,
html.ns-on #pn-btn,
html.ns-on #pn-d,
html.ns-on #pn-s,
html.ns-on .burger,
html.ns-on .drawer,
html.ns-on #sidebarToggle,
html.ns-on .dashboard-sidebar{ display:none !important; }

html.ns-locked{ overflow:hidden; }

/* ── الزر ─────────────────────────────────────────────────────────────── */
.ns-btn{
  display:inline-flex; align-items:center; gap:9px;
  min-height:40px; padding:0 13px; margin-inline-start:6px;
  border-radius:11px; cursor:pointer;
  border:1px solid color-mix(in srgb, currentColor 22%, transparent);
  background:color-mix(in srgb, currentColor 9%, transparent);
  color:inherit; font:700 13px/1 Tajawal,"IBM Plex Sans Arabic",system-ui,sans-serif;
  transition:background .15s ease, border-color .15s ease, transform .15s ease;
}
.ns-btn:hover{ background:color-mix(in srgb, currentColor 16%, transparent); }
.ns-btn:active{ transform:translateY(1px); }
.ns-btn:focus-visible{ outline:2px solid var(--ns-teal-2); outline-offset:2px; }
.ns-btn[aria-expanded="true"]{ background:var(--ns-teal); border-color:var(--ns-teal); color:#fff; }
.ns-bars{ display:grid; gap:3px; }
.ns-bars i{ display:block; width:15px; height:2px; border-radius:2px; background:currentColor; transition:transform .18s, opacity .18s; }
.ns-btn[aria-expanded="true"] .ns-bars i:nth-child(1){ transform:translateY(5px) rotate(45deg); }
.ns-btn[aria-expanded="true"] .ns-bars i:nth-child(2){ opacity:0; }
.ns-btn[aria-expanded="true"] .ns-bars i:nth-child(3){ transform:translateY(-5px) rotate(-45deg); }
@media (max-width:640px){ .ns-btn .ns-btn-txt{ display:none; } .ns-btn{ padding:0 11px; } }

/* ── الحاجز ───────────────────────────────────────────────────────────── */
#ns-scrim{
  position:fixed; inset:0; z-index:9300;
  background:rgba(11,27,34,.38); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px);
  opacity:0; pointer-events:none; transition:opacity .18s ease;
}
#ns-scrim.is-open{ opacity:1; pointer-events:auto; }

/* ── اللوحة ───────────────────────────────────────────────────────────── */
#ns-panel{
  position:fixed; z-index:9350; inset-block-start:72px; inset-inline-end:20px;
  width:min(400px, calc(100vw - 32px));
  max-height:min(72vh, 660px);
  display:flex; flex-direction:column;
  background:var(--ns-card); color:var(--ns-ink);
  border:1px solid var(--ns-line); border-radius:20px;
  box-shadow:0 28px 70px -24px rgba(11,27,34,.42), 0 2px 8px rgba(11,27,34,.06);
  font-family:Tajawal,"IBM Plex Sans Arabic",system-ui,-apple-system,"Segoe UI",sans-serif;
  opacity:0; visibility:hidden; transform:translateY(-8px) scale(.99);
  transform-origin:top left;
  transition:opacity .16s ease, transform .16s ease, visibility .16s;
  overflow:hidden;
}
#ns-panel.is-open{ opacity:1; visibility:visible; transform:none; }

html[dir="rtl"] #ns-panel{ transform-origin:top right; }

/* رأس اللوحة */
.ns-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 16px 11px;
  background:linear-gradient(180deg,#F5FAFB,#FFFFFF);
  border-block-end:1px solid var(--ns-line);
}
.ns-title{ display:flex; align-items:baseline; gap:9px; }
.ns-title b{ font-size:15.5px; letter-spacing:.1px; color:var(--ns-ink); }
.ns-role{ font-size:11px; color:var(--ns-dim); background:var(--ns-soft); padding:3px 8px; border-radius:99px; }
.ns-x{
  width:34px; height:34px; border-radius:10px; border:1px solid var(--ns-line);
  background:#fff; color:var(--ns-ink); cursor:pointer; display:grid; place-items:center;
  font-size:14px; line-height:1;
}
.ns-x:hover{ background:var(--ns-soft); border-color:var(--ns-teal); }
.ns-x:focus-visible{ outline:2px solid var(--ns-teal); outline-offset:2px; }

/* البحث */
.ns-search{ position:relative; padding:12px 16px 10px; }
.ns-search input{
  width:100%; box-sizing:border-box; padding:11px 38px 11px 36px;
  border:1px solid var(--ns-line); border-radius:12px;
  background:#FBFDFD; color:var(--ns-ink); font:inherit; font-size:13.5px;
}
.ns-search input::placeholder{ color:#8AA0A8; }
.ns-search input:focus{ outline:none; border-color:var(--ns-teal); background:#fff; box-shadow:0 0 0 3px rgba(14,140,155,.14); }
.ns-si{ position:absolute; inset-inline-start:28px; inset-block-start:50%; transform:translateY(-58%); color:#8AA0A8; font-size:14px; pointer-events:none; }
.ns-kbd{
  position:absolute; inset-inline-end:26px; inset-block-start:50%; transform:translateY(-58%);
  font:600 11px/1 ui-monospace,monospace; color:#8AA0A8;
  border:1px solid var(--ns-line); border-radius:5px; padding:3px 5px; background:#fff;
}

/* الجسم */
.ns-body{ overflow:auto; padding:0 10px 8px; flex:0 1 auto; overscroll-behavior:contain; }
.ns-group{ margin-bottom:2px; padding-bottom:2px; }
.ns-group + .ns-group{ border-block-start:1px solid #F2F6F7; margin-block-start:4px; padding-block-start:4px; }
.ns-group-head{
  width:100%; display:flex; align-items:center; gap:8px;
  padding:9px 10px; margin-top:2px;
  border:0; border-radius:9px; background:transparent; cursor:pointer;
  color:var(--ns-dim); font:700 11.5px/1 inherit; letter-spacing:.04em; text-align:start;
}
.ns-group-head:hover{ background:#F7FAFB; color:var(--ns-ink); }
.ns-group-head:focus-visible{ outline:2px solid var(--ns-teal); outline-offset:-2px; }
.ns-group-head span{ flex:1; }
.ns-group-head b{
  font-size:10px; font-weight:700; color:var(--ns-dim);
  background:#F1F6F7; border-radius:99px; padding:2px 7px; min-width:18px; text-align:center;
}
.ns-caret{
  width:7px; height:7px; border-inline-end:1.8px solid currentColor; border-block-end:1.8px solid currentColor;
  transform:rotate(45deg); transition:transform .16s ease; margin-inline-start:2px; opacity:.7;
}
.ns-group-head[aria-expanded="true"] .ns-caret{ transform:rotate(-135deg); }

.ns-list{ display:grid; gap:1px; padding:0 0 4px; }

/* البند */
.ns-item{
  display:flex; align-items:center; gap:10px;
  min-height:42px; padding:9px 11px;
  border-radius:10px; text-decoration:none; color:var(--ns-ink);
  font-size:13.8px; line-height:1.35;
  transition:background .12s ease, color .12s ease;
}
.ns-item:hover{ background:var(--ns-soft); color:#08626C; }
.ns-item:focus-visible{ outline:2px solid var(--ns-teal); outline-offset:-2px; }
.ns-item i[data-lucide], .ns-item svg{ width:17px; height:17px; flex:0 0 17px; opacity:.75; }
.ns-item:hover i[data-lucide], .ns-item:hover svg{ opacity:1; }
.ns-dot{ width:6px; height:6px; border-radius:50%; background:#B9CDD2; flex:0 0 6px; margin-inline-start:5px; }
.ns-item-t{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ns-item.is-active{ background:var(--ns-soft); color:#08626C; font-weight:800; }
.ns-item.is-active .ns-dot{ background:var(--ns-teal); box-shadow:0 0 0 3px rgba(14,140,155,.16); }
.ns-item.is-active::after{
  content:""; width:6px; height:6px; border-radius:50%; background:var(--ns-teal); flex:0 0 6px;
}
.ns-guide{ margin-top:6px; border-top:1px solid var(--ns-line); border-radius:0 0 10px 10px; padding-top:12px; }

/* التذييل */
.ns-empty{ margin:0; padding:18px 16px 26px; text-align:center; color:var(--ns-dim); font-size:13px; }
.ns-foot{
  border-top:1px solid var(--ns-line); padding:9px 16px;
  display:flex; justify-content:flex-end; background:#FCFDFD;
}
.ns-foot-link{ font-size:12px; color:var(--ns-dim); text-decoration:none; padding:5px 8px; border-radius:7px; }
.ns-foot-link:hover{ color:var(--ns-teal); background:var(--ns-soft); }

/* ── الجوال: درج كامل ─────────────────────────────────────────────────── */
@media (max-width:760px){
  #ns-panel{
    inset-block-start:0; inset-inline-end:0;
    width:min(360px, 90vw); height:100dvh; max-height:none;
    border-radius:0; border:0;
    transform:translateX(105%);
  }
  /* في LTR تقع اللوحة على اليسار، فالتحريك الموجب يُدخلها للشاشة بدل إخراجها. */
  html[dir="ltr"] #ns-panel{ transform:translateX(-105%); }
  /* القاعدة السابقة (html[dir="rtl"] #ns-panel) كانت تتغلّب على .is-open
     بأولوية أعلى، فتبقى اللوحة خارج الشاشة رغم فتحها. هذا يرفع الأولوية
     إلى المستوى نفسه مع بقاء الحالة المفتوحة أخيرًا. */
  html[dir] #ns-panel.is-open{ transform:none !important; }
  .ns-head{ padding-top:max(14px, env(safe-area-inset-top)); }
  .ns-body{ padding-bottom:max(14px, env(safe-area-inset-bottom)); }
}

/* ── تقليل الحركة ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion:reduce){
  #ns-panel, #ns-scrim, .ns-btn, .ns-item{ transition:none; }
}
@media print{ #ns-btn, #ns-panel, #ns-scrim{ display:none !important; } }

/* الزر داخل ترويسة بسيطة (sd-header) يدفع نفسه إلى الطرف بدل أن يزاحم العنوان */
header > .ns-btn{ margin-inline-start:auto; }

/* زر ثابت في الصفحات ذات ترويسة بسيطة: نفس الزاوية دائمًا */
.ns-btn.ns-floating{ position:fixed; inset-block-start:14px; inset-inline-end:14px; z-index:880; margin:0; box-shadow:0 6px 18px rgba(11,27,34,.14); }
@media print{ .ns-btn.ns-floating{ display:none !important; } }

/* ═══ أزرار الترويسة: قياس واحد وشكل واحد ═══
   كانت ثلاثة أصناف بأحجام مختلفة (أيقونة، إجراء، خروج بنص) فتظهر غير مرتّبة.
   الآن كلها دائرة 38px، والترتيب من اليمين: العلامة ← [الصفحة الرئيسية
   الإشعارات الدليل اللغة الخروج] ← البرغر في الطرف. */
.exam-header .header-actions{ display:flex; align-items:center; gap:8px; }
.exam-header .hbtn{
  width:38px; height:38px; border-radius:50%;
  display:inline-grid; place-items:center; padding:0; position:relative;
  border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.08);
  color:#fff; cursor:pointer; flex:0 0 auto;
  transition:background .16s ease, border-color .16s ease;
}
.exam-header .hbtn:hover{ background:rgba(255,255,255,.17); border-color:rgba(255,255,255,.32); }
.exam-header .hbtn:focus-visible{ outline:2px solid #12A8B8; outline-offset:2px; }
.exam-header .hbtn svg{ width:18px; height:18px; }
.exam-header .hbtn .ns-bars{ display:grid; gap:3px; }
.exam-header .hbtn .ns-bars i{ display:block; width:16px; height:2px; border-radius:2px; background:currentColor; }
#notificationCount{
  position:absolute; top:-3px; inset-inline-end:-3px;
  min-width:16px; height:16px; padding:0 4px; border-radius:99px;
  background:#B8862F; color:#0B1B22; font:800 10px/16px Tajawal,system-ui,sans-serif;
  display:grid; place-items:center;
}
#platformLangSlot > *{ height:38px; border-radius:99px; }

/* ═══ توحيد أدوات الترويسة الإضافية ═══
   زر البحث السريع (ui-cmd-trigger) كان 40×41 بمربّع، وتلميحه ظاهر دائمًا
   كفقاعة فوقه. نجعله دائرة كبقية الأزرار، ولا يظهر التلميح إلا عند التحويم
   أو التركيز. */
.exam-header .header-actions .ui-cmd-trigger{
  width:38px; height:38px; min-width:38px; border-radius:50%;
  display:inline-grid; place-items:center; padding:0; box-sizing:border-box;
  border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.08);
  color:#fff; cursor:pointer;
}
.exam-header .header-actions .ui-cmd-trigger:hover{ background:rgba(255,255,255,.17); }
.exam-header .header-actions .ui-cmd-trigger .ui-cmd-trigger-text{ display:none; }
.exam-header .header-actions > *{ box-sizing:border-box; }
.exam-header .header-actions .hbtn{ line-height:1; }

/* نصوص مساعدة لا تنتمي لشريط الأدوات */
.quick-navigation small{ display:none !important; }
.exam-header .header-actions .hbtn,
.exam-header .header-actions .ui-cmd-trigger{ height:38px !important; padding:0 !important; }

/* ═══ قياس موحّد لأدوات الترويسة ═══
   الأزرار كانت 36.79 و40.79 و43.2 و40 معًا. القياس يأتي من قواعد مختلفة
   لكل صنف، فنفرضه على المستوى الأدنى: كل زر مباشر في الشريط أو داخل حاوية
   الإشعارات. */
.exam-header .header-actions > button,
.exam-header .header-actions > div > button{
  width:38px !important; height:38px !important;
  min-width:38px !important; min-height:38px !important;
  max-width:38px !important; max-height:38px !important;
  padding:0 !important; border-radius:50% !important;
  display:inline-grid !important; place-items:center;
  line-height:1 !important;
}
.exam-header .header-actions{ align-items:center; }

/* القائمة الجانبية مخفية، فالشبكة كانت تُبقي عمودها فارغًا. */
html.ns-on .dashboard-shell,
html.ns-on main.dashboard-shell{
  grid-template-columns:1fr !important;
}
html.ns-on .dashboard-sidebar{ display:none !important; }

/* ═══ مبدّل اللغة داخل الشريط ═══
   pt-i18n يجعله fixed فيطفو منفصلًا؛ هنا يصبح عنصرًا في الصف بنفس قياس
   الأزرار الأخرى. */
#platformLangSlot{ display:inline-flex; align-items:center; gap:6px; }
#platformLangSlot [data-pt-lang-btn]{
  position:static !important; inset:auto !important; top:auto !important;
  right:auto !important; left:auto !important; bottom:auto !important;
  width:auto !important; min-width:44px; height:38px !important;
  padding:0 12px !important; margin:0 !important;
  border-radius:99px !important; display:inline-flex !important;
  align-items:center; justify-content:center; gap:6px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.18);
  color:#fff; font:700 12.5px/1 Tajawal,system-ui,sans-serif; cursor:pointer;
}
#platformLangSlot [data-pt-lang-btn]:hover{ background:rgba(255,255,255,.17); }

/* ارتفاع اللوحة المفروض كان يترك فراغًا أسفل المحتوى ويقص الفوتر. */
.dashboard-page .dashboard-shell{ min-height:auto !important; }

/* زر "تعليم الكل كمقروء": كان على حافة الصندوق اليسرى في RTL. يدفع نفسه
   إلى بداية السطر (اليمين) فيصبح مع عنوان الصندوق. */
#ntAll{ display:block; width:max-content; margin-inline-start:auto; margin-inline-end:0; }

/* ===== ambient.css ===== */
﻿/* ═══════════════════════════════════════════════════════════════════════
   ambient v2 — الكلمات العائمة
   المرجع: ex.codificahub.com (26 كلمة، شفافية 0.18، أوزان 700، توزيع ثابت)
   الطبقات الثلاث تُبنى في ambient.js؛ هنا مظهر الكلمات فقط.
   ═══════════════════════════════════════════════════════════════════════ */

#topics-layer{
  position:fixed; inset:0; z-index:-1; pointer-events:none; overflow:hidden;
}

.amb-topic{
  position:absolute;
  font-family:'Tajawal','Segoe UI',Tahoma,sans-serif;
  font-weight:700;
  letter-spacing:.4px;
  white-space:nowrap;
  will-change:transform;
  user-select:none;
  -webkit-user-select:none;
  transform:translate3d(0,0,0);
}

.amb-sm{ font-size:14.4px; }
.amb-mid{ font-size:23px; }
.amb-big{ font-size:34px; line-height:1; }

/* على الجوال: الشاشة أضيق، فكثافة 26 كلمة تُشوّش النص فوقها. نُبقي الطبقة
   لكن بشفافية أخفض ونخفي الكبيرة، فتبقى الهوية بلا ازدحام. */
@media (max-width: 860px){
  .amb-topic{ opacity:.16 !important; }
  .amb-big{ display:none; }
}

@media (prefers-reduced-motion: reduce){
  .amb-topic{ transition:none !important; }
}

@media print{
  #topics-layer, #bg-animated, #ambient-canvas{ display:none !important; }
}

/* الصفحات ذات الخلفية المعتمة الخاصة (شاشة اختبار، تسجيل دخول) لا تحتاج
   طبقات إضافية تحتها. */
html[data-ambient="off"] #topics-layer,
html[data-ambient="off"] #bg-animated,
html[data-ambient="off"] #ambient-canvas{ display:none !important; }

/* ═══ إظهار الطبقات: body كان معتمًا فيحجبها ═══
   المرجع (ex) يجعل body شفافًا واللون على html، فتظهر الطبقات الثلاث.
   هنا نتبع الشيء نفسه، مع استثناء شاشة الاختبار التي تحتاج سطحًا صلبًا. */
html[data-ambient="on"]{ background-color:#F6F8F9; }
html[data-ambient="on"] body:not(.exam-mode):not(.page-loading){
  background-color: transparent !important;
  background-image: none !important;
}
/* كانفس وكلمات home القديمة: ambient يوفّر البديل، فتبقى مخفية بلا حذف. */
#neural, #topics{ display:none !important; }

/* كانفس الخلفية القديم (plat-bg) كان position:static فيمدّ الصفحة 900px
   فراغًا أسفل المحتوى. ambient يوفّر الطبقة البديلة، فيُخفى هذا نهائيًا. */
#plat-bg, canvas#plat-bg{ display:none !important; }

/* البطاقات الزجاجية كانت شفافة 55% فتظهر الكلمات داخلها كأنها جزء من نصها.
   نرفع عتامتها قليلًا فقط حين تكون الطبقة اللونية نشطة. */
html[data-ambient="on"] .card,
html[data-ambient="on"] .tile,
html[data-ambient="on"] article[class*="card"],
html[data-ambient="on"] .glass-card{
  background-color: rgba(255,255,255,.86) !important;
}
