/* ═══════════════════════════════════════════════════════════
   نافس بذكاء — التنسيق العام
   عربي RTL بالكامل: خصائص منطقية (inline/block) بدل left/right.
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --ink: #15201d;
  --ink-2: #46514d;
  --muted: #646c68;
  --border: #e2e7e4;
  --border-strong: #c9d1cd;
  --primary: #0f766e;
  --primary-hover: #0b5d56;
  --primary-soft: #e3f2ef;
  --primary-ink: #0b5249;
  --on-primary: #fff;
  --focus: #1d63d6;

  --ok-ink: #0b5d0b;   --ok-soft: #e4f4e4;
  --warn-ink: #6f4a00; --warn-soft: #fff3d1;
  --danger: #b42318;   --danger-ink: #9b1c1c; --danger-soft: #fdecea;
  --info-ink: #1c4f8a; --info-soft: #e8f1fc;
  --neutral-soft: #eef1ef;

  /* الرسوم (لوحة dataviz المعتمدة + لوحة الحالة) */
  --series-pre: #8a8983;
  --series-post: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --planned: #2a78d6;
  --cancelled: #c3c2b7;
  --track: #eff1ef;
  --ref: #a3a9a5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 2px 6px rgba(16, 24, 20, .04);
  --sidebar-w: 268px;
  --font: "Nafes Arabic", "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
