/* =============================================================================
   مكتبة المواد الدراسية — NEO-BRUTALISM (إعادة تصميم كاملة حسب المرجع البصري)
   -----------------------------------------------------------------------------
   الهوية: خلفية كريمي · حدود سوداء سميكة · ظلال صلبة بلا ضبابية · ألوان مشبعة
   (أصفر/وردي/بنفسجي/أزرق/أخضر) · شارات ستيكر مائلة · زخارف هندسية
   العقود المحفوظة حرفيًا (app.js يعتمد عليها):
     --c1..c6 + --cX-l · --bc/--bcd/--bcl · --oc/--ocl · --tmain · --wa*
     theme-blue/amber/emerald · كل الكلاسات المولّدة من app.js
   ========================================================================== */

/* ===================== 1. الخطوط (مضمّنة محليًا) ===================== */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF,
    U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===================== 2. التوكنز — هوية Neo-Brutalism ===================== */
:root {
  /* --- ألوان المواد الستة: مشبعة + نسخة فاتحة (استخدام ديناميكي) --- */
  --c1: #5B5FEF; --c1-l: #EDEEFF;
  --c2: #12A5BC; --c2-l: #E4F8FB;
  --c3: #1FB871; --c3-l: #E5F8EE;
  --c4: #F08C1D; --c4-l: #FEF1E0;
  --c5: #F04D7E; --c5-l: #FDEAF1;
  --c6: #8C5CF0; --c6-l: #F1EBFE;

  /* --- الهوية الأساسية --- */
  --yellow:  #FFD84D;  --yellow-l:  #FFF3C4;
  --pink:    #FF5C8A;  --pink-l:    #FFE3EC;
  --violet-main: #8C6BFF; --violet-l: #EDE8FF;
  --blue:    #4D9FFF;  --blue-l:    #E3F0FF;
  --green:   #35D07F;  --green-l:   #E1F8EC;
  --orange:  #FF8A3D;  --orange-l:  #FFEBDD;
  --cyan:    #43D6D0;  --cyan-l:    #DFF9F8;

  --brand: var(--violet-main);
  --brand-2: var(--violet-main);
  --brand-dark: #5A3AD6;
  --brand-soft: var(--violet-l);
  --brand-line: #141414;

  /* --- محايدات --- */
  --bg: #F7F1E3;
  --bg-2: #EFE7D4;
  --surface: #FFFDF6;
  --ink: #141414;
  --ink-2: #1f1f1f;
  --muted: #6B6455;
  --muted-2: #A39B88;
  --line: #141414;
  --line-soft: #E4DCC8;
  --line-2: #EAE2CF;
  --white: #fff;

  /* --- حالات --- */
  --ok: #1FB871;      --ok-soft: #E1F8EC;  --ok-line: #141414;  --ok-ink: #0E7A48;
  --danger: #F04D5E;  --danger-soft: #FFE9EC; --danger-line: #141414; --danger-ink: #C42B3C;
  --warn: #F08C1D;    --warn-soft: #FEF1E0; --warn-line: #141414; --warn-ink: #A85C08;
  --info: #4D9FFF;    --info-soft: #E3F0FF; --info-line: #141414; --info-ink: #1E6CD0;
  --violet: var(--violet-main);       /* تم توحيد --violet مع البانتل الرئيسي */
  --violet-soft: #EDE8FF; --violet-line: #141414; --violet-ink: #5A3AD6;
  --book-deep: #1b2733;  --hero-deep: #22313f; /* أعماق الجرادينت الثابتة (غلاف الكتاب/هيرو المادة) */
  --wa: #12A5BC;      --wa-2: #43D6D0;     --wa-badge: #FFD84D;

  /* --- الحدود والظلال الصلبة (بلا ضبابية) --- */
  --bw: 2.5px;
  --bw-thick: 3px;
  --sh-xs: 2px 2px 0 var(--ink);
  --sh-sm: 3px 3px 0 var(--ink);
  --sh-md: 4px 4px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);
  --sh-xl: 9px 9px 0 var(--ink);
  --sh-focus: 0 0 0 4px rgba(140,107,255,.35);
  --shadow: var(--sh-md);
  --shadow-sm: var(--sh-sm);

  /* --- سلّم نصف القطر --- */
  --r-xs: 8px;  --r-sm: 12px;  --r-md: 16px;
  --r-lg: 20px; --r-xl: 24px;  --r-2xl: 28px;
  --r-full: 999px;
  --r: 18px;

  /* --- سلّم z-index (موثّق) --- */
  --z-frame: 9;
  --z-topbar: 50;
  --z-fab: 350;
  --z-win: 351;
  --z-notif: 360;   /* جرس/فقاعة/قائمة الإشعارات — فوق النوافذ العائمة وتحت المودالات */

  --z-modal: 400;
  --z-toast: 500;

  /* --- سلّم الخطوط --- */
  --font: 'Cairo', 'Segoe UI', Tahoma, 'Noto Kufi Arabic', sans-serif;
  --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 14.5px;
  --fs-md: 16px;   --fs-lg: 18px;   --fs-xl: 22px;
}

/* ===================== 3. الأساس + إتاحة الوصول ===================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.75;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* خلفية النقط — كانباس ثابت ما بيتحركش مع التمرير:
   طبقة overlay مثبّتة خلف المحتوى (position: fixed; inset: 0; z-index: -1) بدل
   background-attachment: fixed على body — لأن iOS Safari بيتجاهل fixed على الخلفيات.
   النقط فوق لون الكانفس وتحت كل المحتوى، ومثبتة بالنسبة للشاشة في أي متصفح. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(20,20,20,.14) 2.4px, transparent 2.4px);
  background-size: 26px 26px;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; }
.hidden { display: none !important; }
::selection { background: var(--yellow); color: var(--ink); }

/* حلقة التركيز الموحّدة */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-xs); }
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: none; box-shadow: var(--sh-focus), 2px 2px 0 var(--ink);
}

/* الأيقونات: كل SVG بـ 1em فتتحجّم بـ font-size العنصر الأب */
.ic {
  width: 1em; height: 1em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
  display: inline-block; vertical-align: -0.14em;
}
.ic.solid { fill: currentColor; stroke: none; }
.ic .sw { stroke-width: 1.8; }

/* منع الحركة لأصحاب حساسية الحركة — يحلّ D8 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.7); opacity: 0; } }

/* ===================== 4. صفحات المصادقة ===================== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  /* شفافة — نفس كانباس النقط الثابت (body::before) بيظهر ورا صفحة الدخول بدل نمط متكرر يتحرك مع السكرول */
}
/* أشكال زخرفية هندسية — كمرجع الصور */
@keyframes pulse-soft {
  0%   { transform: scale(1); }
  100% { transform: scale(.55); }
}
@keyframes logo-float {
  0%   { transform: translateY(-5px) rotate(-5deg); }
  100% { transform: translateY(5px) rotate(2deg); }
}
.auth-wrap::before, .auth-wrap::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
  transform-origin: center; will-change: transform;
}
.auth-wrap::before {
  width: 420px; height: 420px; background: var(--pink); opacity: .9;
  top: -160px; right: -120px;
  animation: pulse-soft 6s ease-in-out infinite alternate;
}
.auth-wrap::after {
  width: 480px; height: 480px; background: var(--violet); opacity: .9;
  bottom: -200px; left: -140px;
  animation: pulse-soft 8s ease-in-out infinite alternate;
}
.auth-wrap.theme-amber::before { background: var(--orange); }
.auth-wrap.theme-amber::after  { background: var(--yellow); }

.auth-card {
  position: relative; z-index: 2; width: 100%; max-width: 460px;
  background: var(--surface);
  border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  padding: 40px 36px;
  animation: pop .4s cubic-bezier(.2,.8,.2,1);
}
.auth-logo {
  width: 68px; height: 68px; margin: 0 auto 18px;
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--ink);
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm);
  transform: rotate(-4deg);
  will-change: transform;
  animation: logo-float 3.2s ease-in-out infinite alternate;
}
/* الشعار المخصص للدخول (قبعة) — الصورة تحتوي الإطار والظل واللون بالفعل
   معايرة بعد المعاينة (طلب المستخدم 2026-11-14): كانت 2× = 136px «كبيرة أوي»
   → 112px → «صغرها شويه» (طلب المستخدم 2026-11-14 ليلًا) → النهائي 96px —
   والهامش السفلي 28px يضمن عدم لمس الاسم (h1) حتى في أقصى هبوط للأنيميشن
   (translateY +5px) → فجوة ≥23px */
.auth-logo-img {
  width: 96px; height: 96px; margin: 0 auto 28px;
  display: block; object-fit: contain;
  will-change: transform;
  animation: logo-float-img 3.2s ease-in-out infinite alternate;
}
@keyframes logo-float-img {
  0%   { transform: translateY(-5px); }
  100% { transform: translateY(5px); }
}
.auth-card h1 { font-size: 25px; font-weight: 800; text-align: center; margin-bottom: 6px; letter-spacing: -.01em; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: var(--fs-sm); font-weight: 800; margin-bottom: 7px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-sm);
  font-size: 15px; background: var(--white); transition: box-shadow .15s, transform .15s;
  outline: none; color: var(--ink); font-weight: 600;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); font-weight: 500; }
/* عين كلمة المرور: زر جوّه الحقل على اليسار متوافق مع RTL والـ Neo-Brutalist */
.pw-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.pw-wrap input { width: 100%; padding-left: 50px; padding-right: 14px; direction: ltr; text-align: right; }
.pw-wrap input::placeholder { direction: rtl; text-align: right; }
.fpw-modal .pw-wrap input { direction: ltr; text-align: right; }
/* زر عين كلمة المرور — مكوّن موحّد في كل حقول المشروع (لوجين الطالب/الأدمن + تغيير كلمة المرور الأولى + الإعدادات):
   شفاف تمامًا — بلا مربع أو حدود أو ظل أو خلفية — وأيقونة Font Awesome (fa-regular fa-eye / fa-eye-slash)
   مدمجة جوه الحقل بـ position absolute (RTL: left = نهاية الحقل).
   التفاعل (hover / active / مكشوفة / focus) = إضاءة الأيقونة بالبرتقالي المميز فقط — بدون أي مربع حواليها. */
.pw-eye {
  position: absolute; top: 50%; left: 6px; transform: translateY(-50%);
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0;
  border: none; background: transparent; box-shadow: none;
  border-radius: 8px; color: var(--muted); cursor: pointer; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .13s ease;
  -webkit-tap-highlight-color: transparent;
}
.pw-eye:hover, .pw-eye:active, .pw-eye.on, .pw-eye:focus-visible { color: var(--orange); }
.pw-eye:focus-visible { outline: none; }
.pw-eye i { font-size: 19px; pointer-events: none; }

.pw-match-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 800; margin-top: 4px; padding: 2px 8px;
  border-radius: var(--r-xs); border: 1.5px solid var(--ink);
}
.pw-match-badge.ok { background: var(--green-l); color: #065f46; }
.pw-match-badge.err { background: var(--danger-soft); color: var(--danger-ink); }
.pw-wrap input.pw-valid { border-color: var(--ink); background: color-mix(in srgb, var(--ok-soft) 40%, var(--surface)); }
.pw-wrap input.pw-invalid { border-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 30%, var(--surface)); }
.field input:focus, .field select:focus, .field textarea:focus {
  box-shadow: var(--sh-sm); transform: translate(-2px, -2px);
}
.field .hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; line-height: 1.6; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 11px 4px; border-radius: var(--r-sm);
  border: var(--bw) solid var(--ink); background: var(--white);
  font-size: 14px; font-weight: 800; color: var(--muted);
  transition: transform .14s, box-shadow .14s, background .14s, color .14s;
}
.seg .seg-sub { font-size: 10px; font-weight: 600; opacity: .75; line-height: 1.3; }
.seg button:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-xs); color: var(--ink); }
.seg button.on {
  background: var(--yellow); color: var(--ink);
  box-shadow: var(--sh-xs); transform: translate(-1px, -1px);
}
.seg button.on .seg-sub { opacity: .85; }

.btn-main {
  width: 100%; padding: 13.5px; border: var(--bw) solid var(--ink); border-radius: var(--r-sm);
  color: var(--ink); font-size: 16px; font-weight: 800; letter-spacing: .01em;
  background: var(--yellow);
  box-shadow: var(--sh-md);
  transition: transform .14s, box-shadow .14s;
}
.btn-main:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn-main:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-ghost {
  width: 100%; padding: 12px; margin-top: 10px; background: var(--surface);
  border: var(--bw) dashed var(--ink); border-radius: var(--r-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 800; transition: .15s;
}
.btn-ghost:hover { color: var(--ink); background: var(--yellow-l); transform: translate(-1px, -1px); box-shadow: var(--sh-xs); }

.auth-error {
  background: var(--danger-soft); color: var(--danger-ink);
  border: var(--bw) solid var(--ink);
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 700; margin-bottom: 16px; text-align: center;
  box-shadow: var(--sh-xs);
}
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-foot b { color: var(--ink); font-weight: 800; }
.demo-note {
  margin-top: 18px; background: var(--yellow-l);
  border: var(--bw) dashed var(--ink); color: var(--ink);
  font-size: 12.5px; font-weight: 700; padding: 10px 14px;
  border-radius: var(--r-sm); text-align: center; line-height: 1.7;
}
.admin-link { text-align: center; margin-top: 14px; }
.admin-link a { color: var(--violet-ink); font-size: 13px; text-decoration: none; font-weight: 800; }
.admin-link a:hover { text-decoration: underline; }

/* ===================== 5. الهيدر ===================== */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  background: var(--surface);
  border-bottom: var(--bw-thick) solid var(--ink);
  /* حاوية قياس inline-size: 100cqw جوّاها = عرض الشريط الفعلي (بدون سكرول‌بار) — بتستخدمها .brand للسحب للحافة */
  container-type: inline-size;
}
.topbar-in { width: 100%; max-width: 100%; margin: 0; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* البراند: شعار كبير واضح + اسم متناسب، فجوة ضيقة، ومحاذاة أقصى اليمين مع مراعاة الـ padding الجانبي (20px):
   min(0px, (1180px - 100cqw)/2) بتعوّض انزياح حاوية 1180px الممركزة لما الشاشة أوسع منها،
   وبتفضل 0 على الشاشات الأضيق (البراند أصلاً على حافة الـ padding) — ولو المتصفح قديم وماليدعم
   container queries التعريف بيسقط كله والبراند يرجع لمكانه الطبيعي بسلام */
.brand {
  display: flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: 24px; letter-spacing: -.01em;
  flex-shrink: 0;
  margin-inline-start: 0;
}
.brand span { white-space: nowrap; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 13px; font-size: 19px;
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-xs);
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  transform: rotate(-5deg);
}
/* الشعار المخصص للموقع (كتاب) — الصورة تحتوي الإطار والظل واللون بالفعل — 2× الحجم القديم (40→80) — النهائي بعد معاينتين: 3× كان كبير والنص كان صغير */
.brand-logo-img {
  width: 88px; height: 88px; object-fit: contain;
  flex-shrink: 0; display: block;
}
@media (max-width: 900px) {
  .topbar-in { padding: 10px 16px; gap: 10px; }
  .brand { font-size: 20px; }
  .brand-logo-img { width: clamp(64px, 8.5vw, 76px); height: clamp(64px, 8.5vw, 76px); }
}
@media (max-width: 560px) {
  .brand-logo-img { width: clamp(54px, 15.5vw, 66px); height: clamp(54px, 15.5vw, 66px); }
  .auth-logo-img { width: clamp(92px, 24vw, 108px); height: clamp(92px, 24vw, 108px); margin-bottom: 22px; }
}
.topbar .spacer { flex: 1; }
.chip {
  padding: 5px 13px; border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: 800; line-height: 1.5;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; white-space: nowrap;
  border: var(--bw) solid var(--ink);
}
.chip.major { background: var(--blue-l); color: var(--ink); }
.chip.admin-chip { background: var(--pink-l); color: var(--ink); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--violet); color: var(--white);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-xs);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14.5px; flex-shrink: 0;
}
.btn-out {
  padding: 8px 15px; border-radius: var(--r-sm);
  border: var(--bw) solid var(--ink); background: var(--white);
  color: var(--ink); font-size: 13px; font-weight: 800; transition: .15s;
  box-shadow: var(--sh-xs);
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn-out:hover { background: var(--danger-soft); transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }
.btn-out:active { transform: translate(1px, 1px); box-shadow: none; }

/* سهم الرجوع في التوب‌بار: زر كبير دائري أصفر مش رفيع وواضح */
.btn-back {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: var(--bw) solid var(--ink); background: var(--yellow);
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-xs); transition: .15s; cursor: pointer; flex: 0 0 auto;
}
.btn-back .ic { width: 23px; height: 23px; stroke-width: 3.1; }
.btn-back:hover { transform: translate(-1px, -1px) rotate(-5deg); box-shadow: var(--sh-sm); background: var(--yellow-l); }
.btn-back:active { transform: translate(1px, 1px) rotate(0deg); box-shadow: none; }
@media (max-width: 480px) { .btn-back { width: 40px; height: 40px; } .btn-back .ic { width: 21px; height: 21px; } }

