/* ==========================================================================
   صفحات الدروس: الفهرس العام، صفحة المادة، صفحة الدرس
   ========================================================================== */

/* ---------- ترويسة داخلية ---------- */
.page-hero {
  position: relative;
  background: var(--navy);
  color: var(--white);
  padding-block: calc(var(--header-h) + 64px) 70px;
  overflow: hidden;
  isolation: isolate;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 78% 15%, rgba(76, 125, 255, 0.4), transparent 52%),
    radial-gradient(circle at 12% 88%, rgba(159, 184, 255, 0.22), transparent 55%);
}
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(ellipse 70% 70% at 60% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 60% 30%, #000 20%, transparent 75%);
}
.page-hero h1 { font-size: clamp(28px, 4.4vw, 52px); margin-block-end: 18px; }
.page-hero p { color: rgba(255, 255, 255, 0.75); max-width: 70ch; font-size: 17.5px; }

/* فتات الطريق */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-block-end: 22px;
}
.crumbs a { transition: color 0.2s var(--ease); }
.crumbs a:hover { color: var(--white); }
.crumbs span.sep { opacity: 0.45; }

/* شارات معلومات الدرس */
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 26px; }
.meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-light);
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
}
.meta svg { width: 15px; height: 15px; color: var(--accent-soft); }

/* ==========================================================================
   فهرس الدروس العام
   ========================================================================== */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 22px;
}

.subject {
  position: relative;
  display: block;
  padding: 30px 26px;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}
.subject::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform 0.45s var(--ease);
}
.subject:hover { transform: translateY(-7px); box-shadow: var(--shadow); border-color: transparent; }
.subject:hover::after { transform: scaleX(1); }

.subject__icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-block-end: 18px;
}
.subject__icon svg { width: 24px; height: 24px; }
.subject h3 { font-size: 20px; margin-block-end: 8px; }
.subject p { color: var(--ink-2); font-size: 15px; margin-block-end: 16px; }
.subject__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-3);
  border-block-start: 1px solid var(--line);
  padding-block-start: 14px;
}
.subject__foot strong { color: var(--accent); font-weight: 700; }

/* مجموعة داخل الفهرس */
.group-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  margin-block: 46px 22px;
}
.group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ==========================================================================
   صفحة المادة: الفصول والدروس
   ========================================================================== */
.chapter {
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-block-end: 20px;
}

.chapter__head {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 26px 28px;
  text-align: start;
  transition: background 0.3s var(--ease);
}
.chapter__head:hover { background: var(--paper); }

.chapter__num {
  flex-shrink: 0;
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--navy), var(--navy-600));
  color: var(--white);
  font-weight: 800;
  font-size: 18px;
}
.chapter__title { flex: 1; min-width: 0; }
.chapter__title h3 { font-size: 20px; margin-block-end: 5px; }
.chapter__title span { font-size: 14px; color: var(--ink-3); }

.chapter__arrow {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--navy);
  transition: transform 0.35s var(--ease), background 0.3s var(--ease);
}
.chapter__arrow svg { width: 15px; height: 15px; }
.chapter.is-open .chapter__arrow { transform: rotate(180deg); background: var(--accent); color: var(--white); }

.chapter__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
}
.chapter.is-open .chapter__panel { grid-template-rows: 1fr; }
.chapter__panel > div { overflow: hidden; }

.lesson-list { list-style: none; margin: 0; padding: 0 28px 24px; }
.lesson-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.lesson-row:hover { background: var(--paper); border-color: var(--line); transform: translateX(-4px); }
html[dir="ltr"] .lesson-row:hover { transform: translateX(4px); }

.lesson-row__num {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
}
.lesson-row__body { flex: 1; min-width: 0; }
.lesson-row__body h4 { font-size: 16.5px; font-weight: 700; margin-block-end: 3px; }
.lesson-row__body p { font-size: 14px; color: var(--ink-3); }
.lesson-row__time { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

.soon-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 28px 26px;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px dashed var(--line);
  color: var(--ink-3);
  font-size: 14.5px;
}

/* ==========================================================================
   صفحة الدرس
   ========================================================================== */
.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 54px;
  align-items: start;
  padding-block: clamp(46px, 6vw, 80px);
}

