/* ===== تحديثات: اختبارات البنوك + توحيد مقاس بطاقات الصفحة الرئيسية ===== */

/* البطاقات الثلاث (الدورات / الاختبارات / الاختبارات المحاكية): نفس العرض ونفس الارتفاع دائماً */
.portals { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.portal { height: 100%; min-width: 0; }
.portal-top { min-height: 64px; }
.portal-top > div { min-width: 0; }
.portal-links { margin-top: 0; flex: 1; }
.portal-links a { min-height: 50px; }
.portal-links a span { min-width: 0; line-height: 1.4; }

/* الشاشات المتوسطة: تبقى الثلاث بطاقات جنب بعض بنفس المقاس (بدل ما المحاكي ياخد سطر كامل) */
@media (max-width: 1100px) {
  .portals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .portals .p-mock { grid-column: auto; }
  .portal { padding: 16px; gap: 14px; }
  .portal-top { flex-direction: column; align-items: flex-start; gap: 10px; }
  .portal-top h2 { font-size: 1.2rem; }
  .portal-links a { padding: 10px 12px; font-size: .92rem; }
}
/* الجوال: بطاقة تحت بطاقة بعرض كامل */
@media (max-width: 760px) {
  .portals { grid-template-columns: 1fr; }
  .portal-top { flex-direction: row; align-items: center; }
}

/* لون تصنيف اختبارات البنوك في لوحة الإدارة */
.pill.cat-banks { background: #ece7fb; color: #5b3fbf; }

/* ================= صور الدورات والدورات المدفوعة ================= */
.cc-band { background: linear-gradient(135deg, #2468b8, #103a70); background-size: cover; background-position: center; }
.cc-band.has-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 24, 48, .15), rgba(8, 24, 48, .55)); }
.cc-band.has-cover > * { z-index: 1; }
.course-card .cc-band { height: 150px; }
.tc-badge.gold { background: linear-gradient(135deg, #e2c27a, #b48a35); border-color: transparent; color: #fff; }
.cc-lock { position: absolute; bottom: 12px; inset-inline-end: 12px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); }
.cc-lock svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cc-lock.big { width: 64px; height: 64px; bottom: auto; inset-inline-end: auto; }
.cc-lock.big svg { width: 32px; height: 32px; }
.course-card.locked .cc-body h3 { color: var(--ink-2); }
.locked-btn { white-space: normal; text-align: center; background: var(--surface-2); color: var(--ink-2); border-color: transparent; }
.locked-btn svg { width: 16px; height: 16px; }
.price-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price-line .price { font: 800 1.45rem var(--font-display); color: var(--orange-ink); }
.old-price { color: var(--ink-3); font-size: .95rem; }
.price-note { color: var(--ink-2); font-size: .85rem; background: var(--surface-2); padding: 1px 10px; border-radius: 999px; }
.wa-sub { background: #25d366 !important; border-color: #25d366 !important; color: #fff !important; gap: 8px; }
.wa-sub:hover { background: #1da851 !important; }
.wa-sub svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.locked-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: center; padding: 0; overflow: hidden; }
.lh-cover { position: relative; min-height: 260px; height: 100%; display: grid; place-items: center; color: #fff; }
.lh-cover > svg { width: 64px; height: 64px; fill: none; stroke: rgba(255,255,255,.85); stroke-width: 1.6; }
.lh-body { display: flex; flex-direction: column; gap: 12px; padding: 22px; align-items: flex-start; }
.lh-desc { color: var(--ink-2); line-height: 1.9; }
.feat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.feat-list li { display: flex; gap: 10px; align-items: flex-start; }
.feat-list svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--good); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; margin-top: 4px; }
.lesson-preview { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: l; }
.lesson-preview li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.lesson-preview svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 2; }
@media (max-width: 760px) { .locked-hero { grid-template-columns: 1fr; } .lh-body { padding: 0 18px 20px; } .lh-cover { min-height: 180px; } }

/* محرر الدورة: الغلاف */
.cover-edit { display: flex; flex-direction: column; gap: 10px; }
.cover-prev { position: relative; height: 170px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.cover-prev .muted { color: rgba(255,255,255,.8) !important; position: relative; z-index: 1; }

/* صفحة الأقسام */
.sec-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sec-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sec-row .field.grow { flex: 1 1 180px; }
.sec-n { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-size: .85rem; align-self: center; }
.sec-count { color: var(--ink-3); font-size: .85rem; align-self: center; white-space: nowrap; }
.sec-count b { color: var(--ink); }
.sec-tools { display: flex; gap: 2px; align-self: center; }

/* ================= الصفحة الرئيسية: الدورات والأسعار ================= */
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; align-items: stretch; }
.price-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 12px 30px rgba(20, 50, 100, .08); transition: transform .25s, box-shadow .25s, border-color .25s; }
.price-card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--orange) 55%, var(--line)); box-shadow: 0 20px 40px rgba(20, 50, 100, .15); }
.price-card.featured { border: 2px solid var(--gold); }
.pc-cover { position: relative; height: 160px; display: grid; place-items: center; color: #fff; }
.pc-cover > svg { width: 54px; height: 54px; fill: none; stroke: rgba(255,255,255,.9); stroke-width: 1.6; }
.pc-badge { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; background: linear-gradient(135deg, #e2c27a, #b48a35); color: #fff; font-weight: 800; font-size: .8rem; padding: 4px 12px; border-radius: 999px; box-shadow: 0 6px 14px rgba(180, 138, 53, .35); }
.pc-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; flex: 1; }
.pc-body h3 { font-size: 1.25rem; color: var(--primary); }
.pc-desc { color: var(--ink-2); line-height: 1.8; }
.pc-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--orange) 8%, var(--surface)); }
.pc-price b { font: 800 1.7rem var(--font-display); color: var(--orange-ink); }
.pc-price s { color: var(--ink-3); }
.pc-price span { color: var(--ink-2); font-size: .88rem; }
.pc-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.pc-feats li { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); }
.pc-feats svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--good); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; margin-top: 4px; }
.pc-meta { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: .88rem; }
.pc-meta svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 2; }
.pc-lessons summary { cursor: pointer; color: var(--primary); font-weight: 800; }
.pc-lessons ol { margin: 8px 0 0; padding-inline-start: 22px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.price-card .lp-btn { margin-top: auto; }
.price-card .lp-btn svg { fill: none; }

/* ================= القائمة الجانبية القابلة للتصغير ================= */
.side-collapse { display: none; }
.side-tip { position: fixed; z-index: 120; transform: translateY(-50%); background: #0c2c56; color: #fff; font-size: .88rem; padding: 6px 12px; border-radius: 9px; white-space: nowrap; pointer-events: none; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.side-tip::after { content: ""; position: absolute; top: 50%; right: -5px; transform: translateY(-50%) rotate(45deg); width: 10px; height: 10px; background: #0c2c56; }
@media (min-width: 1025px) {
  .admin-shell { --side-w: 280px; grid-template-columns: var(--side-w) minmax(0, 1fr); transition: grid-template-columns .25s ease; position: relative; }
  .admin-shell.side-mini { --side-w: 78px; }
  .side-collapse { display: grid; place-items: center; position: fixed; z-index: 45; top: 86px; right: calc(var(--side-w) - 15px); width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: #113d75; color: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.25); transition: right .25s ease, background .15s; }
  .side-collapse svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
  .side-collapse.mini svg { transform: rotate(180deg); }
  .side-collapse:hover { background: var(--orange-strong); }
  .side-mini .sidebar { padding: 18px 10px; overflow-x: hidden; }
  .side-mini .side-brand { justify-content: center; padding: 6px 0 14px; }
  .side-mini .side-brand > span, .side-mini .side-link > span, .side-mini .side-caret, .side-mini .sf-name { display: none; }
  .side-mini .side-brand .logo { width: 44px; height: 44px; }
  .side-mini .side-link { justify-content: center; padding: 12px 0; }
  .side-mini .side-sub { display: none !important; }
  .side-mini .side-sec { font-size: 0; height: 1px; margin: 10px 8px; background: rgba(255,255,255,.14); }
  .side-mini .side-foot { flex-direction: column; gap: 8px; padding-inline: 0; }
}

/* ================= وضع التحرير ================= */
.le-fab { position: fixed; z-index: 92; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: linear-gradient(135deg, #e2c27a, #b48a35); color: #fff; box-shadow: 0 10px 24px rgba(180, 138, 53, .4); transition: transform .2s, background .2s; }
.le-fab svg, .le-pen svg, .le-bar-txt svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.le-fab:hover { transform: scale(1.06); background: var(--orange-strong); }
.le-fab.on { background: var(--orange-strong); box-shadow: 0 0 0 4px color-mix(in srgb, var(--orange) 35%, transparent), 0 10px 24px rgba(234, 88, 12, .4); }
.le-tip { position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--ink); color: var(--bg); font-size: .85rem; padding: 6px 12px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.le-fab:hover .le-tip { opacity: 1; }
body.in-exam .le-fab { display: none; }
.le-top.on { color: #fff !important; background: var(--orange-strong) !important; border-color: var(--orange-strong) !important; }
.le-bar { position: fixed; z-index: 130; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); padding: 8px 10px 8px 14px; border-radius: 14px; background: #0c2c56; color: #fff; box-shadow: 0 14px 34px rgba(0,0,0,.3); }
.le-bar-txt { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.le-bar-txt svg { width: 20px; height: 20px; color: #e2c27a; }
.le-bar-txt b { color: #e2c27a; }
.le-bar .btn:not(.primary) { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }
body.le-on .le-hl { outline: 2px dashed var(--orange); outline-offset: 3px; border-radius: 4px; }
.le-pen { position: fixed; z-index: 131; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; background: var(--orange-strong); color: #fff; cursor: pointer; box-shadow: 0 6px 16px rgba(234, 88, 12, .45); padding: 0; }
.le-pen svg { width: 16px; height: 16px; }
.le-pen:hover { transform: scale(1.12); }
.le-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.le-item { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.le-item p { margin: 2px 0 0; word-break: break-word; }
@media (max-width: 760px) { .le-fab { width: 48px; height: 48px; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); } .le-tip { display: none; } .le-item { grid-template-columns: 1fr; } .le-bar-txt span { display: none; } }
@media print { .le-fab, .le-bar, .le-pen { display: none !important; } }
/* داخل لوحة الإدارة زر "وضع التحرير" موجود في الشريط العلوي */
body:has(.admin-shell) .le-fab { display: none; }

/* ترتيب القائمة الجانبية */
.side-arr-bar { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: rgba(226,194,122,.16); box-shadow: inset 0 0 0 1px rgba(226,194,122,.4); color: #f3dfaf; }
.side-arr-bar span { font-size: .8rem; color: rgba(219,230,245,.75); }
.side-arr-bar .btn:not(.primary) { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }
.arranging .side-link { cursor: default; }
.arranging .side-link:hover { background: rgba(255,255,255,.06); box-shadow: none; color: #dbe6f5; }
.arranging .side-sub { display: flex !important; }
.side-mv { display: inline-flex; gap: 4px; margin-inline-start: auto; }
.side-mv button { width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; font: 800 .95rem var(--font-body); }
.side-mv button:hover { background: var(--orange-strong); }
.side-sec.arr { display: flex; align-items: center; gap: 8px; font-size: .78rem; padding: 6px 4px 6px 0; border-top: 1px dashed rgba(255,255,255,.18); }
.arranging .side-link > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.arranging .side-mv button { width: 26px; height: 26px; }

/* محرر الاختبار: رقم القطعة المرتبطة بالسؤال */
.pg-tag { font-size: .78rem; font-weight: 800; color: var(--primary); background: var(--primary-soft); padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pg-tag.warn { color: var(--low); background: var(--low-soft); }

/* ===== القائمة الجانبية: مستطيلات شبه بارزة تفاعلية ===== */
.side-nav { gap: 7px; }
.side-link:not(.sub) {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.025));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 3px 8px rgba(0,0,0,.18);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}
.side-link:not(.sub) svg {
  box-sizing: content-box; padding: 6px; border-radius: 9px;
  background: rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  transition: background .18s, color .18s, transform .18s;
}
/* لمعة خفيفة بتعدّي على المستطيل عند الوقوف عليه */
.side-link:not(.sub)::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.16) 50%, transparent 65%);
  transform: translateX(120%); transition: transform .55s ease;
}
.side-link:not(.sub):hover::after { transform: translateX(-120%); }
.side-link:not(.sub):hover, .side-link:not(.sub):focus-visible {
  background: linear-gradient(160deg, #f97316, var(--orange-strong)); color: #fff;
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 18px rgba(234,88,12,.32);
}
.side-link:not(.sub):hover svg { background: rgba(255,255,255,.2); transform: scale(1.06); }
.side-link:not(.sub):active { transform: translateY(0); box-shadow: inset 0 2px 5px rgba(0,0,0,.25); }
.side-link.on:not(.sub) {
  background: linear-gradient(180deg, #fff, #eef3fa); color: #113d75;
  border-color: rgba(255,255,255,.9);
  box-shadow: inset 0 -2px 0 rgba(180,138,53,.35), 0 8px 20px rgba(0,0,0,.25);
}
.side-link.on:not(.sub) svg { background: rgba(180,138,53,.14); }
.side-link.on:not(.sub):hover { background: linear-gradient(160deg, #f97316, var(--orange-strong)); color: #fff; }
.side-link:not(.sub) { gap: 10px; }
.side-link.on:not(.sub):hover svg { background: rgba(255,255,255,.2); }
/* الروابط الفرعية: أخف وبخط جانبي */
.side-sub { gap: 4px; margin-top: 6px; }
.side-link.sub { border-radius: 10px; transition: background .15s, color .15s, transform .15s; }
.side-link.sub:hover { transform: translateX(-3px); }
.side-link.sub.on { box-shadow: 0 4px 12px rgba(0,0,0,.18); }
/* وضع الترتيب والقائمة المصغرة */
.arranging .side-link:not(.sub):hover { transform: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 3px 8px rgba(0,0,0,.18); }
.arranging .side-link::after { display: none; }
@media (min-width: 901px) { .side-mini .side-link:not(.sub) { padding: 8px 0; } }
@media (prefers-reduced-motion: reduce) { .side-link, .side-link::after, .side-link svg { transition: none !important; } .side-link:hover { transform: none !important; } }

/* ===== مربعات ثلاثية الأبعاد (الإحصائيات، البطاقات، البوابات، الأزرار) ===== */
:root {
  --d3-top: rgba(255,255,255,.95);
  --d3-edge: rgba(17,61,117,.10);
  --d3-shadow: 0 1px 0 rgba(17,61,117,.06), 0 4px 0 -1px color-mix(in srgb, var(--line) 85%, #9fb3cf), 0 10px 22px -8px rgba(17,61,117,.20);
  --d3-shadow-hi: 0 1px 0 rgba(17,61,117,.06), 0 6px 0 -1px color-mix(in srgb, var(--line) 70%, #9fb3cf), 0 18px 32px -10px rgba(17,61,117,.28);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --d3-top: rgba(255,255,255,.08); --d3-edge: rgba(0,0,0,.35); } }
:root[data-theme="dark"] { --d3-top: rgba(255,255,255,.08); --d3-edge: rgba(0,0,0,.35); }

/* البطاقات البيضاء: مستطيل بارز بحافة سفلية وظل ولمعة علوية */
.metric, .tile, .test-card, .course-card, .panel:not(.flush):not(.notice), .panel.flush {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, #fff), color-mix(in srgb, var(--surface) 94%, #c9d6ea));
  border: 1px solid var(--d3-edge);
  box-shadow: inset 0 1px 0 var(--d3-top), var(--d3-shadow);
}
.metric, .tile, .test-card, .course-card {
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s, border-color .22s;
}
.metric:hover, .tile-link:hover, .metric-link:hover, .test-card:hover, .course-card:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 var(--d3-top), var(--d3-shadow-hi);
}
.metric:active, .tile-link:active, .metric-link:active, .test-card:active, .course-card:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 6px rgba(17,61,117,.12), 0 1px 0 rgba(17,61,117,.08);
}
/* أيقونات الإحصائيات: مكعب صغير بارز */
.m-icon { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.14), 0 8px 18px var(--m-shadow); }

/* بوابات الصفحة الرئيسية (الدورات / الاختبارات / المحاكية) */
.portal { box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.14), 0 16px 32px -10px rgba(20,50,100,.38); transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s; }
.portal:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.14), 0 22px 40px -12px rgba(20,50,100,.45); }
.portal-links a {
  background: linear-gradient(160deg, rgba(255,255,255,.18), rgba(255,255,255,.07));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 4px 10px rgba(0,0,0,.14);
  transition: transform .18s ease, box-shadow .18s, background .18s, color .18s;
}
.portal-links a:hover, .portal-links a:focus-visible { transform: translateY(-2px); box-shadow: inset 0 1px 0 #fff, 0 10px 18px rgba(0,0,0,.22); }
.portal-links a:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(0,0,0,.2); }

/* الأزرار والفلاتر: بروز خفيف */
.btn:not(.ghost):not(.link):not(.danger-link) { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 0 rgba(17,61,117,.12), 0 4px 10px -4px rgba(17,61,117,.25); transition: transform .15s, box-shadow .15s, background .15s, color .15s; }
.btn:not(.ghost):not(.link):not(.danger-link):hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 0 rgba(17,61,117,.14), 0 8px 16px -6px rgba(17,61,117,.32); }
.btn:not(.ghost):not(.link):not(.danger-link):active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,.15); }
.chip { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 0 rgba(17,61,117,.08), 0 3px 8px -4px rgba(17,61,117,.25); transition: transform .15s, box-shadow .15s; }
.chip:hover { transform: translateY(-1px); }
.chip.on { box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 0 rgba(0,0,0,.18), 0 4px 10px -4px rgba(17,61,117,.4); }

/* الجوال والتاب: بدون رفع عند اللمس (اللمس بيعمل ضغطة بس) وظلال أخف */
@media (hover: none) {
  .metric:hover, .tile-link:hover, .metric-link:hover, .test-card:hover, .course-card:hover, .portal:hover,
  .portal-links a:hover, .btn:hover, .chip:hover { transform: none; }
}
@media (max-width: 760px) {
  :root { --d3-shadow: 0 1px 0 rgba(17,61,117,.06), 0 3px 0 -1px color-mix(in srgb, var(--line) 85%, #9fb3cf), 0 6px 14px -6px rgba(17,61,117,.20); }
  .portal { box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.14), 0 10px 22px -8px rgba(20,50,100,.35); }
}
@media (prefers-reduced-motion: reduce) {
  .metric, .tile, .test-card, .course-card, .portal, .portal-links a, .btn, .chip { transition: none !important; transform: none !important; }
}

/* ===== تسجيل الطالب في الأقسام ===== */
.sec-dd-btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 6px 12px; border-radius: 10px; cursor: pointer;
  font: 600 .85rem var(--font-body); color: var(--ink-2); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 var(--d3-top), 0 2px 0 rgba(17,61,117,.10), 0 4px 10px -5px rgba(17,61,117,.3); transition: transform .15s, box-shadow .15s; }
.sec-dd-btn i { font-style: normal; font-size: .75rem; opacity: .7; }
.sec-dd-btn:hover { transform: translateY(-1px); }
.sec-dd-btn.set { color: #113d75; border-color: color-mix(in srgb, #2563eb 35%, var(--line)); background: linear-gradient(180deg, #eff5ff, #dfeafc); }
.sec-dd-btn.none { color: #b42318; border-color: #f3c2bd; background: linear-gradient(180deg, #fff5f4, #fde7e5); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sec-dd-btn.set { color: #bcd4ff; background: #1b2a44; } :root:not([data-theme="light"]) .sec-dd-btn.none { color: #ffb4ab; background: #3a1d1d; border-color: #6b2b2b; } }

.sec-pop { position: fixed; z-index: 1200; width: 340px; max-height: min(560px, calc(100vh - 20px)); display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--d3-top), 0 4px 0 -1px color-mix(in srgb, var(--line) 80%, #9fb3cf), 0 24px 48px -12px rgba(17,61,117,.4); animation: spIn .16s ease-out; }
@keyframes spIn { from { opacity: 0; transform: translateY(-6px); } }
.sec-pop > .loading { padding: 30px; display: grid; place-items: center; }
.sp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sp-head b { display: block; font-size: .95rem; }
.sp-head small { color: var(--ink-3); font-size: .8rem; }
.sp-x { border: 0; background: var(--surface-2); color: var(--ink-2); width: 30px; height: 30px; border-radius: 9px; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.sp-all { display: flex; gap: 10px; align-items: flex-start; margin: 10px 12px 4px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 14%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); }
.sp-all small { display: block; color: var(--ink-3); font-size: .78rem; }
.sp-body { overflow-y: auto; padding: 4px 12px 10px; flex: 1; overscroll-behavior: contain; }
.sp-g { margin: 12px 4px 4px; font-size: .78rem; font-weight: 700; color: var(--gold); }
.sp-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; font-size: .9rem; }
.sp-item:hover { background: var(--surface-2); }
.sp-item.sub { padding-inline-start: 30px; font-size: .85rem; color: var(--ink-2); }
.sp-item input, .sp-all input { width: 17px; height: 17px; accent-color: #174f93; flex: none; margin-top: 1px; }
.sp-item:has(input:disabled) { opacity: .5; cursor: default; }
.sec-pop.all .sp-item.sec { opacity: .4; }
.sp-paid { font-size: .7rem; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 7px; }
.sp-hint { margin: 10px 4px 0; font-size: .78rem; color: var(--ink-3); }
.sp-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.sp-foot .btn.primary { flex: 1; }
/* الجوال: القائمة تطلع من تحت */
.sec-pop.sheet { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-height: 78vh; border-radius: 18px; animation: spUp .2s ease-out; }
@keyframes spUp { from { transform: translateY(30px); opacity: 0; } }
.sec-pop.sheet .sp-item { padding: 10px 8px; }

/* بوابات الطالب حسب عدد الأقسام المسجل فيها */
@media (min-width: 1101px) {
  .portals.cnt-2 { grid-template-columns: repeat(2, 1fr); }
  .portals.cnt-1 { grid-template-columns: minmax(0, 520px); }
}
.portals.cnt-1 .portal, .portals.cnt-2 .p-mock { grid-column: auto; }

/* زر منشور/مخفي: أيقونة صغيرة */
.toggle.pub-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 10px;
  color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--d3-top), 0 2px 0 rgba(17,61,117,.10); transition: transform .15s, background .15s, color .15s; }
.toggle.pub-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toggle.pub-ic.on { color: var(--good); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.toggle.pub-ic:not(:disabled):hover { transform: translateY(-1px) scale(1.05); }
.toggle.pub-ic:not(:disabled):active { transform: translateY(1px); }
.pill.cat-newcomp { background: #e0f2fe; color: #075985; }
.pill.cat-closings { background: #ffe4e6; color: #9f1239; }

/* ================= هوية موحّدة لصفحات المحتوى: مربعات + وضع التحرير ================= */
.hub-head { align-items: flex-end; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-bottom: 16px; }
.hub-tile { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 20px; color: #fff; overflow: hidden; min-height: 170px; text-decoration: none; isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.14), 0 16px 32px -10px rgba(20,50,100,.38);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s; animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.hub-tile::before { content: ''; position: absolute; z-index: -1; inset-inline-end: -40px; top: -50px; width: 170px; height: 170px; border-radius: 50%; border: 22px solid rgba(255,255,255,.07); box-shadow: 0 0 0 26px rgba(255,255,255,.03); }
.hub-tile:hover { transform: translateY(-4px); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.14), 0 24px 40px -12px rgba(20,50,100,.48); }
.hub-tile:active { transform: translateY(1px); }
.hub-tile:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.ht-top { display: flex; align-items: center; gap: 12px; padding-inline-end: 0; }
.ht-ic { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.18); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -2px 0 rgba(0,0,0,.12); }
.ht-ic svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hub-tile h3 { margin: 0; font-size: 1.22rem; color: #fff; line-height: 1.35; }
.hub-tile small { opacity: .85; font-size: .85rem; }
.ht-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-inline-end: 44px; }
.ht-stats span { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2); padding: 4px 10px; border-radius: 99px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.ht-go { position: absolute; bottom: 18px; left: 18px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); transition: transform .2s, background .2s; }
.ht-go svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hub-tile:hover .ht-go { transform: translateX(-4px); background: rgba(255,255,255,.32); }
.hub-tile.t1 { background: linear-gradient(145deg, #2f7fd6, #123f78); }
.hub-tile.t2 { background: linear-gradient(145deg, #8b6cf0, #4b2fae); }
.hub-tile.t3 { background: linear-gradient(145deg, #d6a548, #946617); }
.hub-tile.t4 { background: linear-gradient(145deg, #22b8cf, #0b6a7d); }
.hub-tile.t5 { background: linear-gradient(145deg, #f06292, #a0254f); }
.hub-tile.t6 { background: linear-gradient(145deg, #5fae6e, #2c6b39); }
.hub-tile.tx { background: linear-gradient(145deg, #7b8794, #3e4c59); }
.hub-tile.off { filter: saturate(.35); }
.hub-tile.off:hover { filter: saturate(.7); }
.mk-state { align-self: flex-start; font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: rgba(0,0,0,.25); }
.mk-state.on { background: rgba(255,255,255,.95); color: #15803d; }
.hub-tile.add { background: transparent; color: var(--ink-2); border: 2px dashed #b7c5da; box-shadow: none; align-items: center; justify-content: center; text-align: center; cursor: pointer; font: inherit; }
.hub-tile.add::before { display: none; }
.hub-tile.add svg { width: 34px; height: 34px; fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; }
.hub-tile.add b { color: var(--primary); }
.hub-tile.add:hover { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 6%, transparent); }
.tile-tools { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; gap: 5px; flex-wrap: wrap; max-width: 70%; justify-content: flex-end; }
.tile-tools button { width: 32px; height: 32px; border-radius: 10px; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(255,255,255,.95); color: #113d75; box-shadow: 0 3px 8px rgba(0,0,0,.22); transition: transform .15s, background .15s; padding: 0; }
.tile-tools button:hover:not(:disabled) { transform: translateY(-2px); background: #fff; color: var(--orange-strong); }
.tile-tools button:disabled { opacity: .45; cursor: default; }
.tile-tools button[data-cat-act="del"] { color: #b42318; }
.tile-tools svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hub-tile:has(.tile-tools) .ht-top { padding-top: 34px; }
.hub-links { margin: 0 0 16px; }
.hub-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line); }

/* زر وضع التحرير */
.edit-sw { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; cursor: pointer; font: 800 .92rem var(--font-body); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); color: var(--primary);
  box-shadow: inset 0 1px 0 var(--d3-top), 0 2px 0 rgba(17,61,117,.12), 0 6px 14px -6px rgba(17,61,117,.3); transition: transform .15s, background .2s, color .2s; }
.edit-sw:hover { transform: translateY(-1px); }
.edit-sw svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.edit-sw i { width: 38px; height: 22px; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .2s; }
.edit-sw i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: inset-inline-start .2s; }
.edit-sw.on { background: linear-gradient(160deg, #f97316, var(--orange-strong)); color: #fff; border-color: transparent; }
.edit-sw.on i { background: rgba(255,255,255,.35); }
.edit-sw.on i::after { inset-inline-start: 19px; }
.view-sw { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.view-sw button { width: 36px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.view-sw button.on { background: var(--surface); color: var(--primary); box-shadow: 0 2px 6px rgba(17,61,117,.18); }
.view-sw svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hub-crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 700; text-decoration: none; margin-bottom: 4px; }
.hub-crumb svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.hub-crumb:hover { color: var(--orange-strong); }
.edit-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: #0c2c56; color: #fff; margin-bottom: 16px; box-shadow: 0 10px 24px -10px rgba(12,44,86,.6); }
.edit-bar > svg { width: 20px; height: 20px; fill: none; stroke: #e2c27a; stroke-width: 2; flex: none; }
.edit-bar span { flex: 1; min-width: 200px; }
.edit-bar b { color: #e2c27a; }

/* بطاقات الإدارة (اختبارات ودورات) */
.test-card.adm h3 a, .course-card.adm h3 a { color: inherit; text-decoration: none; }
.test-card.adm h3 a:hover, .course-card.adm h3 a:hover { color: var(--orange-strong); }
.tc-badge.hid { background: rgba(0,0,0,.28); }
.tc-badge.pub { background: rgba(34,197,94,.28); border-color: rgba(134,239,172,.55); }
.cc-band .tc-badge { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; }
.test-card.adm .pill { align-self: flex-start; }
.course-card.adm .cc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.course-card.adm { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.test-card.editing, .course-card.editing { outline: 2px dashed color-mix(in srgb, var(--orange) 55%, transparent); outline-offset: 3px; }
.card-tools { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 10px; border-top: 1px dashed var(--line); background: color-mix(in srgb, var(--orange) 5%, var(--surface)); margin-top: auto; }
.card-tools .ct { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--primary); background: var(--surface); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--d3-top), 0 2px 0 rgba(17,61,117,.1); transition: transform .15s, color .15s, background .15s; }
.card-tools .ct:hover:not(:disabled) { transform: translateY(-2px); color: var(--orange-strong); }
.card-tools .ct.ok { color: var(--good); background: var(--good-soft); }
.card-tools .ct.del { color: #b42318; }
.card-tools .ct:disabled { opacity: .5; }
.card-tools svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.add-card { display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; border: 2px dashed #b7c5da; border-radius: 16px; color: var(--primary); font-weight: 800; min-height: 220px; text-decoration: none; transition: border-color .15s, background .15s; }
.add-card:hover { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 6%, transparent); }
.add-card svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mk-admin.flash { box-shadow: 0 0 0 3px var(--orange) !important; }
.swap-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pill.cat-tx { background: var(--surface-2); }

@media (max-width: 760px) {
  .hub-grid { grid-template-columns: 1fr; gap: 14px; }
  .hub-tile { min-height: 140px; padding: 16px; }
  .hub-head .head-actions { width: 100%; }
  .edit-bar span { min-width: 0; }
}
@media (hover: none) { .hub-tile:hover, .card-tools .ct:hover, .tile-tools button:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { .hub-tile, .course-card.adm { animation: none; transition: none; } }

/* اختيار طريقة إضافة اختبار */
.add-ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.add-way { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start; padding: 16px; border-radius: 16px; cursor: pointer; font: inherit; color: var(--ink);
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 1px 0 var(--d3-top), 0 3px 0 rgba(17,61,117,.10), 0 10px 20px -10px rgba(17,61,117,.3); transition: transform .18s, box-shadow .18s, border-color .18s; }
.add-way:hover, .add-way:focus-visible { transform: translateY(-3px); border-color: var(--orange); box-shadow: inset 0 1px 0 var(--d3-top), 0 4px 0 rgba(234,88,12,.25), 0 16px 26px -12px rgba(234,88,12,.4); }
.add-way:active { transform: translateY(1px); }
.add-way b { font-size: 1.02rem; color: var(--primary); }
.add-way small { color: var(--ink-3); line-height: 1.6; }
.aw-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #2f7fd6, #123f78); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -2px 0 rgba(0,0,0,.15); }
.add-way:nth-child(2) .aw-ic { background: linear-gradient(145deg, #8b6cf0, #4b2fae); }
.add-way:nth-child(3) .aw-ic { background: linear-gradient(145deg, #d6a548, #946617); }
.add-way:nth-child(4) .aw-ic { background: linear-gradient(145deg, #22b8cf, #0b6a7d); }
.aw-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.add-card { font: inherit; cursor: pointer; background: transparent; }
.add-card small { color: var(--ink-3); font-weight: 500; }
.imp-target { display: flex; flex-direction: column; gap: 14px; }
.imp-target .field { max-width: 520px; }
.imp-tabs { flex-wrap: wrap; }
.imp-modes > .panel { margin-bottom: 16px; }
.imp-to { font-size: .85rem; }
.head-actions .btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
@media (max-width: 600px) { .add-ways { grid-template-columns: 1fr; } }

/* ================= العلامة المائية: "د. نادر أبو سكين" بخلفية شفافة ================= */
:root { --wm-img: url("../img/watermark.webp"); --wm-page: .10; --wm-q: .13; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wm-page: .07; --wm-q: .10; } }
:root[data-theme="dark"] { --wm-page: .07; --wm-q: .10; }
/* خلفية كل الصفحات: ثابتة في نص الشاشة ومش بتتحرك مع السكرول */
body { position: relative; z-index: 0; }
body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--wm-img) center / min(78vw, 820px) auto no-repeat; opacity: var(--wm-page); }
/* فوق الأسئلة: طبقة شفافة فوق السؤال والاختيارات (ما بتمنعش الضغط) */
#q-area, .wq, .q-edit, .modal-body:has(.sq-text) { position: relative; }
#q-area::after, .wq::after, .q-edit::after, .modal-body:has(.sq-text)::after {
  content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: var(--wm-img) center / min(58%, 400px) auto no-repeat; opacity: var(--wm-q); }
.wq::after, .q-edit::after { background-size: min(48%, 280px) auto; }
@media print { body::after, #q-area::after, .wq::after, .q-edit::after { display: none !important; } }

/* ================= لوحة أرقام الأسئلة: مُجاب أزرق · مؤجل أصفر · لم يُجب أحمر ================= */
.dot { background: #fff; color: var(--ink-2); border-color: #cfd8e6; box-shadow: inset 0 -2px 0 rgba(17,61,117,.08); transition: transform .12s; }
.dot:hover { transform: translateY(-1px); }
.dot.answered { background: linear-gradient(180deg, #4f86d0, #2f64ad); color: #fff; border-color: #2a5a9c; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -2px 0 rgba(0,0,0,.15); }
.dot.later { background: linear-gradient(180deg, #fde68a, #f8d24b); color: #7a5200; border-color: #e3b21f; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -2px 0 rgba(0,0,0,.08); }
.dot.current { outline: 3px solid #0c2c56; outline-offset: 2px; }
.lgd { background: #fff; border-color: #cfd8e6; }
.lgd.answered { background: #2f64ad; border-color: #2a5a9c; }
.lgd.later { background: #f8d24b; border-color: #e3b21f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dot:not(.answered):not(.later) { background: var(--surface); color: var(--ink-2); border-color: var(--line); } :root:not([data-theme="light"]) .dot.current { outline-color: #e2c27a; } }

/* ================= تبويبات أقسام الطالب: أزرار بارزة منفصلة بألوان مختلفة ================= */
#t-tabs.seg, #c-tabs.seg, .seg.mock-types { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 2px 10px; background: none; border: 0; box-shadow: none; border-radius: 0; width: auto; }
#t-tabs .seg-btn, #c-tabs .seg-btn, .mock-types .seg-btn {
  --c1: #2f7fd6; --c2: #123f78;
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 14px; border: 0; cursor: pointer; text-decoration: none;
  font: 800 .95rem var(--font-body); color: #fff; background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -3px 0 rgba(0,0,0,.18), 0 8px 16px -8px rgba(20,50,100,.45);
  opacity: .72; filter: saturate(.75); transition: transform .18s, opacity .18s, filter .18s, box-shadow .18s; }
#t-tabs .seg-btn:nth-child(6n+2), #c-tabs .seg-btn:nth-child(6n+2), .mock-types .seg-btn:nth-child(6n+2) { --c1: #8b6cf0; --c2: #4b2fae; }
#t-tabs .seg-btn:nth-child(6n+3), #c-tabs .seg-btn:nth-child(6n+3), .mock-types .seg-btn:nth-child(6n+3) { --c1: #d6a548; --c2: #946617; }
#t-tabs .seg-btn:nth-child(6n+4), #c-tabs .seg-btn:nth-child(6n+4), .mock-types .seg-btn:nth-child(6n+4) { --c1: #22b8cf; --c2: #0b6a7d; }
#t-tabs .seg-btn:nth-child(6n+5), #c-tabs .seg-btn:nth-child(6n+5), .mock-types .seg-btn:nth-child(6n+5) { --c1: #f06292; --c2: #a0254f; }
#t-tabs .seg-btn:nth-child(6n), #c-tabs .seg-btn:nth-child(6n), .mock-types .seg-btn:nth-child(6n) { --c1: #5fae6e; --c2: #2c6b39; }
#t-tabs .seg-btn:hover, #c-tabs .seg-btn:hover, .mock-types .seg-btn:hover { opacity: .95; filter: none; transform: translateY(-2px); }
#t-tabs .seg-btn.on, #c-tabs .seg-btn.on, .mock-types .seg-btn.on {
  opacity: 1; filter: none; transform: translateY(-3px); color: #fff; background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c1), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -3px 0 rgba(0,0,0,.2), 0 14px 24px -10px var(--c2); }
#t-tabs .seg-btn:active, #c-tabs .seg-btn:active, .mock-types .seg-btn:active { transform: translateY(1px); }
#t-tabs .seg-btn b, #c-tabs .seg-btn b, .mock-types .seg-btn b { background: rgba(255,255,255,.25); color: #fff; padding: 1px 9px; border-radius: 99px; font-size: .8rem; }
@media (max-width: 760px) {
  #t-tabs.seg, #c-tabs.seg, .seg.mock-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #t-tabs .seg-btn, #c-tabs .seg-btn, .mock-types .seg-btn { justify-content: center; text-align: center; padding: 12px 10px; font-size: .9rem; white-space: normal; line-height: 1.4; }
}
@media (hover: none) { #t-tabs .seg-btn:hover, #c-tabs .seg-btn:hover, .mock-types .seg-btn:hover { transform: none; } }

/* ================= وضع الزائر ================= */
.guest-acts { display: flex; gap: 8px; align-items: center; }
.guest-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px max(16px, calc((100vw - 1240px) / 2)); background: linear-gradient(90deg, #0c2c56, #174f93); color: #fff; font-size: .9rem; }
.guest-strip > svg { width: 20px; height: 20px; fill: none; stroke: #e2c27a; stroke-width: 2; flex: none; }
.guest-strip span { flex: 1; min-width: 220px; }
.guest-strip b { color: #e2c27a; }
.guest-strip .link { color: #fff; opacity: .85; text-decoration: underline; background: none; border: 0; cursor: pointer; font: inherit; }
.guest-gate { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 20px; max-width: 560px; margin: 30px auto; }
.guest-gate h2 { margin: 0; color: var(--primary); }
.guest-gate p { margin: 0; color: var(--ink-2); line-height: 1.9; }
.gg-ic { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #2f7fd6, #123f78); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -3px 0 rgba(0,0,0,.18), 0 12px 24px -10px rgba(18,63,120,.6); }
.gg-ic svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.gg-wrap .modal { position: relative; max-width: 560px; }
.gg-wrap .guest-gate { margin: 0 auto; padding: 24px 10px 10px; }
.gg-x { position: absolute; top: 10px; left: 10px; }
.guest-btn { cursor: pointer; font: inherit; }
@media (max-width: 760px) { .guest-acts .btn { padding: 7px 10px; font-size: .82rem; } .guest-strip { font-size: .82rem; } }

/* شريط قوائم الطالب على الجوال: كل الروابط ظاهرة من غير سكرول */
@media (max-width: 600px) {
  .topbar .nav { flex-wrap: wrap; justify-content: center; overflow: visible; row-gap: 2px; }
  .topbar .nav a { padding: 7px 9px; font-size: .86rem; }
}

/* ================= نتائجي: مستواي الفعلي ================= */
.level-card { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px; align-items: stretch; }
.lv-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 20px; border-radius: 18px; color: #fff;
  background: linear-gradient(145deg, #2f7fd6, #123f78); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.15), 0 14px 26px -12px rgba(18,63,120,.55); }
.lv-main.good { background: linear-gradient(145deg, #34b36b, #17673d); }
.lv-main.mid { background: linear-gradient(145deg, #e2b04a, #9a6b12); }
.lv-main.low { background: linear-gradient(145deg, #ef6a5a, #a12a1d); }
.lv-label { font-size: .85rem; opacity: .9; }
.lv-main b { font: 800 1.9rem var(--font-display); }
.lv-pct { font: 800 1.4rem var(--font-display); opacity: .95; }
.lv-main small { font-size: .82rem; opacity: .92; }
.lv-main small span { color: #fff !important; font-weight: 800; }
.lv-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.lv-facts li { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.lv-facts span { color: var(--ink-3); font-size: .85rem; }
.lv-facts b { font-size: 1.1rem; color: var(--ink); }
.lv-facts b small { color: var(--ink-3); font-weight: 700; }
@media (max-width: 760px) { .level-card { grid-template-columns: 1fr; } }

/* ===== قطعة الاستيعاب: خلفية #F7C7A7 + عنوان أحمر في المنتصف ===== */
.passage, :root .passage.small {
  background: #F7C7A7; color: #2a1a10; border-inline-start-color: #c0392b;
}
.passage .passage-title {
  display: block; text-align: center; color: #d00000; font-weight: 800;
  font-size: 1.18em; line-height: 1.6; margin: 0 0 8px;
}

/* ===== تنسيق النص المخصّص (سميك / تحته خط / حجم / لون) ===== */
.rt-big { font-size: 1.3em; }
.rt-small { font-size: .8em; }
u.rt-u { text-decoration-line: underline; text-decoration-thickness: 2px; text-underline-offset: .4em; text-decoration-skip-ink: none; }

/* ===== شريط التنسيق في محرر الأسئلة ===== */
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 8px 8px 0 0; border-bottom: 0; }
.rt-bar + textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.rt-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 32px; padding: 0 8px; background: var(--surface, #fff); color: var(--ink, #222); border: 1px solid var(--line, rgba(0,0,0,.15)); border-radius: 6px; font: inherit; font-size: .95rem; cursor: pointer; position: relative; }
.rt-btn:hover { border-color: var(--primary); color: var(--primary); }
.rt-btn.wide { padding: 0 12px; font-weight: 700; color: #d00000; }
.rt-btn sup, .rt-btn sub { font-size: .65em; line-height: 0; }
.rt-color span { font-weight: 800; border-bottom: 3px solid #c0392b; line-height: 1.1; }
.rt-color input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.rt-help { margin-inline-start: auto; font-size: .76rem; color: var(--ink-3); padding-inline: 6px; }
.rt-prev { margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--line, rgba(0,0,0,.2)); border-radius: 8px; }
.rt-prev[hidden] { display: none; }
.rt-prev::before { content: 'معاينة'; display: block; font-size: .72rem; color: var(--ink-3); margin-bottom: 4px; }
.rt-prev .passage { margin: 0; }
.rt-prev-q { margin: 0; font-size: 1.05rem; }

.rt-blk { display: block; }
.rt-sep { width: 1px; height: 22px; background: var(--line, rgba(0,0,0,.2)); margin-inline: 3px; }
select.rt-ls { padding: 0 6px; width: auto; }
.rt-btn svg { display: block; }