/* ===================== 5.5 صفحة الإعدادات (الطالب) ===================== */
.settings-wrap { max-width: 640px; margin: 0 auto; padding-top: 26px; }
.settings-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.settings-head h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -.02em; }
.set-card {
  background: var(--surface); border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  padding: 22px 20px; margin-bottom: 18px;
}
.set-card .set-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16.5px; font-weight: 800; margin-bottom: 14px;
}
.set-card .set-title .ic { font-size: 19px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-top: 1.5px dashed var(--line-soft);
  font-size: 14px;
}
.set-row .k { color: var(--muted); font-weight: 700; }
.set-row b { font-weight: 800; }
.set-desc { color: var(--muted); font-weight: 600; font-size: 13.5px; line-height: 1.7; margin-bottom: 12px; }
.btn.out, .set-card .btn.out, .set-card.sc-danger .btn.out { background: var(--white); border: 2px solid var(--ink); color: var(--danger-ink); font-weight: 800; box-shadow: var(--sh-xs); }
.btn.out:hover, .set-card .btn.out:hover, .set-card.sc-danger .btn.out:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); background: var(--danger) !important; color: var(--white) !important; border-color: var(--ink) !important; }
.btn.out:active, .set-card .btn.out:active, .set-card.sc-danger .btn.out:active { transform: translate(1px, 1px); box-shadow: none; background: var(--danger-ink) !important; color: var(--white) !important; }

/* ألوان كروت الإعدادات — Design Tokens: كل كارت ليه --sc (لون قوي من هوية المواد) والخلفية مزيج فاتح منه */
.sc-violet { --sc: var(--c1); }
.sc-blue   { --sc: var(--c2); }
.sc-green  { --sc: var(--c3); }
.sc-yellow { --sc: var(--yellow); }
.sc-amber  { --sc: var(--c4); }
.sc-danger { --sc: var(--danger); }
.set-card { background: color-mix(in srgb, var(--sc, var(--surface)) 14%, var(--surface)); }
/* شارة الأيقونة — Font Awesome: حاوية 44px · أيقونة 22px · لون حبر · حد وظل من التوكنز · توسيط flex بصري */
.set-card .set-title { gap: 12px; }
.set-card .set-title .set-ic {
  width: 44px; height: 44px; font-size: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--sc, var(--yellow)); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: var(--r-sm);
  box-shadow: var(--sh-xs);
}
/* أيقونات FA جوه الأزرار: 18px — مستقلة عن حجم الحاوية */
.btn .fa-solid, .btn .fa-regular, .sg-go .fa-solid { font-size: 18px; line-height: 1; }
/* أيقونة الـ FAB تتوسّط زي ما كانت */
.support-fab .fa-solid { line-height: 1; }
.set-card .set-row { border-top-color: color-mix(in srgb, var(--ink) 16%, transparent); }
.set-card.sc-danger .btn.out { background: var(--white); color: var(--danger-ink); }
/* أرقام قواعد الموقع تاخد لون الكارت نفسه بدل البنفسجي الثابت */
.set-rules li::before { background: color-mix(in srgb, var(--sc, var(--violet-l)) 24%, var(--white)); }
/* أزرار أيقونة SVG تتوسّط صح */
#supportClose { display: flex; align-items: center; justify-content: center; padding: 0; }
/* هدف لمس 40px لعين إظهار كلمة المرور على الموبايل */
@media (max-width: 560px) {
  .pw-wrap input { padding-left: 52px; }
  .pw-eye { width: 40px; height: 40px; }
}
.settings-head h1 {
  background: linear-gradient(transparent 58%, var(--yellow) 58% 92%, transparent 92%);
  padding: 0 6px; border-radius: 4px;
}

/* ===================== 6. الرفوف ===================== */
.container { max-width: 1180px; margin: 0 auto; padding: 30px 20px 100px; }
.shelf-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 14px; }
.shelf-head h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 800; letter-spacing: -.02em; line-height: 1.35; }
.shelf-head .who { color: var(--muted); font-size: 14px; margin-top: 5px; font-weight: 600; }
.shelf-head .who b { color: var(--ink); font-weight: 800; }
.shelf { position: relative; margin-bottom: 56px; }
.shelf-title { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.shelf-title h2 {
  font-size: 19px; font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(transparent 55%, var(--yellow) 55%, var(--yellow) 92%, transparent 92%);
  padding: 0 4px;
}
.shelf-title .line { flex: 1; height: 3px; background: var(--ink); border-radius: var(--r-full); opacity: .85; }
.books-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 44px 28px; padding: 26px 2px 10px; }

/* غلاف الكتاب — Neo-Brutalism: زوايا غير متساوية (زشخ الكتاب يحكي)، كعب ملوّن يمينًا بأشرطة صفحات، خيط ربط + ظل مزدوج (سواد + لون المادة) */
.book-cover {
  position: relative; width: 100%; height: 296px; padding: 0; text-align: center;
  border: var(--bw-thick) solid var(--ink);
  border-radius: 8px 22px 22px 8px;
  cursor: pointer; overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 82% -8%, rgba(255,255,255,.62), transparent 52%),
    color-mix(in srgb, var(--bc) 26%, var(--surface));
  box-shadow:
    var(--sh-lg),
    7px 0 0 calc(-1px) color-mix(in srgb, var(--bc) 80%, white);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease;
}
.book-wrap { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
/* ترقّف صفحات بخطوط ناعمة — يمين الكعب ناحية الداخل */
.book-cover::before {
  content: ''; position: absolute; top: 6px; bottom: 6px; right: 22px; width: 10px;
  border-radius: var(--r-full);
  background: repeating-linear-gradient(0deg,
    rgba(255,255,255,.55) 0 2px, transparent 2px 6px);
  opacity: .8;
  pointer-events: none;
}
.book-cover:hover, .book-cover:focus-visible {
  transform: translate(-4px, -5px);
  box-shadow:
    9px 10px 0 var(--ink),
    7px 0 0 calc(-1px) color-mix(in srgb, var(--bc) 80%, white);
}
.book-cover:active { transform: translate(2px, 3px); box-shadow: var(--sh-xs); }
/* كعب الكتاب (يمين — عربي): شريط بلون المادة القوي + خطّي فاصل */
.book-edge {
  position: absolute; top: 0; bottom: 0; right: 0; width: 18px;
  background: var(--bc);
  border-left: var(--bw) solid var(--ink);
}
.book-edge::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to left, rgba(255,255,255,.42), rgba(0,0,0,.06) 55%, transparent);
}
.book-spine {
  position: absolute; top: 14px; bottom: 14px; right: 22px; width: 5px; z-index: 2;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.85);
  border: 1.5px solid var(--ink);
}
.book-face {
  position: absolute; inset: 18px 38px 16px 20px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--ink);
}
.book-name {
  font-size: 17px; font-weight: 800; line-height: 1.7; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.book-rule { width: 46px; height: 4px; border-radius: var(--r-full); background: var(--ink); }
.book-doctor {
  font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.6; color: var(--ink-2);
  background: rgba(255,255,255,.72);
  border: 2px solid var(--ink); border-radius: var(--r-full);
  padding: 3px 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: 100%;
}
/* ستيكر الرقم — دائرة صفراء مائلة */
.book-corner {
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--yellow); border: 2px solid var(--ink);
  color: var(--ink); font-size: 12.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-8deg); box-shadow: 2px 2px 0 var(--ink);
}
/* الخيارات الثلاثة */
.book-menu { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; margin-top: 14px; min-width: 0; }
/* الصف السفلي: flex تلقائي العرض حسب المحتوى — «الملازم» تاخد مساحة أكبر من «الداتا» بدون أي قصّ */
.bm-row { display: flex; align-items: stretch; gap: 7px; min-width: 0; }
.bm-row .bm { flex: 1 1 auto; min-width: 0; }
.bm {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 0; min-height: 44px; padding: 9px 5px; border-radius: var(--r-sm); cursor: pointer;
  border: var(--bw) solid var(--ink); background: var(--white); color: var(--ink);
  font-size: 13px; font-weight: 800;
  box-shadow: var(--sh-xs);
  transition: transform .13s, box-shadow .13s, background .13s;
}
.bm:hover { transform: translate(-1px, -2px); box-shadow: var(--sh-sm); background: var(--bcl, var(--yellow-l)); }
.bm:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.bm-ic { font-size: 15px; display: flex; flex-shrink: 0; }
/* النص يظهر كامل دائمًا — ممنوع أي ellipsis أو لفّ لسطرين */
.bm-tx { white-space: nowrap; min-width: 0; overflow: visible; text-overflow: clip; flex-shrink: 0; }
.bm-n {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--ink); color: var(--white);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  font-feature-settings: 'tnum'; flex-shrink: 0;
}
.bm-n.zero { color: var(--muted); background: var(--bg-2); border: 1.5px solid var(--muted-2); }
/* الاختبارات: الزر الأساسي الأصفر */
.bm-main {
  background: var(--yellow); color: var(--ink);
  min-height: 48px; padding: 11px 10px;
  font-size: 14.5px; font-weight: 800;
  box-shadow: var(--sh-sm);
}
.bm-main:hover { background: color-mix(in srgb, var(--yellow) 86%, var(--white)); transform: translate(-2px, -2px); box-shadow: var(--sh-md); }
.bm-main .bm-n { background: var(--ink); color: var(--yellow); }

/* ===================== 7. صفحة المادة ===================== */
.mat-hero {
  border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-xl); padding: 36px 32px;
  background: color-mix(in srgb, var(--bc) 16%, var(--surface)) !important;
  color: var(--ink) !important;
  position: relative; overflow: hidden;
  box-shadow: var(--sh-lg);
}
.mat-hero h1 { font-size: clamp(23px, 3vw, 30px); font-weight: 800; letter-spacing: -.02em; text-shadow: none; margin-top: 34px; }
.mat-hero .doc { opacity: 1; font-size: 14.5px; margin-top: 8px; font-weight: 700; color: var(--ink-2); }
.mat-hero .back {
  position: absolute; top: 18px; left: 18px; z-index: 3;
  background: var(--white); border: var(--bw) solid var(--ink);
  color: var(--ink); padding: 8px 15px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 800; box-shadow: var(--sh-xs);
  transition: .14s;
  min-height: 38px;
}
@media (max-width: 640px) {
  .mat-hero .back { top: 12px; left: 12px; }
}
.mat-hero .back:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); background: var(--yellow-l); }
.mat-hero::after { content: none; }
.mat-hero > * { position: relative; z-index: 2; }

.opts { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 26px; }
.opt-card {
  display: flex; align-items: center; gap: 18px; padding: 22px 24px;
  border-radius: var(--r-lg); border: var(--bw) solid var(--ink);
  background: var(--white); box-shadow: var(--sh-sm); cursor: pointer;
  transition: transform .16s, box-shadow .16s, background .16s;
  text-align: right; width: 100%;
}
.opt-card:hover { transform: translate(-2px, -3px); box-shadow: var(--sh-md); background: var(--ocl, var(--yellow-l)); }
.opt-icon {
  width: 56px; height: 56px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: var(--oc, var(--yellow)); color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: var(--sh-xs);
}
.opt-body { flex: 1; min-width: 0; }
.opt-body h3 { font-size: 17px; font-weight: 800; margin-bottom: 3px; color: var(--ink); }
.opt-body p { color: var(--muted); font-size: 13px; line-height: 1.65; font-weight: 600; }
.opt-count {
  background: color-mix(in srgb, var(--oc, var(--yellow)) 88%, var(--white)); color: var(--ink);
  border: var(--bw) solid var(--ink);
  font-weight: 800; font-size: 13.5px; padding: 7px 14px;
  border-radius: var(--r-full); flex-shrink: 0; font-feature-settings: 'tnum';
  box-shadow: var(--sh-xs);
}
.opts-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===================== 8. العارض ===================== */
.viewer-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: var(--bw) solid var(--ink);
  border-radius: var(--r-lg); padding: 10px 14px;
  box-shadow: var(--sh-sm); margin-bottom: 16px;
}
.viewer-bar .t { font-weight: 800; font-size: 15px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn {
  padding: 8px 15px; border-radius: var(--r-sm);
  border: var(--bw) solid var(--ink); background: var(--white);
  font-size: 13px; font-weight: 800; color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; box-shadow: var(--sh-xs);
  transition: transform .13s, box-shadow .13s, background .13s; white-space: nowrap;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); background: var(--yellow-l); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn.primary { background: var(--yellow); color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--yellow) 86%, var(--white)); }
.btn.danger { color: var(--danger-ink); background: var(--danger-soft); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--danger-soft)); }

.viewer-frame {
  position: relative; background: var(--white); border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--sh-lg); min-height: 70vh;
}
.viewer-frame.light { background: var(--white); }
.viewer-frame iframe { width: 100%; height: 82vh; border: none; display: block; background: var(--white); }
/* عارض PDF.js المدمج — صفحات مرسومة على canvas داخل حاوية بتمرير */
.pdfjs-frame { background: var(--bg-2); max-height: 82vh; overflow: hidden; }
.pdfjs-scroll { max-height: 78vh; overflow-y: auto; overflow-x: auto; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 14px; direction: ltr; }
.pdfjs-page { position: relative; flex-shrink: 0; box-shadow: var(--sh-sm); background: var(--white); margin: 0 auto; direction: ltr; }
.pdfjs-page canvas { display: block; direction: ltr; }
.pdfjs-text { position: absolute; inset: 0; opacity: 0; pointer-events: none; overflow: hidden; white-space: pre-wrap; }
.pdfjs-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; color: var(--muted); font-weight: 700; direction: rtl; }
.pdfjs-loading .big { font-size: 40px; color: var(--ink); }
.viewer-fullscreen-active #page-viewer { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--bg); padding: 10px; overflow: auto; }
.viewer-fullscreen-active .pdfjs-frame, .viewer-fullscreen-active .pdfjs-scroll { max-height: calc(100vh - 90px); }
.viewer-frame.img-frame { background: var(--bg-2); padding: 18px; display: flex; justify-content: center; }
.viewer-frame.img-frame img { max-width: 100%; max-height: 82vh; border-radius: var(--r-sm); box-shadow: var(--sh-sm); background: var(--white); }