/* الفهرس الجانبي */
.toc {
  position: sticky;
  inset-block-start: calc(var(--header-h) + 22px);
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--line);
}
.toc h4 {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-block-end: 14px;
  font-weight: 800;
}
.toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a {
  display: block;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
  border-inline-start: 2px solid transparent;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.toc a:hover { background: var(--white); color: var(--navy); }
.toc a.is-active {
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  border-inline-start-color: var(--accent);
}

/* نص الدرس */
.prose { font-size: 17.5px; max-width: 74ch; min-width: 0; }
.prose > * + * { margin-block-start: 22px; }

.prose h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(22px, 2.6vw, 30px);
  margin-block-start: 58px;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.prose h2 .n {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
}
.prose h3 { font-size: 20px; margin-block-start: 34px; }
.prose p { color: var(--ink-2); }
.prose strong { color: var(--navy); font-weight: 700; }

.prose ul, .prose ol { color: var(--ink-2); padding-inline-start: 22px; display: grid; gap: 10px; }
.prose li::marker { color: var(--accent); font-weight: 700; }

.lead {
  font-size: 19.5px;
  color: var(--ink) !important;
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: 20px;
}

/* بطاقات التنبيه */
.callout {
  display: flex;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
}
.callout__icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent);
}
.callout__icon svg { width: 20px; height: 20px; }
.callout h4 { font-size: 16px; margin-block-end: 6px; }
.callout p { font-size: 16px; color: var(--ink-2); }
.callout--tip { background: rgba(76, 125, 255, 0.06); border-color: rgba(76, 125, 255, 0.25); }
.callout--warn { background: #fff8f0; border-color: #f0dcc0; }
.callout--warn .callout__icon { background: #fdefdb; color: #a76b1b; }

/* صندوق مثال */
.example {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.example__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 15px;
}
.example__head svg { width: 17px; height: 17px; color: var(--accent-soft); }
.example__body { padding: 22px; }
.example__body p { font-size: 16.5px; }
.example__body > * + * { margin-block-start: 14px; }

/* جداول */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 16px; background: var(--white); }
thead th {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  padding: 14px 16px;
  text-align: start;
  white-space: nowrap;
}
tbody td { padding: 13px 16px; border-block-start: 1px solid var(--line); color: var(--ink-2); }
tbody tr:nth-child(even) td { background: var(--paper); }
td.num, th.num { font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }

/* رسم توضيحي متحرك */
.figure {
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--navy), var(--navy-700));
  padding: 30px;
  color: var(--white);
  box-shadow: var(--shadow);
}
.figure__caption {
  margin-block-start: 16px;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

/* الميزان المحاسبي */
.scale-wrap { display: grid; place-items: center; }
.scale { width: 100%; max-width: 440px; }
.beam { transform-origin: 200px 60px; animation: tilt 6s ease-in-out infinite; }
@keyframes tilt {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(3.2deg); }
  75% { transform: rotate(-3.2deg); }
}
.pan-l { animation: panL 6s ease-in-out infinite; }
.pan-r { animation: panR 6s ease-in-out infinite; }
@keyframes panL {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(12px); }
  75% { transform: translateY(-12px); }
}
@keyframes panR {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-12px); }
  75% { transform: translateY(12px); }
}

/* الدورة المحاسبية */
.cycle { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: 14px; }
.cycle__step {
  position: relative;
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-light);
  text-align: center;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}
.cycle__step:hover { transform: translateY(-6px); background: rgba(255, 255, 255, 0.12); }
.cycle__step span {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  margin-inline: auto;
  margin-block-end: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
}
.cycle__step h5 { font-size: 15px; margin: 0 0 4px; font-weight: 700; }
.cycle__step p { font-size: 13px; color: rgba(255, 255, 255, 0.62); }

/* ==========================================================================
   الفيديو داخل الدرس
   يقبل: يوتيوب/فيميو عبر <iframe>، أو ملف مرفوع عبر <video>
   ========================================================================== */
.video {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--navy);
  box-shadow: var(--shadow);
}
.video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: linear-gradient(160deg, var(--navy), var(--navy-700));
}
.video__frame iframe,
.video__frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* شكل مؤقت يظهر مكان الفيديو قبل إضافته */
.video__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  padding: 20px;
}
.video__placeholder::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
}
.video__play {
  position: relative;
  width: 74px; height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(76, 125, 255, 0.55);
  animation: pulse 2.6s infinite;
}
.video__play svg { width: 26px; height: 26px; color: #fff; margin-inline-start: 4px; }
html[dir="rtl"] .video__play svg { transform: scaleX(-1); margin-inline-start: 0; margin-inline-end: 4px; }
.video__placeholder span { position: relative; font-size: 15px; }
.video__placeholder small { position: relative; font-size: 13px; color: rgba(255, 255, 255, 0.5); }

.video__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14.5px;
  border-block-start: 1px solid var(--line-light);
}
.video__bar svg { width: 17px; height: 17px; color: var(--accent-soft); flex-shrink: 0; }

