* { 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; } }