.vb-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zoom-box {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm); padding: 2px; box-shadow: var(--sh-xs);
}
.zoom-box .btn.sq { min-width: 36px; min-height: 36px; padding: 0 11px; border: none; background: transparent; font-size: 15px; line-height: 1; border-radius: 8px; color: var(--ink); box-shadow: none; display: inline-flex; align-items: center; justify-content: center; }
.zoom-box .btn.sq:hover:not(:disabled) { background: var(--yellow-l); transform: none; box-shadow: none; }
.zoom-box .btn.sq:disabled { opacity: .35; cursor: not-allowed; }
.zoom-val { font-size: var(--fs-sm); font-weight: 800; color: var(--ink); min-width: 46px; text-align: center; direction: ltr; font-feature-settings: 'tnum'; }
.viewer-nav {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: var(--surface); border: var(--bw) solid var(--ink);
  border-radius: var(--r-md); padding: 9px 14px; margin-bottom: 12px; box-shadow: var(--sh-sm);
}
.viewer-nav .img-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.viewer-nav .img-count b { color: var(--ink); font-size: 15px; font-weight: 800; }

/* علامة التنزيل العايمة فوق شمال الملف */
.frame-dl {
  position: absolute; top: 12px; left: 12px; z-index: var(--z-frame);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-full);
  background: var(--green-l); color: var(--ok-ink);
  border: var(--bw) solid var(--ink);
  font-size: 12.5px; font-weight: 800; text-decoration: none;
  box-shadow: var(--sh-xs); transition: .14s;
}
.frame-dl:hover { background: var(--green); color: var(--ink); transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }
.viewer-frame.zoomed { overflow: auto; }
.viewer-frame.img-frame.zoomed { justify-content: flex-start; align-items: flex-start; }
.viewer-frame.img-frame.zoomed img { margin: 0 auto; }
.viewer-frame:fullscreen { border-radius: 0; min-height: 100vh; }
.viewer-frame:fullscreen iframe { height: 100vh; }
/* زوم فريمات HTML/الاختبارات من شريط العارض — الـ iframe عليه sandbox فالزوم بيتركب عليه من بره:
   صندوق 100/z يتمدد ويتقلص scale حول مركزه العلوي → بيملأ الفريم بالضبط عند أي مستوى،
   والمحتوى جوّه الـ iframe بيتخطط بالعرض المعدّل (زي زوم المتصفح) والتمرير داخلي طبيعي */
.viewer-frame.html-frame { height: 82vh; display: flex; justify-content: center; align-items: flex-start; }
.viewer-frame.html-frame iframe {
  flex: none;
  width: calc(100% / var(--vz, 1));
  height: calc(100% / var(--vz, 1));
  transform: scale(var(--vz, 1));
  transform-origin: top center;
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.viewer-frame.html-frame:fullscreen { height: 100vh; }
@media (max-width: 640px) {
  .vb-tools { width: 100%; justify-content: space-between; }
  .zoom-val { min-width: 40px; }
}

/* ===================== 9. ملفات المادة ===================== */
.tab-desc { color: var(--muted); font-size: 13.5px; margin: -6px 0 16px; font-weight: 600; }
.files-list { display: grid; gap: 12px; }

/* ====================== 9-ب. كروت الاختبارات (ورقة امتحان — شكل مختلف تمامًا عن الكتب) ======================
   ورقة أصفر بشرايد سؤال + هامش أحمر + بنترولات تثبيت + شريطين لاصق فوق
   + استكر نتيجة ملزق في الزاوية + أنميشن عدّاد */
.files-list.quiz-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 20px; padding: 18px 4px 12px; }
.files-list.quiz-grid > .file-row { grid-column: 1 / -1; width: 100%; }
.quiz-self-note, .quiz-note { margin: 0 4px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }

.quiz-wrap { position: relative; }
/* شريطين لاصق فوق الزوايا — إحساس ورقة متعلّقة */
.quiz-wrap::before, .quiz-wrap::after {
  content: ''; position: absolute; z-index: 6; width: 62px; height: 18px;
  background: rgba(255,255,255,.6); border: 1px dashed rgba(0,0,0,.3);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.quiz-wrap::before { top: -9px; right: -14px; transform: rotate(38deg); }
.quiz-wrap::after  { top: -9px; left: -14px;  transform: rotate(-38deg); }

.quiz-paper {
  position: relative; display: block; width: 100%; height: 250px; padding: 0; text-align: center;
  border: var(--bw-thick) solid var(--ink);
  border-radius: 8px;
  cursor: pointer; overflow: visible; color: var(--ink);
  background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(41,80,130,.14) 30px 31px),
    linear-gradient(180deg, color-mix(in srgb, var(--yellow) 78%, white), color-mix(in srgb, var(--yellow) 55%, white) 58%, color-mix(in srgb, var(--yellow) 74%, white));
  box-shadow: var(--sh-lg);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease;
}
/* شريط الهامش الأحمر على اليمين زي ورقة الامتحان */
.quiz-paper::before {
  content: ''; position: absolute; top: 46px; bottom: 14px; right: 18px; width: 2px;
  background: rgba(214,60,60,.5); border-radius: 2px;
}
/* بنترولات تثبيت يسار — زي رَفّة الورق */
.quiz-paper::after {
  content: ''; position: absolute; left: 8px; top: 52px; bottom: 52px; width: 12px;
  background-image: radial-gradient(circle at center, var(--surface) 0 3.5px, rgba(0,0,0,.32) 3.5px 4.5px, transparent 4.5px);
  background-size: 12px 44px; background-repeat: repeat-y;
}
.quiz-paper:hover, .quiz-paper:focus-visible {
  transform: translate(-3px, -4px) rotate(-.6deg);
  box-shadow: 10px 11px 0 var(--ink);
}
.quiz-paper:active { transform: translate(1px, 2px); box-shadow: var(--sh-xs); }

/* شريط رأس الورقة — «ورقة امتحان» */
.qp-band {
  position: absolute; inset: 0 0 auto 0; z-index: 2; height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: color-mix(in srgb, var(--ink) 90%, black);
  color: var(--white); border-bottom: var(--bw) solid var(--ink);
  border-radius: 5px 5px 0 0; font-size: 11.5px; font-weight: 800; letter-spacing: .05em;
}
.qp-band .ic { width: 15px; height: 15px; }
/* قصّة بيرفوره تحت الشريط — زي ورقة مقتطعة */
.qp-band::after {
  content: ''; position: absolute; top: calc(100% + 4px); left: 12px; right: 12px; height: 6px;
  background: radial-gradient(circle at 3px 3px, rgba(0,0,0,.16) 0 2px, transparent 2px);
  background-size: 14px 6px; background-repeat: repeat-x;
}
.qp-body {
  position: absolute; inset: 46px 27px 52px 27px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  color: var(--ink);
}
.quiz-label { font-size: 16.5px; font-weight: 800; line-height: 1.55; }
.quiz-detail {
  font-size: 11.5px; font-weight: 700; color: var(--ink-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.quiz-material {
  font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.6; color: var(--ink-2);
  background: rgba(255,255,255,.72);
  border: 2px solid var(--ink); border-radius: var(--r-full);
  padding: 2px 12px; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* النتيجة المصغّرة جوه الكارت */
.quiz-mini {
  font-size: 13px; font-weight: 800; display: inline-flex; gap: 7px; align-items: center;
  border-radius: var(--r-full); padding: 4px 14px;
  border: 2px solid var(--ink);
}
.quiz-mini.none { background: rgba(255,255,255,.65); color: var(--muted); font-size: 12px; }
.quiz-mini.qc-exc     { background: var(--green-l);  color: var(--ok-ink); }
.quiz-mini.qc-vgood   { background: var(--green-l);  color: var(--ok-ink); }
.quiz-mini.qc-good    { background: var(--warn-soft); color: var(--warn-ink); }
.quiz-mini.qc-review  { background: var(--danger-soft); color: var(--danger-ink); }

/* ستيكر الرمز على يسار الكارت */
.quiz-corner {
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--yellow); border: 2px solid var(--ink);
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  transform: rotate(-8deg); box-shadow: 2px 2px 0 var(--ink);
}
.quiz-corner .ic { width: 15px; height: 15px; }

/* ====================== رسائل الاختبارات التحفيزية (فوق كل حاجة — زي رسالة بتوصل) ====================== */
.quiz-msg {
  position: fixed; top: 16px; left: 50%; z-index: 99999;
  width: min(92vw, 540px);
  padding: 12px 18px 15px;
  background: var(--bg);
  border: var(--bw-thick) solid var(--ink);
  border-radius: 12px;
  box-shadow: 6px 6px 0 var(--ink);
  color: var(--ink);
  transform: translate(-50%, calc(-100% - 48px)) rotate(-1.5deg);
  opacity: 0;
  transition: transform .4s cubic-bezier(.2, .9, .25, 1.15), opacity .3s ease;
  pointer-events: none; /* مش بتقف حاجة قدام المستخدم — بتقعد ثواني كويس وتختفي */
}
.quiz-msg.in { transform: translate(-50%, 0) rotate(-1.5deg); opacity: 1; }
.qm-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
  opacity: .62; margin-bottom: 3px;
}
.qm-head i { font-size: 13px; }
.qm-text { font-size: 18.5px; font-weight: 800; line-height: 1.55; }
/* نسخة الدهبي — لما يجيب من 90 لـ 100 */
.quiz-msg.gold {
  background: linear-gradient(180deg, var(--yellow), var(--yellow-l));
  box-shadow: 6px 6px 0 var(--ink), 0 0 0 3px color-mix(in srgb, var(--yellow) 55%, transparent);
}
.quiz-msg.gold .qm-text { font-size: 22px; }
@media (max-width: 640px) {
  .quiz-msg { top: 10px; width: 94vw; padding: 10px 14px 13px; }
  .qm-text { font-size: 16.5px; }
  .quiz-msg.gold .qm-text { font-size: 19px; }
}

/* ====================== استكر النتيجة (حلّي ركن على زاوية الكارت) ====================== */
.quiz-sticker-slot { position: absolute; top: -10px; left: -12px; z-index: 5; }
.quiz-sticker {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 68px; min-height: 68px; padding: 8px 12px;
  color: var(--white); transform: rotate(-12deg);
  border: 3px solid var(--ink); border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 800; text-align: center;
  transition: transform .5s cubic-bezier(.2,1.65,.4,1);
}
.quiz-sticker.pop { transform: rotate(-12deg) scale(1.35) rotate(10deg); }
.qs-t { font-size: 11.5px; line-height: 1.15; }
.qs-n { font-size: 16px; font-feature-settings: 'tnum'; line-height: 1.1; }

/* ألوان الاستكر حسب الدرجة */
.quiz-sticker.qc-exc     { background: linear-gradient(140deg, var(--green), color-mix(in srgb, var(--green) 75%, black)); }
.quiz-sticker.qc-vgood   { background: linear-gradient(140deg, var(--green), color-mix(in srgb, var(--green) 65%, var(--blue))); }
.quiz-sticker.qc-good    { background: linear-gradient(140deg, var(--yellow), color-mix(in srgb, var(--yellow) 70%, var(--warn-ink))); color: var(--ink); }
.quiz-sticker.qc-review  { background: linear-gradient(140deg, var(--danger), color-mix(in srgb, var(--danger) 75%, black)); }





.file-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: var(--r-md); padding: 14px 16px; cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: transform .14s, box-shadow .14s, background .14s;
}
.file-row:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-sm); background: var(--yellow-l); }
.file-ic {
  width: 46px; height: 46px; border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--ink);
  border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0;
}
.file-ic .ic { width: 22px; height: 22px; }
.file-ic.pdf    { background: var(--danger-soft); color: var(--danger-ink); }
.file-ic.img    { background: var(--green-l);     color: var(--ok-ink); }
.file-ic.sheet  { background: var(--green-l);     color: var(--ok-ink); }
.file-ic.code   { background: var(--warn-soft);   color: var(--warn-ink); }
.file-ic.video  { background: var(--violet-soft); color: var(--violet-ink); }
.file-ic.audio  { background: var(--info-soft);   color: var(--info-ink); }
.file-row .fi { flex: 1; min-width: 0; }
.file-row .fi b { display: block; font-size: 14.5px; font-weight: 800; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; flex-shrink: 0; }
.dl-chip {
  font-size: 11px; font-weight: 800; padding: 4px 10px;
  border-radius: var(--r-full); flex-shrink: 0; white-space: nowrap;
  border: 2px solid var(--ink);
}
.dl-chip.yes { background: var(--green); color: var(--ink); }
.dl-chip.no { background: var(--bg-2); color: var(--muted); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 52px; margin-bottom: 14px; color: var(--ink); display: flex; justify-content: center; }
.empty h3 { color: var(--ink); font-size: 17px; font-weight: 800; margin-bottom: 6px; }

/* ===================== 10. لوحة المدير ===================== */
.file-dropzone {
  border: 2.5px dashed var(--ink); border-radius: var(--r-md);
  padding: 24px 16px; text-align: center; background: var(--surface);
  cursor: pointer; transition: .14s; position: relative; margin-bottom: 14px;
}
.file-dropzone:hover, .file-dropzone.dragover {
  background: var(--yellow-l); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink);
}
.file-dropzone.has-file {
  border-style: solid; background: var(--green-l); border-color: var(--ink);
}
.file-dropzone .fdz-icon { display: flex; align-items: center; justify-content: center; font-size: 36px; line-height: 1; margin: 0 auto 10px; color: var(--ink); }
.file-dropzone .fdz-title { font-size: 15px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.file-dropzone .fdz-sub { font-size: 12px; color: var(--muted); }
.file-dropzone .file-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; display: block !important; }

.notif-sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 24px 0 14px;
}
.notif-sec-head .sec-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 800; color: var(--ink); margin: 0;
}
.count-bubble {
  min-width: 24px; height: 24px; padding: 0 7px;
  background: var(--yellow); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 999px;
  font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}
.notif-clear-all {
  height: 32px; padding: 0 12px;
  background: var(--surface); color: var(--danger-ink);
  border: 2px solid var(--ink); border-radius: var(--r-xs);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 12px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: .12s;
}
.notif-clear-all:hover { background: var(--danger-soft); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }

.adm-add-mat-card {
  border: 2.5px dashed var(--ink); border-radius: var(--r-md);
  padding: 20px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; min-height: 120px;
  background: var(--surface); cursor: pointer; transition: .14s;
}
.adm-add-mat-card:hover {
  background: var(--yellow-l); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink);
}
.adm-add-mat-card .ic { font-size: 24px; color: var(--ink); }
.adm-add-mat-card b { font-size: 14px; font-weight: 800; color: var(--ink); }
.adm-add-mat-card span { font-size: 11.5px; color: var(--muted); }

.admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; max-width: min(1680px, 100%); margin: 0 auto; padding: 26px 20px 100px; }
/* شاشات عريضة: استغلال كامل للمساحة — القائمة الجانبية ثابتة واللوحة تأخذ الباقي */
@media (min-width: 1440px) {
  .admin-layout { padding: 30px 36px 110px; gap: 28px; }
  table.students th, table.students td { padding-inline: 16px; }
}
.admin-side {
  background: var(--surface); border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-lg); padding: 16px 12px; height: fit-content;
  position: sticky; top: 84px; box-shadow: var(--sh-md);
}
.admin-side .st { font-size: 11.5px; font-weight: 800; color: var(--muted); letter-spacing: .06em; margin: 4px 10px 10px; }
/* زر الرجوع لرفوف المواد — فوق أقسام اللوحة */
.adm-back-shelf {
  display: flex; align-items: center; gap: 9px; width: 100%;
  margin: 0 0 10px; padding: 10px 14px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-sm);
  background: var(--yellow); color: var(--ink);
  font-weight: 800; font-size: 13.5px; box-shadow: var(--sh-xs);
  transition: .13s;
}
.adm-back-shelf:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); background: var(--yellow-l); }
.adm-back-shelf:active { transform: translate(1px, 1px); box-shadow: none; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav button {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: var(--r-sm); border: var(--bw) solid transparent;
  background: transparent; font-size: 14px; font-weight: 800; color: var(--muted);
  text-align: right; transition: background .14s, color .14s, box-shadow .14s;
}
.admin-nav button .ic, .admin-nav button i { font-size: 17px; width: 1em; text-align: center; }
.admin-nav button:hover { background: var(--yellow-l); color: var(--ink); border-color: var(--ink); }
.admin-nav button.on {
  background: var(--yellow); color: var(--ink);
  border-color: var(--ink); box-shadow: var(--sh-xs);
}
.admin-main { min-width: 0; }
.panel {
  background: var(--surface); border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sh-md); margin-bottom: 20px;
}
.panel h2 { font-size: 19px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.01em; }
.panel .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; }
.stat-box {
  background: var(--yellow-l);
  border: var(--bw) solid var(--ink); border-radius: var(--r-md); padding: 16px;
  box-shadow: var(--sh-xs);
}
.stat-box .v { font-size: 27px; font-weight: 800; color: var(--ink); line-height: 1.2; font-feature-settings: 'tnum'; }
.stat-box .k { font-size: var(--fs-sm); color: var(--muted); font-weight: 800; margin-top: 3px; }