/* حساب على شكل حرف T */
.taccount {
  border: 1px solid var(--line-light);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.taccount__name {
  padding: 12px 16px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  border-block-end: 1px solid var(--line-light);
}
.taccount__cols { display: grid; grid-template-columns: 1fr 1fr; }
.taccount__col { padding: 14px 16px; min-height: 120px; }
.taccount__col + .taccount__col { border-inline-start: 1px solid var(--line-light); }
.taccount__side {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent-soft);
  font-weight: 700;
  margin-block-end: 10px;
  text-align: center;
}
.taccount__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.82);
  padding-block: 5px;
}
.taccount__row span:last-child { font-variant-numeric: tabular-nums; }
.taccount__total {
  border-block-start: 1px solid var(--line-light);
  margin-block-start: 8px;
  padding-block-start: 8px;
  font-weight: 700;
  color: #fff;
}

/* نقاط مفتاحية */
.key-points {
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--navy), var(--navy-600));
  color: var(--white);
  padding: 32px;
}
.key-points h3 { color: var(--white); font-size: 20px; margin-block-end: 18px; }
.key-points ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.key-points li { display: flex; gap: 12px; font-size: 16px; color: rgba(255, 255, 255, 0.82); min-width: 0; overflow-wrap: anywhere; }
.key-points li::before {
  content: "";
  flex-shrink: 0;
  width: 22px; height: 22px;
  margin-block-start: 3px;
  border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center/13px no-repeat;
}

/* اختبار سريع */
.quiz {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--white);
  padding: 30px;
  box-shadow: var(--shadow-sm);
}
.quiz > h3 { display: flex; align-items: center; gap: 10px; font-size: 20px; margin-block-end: 6px; }
.quiz > p.hint { color: var(--ink-3); font-size: 15px; margin-block-end: 22px; }