img, svg { display: inline-block; vertical-align: middle; }
a { color: var(--primary-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
code, .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.pre-line { white-space: pre-line; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; inset-inline-start: 12px; inset-block-start: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { inset-block-start: 12px; }

.demo-banner {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 6px 16px; font-size: .85rem; background: var(--warn-soft); color: var(--warn-ink);
  border-block-end: 1px solid #f1dfa8; text-align: center;
}

/* شريط الدعم الفني: مالك المنصة داخل مدرسة غير مدرسته */
.support-banner {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center;
  padding: 8px 16px; font-size: .9rem; background: var(--info-soft); color: var(--info-ink);
  border-block-end: 1px solid var(--border); text-align: center;
}
.support-banner .inline-form { margin: 0; }

/* ───────── الإطار ───────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; inset-block-start: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; background: var(--surface);
  border-inline-end: 1px solid var(--border);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-weight: 800; font-size: 1.08rem; }
.brand-slogan { font-size: .74rem; color: var(--muted); }
.nav { padding: 4px 10px 16px; flex: 1; }
.nav-group { margin-block-start: 8px; }
.nav-group-title { font-size: .74rem; font-weight: 700; color: var(--muted); padding: 0 10px 4px; letter-spacing: 0; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; min-height: 40px;
}
.nav-link:hover { background: var(--neutral-soft); color: var(--ink); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; }
.nav-link.is-soon { color: var(--muted); }
.soon-tag {
  margin-inline-start: auto; font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: var(--neutral-soft); color: var(--muted);
}
.sidebar-foot { border-block-start: 1px solid var(--border); padding: 12px 14px 16px; }
.user-card { display: flex; gap: 10px; align-items: center; margin-block-end: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; flex: none;
}
.user-name { font-weight: 600; font-size: .9rem; }
.user-role { font-size: .78rem; color: var(--muted); }
.user-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.icon-btn.nav-close { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; inset-block-start: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 8px 24px; background: rgba(255, 255, 255, .92);
  border-block-end: 1px solid var(--border); backdrop-filter: blur(6px);
}
.topbar-title { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.topbar-title .school { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title .year { font-size: .78rem; color: var(--muted); }
.topbar-user { margin-inline-start: auto; }
.role-chip { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); white-space: nowrap; }
.icon-btn.menu-btn { display: none; }
.content { width: 100%; max-width: 1240px; margin-inline: auto; padding: 24px; }
.backdrop { display: none; }
.bottom-nav { display: none; }

/* ───────── عناصر عامة ───────── */
.page-header { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; margin-block-end: 18px; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-block-end: 16px; min-width: 0;
}
.card > h2 { margin-block-end: 12px; }
.card-head { margin-block-end: 14px; }
.card-head h2 > .icon:first-child { margin-inline-end: 8px; vertical-align: -3px; color: var(--primary); }
.card-sub { color: var(--muted); font-size: .85rem; margin: 2px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card { margin-block-end: 0; }
.grid-2 + .grid-2 { margin-block-start: 16px; }
.note { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); margin: 8px 0 0; }
.note-card p { font-size: .92rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer; text-decoration: none;
  background: transparent; color: var(--ink-2); white-space: nowrap;
}
.btn-sm { min-height: 36px; padding: 5px 10px; font-size: .86rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-ink); }
.btn-secondary:hover { background: #d3ebe6; }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--neutral-soft); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1b12; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--neutral-soft); }
.link-btn { border: 0; background: none; color: var(--primary-ink); font: inherit; text-decoration: underline; cursor: pointer; padding: 8px; }
.inline-form { display: inline; margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.badge-ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge-muted { background: var(--neutral-soft); color: var(--ink-2); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-info { background: var(--info-soft); color: var(--info-ink); }
.level-mastered { background: var(--ok-soft); color: var(--ok-ink); }
.level-reinforce { background: var(--warn-soft); color: var(--warn-ink); }
.level-support { background: var(--danger-soft); color: var(--danger-ink); }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  margin-block-end: 16px; border: 1px solid transparent; font-size: .95rem;
}
.alert .icon { flex: none; margin-block-start: 2px; }
.alert > div > :last-child { margin-block-end: 0; }
.alert-success { background: var(--ok-soft); color: var(--ok-ink); border-color: #c7e6c7; }
.alert-error { background: var(--danger-soft); color: var(--danger-ink); border-color: #f5c9c4; }
.alert-info { background: var(--info-soft); color: var(--info-ink); border-color: #cfe0f6; }
.alert-warning { background: var(--warn-soft); color: var(--warn-ink); border-color: #f1dfa8; }

.empty { text-align: center; padding: 40px 16px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); margin-block-end: 16px; }
.card .empty { border: 0; padding: 24px 8px; margin: 0; }
.empty-icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty h2 { margin-block-end: 6px; }
.empty p { color: var(--muted); max-width: 46ch; margin-inline: auto; }

/* ───────── النماذج ───────── */
.form { display: block; }
.form.narrow { max-width: 460px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.form-grid.three { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.field { margin-block-end: 16px; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; font-size: .92rem; margin-block-end: 6px; color: var(--ink); }
.req { color: var(--danger); margin-inline-start: 3px; }
input[type="text"], input[type="search"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], input[type="url"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .18); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field input[type="file"] { width: 100%; min-height: 44px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; }
.field label.check { display: flex; font-weight: 400; margin-block: 8px 0; }
.hint { font-size: .82rem; color: var(--muted); margin: 5px 0 0; }
.error { font-size: .85rem; color: var(--danger); margin: 5px 0 0; font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 8px; }
fieldset.checks { border: 0; padding: 0; margin: 0 0 16px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.password-wrap { position: relative; }
.password-wrap input { padding-left: 50px; }
.password-wrap .icon-btn { position: absolute; left: 2px; top: 50%; transform: translateY(-50%); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-inline-start: 40px; }

.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)) auto; gap: 0 12px; align-items: end; padding-block-end: 4px; }
.filters .field { margin-block-end: 16px; }
.filter-actions { display: flex; gap: 6px; margin-block-end: 16px; }

/* ───────── الجداول ───────── */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { padding: 12px 16px; text-align: start; border-block-end: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: .82rem; font-weight: 700; color: var(--ink-2); background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover { background: #fafcfb; }
.table tbody th { font-weight: 600; }
.table.compact th, .table.compact td { padding: 8px 10px; font-size: .88rem; }
.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.row-link:hover { color: var(--primary-ink); text-decoration: underline; }
.row-actions { white-space: nowrap; text-align: end; }
.row-actions > * { vertical-align: middle; }
.mobile-meta { display: none; }
.pager { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: .88rem; }
.pager-links { display: flex; align-items: center; gap: 6px; }
.pager-cur { color: var(--ink-2); }

/* ───────── لوحة المؤشرات ───────── */
.stepper {
  list-style: none; margin: 0 0 18px; padding: 12px 14px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.step { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); min-width: 0; }
.step-dot {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; background: var(--neutral-soft); color: var(--ink-2);
}
.step.done .step-dot { background: var(--primary); color: var(--on-primary); }
.step.done { color: var(--ink); }
.step.current .step-dot { background: #fff; color: var(--primary-ink); box-shadow: inset 0 0 0 2px var(--primary); }
.step.current { color: var(--primary-ink); font-weight: 700; }
.step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 12px; margin-block-end: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { font-size: .88rem; color: var(--ink-2); font-weight: 600; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.25; margin-block: 4px 2px; }
.kpi-sub { font-size: .8rem; color: var(--muted); line-height: 1.5; }

/* ───────── الرسوم ───────── */
.chart { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; padding: 0; list-style: none; font-size: .85rem; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-counts .legend-item strong { color: var(--ink); margin-inline-start: 2px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-note { font-size: .78rem; color: var(--muted); margin: 0 0 10px; }
.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-group-label { font-weight: 600; font-size: .92rem; margin-block-end: 4px; }
.bar-row { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 3.6rem; align-items: center; gap: 10px; }
.bar-row + .bar-row { margin-block-start: 4px; }
.bar-key { font-size: .78rem; color: var(--muted); }
.bar-val { font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: end; }
.skill-row .bar-row { grid-template-columns: minmax(0, 1fr) 3.6rem auto; }
.skill-head { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; margin-block-end: 4px; }
.skill-name { font-weight: 600; font-size: .92rem; }
.skill-meta { font-size: .76rem; color: var(--muted); }
.hbar, .stack { display: block; overflow: visible; }
.track { fill: var(--track); }
.ref-line { stroke: var(--ref); stroke-width: 1; }
.seg { stroke: var(--surface); stroke-width: 2; }
.fill-pre { fill: var(--series-pre); background: var(--series-pre); }
.fill-post { fill: var(--series-post); background: var(--series-post); }
.fill-mastered { fill: var(--good); background: var(--good); }
.fill-reinforce { fill: var(--warning); background: var(--warning); }
.fill-support { fill: var(--critical); background: var(--critical); }
.fill-done { fill: var(--good); background: var(--good); }
.fill-planned { fill: var(--planned); background: var(--planned); }
.fill-postponed { fill: var(--warning); background: var(--warning); }
.fill-cancelled { fill: var(--cancelled); background: var(--cancelled); }
.stack { border-radius: 4px; margin-block-end: 12px; }
.table-view { margin-block-start: 12px; font-size: .88rem; }
.table-view summary { cursor: pointer; color: var(--primary-ink); font-weight: 600; width: fit-content; padding: 4px 0; }
.table-view .table { margin-block-start: 8px; }

/* ───────── الفصول والطلاب ───────── */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.class-card { margin: 0; display: flex; flex-direction: column; }
.class-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-block-end: 6px; }
.class-count { color: var(--muted); font-size: .9rem; }
.class-count strong { color: var(--ink); font-size: 1.3rem; }
.class-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: auto; padding-block-start: 8px; }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.dl > div { min-width: 0; }
.dl .full { grid-column: 1 / -1; }
.dl dt { font-size: .8rem; color: var(--muted); }
.dl dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.result-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.result-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.result-title { font-weight: 600; }
.result-score { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block: 4px; }
.result-score strong { font-size: 1.2rem; }
.result-weak { font-size: .86rem; margin: 0; }
.temp-pass-value code { display: inline-block; font-size: 1.5rem; letter-spacing: .08em; padding: 8px 16px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); user-select: all; }

/* ───────── صفحات الدخول ───────── */
body.auth { background: linear-gradient(180deg, #e7f3f0 0%, var(--bg) 320px); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 30px rgba(16, 24, 20, .08); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-block-end: 20px; }
.auth-brand .brand-name { font-size: 1.3rem; }
.auth-title { font-size: 1.25rem; margin-block-end: 16px; }
.auth-foot { font-size: .8rem; color: var(--muted); margin-block-start: 16px; text-align: center; }
.auth-alt { text-align: center; margin-block-start: 8px; }
.demo-accounts { margin-block-start: 20px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: .88rem; }
.demo-accounts h2 { font-size: .92rem; margin-block-end: 6px; }
.demo-accounts ul { margin: 0; padding-inline-start: 18px; }
.demo-accounts p { margin-block-end: 6px; }

/* ───────── نافذة التأكيد ───────── */
.confirm-dialog { border: 0; border-radius: 14px; padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0, 0, 0, .2); color: var(--ink); }
.confirm-dialog::backdrop { background: rgba(15, 23, 20, .45); }
.confirm-dialog h2 { margin-block-end: 8px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-start; margin-block-start: 16px; }

/* ───────── المرحلة 3: القياس التشخيصي وخريطة المهارات ───────── */
.section-title { font-size: 1rem; color: var(--ink-2); margin: 4px 0 10px; }
.kpi .kpi-value-text { display: block; font-size: 1.05rem; line-height: 1.45; margin-block: 6px 4px; color: var(--primary-ink); text-decoration: none; font-weight: 700; }
.kpi-value-text:hover { text-decoration: underline; }
.kpi-levels { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-block: 8px 4px; }
.kpi-levels span { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--ink-2); }
.kpi-levels strong { font-size: 1.45rem; color: var(--ink); margin-inline-start: 2px; }
.kpi-levels .level-dot-label { font-size: 0; gap: 0; }
.kpi-levels .level-dot-label .dot { margin: 0; }

.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; margin-inline-end: 6px; vertical-align: middle; box-shadow: 0 0 0 2px var(--surface); }
.dot-mastered { background: var(--good); }
.dot-reinforce { background: var(--warning); }
.dot-support { background: var(--critical); }
.level-dot-label { display: inline-flex; align-items: center; white-space: nowrap; font-weight: 600; font-size: .9rem; }
.levels-inline { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 1.1rem; }
.levels-inline > span { display: inline-flex; align-items: center; }
.levels-inline .level-dot-label { font-size: 0; }
.levels-inline .level-dot-label .dot { margin-inline-end: 4px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-block-end: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.stat-value { font-size: 1.4rem; font-weight: 700; }
.stat-value small { font-size: .85rem; color: var(--muted); font-weight: 500; }

.tabs { display: flex; gap: 4px; border-block-end: 1px solid var(--border); margin-block-end: 16px; overflow-x: auto; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; min-height: 44px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; border-block-end: 3px solid transparent; margin-block-end: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary-ink); border-block-end-color: var(--primary); }
.tab-count { font-size: .76rem; padding: 0 7px; border-radius: 999px; background: var(--neutral-soft); color: var(--ink-2); }

fieldset.radios { border: 0; padding: 0; margin: 0 0 16px; }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.radios.inline .radio-grid { display: flex; flex-wrap: wrap; }
.radios.inline .check { min-width: 110px; }
.check input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.field-label { display: block; font-weight: 600; font-size: .92rem; margin-block-end: 6px; }
.static-value { margin: 0; min-height: 44px; display: flex; align-items: center; padding: 9px 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

.skill-group { margin-block-end: 12px; }
.skill-group[hidden] { display: none; }
.skill-group-title { font-size: .85rem; font-weight: 700; color: var(--ink-2); margin-block-end: 6px; }
[data-mode][hidden], [data-type][hidden], .field[hidden] { display: none; }

.grid-2.top { margin-block-end: 16px; }
.big-line { font-size: 1rem; }
.big-line strong { font-size: 1.3rem; }
.progress { margin-block: 8px 12px; }
.progress-svg { display: block; }
.coverage { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.coverage li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9rem; }
.coverage li.warn { background: var(--warn-soft); color: var(--warn-ink); }
.cov-name { font-weight: 600; }
.cov-meta { color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.coverage li.warn .cov-meta { color: var(--warn-ink); }

.question-list, .answer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.question-item, .answer-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.answer-item.pending { border-inline-start: 4px solid var(--border-strong); }
.answer-item.has-error { border-color: var(--danger); }
.q-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block-end: 6px; }
.q-num { font-weight: 800; color: var(--primary-ink); background: var(--primary-soft); border-radius: 8px; padding: 1px 9px; }
.q-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.q-text { font-weight: 600; margin-block-end: 8px; white-space: pre-line; }
.q-options { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.q-options li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .92rem; }
.q-options li.correct { border-color: var(--good); background: var(--ok-soft); }
.opt-letter { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--neutral-soft); font-weight: 700; font-size: .82rem; flex: none; }
.correct .opt-letter { background: var(--good); color: #fff; }
.correct-mark { color: var(--ok-ink); margin-inline-start: auto; }
.q-model, .q-note { font-size: .88rem; margin: 4px 0 0; }
.q-note { color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; }
.q-actions { display: flex; gap: 6px; margin-block-start: 8px; }

.options-set { border: 0; padding: 0; margin: 0 0 16px; }
.option-row { display: flex; align-items: center; gap: 8px; margin-block-end: 8px; }
.option-row input[type="text"] { flex: 1; }
.option-correct { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-height: 44px; padding-inline: 4px; }
.option-correct input { width: 20px; height: 20px; accent-color: var(--good); }

.choice-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.choice { position: relative; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice-letter { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--neutral-soft); font-weight: 800; flex: none; }
.choice:has(input:checked) .choice-letter { background: var(--primary); color: var(--on-primary); }
.choice-text { font-size: .92rem; line-height: 1.4; }
.choice-none { border-style: dashed; color: var(--ink-2); }
.key-mark { margin-inline-start: auto; color: var(--ok-ink); display: inline-flex; }
.open-answer label { display: block; font-weight: 600; font-size: .9rem; margin-block-end: 6px; }
.open-answer input { max-width: 180px; }

.entry-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.entry-layout > .card { margin: 0; }
.entry-layout .result-card { position: sticky; inset-block-start: 76px; }
.result-top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-block-end: 12px; }
.result-total { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.result-percent { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.skill-result td, .skill-result th { font-size: .9rem; }
.student-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin-block-end: 16px; }
.jump-form select { min-height: 40px; }
.crumbs { margin: 0 0 4px; font-size: .88rem; }
.crumbs a { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.sticky-actions { position: sticky; inset-block-end: 0; background: linear-gradient(to top, var(--surface) 70%, transparent); padding-block: 12px 4px; z-index: 5; }

.card-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg-toggle a { padding: 6px 12px; min-height: 36px; display: inline-flex; align-items: center; text-decoration: none; color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.seg-toggle a.active { background: var(--primary); color: var(--on-primary); }
.dist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-block-start: 6px; }
.dist-bar { display: block; border-radius: 4px; }
.dist-text { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.map-grid { align-items: start; }

.priority-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.priority { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); border-inline-start: 4px solid var(--border-strong); }
.priority.top { border-inline-start-color: var(--critical); background: #fffafa; }
.priority-list.compact .priority { padding: 10px 12px; }
.rank-label { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--ink-2); background: var(--neutral-soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.priority.top .rank-label { background: var(--danger-soft); color: var(--danger-ink); }
.priority-title { margin-block-end: 4px; }
.priority-metrics { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; color: var(--ink-2); }
.priority-metrics strong { color: var(--ink); }
.priority-action { font-size: .88rem; margin: 6px 0 0; }
.priority-students { font-size: .86rem; margin-block-start: 6px; }
.priority-students summary { cursor: pointer; color: var(--primary-ink); font-weight: 600; }
.priority-students p { margin: 6px 0 0; }
.method { margin-block-start: 12px; font-size: .88rem; color: var(--ink-2); }
.method summary { cursor: pointer; color: var(--primary-ink); font-weight: 600; }

.student-card { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.student-id { display: flex; gap: 14px; align-items: center; min-width: 0; }
.avatar.big { width: 52px; height: 52px; font-size: 1.3rem; }
.inline-dl { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 0; font-size: .9rem; }
.inline-dl dt { display: inline; color: var(--muted); }
.inline-dl dt::after { content: ": "; }
.inline-dl dd { display: inline; margin: 0; font-weight: 600; }
.student-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.student-stats .stat { min-width: 150px; }
.inline-select { display: flex; align-items: flex-end; gap: 6px; }
.inline-select .field { margin: 0; min-width: 220px; }
.skill-map-table .group-row th { background: var(--surface-2); font-size: .84rem; color: var(--ink-2); font-weight: 700; }
.skill-map-table td.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.needs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.needs-list li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.needs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-end: 4px; }
.needs-list p { margin: 0; font-size: .9rem; color: var(--ink-2); }

.filters-3 { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; }
.filters-2 { grid-template-columns: repeat(2, minmax(150px, 1fr)) auto; }
.domain-card .domain-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; margin-block-end: 12px; }
.domain-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cell-sub { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; margin-block-start: 2px; }
.clamp { font-size: .86rem; color: var(--ink-2); max-width: 32ch; }
.row-muted th, .row-muted td { color: var(--muted); }
.danger-zone h2 { font-size: 1rem; }

/* ───────── الشاشات المتوسطة والصغيرة ───────── */
@media (max-width: 1100px) {
  .filters, .filters-3, .filters-2, .filters-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .field.grow { grid-column: 1 / -1; }
  .filter-actions { flex-wrap: wrap; }
}
@media (max-width: 1023px) {
  .entry-layout { grid-template-columns: minmax(0, 1fr); }
  .entry-layout .result-card { position: static; order: -1; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  /* القائمة الجانبية تنزلق عموديًا وتختفي بالكامل عند الإغلاق:
     الإزاحة الأفقية خارج الشاشة كانت تضيف تمريرًا أفقيًا وهميًا في اتجاه RTL. */
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; width: min(86vw, 310px);
    transform: translateY(-8px); opacity: 0; visibility: hidden; box-shadow: none; height: 100%;
    transition: transform .2s ease, opacity .2s ease, visibility 0s linear .2s;
  }
  body.nav-open .sidebar {
    transform: none; opacity: 1; visibility: visible; box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
    transition: transform .2s ease, opacity .2s ease;
  }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 20, .4); }
  body.nav-open { overflow: hidden; }
  .icon-btn.nav-close { display: inline-grid; }
  .icon-btn.menu-btn { display: inline-grid; margin-inline-start: -8px; }
  .topbar { padding: 6px 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > .card + .card { margin-block-start: 0; }
}
@media (max-width: 767px) {
  body.app { padding-block-end: 72px; }
  .content { padding: 16px; }
  h1 { font-size: 1.3rem; }
  .card { padding: 16px; }
  .topbar-user { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40;
    background: var(--surface); border-block-start: 1px solid var(--border); padding-block-end: env(safe-area-inset-bottom);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px;
    font: inherit; font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer;
  }
  .bottom-nav .active { color: var(--primary-ink); }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px; }
  .step { font-size: .78rem; gap: 6px; }
  .step-dot { width: 22px; height: 22px; font-size: .72rem; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 1.5rem; }
  .filters, .filters-3, .filters-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; padding: 14px; }
  .choice-row, .q-options { grid-template-columns: minmax(0, 1fr); }
  .student-nav { grid-template-columns: auto minmax(0, 1fr) auto; }
  .student-nav .btn { padding-inline: 8px; }
  .dist-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .priority { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .result-total { align-items: flex-start; }
  .inline-select { width: 100%; }
  .inline-select .field { min-width: 0; flex: 1; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 1.2rem; }
  .table.skill-map-table .hide-sm { display: none; }
  .filters .field { margin-block-end: 10px; }
  .filters .field label { font-size: .84rem; margin-block-end: 4px; }
  .filter-actions { margin-block-end: 10px; align-self: end; }
  .filter-actions .btn { flex: 1; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .auth-card { padding: 22px 18px; }

  /* الجداول تتحول إلى بطاقات */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td, .table.responsive th { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 14px; border-block-end: 1px solid var(--border); }
  .table.responsive th, .table.responsive td { border: 0; padding: 3px 0; }
  .table.responsive tbody th { font-size: 1rem; margin-block-end: 4px; }
  .table.responsive td[data-label] { display: flex; justify-content: space-between; gap: 12px; }
  .table.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .84rem; font-weight: 500; }
  .table.responsive td.row-actions { text-align: start; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; padding-block-start: 6px; }
  .table.responsive td.hide-sm[data-label] { display: none; }
  .mobile-meta { display: block; font-size: .84rem; font-weight: 400; color: var(--muted); margin-block-start: 2px; }
}
@media (max-width: 380px) {
  .skill-row .bar-row { grid-template-columns: minmax(0, 1fr) 3.4rem; }
  .skill-row .bar-row .badge { grid-column: 1 / -1; justify-self: start; }
  .kpi-label { font-size: .82rem; }
}
@media (max-width: 340px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
}

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

@media print {
  .sidebar, .topbar, .bottom-nav, .demo-banner, .page-actions, .row-actions, .table-view summary { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}
.level-counts { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.lc { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.lc .dot { margin: 0; }
.lc strong { font-size: 1.3rem; color: var(--ink); margin-inline-start: 2px; }
.stat-wide { grid-column: span 2; }
.link-btn.small { font-size: .8rem; padding: 2px 6px; font-weight: 600; }
.more-priorities { margin-block-start: 10px; }
.more-priorities > summary { cursor: pointer; color: var(--primary-ink); font-weight: 600; margin-block-end: 8px; }
.skill-map-table td, .skill-result td { white-space: nowrap; width: 1%; }
@media (max-width: 1023px) {
  .map-grid > #priorities { order: -1; }
}
@media (max-width: 767px) {
  .sticky-actions { inset-block-end: calc(60px + env(safe-area-inset-bottom)); }
  .stat-wide { grid-column: 1 / -1; }
  .lc strong { font-size: 1.15rem; }
  .tabs .tab { flex: 1 1 auto; justify-content: center; padding: 8px 6px; font-size: .86rem; }
  .skill-map-table th, .skill-map-table td, .skill-result th, .skill-result td { padding: 10px 8px; }
}
[hidden] { display: none !important; }

/* ═══════════ مركز التقارير وExcel ═══════════ */
.filters-4 { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; }
.report-filters { padding-block-end: 6px; }
.report-filters > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; margin: -4px 0 0; padding-block: 4px; }
.report-filters > summary::-webkit-details-marker { display: none; }
.report-filters > summary .muted { font-size: .84rem; margin-inline-start: auto; }
.report-filters > summary::after { content: '▾'; color: var(--muted); }
.report-filters[open] > summary { margin-block-end: 12px; }
.report-filters[open] > summary::after { content: '▴'; }
.export-all { white-space: normal; flex-wrap: wrap; text-align: center; height: auto; padding-block: 10px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; align-items: end; }
.filters-grid .field { margin-block-end: 12px; }
.filters-grid .field .hint { font-size: .75rem; margin-block-start: 2px; }
.report-filters .filter-actions { margin-block: 4px 10px; flex-wrap: wrap; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-block-end: 16px; }
.report-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); min-height: 104px;
}
.report-card:hover { border-color: var(--primary); background: #fbfdfc; }
.report-card-icon { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.report-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.report-card-body strong { font-size: 1rem; }
.report-card-body span { font-size: .84rem; color: var(--muted); line-height: 1.55; }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; font-size: .88rem; padding: 12px 16px; }
.report-meta span { display: inline-flex; align-items: center; gap: 6px; }
.report-meta .icon { color: var(--primary); }
.report-block { margin-block-end: 16px; }
.report .kpi-grid { margin-block-end: 0; }
.kpi-empty { font-size: .86rem; color: var(--muted); font-weight: 600; margin-block: 8px 2px; line-height: 1.5; }
.no-data { color: var(--muted); font-weight: 600; margin: 4px 0; }
.report-list { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.report-list li { line-height: 1.7; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-block { padding-inline: 0; padding-block-end: 4px; }
.table-block > .card-head, .table-block > .no-data, .table-block > p { padding-inline: 18px; }
.report-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-table td[data-label="التاريخ"], .report-table td[data-label*="تاريخ"], .report-table td[data-label="موعد التسليم"] { white-space: nowrap; }
.report-table tbody th { min-width: 9rem; }
.report-table th, .report-table td { padding: 10px 14px; }
.report-print-head { display: none; }
.small { font-size: .84rem; }
.btn-lg { min-height: 52px; font-size: 1.02rem; padding-inline: 20px; }
.btn small { font-weight: 500; opacity: .9; }
.export-all { width: 100%; justify-content: center; margin-block: 6px 14px; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.export-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink); background: var(--surface-2);
}
.export-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.export-item .icon { color: var(--primary); flex: none; margin-block-start: 2px; }
.export-item span { display: flex; flex-direction: column; gap: 2px; }
.export-item small { color: var(--muted); font-size: .8rem; }
.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-block-end: 16px; }
.import-grid > .card { margin-block-end: 0; }
.import-card h3 { font-size: 1.05rem; margin-block-end: 6px; }
.import-steps { margin: 0 0 12px; padding-inline-start: 20px; font-size: .86rem; color: var(--ink-2); }
.import-card .inline-select { flex-wrap: wrap; margin-block-end: 12px; }
.import-card .inline-select .field { flex: 1; min-width: 200px; }
.upload-form { border-block-start: 1px dashed var(--border-strong); padding-block-start: 12px; }
.upload-form input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; }
.col-check { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.col-check li { display: block; font-size: .9rem; line-height: 1.7; }
.col-check li .icon { vertical-align: -3px; margin-inline-end: 6px; }
.col-check .col-status { color: var(--ink-2); }
.col-check li.bad .col-status { color: inherit; }
.col-check li.ok .icon { color: var(--good); }
.col-check li.bad { color: var(--danger-ink); font-weight: 600; }
.col-check li.opt { color: var(--muted); }
.err-list { margin: 0; padding-inline-start: 18px; color: var(--danger-ink); }
.preview-table td, .preview-table th { white-space: nowrap; font-size: .86rem; padding: 8px 10px; }
.preview-table td.small { white-space: normal; min-width: 220px; }
.row-error td, .row-error th { background: var(--danger-soft); }
.stat-bad { border-color: #f3b4ae; background: var(--danger-soft); }
.stat-bad .stat-value { color: var(--danger-ink); }
@media (max-width: 1023px) {
  .import-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .filters-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; padding: 14px; }
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
  .filters-grid > .field:has(select[name="school"]) { grid-column: 1 / -1; }
  .filters-grid input[type="date"] { font-size: .9rem; padding-inline: 8px; }
  .report-cards { grid-template-columns: minmax(0, 1fr); }
  .report-card { min-height: 0; }
  .report-meta { gap: 4px 14px; font-size: .82rem; }
  .table-block > .card-head, .table-block > .no-data, .table-block > p { padding-inline: 16px; }
  .report-table.responsive td.num { white-space: normal; }
  .export-grid { grid-template-columns: minmax(0, 1fr); }
  .col-check { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body.app { padding: 0; }
  .content { padding: 0; }
  .report-filters, .page-header .page-actions, .flash, .alert-warning, .skip-link, .table-view, .confirm-dialog { display: none !important; }
  .report-print-head { display: flex; gap: 10px; align-items: center; border-block-end: 2px solid var(--primary); padding-block-end: 8px; margin-block-end: 10px; font-size: .9rem; }
  .page-header { margin-block-end: 8px; }
  .page-sub { display: none; }
  .report-block, .kpi, .table-block tr { break-inside: avoid; }
  .report h2, .report h3, .section-title { break-after: avoid; }
  .bar-group, .chart-legend, .chart-note { break-inside: avoid; }
  .table-block { break-inside: auto; }
  .table.responsive thead { display: table-header-group !important; }
  .table.responsive { display: table !important; width: 100%; }
  .table.responsive tbody { display: table-row-group !important; }
  .table.responsive tr { display: table-row !important; padding: 0 !important; }
  .table.responsive th, .table.responsive td { display: table-cell !important; padding: 4px 6px !important; font-size: 9pt; }
  .table.responsive td[data-label]::before { content: none !important; }
  .table-scroll { overflow: visible; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px; }
  .kpi { padding: 8px 10px; }
  .kpi-value { font-size: 1.2rem; }
  /* الجداول المتجاورة تُطبع واحدًا تحت الآخر كي لا تُقص أعمدتها */
  .grid-2 { display: block !important; }
  .grid-2 > * + * { margin-block-start: 10px; }
  .table th, .table td { white-space: normal; }
  a { color: inherit; text-decoration: none; }
}

/* ═══════════════════════════════════════════════════════════
   المرحلة 5 — الهوية البصرية وتجربة الاستخدام
   خط عربي موحد (يُضمَّن إن وُجد في public/fonts، وإلا خطوط النظام)،
   شريط علوي ببحث موحد، بطاقات التنبيهات، شبكة العمل اليومي،
   صفحة الطالب المتكاملة، البحث، مكتبة المحتوى، وحالات التحميل.
   ═══════════════════════════════════════════════════════════ */

:root {
  --ink-3: #5c6763;
  --brand-tint: #f2f8f7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 20, .06);
  --high-ink: #9b1c1c;   --high-soft: #fdecea;   --high-bar: #d03b3b;
  --medium-ink: #6f4a00; --medium-soft: #fff8e8; --medium-bar: #e0a107;
  --low-ink: #1c4f8a;    --low-soft: #eff5fd;    --low-bar: #2a78d6;
}

/* أرقام واضحة ومتساوية العرض في كل ما يُقرأ كرقم */
.kpi-value, .stat-value, .attn-count, .table td.num, .bar-val, .result-score strong, .priority-metrics strong { font-variant-numeric: tabular-nums; }

/* ───────── الشريط العلوي: البحث الموحد والتنبيهات ───────── */
.topbar { gap: 10px; }
.topbar-search { position: relative; flex: 1 1 320px; max-width: 460px; margin-inline-start: 8px; display: flex; align-items: center; }
.topbar-search .search-icon { position: absolute; inset-inline-start: 12px; color: var(--muted); display: inline-flex; pointer-events: none; }
.topbar-search input[type="search"] {
  width: 100%; min-height: 40px; padding-inline: 38px 40px; font-size: .95rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.topbar-search input[type="search"]:focus { background: var(--surface); }
.search-kbd {
  position: absolute; inset-inline-end: 12px; font-size: .74rem; color: var(--muted); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 0 6px; line-height: 1.5; background: var(--surface); font-family: inherit;
}
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.topbar-search-link { display: none; }
.nav-link .view-tag { background: var(--info-soft); color: var(--info-ink); }

/* ───────── إجراءات سريعة ───────── */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 18px; }
.quick-actions .btn { min-height: 42px; }
.panel-more { margin: 4px 0 18px; }
.panel-more a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--primary-ink); }

/* ───────── «ماذا يحتاج إلى انتباهك اليوم؟» ───────── */
.section-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.section-head .section-title { display: inline-flex; align-items: center; gap: 8px; font-size: 1.12rem; color: var(--ink); font-weight: 700; }
.section-head .section-title .icon { color: var(--primary); }
.attn-section { margin-block-end: 20px; }
.attn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.attn-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-inline-start: 4px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.attn-head { display: flex; align-items: flex-start; gap: 10px; }
.attn-icon { flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--neutral-soft); color: var(--ink-2); }
.attn-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attn-title h3 { font-size: 1rem; margin: 0; }
.attn-sev { font-size: .74rem; font-weight: 700; }
.attn-count { margin-inline-start: auto; font-size: 1.6rem; font-weight: 800; line-height: 1; }
.attn-detail { font-size: .88rem; color: var(--ink-3); margin: 0; line-height: 1.6; }
.attn-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.attn-items li { overflow-wrap: anywhere; }
.attn-action { align-self: flex-start; margin-block-start: auto; }
.attn-high { border-inline-start-color: var(--high-bar); }
.attn-high .attn-icon { background: var(--high-soft); color: var(--high-ink); }
.attn-high .attn-sev, .attn-high .attn-count { color: var(--high-ink); }
.attn-medium { border-inline-start-color: var(--medium-bar); }
.attn-medium .attn-icon { background: var(--medium-soft); color: var(--medium-ink); }
.attn-medium .attn-sev, .attn-medium .attn-count { color: var(--medium-ink); }
.attn-low { border-inline-start-color: var(--low-bar); }
.attn-low .attn-icon { background: var(--low-soft); color: var(--low-ink); }
.attn-low .attn-sev, .attn-low .attn-count { color: var(--low-ink); }

/* ───────── شبكة العمل اليومي ───────── */
.focus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-block-end: 20px; align-items: start; }
.focus-card { margin-block-end: 0; }
.card-head-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; justify-content: space-between; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mini-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 0; font-size: .92rem;
  border-block-end: 1px solid var(--border);
}
.mini-list li:last-child { border-block-end: 0; padding-block-end: 0; }
.mini-list li > a { font-weight: 600; text-decoration: none; color: var(--ink); }
.mini-list li > a:hover { color: var(--primary-ink); text-decoration: underline; }
.mini-note { font-size: .82rem; }
.mini-list .badge, .mini-list .mini-note + .badge { margin-inline-start: auto; }
.kpi-inline { margin-block-end: 12px; }
.kpi-inline .kpi { border: 0; box-shadow: none; padding: 0; background: none; }

/* ───────── صفحة الطالب: مركز متكامل ───────── */
.hub-tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-block-end: 4px; margin-block-end: 16px;
  border-block-end: 1px solid var(--border);
}
.hub-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 40px; white-space: nowrap;
  font-size: .9rem; font-weight: 600; color: var(--ink-2); text-decoration: none; border-radius: 999px; background: var(--surface-2);
}
.hub-tab:hover { background: var(--primary-soft); color: var(--primary-ink); }
.hub-tab:target, .hub-tab.active { background: var(--primary-soft); color: var(--primary-ink); }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.hub-grid > .card { margin-block-end: 16px; }
.hub-panel { scroll-margin-block-start: 80px; }
.hub-panel:target { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.content-list li { gap: 6px; }
.content-list .icon { color: var(--primary); flex: none; }

.content-filters { display: block; padding-block-end: 4px; }
.content-filters .filters-grid { align-items: end; }
.content-filters .filter-actions { margin-block: 0 12px; flex-wrap: wrap; }

/* ───────── البحث الموحد ───────── */
.search-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.search-form .field { flex: 1 1 260px; margin-block-end: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 14px; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: 999px; font-size: .88rem;
  font-weight: 600; text-decoration: none; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border);
}
.chip:hover { border-color: var(--primary); color: var(--primary-ink); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.list-count { margin-block: -6px 10px; font-size: .88rem; }

/* ───────── المساعد الذكي (1.9) ───────── */
.ai-chat { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.ai-log { display: flex; flex-direction: column; gap: 12px; min-block-size: 220px; max-block-size: min(62vh, 640px); overflow-y: auto; padding: 4px 2px; overscroll-behavior: contain; }
.ai-msg { max-inline-size: min(100%, 720px); line-height: 1.75; }
.ai-msg p { margin: 0 0 6px; }
.ai-msg p:last-child { margin-block-end: 0; }
.ai-user { align-self: flex-start; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: var(--primary); color: var(--on-primary); white-space: pre-line; }
.ai-bot { align-self: flex-end; display: flex; gap: 10px; align-items: flex-start; inline-size: 100%; }
.ai-avatar { flex: none; inline-size: 30px; block-size: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-block-start: 2px; }
.ai-text { flex: 1; min-inline-size: 0; padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; }
.ai-text h3 { font-size: 1rem; margin: 8px 0 4px; }
.ai-text ul, .ai-text ol { margin: 4px 0 8px; padding-inline-start: 22px; }
.ai-text li { margin-block: 2px; }
.ai-student { font-weight: 600; }
.ai-typing { color: var(--muted); font-size: .9rem; padding-inline-start: 40px; }
.ai-typing p::after { content: ''; display: inline-block; inline-size: 1.2em; text-align: start; animation: ai-dots 1.2s steps(4, end) infinite; }
@keyframes ai-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .ai-typing p::after { animation: none; } }
.ai-proposal { margin-inline-start: 40px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.ai-proposal.is-done { border-style: solid; border-color: #c7e6c7; background: var(--ok-soft); }
.ai-proposal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-end: 8px; }
.ai-proposal-head .icon { color: var(--primary); }
.ai-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; margin: 0 0 10px; }
.ai-fields dt { font-size: .78rem; color: var(--muted); }
.ai-fields dd { margin: 0; font-size: .92rem; overflow-wrap: anywhere; }
.ai-proposal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-proposal-result { margin: 6px 0 0; font-size: .9rem; }
.ai-proposal-result:empty { display: none; }
.ai-proposal-result.error { color: var(--danger-ink); }
.ai-form { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: end; padding-block-start: 12px; border-block-start: 1px solid var(--border); }
.ai-form textarea { resize: vertical; min-block-size: 52px; }
.ai-suggest { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-suggest .chip { cursor: pointer; font-family: inherit; }
.ai-foot { margin: 0; font-size: .82rem; color: var(--muted); }
.ai-privacy > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.ai-privacy[open] > summary { margin-block-end: 8px; }
.ai-privacy ul { margin: 4px 0 10px; padding-inline-start: 22px; }
@media (max-width: 767px) {
  .ai-chat { padding: 12px; }
  .ai-log { max-block-size: 58vh; }
  .ai-proposal { margin-inline-start: 0; }
  .ai-form { grid-template-columns: 1fr; }
  .ai-form .btn[data-ai-send] { justify-content: center; }
}
.search-group { margin-block-end: 12px; }
.search-group h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; }
.search-group h2 .icon { color: var(--primary); }
.result-link { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; padding: 9px 0; text-decoration: none; color: var(--ink); border-block-end: 1px solid var(--border); }
.result-link:hover .result-label { color: var(--primary-ink); text-decoration: underline; }
.search-group li:last-child .result-link { border-block-end: 0; }
.result-label { font-weight: 600; }
.result-note { font-size: .84rem; }

/* ───────── مكتبة المحتوى والفيديوهات ───────── */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.content-card { margin-block-end: 0; display: flex; flex-direction: column; gap: 8px; }
.content-card.is-off { background: var(--surface-2); }
.content-head { display: flex; gap: 10px; align-items: flex-start; }
.content-kind { flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.content-title { min-width: 0; }
.content-title h3 { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.content-title .card-sub { margin: 2px 0 0; }
.content-desc { font-size: .9rem; color: var(--ink-3); margin: 0; }
.content-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.content-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: auto; padding-block-start: 4px; }
.content-foot { font-size: .78rem; margin: 0; }

/* ───────── حالات التحميل ───────── */
.route-progress {
  position: fixed; inset-block-start: 0; inset-inline: 0; height: 3px; z-index: 80; background: var(--primary);
  transform: scaleX(0); transform-origin: inline-start; transition: transform .25s ease, opacity .3s ease; opacity: 0;
}
body.is-loading .route-progress { opacity: 1; transform: scaleX(.75); }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy .icon, .btn.is-busy span { visibility: hidden; }
.btn.is-busy::after {
  content: ''; position: absolute; inset-block-start: calc(50% - 9px); inset-inline-start: calc(50% - 9px);
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-block-start-color: transparent;
  color: #fff; animation: spin .7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after { color: var(--primary-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::after { animation-duration: 2s; } }

/* ───────── شاشات ───────── */
@media (min-width: 768px) {
  .hub-tabs { flex-wrap: wrap; overflow: visible; }
}
@media (max-width: 1023px) {
  .topbar-search { flex: 1 1 auto; max-width: none; margin-inline-start: 0; }
  .search-kbd { display: none; }
  .hub-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .topbar-search { display: none; }
  .topbar-search-link { display: inline-grid; margin-inline-start: auto; }
  .topbar-actions { margin-inline-start: 0; }
  .topbar-title .year { display: none; }
  .topbar-actions .role-chip { display: none; }
  /* على الجوال: شبكة من عمودين بدل شريط يُقصّ آخره، والإجراء الأساسي بعرض كامل */
  .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions .btn { justify-content: center; font-size: .9rem; padding-inline: 10px; }
  .quick-actions .btn-primary { grid-column: 1 / -1; }
  .attn-grid, .focus-grid, .content-grid { grid-template-columns: minmax(0, 1fr); }
  .attn-count { font-size: 1.35rem; }
  .hub-tab { font-size: .84rem; padding-inline: 10px; }
  .mini-list li { padding-block: 10px; }
  .search-form .btn { width: 100%; }
}
@media print {
  .quick-actions, .attn-section, .hub-tabs, .topbar-search, .topbar-actions, .route-progress { display: none !important; }
  .focus-grid, .hub-grid, .content-grid, .attn-grid { display: block !important; }
  .focus-grid > *, .hub-grid > * { margin-block-end: 10px; }
}

/* ═══════════════ المرحلة 6: منظومة مشاركة الأسرة ═══════════════ */
.nowrap { white-space: nowrap; }
.chip-count {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding-inline: 6px; margin-inline-start: 6px;
  border-radius: 999px; font-size: .78rem; background: var(--neutral-soft); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.chip.active .chip-count { background: rgba(255, 255, 255, .22); color: #fff; }
.family-table td, .family-table th { vertical-align: top; }
@media (min-width: 1024px) { .kpi-grid.kpi-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.inline-filter { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding-block: 14px; }
.inline-filter .field { flex: 0 1 280px; margin-block-end: 0; }
.inline-filter .btn { min-height: 44px; }
.js .inline-filter [data-js-hide] { display: none; }
.family-hub > .card { min-height: 100%; }

.family-summary { margin-block-end: 12px; }
.mini-head { font-size: .92rem; margin-block: 4px 2px; color: var(--ink-2); }
.hub-panel .form-actions { flex-wrap: wrap; margin-block-start: 12px; }

/* سجل التواصل: خط زمني */
.timeline { list-style: none; margin: 0 0 12px; padding: 0; position: relative; }
.timeline-item {
  position: relative; padding: 10px 0 12px; padding-inline-start: 22px; border-block-end: 1px solid var(--border);
}
.timeline-item:last-child { border-block-end: 0; }
.timeline-item::before {
  content: ''; position: absolute; inset-inline-start: 4px; inset-block-start: 17px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.timeline-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.timeline-head .badge { margin-inline-start: auto; }
.timeline-body { margin: 4px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.timeline-next {
  display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 0; padding: 3px 10px; border-radius: 999px;
  font-size: .84rem; background: var(--info-soft); color: var(--info-ink);
}
.timeline-foot { margin: 4px 0 0; font-size: .78rem; }

/* نماذج قابلة للطي داخل البطاقات */
details.card > .summary-btn {
  display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 700; color: var(--primary-ink);
  list-style: none; border-radius: var(--radius-sm);
}
details.card > .summary-btn::-webkit-details-marker { display: none; }
details.card > .summary-btn::after { content: '▾'; margin-inline-start: auto; color: var(--muted); transition: transform .15s ease; }
details.card[open] > .summary-btn { margin-block-end: 12px; }
details.card[open] > .summary-btn::after { transform: rotate(180deg); }
.hub-panel details.card { margin: 12px 0 0; background: var(--surface-2); box-shadow: none; }

/* تحديث حالة المهمة */
.status-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.status-form select {
  min-height: 38px; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; font-size: .88rem; color: var(--ink);
}
.js .status-form select[data-autosubmit] + .btn { display: none; }

/* رابط متابعة الأسرة */
.portal-token input.code {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); text-align: left; font-size: .84rem;
}
.portal-token .form-actions { margin-block: 10px 6px; flex-wrap: wrap; }
.btn.is-copied { border-color: var(--good); color: var(--ok-ink); }
.small { font-size: .84rem; }

/* قوالب الرسائل */
.template-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px; }
.template-grid .chip { gap: 6px; }
.template-grid .chip .icon { color: var(--primary); }
.template-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); scroll-margin-block-start: 80px; }
.template-preview h3 { font-size: 1rem; }
.message-box {
  width: 100%; margin-block-start: 8px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .95rem; line-height: 1.8; resize: vertical; white-space: pre-wrap;
}
.template-preview .form-actions { flex-wrap: wrap; }

/* بطاقة المتابعة المطبوعة */
.print-card h2 { font-size: 1.02rem; margin-block: 18px 8px; }
.print-card h2:first-of-type { margin-block-start: 12px; }
.print-card .code { overflow-wrap: anywhere; direction: ltr; text-align: left; }

/* صفحة الأسرة العامة (رابط خاص بطالب واحد) */
body.portal { background: linear-gradient(180deg, #e7f3f0 0%, var(--bg) 280px); }
.portal-wrap { width: min(880px, 100%); margin-inline: auto; padding: 20px 16px 32px; }
.portal-head { display: flex; align-items: center; gap: 12px; padding-block-end: 14px; margin-block-end: 18px; border-block-end: 1px solid var(--border); }
.portal-main h1 { margin-block-end: 4px; }
.portal-main .page-sub { margin: 0 0 16px; color: var(--muted); }
.portal-main .kpi-grid { margin-block-end: 16px; }
.portal-main .mini-list .btn { margin-inline-start: auto; }
/* صفحة الأسرة (1.6): خلاصة إيجابية أولًا، ونشاط منزلي بجانب كل مهارة، وما أتقنه الطالب */
.portal-hero { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; margin-block-end: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.portal-hero-icon { display: inline-grid; place-items: center; flex: 0 0 auto; inline-size: 46px; block-size: 46px; border-radius: 50%; background: var(--ok-soft); color: var(--ok-ink); }
.portal-hero > div { flex: 1; min-width: 0; }
.portal-hero-title { margin: 2px 0 10px; font-size: 1.12rem; font-weight: 700; text-wrap: balance; }
.portal-hero-title strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.portal-hero-sub { margin: 10px 0 0; color: var(--ink-2); font-size: .92rem; }
.portal-progress { display: block; }
.portal-main .mini-list li.is-open > span:first-child { font-weight: 700; }
.portal-tip { flex-basis: 100%; display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--ink-2); }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-ink); font-size: .9rem; font-weight: 600; }
.portal-foot { margin-block-start: 22px; font-size: .84rem; color: var(--ink-2); text-align: center; }
.portal-foot p { margin: 4px 0; }

@media (max-width: 767px) {
  .timeline-head .badge { margin-inline-start: 0; }
  .status-form { justify-content: flex-start; }
  .template-grid { flex-wrap: nowrap; overflow-x: auto; margin-inline: -4px; padding: 0 4px 4px; }
  .template-grid .chip { flex: 0 0 auto; }
  .portal-wrap { padding-block-start: 14px; }
  .portal-main .mini-list .btn { margin-inline-start: 0; }
}
@media print {
  body.portal { background: #fff; }
  .template-grid, .summary-btn, details.card:not([open]), .status-form, .portal-token .form-actions { display: none !important; }
  .print-card { border: 0; box-shadow: none; padding: 0; }
  .message-box { border: 0; padding: 0; resize: none; height: auto; }
}

/* ───── إدارة المستخدمين والوصول (الأمر العاشر) ───── */
.role-hints { margin: 0 0 16px; padding-inline-start: 18px; display: grid; gap: 4px; }
.access-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.access-actions .inline-form { margin: 0; }
.grid-2 + .card, .card + .grid-2 { margin-block-start: 16px; }
.log-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.log-filters .field { min-width: 180px; margin: 0; }
.demo-remote { margin-block-start: 16px; }
.auth-note { margin: 12px 0 0; text-align: center; }

/* ═══════════════ حسابات دخول الطلاب ومنطقة الطالب ═══════════════ */
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.inline-field select { min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 10px; background: var(--surface); font: inherit; }
.account-card .dl { margin-block-end: 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.account-actions .inline-form { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kid-login input { font-size: 1.5rem; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }

body.kid { background: linear-gradient(180deg, #e7f3f0 0%, var(--bg) 280px); min-height: 100vh; }
.kid-wrap { max-width: 860px; margin: 0 auto; padding: 16px 16px 32px; }
.kid-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-block-end: 18px; }
.kid-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.kid-brand > span { display: flex; flex-direction: column; line-height: 1.3; }
.kid-user { display: flex; align-items: center; gap: 10px; }
.kid-name { font-weight: 700; }
.kid-hello { background: var(--surface); border-radius: 18px; padding: 22px 24px; margin-block-end: 16px; box-shadow: var(--shadow); border-inline-start: 6px solid var(--warning); }
.kid-hello h1 { margin: 0 0 4px; font-size: 1.7rem; }
.kid-hello p { margin: 0; color: var(--ink-2); }
.kid-card { border-radius: 18px; }
.kid-card .card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; }
.kid-skills { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kid-skill { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.kid-skill b { display: block; }
.kid-skill small { color: var(--muted); }
.kid-skill-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.kid-stars { display: inline-flex; gap: 2px; color: var(--border-strong); }
.kid-stars .on { color: var(--warning); }
.kid-stars .on svg { fill: currentColor; }
.kid-level { font-weight: 700; font-size: .9rem; }
.kid-pct { font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 3.5em; text-align: end; }
.lv-mastered { background: var(--ok-soft); border-color: #bfe3bf; }
.lv-reinforce { background: var(--medium-soft); border-color: #f2dfae; }
.lv-support { background: var(--low-soft); border-color: #cfe0f6; }

/* بطاقات الدخول للطباعة: 8 بطاقات في صفحة A4 */
body.print-page { background: var(--bg); }
.print-toolbar { max-width: 210mm; margin: 0 auto; padding: 14px 12px 0; }
.print-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-block-end: 10px; }
.print-sheet { max-width: 210mm; margin: 0 auto; padding: 12px; }
.login-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6mm; }
.login-card { background: #fff; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 5mm 6mm; break-inside: avoid; display: flex; flex-direction: column; gap: 2mm; min-height: 62mm; }
.login-card header { display: flex; align-items: center; gap: 8px; border-block-end: 2px solid var(--primary); padding-block-end: 2mm; }
.login-card header b { display: block; font-size: .95rem; }
.login-card header small { color: var(--muted); font-size: .75rem; }
.lc-name { font-size: 1.15rem; font-weight: 800; }
.lc-class { color: var(--ink-2); font-size: .85rem; }
.login-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; margin: 1mm 0; }
.login-card dl div { background: var(--primary-soft); border-radius: 8px; padding: 2mm 3mm; text-align: center; }
.login-card dt { font-size: .75rem; color: var(--primary-ink); font-weight: 700; }
.login-card dd { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.lc-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4mm; align-items: center; }
.lc-body dl { grid-template-columns: 1fr; }
.lc-qr { margin: 0; display: grid; justify-items: center; gap: 1mm; }
.lc-qr svg { inline-size: 26mm; block-size: 26mm; }
.lc-qr figcaption { font-size: .66rem; color: var(--ink-2); text-align: center; max-inline-size: 30mm; line-height: 1.3; }
.lc-url { margin: 0; font-size: .75rem; color: var(--ink-2); }
.lc-note { margin: 0; font-size: .72rem; color: var(--muted); }
@media print {
  @page { size: A4; margin: 10mm; }
  .print-toolbar { display: none !important; }
  body.print-page { background: #fff; }
  .print-sheet { padding: 0; max-width: none; }
}
@media (max-width: 560px) { .login-cards { grid-template-columns: 1fr; } }

/* ═══════════════ استيراد كشوف نور ═══════════════ */
.steps-list { margin: 0 0 14px; padding-inline-start: 22px; line-height: 1.9; color: var(--ink-2); }
.noor-class .card-head { flex-wrap: wrap; gap: 6px 12px; }
.noor-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 16px; }
.noor-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.noor-list summary { cursor: pointer; font-weight: 600; color: var(--primary-ink); padding: 6px 0; }
.noor-list input[type="checkbox"] { inline-size: 18px; block-size: 18px; }

/* ═══════════════ الإصدار 1.3: الواجبات، بنك الأسئلة، المسابقات، الشهادات، لوحة الشرف ═══════════════ */
.no-print { }
@media print { .no-print { display: none !important; } }
.score-input { inline-size: 6.5em; min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 8px; font: inherit; text-align: center; }
.hw-entry select { min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 8px; background: var(--surface); font: inherit; max-inline-size: 100%; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0 0 6px; }
.facts > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; font-size: 1.05rem; }
.how-card > summary { cursor: pointer; font-weight: 700; color: var(--primary-ink); display: flex; gap: 8px; align-items: center; }
.how-card ul { margin: 12px 0 0; padding-inline-start: 22px; line-height: 1.9; color: var(--ink-2); }

/* بنك الأسئلة: البدائل والإجابة الصحيحة */
.bank-options legend { font-weight: 600; margin-block-end: 6px; }
.bank-option { display: flex; align-items: center; gap: 8px; margin-block-end: 8px; }
.bank-option input[type="text"], .bank-option input:not([type]) { flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; font: inherit; background: var(--surface); }
.bank-correct { position: relative; display: inline-flex; cursor: pointer; }
.bank-correct input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bank-correct .opt-letter { width: 36px; height: 36px; font-size: .95rem; border: 2px solid var(--border-strong); background: var(--surface); }
.bank-correct input:checked + .opt-letter { background: var(--good); border-color: var(--good); color: #fff; }
.bank-correct input:focus-visible + .opt-letter { outline: 3px solid var(--focus); outline-offset: 2px; }
.bank-review.needs-review { border-inline-start: 5px solid var(--warning); }
.bank-review.has-error { border-color: var(--danger); }
.bank-review-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.q-passage { margin-block-end: 8px; }
.q-passage summary { cursor: pointer; color: var(--primary-ink); font-weight: 600; font-size: .9rem; }
.q-passage p { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 0; }

/* المسابقات: القائمة والتفاصيل (العاملون) */
.comp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.comp-card { border: 1px solid var(--border); border-inline-start: 5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.comp-card.st-live { border-inline-start-color: var(--good); background: linear-gradient(90deg, var(--surface), var(--ok-soft)); }
.comp-card.st-upcoming { border-inline-start-color: var(--planned); }
.comp-card.st-cancelled { border-inline-start-color: var(--warning); opacity: .8; }
.comp-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.comp-link:hover b { color: var(--primary-ink); text-decoration: underline; }
.comp-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #fff4d6; color: #a86b00; flex: none; }
.comp-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.comp-main small { font-size: .84rem; color: var(--ink-2); }
.comp-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.comp-end small { color: var(--muted); font-size: .8rem; }
.comp-winners { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0; padding: 0 14px 12px; font-size: .84rem; color: var(--ink-2); }
.comp-winners .icon { color: #b8860b; }
.comp-winners .tone-1 { font-weight: 700; }
.comp-questions > summary { cursor: pointer; list-style: none; }
.comp-questions > summary h2 { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.comp-questions[open] > summary { margin-block-end: 12px; }
tr.top-1 { background: #fff7dc; }
tr.top-2 { background: #f1f4f6; }
tr.top-3 { background: #fbefe6; }

/* منصة التتويج */
.podium { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }
.podium li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 14px 8px 12px; border-radius: 14px 14px 6px 6px; min-width: 0; }
.podium li b { font-size: 1rem; overflow-wrap: anywhere; }
.podium li small { color: var(--ink-2); font-size: .8rem; }
.podium-1 { order: 2; background: linear-gradient(180deg, #fff3c4, #ffe28a); min-height: 170px; }
.podium-2 { order: 1; background: linear-gradient(180deg, #f3f5f7, #dfe4e8); min-height: 140px; }
.podium-3 { order: 3; background: linear-gradient(180deg, #fbeee3, #f0d2bb); min-height: 120px; }
.podium-1 .podium-medal { color: #b8860b; }
.podium-2 .podium-medal { color: #6f7c86; }
.podium-3 .podium-medal { color: #9a5a2a; }
.podium-score { font-weight: 800; font-size: 1.05rem; margin-block-start: 4px; }
.podium-1:only-child { grid-column: 2; }
.honor-title { display: flex; align-items: center; gap: 8px; }
.honor-title .icon { color: #b8860b; }
.medal-count { display: inline-flex; align-items: center; gap: 2px; color: #a86b00; font-weight: 700; }

/* منطقة الطالب: المسابقات */
.kid-comp-card .card-head, .kid-card .card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kid-comp-card { border: 2px solid #ffd666; background: linear-gradient(180deg, #fffaf0, var(--surface) 60%); }
.kid-hello-comp { border-inline-start-color: #f59e0b; background: linear-gradient(120deg, #fff8e6, var(--surface) 70%); }
.kid-hello-comp h1 { display: flex; align-items: center; gap: 10px; }
.kid-hello-comp h1 .icon { color: #d38b00; }
.kid-comp-list, .kid-certs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kid-comp-list a, .kid-certs a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; min-height: 64px; }
.kid-comp-list a:hover, .kid-certs a:hover { border-color: var(--primary); }
.kid-comp-list a > span:nth-child(2), .kid-certs a > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.kid-comp-list small, .kid-certs small { color: var(--ink-2); font-size: .85rem; }
.kid-comp-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff1c7; color: #b77800; flex: none; }
.kid-comp-go { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: .9rem; }
.kid-comp-list .is-live a { border: 2px solid #22a35a; background: linear-gradient(90deg, #eefaf2, var(--surface)); }
.kid-comp-list .is-live .kid-comp-go { background: #17924d; color: #fff; animation: kid-pulse 1.6s ease-in-out infinite; }
@keyframes kid-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(23, 146, 77, .45); } 50% { box-shadow: 0 0 0 8px rgba(23, 146, 77, 0); } }
.kid-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 0; }
.kid-links a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.kid-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding-inline: 6px; border-radius: 999px; background: #f59e0b; color: #fff; font-size: .8rem; }
.kid-back { margin: 8px 0 0; }
.kid-rules { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.kid-rules li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 1.02rem; }
.kid-rules .icon { color: var(--primary); flex: none; margin-block-start: 2px; }
.kid-countdown { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 6px 12px; margin: 0 0 16px; padding: 14px; border-radius: 14px; background: #10233b; color: #fff; font-size: 1.05rem; }
.kid-countdown b { font-size: 2.2rem; font-variant-numeric: tabular-nums; letter-spacing: .04em; color: #ffd666; }
.play-intro { text-align: start; }
.play-go { font-size: 1.25rem; min-height: 60px; }

/* شاشة السؤال */
.play { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; margin-block-end: 16px; }
.play-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-block-end: 12px; font-size: 1.02rem; }
.play-step b { font-size: 1.2rem; }
.play-score { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff4d6; color: #7a4d00; }
.play-score .icon { fill: currentColor; }
.play-timer { display: flex; align-items: center; gap: 12px; margin-block-end: 16px; }
.play-timer-num { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; transition: background .2s; }
.play-timer-track { flex: 1; height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; }
.play-timer-bar { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #22a35a, #8bd17c); transform-origin: right center; transition: transform .1s linear; }
[dir="rtl"] .play-timer-bar { transform-origin: right center; }
.play-timer.is-low .play-timer-num { background: var(--critical); animation: timer-beat .5s ease-in-out infinite alternate; }
.play-timer.is-low .play-timer-bar { background: linear-gradient(90deg, #d03b3b, #f08c6c); }
@keyframes timer-beat { from { transform: scale(1); } to { transform: scale(1.1); } }
.play-passage { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-block-end: 12px; line-height: 1.9; max-height: 40vh; overflow: auto; }
.play-q { font-size: clamp(1.25rem, 4.2vw, 1.7rem); line-height: 1.6; text-align: center; margin: 4px 0 18px; }
.play-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.play-opt { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 14px; border: 0; border-radius: 16px; color: #fff; font: inherit; font-size: 1.12rem; font-weight: 700; text-align: start; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); transition: transform .08s, box-shadow .08s, opacity .2s; }
.play-opt:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0, 0, 0, .18); }
.play-opt:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.play-opt:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.play-opt.opt-0 { background: #c62f3a; }
.play-opt.opt-1 { background: #1f62c8; }
.play-opt.opt-2 { background: #138a4a; }
.play-opt.opt-3 { background: #7a3fc0; }
.play-letter { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #15201d; font-size: 1.1rem; flex: none; }
.play-opt-text { min-width: 0; overflow-wrap: anywhere; }
.play-form.is-locked .play-opt { cursor: default; }
.play-form.is-locked .play-opt:not(.is-chosen) { opacity: .35; }
.play-form.is-locked .play-opt.is-chosen { outline: 4px solid #ffd666; outline-offset: 2px; }
@media (max-width: 420px) { .play-options { grid-template-columns: 1fr; } .play-opt { min-height: 62px; } }

/* التغذية الراجعة بعد كل سؤال */
.play-fb { text-align: center; padding: 34px 18px; }
.play-fb h1 { font-size: 2rem; margin: 12px 0 4px; }
.fb-badge { display: inline-grid; place-items: center; width: 104px; height: 104px; border-radius: 50%; color: #fff; animation: fb-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes fb-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fb-ok { background: linear-gradient(180deg, #eaf8ef, var(--surface)); }
.fb-ok .fb-badge { background: #17924d; }
.fb-no { background: linear-gradient(180deg, #fdeeee, var(--surface)); }
.fb-no .fb-badge { background: #c62f3a; }
.fb-time { background: linear-gradient(180deg, #fff6e0, var(--surface)); }
.fb-time .fb-badge { background: #d38b00; }
.fb-sub { font-size: 1.15rem; color: var(--ink-2); margin: 0 0 8px; }
.fb-points { font-size: 2.6rem; font-weight: 800; color: #17924d; margin: 4px 0; animation: fb-pop .5s .15s both; }
.fb-points small { font-size: 1rem; }
.fb-total { color: var(--ink-2); margin: 6px 0 18px; }
.play-next { min-width: 220px; }

/* النتيجة وترتيب الطلاب */
.result-hero { text-align: center; }
.result-hero h1 { font-size: 1.8rem; margin: 10px 0 6px; }
.result-medal { position: relative; display: inline-grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; background: #fff3c4; color: #b8860b; }
.result-medal > span { position: absolute; inset-block-start: 52%; font-weight: 800; font-size: 1.15rem; color: #6b4b00; }
.result-medal.plain { background: var(--primary-soft); color: var(--primary); }
.won-gold { background: linear-gradient(180deg, #fff6d5, var(--surface) 70%); border: 2px solid #f1c94b; }
.won-silver { background: linear-gradient(180deg, #f2f5f7, var(--surface) 70%); border: 2px solid #c3ccd3; }
.won-silver .result-medal { background: #e6ebef; color: #5f6c76; }
.won-bronze { background: linear-gradient(180deg, #fbefe5, var(--surface) 70%); border: 2px solid #e2b38c; }
.won-bronze .result-medal { background: #f6dfcb; color: #8c4f22; }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 6px; }
.result-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px 6px; }
.result-stats dt { font-size: .85rem; color: var(--muted); }
.result-stats dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 800; }
.result-stats dd small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.kid-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kid-board li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.kb-rank { display: inline-flex; align-items: center; gap: 4px; min-width: 3.2em; font-weight: 800; font-variant-numeric: tabular-nums; }
.kb-name { flex: 1; min-width: 0; font-weight: 600; }
.kb-name small { color: var(--muted); font-weight: 400; margin-inline-start: 6px; }
.kb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.kid-board .rank-1 { background: #fff3c4; border-color: #f1c94b; }
.kid-board .rank-1 .kb-rank { color: #9a6b00; }
.kid-board .rank-2 { background: #eef1f4; border-color: #c3ccd3; }
.kid-board .rank-2 .kb-rank { color: #5f6c76; }
.kid-board .rank-3 { background: #fbeee3; border-color: #e2b38c; }
.kid-board .rank-3 .kb-rank { color: #8c4f22; }
.kid-board .is-me { outline: 3px solid var(--primary); outline-offset: 1px; }
.my-honor-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 0 0 4px; font-size: 1.1rem; }
.my-honor-line b { font-size: 2rem; color: var(--primary-ink); }
.kid-review > summary { cursor: pointer; list-style: none; }
.kid-review > summary h2 { display: inline-flex; gap: 8px; align-items: center; margin: 0; font-size: 1.2rem; }
.review-list { margin: 14px 0 0; padding-inline-start: 22px; display: grid; gap: 14px; }
.review-q { font-weight: 700; margin: 0 0 6px; }
.review-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.review-opts li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); }
.review-opts li.correct { background: var(--ok-soft); border-color: #9fd3a8; }
.review-opts li.wrong { background: var(--danger-soft); border-color: #f0b4ae; }
.review-opts small { color: var(--ink-2); }
.kid-certs .kc-medal { position: relative; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; flex: none; }
.kid-certs .kc-medal > span { position: absolute; inset-block-start: 50%; font-size: .8rem; font-weight: 800; }
.kid-certs .cert-gold .kc-medal { background: #fff3c4; color: #b8860b; }
.kid-certs .cert-silver .kc-medal { background: #eef1f4; color: #5f6c76; }
.kid-certs .cert-bronze .kc-medal { background: #fbeee3; color: #8c4f22; }
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
@media (prefers-reduced-motion: reduce) {
  .kid-comp-list .is-live .kid-comp-go, .play-timer.is-low .play-timer-num, .fb-badge, .fb-points { animation: none !important; }
}

/* شهادة الشكر: A4 أفقي */
body.print-page .print-toolbar:has(+ .print-sheet .cert-sheet), body.print-page .print-sheet:has(.cert-sheet) { max-width: 297mm; }
.cert-sheet { display: grid; gap: 16px; }
.certificate {
  --tone: #b8860b; --tone-soft: #fff6d5; --tone-ink: #6b4b00;
  container-type: inline-size; width: 100%; max-width: 297mm; aspect-ratio: 297 / 210; margin: 0 auto; background: #fff;
  box-shadow: 0 2px 14px rgba(16, 24, 20, .12); padding: 2.6%; break-inside: avoid; color: #1d2421;
}
.cert-silver { --tone: #6f7c86; --tone-soft: #f1f4f6; --tone-ink: #3f4a52; }
.cert-bronze { --tone: #9a5a2a; --tone-soft: #fbefe5; --tone-ink: #5e3216; }
.cert-frame {
  position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center;
  border: .5cqi solid var(--tone); outline: .2cqi solid var(--tone); outline-offset: -1.3cqi; border-radius: 1cqi;
  padding: 3cqi 6cqi 2cqi; background: radial-gradient(circle at 50% 0%, var(--tone-soft), #fff 60%);
}
.cert-frame::before, .cert-frame::after { content: ""; position: absolute; width: 7cqi; height: 7cqi; border: 0 solid var(--tone); opacity: .55; }
.cert-frame::before { inset-block-start: 2cqi; inset-inline-start: 2cqi; border-block-start-width: .35cqi; border-inline-start-width: .35cqi; }
.cert-frame::after { inset-block-end: 2cqi; inset-inline-end: 2cqi; border-block-end-width: .35cqi; border-inline-end-width: .35cqi; }
.cert-head { display: flex; align-items: center; justify-content: space-between; gap: 2cqi; width: 100%; text-align: start; }
.cert-head img { width: 6.5cqi; height: auto; }
.cert-head > div { flex: 1; display: flex; flex-direction: column; }
.cert-head b { font-size: 2cqi; color: var(--primary-ink); }
.cert-head small { font-size: 1.5cqi; color: #4b5551; }
.cert-medal { position: relative; display: grid; place-items: center; width: 8cqi; height: 8cqi; border-radius: 50%; background: var(--tone-soft); color: var(--tone); border: .3cqi solid var(--tone); }
.cert-medal svg { width: 5cqi; height: 5cqi; }
.cert-medal > span { position: absolute; inset-block-start: 49%; font-weight: 800; font-size: 1.5cqi; color: var(--tone-ink); }
.cert-title { margin: 1.4cqi 0 .4cqi; font-size: 5.2cqi; line-height: 1.3; color: var(--tone-ink); letter-spacing: .02em; }
.cert-lead { margin: 0; font-size: 2cqi; color: #4b5551; }
.cert-name { margin: .8cqi 0 0; font-size: 4.4cqi; font-weight: 800; color: var(--primary-ink); border-block-end: .25cqi solid var(--tone); padding: 0 4cqi .4cqi; }
.cert-class { margin: .6cqi 0 0; font-size: 1.8cqi; color: #4b5551; }
.cert-body { margin: 1.6cqi 0 0; font-size: 2.2cqi; line-height: 1.8; max-width: 80%; }
.cert-body strong { color: var(--tone-ink); }
.cert-wish { margin: .8cqi 0 0; font-size: 1.9cqi; color: #4b5551; }
.cert-foot { margin-block-start: auto; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3cqi; font-size: 1.6cqi; }
.cert-foot > div { display: flex; flex-direction: column; align-items: center; gap: .4cqi; }
.cert-foot span { color: #4b5551; }
.cert-foot b { min-height: 2.6cqi; min-width: 70%; border-block-end: .15cqi solid #9aa39f; padding-block-end: .3cqi; }
.cert-foot small { font-size: 1.3cqi; color: #6b7470; letter-spacing: .12em; }
.cert-note { margin: 1cqi 0 0; font-size: 1.25cqi; color: #6b7470; }
@page certificate { size: A4 landscape; margin: 0; }
@media print {
  .cert-sheet { display: block; }
  .certificate { page: certificate; width: 297mm; height: 209mm; max-width: none; aspect-ratio: auto; box-shadow: none; margin: 0; break-after: page; overflow: hidden; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .certificate:last-child { break-after: auto; }
}

/* استيراد كشف بأي صيغة: تحديد عمود الأسماء في صورة الكشف وقراءته في المتصفح */
.ocr-panel { margin-block-start: 12px; }
.ocr-help { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); margin: 0 0 10px; }
.ocr-help .icon { flex: none; margin-block-start: 3px; color: var(--primary); }
.ocr-pages { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 8px; }
.ocr-pages .active { background: var(--primary-soft); color: var(--primary-ink); border-color: var(--primary); }
.ocr-stage { position: relative; text-align: center; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 8px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.ocr-stage img { display: inline-block; max-width: 100%; max-height: 75vh; height: auto; vertical-align: top; pointer-events: none; }
.ocr-sel { position: absolute; border: 2px solid var(--focus); background: rgba(29, 99, 214, .14); border-radius: 4px; pointer-events: none; }
.ocr-status { margin: 10px 0 0; font-weight: 600; color: var(--ink-2); min-height: 1.5em; }
.ocr-status.is-ok { color: var(--ok-ink); }
.ocr-status.is-error { color: var(--danger-ink); }
.rejected-lines { margin: 6px 0; padding-inline-start: 20px; max-height: 220px; overflow: auto; }
#f-names { font-size: 1.02rem; line-height: 1.9; }
.ocr-status.is-warn { color: var(--warn-ink); }
.row-warn td, .row-warn th { background: var(--warn-soft); }
.sheet-review td { vertical-align: top; }
.sheet-review td:nth-child(6) { min-width: 260px; }

/* 1.3.2 — إضافة أسئلة القياس من بنك الأسئلة */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pick-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pick-check input { width: 22px; height: 22px; accent-color: var(--primary); }
.pick-item.is-added { opacity: .72; }
.pick-item .q-text { margin-block-start: 6px; }
.pick-settings { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-block: 14px; }
.pick-settings legend { font-weight: 600; padding-inline: 6px; }
.pick-settings .check { display: flex; gap: 8px; align-items: center; margin-block-end: 10px; }

/* 1.3.3 — تعديل الأسماء والحذف */
.names-table td { vertical-align: middle; }
.names-table td.num { width: 3ch; color: var(--ink-2); }
.names-table .name-input { width: 100%; min-width: 0; min-height: 42px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px; font: inherit; background: var(--surface); }
.names-table .name-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.names-table tr.has-error .name-input { border-color: var(--danger); }
.names-table .badge { margin-block-start: 4px; }
.del-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; min-height: 42px; }
.del-check input { width: 20px; height: 20px; accent-color: var(--danger); }
.names-table tr.is-removing .name-input { text-decoration: line-through; opacity: .55; }
.names-table tr.is-removing { background: var(--warn-soft); }
.names-table td:nth-child(2) { width: 100%; }
@media (max-width: 767px) {
  .names-table .hide-sm { display: none; }
  .names-table th, .names-table td { padding-inline: 6px; }
}
.names-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-end: 10px; }
.names-toolbar .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ═══════════ 1.4.0 — الواجهة العامة وصفحات الدخول الجديدة ═══════════ */
html { -webkit-tap-highlight-color: rgba(15, 118, 110, .15); }
a, button, input, select, textarea, label { touch-action: manipulation; }
h1, h2, h3 { text-wrap: balance; }
.auth-brand { text-decoration: none; color: var(--ink); }

/* الشريط العلوي والتذييل للصفحات العامة */
body.public { background: var(--surface); }
html:has(body.public) { scroll-padding-top: 84px; }
.pub-inner { width: min(1160px, 100%); margin-inline: auto; padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
.pub-head { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-block-end: 1px solid var(--border); }
.pub-head .pub-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.pub-nav { display: flex; gap: 8px; align-items: center; }
.pub-main { overflow-x: hidden; }
.pub-main section[id], .pub-main [id] { scroll-margin-top: 84px; }

.hero-school { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); font-size: .88rem; font-weight: 600; }
.hero-slogan { margin: 8px 0 0; font-size: clamp(1.1rem, 2.2vw, 1.35rem); font-weight: 600; color: var(--primary); }
.hero-lead { margin: 16px 0 0; font-size: 1.08rem; line-height: 1.9; color: var(--ink-2); max-width: 36em; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 26px; }

/* ═══════════ 1.13 — الصفحة الرئيسية بأسلوب بوابات المنصات السحابية ═══════════
   واجهة داكنة عريضة بعنوان كبير، ثم صورة المنتج بعرض الصفحة، ثم أقسام بوسم صغير وعنوان كبير.
   الواجهة والشريط الختامي داكنان في الوضعين؛ بقية الأقسام تتبع الوضع المختار. */
.pub-links { display: flex; align-items: center; gap: 4px; margin-inline: auto 0; }
.pub-links a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .94rem; text-decoration: none; transition: color .15s, background-color .15s; }
.pub-links a:hover { color: var(--primary-ink); background: var(--primary-soft); }
.pub-links a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.lx-hero {
  --lx-ink: #f2f7f6; --lx-ink-2: #b7c7cc; --lx-accent: #3fd1bf; --lx-gold: #f2b233;
  position: relative; isolation: isolate; overflow: hidden; color: var(--lx-ink);
  background: linear-gradient(180deg, #071521 0%, #0a2230 55%, #0c2c33 100%);
  padding-block: 72px 0; text-align: center;
}
.lx-hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%); }
.lx-glow { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.lx-glow-a { inline-size: 520px; block-size: 520px; inset-block-start: -180px; inset-inline-start: -120px; background: #0f766e; }
.lx-glow-b { inline-size: 460px; block-size: 460px; inset-block-start: 120px; inset-inline-end: -160px; background: #1d4f8f; }
.lx-hero-copy { display: flex; flex-direction: column; align-items: center; }
.lx-hero .hero-school { background: rgba(63, 209, 191, .12); color: var(--lx-accent); border: 1px solid rgba(63, 209, 191, .3); }
.lx-welcome { margin: 4px 0 0; font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 600; letter-spacing: .02em; color: var(--lx-ink-2); }
.lx-hero h1 { margin-block-start: 4px; font-size: clamp(2.8rem, 8vw, 5.2rem); font-weight: 800; line-height: 1.15; color: var(--lx-ink);
  background: linear-gradient(100deg, #ffffff 10%, #9ff0e4 55%, #6fb6ff 95%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.lx-hero .hero-slogan { margin-block-start: 10px; color: var(--lx-gold); font-weight: 700; }
.lx-hero .hero-lead { margin-inline: auto; color: var(--lx-ink-2); max-width: 40em; }
.lx-hero .hero-actions { justify-content: center; margin-block-start: 30px; }
.btn-lx { background: var(--lx-accent); color: #04211d; font-weight: 700; box-shadow: 0 8px 28px -8px rgba(63, 209, 191, .6); }
.btn-lx:hover { background: #6fe0d2; color: #04211d; }
.btn-lx-ghost { background: rgba(255, 255, 255, .06); color: var(--lx-ink); border: 1px solid rgba(255, 255, 255, .22); }
.btn-lx-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lx-hero .btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.lx-trust { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; color: var(--lx-ink-2); font-size: .9rem; }
.lx-trust li { display: inline-flex; align-items: center; gap: 6px; }
.lx-trust .icon { color: var(--lx-accent); }
.lx-showcase { margin-block-start: 52px; }
.lx-screen { margin: 0 auto; max-width: 1040px; padding: 10px 10px 0; border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .02)); border: 1px solid rgba(255, 255, 255, .14); border-block-end: 0;
  box-shadow: 0 -20px 80px -20px rgba(63, 209, 191, .35); }
.lx-screen img { display: block; inline-size: 100%; block-size: auto; border-radius: 14px 14px 0 0; }

/* رؤوس الأقسام */
.pub-section { padding-block: 88px; }
.pub-section-alt { background: var(--bg); }
.pub-title { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 800; line-height: 1.3; margin-block-end: 0; }
.lx-head { text-align: center; max-width: 760px; margin: 0 auto 44px; }
.lx-kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--primary); font-size: .9rem; font-weight: 700; letter-spacing: .04em; }
.lx-kicker::before, .lx-kicker::after { content: ""; inline-size: 22px; block-size: 2px; border-radius: 2px; background: currentColor; opacity: .6; }
.lx-lead { margin: 14px auto 0; color: var(--ink-2); font-size: 1.08rem; line-height: 1.9; max-width: 44em; text-wrap: pretty; }

/* الركائز الثلاث */
.lx-pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.lx-pillar { position: relative; overflow: hidden; padding: 34px 28px 30px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); text-align: center; transition: translate .25s, box-shadow .25s, border-color .25s; min-width: 0; }
.lx-pillar::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 4px; background: linear-gradient(90deg, #0f766e, #3fd1bf, #5aa2f0); }
.lx-pillar:hover { translate: 0 -4px; box-shadow: 0 18px 40px -18px rgba(15, 118, 110, .35); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.lx-pillar-icon { display: inline-grid; place-items: center; inline-size: 68px; block-size: 68px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); }
.lx-pillar h3 { margin-block: 18px 10px; font-size: 1.28rem; }
.lx-pillar p { margin: 0; color: var(--ink-2); line-height: 1.85; }

/* الدخول والأدوات */
.entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.entry-card { display: flex; flex-direction: column; gap: 10px; padding: 28px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); min-width: 0; transition: translate .25s, box-shadow .25s; }
.entry-card:hover { translate: 0 -3px; box-shadow: 0 16px 36px -18px rgba(16, 24, 20, .3); }
.entry-card h3 { font-size: 1.22rem; }
.entry-card p { margin: 0; color: var(--ink-2); line-height: 1.8; }
.entry-card .btn { margin-block-start: auto; align-self: flex-start; }
.entry-icon { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.entry-student .entry-icon { background: #fff3d1; color: #8a5a00; }
.entry-family .entry-icon { background: var(--info-soft); color: var(--info-ink); }
.entry-note { margin-block-start: auto !important; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--info-ink) !important; }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--border); border-radius: 22px; overflow: hidden; background: var(--border); }
.feature { padding: 30px 28px; min-width: 0; background: var(--surface); transition: background-color .2s; }
.feature:hover { background: var(--surface-2); }
.feature h3 { font-size: 1.1rem; margin-block: 14px 6px; }
.feature p { margin: 0; color: var(--ink-2); font-size: .96rem; line-height: 1.8; }
.feature-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); }

/* الرحلة: خط زمني بأربع درجات */
.journey { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; position: relative; }
.journey::before { content: ""; position: absolute; inset-inline: 12%; inset-block-start: 27px; block-size: 2px; background: linear-gradient(90deg, #f2b233, #1f9bb6, #0f766e); opacity: .5; }
.journey-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 8px; min-width: 0; }
.journey-step h3 { font-size: 1.35rem; color: var(--primary-ink); margin-block: 16px 6px; }
.journey-step p { margin: 0; color: var(--ink-2); line-height: 1.8; }
.journey-num { position: relative; display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 8px var(--bg); }
.journey-step:last-child .journey-num { background: #f2b233; color: #3d2a00; }

/* شريط الخصوصية الداكن */
.lx-band { position: relative; isolation: isolate; overflow: hidden; padding-block: 80px; color: #f2f7f6; background: linear-gradient(120deg, #071521 0%, #0b2a33 60%, #0c3a3a 100%); }
.lx-band .lx-glow-b { inset-block-start: -120px; opacity: .45; }
.privacy-band { display: flex; gap: 26px; align-items: flex-start; }
.privacy-band .pub-title { margin-block-end: 12px; color: #fff; }
.privacy-band p { margin: 0; color: #b7c7cc; line-height: 1.95; max-width: 60em; font-size: 1.05rem; }
.lx-band .lx-kicker { color: #3fd1bf; }
.lx-band .lx-kicker::before { display: none; }
.privacy-icon { flex: none; display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: rgba(63, 209, 191, .12); color: #3fd1bf; border: 1px solid rgba(63, 209, 191, .3); }
.lx-link { display: inline-flex; align-items: center; gap: 6px; margin-block-start: 18px; color: #3fd1bf; font-weight: 700; text-decoration: none; }
.lx-link:hover { text-decoration: underline; }
.lx-link:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 4px; }

/* «اطلبها لمدرستك اليوم»: بطاقة داكنة بارزة في الوضعين */
.lx-cta { padding-block: 88px; }
.lx-cta-card { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap;
  width: min(1120px, calc(100% - 40px)); padding: 56px 52px; border-radius: 28px; color: #f2f7f6;
  background: linear-gradient(120deg, #071521 0%, #0b2a33 55%, #0f4a45 100%); border: 1px solid rgba(63, 209, 191, .25);
  box-shadow: 0 30px 70px -30px rgba(7, 21, 33, .55); }
.lx-cta-card .lx-hero-bg { border-radius: inherit; }
.lx-cta-card .lx-glow-a { inset-block-start: -260px; inset-inline-start: auto; inset-inline-end: -200px; }
.lx-cta-copy { flex: 1 1 460px; min-width: 0; }
.lx-cta-card .lx-kicker { color: #3fd1bf; }
.lx-cta-card .pub-title { color: #fff; font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
.lx-cta-card p { margin: 12px 0 0; color: #b7c7cc; line-height: 1.9; max-width: 40em; }
.lx-cta-points { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; }
.lx-cta-points li { display: flex; align-items: center; gap: 10px; color: #e2ecea; font-weight: 600; }
.lx-cta-points .icon { flex: none; inline-size: 26px; block-size: 26px; padding: 5px; border-radius: 50%; background: rgba(63, 209, 191, .16); color: #3fd1bf; }
.lx-cta-actions { --lx-accent: #3fd1bf; --lx-ink: #f2f7f6; display: flex; flex-direction: column; gap: 12px; min-width: 240px; }
.lx-cta-actions .btn { justify-content: center; }
.lx-cta-card .btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.pub-links .pub-links-cta { color: var(--primary-ink); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); }
.pub-links .pub-links-cta:hover { background: var(--primary); color: var(--on-primary); }

/* ظهور تدريجي عند التمرير (يُفعّله app.js فقط؛ دونه تظهر الأقسام مباشرة) */
.js-reveal .lx-reveal { opacity: 0; transform: translateY(28px) scale(.98); transition: opacity .6s ease, transform .7s cubic-bezier(.2, .8, .2, 1), translate .25s, box-shadow .25s, background-color .2s; }
.js-reveal .lx-reveal.from-top { transform: translateY(-28px) scale(.98); }
.js-reveal .lx-reveal.is-in { opacity: 1; transform: none; }
/* البطاقات داخل الشبكات تتتابع قليلًا */
.js-reveal .lx-pillars > .lx-reveal:nth-child(2), .js-reveal .entry-grid > .lx-reveal:nth-child(2), .js-reveal .feature-grid > .lx-reveal:nth-child(3n+2), .js-reveal .journey > .lx-reveal:nth-child(2) { transition-delay: .08s, .08s, 0s, 0s, 0s; }
.js-reveal .lx-pillars > .lx-reveal:nth-child(3), .js-reveal .entry-grid > .lx-reveal:nth-child(3), .js-reveal .feature-grid > .lx-reveal:nth-child(3n), .js-reveal .journey > .lx-reveal:nth-child(3) { transition-delay: .16s, .16s, 0s, 0s, 0s; }
.js-reveal .journey > .lx-reveal:nth-child(4) { transition-delay: .24s, .24s, 0s, 0s, 0s; }
.lx-hero-copy > * { animation: lx-up .7s cubic-bezier(.2, .8, .2, 1) both; }
.lx-hero-copy > :nth-child(2) { animation-delay: .06s; }
.lx-hero-copy > :nth-child(3) { animation-delay: .12s; }
.lx-hero-copy > :nth-child(4) { animation-delay: .18s; }
.lx-hero-copy > :nth-child(5) { animation-delay: .24s; }
.lx-hero-copy > :nth-child(n+6) { animation-delay: .3s; }
.lx-screen { animation: lx-rise .9s .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lx-rise { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: none; } }
@keyframes lx-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .lx-hero-copy > *, .lx-screen { animation: none; }
  .js-reveal .lx-reveal { opacity: 1; transform: none; transition: none; }
  .lx-pillar:hover, .entry-card:hover { translate: none; }
}

/* الدعم الفني: بطاقات تواصل */
.lx-contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.lx-contact { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; text-align: center; transition: translate .25s, box-shadow .25s, border-color .25s; min-width: 0; }
.lx-contact:hover { translate: 0 -4px; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 18px 40px -18px rgba(15, 118, 110, .35); }
.lx-contact:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.lx-contact-icon { display: inline-grid; place-items: center; inline-size: 60px; block-size: 60px; margin-block-end: 6px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.lx-contact:hover .lx-contact-icon { transform: translateY(-3px) rotate(-6deg) scale(1.08); }
.lx-contact-label { font-weight: 700; font-size: 1.1rem; }
.lx-contact-value { font-weight: 700; color: var(--primary-ink); font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lx-contact-hint { color: var(--muted); font-size: .88rem; }
.lx-support-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 0; color: var(--muted); font-size: .9rem; }
.doc-sec .lx-contacts { margin-block-start: 14px; gap: 12px; }
.doc-sec .lx-contact { padding: 20px 14px; box-shadow: none; }
[data-theme="dark"] .lx-contact:hover { box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6); }

/* التفاعل مع الزائر (يُفعّله app.js) */
.lx-progress { position: absolute; inset-inline: 0; inset-block-end: -1px; block-size: 3px; background: linear-gradient(90deg, #f2b233, #3fd1bf, #5aa2f0); transform: scaleX(var(--lx-progress, 0)); transform-origin: right; pointer-events: none; }
.pub-head { transition: box-shadow .25s, background-color .25s; }
.pub-head.is-scrolled { box-shadow: 0 8px 24px -16px rgba(7, 21, 33, .45); }
.lx-spot { position: relative; isolation: isolate; }
.lx-spot::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%); }
.lx-spot:hover::after { opacity: 1; }
.lx-cta-card.lx-spot::after { z-index: 0; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(63, 209, 191, .18), transparent 70%); }
.lx-cta-card > * { position: relative; z-index: 1; }
.lx-cta-card > .lx-hero-bg { position: absolute; z-index: -1; }
.feature.lx-spot { isolation: auto; }
.feature.lx-spot::after { z-index: 0; }
.feature > * { position: relative; z-index: 1; }
.lx-hero { perspective: 1400px; }
.lx-hero .lx-glow-a { translate: calc(var(--gx, 0px) * -1) calc(var(--gy, 0px) * -1 + var(--lx-scroll, 0) * .25px); transition: translate .4s ease-out; }
.lx-hero .lx-glow-b { translate: var(--gx, 0px) calc(var(--gy, 0px) - var(--lx-scroll, 0) * .15px); transition: translate .4s ease-out; }
.lx-screen { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; transition: transform .35s ease-out, box-shadow .35s; }
.lx-screen:hover { box-shadow: 0 -20px 90px -16px rgba(63, 209, 191, .5); }
.lx-hero .btn, .lx-cta-actions .btn { translate: var(--bx, 0px) var(--by, 0px); transition: translate .2s ease-out, background-color .15s, box-shadow .2s; }
.btn-lx:hover { box-shadow: 0 12px 34px -8px rgba(63, 209, 191, .75); }
.lx-pillar-icon, .entry-icon, .feature-icon { transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.lx-pillar:hover .lx-pillar-icon, .entry-card:hover .entry-icon, .feature:hover .feature-icon { transform: translateY(-3px) rotate(-6deg) scale(1.08); }
.journey-num { transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.journey-step:hover .journey-num { transform: scale(1.12); }
.lx-hero h1 { background-size: 200% 100%; animation: lx-up .7s cubic-bezier(.2, .8, .2, 1) both, lx-shine 8s 1s ease-in-out infinite alternate; }
@keyframes lx-shine { to { background-position: 100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .lx-hero h1 { animation: none; }
  .lx-screen, .lx-hero .btn, .lx-cta-actions .btn, .lx-pillar-icon, .entry-icon, .feature-icon, .journey-num { transition: none; transform: none; translate: none; }
}

/* التذييل */
.pub-foot { background: #071521; color: rgba(255, 255, 255, .78); padding-block: 56px max(24px, env(safe-area-inset-bottom)); }
.pub-foot-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.pub-foot-brand { display: flex; align-items: flex-start; gap: 12px; }
.pub-foot-brand img { background: #fff; border-radius: 10px; padding: 3px; }
.pub-foot-brand b { display: block; color: #fff; font-size: 1.1rem; }
.pub-foot-brand small { display: block; font-size: .86rem; margin-block-start: 4px; max-width: 26ch; }
.pub-foot-col { display: flex; flex-direction: column; gap: 10px; }
.pub-foot-col h2 { margin: 0 0 4px; font-size: .95rem; color: #3fd1bf; font-weight: 700; }
.pub-foot-col a { color: rgba(255, 255, 255, .85); text-decoration: none; font-size: .94rem; }
.pub-foot-col a:hover { color: #fff; text-decoration: underline; }
.pub-foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-block-start: 40px; padding-block-start: 20px; border-block-start: 1px solid rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .6); }
.pub-foot a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 4px; }

@media (max-width: 1080px) { .pub-links { display: none; } }
@media (max-width: 960px) {
  .lx-pillars, .entry-grid, .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lx-pillars > :last-child { grid-column: 1 / -1; }
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }
  .journey::before { display: none; }
  .pub-foot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pub-foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .lx-hero { padding-block-start: 44px; }
  .lx-showcase { margin-block-start: 36px; padding-inline: 12px; }
  .lx-screen { padding: 6px 6px 0; border-radius: 14px 14px 0 0; }
  .lx-screen img { border-radius: 9px 9px 0 0; }
  .pub-section { padding-block: 56px; }
  .lx-head { margin-block-end: 28px; }
  .lx-pillars, .entry-grid, .feature-grid, .journey { grid-template-columns: minmax(0, 1fr); }
  .lx-pillars > :last-child { grid-column: auto; }
  .lx-band { padding-block: 56px; }
  .privacy-band { flex-direction: column; gap: 16px; }
  .lx-cta-card { padding: 36px 22px; border-radius: 22px; width: calc(100% - 24px); }
  .lx-cta-actions { flex: 1 1 100%; min-width: 0; }
  .pub-nav .btn-ghost { display: none; }
  .hero-actions .btn { flex: 1 1 100%; }
  .pub-head .brand-slogan { display: none; }
  .pub-foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}

/* ═══════════ 1.4.1 — صفحة الطالب بالبلاطات وحلقات التقدم ═══════════ */
.kid-hello-2 { display: flex; align-items: center; gap: 16px; border-inline-start: 0; background: linear-gradient(120deg, #0f766e 0%, #1688a8 100%); color: #fff; }
.kid-hello-2 h1 { color: #fff; }
.kid-hello-2 p { color: rgba(255, 255, 255, .9); }
.kid-avatar { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: #fff; color: var(--primary); font-size: 1.7rem; font-weight: 800; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.kid-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-block-end: 16px; }
.kid-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; min-height: 120px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; min-width: 0; }
.kid-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16, 24, 20, .10); }
.kid-tile-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; }
.kid-tile-label { font-size: 1.12rem; font-weight: 800; }
.kid-tile-note { font-size: .86rem; color: var(--ink-2); }
.kid-tile.tone-amber .kid-tile-icon { background: #fff1c7; color: #a86b00; }
.kid-tile.tone-teal .kid-tile-icon { background: var(--primary-soft); color: var(--primary); }
.kid-tile.tone-blue .kid-tile-icon { background: var(--info-soft); color: var(--info-ink); }
.kid-tile.tone-green .kid-tile-icon { background: var(--ok-soft); color: var(--ok-ink); }
.kid-tile.tone-violet .kid-tile-icon { background: #efe9fb; color: #5b3aa6; }
.kid-tile.tone-rose .kid-tile-icon { background: #fde8ee; color: #a3244a; }
.kid-tile.is-hot { border: 2px solid #22a35a; }
.kid-tile.is-hot .kid-tile-note { color: #17924d; font-weight: 700; }
.kid-tile.is-hot::after { content: ""; position: absolute; inset-block-start: 14px; inset-inline-end: 14px; width: 10px; height: 10px; border-radius: 50%; background: #22a35a; box-shadow: 0 0 0 4px rgba(34, 163, 90, .2); }

.kid-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kid-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.kid-list-main { display: flex; flex-direction: column; min-width: 0; }
.kid-list-main b { overflow-wrap: anywhere; }
.kid-list-main small { color: var(--muted); }
.kid-chip { flex: none; padding: 4px 12px; border-radius: 999px; font-size: .86rem; font-weight: 700; white-space: nowrap; }
.chip-ok { background: var(--ok-soft); color: var(--ok-ink); }
.chip-info { background: var(--info-soft); color: var(--info-ink); }
.chip-warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip-muted { background: var(--neutral-soft); color: var(--ink-2); }
.chip-due { background: #fff1c7; color: #7a4c00; }

.kid-rings { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.kid-rings li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; min-width: 0; }
.kid-rings b { font-size: .98rem; overflow-wrap: anywhere; }
.kid-rings small { color: var(--muted); font-size: .8rem; }
.ring-wrap { position: relative; display: inline-grid; place-items: center; width: 72px; height: 72px; }
.ring-wrap .ring { position: absolute; inset: 0; }
.ring-val { position: relative; font-weight: 800; font-size: .92rem; font-variant-numeric: tabular-nums; }
.ring-track { stroke: var(--track); }
.ring-bar { stroke: var(--primary); }
.ring-mastered .ring-bar { stroke: var(--good); }
.ring-reinforce .ring-bar { stroke: var(--warning); }
.ring-support .ring-bar { stroke: var(--critical); }

@media (max-width: 640px) {
  .kid-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kid-tile { min-height: 108px; padding: 14px; }
  .kid-hello-2 { padding: 18px; }
  .kid-avatar { width: 50px; height: 50px; font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { .kid-tile:hover { transform: none; } }

/* ═══════════ 1.4.1 — الرئيسية: صف أرقام وتبويبات ═══════════ */
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-block-end: 14px; }
.home-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; min-width: 0; transition: border-color .15s ease, box-shadow .15s ease; }
.home-stat:hover { border-color: var(--primary); box-shadow: 0 8px 20px rgba(16, 24, 20, .08); }
.home-stat-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; }
.home-stat-text { display: flex; flex-direction: column; min-width: 0; }
.home-stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.home-stat-label { font-size: .86rem; color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }
.home-stat.tone-teal .home-stat-icon { background: var(--primary-soft); color: var(--primary); }
.home-stat.tone-blue .home-stat-icon { background: var(--info-soft); color: var(--info-ink); }
.home-stat.tone-warn .home-stat-icon { background: var(--warn-soft); color: var(--warn-ink); }
.home-stat.tone-ok .home-stat-icon, .home-stat.tone-green .home-stat-icon { background: var(--ok-soft); color: var(--ok-ink); }
.home-tabs { display: flex; gap: 6px; padding: 5px; margin-block: 6px 16px; border-radius: 14px; background: var(--neutral-soft); overflow-x: auto; scrollbar-width: none; }
.home-tab { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 18px; border-radius: 10px; color: var(--ink-2); font-weight: 700; text-decoration: none; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.home-tab:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.home-tab.active { background: var(--surface); color: var(--primary-ink); box-shadow: 0 1px 3px rgba(16, 24, 20, .12); }
.home-tab .tab-count { background: var(--warn-soft); color: var(--warn-ink); }
.home-panel[hidden] { display: none; }
@media (max-width: 1023px) { .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) {
  .home-stat { padding: 12px; gap: 10px; }
  .home-stat-icon { width: 40px; height: 40px; }
  .home-stat-value { font-size: 1.3rem; }
  .home-tab { padding: 8px 12px; }
}

/* ═══════════ 1.4.2 — رسوم أوضح: «الدمبل» قبل/بعد، وخط التطور الزمني، وتلميح الرسوم ═══════════ */
.swatch-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-pre { fill: var(--series-pre); background: var(--series-pre); }
.dot-post { fill: var(--series-post); background: var(--series-post); }
.db-list { display: flex; flex-direction: column; gap: 12px; }
.db-label { font-weight: 600; font-size: .92rem; margin-block-end: 2px; overflow-wrap: anywhere; }
.db-plot { display: grid; grid-template-columns: minmax(0, 1fr) 6.8rem; align-items: center; gap: 10px; }
.dumbbell { display: block; overflow: visible; }
.db-track { stroke: var(--border); stroke-width: 1; }
.db-link { stroke: var(--series-post); stroke-opacity: .32; stroke-width: 4; stroke-linecap: round; }
.db-dot { stroke: var(--surface); stroke-width: 2; }
.db-val { font-size: .86rem; text-align: end; white-space: nowrap; }
.db-val strong { font-variant-numeric: tabular-nums; }
.delta-up { color: #006300; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta-down { color: var(--danger-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.delta-flat { color: var(--muted); font-variant-numeric: tabular-nums; }
.dumbbell:hover .db-dot { stroke-width: 3; }
.dumbbell:hover .db-link { stroke-opacity: .5; }

.trend { display: block; overflow: visible; touch-action: pan-y; }
.tr-grid { stroke: var(--border); stroke-width: 1; }
.tr-tick, .tr-date, .tr-ref-label { font-size: 11px; fill: var(--muted); font-family: inherit; font-variant-numeric: tabular-nums; }
.tr-ref { stroke-width: 1; }
.tr-ref-support { stroke: var(--critical); stroke-opacity: .5; }
.tr-ref-mastery { stroke: var(--good); stroke-opacity: .55; }
.tr-line { stroke: var(--series-post); stroke-width: 2; stroke-linecap: round; }
.tr-dot { fill: var(--series-post); stroke: var(--surface); stroke-width: 2; }
.tr-hit { fill: transparent; }
.tr-pt { outline: none; }
.tr-pt:focus-visible .tr-dot, .tr-pt.is-active .tr-dot { stroke: var(--series-post); stroke-opacity: .3; stroke-width: 8; }
.tr-end { font-size: 12px; font-weight: 700; fill: var(--ink); font-family: inherit; }
.tr-cross { stroke: var(--ref); stroke-width: 1; }

.hbar:hover rect:not(.track), .seg:hover { filter: brightness(1.08); }
.chart-tip { position: fixed; top: 0; left: 0; z-index: 80; pointer-events: none; max-width: min(300px, calc(100vw - 16px)); padding: 7px 10px; border-radius: 8px; background: #15201d; color: #fff; font-size: .84rem; line-height: 1.55; box-shadow: 0 8px 22px rgba(0, 0, 0, .2); opacity: 0; transition: opacity .12s ease; }
.chart-tip.show { opacity: 1; }
@media print { .chart-tip { display: none !important; } }

/* صفحات الخصوصية والمساعدة (1.4.2) */
.doc-page { max-width: 860px; padding-block: 40px 56px; }
.doc-head { margin-block-end: 26px; }
.doc-kicker { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); font-size: .86rem; font-weight: 700; }
.doc-head h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; }
.doc-lead { margin: 10px 0 0; font-size: 1.05rem; line-height: 1.9; color: var(--ink-2); text-wrap: pretty; }
.doc-sec { padding: 20px 22px; margin-block-end: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.doc-sec h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin-block-end: 10px; }
.doc-sec ul { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.85; color: var(--ink-2); }
.doc-sec p { margin: 0; line-height: 1.9; color: var(--ink-2); }
.doc-h-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.faq { display: grid; gap: 8px; }
.faq-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.faq-item summary { cursor: pointer; padding: 12px 14px; font-weight: 700; list-style-position: inside; min-height: 44px; }
.faq-item[open] summary { border-block-end: 1px solid var(--border); }
.faq-item p { padding: 12px 14px; }
.doc-contact { background: linear-gradient(120deg, var(--primary-soft), var(--surface) 70%); }
.doc-foot { display: flex; align-items: center; gap: 8px; color: var(--ink-2); margin-block-start: 18px; }
.auth-foot a, .portal-foot a { color: inherit; }

/* ═════════ المسابقات 1.5: نموذج بالمجال والمهارة والمستوى، وأعداد البنك، وتعليمات الطالب، ورسائل الشكر ═════════ */
fieldset.form-section { border: 0; border-block-start: 1px solid var(--border); padding: 16px 0 0; margin: 0 0 18px; min-width: 0; }
fieldset.form-section:first-of-type { border-block-start: 0; padding-block-start: 0; }
fieldset.form-section > legend { font-weight: 700; font-size: 1.02rem; color: var(--primary-ink); padding: 0 0 6px; }
.bank-avail-line { margin: 4px 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info-ink); font-weight: 600; }
.bank-avail-line.is-ok { background: var(--ok-soft); color: var(--ok-ink); }
.bank-avail-line.is-short { background: var(--danger-soft); color: var(--danger-ink); }
.bank-avail { margin-block-start: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.bank-avail > h2 { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; margin: 0 0 4px; }
.bank-grade + .bank-grade { margin-block-start: 14px; }
.bank-grade > h3 { font-size: .98rem; margin: 10px 0 6px; }
.bank-matrix th, .bank-matrix td { text-align: start; }
.bank-matrix td { font-variant-numeric: tabular-nums; width: 13%; }
.bank-matrix tr.dom-row th { font-weight: 700; }
.bank-matrix tr.dom-row > * { background: var(--neutral-soft); }
.bank-matrix tr.skill-row th { font-weight: 500; padding-inline-start: 26px; }
.bank-matrix tr.is-picked > * { background: var(--primary-soft); }
.bank-matrix tr.is-picked th { color: var(--primary-ink); }

.kid-src { margin-block-start: 6px !important; font-weight: 600; color: var(--primary-ink) !important; }
.kid-guide > h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.kid-guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 0 0 14px; }
.kid-guide-box { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
.kid-guide-box h3 { display: flex; align-items: center; gap: 8px; font-size: 1.06rem; margin: 0 0 8px; color: var(--primary-ink); }
.kid-guide-box p { margin: 0 0 10px; line-height: 1.8; }
.kid-points { width: 100%; border-collapse: collapse; font-size: 1rem; }
.kid-points caption { text-align: start; color: var(--ink-2); font-size: .92rem; padding-block-end: 6px; }
.kid-points th, .kid-points td { padding: 8px 10px; border-block-start: 1px solid var(--border); text-align: start; }
.kid-points th { font-weight: 500; }
.kid-points td { white-space: nowrap; text-align: end; }
.kid-points td b { font-size: 1.15rem; color: var(--primary-ink); }
.kid-points tr.zero td b { color: var(--danger-ink); }
.kid-tips { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.75; }
.kid-rewards { margin-block-end: 0; }
.kid-rewards li { background: #fff7dc; }
.kid-ready { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 600; cursor: pointer; }
.kid-ready input { width: 22px; height: 22px; accent-color: var(--primary); }
.thanks-medal { background: #fff3c4 !important; color: #b8860b !important; }
.thanks-msg { max-width: 34rem; margin: 6px auto 0; line-height: 1.9; color: var(--ink-2); }
.kid-thanks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kid-thanks a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: #fffbea; color: inherit; text-decoration: none; }
.kid-thanks a:hover { border-color: var(--primary); }
.kid-thanks small { color: var(--muted); }
.cert-foot b.cert-principal { font-weight: 700; }
.cert-foot small.cert-e { letter-spacing: 0; }

/* ═════════ المسابقات 1.5.1: نموذج مختصر واختيار الأسئلة يدويًا ═════════ */
.mode-choice { border: 0; padding: 0; margin: 4px 0 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.mode-choice > legend { font-weight: 700; padding: 0 0 8px; color: var(--ink); }
.mode-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.mode-card:hover { border-color: var(--border-strong); }
.mode-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-card input { width: 20px; height: 20px; margin-block-start: 2px; accent-color: var(--primary); flex: none; }
.mode-card b { display: block; font-size: 1rem; }
.mode-card small { display: block; color: var(--ink-2); line-height: 1.6; }
.comp-time { margin-block-start: 6px; padding-block-start: 14px; border-block-start: 1px solid var(--border); }
@media (min-width: 900px) { .comp-time { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.comp-q-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.comp-q-line .icon { color: var(--primary); }
.pick-intro { display: flex; gap: 8px; align-items: flex-start; }
.pick-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--primary-soft); margin: 0 0 14px; }
.pick-bar.bottom { margin: 14px 0 0; position: sticky; bottom: 8px; box-shadow: var(--shadow); z-index: 2; }
.pick-count { margin: 0; font-size: 1.02rem; }
.pick-count b { font-size: 1.25rem; color: var(--primary-ink); }
.pick-count b.is-over { color: var(--danger-ink); }
.comp-pick .pick-item.is-picked { border-color: var(--primary); background: #f3faf8; }
.comp-pick .pick-check input { width: 22px; height: 22px; accent-color: var(--primary); }
.comp-students > summary { cursor: pointer; list-style: none; }
.comp-students > summary::-webkit-details-marker { display: none; }
.comp-students > summary h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.comp-students[open] > summary { margin-block-end: 10px; }

/* ═══════════════ تجهيز المنصة لأول مرة (1.6) ═══════════════ */
.setup-card { border-inline-start: 4px solid var(--primary); }
.setup-card h2 { display: flex; align-items: center; gap: 8px; }
.setup-steps { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: setup; }
.setup-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-block-end: 1px solid var(--border); counter-increment: setup; }
.setup-step:last-child { border-block-end: 0; padding-block-end: 0; }
.setup-dot { display: inline-grid; place-items: center; flex: 0 0 auto; inline-size: 26px; block-size: 26px; border-radius: 50%; border: 2px solid var(--border-strong); color: var(--ink-2); font-size: .8rem; font-weight: 700; }
.setup-dot:empty::before { content: counter(setup); }
.setup-step.done .setup-dot { background: var(--ok-soft); border-color: var(--ok-ink); color: var(--ok-ink); }
.setup-step.done .setup-label { color: var(--muted); }
.setup-step.current .setup-dot { border-color: var(--primary); color: var(--primary-ink); }
.setup-step.current .setup-label { font-weight: 700; }
.setup-label { flex: 1; min-width: 10rem; }
.setup-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 767px) { .setup-actions { flex-basis: 100%; padding-inline-start: 38px; } }
@media print { .setup-card { display: none !important; } }

/* ═══════════════ صفحة الطالب: «خطوتك التالية» (1.6) ═══════════════ */
.kid-next { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 18px; margin-block-end: 16px; border-radius: 18px; background: var(--surface); border: 2px solid var(--primary); box-shadow: var(--shadow); }
.kid-next-icon { display: grid; place-items: center; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.kid-next-text { flex: 1; min-width: 12rem; }
.kid-next-text small { display: block; font-size: .8rem; font-weight: 700; color: var(--primary-ink); }
.kid-next-text h2 { margin: 2px 0 4px; font-size: 1.15rem; text-wrap: balance; }
.kid-next-text p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.kid-next.tone-amber { border-color: #e7b23a; }
.kid-next.tone-amber .kid-next-icon { background: #fff1c7; color: #a86b00; }
.kid-next.tone-blue .kid-next-icon { background: var(--info-soft); color: var(--info-ink); }
.kid-next.tone-green .kid-next-icon { background: var(--ok-soft); color: var(--ok-ink); }
@media (max-width: 560px) { .kid-next .btn { flex-basis: 100%; } }

/* ═══════════ 1.7.0 — صفحات الدخول: لوحة النموذج + «درج المبادرة» ═══════════
   الدرج هو العنصر المميز الوحيد: أربع درجات تصعد (أفهم ← أطبّق ← أستنتج ← أتقدم)،
   وكل ما حوله هادئ. لون الجانب يميّز نوع الدخول: أخضر مزرق للعاملين وأزرق للطلاب. */
body.auth-split-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.auth-shell {
  --stage: #0c4a45; --step-1: #13685f; --step-2: #198577; --step-3: #1f9bb6; --step-4: #f2b233; --step-4-ink: #3d2a00;
  flex: 1; display: grid; grid-template-columns: minmax(400px, 540px) minmax(0, 1fr); min-height: 0;
}
.auth-shell-student { --stage: #0f4c73; --step-1: #175f8c; --step-2: #1c76a8; --step-3: #2a93c9; }

.auth-pane { display: flex; justify-content: center; padding: 28px 48px; background: var(--surface); }
.auth-shell .auth-card {
  width: min(400px, 100%); border: 0; border-radius: 0; box-shadow: none; padding: 0; background: none;
  display: flex; flex-direction: column; min-height: 100%;
}
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); border-radius: 10px; }
.auth-brand > span { display: flex; flex-direction: column; line-height: 1.3; }
.auth-shell .auth-brand { margin: 0; }
.auth-shell .auth-brand .brand-name { font-size: 1.15rem; }
.auth-back { display: inline-flex; align-items: center; gap: 4px; font-size: .88rem; color: var(--muted); text-decoration: none; border-radius: 8px; padding: 4px 6px; }
.auth-back:hover { color: var(--primary-ink); text-decoration: underline; }
.auth-body { margin-block: auto; padding-block: 36px 28px; }

.auth-roles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-block-end: 28px;
  background: var(--neutral-soft); border-radius: 12px;
}
.auth-roles a {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 6px 10px;
  border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: .92rem; text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.auth-roles a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.auth-roles a[aria-current="page"] { background: var(--surface); color: var(--primary-ink); box-shadow: 0 1px 2px rgba(16, 24, 20, .08), 0 0 0 1px var(--border); }

.auth-shell .auth-title { font-size: 1.75rem; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-lead { color: var(--muted); margin: 0 0 24px; text-wrap: pretty; }
.auth-form .field { margin-block-end: 18px; }
.auth-form input[type="text"], .auth-form input[type="password"] { min-height: 50px; border-radius: 10px; background: #fbfcfc; }
.auth-form input:hover { border-color: #aeb9b4; }
.auth-form input:focus { background: var(--surface); }
.auth-form .btn-lg { margin-block-start: 8px; border-radius: 10px; }

/* حقل بأيقونة في بدايته */
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > input { padding-inline-start: 44px; }
.input-icon:focus-within > .icon { color: var(--primary); }
.caps-hint { min-height: 0; margin: 6px 0 0; color: var(--warn-ink); font-weight: 600; }
.caps-hint:empty { display: none; }

/* رقم الدخول والرمز السري للطلاب: أرقام كبيرة متباعدة */
.auth-form .digits-input { min-height: 60px; font-size: 1.6rem; font-weight: 600; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-form .digits-input::placeholder { color: #c3ccc8; letter-spacing: .3em; }

.auth-note { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: .86rem; text-wrap: pretty; }
.auth-shell .auth-foot { margin: 0; text-align: start; font-size: .8rem; }

/* الحسابات التجريبية: أزرار تعبئة */
.auth-shell .demo-accounts { margin-block-start: 24px; }
.auth-shell .demo-accounts ul { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.demo-fill {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: .8rem; text-align: start; cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.demo-fill code { font-weight: 700; color: var(--primary-ink); font-size: .85rem; }
.demo-fill:hover { border-color: var(--primary); background: var(--primary-soft); }

/* الجانب: درج المبادرة */
.auth-side {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  padding: 56px 56px 0; background: var(--stage); color: #fff;
}
.auth-side-title { max-width: 26ch; font-size: clamp(1.6rem, 2.4vw, 2.3rem); line-height: 1.45; font-weight: 700; margin: 0; text-wrap: balance; }
.climb {
  list-style: none; margin: auto 0 0; padding: 40px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end; gap: 10px; height: min(58vh, 460px);
}
.climb-step {
  display: flex; flex-direction: column; justify-content: flex-start; gap: 6px; min-width: 0;
  padding: 18px 16px; border-radius: 14px 14px 0 0; background: var(--step-1);
  transform-origin: bottom center; animation: climb-rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.climb-1 { height: 40%; }
.climb-2 { height: 58%; background: var(--step-2); animation-delay: .08s; }
.climb-3 { height: 78%; background: var(--step-3); animation-delay: .16s; }
.climb-4 { height: 100%; background: var(--step-4); color: var(--step-4-ink); animation-delay: .24s; }
.climb-verb { font-size: clamp(1.3rem, 2vw, 1.9rem); font-weight: 700; line-height: 1.2; }
.climb-text { font-size: .9rem; line-height: 1.55; opacity: .92; text-wrap: pretty; }
@keyframes climb-rise { from { transform: scaleY(.15); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .climb-step { animation: none; } }

.auth-brand:focus-visible, .auth-back:focus-visible, .auth-roles a:focus-visible, .demo-fill:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-pane { padding: 20px 20px 8px; }
  .auth-body { padding-block: 24px 20px; }
  .auth-side { padding: 28px 20px 0; }
  .auth-side-title { font-size: 1.3rem; }
  .climb { height: 260px; padding-block-start: 24px; gap: 6px; }
  .climb-step { padding: 12px 10px; border-radius: 10px 10px 0 0; }
  .climb-text { font-size: .8rem; }
  .auth-shell .auth-foot { text-align: center; padding-block-end: 12px; }
}
@media (max-width: 420px) {
  .auth-shell .auth-title { font-size: 1.5rem; }
  .auth-back { font-size: 0; gap: 0; padding: 8px; }
  .auth-back .icon { width: 20px; height: 20px; }
}
@media (max-width: 560px) {
  .climb { height: 190px; }
  .climb-text { display: none; }
}

/* البطاقة المنفردة (تغيير كلمة المرور الإجباري، الأخطاء قبل الدخول) */
.auth-card-solo { border-radius: 18px; padding: 32px; box-shadow: 0 1px 2px rgba(16, 24, 20, .04), 0 12px 32px rgba(16, 24, 20, .07); }
.auth-card-solo .auth-brand { margin-block-end: 22px; }

/* ═══════════ 1.7.0 — صقل عام للواجهة الداخلية ═══════════ */
/* خلفية القائمة الجانبية تمتد بطول الصفحة كلها (كانت تتوقف عند ارتفاع الشاشة في الصفحات الطويلة) */
@media screen and (min-width: 1024px) {
  .shell {
    background: linear-gradient(to left, var(--surface) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px), var(--border) var(--sidebar-w), transparent var(--sidebar-w));
  }
}
/* عنصر القائمة الحالي: شريط في بدايته إضافة إلى الخلفية */
.nav-link { position: relative; transition: background-color .15s ease, color .15s ease; }
.nav-link.active::before {
  content: ""; position: absolute; inset-inline-start: -10px; inset-block: 8px; width: 3px;
  border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--primary);
}
.nav-link.active .icon { color: var(--primary); }

/* الأزرار: انتقال محدد الخصائص وضغطة محسوسة */
.btn { transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease; }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 1px 2px rgba(11, 82, 73, .25); }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 4px 12px rgba(11, 82, 73, .22); }
.icon-btn { transition: background-color .15s ease, color .15s ease; }

/* الحقول: حدود أوضح عند المرور */
input[type="text"]:hover, input[type="search"]:hover, input[type="password"]:hover, input[type="date"]:hover, input[type="number"]:hover, input[type="url"]:hover, select:hover, textarea:hover { border-color: #aeb9b4; }
input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }

/* الأرقام بعرض ثابت في المؤشرات والجداول لسهولة المقارنة */
.stat-value, .table td, .kpi-value { font-variant-numeric: tabular-nums; }

/* ═══ 1.8: القائمة بأقسام تنطوي، وعناوين دورة المبادرة بارزة ═══ */
.nav-group-top { margin-block-start: 0; padding-block-end: 6px; border-block-end: 1px solid var(--border); }
details.nav-group { margin-block-start: 4px; }
details.nav-group > summary.nav-group-title {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: var(--radius-sm); min-height: 40px;
  font-size: .86rem; font-weight: 700; color: var(--ink-2); user-select: none;
}
details.nav-group > summary.nav-group-title::-webkit-details-marker { display: none; }
details.nav-group > summary:hover { background: var(--neutral-soft); color: var(--ink); }
details.nav-group > summary .icon { margin-inline-start: auto; color: var(--muted); transition: transform .15s ease; }
details.nav-group[open] > summary .icon { transform: rotate(180deg); }
details.nav-group > ul { padding-block: 2px 6px; }
.nav-group-cycle > summary.nav-group-title { align-items: baseline; }
.nav-verb { font-size: 1.06rem; font-weight: 800; color: var(--primary-ink); display: inline-flex; align-items: center; gap: 8px; }
.nav-verb::before { content: ""; inline-size: 4px; block-size: 1.05em; border-radius: 2px; background: var(--primary); align-self: center; }
.nav-group-cycle[data-nav-group="apply"] .nav-verb::before { background: #2a78d6; }
.nav-group-cycle[data-nav-group="conclude"] .nav-verb::before { background: #7c5bd6; }
.nav-group-cycle[data-nav-group="progress"] .nav-verb::before { background: #e3a008; }
.nav-sub { font-size: .76rem; font-weight: 600; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { details.nav-group > summary .icon { transition: none; } }

/* العام الدراسي: أرقام باتجاه ثابت */
.ac-year bdi { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* شريط تقدم عام (progress أصلي يعمل بلا JS وبلا أنماط مضمنة) */
progress.meter { appearance: none; -webkit-appearance: none; display: block; inline-size: 100%; block-size: 8px; border: 0; border-radius: 999px; background: var(--track); overflow: hidden; }
progress.meter::-webkit-progress-bar { background: var(--track); border-radius: 999px; }
progress.meter::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
progress.meter::-moz-progress-bar { background: var(--primary); border-radius: 999px; }

/* تجهيز المنصة في سطر واحد */
.setup-bar { padding: 12px 16px; border-inline-start: 4px solid var(--primary); }
.setup-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.setup-bar-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 1rem; }
.setup-bar-count { font-size: .82rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink); font-variant-numeric: tabular-nums; }
.setup-bar .meter { flex: 1 1 120px; max-inline-size: 220px; }
.setup-bar-next { margin: 0; flex: 1 1 auto; }
.setup-details { margin-block-start: 6px; }
.setup-details > summary { cursor: pointer; font-size: .84rem; color: var(--primary-ink); font-weight: 600; inline-size: fit-content; }
.setup-details[open] > summary { margin-block-end: 4px; }
@media (max-width: 767px) {
  .setup-bar .meter { flex-basis: 100%; max-inline-size: none; order: 3; }
  .setup-bar-next { flex-basis: 100%; order: 4; }
  .setup-bar-row > .btn { order: 5; flex: 1 1 100%; justify-content: center; }
}
@media print { .setup-bar { display: none !important; } }

/* نص توضيحي للأرقام الفارغة */
.home-stat-hint { font-size: .74rem; color: var(--muted); line-height: 1.35; }

/* الخطوة التالية: زر واحد واضح */
.next-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; margin-block-end: 14px; border-radius: var(--radius); background: var(--info-soft); color: var(--info-ink); }
.next-step p { margin: 0; flex: 1 1 14rem; }

/* اكتمال بيانات الأسر */
.family-progress { padding: 14px 16px; }
.family-progress-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-block-end: 10px; }
.family-progress h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1rem; }
.family-progress .card-sub { margin: 2px 0 0; }
.improvement-note { margin: 0 0 10px; }

/* ═══════════════════════════════════════════════════════════
   الوضع الليلي
   يتبع إعداد الجهاز حتى يختار المستخدم بنفسه (يُحفظ على الجهاز نفسه).
   كله داخل @media screen: الطباعة تبقى فاتحة دائمًا، وصفحات الطباعة
   (بطاقات الدخول والشهادات) تُثبَّت على الفاتح من الخادم.
   ═══════════════════════════════════════════════════════════ */

/* زر التبديل: يظهر فقط حين يعمل السكربت، والأيقونة تتبع الوضع الحالي */
.theme-toggle { display: none; }
.has-theme .theme-toggle { display: inline-grid; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.auth-tools { display: flex; align-items: center; gap: 4px; }
.auth-solo-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.portal-head .theme-toggle, .kid-user .theme-toggle { flex: none; }
.portal-head .theme-toggle { margin-inline-start: auto; }

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1514;
    --surface: #162120;
    --surface-2: #1b2725;
    --ink: #e5ecea;
    --ink-2: #bfcac6;
    --ink-3: #a9b5b0;
    --muted: #94a29d;
    --border: #283634;
    --border-strong: #3a4b48;
    --primary: #2bb3a3;
    --primary-hover: #4cc6b7;
    --primary-soft: #133632;
    --primary-ink: #6fd8ca;
    --on-primary: #03221e;
    --focus: #79a8ff;
    --brand-tint: #15302c;

    --ok-ink: #86d98c;   --ok-soft: #15301b;
    --warn-ink: #f2c96b; --warn-soft: #33290e;
    --danger: #e5534b;   --danger-ink: #ff958c; --danger-soft: #3b1917;
    --info-ink: #94bdf2; --info-soft: #172a41;
    --neutral-soft: #212d2b;

    --series-pre: #a6a59e;
    --series-post: #5a9df0;
    --good: #35c252;
    --warning: #fab219;
    --critical: #ec6a63;
    --planned: #5a9df0;
    --cancelled: #5e5d57;
    --track: #25312f;
    --ref: #6c7874;

    --high-ink: #ff958c;   --high-soft: #3b1917;   --high-bar: #ec6a63;
    --medium-ink: #f2c96b; --medium-soft: #30270e; --medium-bar: #e0a107;
    --low-ink: #94bdf2;    --low-soft: #172a41;    --low-bar: #5a9df0;

    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  }

  /* الإطار والعناصر العامة */
  [data-theme="dark"] .skip-link { color: var(--bg); }
  [data-theme="dark"] .demo-banner { border-block-end-color: #5a4a1c; }
  [data-theme="dark"] .topbar { background: rgba(22, 33, 32, .92); }
  [data-theme="dark"] .pub-head { background: rgba(22, 33, 32, .92); }
  [data-theme="dark"] .btn-secondary:hover { background: #1a4a44; }
  [data-theme="dark"] .btn-danger { color: #fff; background: #c4392f; }
  [data-theme="dark"] .btn-danger:hover { background: #a92e25; }
  [data-theme="dark"] .btn-primary,
  [data-theme="dark"] .btn-primary:hover { box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
  [data-theme="dark"] .alert-success { border-color: #2c5a31; }
  [data-theme="dark"] .alert-error { border-color: #6b2a25; }
  [data-theme="dark"] .alert-info { border-color: #2a4a70; }
  [data-theme="dark"] .alert-warning { border-color: #5a4a1c; }
  [data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { box-shadow: 0 0 0 3px rgba(43, 179, 163, .25); }
  [data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):hover,
  [data-theme="dark"] select:hover, [data-theme="dark"] textarea:hover { border-color: #536661; }
  [data-theme="dark"] .table tbody tr:hover { background: var(--surface-2); }
  [data-theme="dark"] .step.current .step-dot { background: var(--surface); }
  [data-theme="dark"] .confirm-dialog { background: var(--surface); box-shadow: 0 20px 50px rgba(0, 0, 0, .55); }
  [data-theme="dark"] .confirm-dialog::backdrop,
  [data-theme="dark"] body.nav-open .backdrop { background: rgba(0, 0, 0, .6); }
  [data-theme="dark"] .priority.top { background: #2a1615; }
  [data-theme="dark"] .report-card:hover { background: var(--surface-2); }
  [data-theme="dark"] .stat-bad { border-color: #6b2a25; }
  [data-theme="dark"] .ai-proposal.is-done { border-color: #2c5a31; }
  [data-theme="dark"] .hub-panel:target { box-shadow: 0 0 0 3px rgba(43, 179, 163, .2); }
  [data-theme="dark"] .home-tab:hover,
  [data-theme="dark"] .auth-roles a:hover { background: rgba(255, 255, 255, .06); }
  [data-theme="dark"] .home-tab.active { box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
  [data-theme="dark"] .delta-up { color: #7fdc85; }
  [data-theme="dark"] .chart-tip { background: #2a3836; border: 1px solid #3a4b48; box-shadow: 0 8px 22px rgba(0, 0, 0, .5); }
  [data-theme="dark"] .lv-mastered { border-color: #2c5a31; }
  [data-theme="dark"] .lv-reinforce { border-color: #5a4a1c; }
  [data-theme="dark"] .lv-support { border-color: #2a4a70; }
  [data-theme="dark"] .review-opts li.correct { border-color: #2c5a31; }
  [data-theme="dark"] .review-opts li.wrong { border-color: #6b2a25; }
  [data-theme="dark"] .comp-pick .pick-item.is-picked { background: var(--primary-soft); }
  [data-theme="dark"] .nav-group-cycle[data-nav-group="apply"] .nav-verb::before { background: #5a9df0; }
  [data-theme="dark"] .nav-group-cycle[data-nav-group="conclude"] .nav-verb::before { background: #a088ec; }

  /* خلفيات الصفحات المتدرجة */
  [data-theme="dark"] body.auth { background: linear-gradient(180deg, #11302c 0%, var(--bg) 320px); }
  [data-theme="dark"] body.portal,
  [data-theme="dark"] body.kid { background: linear-gradient(180deg, #11302c 0%, var(--bg) 280px); }
  [data-theme="dark"] .auth-card { box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
  [data-theme="dark"] .auth-form input[type="text"],
  [data-theme="dark"] .auth-form input[type="password"] { background: var(--surface-2); }
  [data-theme="dark"] .auth-form .digits-input::placeholder { color: #4d5c58; }

  /* الصفحة العامة */
  [data-theme="dark"] .entry-student .entry-icon { background: #35290c; color: #f2c96b; }
  [data-theme="dark"] .lx-pillar:hover { box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6); }
  [data-theme="dark"] .entry-card:hover { box-shadow: 0 16px 36px -18px rgba(0, 0, 0, .6); }
  [data-theme="dark"] .pub-foot { background: #050f17; }

  /* ألوان دافئة (المسابقات، لوحة الشرف، منطقة الطالب) */
  [data-theme="dark"] .comp-icon,
  [data-theme="dark"] .kid-comp-icon,
  [data-theme="dark"] .play-score,
  [data-theme="dark"] .chip-due,
  [data-theme="dark"] .kid-tile.tone-amber .kid-tile-icon,
  [data-theme="dark"] .kid-next.tone-amber .kid-next-icon { background: #35290c; color: #f2c96b; }
  [data-theme="dark"] .kid-tile.tone-violet .kid-tile-icon { background: #2a2145; color: #c3aef5; }
  [data-theme="dark"] .kid-tile.tone-rose .kid-tile-icon { background: #3d1a26; color: #f5a3bd; }
  [data-theme="dark"] .kid-tile.is-hot .kid-tile-note,
  [data-theme="dark"] .fb-points { color: #4fd17c; }
  [data-theme="dark"] .kid-tile:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
  [data-theme="dark"] .medal-count,
  [data-theme="dark"] .comp-winners .icon,
  [data-theme="dark"] .honor-title .icon,
  [data-theme="dark"] .kid-hello-comp h1 .icon { color: #f2c14b; }
  [data-theme="dark"] tr.top-1, [data-theme="dark"] .kid-rewards li { background: #33290e; }
  [data-theme="dark"] tr.top-2 { background: #222c33; }
  [data-theme="dark"] tr.top-3 { background: #35251a; }
  [data-theme="dark"] .podium-1 { background: linear-gradient(180deg, #4a3a0f, #33290e); }
  [data-theme="dark"] .podium-2 { background: linear-gradient(180deg, #2f3a42, #232c33); }
  [data-theme="dark"] .podium-3 { background: linear-gradient(180deg, #4a3121, #35251a); }
  [data-theme="dark"] .podium-1 .podium-medal { color: #f2c14b; }
  [data-theme="dark"] .podium-2 .podium-medal { color: #b9c4cc; }
  [data-theme="dark"] .podium-3 .podium-medal { color: #e2a47a; }
  [data-theme="dark"] .kid-comp-card { border-color: #7a6220; background: linear-gradient(180deg, #2c240d, var(--surface) 60%); }
  [data-theme="dark"] .kid-hello-comp { background: linear-gradient(120deg, #2e250c, var(--surface) 70%); }
  [data-theme="dark"] .kid-comp-list .is-live a { background: linear-gradient(90deg, #15301f, var(--surface)); }
  [data-theme="dark"] .fb-ok { background: linear-gradient(180deg, #15301f, var(--surface)); }
  [data-theme="dark"] .fb-no { background: linear-gradient(180deg, #3b1917, var(--surface)); }
  [data-theme="dark"] .fb-time { background: linear-gradient(180deg, #33290e, var(--surface)); }
  [data-theme="dark"] .won-gold { background: linear-gradient(180deg, #33290e, var(--surface) 70%); border-color: #8a6d1c; }
  [data-theme="dark"] .won-silver { background: linear-gradient(180deg, #232c33, var(--surface) 70%); border-color: #4d5a63; }
  [data-theme="dark"] .won-bronze { background: linear-gradient(180deg, #35251a, var(--surface) 70%); border-color: #7a4f30; }
  [data-theme="dark"] .kid-board .rank-1 { background: #33290e; border-color: #8a6d1c; }
  [data-theme="dark"] .kid-board .rank-1 .kb-rank { color: #f2c14b; }
  [data-theme="dark"] .kid-board .rank-2 { background: #232c33; border-color: #4d5a63; }
  [data-theme="dark"] .kid-board .rank-2 .kb-rank { color: #b9c4cc; }
  [data-theme="dark"] .kid-board .rank-3 { background: #35251a; border-color: #7a4f30; }
  [data-theme="dark"] .kid-board .rank-3 .kb-rank { color: #e2a47a; }
  [data-theme="dark"] .kid-thanks a { background: #2c240d; }
  [data-theme="dark"] .kid-avatar { background: #e5ecea; color: #0f766e; }
  [data-theme="dark"] .kid-hello-2 { background: linear-gradient(120deg, #0d5c55 0%, #126e87 100%); }

}

/* ═══ القياس الإلكتروني (1.14): إعداد الوقت للمعلمة، والحل من حساب الطالب ═══ */
.online-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.online-box legend { font-weight: 700; padding-inline: 6px; }
.online-box .form-grid { margin-block-start: 10px; }
.online-card .card-head h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.student-answer { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-block-end: 8px; }
.student-answer p { margin: 4px 0 0; }
.result-hero h2 { font-size: 1.6rem; margin: 10px 0 6px; }
.take { max-width: 860px; margin-inline: auto; }
.take-head { position: sticky; inset-block-start: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px; margin-block-end: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(16, 35, 59, .08); }
.take-head h1 { font-size: 1.3rem; margin: 0; }
.take-head p { margin: 2px 0 0; }
.take-timer { margin: 0; flex: 1 1 260px; max-width: 420px; }
.take-timer-label { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; white-space: nowrap; }
.take-timer .play-timer-num { width: auto; min-width: 84px; height: 42px; padding-inline: 12px; border-radius: 999px; font-size: 1.2rem; }
.take-progress { margin: 0 0 10px; color: var(--ink-2); }
.take-item { background: var(--surface); transition: border-color .15s; }
.take-item.is-answered { border-inline-start: 4px solid #22a35a; }
.take-q { font-size: 1.12rem; font-weight: 600; line-height: 1.8; }
.take-choices .choice { min-height: 52px; font-size: 1rem; }
.take-item textarea { width: 100%; }
.take-actions { margin-block-start: 16px; }
.take-form.is-locked { opacity: .6; pointer-events: none; }
.kid-tests .kid-list-main { color: inherit; text-decoration: none; }
@media (max-width: 600px) {
  .take-head { inset-block-start: 6px; padding: 8px 12px; gap: 6px; }
  .take-head h1 { font-size: 1.05rem; }
  .take-head p { display: none; }
  .take-timer { max-width: none; flex-basis: 100%; }
}
.kid-count { display: inline-flex; align-items: center; gap: 6px; margin-block-start: 6px; padding: 4px 12px; border-radius: 999px; background: #10233b; color: #fff; font-size: .9rem; font-weight: 600; width: fit-content; }
.kid-count b { color: #ffd666; font-size: 1.05rem; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.kid-tests .kid-test.is-todo, .kid-tests .kid-test.is-doing { border: 2px solid #22a35a; background: var(--ok-soft); }
.kid-tests .kid-test .btn { flex: none; }
.kid-next .kid-count { margin-block-start: 8px; }
.kid-count, .kid-count span { white-space: nowrap; }
.kid-tests .kid-test { flex-wrap: wrap; }
.kid-tests .kid-test .kid-list-main { flex: 1 1 240px; }
@media (max-width: 600px) {
  .kid-tests .kid-test .btn { flex: 1 1 100%; justify-content: center; }
}

/* لوحة مالك المنصة (1.16.0) */
.card-head-pad { padding: 18px 20px 0; }
.service-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.service-note { display: inline; }
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-block-end: 1px solid var(--border); }
.event-list li:last-child { border-block-end: 0; }
.event-list time { white-space: nowrap; font-size: .85rem; }
.status-list { margin: 0; }
.status-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-block-end: 1px solid var(--border); }
.status-row:last-child { border-block-end: 0; }
.status-row dt { color: var(--muted); }
.status-row dd { margin: 0; text-align: end; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--primary); }
@media (max-width: 640px) {
  .event-list li { flex-direction: column; gap: 2px; }
}
.switch .switch-state::before { content: 'موقوفة'; color: var(--muted); }
.switch input:checked + .switch-state::before { content: 'تعمل'; color: var(--primary); font-weight: 600; }

/* ===== الافتتاحية والفيديو التعريفي (الصفحة الرئيسية) =====
   حركة الشعار ← خطوات المنهجية ← اسم المنصة ← ومضة ضوء ← الفيديو. داكنة دائمًا لتطابق الفيديو. */
.intro { display: none; }
.intro-on .intro {
  --in-bg: #071312; --in-ink: #f2f7f6; --in-teal: #3fd1bf; --in-blue: #5aa2f0; --in-gold: #f2b233;
  display: block; position: fixed; inset: 0; z-index: 1000; background: var(--in-bg); color: var(--in-ink); overflow: hidden;
  transition: opacity .7s ease, visibility .7s;
}
.intro-on body { overflow: hidden; }
.intro.is-out { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-bg { position: absolute; inset: 0; pointer-events: none; }
.intro-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.intro-glow-a { inline-size: 60vmax; block-size: 60vmax; inset-block-start: -22vmax; inset-inline-end: -14vmax; background: radial-gradient(circle, #0f766e, transparent 65%); animation: intro-drift 9s ease-in-out infinite alternate; }
.intro-glow-b { inline-size: 48vmax; block-size: 48vmax; inset-block-end: -20vmax; inset-inline-start: -12vmax; background: radial-gradient(circle, #1e6fb0, transparent 65%); opacity: .4; animation: intro-drift 11s ease-in-out infinite alternate-reverse; }
.intro-grid { position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(63, 209, 191, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(63, 209, 191, .07) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(circle at 50% 45%, #000 0, transparent 62%); -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0, transparent 62%);
  animation: intro-grid 3.4s ease-out both; }
@keyframes intro-drift { to { transform: translate(-6vmax, 5vmax) scale(1.12); } }
@keyframes intro-grid { from { opacity: 0; transform: scale(1.25); } to { opacity: .5; transform: scale(1); } }

.intro-stage { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center;
  transition: transform .9s cubic-bezier(.7, 0, .2, 1), opacity .7s ease, filter .7s ease; }
.intro-mark { position: relative; display: grid; place-items: center; inline-size: 150px; block-size: 150px; animation: intro-float 3s ease-in-out .9s infinite alternate; }
.intro-mark svg { position: relative; filter: drop-shadow(0 0 22px rgba(63, 209, 191, .35)); }
.intro-stroke { fill: none; stroke-width: 7.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.intro-stroke-a { stroke: var(--in-teal); animation: intro-draw .6s cubic-bezier(.6, 0, .3, 1) .15s forwards; }
.intro-stroke-b { stroke: var(--in-blue); animation: intro-draw .6s cubic-bezier(.6, 0, .3, 1) .5s forwards; }
.intro-gem { fill: var(--in-gold); transform-box: fill-box; transform-origin: center; opacity: 0; animation: intro-gem .55s cubic-bezier(.3, 1.6, .5, 1) 1s forwards; }
.intro-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(63, 209, 191, .55); opacity: 0; animation: intro-ring 1.6s ease-out 1s; }
.intro-ring-2 { border-color: rgba(242, 178, 51, .5); animation-delay: 1.25s; }
@keyframes intro-draw { to { stroke-dashoffset: 0; } }
@keyframes intro-gem { 0% { opacity: 0; transform: rotate(45deg) scale(0); } 100% { opacity: 1; transform: rotate(45deg) scale(1); } }
@keyframes intro-ring { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes intro-float { to { transform: translateY(-6px); } }

.intro-words { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin: 6px 0 0; padding: 0; font-size: clamp(1.05rem, 3.2vw, 1.5rem); font-weight: 700; }
.intro-word { opacity: 0; transform: translateY(14px) scale(.9); filter: blur(6px); animation: intro-word .45s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.intro-word-a { color: var(--in-teal); animation-delay: 1.15s; }
.intro-word-b { color: #7fe3d6; animation-delay: 1.35s; }
.intro-word-c { color: var(--in-blue); animation-delay: 1.55s; }
.intro-word-d { color: var(--in-gold); animation-delay: 1.75s; }
.intro-word + .intro-word::before { content: '•'; margin-inline-end: 22px; color: rgba(242, 247, 246, .25); }
@keyframes intro-word { to { opacity: 1; transform: none; filter: none; } }

.intro-title { margin: 4px 0 0; font-size: clamp(2.6rem, 10vw, 5.4rem); font-weight: 800; line-height: 1.15;
  background: linear-gradient(100deg, #f2f7f6 0%, #f2f7f6 40%, #9ff0e5 50%, #f2f7f6 60%, #f2f7f6 100%); background-size: 250% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  clip-path: inset(0 0 0 100%); animation: intro-title .8s cubic-bezier(.7, 0, .2, 1) 2s forwards, intro-shine 1.2s ease 2.6s forwards; }
@keyframes intro-title { to { clip-path: inset(0 0 0 0); } }
@keyframes intro-shine { to { background-position: -50% 0; } }
.intro-tag { margin: 0; color: #b7c7cc; font-size: clamp(.95rem, 2.6vw, 1.15rem); opacity: 0; animation: intro-word .6s ease 2.55s forwards; }
.intro-sweep { position: absolute; inset-block: -20%; inline-size: 18%; inset-inline-start: -30%; transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14), transparent); pointer-events: none; animation: intro-sweep 1s ease-in 3s forwards; }
@keyframes intro-sweep { to { inset-inline-start: 120%; } }

/* الانتقال إلى الفيديو: الافتتاحية تقترب وتذوب، والفيديو يتسع من المنتصف */
.intro.is-video .intro-stage { transform: scale(1.35); opacity: 0; filter: blur(10px); pointer-events: none; }
.intro-player { position: absolute; inset: 0; background: #0b1615; display: grid; place-items: center; opacity: 0; transform: scale(.86); visibility: hidden;
  transition: opacity .8s ease .15s, transform 1s cubic-bezier(.2, .8, .2, 1) .1s, visibility .8s; }
.intro.is-video .intro-player { opacity: 1; transform: none; visibility: visible; }
.intro-video { inline-size: 100%; block-size: 100%; object-fit: contain; background: #0b1615; }
.intro-bar { position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 4px; background: rgba(255, 255, 255, .1); }
.intro-bar-fill { display: block; block-size: 100%; inline-size: 100%; background: linear-gradient(90deg, var(--in-gold), var(--in-teal), var(--in-blue)); transform: scaleX(var(--intro-p, 0)); transform-origin: right; }

.intro-skip, .intro-sound { font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; }
.intro-skip { position: absolute; z-index: 2; inset-block-start: max(18px, env(safe-area-inset-top)); inset-inline-start: 18px; padding: 10px 18px; font-weight: 700; font-size: .95rem;
  color: var(--in-ink); background: rgba(7, 19, 18, .55); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; animation: intro-word .5s ease .6s forwards; transition: background .2s, border-color .2s; }
.intro-skip:hover, .intro-skip:focus-visible { background: rgba(63, 209, 191, .2); border-color: var(--in-teal); }
.intro-sound { position: absolute; inset-block-end: max(34px, calc(env(safe-area-inset-bottom) + 20px)); inset-inline-start: 50%; translate: 50% 0; padding: 12px 22px; font-weight: 700;
  color: #04211d; background: var(--in-teal); border: 0; box-shadow: 0 10px 34px -8px rgba(63, 209, 191, .7); animation: intro-pulse 1.6s ease-in-out infinite; }
.intro-sound[hidden] { display: none; }
@keyframes intro-pulse { 50% { box-shadow: 0 0 0 10px rgba(63, 209, 191, .18), 0 10px 34px -8px rgba(63, 209, 191, .7); } }
.intro :focus-visible { outline: 3px solid var(--in-gold); outline-offset: 3px; }

/* زر «شاهد الفيديو التعريفي» في الواجهة */
.lx-watch { font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; margin-block-start: 18px; padding: 6px 16px 6px 6px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .05); color: var(--lx-ink, #f2f7f6); font-weight: 600; transition: background .2s, border-color .2s; }
.lx-watch:hover, .lx-watch:focus-visible { background: rgba(63, 209, 191, .14); border-color: rgba(63, 209, 191, .5); }
.lx-watch-icon { display: grid; place-items: center; inline-size: 32px; block-size: 32px; border-radius: 50%; background: var(--lx-gold, #f2b233); color: #2a1c00; }

@media (prefers-reduced-motion: reduce) {
  .intro-on .intro *, .intro-on .intro { animation-duration: .01s !important; animation-delay: 0s !important; }
  .intro-glow, .intro-mark, .intro-sound { animation: none !important; }
  .intro-stage, .intro-player { transition: opacity .3s ease !important; transform: none !important; }
}
@media print { .intro { display: none !important; } }