/* جدول الطلاب — تغليف قابل للتمرير + رأس لاصق */
.table-wrap, .tbl-scroll { --table-zoom: 1; overflow: auto; max-height: 64vh; border: var(--bw) solid var(--ink); border-radius: var(--r-md); box-shadow: var(--sh-xs); background: var(--surface); contain: layout style paint; }
.tbl-scroll > table.students { zoom: var(--table-zoom, 1); transform: translateZ(0); will-change: transform; backface-visibility: hidden; }
table.students tbody tr { content-visibility: auto; contain-intrinsic-size: auto 56px; }
table.students { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.students th {
  position: sticky; top: 0; z-index: 2;
  text-align: right; padding: 11px 12px;
  background: var(--yellow-l); color: var(--ink);
  font-size: 12px; font-weight: 800;
  border-bottom: var(--bw) solid var(--ink); white-space: nowrap;
}
table.students td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; background: var(--surface); }
table.students tr:last-child td { border-bottom: none; }
table.students tbody tr:hover td { background: var(--yellow-l); }
table.students tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
table.students tbody tr:nth-child(even):hover td { background: var(--yellow-l); }

.pw-view {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  background: var(--bg-2); padding: 3px 9px; border-radius: var(--r-xs);
  font-size: 12.5px; direction: ltr; display: inline-block; font-weight: 700;
}
.pw-view.pw { background: var(--warn-soft); color: var(--warn-ink); }
.badge { font-size: 11px; font-weight: 800; padding: 4px 11px; border-radius: var(--r-full); display: inline-block; border: 2px solid var(--ink); }
.badge.yes { background: var(--green); color: var(--ink); }
.badge.no { background: var(--bg-2); color: var(--muted); }
.badge.admin-b { background: var(--pink-l); color: var(--ink); }
.badge.admin-b.core { background: var(--yellow); color: var(--ink); }

/* شارة التسجيل — ديناميكية لكل طالب (أخضر «سجّل» / أحمر «لم يسجل») + أيقونة فوق النص بتوسيط مطلق */
.badge.reg {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; line-height: 1; text-align: center; white-space: nowrap;
  min-width: 72px; min-height: 46px; padding: 7px 12px;
}
.badge.reg .ic { width: 13px; height: 13px; vertical-align: baseline; }
.badge.reg.reg-yes { background: var(--ok-soft); color: var(--ok-ink); }
.badge.reg.reg-no { background: var(--danger-soft); color: var(--danger-ink); }
.star-admin { cursor: default; color: var(--warn); font-size: 13px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-xs);
  border: 2px solid var(--ink); background: var(--white);
  font-size: 15px; transition: .14s; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 0 var(--ink);
}
.icon-btn:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-xs); background: var(--yellow-l); }
.icon-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.icon-btn.on { background: var(--green); color: var(--ink); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar input[type=text] {
  padding: 10px 14px; border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm); font-size: 13.5px; min-width: 220px; outline: none;
  background: var(--white); font-weight: 600; transition: box-shadow .14s, transform .14s;
}
.toolbar input[type=text]:focus { box-shadow: var(--sh-xs); transform: translate(-1px, -1px); }
.upload-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; align-items: end; }
.upload-form .field { margin: 0; }
.check-line { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; color: var(--ink); cursor: pointer; padding: 11px 0; }
.check-line input { width: 18px; height: 18px; accent-color: var(--ok); }

.mat-admin-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: var(--bw) solid var(--ink);
  border-radius: var(--r-md); padding: 13px 15px; margin-bottom: 10px; flex-wrap: wrap;
  box-shadow: var(--sh-xs);
}
.mat-admin-row .mini-book {
  width: 42px; height: 58px; border-radius: 6px 10px 10px 6px;
  background: var(--bc);
  border: 2px solid var(--ink); box-shadow: var(--sh-xs); flex-shrink: 0;
}
.mat-admin-row .mi { flex: 1; min-width: 150px; }
.mat-admin-row .mi b { display: block; font-size: 14.5px; font-weight: 800; }
.mat-admin-row .mi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.mat-admin-row .mini {
  padding: 8px 13px; border-radius: var(--r-xs);
  border: 2px solid var(--ink); background: var(--white);
  font-size: 12.5px; font-weight: 800; color: var(--ink); transition: .13s;
  box-shadow: 2px 2px 0 var(--ink);
}
.mat-admin-row .mini:hover { background: var(--yellow-l); transform: translate(-1px, -1px); box-shadow: var(--sh-xs); }
.mat-admin-row .mini:active { transform: translate(1px, 1px); box-shadow: none; }

.adm-major-head { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; }
.adm-major-head:first-child { margin-top: 4px; }
.adm-major-head b { font-size: 16px; font-weight: 800; color: var(--ink);
  background: linear-gradient(transparent 55%, var(--yellow) 55%, var(--yellow) 92%, transparent 92%); padding: 0 4px; }
.adm-major-head span { font-size: 12px; font-weight: 800; color: var(--ink); background: var(--blue-l); padding: 3px 11px; border-radius: var(--r-full); border: 2px solid var(--ink); }
.adm-mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.adm-mat-card {
  display: flex; align-items: center; gap: 12px; position: relative; overflow: hidden;
  background: var(--surface); border: var(--bw) solid var(--ink);
  border-radius: var(--r-md); padding: 13px 15px; transition: .15s;
  box-shadow: var(--sh-xs);
}
.adm-mat-card:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-sm); }
.adm-mat-card .amc-strip { position: absolute; top: 0; bottom: 0; right: 0; width: 8px; background: var(--bc); border-inline-start: 2px solid var(--ink); }
.adm-mat-card .amc-body { flex: 1; min-width: 0; padding-right: 10px; }
.adm-mat-card .amc-body b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.55; }
.adm-mat-card .amc-body > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.adm-mat-card .amc-counts { display: flex; gap: 8px; margin-top: 8px; font-size: 11.5px; font-weight: 800; color: var(--ink); flex-wrap: wrap; }
.adm-mat-card .amc-counts span { background: var(--bg-2); padding: 3px 9px; border-radius: var(--r-full); border: 1.5px solid var(--ink); }
/* لون مميّز لكل نوع: اختيارات / ملازم / داتا */
.adm-mat-card .amc-counts span:nth-child(1) { background: var(--yellow-l); color: var(--ink); }
.adm-mat-card .amc-counts span:nth-child(2) { background: var(--violet-l); color: var(--ink); }
.adm-mat-card .amc-counts span:nth-child(3) { background: var(--green-l); color: var(--ink); }
.adm-mat-card .amc-acts { display: grid; gap: 6px; flex-shrink: 0; }
.adm-mat-card .mini {
  padding: 7px 12px; border-radius: var(--r-xs);
  border: 2px solid var(--ink); background: var(--white);
  font-size: 12px; font-weight: 800; color: var(--ink); white-space: nowrap; transition: .13s;
  box-shadow: 2px 2px 0 var(--ink);
}
.adm-mat-card .mini:hover { background: var(--yellow-l); transform: translate(-1px, -1px); }
.adm-mat-card .mini:active { transform: translate(1px, 1px); box-shadow: none; }

.filter-seg { display: inline-grid; grid-auto-flow: column; grid-template-columns: none; gap: 6px; }
.filter-seg button { padding: 9px 13px; font-size: 12.5px; border-radius: var(--r-xs); }
.stu-foot { margin-top: 12px; font-size: var(--fs-sm); font-weight: 800; color: var(--muted); }
td.row-acts { white-space: nowrap; }
td.row-acts .mini {
  padding: 7px 11px; border-radius: var(--r-xs);
  border: 2px solid var(--ink); background: var(--white);
  font-size: 12px; font-weight: 800; color: var(--ink); transition: .13s;
  box-shadow: 2px 2px 0 var(--ink); white-space: nowrap;
}
td.row-acts .mini:hover { background: var(--yellow-l); transform: translate(-1px, -1px); }
td.row-acts .act-del2 { color: var(--danger-ink); background: var(--danger-soft); min-width: 38px; min-height: 38px; padding: 0 8px; }
td.row-acts .act-del2:hover { background: color-mix(in srgb, var(--danger) 10%, var(--danger-soft)); }
/* أزرار ترقية/سحب الصلاحيات في جدول الطلاب كانت نص مسطّح بدون حدود ولا ظل */
.adm-role-cell .mini {
  padding: 6px 10px; min-height: 34px;
  border: 2px solid var(--ink); border-radius: var(--r-xs);
  background: var(--white); color: var(--ink);
  font-size: 12px; font-weight: 800; white-space: nowrap;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .13s, box-shadow .13s, background .13s;
}
.adm-role-cell .mini:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.adm-role-cell .mini:active { transform: translate(1px, 1px); box-shadow: none; }

/* ===================== الحظر الصامت (بند 45) + تكبير جدول الطلاب (بند 46) ===================== */
/* شارة «محظور» جنب الاسم — للأدمن فقط */
.badge.banned-b { background: var(--danger-soft); color: var(--danger-ink); }
.badge.banned-b .fa-solid { font-size: 11px; }
/* الصف المحظور: صبغة حمراء هادئة — بعد قواعد التناوب والـhover عشان يغلبهم */
table.students tbody tr.banned-row td { background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface)); }
table.students tbody tr.banned-row:hover td { background: color-mix(in srgb, var(--danger-soft) 85%, var(--surface)); }
/* زر الحظر/فك الحظر في عمود الإجراءات — نفس لغة أزرار العمود والحالة الحمراء لما يكون محظور */
td.row-acts .act-ban .fa-solid { font-size: 12.5px; }
td.row-acts .act-ban.is-banned { color: var(--danger-ink); background: var(--danger-soft); }
td.row-acts .act-ban.is-banned:hover { background: color-mix(in srgb, var(--danger) 10%, var(--danger-soft)); }
/* شريط تكبير/تصغير جدول الطلاب (في التولبار جنب فلتر التخصص) */
.tbl-zoom {
  display: inline-flex; align-items: center; gap: 2px;
  border: 2px solid var(--ink); border-radius: var(--r-full);
  background: var(--white); padding: 3px 5px; box-shadow: 2px 2px 0 var(--ink);
}
.tbl-zoom button {
  border: none; background: transparent; cursor: pointer;
  min-width: 30px; height: 26px; padding: 0 7px;
  border-radius: var(--r-full); display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 12px; font-weight: 800; color: var(--ink); transition: .13s;
}
.tbl-zoom button:hover { background: var(--yellow-l); }
.tbl-zoom button:active { transform: translate(1px, 1px); }
.tbl-zoom button .fa-solid { font-size: 13px; }
.tbl-zoom .zval { min-width: 50px; letter-spacing: .02em; }

.ask-support {
  display: inline-flex; align-items: center; gap: 5px;
  margin-right: 8px; margin-top: 6px;
  padding: 6px 13px; border-radius: var(--r-full);
  border: var(--bw) solid var(--ink); background: var(--yellow);
  color: var(--ink); font-size: 12.5px; font-weight: 800; transition: .14s;
  box-shadow: 2px 2px 0 var(--ink);
}
.ask-support:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-xs); }