.q { padding-block: 18px; border-block-start: 1px solid var(--line); }
.q:first-of-type { border-block-start: 0; padding-block-start: 0; }
.q__text { font-weight: 700; margin-block-end: 14px; }
.q__options { display: grid; gap: 10px; }
.q__opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--white);
  text-align: start;
  font-size: 16px;
  color: var(--ink-2);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.2s var(--ease);
}
.q__opt:hover:not(:disabled) { border-color: var(--accent); background: rgba(76, 125, 255, 0.05); transform: translateY(-2px); }
.q__opt::before {
  content: "";
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.q__opt.is-right { border-color: #1f9d55; background: #eefaf3; color: #11603a; }
.q__opt.is-right::before { border-color: #1f9d55; background: #1f9d55; }
.q__opt.is-wrong { border-color: #d9534f; background: #fdf0ef; color: #9c2b28; }
.q__opt.is-wrong::before { border-color: #d9534f; background: #d9534f; }

.q__feedback {
  margin-block-start: 12px;
  font-size: 15px;
  color: var(--ink-2);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--paper);
  display: none;
}
.q.is-answered .q__feedback { display: block; animation: fadeUp 0.4s var(--ease); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* مصدر الدرس */
.source-note {
  margin-block-start: 44px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--ink-3);
}
.source-note strong { color: var(--ink-2); }

/* التنقل بين الدروس */
.lesson-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-block-start: 50px;
}
.lesson-nav a {
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--white);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.lesson-nav a:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.lesson-nav span { display: block; font-size: 13px; color: var(--ink-3); margin-block-end: 6px; }
.lesson-nav strong { font-size: 16.5px; color: var(--navy); }
.lesson-nav a.is-disabled { opacity: 0.45; pointer-events: none; }
.lesson-nav .next { text-align: end; }

@media (max-width: 1000px) {
  .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .toc { position: static; order: -1; }
  .toc ul { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); display: grid; }
}

@media (max-width: 640px) {
  .prose { font-size: 16.5px; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-list { padding-inline: 12px 12px; }
  .figure { padding: 18px; }

  .chapter__head { padding: 18px 14px; gap: 12px; }
  .chapter__num { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
  .chapter__title h3 { font-size: 17px; }
  .chapter__title span { font-size: 13px; }
  .chapter__arrow { width: 30px; height: 30px; }

  .lesson-row { padding: 14px 12px; gap: 12px; align-items: flex-start; }
  .lesson-row__num { width: 28px; height: 28px; font-size: 13px; }
  .lesson-row__body h4 { font-size: 15.5px; }
  .lesson-row__body p { font-size: 13.5px; }
  .lesson-row__time { align-self: flex-start; font-size: 12px; }

  .quiz { padding: 22px 18px; }
  .example__body { padding: 18px 14px; }
  .key-points { padding: 24px 20px; }
  .toc { padding: 18px; }
}

/* ==========================================================================
   مصفوفة الأثر والاحتمال (دروس إدارة المخاطر)
   ========================================================================== */
.matrix-wrap { overflow-x: auto; }
.matrix {
  display: grid;
  grid-template-columns: auto repeat(5, minmax(58px, 1fr));
  gap: 6px;
  min-width: 420px;
  color: var(--white);
}
.matrix__cell {
  display: grid;
  place-items: center;
  padding: 12px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  transition: transform 0.25s var(--ease);
}
.matrix__cell:hover { transform: scale(1.06); }
.matrix__head {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-light);
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}
.matrix__low { background: rgba(31, 157, 85, 0.75); }
.matrix__mid { background: rgba(214, 158, 46, 0.8); color: #241a00; }
.matrix__high { background: rgba(217, 83, 79, 0.85); }
.matrix__crit { background: rgba(155, 28, 28, 0.95); }
.matrix__axis {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin-block-start: 12px;
}

/* ==========================================================================
   محاكاة ورقة إكسل + الصيغ (دروس برامج الأوفيس)
   ========================================================================== */
.sheet-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--white);
  margin-block: 22px;
  box-shadow: 0 10px 30px rgba(0, 7, 34, 0.06);
}
.sheet {
  border-collapse: collapse;
  width: 100%;
  min-width: 420px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.sheet th,
.sheet td {
  border: 1px solid #e3e7f0;
  padding: 9px 10px;
  text-align: start;
  white-space: nowrap;
}
.sheet thead th,
.sheet tbody th {
  background: #eef1f8;
  color: #5b6478;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  width: 42px;
}
.sheet td.num { text-align: end; }
.sheet td.hl { background: #eef4ff; font-weight: 700; color: var(--navy); }
.sheet td.res { background: #f0fbf4; font-weight: 700; color: #10633a; }
.sheet td.err { background: #fdeeee; font-weight: 700; color: #a02323; }
.sheet caption {
  caption-side: top;
  padding: 11px 14px;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12.5px;
  font-weight: 600;
  text-align: start;
}

.fx {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  background: #f2f5fb;
  border: 1px solid #dde3ef;
  border-radius: 7px;
  padding: 2px 7px;
  color: #17306b;
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
  vertical-align: middle;
}
.fx-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  padding: 12px 14px;
  margin-block: 18px;
}
.fx-bar__label {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--navy);
  color: var(--white);
  font-weight: 800;
  font-size: 14px;
  font-style: italic;
  flex-shrink: 0;
}
.fx-bar code {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13.5px;
  color: #17306b;
  overflow-x: auto;
  min-width: 0;
}

.keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 12px;
  margin-block: 20px;
}
.keys__item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  padding: 12px 14px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  min-width: 0;
}
.keys__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(0, 7, 34, 0.09);
}
.keys kbd {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  background: var(--navy);
  color: var(--white);
  border-radius: 7px;
  padding: 5px 9px;
  flex-shrink: 0;
  white-space: nowrap;
}
.keys__item span { font-size: 13.5px; color: var(--ink-2); min-width: 0; }

@media (max-width: 640px) {
  .sheet { font-size: 12.5px; }
  .sheet th, .sheet td { padding: 7px 8px; }
}

.sheet td.fxc,
.sheet caption .fxc {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
  font-family: "Consolas", "Courier New", monospace;
}

/* ==========================================================================
   العروض المتحركة التوضيحية (دروس برامج الأوفيس)
   ========================================================================== */
.demo {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 14px 36px rgba(0, 7, 34, 0.08);
  margin-block: 26px;
}
.demo__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--navy);
}
.demo__dots { display: inline-flex; gap: 5px; flex-shrink: 0; }
.demo__dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.26); }
.demo__bar h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--white);
  flex: 1;
  min-width: 0;
}
.demo__replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.demo__replay:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-1px); }
.demo__replay svg { width: 14px; height: 14px; }
.demo__stage {
  position: relative;
  padding: 18px 16px;
  background: linear-gradient(180deg, #fafbff, #f2f5fc);
}
.demo__caption {
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: var(--white);
  font-size: 12.5px;
  color: var(--ink-3);
}

/* شبكة مصغّرة تحاكي الخلايا */
.mini { display: grid; gap: 5px; min-width: 0; }
.mini__row { display: grid; gap: 5px; align-items: stretch; }
.mini__c {
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 7px;
  padding: 8px 9px;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.mini__c.h { background: #e9edf7; color: #525c73; font-weight: 700; font-size: 11.5px; text-align: center; }
.mini__c.n { text-align: end; font-variant-numeric: tabular-nums; }
.mini__c.f {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11.5px;
  text-align: start;
}
.mini__c.ok { background: #eaf9f0; border-color: #bfe8cf; color: #11693d; font-weight: 700; }
.mini__c.bad { background: #fdecec; border-color: #f3c9c9; color: #9e2626; font-weight: 700; }
.mini__c.key { background: #e9f0ff; border-color: #c3d4ff; color: #17306b; font-weight: 700; }

/* شريط الخطوات الموضّحة */
.steps { display: grid; gap: 8px; margin-block-start: 14px; }
.steps__i { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.steps__i b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e4e9f5;
  color: #5b6478;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

/* الحالة الافتراضية = النتيجة النهائية، والحركة تعيد تمثيلها */
.demo.is-playing .steps__i { animation: dStep 0.5s both var(--t); }
.demo.is-playing .steps__i b { animation: dBadge 0.5s both var(--t); }
.demo.is-playing .d-pop { animation: dPop 0.45s both var(--t); }
.demo.is-playing .d-hi { animation: dHi 1.2s both var(--t); }
.demo.is-playing .d-fade { animation: dFade 0.6s both var(--t); }
.demo.is-playing .d-bar { animation: dGrow 0.8s both var(--t); }

@keyframes dStep { from { opacity: 0.4; } to { opacity: 1; } }
@keyframes dBadge {
  from { background: #e4e9f5; color: #5b6478; }
  to { background: var(--accent); color: #fff; }
}
@keyframes dPop {
  from { opacity: 0; transform: translateY(9px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes dHi {
  0% { box-shadow: 0 0 0 0 rgba(76, 125, 255, 0); }
  25% { box-shadow: 0 0 0 5px rgba(76, 125, 255, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(76, 125, 255, 0); }
}
@keyframes dFade { from { opacity: 1; } to { opacity: 0.3; } }
@keyframes dGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* عدّاد متدرّج */
.d-tally {
  position: relative;
  display: inline-grid;
  align-items: center;
  justify-items: end;
  min-width: 130px;
}
.d-tally span {
  grid-area: 1 / 1;
  opacity: 0;
  font-weight: 800;
  font-size: 19px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.d-tally span:last-child { opacity: 1; }
.demo.is-playing .d-tally span { animation: dIn 0.3s both var(--in), dOut 0.3s both var(--out); }
.demo.is-playing .d-tally span:last-child { animation: dIn 0.3s both var(--in); }
@keyframes dIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes dOut { to { opacity: 0; transform: translateY(-9px); } }

/* نافذة إكسل المصغّرة */
.xl { display: grid; gap: 8px; }
.xl__top { display: grid; grid-template-columns: 62px 1fr; gap: 6px; }
.xl__name,
.xl__fx {
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 7px;
  padding: 8px 9px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.xl__name { justify-content: center; font-weight: 700; color: var(--navy); }
.xl__fx i { font-style: italic; font-weight: 800; color: var(--ink-3); flex-shrink: 0; }
.xl__fx code {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  color: #17306b;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.xl__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.xl__tabs span {
  background: #e9edf7;
  border: 1px solid #dfe4f0;
  border-radius: 7px 7px 0 0;
  padding: 6px 12px;
  font-size: 11.5px;
  color: #5b6478;
}
.xl__tabs span.is-on { background: var(--white); color: var(--navy); font-weight: 700; }

/* توزيع الأعمدة لكل عرض */
.demo--anatomy .mini__row { grid-template-columns: 26px 1fr 1fr 1fr; }
.demo--fill .mini__row { grid-template-columns: 24px 1fr 1.25fr 0.9fr; }
.demo--sumif .mini__row { grid-template-columns: 1fr 1fr; }
.demo--lookup .mini__row { grid-template-columns: 1fr 1fr 1fr; }
.demo--pivot .mini__row { grid-template-columns: 1fr 1fr; }

.demo__split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 16px;
}
.demo__col { min-width: 0; }
.demo__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-block-end: 9px;
  color: var(--ink-2);
}
.demo__label.is-bad { color: #9e2626; }
.demo__label.is-ok { color: #11693d; }
.demo__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-start: 14px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.demo__total span { font-size: 12.5px; color: var(--ink-3); }
.d-bar { height: 8px; border-radius: 999px; background: var(--accent); transform-origin: right center; }
[dir="ltr"] .d-bar { transform-origin: left center; }

@media (max-width: 640px) {
  .demo__stage { padding: 14px 12px; }
  .mini__c { padding: 7px 7px; font-size: 11.5px; }
  .mini__c.f { font-size: 10.5px; }
  .demo__bar h4 { font-size: 12.5px; }
  .d-tally span { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .demo__replay { display: none; }
  .demo.is-playing * { animation: none !important; }
}

/* ==========================================================================
   مستند وورد مصغّر (دروس وورد)
   ========================================================================== */
.rbn {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 9px;
  padding: 7px;
}
.rbn span {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 6px;
  color: #5b6478;
  white-space: nowrap;
}
.rbn span.is-on { background: var(--navy); color: var(--white); font-weight: 700; }

.pg {
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 9px;
  padding: 12px;
  display: grid;
  gap: 7px;
  min-width: 0;
}
.pg__hd,
.pg__ft {
  font-size: 10.5px;
  color: var(--ink-3);
  text-align: center;
}
.pg__hd { border-block-end: 1px dashed #dfe4f0; padding-block-end: 7px; }
.pg__ft { border-block-start: 1px dashed #dfe4f0; padding-block-start: 7px; }
.ln { height: 7px; border-radius: 999px; background: #e7ebf4; }
.ln.s { width: 66%; }
.ln.m { width: 86%; }
.ln.h1 { height: 12px; width: 56%; background: var(--navy); }
.ln.h2 { height: 9px; width: 42%; background: var(--accent); }
.ln.plain { background: #cfd6e6; height: 11px; width: 56%; }

.toc-mock { display: grid; gap: 7px; }
.toc-mock div { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.toc-mock i { flex: 1; border-block-end: 1px dotted #c9d2e6; font-style: normal; }
.toc-mock b { font-variant-numeric: tabular-nums; color: var(--navy); }
.toc-mock .sub { padding-inline-start: 16px; color: var(--ink-3); font-size: 12px; }

.trk {
  font-size: 13.5px;
  line-height: 2.1;
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 9px;
  padding: 13px;
}
.trk ins {
  background: #e9f0ff;
  color: #17306b;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  padding: 1px 3px;
  border-radius: 4px;
}
.trk del { background: #fdecec; color: #9e2626; padding: 1px 3px; border-radius: 4px; }

/* ==========================================================================
   شرائح باوربوينت مصغّرة (دروس باوربوينت)
   ========================================================================== */
.sld {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 9px;
  padding: 12px 13px;
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
}
.sld--dark { background: var(--navy); border-color: #0a1d5e; }
.sld--center { align-content: center; justify-items: center; text-align: center; }
.sld__t { font-size: 13px; font-weight: 800; color: var(--navy); line-height: 1.4; }
.sld--dark .sld__t { color: var(--white); }
.sld__b {
  font-size: 11px;
  color: var(--ink-2);
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.6;
  text-align: start;
}
.sld__b::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-block-start: 7px;
  flex-shrink: 0;
}
.sld--dark .sld__b { color: rgba(255, 255, 255, 0.72); }
.sld__big { font-size: 28px; font-weight: 900; color: var(--accent); line-height: 1.1; }
.sld__cap { font-size: 11px; color: var(--ink-3); }
.sld--dark .sld__cap { color: rgba(255, 255, 255, 0.6); }
.sld__bar {
  position: absolute;
  inset-inline-start: 0;
  inset-block: 0;
  width: 5px;
  background: var(--accent);
}
.sld__logo {
  position: absolute;
  inset-block-end: 9px;
  inset-inline-end: 11px;
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.sld--dark .sld__logo { color: rgba(255, 255, 255, 0.45); }

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
  gap: 10px;
}

.chart-mock { display: flex; align-items: flex-end; gap: 7px; height: 92px; }
.chart-mock i {
  flex: 1;
  display: block;
  background: var(--accent);
  border-radius: 5px 5px 0 0;
  transform-origin: bottom;
}
.chart-mock i.dim { background: #cfd8ee; }

.pres { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px; }
.pres__side { display: grid; gap: 9px; align-content: start; min-width: 0; }
.pres__note {
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 9px;
  padding: 10px;
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.7;
}
.pres__timer {
  background: var(--navy);
  color: var(--white);
  border-radius: 9px;
  padding: 9px;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.demo.is-playing .d-rise { animation: dRise 0.7s both var(--t); }
@keyframes dRise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (max-width: 640px) {
  .pres { grid-template-columns: minmax(0, 1fr); }
  .sld__t { font-size: 12px; }
  .sld__big { font-size: 22px; }
}

/* ==========================================================================
   بريد وتقويم مصغّر (دروس أوتلوك)
   ========================================================================== */
.mbox { display: grid; gap: 6px; }
.mrow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 9px;
  padding: 9px 11px;
  min-width: 0;
}
.mrow__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.mrow__b { min-width: 0; }
.mrow__b strong {
  display: block;
  font-size: 12.5px;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mrow__b span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mrow__t { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.mrow--read .mrow__dot { background: #d5dcec; }

.tagx {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.tagx--red { background: #fdecec; color: #9e2626; }
.tagx--green { background: #eaf9f0; color: #11693d; }
.tagx--blue { background: #e9f0ff; color: #17306b; }
.tagx--amber { background: #fff6e6; color: #7a5518; }
.tagx--grey { background: #eef1f8; color: #5b6478; }

.env { background: var(--white); border: 1px solid #e1e6f1; border-radius: 9px; overflow: hidden; }
.env__f {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 11px;
  border-block-end: 1px solid #eef1f7;
  font-size: 12px;
  color: var(--ink);
  align-items: center;
}
.env__f b { color: var(--ink-3); font-weight: 600; font-size: 11.5px; }
.env__f span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.env__body { padding: 12px; font-size: 12.5px; line-height: 1.95; color: var(--ink-2); }
.env__body p { margin: 0 0 9px; }
.env__body p:last-child { margin: 0; }

.cal { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.cal__h { font-size: 10.5px; color: var(--ink-3); text-align: center; font-weight: 700; }
.cal__s { height: 22px; border-radius: 5px; background: #f3f5fa; border: 1px solid #e6eaf3; }
.cal__s.busy { background: #dde4f2; border-color: #c9d3e9; }
.cal__s.free { background: #eaf9f0; border-color: #bfe8cf; }
.cal__s.pick { background: var(--accent); border-color: var(--accent); }

.buckets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
}
.bucket {
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 10px;
  padding: 11px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.bucket h5 { margin: 0; font-size: 12.5px; color: var(--navy); font-weight: 800; }
.bucket p { margin: 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

@media (max-width: 640px) {
  .env__f { grid-template-columns: 46px minmax(0, 1fr); font-size: 11.5px; }
  .mrow { padding: 8px 9px; gap: 8px; }
  .cal__s { height: 18px; }
}

/* ==========================================================================
   محادثة وتوقّع الكلمات (دروس الذكاء الاصطناعي)
   ========================================================================== */
.chat { display: grid; gap: 9px; }
.chat__m {
  max-width: 90%;
  border-radius: 13px;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.9;
  border: 1px solid #e1e6f1;
  background: var(--white);
  color: var(--ink-2);
  min-width: 0;
}
.chat__m--u {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.92);
  border-color: var(--navy);
  justify-self: start;
}
.chat__m--a { justify-self: end; }
.chat__m b { color: var(--navy); }
.chat__m--u b { color: var(--white); }
.chat__who {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  margin-block-end: 5px;
  opacity: 0.6;
}

.toks { display: grid; gap: 7px; }
.tok {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 9px;
  align-items: center;
  font-size: 12.5px;
}
.tok__w {
  position: relative;
  overflow: hidden;
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-radius: 8px;
  padding: 8px 11px;
  min-width: 0;
}
.tok__w i {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  background: var(--accent-dim);
  transform-origin: right center;
  display: block;
}
[dir="ltr"] .tok__w i { transform-origin: left center; }
.tok__w span { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tok__p { font-size: 11.5px; color: var(--ink-3); text-align: end; font-variant-numeric: tabular-nums; }
.tok.is-pick .tok__w { border-color: var(--accent); }
.tok.is-pick .tok__p { color: var(--accent); font-weight: 700; }

.demo.is-playing .d-wide { animation: dGrow 0.7s both var(--t); }

.flags { display: grid; gap: 9px; }
.flag {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  background: var(--white);
  border: 1px solid #e1e6f1;
  border-inline-start: 3px solid #d9534f;
  border-radius: 10px;
  padding: 10px 12px;
}
.flag__n {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fdecec;
  color: #9e2626;
  font-size: 11.5px;
  font-weight: 800;
  flex-shrink: 0;
}
.flag p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.flag p strong { color: var(--navy); }

/* ==========================================================================
   شارات المراجعة وجدول حالة التحديث (أنظمة العمل)
   ========================================================================== */
.rev {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.rev svg { width: 15px; height: 15px; flex-shrink: 0; }
.rev--ok { background: #eaf9f0; color: #11693d; border-color: #bfe8cf; }
.rev--due { background: #fff6e6; color: #7a5518; border-color: #f0dcc0; }
.rev--stale { background: #fdecec; color: #9e2626; border-color: #f3c9c9; }

.rev-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.rev-inline--due { background: #fff6e6; color: #7a5518; }
.rev-inline--stale { background: #fdecec; color: #9e2626; }

.rev-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--white);
  padding: 13px 15px;
  margin-block: 20px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.8;
}
.rev-note svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--accent); margin-block-start: 2px; }
.rev-note a { color: var(--navy); font-weight: 700; }

.rev-sources { display: grid; gap: 7px; margin-block-start: 9px; }
.rev-sources a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--navy);
  font-weight: 600;
}
.rev-sources a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ==========================================================================
   مكوّنات الدرس والمحتوى على الجوال — تخطيط مستقل
   (تُحمَّل lesson.css في كل صفحات الدروس والصفحات الداخلية)
   ========================================================================== */
@media (max-width: 640px) {

  /* الهيرو الداخلي: ارتفاع أقل وعنوان أقرب للأعلى */
  .page-hero { padding-block: calc(var(--header-h) + 30px) 38px; }
  .page-hero h1 { font-size: clamp(26px, 8vw, 34px); margin-block-end: 12px; }
  .page-hero p { font-size: 16px; line-height: 1.8; }
  .crumbs { font-size: 13px; margin-block-end: 14px; }

  /* مخطط الدورة: كان عمودين بعرض ١٢٧ بكسل للخطوة — ضيق على النص.
     عمود واحد يعطي كل خطوة عرضها الكامل. */
  .cycle { grid-template-columns: 1fr; gap: 10px; }
  .cycle__step { padding: 14px 16px; border-radius: 14px; }
  .cycle__step h5 { font-size: 15.5px; }
  .cycle__step p { font-size: 13.5px; }

  /* فهرس الدرس فوق المحتوى: صندوق مضغوط بعمودين لا قائمة طويلة */
  .toc { padding: 16px 18px; border-radius: 16px; }
  .toc h4 { font-size: 13.5px; margin-block-end: 10px; }
  .toc ul { grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .toc a { font-size: 14px; }

  /* التنبيهات: الأيقونة فوق النص بدل جنبه لتوفير العرض */
  .callout { flex-direction: column; gap: 10px; padding: 18px 16px; }
  .callout__icon { width: 34px; height: 34px; }
  .callout h4 { font-size: 16px; }
  .callout p { font-size: 15px; }

  .figure { padding: 18px 14px; }
  .figure__caption { font-size: 13px; }

  /* الجداول تبقى قابلة للسحب أفقيًا مع خط أصغر */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { font-size: 14px; }
  .table-wrap th, .table-wrap td { padding: 10px 12px; }

  .source-note { font-size: 13.5px; padding: 16px; }
}
