:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #17223b;
  --muted: #6b7690;
  --line: #e3e8f2;
  --brand: #1f6f8b;
  --brand-2: #2a9d8f;
  --brand-soft: #e6f3f6;
  --ok: #2e9e5b;
  --ok-soft: #e4f6ea;
  --bad: #d64545;
  --bad-soft: #fdeaea;
  --warn: #d98c1f;
  --warn-soft: #fff3df;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(23, 34, 59, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.3; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* الشريط العلوي */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; gap: 10px;
}
.topbar .brand { font-weight: 800; font-size: 1.15rem; color: var(--brand); display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; }
.topbar .actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 0.9rem; }
.icon-btn:active { background: var(--bg); }

.page { max-width: 720px; margin: 0 auto; padding: 14px 14px calc(30px + var(--safe-b) + var(--install-h, 0px)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.tight { padding: 10px 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack > * + * { margin-top: 10px; }

/* الأزرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 11px 18px; font-weight: 700; cursor: pointer; min-height: 44px;
  transition: transform 0.05s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--brand-soft); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 0.9rem; border-radius: 9px; }
.btn.big { font-size: 1.1rem; padding: 14px 22px; }

/* النماذج */
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 0.95rem; }
.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; min-height: 44px; outline: none;
}
.field input:not([type=radio]):not([type=checkbox]):focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 0.95rem; }
.success { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.info { background: var(--warn-soft); color: #7a4e00; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 0.95rem; }

/* الشارات */
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.gray { background: #eef0f5; color: var(--muted); }

/* صفحة الدخول */
.hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.hero img { width: 100%; max-height: 260px; object-fit: cover; }
.hero .hero-text { padding: 16px; font-size: 1.05rem; text-align: center; position: relative; }
.hero .hero-more { color: #fff; font-weight: 800; text-decoration: underline; margin-right: 4px; }
.hero .hero-x { position: absolute; top: 6px; left: 10px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,255,255,0.25); color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.hero #heroCloseWrap { margin-top: 10px; }
.hero .hero-text.open { padding-top: 44px; }
.footer-line a { color: var(--brand); font-weight: 700; text-decoration: underline; }
.hero .placeholder { padding: 40px 16px; text-align: center; font-size: 1.6rem; font-weight: 800; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.role-btn {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px 10px; text-align: center; cursor: pointer;
}
.role-btn .ic { font-size: 2rem; }
.role-btn .t { font-weight: 800; font-size: 1.1rem; }
.role-btn:active, .role-btn.active { border-color: var(--brand); background: var(--brand-soft); }

/* البنر الإعلاني: 3سم */
.ad-banner { display: block; width: 100%; height: 3cm; border-radius: 12px; overflow: hidden; background: #eef0f5; margin: 12px 0; }
.ad-banner img { width: 100%; height: 100%; object-fit: cover; }

/* أنماط الاختبار */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-btn { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; cursor: pointer; }
.mode-btn .t { font-weight: 800; }
.mode-btn .n { color: var(--muted); font-size: 0.8rem; }
.mode-btn.active { border-color: var(--brand); background: var(--brand-soft); }
.mode-btn .q { position: absolute; top: 4px; left: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--line); font-size: 0.75rem; display: flex; align-items: center; justify-content: center; }
.mode-def { background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; margin-top: 8px; }

/* شجرة الفصول */
.chapter { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.chapter > .ch-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fafbfe; cursor: pointer; }
.chapter > .ch-head .title { flex: 1; font-weight: 700; }
.chapter .lessons { padding: 4px 12px 8px 12px; border-top: 1px solid var(--line); }
.lesson-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.lesson-row:last-child { border-bottom: none; }
.lesson-row .title { flex: 1; cursor: pointer; }
.lesson .ls-chev { transition: transform 0.2s; }
.lesson.open .ls-chev { transform: rotate(180deg); }
.lesson .skills { padding: 2px 30px 6px 0; }
.skill-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.92rem; }
.skill-row .chk { width: 18px !important; height: 18px; }
.chk { width: 22px !important; height: 22px; min-height: 0 !important; padding: 0 !important; margin: 0; accent-color: var(--brand); flex-shrink: 0; }
.chev { transition: transform 0.2s; color: var(--muted); }
.chapter.open .chev { transform: rotate(180deg); }
.chapter.open > .ch-head { background: var(--brand-soft); }

/* الأسئلة */
.question { margin-bottom: 12px; }
.question .skill-tag { display: inline-block; background: var(--brand-soft); color: var(--brand); border-radius: 8px; padding: 3px 10px; font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; }
.question .qtext { font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.opt.active { border-color: var(--brand); background: var(--brand-soft); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt .letter { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.opt.active .letter { background: var(--brand); color: #fff; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.progress > div { height: 100%; background: var(--brand-2); transition: width 0.3s; }

/* النتائج */
.score-big { font-size: 2.6rem; font-weight: 900; text-align: center; color: var(--brand); line-height: 1; }
.skill-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.skill-line:last-child { border-bottom: none; }
.skill-line .s { font-weight: 800; min-width: 56px; text-align: center; border-radius: 8px; padding: 2px 8px; }
.skill-line .s.ok { background: var(--ok-soft); color: var(--ok); }
.skill-line .s.bad { background: var(--bad-soft); color: var(--bad); }
.skill-line .s.mid { background: var(--warn-soft); color: var(--warn); }
.lesson-head { font-weight: 800; color: var(--brand); margin: 10px 0 4px; }
.rank-list { counter-reset: r; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rank-item:last-child { border-bottom: none; }
.rank-item .num { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.rank-item .name { flex: 1; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; flex: 1; max-width: 120px; }
.bar > div { height: 100%; background: var(--brand-2); }
.bar.low > div { background: var(--bad); }

/* أزرار الإجراء في بطاقة المادة (للمعلم) */
.action-btn { display: block; background: var(--brand-soft); border: 2px solid transparent; border-radius: 12px; padding: 10px 12px; color: var(--ink); text-align: center; }
.action-btn:active { border-color: var(--brand); }
.action-btn .t { font-weight: 800; color: var(--brand); }
.action-btn .d { font-size: 0.78rem; color: var(--muted); margin-top: 2px; line-height: 1.4; }


.card.need { border: 2px solid var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.need-hint { margin-top: 8px; background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 0.92rem; }

.stage-head { font-weight: 800; color: var(--brand); margin: 12px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--brand-soft); display: flex; align-items: center; gap: 8px; }

/* التبويبات */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tab { flex: 1 1 40%; text-align: center; padding: 8px 6px; border-radius: 9px; cursor: pointer; white-space: nowrap; font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.tab.active { background: var(--brand); color: #fff; }

/* قوائم */
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .body { flex: 1; min-width: 0; }
.list-item a.body { color: inherit; }
.list-item .title { font-weight: 700; }
.list-item .sub { color: var(--muted); font-size: 0.85rem; }
.subject-card { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.subject-card .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }

/* بانك الأسئلة عند المعلم */
.bank-skill { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.bank-skill .bs-head { font-weight: 800; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.bank-q { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 6px; background: #fff; }
.bank-q.sel { border-color: var(--brand); background: var(--brand-soft); }
.bank-q .body { flex: 1; min-width: 0; }
.bank-q .opts { color: var(--muted); font-size: 0.85rem; }
.bank-q .opts .c { color: var(--ok); font-weight: 700; }
.hide-answers .bank-q:not(.show) .opts .c { color: var(--muted); font-weight: 400; }
.bank-q.show { box-shadow: inset 0 0 0 2px var(--ok-soft); }
.bank-q .tools { display: flex; flex-direction: column; gap: 4px; }
.bank-q .tools button { font-size: 0.8rem; padding: 3px 8px; min-height: 28px; }

/* الحوار */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal h3 { margin-bottom: 12px; }
.reason-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.reason-btns .role-btn { padding: 10px; }

.toast { position: fixed; bottom: calc(20px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 100; font-size: 0.95rem; max-width: 90vw; }
.spinner { text-align: center; padding: 30px; color: var(--muted); }
.fab-bar { position: sticky; bottom: var(--install-h, 0px); background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 calc(6px + var(--safe-b)); }
.install-tip { background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; font-size: 0.9rem; display: flex; gap: 8px; align-items: center; }

/* أقسام المواد القابلة للطي (مرحلة ← صف) */
.sec { margin: 10px 0; }
.sec-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; color: var(--brand); padding: 8px 4px; border-bottom: 2px solid var(--brand-soft); text-align: right; }
.sec-head .sec-title { flex: 1; }
.sec-head .sec-chev { font-size: 1.1rem; color: var(--muted); }
.sec-stage > .sec-head { font-size: 1.05rem; }
.sec-level { margin: 6px 0 6px 10px; }
.sec-level > .sec-head { font-size: 0.95rem; color: var(--ink); border-bottom: 1px dashed var(--line); }
.sec-body { padding-top: 6px; }

/* نص «ما قبل التسجيل» الذي يضبطه الأدمن فوق استمارة التسجيل */
.pre-reg { background: #f3f8fa; border-right: 4px solid var(--brand, #1f6f8b); line-height: 1.9; }

/* شارة التنبيه في الشريط العلوي: تظهر فقط عند وجود جديد */
.icon-btn.bell { position: relative; padding-left: 14px; }
.icon-btn.bell .dot {
  position: absolute; top: -4px; left: -4px; min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px; border-radius: 9px; background: #c0392b; color: #fff;
  font-size: .72rem; font-weight: 800; line-height: 1;
}
.card.notice { background: #fff6e5; border-right: 4px solid #e08e0b; font-weight: 700; }

/* صفحة «شرح التطبيق» وأدوار «مشترك جديد» */
.video-wrap { padding: 0; overflow: hidden; }
.video-wrap iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.guide-text { line-height: 2; white-space: normal; }
.guide-btn { white-space: nowrap; font-weight: 700; }
.role-btn .sub-roles { font-size: .82rem; font-weight: 700; color: var(--brand, #1f6f8b); margin-top: 2px; }

/* أقسام «قياساتي» الثلاثة: شريط داكن عريض يُفتح واحد فيُطوى غيره */
.sec.sec-bar { margin: 12px 0; border: 0; background: none; }
.sec.sec-bar > .sec-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--brand, #1f6f8b); color: #fff; border: 0; border-radius: 12px;
  padding: 14px 16px; font-family: inherit; font-size: 1.05rem; font-weight: 800; cursor: pointer;
}
.sec.sec-bar > .sec-head .sec-chev { font-size: 1rem; opacity: .9; }
.sec.sec-bar > .sec-body { margin-top: 10px; }
.card.tight { padding: 12px; }
.list-item.tight { padding: 6px 0; }

/* أرقام الدرجات «س / ١٠» تُعزل اتجاهيًّا لئلا تنعكس داخل الصفحة العربية */
.num-ltr { direction: ltr; unicode-bidi: isolate; }

/* نتيجتان جنبًا إلى جنب في النمطين العالي والمتوسط */
.two-scores { align-items: start; }
.two-scores .score-big { font-size: 2.1rem; }
.score-big .of { font-size: 1rem; color: var(--muted); }

/* قائمة الفقرات التي أخفق فيها الطالب + معاينة رسالة الواتساب */
.dash-list { list-style: none; margin: 4px 0 10px; padding: 0; }
.dash-list li { position: relative; padding-right: 16px; line-height: 1.9; }
.dash-list li::before { content: '–'; position: absolute; right: 0; color: var(--muted); }
.weak-card .num { background: var(--brand-soft); color: var(--brand); border-radius: 50%; padding: 1px 7px; font-size: .8rem; font-weight: 800; }
.wa-btn { background: #25d366; color: #fff; width: 100%; }
.wa-preview { white-space: pre-line; background: #f3f8fa; border-radius: 10px; padding: 12px; margin: 8px 0; line-height: 1.9; font-size: .95rem; }

/* صف الفقرة في تبويب الفاقد: الاسم يأخذ عرضه، والوسم تحته لا بجانب الدرجة */
.item-row .name { min-width: 0; }
.tag-loss { display: inline-block; margin-top: 4px; background: #fdecea; color: #c0392b; border-radius: 6px; padding: 1px 8px; font-size: .75rem; font-weight: 800; }
.item-row .bar { max-width: 70px; }

/* محرّر مقاطع دليل الاستخدام في لوحة التحكم */
.blk { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fafcfd; }
.blk-head { margin-bottom: 6px; }
.blk textarea, .blk input[type="text"], .blk input:not([type]) { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; }
.blk .btn.sm.ghost[disabled] { opacity: .35; pointer-events: none; }

/* سطر الإقرار الإلزامي في صفحة التسجيل */
.ack { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-weight: 700; cursor: pointer; line-height: 1.8; }
.ack input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.ack.ack-need { color: #c0392b; animation: ackShake .4s; }
@keyframes ackShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* إطار لكل نتيجة ليظهر الفرق بينهما */
.two-scores .score-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; background: #fafcfd; }

/* فقرات الدعم في نتيجة الطالب */
.support-card { border-right: 4px solid #e08e0b; }
.support-card h3 { margin: 0 0 4px; }

/* تعريف ألوان الشارات فوق قائمة الفقرات */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 2px 0 8px; font-size: .82rem; color: var(--muted); }
.legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-left: 5px; vertical-align: -1px; }
.legend .dot.bad { background: #e74c3c; }
.legend .dot.mid { background: #e08e0b; }
.legend .dot.ok { background: #27ae60; }
.legend-note { margin: 0 0 8px; }

/* إطار يجمع بطاقتَي «مشترك جديد» */
.roles-group { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px 12px; margin: 14px 0; background: #fafcfd; }
.roles-group > h2 { margin: 12px 0 2px; }
.roles-group .roles { margin: 10px 0 0; }

/* عنوان القياس في «قياسات تمت» يُفتح على تفصيله */
.ex-item { padding: 10px 12px; }
.ex-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font: inherit; text-align: right; cursor: pointer; color: inherit; }
.ex-title { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-head .sec-chev { color: var(--muted); }

/* عنوان القياس في «قياسات تمت» يُفتح على تفصيله */
.ex-item { padding: 10px 12px; }
.ex-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font: inherit; text-align: right; cursor: pointer; color: inherit; }
.ex-title { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-head .sec-chev { color: var(--muted); }

/* منتقي القياس والمجموعة: قائمة تُفتح في الصفحة بلا اختيار افتراضي */
.pick-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; font: inherit; color: var(--muted); cursor: pointer; text-align: right; }
.pick-btn.picked { color: var(--ink); font-weight: 700; border-color: var(--brand); }
.pick-list { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; max-height: 240px; overflow-y: auto; background: #fff; }
.pick-row { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; border-bottom: 1px dashed var(--line); background: none; padding: 10px 12px; font: inherit; cursor: pointer; text-align: right; }
.pick-row:last-child { border-bottom: 0; }
.pick-list.boxed { border-top: 1px solid var(--line); border-radius: 10px; max-height: none; }
.pick-row:hover, .pick-row:active { background: var(--brand-soft); }
.pick-row .t { font-weight: 700; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }

/* بطاقة الرابط الخارجي */
.link-box { background: #f3f8fa; margin-top: 8px; }
.link-url { direction: ltr; unicode-bidi: isolate; background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 8px; margin: 6px 0; font-size: .8rem; word-break: break-all; }
.req { color: #c0392b; }

/* الأشرطة الفرعية تحت «قياساتي» في الرئيسية */
.sub-bars { display: grid; gap: 8px; }
.sec-head.sub-bar { background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 12px 14px; font-weight: 800; border: 1px solid var(--line); }
.sec-head.sub-bar .sec-chev { font-size: 1.2rem; }

/* شجرة اختيار المادة: مرحلة ← صف ← مادة */
.tp-tree { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; max-height: 320px; overflow-y: auto; background: #fff; }
.tp-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 11px 12px; font: inherit; cursor: pointer; text-align: right; color: var(--brand); font-weight: 800; }
.tp-head.lv { padding-right: 24px; font-size: .92rem; color: var(--ink); border-bottom: 1px dashed var(--line); }
.tp-head .tp-t { flex: 1; }
.tp-subject { width: 100%; display: block; background: none; border: 0; border-bottom: 1px dashed var(--line); padding: 10px 36px 10px 12px; font: inherit; cursor: pointer; text-align: right; }
.tp-subject:hover, .tp-subject:active { background: var(--brand-soft); }
.tp-subject.on { background: var(--brand-soft); font-weight: 800; color: var(--brand); }

/* شجرة المواد في لوحة التحكم */
tr.grp { cursor: pointer; }
tr.grp.st > td { background: var(--brand); color: #fff; font-weight: 800; }
tr.grp.lv > td { background: var(--brand-soft); color: var(--brand); font-weight: 800; padding-right: 26px; }
tr.grp .badge.gray { background: rgba(255,255,255,.22); color: inherit; }
tr.grp.lv .badge.gray { background: #fff; color: var(--brand); }

/* عنوان الموقع في سطر واحد: يُختصر زر «الرئيسية» إلى أيقونته في الشاشات الضيقة */
@media (max-width: 430px) {
  .topbar { padding: 10px; gap: 6px; }
  .icon-btn.home-btn .lbl { display: none; }
  .icon-btn { padding: 6px 9px; }
}
@media (max-width: 340px) {
  .topbar .brand { font-size: 1.02rem; }
  .topbar .brand img { width: 26px; height: 26px; }
}

/* شريط التثبيت على الجوال */
.install-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 40; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px calc(10px + var(--safe-b)); background: var(--card); color: var(--text);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.12); animation: ib-up 0.25s ease-out; }
@keyframes ib-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.install-bar img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-bar .ib-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.install-bar .ib-t b { font-size: 0.95rem; }
.install-bar .ib-t span { font-size: 0.78rem; }
.install-bar .btn { flex: none; white-space: nowrap; }
.install-bar .ib-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--brand-soft); color: var(--muted); font-size: 1rem; line-height: 1; }
.install-bar .ib-x:active { transform: scale(0.92); }
@media (min-width: 560px) { .install-bar { inset-inline: auto 12px; bottom: 12px; max-width: 420px; border-radius: 16px; border: 1px solid var(--line); } }