/* ===================== 11. المودال ===================== */
.modal-back {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(20,20,20,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade .2s ease;
}
.modal {
  background: var(--surface); border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-xl);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  padding: 30px; box-shadow: 10px 10px 0 var(--ink); animation: pop .25s cubic-bezier(.2,.8,.2,1);
}
.modal h3 { font-size: 19px; font-weight: 800; margin-bottom: 16px; letter-spacing: -.01em; }
.modal-foot { display: flex; gap: 10px; margin-top: 22px; }
.fpw-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.fpw-head h3 { margin-bottom: 0; }
.fpw-back-btn {
  width: 38px; height: 38px; min-width: 38px;
  border-radius: var(--r-xs); border: 2px solid var(--ink);
  background: var(--white); color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: .12s;
}
.fpw-back-btn:hover { background: var(--yellow-l); transform: translate(-1px, -1px); }
.modal-foot.fpw-foot {
  display: flex; flex-direction: column; gap: 10px; margin-top: 18px;
}
.modal-foot.fpw-foot .fpw-btn {
  width: 100%; padding: 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 800; border: 2px solid var(--ink);
  cursor: pointer; transition: .12s;
}
.modal-foot.fpw-foot .save {
  background: var(--yellow); color: var(--ink); box-shadow: 3px 3px 0 var(--ink);
}
.modal-foot.fpw-foot .save:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* confirmNeoModal */
.confirm-neo { width: 100%; }
.confirm-neo .cnm-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.confirm-neo .cnm-ic {
  width: 44px; height: 44px; min-width: 44px;
  border-radius: 12px; border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  background: var(--yellow); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.confirm-neo .cnm-ic.danger { background: var(--danger-soft); color: var(--danger-ink); }
.confirm-neo .cnm-head h3 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.35; }
.confirm-neo .cnm-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; margin-top: 4px;
  background: var(--yellow-l); border: 1.5px solid var(--ink);
  border-radius: 999px; font-size: 11.5px; font-weight: 800;
}
.confirm-neo .cnm-badge.danger { background: var(--danger-soft); color: var(--danger-ink); }
.confirm-neo .cnm-msg {
  font-size: 14px; font-weight: 600; color: var(--ink);
  line-height: 1.6; margin: 0 0 12px 0;
}
.confirm-neo .cnm-note {
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--bg-2); border: 2px dashed var(--ink);
  border-radius: 10px; font-size: 12px; font-weight: 700;
  color: var(--ink-2); line-height: 1.55;
}
.confirm-neo .cnm-note.danger { background: #fef2f2; border-color: var(--danger); color: var(--danger-ink); }
.confirm-neo .cnm-foot { display: flex; gap: 10px; margin-top: 18px; }
.confirm-neo .cnm-foot button {
  flex: 1; padding: 11px 16px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 800; font-family: inherit;
  cursor: pointer; border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink); transition: .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.confirm-neo .cnm-foot #cnmCancel { background: var(--white); color: var(--ink); }
.confirm-neo .cnm-foot #cnmCancel:hover { background: var(--bg-2); }
.confirm-neo .cnm-foot .save { background: var(--yellow); color: var(--ink); }
.confirm-neo .cnm-foot .save:hover { background: #facc15; }
.confirm-neo .cnm-foot .cnm-danger { background: var(--danger); color: #fff; }
.confirm-neo .cnm-foot .cnm-danger:hover { background: #b91c1c; }
.modal-foot button {
  flex: 1; padding: 12px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 800;
  border: var(--bw) solid var(--ink); background: var(--white); color: var(--ink);
  box-shadow: var(--sh-xs); transition: .13s;
}
.modal-foot button:hover:not(.save) { background: var(--bg-2); transform: translate(-1px, -1px); }
.modal-foot button.save { background: var(--yellow); color: var(--ink); }
.modal-foot button.save:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }
.modal-foot button:active { transform: translate(1px, 1px); box-shadow: none; }

/* ===================== 12. شات الأدمن ===================== */
.chat-admin-list { display: grid; gap: 10px; }
.chat-msg { border: var(--bw) solid var(--ink); border-radius: var(--r-md); padding: 14px 16px; background: var(--white); box-shadow: var(--sh-xs); }
.chat-msg .cm-h { display: flex; gap: 10px; align-items: center; margin-bottom: 7px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); }
.chat-msg .cm-h b { color: var(--ink); font-size: 13.5px; font-weight: 800; }
.chat-msg .cm-t { font-size: 14px; line-height: 1.75; }
.chat-msg .reply-box { margin-top: 10px; background: var(--violet-l); border-radius: var(--r-sm); padding: 9px 13px; font-size: 13.5px; color: var(--ink); border: 2px solid var(--ink); font-weight: 600; }
.reply-row { display: flex; gap: 8px; margin-top: 10px; }
.reply-row input { flex: 1; padding: 9px 13px; border: var(--bw) solid var(--ink); border-radius: var(--r-sm); font-size: 13px; outline: none; background: var(--white); font-weight: 600; }
.reply-row input:focus { box-shadow: var(--sh-xs); }
.reply-row button { padding: 9px 18px; border-radius: var(--r-sm); border: var(--bw) solid var(--ink); background: var(--yellow); color: var(--ink); font-weight: 800; font-size: 13px; box-shadow: var(--sh-xs); transition: .13s; }
.reply-row button:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }

/* ===================== 13. ويدجت الدعم العائم ===================== */
/* تعريف واحد canonical للزر — بيتطبّق بنفس الشكل على شاشة الدخول (external)
   وعلى لوحة الطالب (internal)، بدون أي inline style أو اختلاف حسب الصفحة. */
.support-fab {
  position: fixed; bottom: 22px; left: 22px; z-index: var(--z-fab);
  box-sizing: border-box; padding: 0;
  width: 58px; height: 58px; border-radius: 50%;
  border: var(--bw-thick) solid var(--ink);
  background: var(--yellow); color: var(--ink);
  font-size: 24px; line-height: 1;
  box-shadow: var(--sh-md);
  transition: transform .18s, box-shadow .18s;
  display: flex; align-items: center; justify-content: center;
}
/* الأيقونة: نفس FontAwesome (fa-headset) ونفس المقاس في كل الحالات،
   وطبقة position:relative فوق حلقة الـ pulse. */
.support-fab-ic {
  position: relative; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.support-fab .fa-headset { font-size: 1em; line-height: 1; }
.support-fab:hover { transform: translate(-2px, -3px) rotate(-6deg); box-shadow: var(--sh-lg); }
.support-fab:active { transform: translate(1px, 2px); box-shadow: var(--sh-xs); }
.support-fab .pulse {
  display: none;
}
html.is-l1 #supportFab,
html.is-l1 #supportWin,
body.is-l1 #supportFab,
body.is-l1 #supportWin {
  display: none !important;
}
.support-win {
  position: fixed; bottom: 92px; left: 22px; z-index: var(--z-win);
  width: 360px; max-width: calc(100vw - 32px);
  height: min(480px, calc(100vh - 130px));
  background: var(--surface); border-radius: var(--r-xl);
  border: var(--bw-thick) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .25s cubic-bezier(.2,.8,.2,1);
}
.support-head {
  background: var(--yellow);
  color: var(--ink); padding: 15px 18px; display: flex; align-items: center; gap: 11px;
  border-bottom: var(--bw) solid var(--ink);
}
.support-head .t { flex: 1; font-weight: 800; font-size: 15px; }
.support-head .t span { display: block; font-size: 11.5px; font-weight: 600; opacity: .8; margin-top: 2px; }
.support-head-actions {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.support-head .support-clear-btn {
  flex: 0 0 auto; width: auto; min-width: 64px; height: 32px; padding: 0 10px;
  background: var(--surface); color: var(--danger-ink);
  border: 2px solid var(--ink); border-radius: var(--r-xs);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: .12s; flex-shrink: 0; white-space: nowrap;
}
.support-head .support-clear-btn:hover { background: var(--danger-soft); color: var(--danger-ink); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.support-head .support-close-btn,
.support-head button#supportClose {
  width: 32px; height: 32px; min-width: 32px; padding: 0;
  background: var(--white); color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--r-xs);
  box-shadow: 2px 2px 0 var(--ink); font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: .12s; flex-shrink: 0;
}
.support-head .support-close-btn:hover,
.support-head button#supportClose:hover { background: var(--pink-l); transform: translate(-1px, -1px); }
.support-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
  background-image: radial-gradient(rgba(20,20,20,.06) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
.smsg {
  max-width: 82%; padding: 10px 14px; border-radius: var(--r-md);
  font-size: 13.5px; line-height: 1.7; word-break: break-word;
  border: var(--bw) solid var(--ink); position: relative; font-weight: 600;
}
.smsg.me { align-self: flex-start; background: var(--green-l); border-bottom-right-radius: 5px; box-shadow: var(--sh-xs); }
.smsg.bot { align-self: flex-end; background: var(--white); border-bottom-left-radius: 5px; box-shadow: var(--sh-xs); }
.smsg.sys { align-self: center; background: transparent; color: var(--muted); font-size: 11.5px; box-shadow: none; border: none; }
.support-foot { padding: 12px; border-top: var(--bw) solid var(--ink); background: var(--surface); }
.support-foot input {
  flex: 1; padding: 11px 15px; border: var(--bw) solid var(--ink);
  border-radius: var(--r-full); font-size: 13.5px; outline: none; background: var(--white); font-weight: 600;
  transition: box-shadow .14s, transform .14s;
}
.support-foot input:focus { box-shadow: var(--sh-xs); transform: translate(-1px, -1px); }
.support-foot > .sg-chat-row button, .sg-chat-row button {
  width: 44px; height: 44px; border-radius: 50%;
  border: var(--bw) solid var(--ink);
  background: var(--yellow); color: var(--ink); font-size: 17px; flex-shrink: 0;
  box-shadow: var(--sh-xs); transition: .13s;
}
.support-foot > .sg-chat-row button:hover, .sg-chat-row button:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }
.sg-chat { display: flex; flex-direction: column; gap: 8px; }
.sg-chat-row { display: flex; gap: 8px; align-items: center; }
.sg-chat-row #chatAttBtn {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink);
  background: var(--white); color: var(--ink); font-size: 17px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: .13s;
  box-shadow: 2px 2px 0 var(--ink);
}
.sg-chat-row #chatAttBtn:hover { background: var(--yellow-l); transform: translate(-1px, -1px); }

.support-idgate { display: grid; gap: 8px; }
.sg-title { font-size: 12.5px; font-weight: 800; color: var(--ink); line-height: 1.7; margin-bottom: 2px; }
.support-idgate input {
  width: 100%; padding: 10px 13px; border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm); font-size: 13.5px; outline: none; background: var(--white); font-weight: 600;
  transition: box-shadow .14s, transform .14s;
}
.support-idgate input:focus { box-shadow: var(--sh-xs); transform: translate(-1px, -1px); }
.sg-majors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sg-majors button {
  padding: 10px 2px; border-radius: var(--r-sm);
  border: var(--bw) solid var(--ink); background: var(--white);
  font-size: 12.5px; font-weight: 800; color: var(--muted); transition: .13s;
  white-space: nowrap; overflow: hidden; line-height: 1.3; min-height: 38px;
}
.sg-majors button:hover { background: var(--yellow-l); color: var(--ink); }
.sg-majors button.on { background: var(--yellow); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.sg-go {
  width: 100%; height: auto !important; border-radius: var(--r-sm) !important;
  font-size: 13.5px !important; font-weight: 800;
  border: var(--bw) solid var(--ink) !important; background: var(--yellow) !important; color: var(--ink) !important;
  box-shadow: var(--sh-xs) !important;
  white-space: nowrap; padding: 11px 13px !important; min-height: 44px;
  overflow: hidden; text-overflow: ellipsis;
}

/* ---------- شات واتساب (ويدجت + لوحة الأدمن) ---------- */
.att-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.att-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-l); border: 2px solid var(--ink);
  color: var(--ink); font-size: 11.5px; font-weight: 800;
  padding: 4px 10px; border-radius: var(--r-full);
}
.att-pill button { border: none; background: transparent; color: var(--danger-ink); font-size: 11px; cursor: pointer; padding: 0; font-weight: 800; }
.smsg .wa-meta { display: inline-flex; align-items: center; gap: 3px; margin-right: 8px; font-size: 10px; color: var(--muted); direction: ltr; vertical-align: bottom; }
.smsg.me .wa-ticks { color: var(--info-ink); font-size: 10.5px; letter-spacing: -2px; }
.smsg.uploading { opacity: .75; font-style: italic; }
.wa-day { align-self: center; background: var(--bg-2); color: var(--muted); font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: var(--r-full); margin: 4px 0; border: 1.5px solid var(--ink); }
.wa-img { max-width: 100%; max-height: 210px; border-radius: var(--r-sm); display: block; margin-top: 6px; cursor: zoom-in; border: 2px solid var(--ink); }
.wa-file {
  display: flex; align-items: center; gap: 9px;
  background: var(--white); border: 2px solid var(--ink);
  border-radius: var(--r-sm); padding: 8px 11px; margin-top: 6px; min-width: 190px;
}
.wa-file-ic { font-size: 21px; display: flex; }
.wa-file-ic .ic { width: 20px; height: 20px; }
.wa-file-ic.pdf    { color: var(--danger-ink); }
.wa-file-ic.img    { color: var(--ok-ink); }
.wa-file-ic.sheet  { color: var(--ok-ink); }
.wa-file-ic.code   { color: var(--warn-ink); }
.wa-file-ic.video  { color: var(--violet-ink); }
.wa-file-ic.audio  { color: var(--info-ink); }
.wa-file-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wa-file-t b { font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; font-weight: 800; }
.wa-file-t small { font-size: 10.5px; color: var(--muted); }
.wa-file-dl { text-decoration: none; font-size: 15px; padding: 5px 8px; border-radius: var(--r-xs); background: var(--bg-2); color: var(--ink); border: 1.5px solid var(--ink); }
.wa-file-dl:hover { background: var(--yellow-l); }

.chat-panel { padding: 0 !important; overflow: hidden; }
.chat-panel-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 14px; border-bottom: var(--bw) solid var(--ink); }
.chat-panel-head h2 { margin: 0; }
.wt-badge {
  min-width: 21px; height: 21px; border-radius: var(--r-full);
  background: var(--pink); color: var(--ink); font-size: 11.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
  border: 2px solid var(--ink);
}
.wt-badge.big { font-size: 12.5px; padding: 3px 12px; }
.wa-wrap { display: grid; grid-template-columns: minmax(310px, 340px) 1fr; min-height: 520px; }
.wt-right-col {
  display: flex; flex-direction: column; align-items: flex-end;
  justify-content: center; gap: 5px; flex-shrink: 0; margin-inline-start: auto;
}
.wt-acts, .wa-head-actions {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.wt-act {
  width: 28px; height: 28px; min-width: 28px;
  border: 2px solid var(--ink); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; flex-shrink: 0; transition: .12s;
}
.wt-act:hover { transform: translate(-1px, -1px); box-shadow: 2.5px 2.5px 0 var(--ink); }
.wt-act.act-hide { background: var(--blue-l); color: #1e40af; }
.wt-act.act-local-del { background: var(--yellow-l); color: #92400e; }
.wt-act.act-global-wipe { background: var(--danger-soft); color: var(--danger-ink); }
.wa-head-actions .wt-act {
  width: 32px; height: 32px; min-width: 32px; font-size: 14px;
  border-radius: 8px; box-shadow: 2px 2px 0 var(--ink);
}
.wa-hidden-box {
  margin-top: 10px; padding: 10px; background: var(--bg-2);
  border: 2px dashed var(--ink); border-radius: var(--r-sm);
}
.wa-hidden-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 8px;
}
.wa-hidden-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 8px; background: var(--surface);
  border: 1.5px solid var(--ink); border-radius: var(--r-xs); margin-bottom: 4px;
  cursor: pointer; font-size: 12px; font-weight: 700;
}
.wa-list {
  border-inline-start: var(--bw) solid var(--ink); overflow-y: auto; max-height: 640px;
  background: var(--bg-2); padding: 8px; display: flex; flex-direction: column; gap: 4px;
}
.wt-item { position: relative; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; transition: background .14s; border: 2px solid transparent; }
.wt-item:hover { background: var(--white); border-color: var(--ink); }
.wt-item.on { background: var(--yellow-l); border-color: var(--ink); box-shadow: var(--sh-xs); }
.wt-av {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--cyan); color: var(--ink);
  border: 2px solid var(--ink);
  font-size: 17px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wt-body { flex: 1; min-width: 0; }
.wt-row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wt-row1 b { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.wt-time { font-size: 10.5px; color: var(--muted); direction: ltr; }
.wt-row2 { display: flex; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.wt-row2 .pw-view { font-size: 11px; }
.wt-row2 .chip { font-size: 10px; padding: 2px 8px; border-width: 1.5px; }
.wt-last { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.wt-item .wt-badge { position: static; margin: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--danger); color: #fff; border: 1.5px solid var(--ink); line-height: 1; }

.wa-open {
  display: flex; flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(rgba(20,20,20,.05) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  min-height: 520px;
}
.wa-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; padding: 30px; }
.wa-empty .big { font-size: 44px; display: flex; justify-content: center; color: var(--ink); }
.wa-empty h3 { color: var(--ink); font-size: 16px; font-weight: 800; }
.wa-empty p { font-size: 13px; }
.wa-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: var(--bw) solid var(--ink); }
.wa-head .wt-av { width: 38px; height: 38px; font-size: 15px; }
.wa-head-t { flex: 1; }
.wa-head-t b { display: block; font-size: 14px; font-weight: 800; }
.wa-head-t small { font-size: 11.5px; color: var(--muted); }
.wa-del { border: 2px solid var(--ink); background: var(--white); font-size: 15px; cursor: pointer; color: var(--danger-ink); border-radius: var(--r-xs); width: 36px; height: 36px; min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; transition: .13s; }
.wa-del:hover { background: var(--danger-soft); }
.wa-msgs { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; max-height: 480px; }
.wa-msgs .smsg { max-width: 62%; font-size: 13px; }
.wa-msgs .smsg.me { align-self: flex-start; background: var(--green-l); border-bottom-right-radius: 5px; }
.wa-msgs .smsg.bot { align-self: flex-end; background: var(--white); border-bottom-left-radius: 5px; }
.wa-inputbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border-top: var(--bw) solid var(--ink); }
.wa-inputbar .att-pills { width: 100%; }
.wa-att { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--white); font-size: 17px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.wa-att:hover { background: var(--yellow-l); }
.wa-inputbar input[type=text] {
  flex: 1; min-width: 120px; padding: 11px 16px; border: var(--bw) solid var(--ink);
  border-radius: var(--r-full); font-size: 13.5px; outline: none; background: var(--white); font-weight: 600;
}
.wa-inputbar input[type=text]:focus { box-shadow: var(--sh-xs); }
.wa-inputbar button#admChatSend {
  width: 42px; height: 42px; border-radius: 50%;
  border: var(--bw) solid var(--ink);
  background: var(--yellow); color: var(--ink); font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-xs); transition: .13s;
}
.wa-inputbar button#admChatSend:hover { transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }
@media (max-width: 900px) {
  .wa-wrap { grid-template-columns: 1fr; }
  .wa-list { max-height: 200px; border-inline-start: none; border-bottom: var(--bw) solid var(--ink); }
}

/* ===================== 14. التوست ===================== */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: var(--z-toast);
  background: var(--ink); color: var(--yellow);
  padding: 13px 22px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 800;
  box-shadow: var(--sh-md); animation: rise .25s cubic-bezier(.2,.8,.2,1);
  max-width: min(420px, calc(100vw - 48px));
}
.toast.ok { background: var(--green); color: var(--ink); }
.toast.err { background: var(--danger); color: var(--white); }

/* ===================== 15. الاستجابة — كومبيوتر / تاب / تليفون ===================== */

/* شاشات متوسطة (~1056px): ضبط فجوات الكتب وصفوف الأزرار لمنع التمدد الأفقي مع الحفاظ على الحدود والظلال */
@media (max-width: 1140px) {
  .books-row { gap: 38px 20px; }
  .bm-row { gap: 6px; }
  .bm { padding: 8px 4px; gap: 4px; font-size: 12px; }
  .bm-ic { font-size: 13px; }
  .bm-n { min-width: 18px; height: 18px; padding: 0 4px; font-size: 10px; }
}
/* تاب أفقي وأصغر */
@media (max-width: 1024px) {
  .container { max-width: 100%; }
  .books-row { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 38px 28px; }
  .admin-layout { grid-template-columns: 210px 1fr; gap: 18px; }
}

/* تاب عمودي / موبايل كبير */
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .admin-nav { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .opts-two { grid-template-columns: 1fr; }
  .books-row { grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 32px 22px; }
  .book-cover { height: 272px; }
  .book-name { font-size: 15.5px; }
  .bm { font-size: 12.5px; padding: 9px 6px; min-height: 40px; }
  .bm-main { font-size: 13.5px; min-height: 44px; }
  .bm-ic { display: none; }
  .table-wrap { max-height: none; }
  .wa-msgs .smsg { max-width: 85%; }
  .mat-hero { padding: 28px 22px; }
  .mat-hero h1 { margin-top: 46px; }
  .shelf-head { align-items: flex-start; flex-direction: column; }
}

/* موبايل: عمودان للكتب + تصغير المسافات */
@media (max-width: 560px) {
  .auth-card { padding: 28px 20px; border-radius: var(--r-lg); }
  .auth-logo { width: 58px; height: 58px; font-size: 25px; border-radius: 15px; }
  .auth-wrap::before { width: 260px; height: 260px; top: -110px; right: -90px; }
  .auth-wrap::after { width: 300px; height: 300px; bottom: -140px; left: -110px; }
  .books-row { grid-template-columns: repeat(2, 1fr); gap: 26px 16px; padding-top: 20px; }
  .book-cover { height: 226px; border-radius: 6px 16px 16px 6px; }
  .book-cover::before { right: 15px; width: 8px; top: 4px; bottom: 4px; }
  .book-face { inset: 12px 24px 10px 12px; gap: 7px; }
  .book-name { font-size: 13.5px; }
  .book-rule { width: 32px; height: 3px; }
  .book-doctor { font-size: 10.5px; padding: 2px 9px; border-width: 1.5px; }
  .book-corner { width: 24px; height: 24px; font-size: 10.5px; left: 8px; bottom: 8px; }
  .book-edge { width: 12px; }
  .book-spine { right: 15px; width: 4px; }
  .book-menu { gap: 7px; margin-top: 10px; }
  .bm-row { gap: 6px; }
  .bm { min-height: 38px; font-size: 11.5px; padding: 7px 4px; gap: 4px; border-width: 2px; box-shadow: 2px 2px 0 var(--ink); }
  .bm-main { min-height: 42px; font-size: 12.5px; }
  .bm-n { min-width: 18px; height: 18px; font-size: 9.5px; padding: 0 4px; }
  .topbar-in { padding: 9px 12px; gap: 6px; }
  .chip { padding: 3px 8px; font-size: 11px; line-height: 1.3; }
  /* الشريط العلوي على الموبايل: اسم أقصر + عناصر أصغر عشان مفيش لفّ سطر ولا خروج بره الشاشة */
  .brand { font-size: 15px; gap: 5px; flex-shrink: 0; }
  .brand .logo { width: 40px; height: 40px; font-size: 19px; border-radius: 12px; }
  .brand-logo-img { width: clamp(54px, 15.5vw, 66px); height: clamp(54px, 15.5vw, 66px); }
  .avatar { width: 34px; height: 34px; font-size: 13px; }
  .btn-out { padding: 6px 9px; min-height: 34px; }
  .btn-back { width: 38px; height: 38px; }
  .btn-back .ic { width: 20px; height: 20px; }
  .container { padding: 20px 12px 90px; }
  .admin-layout { padding: 18px 12px 90px; gap: 14px; }
  .panel { padding: 18px 14px; }
  .modal { padding: 24px 18px; }
  .support-win { width: calc(100vw - 24px); left: 12px; bottom: 86px; height: min(440px, calc(100vh - 120px)); }
  .support-fab { bottom: 16px; left: 12px; width: 52px; height: 52px; font-size: 21px; }
  .toast { right: 12px; left: 12px; bottom: 84px; max-width: none; }
  .shelf-head h1 { font-size: 22px; }
  .shelf-title h2 { font-size: 16.5px; }
  .opt-card { padding: 16px 16px; gap: 12px; }
  .opt-icon { width: 46px; height: 46px; font-size: 21px; }
  .opt-count { font-size: 12px; padding: 5px 11px; }
  .mat-hero { padding: 24px 18px; }
  .toolbar input[type=text] { min-width: 0; width: 100%; }
  .adm-mat-grid { grid-template-columns: 1fr; }
  .adm-mat-card { flex-wrap: wrap; }
  .adm-mat-card .amc-acts { display: flex; width: 100%; }
  .adm-mat-card .amc-acts .mini { flex: 1; }
  .viewer-bar { gap: 8px; }
  .vb-tools { width: 100%; justify-content: space-between; }
  .zoom-val { min-width: 40px; }
  .viewer-frame { min-height: 56vh; }
  .viewer-frame iframe { height: 66vh; }
  .viewer-frame.html-frame { height: 66vh; }
  .pdfjs-frame { max-height: 66vh; }
  .pdfjs-scroll { max-height: 62vh; }
  .viewer-frame.img-frame img { max-height: 62vh; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-form { grid-template-columns: 1fr; }
}

/* موبايل صغير جدًا */
@media (max-width: 480px) {
  .support-head .support-clear-btn span { display: none; }
  .support-head .support-clear-btn { width: 32px; min-width: 32px; padding: 0; justify-content: center; flex: 0 0 32px; }
}
@media (max-width: 380px) {
  .books-row { grid-template-columns: 1fr; }
  .book-cover { height: 210px; }
  .book-name { font-size: 15px; }
  .bm { font-size: 12.5px; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* شاشات ضيقة جدًا: اللوجو بس — ضمان مفيش لفّ ولا خروج بره الشاشة */
@media (max-width: 340px) {
  .brand span { display: none; }
}

/* لمس: إلغاء hover العالق على الشاشات اللمسية */
@media (hover: none) {
  .book-cover:hover { transform: none; box-shadow: var(--sh-lg), 7px 0 0 calc(-1px) color-mix(in srgb, var(--bc) 80%, white); }
  .bm:hover, .btn:hover, .opt-card:hover, .file-row:hover { transform: none; box-shadow: var(--sh-xs); }
  .bm:active, .btn:active, .opt-card:active, .file-row:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 var(--ink); }
}

/* ===================== رسالة الترحيب + القواعد ===================== */
.welcome-modal { max-width: 560px; width: calc(100vw - 32px); padding: 0; overflow: auto; }
.wm-hero {
  padding: 26px 22px 18px; text-align: center;
  background: var(--yellow-l); border-bottom: var(--bw) solid var(--ink);
}
.wm-emoji {
  width: 58px; height: 58px; margin: 0 auto 10px; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--yellow); border: var(--bw) solid var(--ink);
  border-radius: 16px; box-shadow: var(--sh-sm); transform: rotate(-5deg);
}
.wm-hero h3 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.wm-hero .sub { color: var(--muted); font-size: 13.5px; }
.wm-rules {
  list-style: none; counter-reset: wm; padding: 16px 18px; margin: 0;
  display: grid; gap: 10px; text-align: right;
}
.wm-rules li {
  counter-increment: wm; position: relative;
  padding: 12px 46px 12px 12px;
  background: var(--surface); border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm); box-shadow: var(--sh-xs);
  font-size: 13.5px; font-weight: 600; line-height: 1.7;
}
.wm-rules li::before {
  content: counter(wm);
  position: absolute; right: 10px; top: 12px;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  background: var(--violet-l); color: var(--ink); font-weight: 800; font-size: 12.5px;
  border: 2px solid var(--ink); border-radius: 8px;
}
.wm-agree {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  background: var(--ok-soft); border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm); font-weight: 800; font-size: 13.5px;
  user-select: none;
}
.wm-agree input { width: 20px; height: 20px; accent-color: var(--ok); flex-shrink: 0; cursor: pointer; }
/* الجزء السفلي (العلم + تم) ثابت تحت — يفضل ظاهر حتى لو القواعد طويلة على الموبايل */
.wm-foot {
  position: sticky; bottom: 0;
  background: var(--surface);
  border-top: var(--bw) solid var(--ink);
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 10px;
}
.wm-foot .modal-foot { margin-top: 0; }
.welcome-modal .modal-foot { padding: 0; display: flex; justify-content: center; }
.welcome-modal .modal-foot .save:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--sh-xs); }
@media (max-width: 560px) {
  .welcome-modal { width: calc(100vw - 24px); max-height: 92vh; }
  .wm-rules { padding: 12px 14px; gap: 8px; }
  .wm-rules li { font-size: 12.5px; padding: 10px 42px 10px 10px; line-height: 1.6; }
  .wm-hero { padding: 18px 16px 12px; }
  .wm-hero h3 { font-size: 19px; }
  .wm-emoji { width: 48px; height: 48px; font-size: 23px; margin-bottom: 8px; }
}

/* ===================== 16. محاذاة الأيقونات داخل الأزرار والشارات ===================== */
.mini, .badge, .dl-chip, .chip, .star-admin,
.adm-mat-card .amc-counts span, .support-foot button,
.support-head > div:first-child, .wa-del, .stat-box .k, .adm-major-head span,
.wt-row2 .chip, .badge.admin-b, .ask-support, .btn-out, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.mini .ic, .badge .ic, .dl-chip .ic, .chip .ic,
.adm-mat-card .amc-counts span .ic, .star-admin .ic { font-size: .95em; }
.wa-del .ic, .stat-box .k .ic { font-size: 1.15em; }
.support-head > div:first-child .ic { font-size: 22px; }
.viewer-bar .t .ic, .panel h2 .ic, .chat-panel-head h2 .ic,
.tab-desc .ic, .sub .ic, .empty p .ic { font-size: 1.15em; vertical-align: -.18em; }
.empty .big .ic { font-size: 1em; }


/* ===================== 17. تحديثات التصميم النهائية (Neo-Brutalist Polish & QA Fixes) ===================== */

/* 17.1 بطاقات الملفات المرفوعة (الملازم، الاختبارات، الداتا) + زر الحذف (✕) للمستوى الأول */
.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--yellow-l) 52%, var(--surface));
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.file-row:hover {
  background: color-mix(in srgb, var(--yellow-l) 78%, var(--surface));
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}
.file-row .fi {
  flex: 1 1 auto;
  min-width: 0;
}
.file-row .fi b {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.file-row .fi span {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}
/* حاوية الإجراءات في أقصى اليسار (بما أن الموقع RTL فـ margin-right: auto يدفعها لأقصى اليسار) */
.file-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.dl-chip.yt {
  background: #ffe4e6;
  color: #be123c;
  border-color: var(--ink);
}
.dl-chip.gdrive {
  background: #e0f2fe;
  color: #0369a1;
  border-color: var(--ink);
}
.file-ic.ic-yt {
  background: #ef4444;
  color: #fff;
}

/* 17.1أ شارة الإشعارات الحية لدعم الطلاب + زر حذف المادة للمستوى الأول */
.admin-nav button { position: relative; }
.nav-chat-badge {
  margin-right: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--ink);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.adm-mat-card .mini.act-del-course,
.file-actions .mini.act-del {
  background: #fee2e2;
  color: var(--danger-ink);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.adm-mat-card .mini.act-del-course:hover,
.file-actions .mini.act-del:hover {
  background: var(--danger);
  color: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.upload-modal-wrap {
  position: relative;
}
.file-dropzone .fdz-icon,
.file-dropzone .fdz-body,
.file-dropzone .fdz-cta {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

/* 17.2 شريط البحث السريع داخل ملفات المادة (Proactive UX) */
.mat-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.mat-search-inp {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 6px 8px !important;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  outline: none;
}
.mat-search-count {
  padding: 4px 10px;
  background: var(--yellow-l);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* 17.3 نافذة الرفع (#uploadModal) وتبويبات التبديل (ملف من الجهاز / رابط يوتيوب أو Google Drive) */
.up-type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
  padding: 6px;
  background: var(--bg-2);
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.up-tab {
  min-height: 44px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: all .12s ease;
}
.up-tab:hover {
  background: var(--yellow-l);
}
.up-tab.on {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.link-detect-badge {
  margin-top: 8px;
  padding: 9px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  background: var(--yellow-l);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.link-detect-badge.yt {
  background: #ffe4e6;
  color: #9f1239;
}
.link-detect-badge.gdrive {
  background: #e0f2fe;
  color: #075985;
}
.fdz-body {
  display: grid;
  gap: 4px;
  text-align: center;
}
.fdz-cta {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--yellow);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink);
}
.yt-frame, .gdrive-frame {
  width: 100%;
  margin: 0 auto;
  border: var(--bw-thick) solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: auto;
  height: 82vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #000;
}
.gdrive-frame {
  background: var(--white);
}
.yt-frame iframe, .gdrive-frame iframe {
  flex: none;
  width: calc(100% / var(--vz, 1)) !important;
  height: calc(100% / var(--vz, 1)) !important;
  transform: scale(var(--vz, 1));
  transform-origin: top center;
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
  border: none;
  display: block;
}
.yt-frame:fullscreen, .gdrive-frame:fullscreen {
  height: 100vh;
}
.files-list.quiz-grid > .file-row {
  grid-column: 1 / -1;
  width: 100%;
}
.file-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  flex-shrink: 0;
}
.file-ic.ic-yt {
  background: #ef4444;
  color: var(--white);
}
.dl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dl-chip.yt {
  background: #ffe4e6;
  color: #9f1239;
}
.dl-chip.gdrive {
  background: #e0f2fe;
  color: #075985;
}

/* 17.4 لوحة المدير: ترويسة المواد، الموافقات، الإحصاءات، الصيانة، والرتب */
.adm-mat-head-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.notif-sec-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.notif-dismiss-btn {
  margin-right: auto;
  min-width: 38px;
  min-height: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s ease, transform .1s ease;
}
.notif-dismiss-btn:hover {
  background: #fee2e2;
  color: var(--danger-ink);
  transform: translate(-1px, -1px);
}
.notif-item.dismissing {
  opacity: 0;
  transform: translateX(-16px);
  transition: all .18s ease;
}
.adm-role-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.adm-role-cell .role-l1 {
  background: var(--yellow-l);
}
.adm-role-cell .role-l2 {
  background: var(--violet-l);
}
.adm-role-cell .role-revoke {
  background: #fee2e2;
  color: var(--danger-ink);
}
.copyable-id {
  cursor: pointer;
  transition: transform .1s ease, background .12s ease;
}
.copyable-id:hover {
  background: var(--yellow);
  transform: translateY(-1px);
}
.stat-box.highlight-green {
  background: color-mix(in srgb, var(--ok-soft) 65%, var(--surface));
}
.stat-box.highlight-amber {
  background: color-mix(in srgb, var(--yellow-l) 65%, var(--surface));
}
.stat-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

/* مربعات المساحة — heatmap ديناميكي حسب نسبة الاستهلاك من الحد الحقيقي (Supabase Free Tier)
   0–40% ok (أخضر هادئ) · 41–75% warn (برتقالي) · 76–100% danger (أحمر) — الحدود الحبرية زي ما هي */
.stat-box.stat-storage { transition: background-color .5s ease; }
.stat-box.stat-storage.lvl-ok { background: color-mix(in srgb, var(--ok-soft) 65%, var(--surface)); }
.stat-box.stat-storage.lvl-warn { background: color-mix(in srgb, var(--warn-soft) 65%, var(--surface)); }
.stat-box.stat-storage.lvl-danger { background: color-mix(in srgb, var(--danger-soft) 65%, var(--surface)); }
.storage-usage-bar {
  height: 9px;
  margin-top: 10px;
  border: 2px solid var(--ink);
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--surface) 72%, var(--muted));
  overflow: hidden;
  transition: background-color .4s ease;
}
.storage-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width .6s ease, background-color .4s ease;
}
.storage-pct {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  font-feature-settings: 'tnum'; flex-shrink: 0;
  transition: color .4s ease;
}
.storage-usage-bar.lvl-ok .storage-fill { background: var(--ok); }
.storage-usage-bar.lvl-warn .storage-fill { background: var(--warn); }
.storage-usage-bar.lvl-danger .storage-fill { background: var(--danger); }
.storage-pct.lvl-ok { color: var(--ok-ink); }
.storage-pct.lvl-warn { color: var(--warn-ink); }
.storage-pct.lvl-danger { color: var(--danger-ink); }
.maint-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--violet-l) 35%, var(--surface));
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
}
.maint-info {
  flex: 1 1 320px;
}
.maint-info h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.maint-info p {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.maint-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-head-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wa-empty-chat {
  margin: auto;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
}

/* 17.5 استجابة كاملة للشاشات الصغيرة والهواتف (Android & iOS Safari) بدون أي تداخل */
@media (max-width: 640px) {
  .file-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }
  .file-row .fi {
    flex: 1 1 calc(100% - 62px);
  }
  .file-actions {
    width: 100%;
    margin-right: 0;
    padding-top: 8px;
    border-top: 1.5px dashed color-mix(in srgb, var(--ink) 25%, transparent);
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .up-type-switch {
    grid-template-columns: 1fr;
  }
  .adm-mat-head-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ===================== 18. اللمسات النهائية الشاملة (Ultimate Polish: Chat Actions, Student Badge, Lightbox, Admin File Rows) ===================== */

/* 18.1 نقل أزرار التحكم الثلاثة لأعلى يسار نافذة الشات النشطة للأدمن */
.wa-open-head {
  display: flex;
  align-items: center;
  justify-content: flex-end; /* في واجهة RTL، flex-end يدفع العناصر لأقصى اليسار */
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 2px solid var(--ink);
}
.wa-open-head .wa-head-actions {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wa-open-head .wt-act {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 15px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.wa-open-head .wt-act:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.wa-open-head .wt-act:active {
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 var(--ink);
}
.wt-act.act-global-wipe {
  background: #fee2e2;
  color: var(--danger-ink);
}

/* 18.2 شارة الإشعارات الحمراء الحية للطالب على أيقونة الدعم العائمة (#supportFab) */
.support-fab {
  overflow: visible;
}
.support-fab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 5;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--white);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: pop .22s cubic-bezier(.2,.8,.2,1);
}

/* 18.3 عارض صور الشات بملء الشاشة + زر التنزيل المباشر (Chat Image Lightbox) */
.wa-img-btn {
  display: inline-block;
  padding: 0;
  margin-top: 6px;
  background: transparent;
  border: none;
  cursor: zoom-in;
  max-width: 100%;
}
.wa-img-btn .wa-img {
  margin-top: 0;
}
.chat-img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 20, 20, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade .18s ease;
}
.cil-box {
  width: min(920px, 100%);
  max-height: 92vh;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 8px 8px 0 var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cil-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--yellow);
  border-bottom: 2px solid var(--ink);
}
.cil-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  min-width: 0;
}
.cil-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48vw;
}
.cil-actions {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cil-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.cil-dl-btn {
  background: var(--green);
  color: var(--ink);
}
.cil-dl-btn:hover {
  background: var(--yellow-l);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.cil-close-btn {
  padding: 0;
  width: 44px;
  background: var(--white);
  color: var(--ink);
}
.cil-close-btn:hover {
  background: #fee2e2;
  color: var(--danger-ink);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.cil-body {
  flex: 1;
  overflow: auto;
  padding: 18px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}
.cil-img {
  max-width: 100%;
  max-height: calc(88vh - 96px);
  object-fit: contain;
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-sm);
  background: var(--white);
}

/* 18.4 إعادة تصميم قائمة ملفات الأدمن (Mobile-First & 44x44px Touch Targets) */
.files-list {
  display: grid;
  gap: 12px;
}
.adm-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--yellow-l) 55%, var(--surface));
  border: 2px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: 3px 3px 0 var(--ink);
  flex-wrap: wrap;
}
.adm-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 240px;
  min-width: 0;
}
.adm-file-info .file-ic {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  background: var(--yellow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.adm-file-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.adm-fbtn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 13px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.adm-fbtn:hover {
  background: var(--yellow-l);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.adm-fbtn:active {
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 var(--ink);
}
.adm-fbtn.primary {
  background: var(--yellow);
  color: var(--ink);
}
.adm-fbtn.act-dl.on {
  background: var(--green);
  color: var(--ink);
}
.adm-fbtn.act-del {
  background: #fee2e2;
  color: var(--danger-ink);
}
.adm-fbtn.act-del:hover {
  background: var(--danger);
  color: var(--white);
}

@media (max-width: 640px) {
  .adm-file-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }
  .adm-file-info {
    flex: 1 1 auto;
    width: 100%;
  }
  .adm-file-actions {
    width: 100%;
    margin-right: 0;
    padding-top: 10px;
    border-top: 1.5px dashed color-mix(in srgb, var(--ink) 25%, transparent);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .adm-fbtn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
  .wa-open-head .wt-act {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
}

/* ==========================================================================
   19. QA — إصلاحات الموبايل النهائية (Touch Targets ≥ 44×44)
   --------------------------------------------------------------------------
   ناتج اختبار فعلي على عروض 360 / 375 / 412 / 430px لكل صفحات المنصة
   (دخول · رفوف · مادة · عارض ملفات · لوحة المدير بتاباتها الستة · شات الأدمن ·
   الدعم الفني العائم · مودالات الرفع/الإضافة/التأكيد).
   الهدف: مفيش زر أو أيقونة أصغر من 44×44 على اللمس، ولا خروج أفقي بره الشاشة،
   مع الحفاظ الكامل على الحدود السميكة والظلال الصلبة (Neo-Brutalism).
   ========================================================================== */
@media (max-width: 640px) {

  /* ---------- 19.1 الشريط العلوي المتجاوب تلقائيًا مع عرض الهاتف والتطبيق ---------- */
  .topbar { width: 100%; max-width: 100vw; overflow-x: clip; padding-top: env(safe-area-inset-top, 0px); }
  .topbar-in { padding: 6px clamp(6px, 2vw, 12px); gap: clamp(3px, 1vw, 6px); flex-wrap: nowrap; box-sizing: border-box; }
  .topbar .brand-logo-img { width: clamp(48px, 13.5vw, 60px); height: clamp(48px, 13.5vw, 60px); }
  .topbar .btn-back { width: clamp(34px, 9vw, 39px); height: clamp(34px, 9vw, 39px); flex-shrink: 0; }
  .topbar .btn-back .ic { width: clamp(17px, 4.6vw, 20px); height: clamp(17px, 4.6vw, 20px); }
  .topbar .btn-out { width: clamp(34px, 9vw, 39px); height: clamp(34px, 9vw, 39px); min-width: clamp(34px, 9vw, 39px); min-height: clamp(34px, 9vw, 39px); padding: 0; flex-shrink: 0; }

  /* ---------- 19.2 شاشات الدخول / الأدمن ---------- */
  .pw-eye { width: 44px; height: 44px; min-width: 44px; min-height: 44px; left: 6px; }
  .pw-wrap input { padding-left: 58px; }
  .seg button { min-height: 44px; }
  .admin-link a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 18px;
  }
  .btn-ghost { min-height: 44px; }

  /* ---------- 19.3 رفوف المواد: أزرار الاختبارات/الملازم/الداتا ---------- */
  .bm, .bm-main { min-height: 44px; }

  /* ---------- 19.4 كروت المواد في لوحة المدير + جدول الطلاب ---------- */
  .mini { min-height: 44px; }
  .adm-mat-card .mini,
  td.row-acts .mini,
  .mat-admin-row .mini { min-height: 44px; min-width: 44px; padding: 10px 12px; }
  /* زر حذف المادة (السهم/الأيقونة) كان 37×29 — بقى 44×44 */
  .adm-mat-card .mini.act-del-course,
  td.row-acts .act-del2 { min-width: 44px; min-height: 44px; padding: 0 10px; }
  .filter-seg button { min-height: 44px; }
  .ask-support { min-height: 44px; }

  /* ---------- 19.5 أزرار عامة (تصدير CSV، أزرار الملفات، إلخ) ---------- */
  .btn { min-height: 44px; }
  .btn.sm { min-height: 44px; padding: 9px 14px; }
  .file-actions .mini { min-height: 44px; min-width: 44px; }
  .dl-chip { min-height: 32px; }

  /* ---------- 19.6 شريط بحث ملفات المادة (كان 38px) ---------- */
  .mat-search-bar { padding: 4px 8px; }
  .mat-search-inp { min-height: 44px; padding: 10px 8px !important; }

  /* ---------- 19.7 عارض الملفات: أزرار التكبير/التصغير كانت 37×25 ---------- */
  .zoom-box .btn.sq { min-width: 44px; min-height: 44px; padding: 0 10px; }
  .viewer-nav .btn { min-height: 44px; }

  /* ---------- 19.8 مودال الرفع: الملف مقابل الرابط + سحابة الرفع ---------- */
  .up-tab { min-height: 48px; }
  .fdz-cta { min-height: 44px; padding: 10px 18px; }
  .check-line { min-height: 44px; }
  .check-line input { width: 20px; height: 20px; }
  .modal .seg button { min-height: 44px; }  /* مربعات اختيار لون المادة */

  /* ---------- 19.9 شات الأدمن (دعم الطلاب) ---------- */
  .wa-att { width: 44px; height: 44px; min-width: 44px; }
  .wa-inputbar { gap: 8px; padding: 10px; }
  .wa-inputbar input[type="text"] { min-width: 0; }
  .wa-inputbar button#admChatSend { width: 44px; height: 44px; min-width: 44px; }
  .wa-del { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .wt-act,
  .wa-open-head .wt-act { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .wt-acts, .wa-head-actions { gap: 8px; }
  .wa-hidden-item { min-height: 44px; }

  /* ---------- 19.10 الدعم الفني العائم للطلاب ---------- */
  .support-head .support-clear-btn {
    width: 44px; min-width: 44px; height: 44px; flex: 0 0 44px; padding: 0;
    justify-content: center;
  }
  .support-head .support-clear-btn span { display: none; }
  .support-head .support-close-btn,
  .support-head button#supportClose {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  }
  .sg-majors button { min-height: 44px; }
  .sg-go { min-height: 44px; }
  .sg-chat-row #chatAttBtn { width: 44px; height: 44px; min-width: 44px; }
  .support-idgate input { min-height: 44px; }
  .support-foot input { min-height: 44px; }

  /* ---------- 19.11 الإشعارات ---------- */
  .notif-clear-all { height: 44px; min-height: 44px; padding: 0 14px; }
  .notif-dismiss-btn {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0;
  }

  /* ---------- 19.12 ضمان عدم الخروج الأفقي من أي مودال أو قائمة ---------- */
  .modal { max-width: calc(100vw - 24px); }
  .files-list, .adm-file-row, .adm-file-info, .adm-file-actions { min-width: 0; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .wa-wrap, .wa-open, .wa-list { min-width: 0; }

  /* ---------- 19.13 جدول الطلاب: من جدول ٧ أعمدة لتمرير أفقي → كروت مقروءة ---------- */
  /* كان الأدمن لازم يسحب الجدول أفقيًا عشان يوصل لأزرار الترقية/الحذف — دلوقتي كل طالب كارت */
  #adm-students table.students { display: block; width: 100%; }
  #adm-students table.students thead { display: none; }
  #adm-students table.students tbody {
    display: grid; gap: 10px; padding: 8px;
  }
  #adm-students table.students tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "name name name"
      "id major reg"
      "role role role"
      "last last last"
      "acts acts acts";
    gap: 8px; padding: 12px;
    background: var(--surface);
    border: 2px solid var(--ink); border-radius: var(--r-md);
    box-shadow: 2px 2px 0 var(--ink);
  }
  #adm-students table.students td {
    display: block; padding: 0 !important; border: 0 !important;
    background: transparent !important; white-space: normal !important;
    font-size: 12.5px; vertical-align: middle;
  }
  #adm-students table.students td:nth-child(1) { grid-area: name; font-size: 14.5px; }
  #adm-students table.students td:nth-child(2) { grid-area: id; justify-self: start; }
  #adm-students table.students td:nth-child(3) { grid-area: major; align-self: center; font-weight: 800; }
  #adm-students table.students td:nth-child(4) { grid-area: reg; justify-self: end; }
  #adm-students table.students td:nth-child(5) { grid-area: role; }
  #adm-students table.students td:nth-child(6) {
    grid-area: last; padding-top: 6px !important;
    border-top: 1.5px dashed var(--line-soft) !important; color: var(--muted);
  }
  #adm-students table.students td:nth-child(6)::before { content: 'آخر دخول: '; font-weight: 800; }
  #adm-students table.students td.row-acts {
    grid-area: acts; display: flex; gap: 8px; flex-wrap: wrap;
    padding-top: 6px !important; border-top: 1.5px dashed var(--line-soft) !important;
  }
  #adm-students table.students td.row-acts .mini { flex: 1 1 auto; }
  #adm-students .adm-role-cell { gap: 8px; }
  .adm-role-cell .mini { min-height: 44px; padding: 8px 12px; }
}

/* شاشات لمس (تابلت/موبايل) — نفس الحد الأدنى حتى لو العرض أكبر من 640 */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.sm { min-height: 44px; }
  .bm { min-height: 44px; }
  .wa-att, .wa-inputbar button#admChatSend { width: 44px; height: 44px; }
  .zoom-box .btn.sq { min-width: 44px; min-height: 44px; }
}

/* =============================================================================
   20. ترقيات الإنتاج: PWA + أدوات التصدير
   (زر تثبيت التطبيق + زر تصدير بيانات الطلاب — بنفس هوية Neo-Brutalism)
   ========================================================================== */

/* ---------- 20.1 زر «تثبيت التطبيق» داخل الإعدادات وبجانب تسجيل الخروج ---------- */
.logout-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.logout-actions-row > .btn,
.logout-actions-row > .pwa-install {
  flex: 1 1 180px;
}
.pwa-install {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-xs);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .13s ease, box-shadow .13s ease, background .13s ease;
}
.pwa-install .ic { width: 20px; height: 20px; flex: 0 0 auto; }
.pwa-install:hover { background: var(--yellow-l); transform: translate(-1px, -1px); box-shadow: var(--sh-sm); }
.pwa-install:active { transform: translate(1px, 1px); box-shadow: none; }
.pwa-install:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.pwa-install.hidden { display: none !important; }

/* ---------- 20.2 زر تصدير بيانات الطلاب (CSV) ---------- */
.btn.csv-export {
  background: var(--yellow-l);
  color: var(--ink);
}
.btn.csv-export:hover { background: var(--yellow); }
.btn.csv-export .ic { color: var(--ink); }

@media (max-width: 640px) {
  .logout-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .logout-actions-row > .btn,
  .logout-actions-row > .pwa-install {
    flex: 1 1 auto;
    width: 100%;
  }
  .pwa-install {
    min-height: 44px;
    padding: 9px 14px;
    font-size: 13.5px;
    box-shadow: 2px 2px 0 var(--ink);
  }
  .pwa-install .ic { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-install { transition: none; }
  .pwa-install:hover,
  .pwa-install:active { transform: none; }
}

/* ==========================================================================
   20. ضبط الشريط العلوي المتجاوب + أنميشن زر الدخول + زر فتح PDF في صفحة ثانية
   ========================================================================== */
@media (max-width: 560px) {
  .auth-logo-img { width: clamp(92px, 24vw, 108px); height: clamp(92px, 24vw, 108px); margin-bottom: 22px; }
  .topbar { width: 100%; max-width: 100vw; overflow-x: clip; padding-top: env(safe-area-inset-top, 0px); }
  .topbar-in { padding: 6px clamp(6px, 2vw, 12px); gap: clamp(3px, 1vw, 6px); flex-wrap: nowrap; box-sizing: border-box; }
  .topbar .brand > span { display: none; }
  .topbar .brand { gap: 0; flex-shrink: 0; min-width: 0; }
  .topbar .brand-logo-img { width: clamp(48px, 13.5vw, 60px); height: clamp(48px, 13.5vw, 60px); }
  .topbar .spacer { flex: 1 1 0px; min-width: 0; }
  .topbar .chip {
    padding: 4px clamp(7px, 2vw, 11px);
    font-size: clamp(10px, 2.7vw, 11.5px);
    line-height: 1.35;
    flex-shrink: 0;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
  }
  .topbar .avatar {
    width: clamp(30px, 8.2vw, 35px);
    height: clamp(30px, 8.2vw, 35px);
    font-size: clamp(11.5px, 3.1vw, 13.5px);
    flex-shrink: 0;
  }
  .topbar .btn-back {
    width: clamp(34px, 9vw, 39px);
    height: clamp(34px, 9vw, 39px);
    flex-shrink: 0;
  }
  .topbar .btn-back .ic {
    width: clamp(17px, 4.6vw, 20px);
    height: clamp(17px, 4.6vw, 20px);
  }
  .topbar .btn-out {
    width: clamp(34px, 9vw, 39px);
    height: clamp(34px, 9vw, 39px);
    min-width: clamp(34px, 9vw, 39px);
    min-height: clamp(34px, 9vw, 39px);
    padding: 0;
    flex-shrink: 0;
  }
}

/* أنميشن زر تسجيل الدخول (طالب / مدير) — تحميل ثم تحوّل لعلامة صح خضراء */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
@keyframes check-pop {
  0% { transform: scale(0.3) rotate(-25deg); opacity: 0; }
  65% { transform: scale(1.18) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes btn-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(6px); }
  40% { transform: translateX(-6px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-4px); }
}
.btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease, background-color .2s ease, color .2s ease;
}
.btn-main.is-loading {
  background: var(--yellow-l) !important;
  color: var(--ink) !important;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink) !important;
  pointer-events: none;
}
.btn-main.is-success {
  background: var(--green) !important;
  color: var(--ink) !important;
  transform: translate(-2px, -2px) scale(1.015);
  box-shadow: 5px 5px 0 var(--ink) !important;
  pointer-events: none;
}
.btn-main.is-error {
  animation: btn-shake .38s cubic-bezier(.36,.07,.19,.97);
}
.btn-login-spin {
  width: 19px;
  height: 19px;
  border: 2.6px solid var(--ink);
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: btn-spin .65s linear infinite;
  flex-shrink: 0;
}
.btn-check-badge {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--ink);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: check-pop .38s cubic-bezier(.2, 1.8, .4, 1) forwards;
  flex-shrink: 0;
}
.btn-check-badge svg {
  width: 15px;
  height: 15px;
  stroke: var(--ink);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* زر فتح PDF أو مستند في صفحة ثانية / Google Drive */
.btn.act-ext,
#viewerExtBtn {
  background: var(--blue-l);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn.act-ext:hover,
#viewerExtBtn:hover {
  background: var(--yellow);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.adm-fbtn.act-ext {
  background: var(--blue-l);
  color: var(--ink);
  text-decoration: none;
}
.adm-fbtn.act-ext:hover {
  background: var(--yellow);
}

/* ==================== نظام الإشعارات الذكي (بند 83) ==================== */
/* الجرس — على يسار اللوجو مباشرة في الهيدر */
.notif-anchor { display: inline-flex; align-items: center; position: relative; flex-shrink: 0; }
.notif-bell {
  position: relative; width: clamp(38px, 9vw, 44px); height: clamp(38px, 9vw, 44px);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--yellow); color: var(--ink);
  border: 2.5px solid var(--line); border-radius: 13px;
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  font-size: clamp(15px, 3.4vw, 17px); line-height: 1; padding: 0;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.notif-bell:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); background: var(--yellow-l); }
.notif-bell:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.notif-bell:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.notif-bell.shaking { animation: ntf-shake .65s cubic-bezier(.36,.07,.19,.97) both; transform-origin: 50% 6px; }
@keyframes ntf-shake {
  10%, 90% { transform: rotate(-8deg); }
  20%, 80% { transform: rotate(9deg) translateY(-1px); }
  30%, 50%, 70% { transform: rotate(-12deg) translateY(-2px); }
  40%, 60% { transform: rotate(12deg); }
}
.notif-dot {
  position: absolute; top: -6px; inset-inline-start: -6px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--ink);
  animation: ntf-pulse 2.2s ease-in-out infinite;
}
@keyframes ntf-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22); } }

/* فقاعة المعاينة (Teaser) — تنبثق قرب الجرس */
.notif-teaser {
  position: fixed; z-index: var(--z-notif); max-width: min(360px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink);
  border: 2.5px solid var(--line); border-radius: 14px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 10px 14px; font-size: 13.5px; font-weight: 700; line-height: 1.5;
  overflow-wrap: anywhere;
  cursor: pointer; opacity: 0; transform: translateY(-8px) scale(.96);
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.9,.3,1.3);
  pointer-events: none;
}
.notif-teaser.show { opacity: 1; transform: none; pointer-events: auto; }
/* بند 90: تم حذف السهم/الذيل المثلثي (::after) نهائيًا — الحد العلوي للفقاعة مستقيم ونظيف */

/* القائمة المنسدلة (Panel) */
.notif-panel {
  position: fixed; z-index: var(--z-notif);
  width: min(400px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(66vh, 540px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 3px solid var(--line); border-radius: 18px;
  box-shadow: 8px 8px 0 rgba(20, 20, 20, .92);
  opacity: 0; transform: translateY(-10px) scale(.97);
  transition: opacity .2s ease, transform .2s cubic-bezier(.2,.9,.3,1.15);
  pointer-events: none; overflow: hidden;
}
.notif-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 13px; border-bottom: 2.5px solid var(--line);
  background: var(--yellow-l); flex-shrink: 0;
}
.nph-title { font-size: 15.5px; font-weight: 900; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.nph-title i { color: var(--warn-ink); flex-shrink: 0; }
.notif-markall {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 10px;
  padding: 5px 10px; font-size: 12px; font-weight: 800; color: var(--ink);
  cursor: pointer; box-shadow: 2px 2px 0 var(--ink); font-family: inherit;
  flex-shrink: 0; white-space: nowrap; max-width: 100%;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.notif-markall:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); background: var(--ok-soft); }
.notif-markall:active { transform: translate(1px, 1px); box-shadow: none; }
.notif-list { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* عنصر إشعار في القائمة */
.ntf-row {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px; border-bottom: 2px dashed var(--line-soft);
  cursor: pointer; transition: background .15s ease;
}
.ntf-row:last-child { border-bottom: none; }
.ntf-row:hover { background: var(--yellow-l); }
.ntf-row:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.ntf-row.unread { background: color-mix(in srgb, var(--blue-l) 55%, var(--surface)); }
.ntf-row.unread:hover { background: var(--blue-l); }
.ntf-row.important {
  background: linear-gradient(0deg, color-mix(in srgb, var(--yellow) 26%, transparent), color-mix(in srgb, var(--yellow) 26%, transparent)), var(--surface);
  box-shadow: inset 5px 0 0 var(--yellow), inset -5px 0 0 var(--yellow), inset 0 3px 0 var(--yellow), inset 0 -3px 0 var(--yellow);
}
.ntf-row.important:hover {
  background: linear-gradient(0deg, color-mix(in srgb, var(--yellow) 34%, transparent), color-mix(in srgb, var(--yellow) 34%, transparent)), var(--surface);
}
.notif-ic {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 2px solid var(--line); border-radius: 12px; font-size: 16px; color: var(--ink);
}
.notif-body { flex: 1; min-width: 0; }
.notif-top { display: flex; align-items: flex-start; gap: 8px; flex-wrap: nowrap; }
.notif-title {
  font-size: 14px; font-weight: 900; line-height: 1.45;
  min-width: 0; flex: 1 1 auto;
  overflow-wrap: anywhere; word-break: break-word; white-space: normal;
}
.notif-imp-star { color: var(--warn-ink); font-size: 12px; flex-shrink: 0; margin-top: 2px; }
.notif-unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--info); border: 1.5px solid var(--ink); flex-shrink: 0; margin-inline-start: auto; margin-top: 5px; }
.notif-msg {
  font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-meta { display: flex; align-items: center; gap: 6px 8px; margin-top: 6px; flex-wrap: wrap; min-width: 0; }
.notif-kind {
  font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 7px;
  border: 1.5px solid var(--line); background: var(--surface);
  white-space: nowrap; flex-shrink: 0;
}
.notif-mat { font-size: 11.5px; font-weight: 700; color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
.notif-time { font-size: 11px; color: var(--muted-2); margin-inline-start: auto; direction: ltr; white-space: nowrap; }
.notif-empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.notif-empty i { font-size: 34px; color: var(--muted-2); margin-bottom: 10px; display: inline-block; }
.notif-empty h3 { font-size: 15.5px; font-weight: 900; color: var(--ink); margin: 0 0 5px; }
.notif-empty p { font-size: 12.5px; margin: 0; }

/* تبويب «الإشعارات» في لوحة المدير (درجة أولى) */
.nt-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.nt-form input[type="text"], .nt-form textarea, .nt-form select {
  width: 100%; box-sizing: border-box;
  border: 2.5px solid var(--line); border-radius: 12px;
  padding: 11px 13px; font-family: inherit; font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--ink); resize: vertical;
}
.nt-form input:focus, .nt-form textarea:focus, .nt-form select:focus { outline: 3px solid var(--brand-soft); }
.nt-form-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nt-field { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 800; }
.nt-field select { width: auto; min-width: 170px; padding: 9px 11px; }
.nt-imp-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-weight: 800; font-size: 13.5px; position: relative; }
.nt-imp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.nt-imp-box {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 2.5px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted-2); font-size: 13px;
  box-shadow: 2px 2px 0 var(--ink); transition: all .15s ease;
}
.nt-imp-toggle input:checked + .nt-imp-box { background: var(--yellow); color: var(--warn-ink); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.nt-imp-toggle input:focus-visible + .nt-imp-box { outline: 3px solid var(--brand); outline-offset: 2px; }
.nt-imp-text small { font-weight: 700; color: var(--muted); }
.nt-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.nt-star { color: var(--warn-ink); font-size: 12px; }
/* طبقة ذهبية للإشعار المهم في سجل الأدمن — نفس روح الطبقة عند الطالب */
.file-row.notif-item.important {
  background: linear-gradient(0deg, color-mix(in srgb, var(--yellow) 20%, transparent), color-mix(in srgb, var(--yellow) 20%, transparent)), var(--surface);
  box-shadow: inset 4px 0 0 var(--yellow);
}

/* ==================== تجاوب نظام الإشعارات (بند 88) ==================== */
/* خلفية معتمة خفيفة على الموبايل فقط — تسهّل القراءة والإغلاق باللمس خارج القائمة */
.notif-backdrop {
  position: fixed; inset: 0; z-index: calc(var(--z-notif) - 1);
  background: rgba(20, 20, 20, .28);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  display: none;
}
.notif-backdrop.open { opacity: 1; pointer-events: auto; }

/* موبايل */
@media (max-width: 560px) {
  .notif-bell { width: 37px; height: 37px; font-size: 14.5px; border-radius: 11px; border-width: 2px; box-shadow: 2px 2px 0 var(--ink); }
  .notif-dot { width: 13px; height: 13px; top: -5px; inset-inline-start: -5px; }
  .notif-panel { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: min(72vh, 520px); border-radius: 16px; }
  .notif-teaser { max-width: calc(100vw - 24px); font-size: 12.5px; }
  .notif-panel-head { padding: 9px 10px; gap: 6px; }
  .nph-title { font-size: 14px; gap: 6px; }
  .notif-markall { font-size: 11px; padding: 5px 7px; gap: 4px; border-radius: 9px; box-shadow: 1.5px 1.5px 0 var(--ink); }
  .notif-markall i { font-size: 10.5px; }
  .ntf-row { padding: 11px 10px; gap: 9px; }
  .notif-ic { width: 34px; height: 34px; font-size: 13.5px; border-radius: 10px; }
  .notif-title { font-size: 13.5px; }
  .notif-msg { font-size: 12px; -webkit-line-clamp: 3; }
  .notif-time { font-size: 10px; }
  .notif-mat { font-size: 11px; }
  .notif-backdrop { display: block; }
  body.notif-open { overflow: hidden; }
}

/* تابلت */
@media (min-width: 561px) and (max-width: 900px) {
  .notif-panel { width: min(380px, calc(100vw - 28px)); max-height: min(68vh, 520px); }
}

/* ==================== تبويب الإشعارات في لوحة المدير — تجاوب ==================== */
.notif-sec-head { flex-wrap: wrap; gap: 8px; }
/* منع أي تجاوز أفقي في سجل الإشعارات (العنوان/النص/الشارات تلتف داخل البطاقة) */
.notif-item { align-items: flex-start; min-width: 0; max-width: 100%; }
.files-list > .file-row { min-width: 0; }
.notif-item .file-ic.img { flex-shrink: 0; }
.notif-item .fi { min-width: 0; flex: 1 1 auto; }
.notif-item .fi b { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.notif-item .fi span { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.nt-del { flex-shrink: 0; }
.nt-meta { flex-wrap: wrap; min-width: 0; }
.nt-meta .chip, .nt-star { flex-shrink: 0; }
.nt-meta .chip { max-width: 100%; white-space: normal; }

@media (max-width: 760px) {
  .nt-form-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .nt-field { justify-content: space-between; gap: 10px; }
  .nt-field select { width: 100%; min-width: 0; }
  .nt-imp-toggle { justify-content: flex-start; }
  .nt-form > div > .btn { width: 100%; }
  .notif-item { gap: 10px; padding: 12px 12px; }
  .notif-item .file-ic.img { width: 34px; height: 34px; font-size: 14px; flex-shrink: 0; }
  .nt-del { width: 34px; height: 34px; }
}

@media (max-width: 420px) {
  .notif-markall { font-size: 10.5px; padding: 4px 6px; }
  .notif-markall i { display: none; }
  .ntf-row { padding: 10px 9px; gap: 8px; }
  .notif-ic { width: 31px; height: 31px; font-size: 12.5px; }
  .notif-title { font-size: 13px; }
}


