/* =====================================================================
   فايف بلس باي — ثيم فاتح بهوية الموقع الأساسي
   أحمر كرزي · رصاصي زيتوني · كريمي
   (كل أسماء الكلاسات كما هي — تغيير شكل فقط)
   ===================================================================== */
:root {
  --red: #D7263D;
  --red-dark: #B81E33;
  --red-deep: #8E1626;
  --red-soft: #FBE3E0;
  --red-tint: #FDF0EE;

  --gray: #A8A99A;
  --gray-dark: #7F8072;
  --gray-soft: #E7E6DA;

  --cream: #FFF9E3;       /* خلفية الصفحة */
  --cream-alt: #FFF1D6;   /* أقسام بالتبادل */
  --cream-soft: #FFE8C4;
  --card: #FFFCF2;        /* الكروت والبانلز */
  --paper: #FFFFFF;

  --ink: #3B342E;         /* الفوتر + النص */
  --text: #3B342E;
  --muted: #7A7064;
  --line: #EADFC6;
  --line-strong: #DCCDAA;

  --white: #ffffff;
  --black: #1F1B18;
  --ok: #1F8A4C;
  --ok-soft: #E3F4EA;
  --warn: #B86E00;
  --warn-soft: #FFF0D4;
  --danger: #C0283A;
  --danger-soft: #FCE4E6;

  --field: #FFFFFF;
  --header-bg: rgba(255, 253, 245, .94);
  --row-alt: rgba(255, 241, 214, .45);
  --footer-bg: #3B342E;
  --hero-bg: #D7263D;
  --badge-text: #B81E33;
  --pink-line: #F3C4BE;
  --chip-bg: #EFE4D6;
  --chip-text: #6B4E33;
  --placeholder: #B3A895;
  --ok-line: #A9DCBC;  --ok-text: #17683A;
  --danger-line: #F1B3BA;  --danger-text: #9B1C2C;
  --warn-line: #F2CD8C;  --warn-text: #8A5200;
  --shadow-sm-c: rgba(122, 88, 40, .06);

  --radius: 18px;
  --shadow: 0 10px 28px rgba(122, 88, 40, .10);
  --shadow-lift: 0 18px 40px rgba(122, 88, 40, .16);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.75;
  background: var(--cream);
  overflow-x: hidden;
  position: relative;
}
h1, h2, h3, h4 { color: var(--ink); line-height: 1.35; }
strong, b { color: inherit; }

/* الخلفية المتحركة القديمة — اتشالت من الهيدر، ونخفيها احتياطياً */
.bg-stage, .bg-slide { display: none !important; }
.float-gallery { display: none !important; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.container { width: min(1140px, calc(100% - 1.5rem)); margin-inline: auto; }

/* ================= الهيدر ================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px var(--shadow-sm-c);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 0;
}
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.brand img {
  width: 52px; height: 52px; object-fit: contain;
  border-radius: 12px; background: #fff; padding: 3px;
  border: 1px solid var(--line);
}
.brand strong { display: block; font-size: 1.05rem; color: var(--red); font-weight: 800; }
.brand span { display: block; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--red);
  align-items: center; justify-content: center; font-size: 1.3rem; cursor: pointer;
}
.nav-links { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; order: 1; margin-inline-start: auto; }
.nav-tools { display: flex; align-items: center; gap: .5rem; order: 2; flex-shrink: 0; }
.nav-links a { color: var(--ink); font-weight: 700; font-size: .95rem; }
.nav-links a:not(.btn) { position: relative; padding: .25rem .1rem; transition: color .2s ease; }
.nav-links a:not(.btn)::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 2px; border-radius: 2px;
  background: var(--red); transform: scaleX(0); transition: transform .25s ease;
}
.nav-links a:not(.btn):hover { color: var(--red); }
.nav-links a:not(.btn):hover::after { transform: scaleX(1); }

/* ================= الأزرار ================= */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1.5px solid transparent; border-radius: 10px; padding: .72rem 1.3rem;
  font-weight: 700; line-height: 1.2; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:focus-visible, .nav-toggle:focus-visible, .floating-wa:focus-visible, .ai-fab:focus-visible {
  outline: 3px solid var(--red); outline-offset: 3px;
}
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--red); color: #fff; border-color: var(--red);
  box-shadow: 0 6px 16px rgba(215, 38, 61, .25);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(215, 38, 61, .32); }

.btn-ghost { background: transparent; border-color: var(--red); color: var(--red); }
.btn-ghost:hover { background: var(--red); color: #fff; transform: translateY(-2px); }

.btn-wa { background: #128C7E; color: #fff; border-color: #128C7E; box-shadow: 0 6px 16px rgba(18,140,126,.25); }
.btn-wa:hover { background: #0f7a6e; transform: translateY(-2px); }
.btn-sm { padding: .45rem .95rem; font-size: .9rem; }
.btn-block { width: 100%; }

.icon { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.15em; }
.icon-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ================= البانر الأحمر (الرئيسية) ================= */
.hero-band {
  position: relative; background: var(--hero-bg); color: #fff; overflow: hidden;
  isolation: isolate;
}
/* دواير خفيفة زي ختم الشعار — عنصر الهوية الوحيد في الصفحة */
.hero-band::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 620px; height: 620px; border-radius: 50%;
  inset-inline-start: -180px; top: -260px;
  background:
    radial-gradient(circle, transparent 54%, rgba(255,255,255,.07) 54.5%, rgba(255,255,255,.07) 56%, transparent 56.5%),
    radial-gradient(circle, transparent 68%, rgba(255,255,255,.06) 68.5%, rgba(255,255,255,.06) 70%, transparent 70.5%),
    radial-gradient(circle, rgba(255,255,255,.08), transparent 45%);
}
.hero-band::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 420px; height: 420px; border-radius: 50%;
  inset-inline-end: -140px; bottom: -220px;
  border: 26px solid rgba(142, 22, 38, .35);
}
.hero {
  padding: 4rem 0 5.2rem;
  display: grid; grid-template-columns: 1fr; justify-items: center; text-align: center;
}
.hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4.6vw, 3.1rem); font-weight: 800;
  line-height: 1.3; margin: .9rem 0 .8rem;
}
.hero h1 em { font-style: normal; color: inherit; }
.hero p { color: rgba(255,255,255,.92); font-size: 1.08rem; margin: 0 auto 1.6rem; max-width: 40rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }
.hero .btn-primary { background: #fff; color: var(--red); border-color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.14); }
.hero .btn-primary:hover { background: var(--cream); color: var(--red-dark); border-color: var(--cream); }
.hero .btn-ghost { border-color: rgba(255,255,255,.85); color: #fff; }
.hero .btn-ghost:hover { background: #fff; color: var(--red); }
.hero .btn:focus-visible { outline-color: #fff; }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--red-soft); color: var(--badge-text);
  border: 1px solid var(--pink-line);
  padding: .3rem .75rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
}
.hero .badge { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.45); }

/* شريط الأرقام تحت البانر */
.stats-strip { position: relative; z-index: 2; margin-top: -2.6rem; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: .9rem; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 1rem .9rem; text-align: center;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 1.7rem; color: var(--red); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; font-weight: 600; }

/* ================= الأقسام بالتبادل ================= */
.band { padding: 3.2rem 0; }
.band-alt { background: var(--cream-alt); }
.band-gray { background: var(--gray); color: #fff; }
.band-gray h2, .band-gray h3 { color: #fff; }
.band-gray p { color: rgba(255,255,255,.92); }
.band-gray .btn-primary { background: var(--red-deep); border-color: var(--red-deep); box-shadow: 0 8px 20px rgba(80, 20, 20, .25); }
.band-gray .btn-primary:hover { background: #761120; border-color: #761120; }

.band-title { text-align: center; margin: 0 0 1.8rem; }
.band-title h2 { margin: 0; color: var(--red); font-size: clamp(1.4rem, 3vw, 1.85rem); font-weight: 800; }
.band-title p { margin: .35rem 0 0; color: var(--muted); }

/* ================= المميزات ================= */
.features {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0;
}
.feature {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.4rem 1rem 1.2rem; text-align: center;
  box-shadow: 0 4px 14px var(--shadow-sm-c);
  transition: transform .25s ease, box-shadow .25s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.feature .fi {
  width: 56px; height: 56px; margin: 0 auto .8rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red-soft); color: var(--red);
}
.feature h3 { margin: 0 0 .3rem; font-size: 1rem; color: var(--ink); }
.feature p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ================= رؤوس الأقسام + الكروت ================= */
.section { padding: 2.2rem 0 3rem; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.75rem); color: var(--red); font-weight: 800; }
.section-head p { margin: .3rem 0 0; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.card {
  display: block;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 4px 14px var(--shadow-sm-c);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--pink-line); box-shadow: var(--shadow-lift); }
.card-thumb { aspect-ratio: 16/10; background: var(--red-soft); position: relative; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-empty {
  height: 100%; display: grid; place-items: center;
  background: var(--red-soft); color: var(--red); font-weight: 800; letter-spacing: .02em;
}
.card-body { padding: 1rem 1.05rem 1.15rem; }
.card-body h3 { margin: 0 0 .35rem; font-size: 1.05rem; color: var(--ink); }
.card-meta { color: var(--muted); font-size: .9rem; margin-bottom: .7rem; }
.price { color: var(--red); font-weight: 800; font-size: 1.15rem; }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 1.25rem; box-shadow: var(--shadow);
}
.panel h1, .panel h2 { margin-top: 0; }
.panel h2 { color: var(--ink); }

/* قسم الشهادات الرصاصي في الرئيسية */
.cert-promo { align-items: center; }
.cert-promo h2 { margin-top: 0; font-size: clamp(1.4rem, 3vw, 1.85rem); }
.logo-plate {
  background: #fff; border-radius: 16px; padding: 1rem;
  box-shadow: 0 14px 30px rgba(60, 60, 50, .18);
  max-width: 340px; margin-inline: auto;
}

/* ================= الفورمز ================= */
.form-grid { display: grid; gap: .9rem; }
.form-row { display: grid; gap: .35rem; }
.form-row label { color: var(--muted); font-size: .92rem; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; background: var(--field); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: .75rem .95rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--placeholder); }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(215, 38, 61, .14);
}
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }

/* ================= رسائل التنبيه ================= */
.alert { padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; }
.alert-success { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ok-text); }
.alert-error { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-text); }
.alert-info { background: var(--card); border: 1px solid var(--gray); border-inline-start: 4px solid var(--gray-dark); color: var(--ink); }

/* ================= الجداول ================= */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { padding: .75rem .65rem; border-bottom: 1px solid var(--line); text-align: right; }
th { background: var(--gray-soft); color: var(--ink); font-weight: 800; font-size: .88rem; }
thead th:first-child { border-start-start-radius: 10px; }
thead th:last-child { border-start-end-radius: 10px; }
tbody tr:nth-child(even) td { background: var(--row-alt); }
tbody tr:hover td { background: var(--red-tint); }

/* ================= لوحات التحكم ================= */
.layout-dash {
  display: grid; grid-template-columns: 240px 1fr; gap: 1.1rem; padding: 1.4rem 0 3rem;
}
.side {
  background: var(--cream-alt); border: 1px solid var(--line);
  border-radius: 18px; padding: .8rem; height: fit-content; position: sticky; top: 90px;
}
.side a {
  display: flex; align-items: center; gap: .55rem;
  padding: .7rem .85rem; border-radius: 10px; color: var(--ink); font-weight: 600; margin-bottom: .2rem;
  transition: background .2s ease, color .2s ease;
}
.side a:hover { background: var(--red-soft); color: var(--badge-text); }
.side a.active { background: var(--red); color: #fff; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 0 0 1.2rem; }
.kpi {
  padding: .9rem 1rem; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-top: 3px solid var(--red);
}
.kpi small { display: block; color: var(--muted); font-size: .78rem; }
.kpi span { color: var(--muted); font-size: .85rem; }
.kpi b { display: block; font-size: 1.5rem; margin-top: .15rem; color: var(--red); line-height: 1.3; font-variant-numeric: tabular-nums; }

/* ================= الدخول والتسجيل ================= */
.auth-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: min(460px, 100%); box-shadow: var(--shadow-lift); }
.auth-card h1, .auth-card h2 { color: var(--red); }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1rem 0; }
.divider::before, .divider::after { content:""; flex:1; height:1px; background: var(--line-strong); }
.link-strong { color: var(--red); font-weight: 700; }
.link-strong:hover { text-decoration: underline; }

/* ================= المشاهدة والدروس ================= */
.video-box { background: #000; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.video-box video { width: 100%; max-height: 70vh; background: #000; }
.lesson-list { display: grid; gap: .5rem; }
.lesson-item {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center;
  padding: .75rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--field);
}
.lesson-item.active { border-color: var(--red); background: var(--red-tint); box-shadow: inset 3px 0 0 var(--red); }
.progress { height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display:block; height:100%; background: var(--red); }

/* ================= الشهادة (تفضل ورقة بيضا للطباعة) ================= */
.cert {
  background: #fff; color: #1f1b18; border-radius: 16px; padding: 2rem;
  border: 8px solid var(--red); position: relative; max-width: 900px; margin: auto;
}
.cert-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.cert-top img { width: 110px; height: auto; }
.cert h2 { color: var(--red); text-align: center; margin: 1.2rem 0 .4rem; font-size: 1.8rem; }
.cert .name { text-align: center; font-size: 1.6rem; font-weight: 800; margin: .8rem 0; color: #1f1b18; }
.cert .meta { text-align: center; color: #444; }
.cert-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; font-size: .92rem; color: #333; }
.itida-note {
  margin-top: 1rem; padding: .8rem; background: #FFF9E3; border-radius: 10px;
  text-align: center; font-size: .9rem; color: #333; border: 1px solid #EADFC6;
}

/* ================= الفوتر ================= */
.site-footer {
  padding: 1.8rem 0 2.2rem; margin-top: 3rem;
  color: #D9CFBF; font-size: .92rem; background: var(--footer-bg);
}
.site-footer strong { color: #fff; }
.footer-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
/* الرئيسية بتنتهي بقسم ملوّن فبنلزق الفوتر فيه */
.band + .site-footer, main:has(> .band:last-child) + .site-footer { margin-top: 0; }

.floating-wa {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%;
  background: #25D366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(0,0,0,.2); font-size: 1.5rem;
  transition: transform .2s ease, box-shadow .2s ease;
}
.floating-wa:hover { transform: scale(1.08); box-shadow: 0 14px 30px rgba(37,211,102,.4); }

.watch-layout { display: grid; grid-template-columns: 1.5fr .8fr; gap: 1.1rem; }
.course-layout { display: grid; grid-template-columns: 1.4fr .8fr; gap: 1.2rem; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--red); }
::selection { background: var(--red); color: #fff; }
.ok { color: var(--ok); font-weight: 700; }
.bad { color: var(--danger); font-weight: 700; }
.correct-opt { color: var(--ok); font-weight: 700; }

.inline-amount {
  width: 100px; padding: .45rem; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--field); color: var(--text);
}
.inline-amount:focus { outline: none; border-color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  .btn, .card, .feature, .nav-links a::after, .side a { transition: none; }
  .card:hover, .feature:hover, .btn:hover { transform: none; }
}

/* ---- أيقونة قائمة الموبايل ---- */
.nav-toggle { touch-action: manipulation; -webkit-tap-highlight-color: transparent; flex-shrink: 0; }
.nav-toggle .burger path { transition: transform .25s ease, opacity .2s ease; transform-origin: 12px 12px; }
.nav-toggle[aria-expanded="true"] .l1 { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .l2 { opacity: 0; }
.nav-toggle[aria-expanded="true"] .l3 { transform: translateY(-6px) rotate(-45deg); }
.nav-toggle[aria-expanded="true"] { background: var(--red); border-color: var(--red); color: #fff; }

.cert-en .cert-top { flex-direction: row; }
.cert-en .meta, .cert-en .name, .cert-en h2 { direction: ltr; }
@media print { .cert { break-after: page; } }

@media print {
  body { background: #fff !important; color: #000; }
  .site-header, .site-footer, .floating-wa, .no-print, .bg-stage, .ai-fab, .ai-panel { display: none !important; }
  .cert { box-shadow: none; max-width: 100%; }
}

/* منع طباعة أو حفظ صفحات لوحات التحكم والدروس كملف — الشهادة فقط مستثناة ومسموح طباعتها عمداً */
@media print {
  .layout-dash > *, .watch-layout > * { display: none !important; }
  .layout-dash::before, .watch-layout::before {
    content: "🚫 غير مسموح بطباعة أو حفظ هذه الصفحة كملف. لأي استفسار تواصل مع إدارة المنصة.";
    display: block; padding: 4rem 1rem; text-align: center; font-size: 1.3rem; color: #000; line-height: 1.9;
  }
}

@media (max-width: 980px) {
  .grid, .layout-dash, .form-2, .watch-layout, .course-layout {
    grid-template-columns: 1fr;
  }
  .features { grid-template-columns: 1fr 1fr; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none; width: 100%; flex-direction: column; align-items: stretch;
    padding: .75rem 0 .4rem; gap: .2rem; border-top: 1px solid var(--line); margin-top: .5rem;
  }
  .nav-links a:not(.btn) { padding: .55rem .4rem; border-radius: 8px; }
  .nav-links a:not(.btn)::after { display: none; }
  .nav-links a:not(.btn):hover { background: var(--red-soft); }
  .nav-links .btn { margin-top: .3rem; }
  .nav-links.open { display: flex; }
  .nav-links { order: 3; margin-inline-start: 0; }
  .nav-tools { margin-inline-start: auto; }
  .nav { flex-wrap: wrap; }
  .brand span { max-width: 150px; }
  .hero { padding: 3rem 0 4.6rem; }
  .cert-promo { text-align: center; }
}

@media (max-width: 560px) {
  .container { width: min(1140px, calc(100% - 1rem)); }
  .brand img { width: 44px; height: 44px; }
  .btn { padding: .65rem 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .stats { gap: .5rem; }
  .stat { padding: .8rem .4rem; }
  .stat b { font-size: 1.35rem; }
  .stat span { font-size: .8rem; }
  .band { padding: 2.4rem 0; }
  .hero-band::before { width: 420px; height: 420px; top: -200px; }
  .cert { padding: 1rem; border-width: 5px; }
  .cert .name { font-size: 1.25rem; }
  .cert h2 { font-size: 1.35rem; }
}

/* ================= مشغّل الفيديو المحمي (يفضل غامق) ================= */
.video-box.panel { background: var(--card); padding: 0; }
.video-box .player { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 75vh; background: #000; direction: ltr; overflow: hidden; -webkit-user-select: none; user-select: none; outline: none; }
.player video { width: 100%; height: 100%; max-height: none; object-fit: contain; display: block; background: #000; }
.player:fullscreen, .player:-webkit-full-screen { max-height: none; aspect-ratio: auto; height: 100%; }
.player.is-pseudo-fs { position: fixed; inset: 0; z-index: 9999; max-height: none; aspect-ratio: auto; height: 100%; border-radius: 0; }
body.no-scroll { overflow: hidden; }

.wm-tile { position: absolute; inset: 0; z-index: 2; pointer-events: none; background-repeat: repeat; }
.wm-move { position: absolute; z-index: 3; pointer-events: none; direction: rtl; white-space: nowrap; color: #fff; opacity: .6; font-weight: 700; font-size: clamp(.7rem, 1.5vw, .95rem); padding: .12rem .55rem; border-radius: 6px; background: rgba(0,0,0,.18); text-shadow: 0 1px 3px rgba(0,0,0,.85); transition: top 1.4s ease, left 1.4s ease; }

.p-big { position: absolute; z-index: 4; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%; border: 3px solid rgba(255,255,255,.85); cursor: pointer; display: grid; place-items: center; color: #fff; background: var(--red); box-shadow: 0 10px 30px rgba(0,0,0,.45); transition: transform .2s ease, opacity .25s ease; }
.p-big svg { margin-left: 4px; }
.p-big:hover { transform: scale(1.07); background: var(--red-dark); }
.player.is-playing .p-big { opacity: 0; pointer-events: none; }

.p-bar { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: .65rem; padding: 1.6rem .8rem .6rem; background: linear-gradient(0deg, rgba(15,12,10,.92), rgba(15,12,10,0)); color: #fff; }
.p-btn { flex: none; width: 36px; height: 36px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px; color: #fff; cursor: pointer; transition: background .2s ease, color .2s ease; }
.p-btn:hover { background: rgba(255,255,255,.16); }
.p-btn:focus-visible, .p-speed:focus-visible, .p-seek:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.p-time { flex: none; font-size: .82rem; font-variant-numeric: tabular-nums; color: #fff; min-width: 84px; }
.p-speed { flex: none; min-width: 64px; text-align: center; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: .2rem .35rem; font-size: .8rem; cursor: pointer; }
.p-speed option { color: #111; }
.p-seek { flex: 1; min-width: 60px; height: 6px; border-radius: 6px; -webkit-appearance: none; appearance: none; cursor: pointer;
  background: linear-gradient(to right, var(--red) var(--p, 0%), rgba(255,255,255,.3) var(--p, 0%)); }
.p-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--red); box-shadow: 0 0 0 3px rgba(215,38,61,.3); }
.p-seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--red); }

.p-shield { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; text-align: center; direction: rtl; cursor: pointer; color: #fff; line-height: 1.9;
  background: rgba(20,16,14,.96); }
.p-shield[hidden] { display: none; }

.meter-head { display: flex; justify-content: space-between; margin-bottom: .4rem; font-weight: 700; }
.meter-track { position: relative; height: 10px; border-radius: 10px; background: var(--gray-soft); overflow: visible; margin-bottom: .5rem; }
.meter-track span { display: block; height: 100%; border-radius: 10px; background: var(--red); transition: width .5s ease; }
.meter-track i { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink); border-radius: 2px; }

.toast { position: fixed; z-index: 10000; bottom: 1.4rem; left: 50%; transform: translate(-50%, 20px); opacity: 0; padding: .75rem 1.2rem; border-radius: 999px; background: var(--footer-bg); color: #fff; border: 1px solid var(--red); box-shadow: 0 12px 30px rgba(0,0,0,.25); font-weight: 700; transition: opacity .3s ease, transform .3s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.badge-on, .badge-off { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.badge-on, .badge.badge-on { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ok-text); }
.badge-off, .badge.badge-off { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-text); }

@media (max-width: 640px) {
  .p-bar { gap: .35rem; padding: 1.2rem .5rem .4rem; }
  .p-time { min-width: 0; font-size: .72rem; }
  .p-speed { display: none; }
  .p-big { width: 60px; height: 60px; }
}
@media print { .video-box { display: none !important; } }

/* ================= السجل والتقارير ================= */
.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; padding: 1rem; margin-bottom: .6rem; border-radius: 14px; border: 1px solid var(--line); background: var(--cream-alt); }
.filters .form-row { margin: 0; min-width: 140px; }
.filters .form-row.grow { flex: 1 1 260px; }
.filters .check { display: flex; gap: .4rem; align-items: center; color: var(--muted); padding-bottom: .5rem; }
.filters-actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-bottom: .1rem; }

.tone { display: inline-block; padding: .18rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.tone-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.tone-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.tone-bad { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.tone-info { background: var(--gray-soft); border-color: var(--gray); color: var(--ink); }

.role-chip { display: inline-block; padding: .05rem .5rem; border-radius: 6px; font-size: .72rem; font-weight: 700; background: var(--chip-bg); color: var(--chip-text); vertical-align: middle; }
.role-student { background: var(--chip-bg); color: var(--chip-text); }
.role-doctor { background: var(--gray); color: #fff; }
.role-admin { background: var(--red); color: #fff; }

.log-table td { vertical-align: top; }
.log-table a { color: var(--badge-text); text-decoration: underline; text-decoration-color: rgba(215,38,61,.4); }
.pager { display: flex; gap: .8rem; align-items: center; justify-content: center; margin-top: 1rem; color: var(--muted); }

/* منع الجداول العريضة من توسيع الصفحة على الموبايل */
.layout-dash > *, .watch-layout > *, .course-layout > *, .hero > * { min-width: 0; }

/* ================= طرق الشهادة + الامتحان ================= */
.cert-mode-hint { margin-top: .4rem; }
.cert-mode-hint p { margin: 0; color: var(--muted); font-size: .85rem; }
.resource-link { padding: 0 1rem; margin-top: -.4rem; }
.cert-banner { margin: 0; }

.exam-timer {
  position: sticky; top: 5.2rem; z-index: 3; margin: 0 0 1rem; margin-inline-start: auto; width: fit-content;
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.3rem; letter-spacing: .03em;
  padding: .4rem 1.1rem; border-radius: 999px; background: var(--red); border: 1px solid var(--red); color: #fff;
  box-shadow: 0 6px 16px rgba(215,38,61,.25);
}
.exam-timer-warn { background: var(--red-deep); border-color: var(--red-deep); animation: examPulse 1s ease-in-out infinite; }
@keyframes examPulse { 50% { opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .exam-timer-warn { animation: none; } }

.exam-q { padding: 1rem 0; border-top: 1px solid var(--line); }
.exam-q:first-of-type { border-top: none; padding-top: .4rem; }
.exam-q p { margin: 0 0 .6rem; }
.exam-opt { display: flex; align-items: center; gap: .55rem; padding: .6rem .85rem; margin-bottom: .45rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--field); cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.exam-opt:hover { border-color: var(--pink-line); background: var(--red-tint); }
.exam-opt:has(input:checked) { border-color: var(--red); background: var(--red-tint); box-shadow: inset 0 0 0 1px var(--red); }
.exam-opt input { accent-color: var(--red); flex: none; }
.exam-opt span { flex: 1; }

.reject-form { display: flex; gap: .4rem; align-items: center; }
.reject-form input[type="text"] { padding: .4rem .6rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--field); color: var(--text); }

/* ================= شارة طريقة إصدار الشهادة ================= */
.cert-mode-badge {
  display: inline-flex; align-items: center; gap: .4rem; margin: .5rem 0 1rem;
  padding: .35rem .9rem; border-radius: 999px; background: var(--gray-soft);
  border: 1px solid var(--gray); color: var(--ink); font-size: .85rem; font-weight: 700;
}
.cert-mode-badge-sm { margin: .3rem 0; padding: .2rem .65rem; font-size: .76rem; }

/* ================= زر الامتحان الثابت أسفل الفيديو ================= */
.exam-cta { padding: 0 1rem 1rem; }
.exam-cta .btn { font-size: .95rem; }
.video-box .exam-cta, .video-box .resource-link, .video-box .cert-banner { background: var(--card); }

/* ================= دليل استخدام المنصة ================= */
.guide-acc { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .7rem; background: var(--field); overflow: hidden; }
.guide-acc summary {
  cursor: pointer; padding: .9rem 1.1rem; font-weight: 700; color: var(--ink); list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
}
.guide-acc summary::-webkit-details-marker { display: none; }
.guide-acc summary::after { content: "+"; font-size: 1.3rem; color: var(--red); flex: none; line-height: 1; }
.guide-acc[open] summary::after { content: "−"; }
.guide-acc[open] summary { border-bottom: 1px solid var(--line); background: var(--red-tint); color: var(--badge-text); }
.guide-acc summary:hover { background: var(--red-tint); }
.guide-acc-body { padding: 1rem 1.1rem 1.2rem; }
.guide-steps { padding-inline-start: 1.3rem; }
.guide-steps li { margin-bottom: .6rem; }
.guide-steps li::marker { color: var(--red); font-weight: 800; }

/* ================= المساعد الذكي ================= */
.ai-fab {
  position: fixed; left: 1rem; bottom: 5.4rem; z-index: 61;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--red); color: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 24px rgba(215,38,61,.35);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.ai-fab:hover { transform: scale(1.08); background: var(--red-dark); }
.ai-fab.is-open { background: var(--footer-bg); }

.ai-panel {
  position: fixed; z-index: 62; left: 1rem; bottom: 9.8rem;
  width: min(360px, calc(100vw - 2rem)); height: min(480px, calc(100vh - 11rem));
  background: var(--cream); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(59,52,46,.25); display: flex; flex-direction: column; overflow: hidden;
}
.ai-panel[hidden] { display: none !important; }
.ai-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; background: var(--red);
  font-weight: 700; color: #fff; font-size: .92rem;
}
.ai-head button { background: none; border: none; color: rgba(255,255,255,.9); font-size: 1rem; cursor: pointer; }
.ai-head button:hover { color: #fff; }
.ai-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.ai-msg { max-width: 85%; padding: .55rem .8rem; border-radius: 12px; font-size: .88rem; line-height: 1.7; white-space: pre-wrap; }
.ai-msg.ai-user { align-self: flex-end; background: var(--red-soft); color: var(--badge-text); border: 1px solid var(--pink-line); border-bottom-right-radius: 3px; }
.ai-msg.ai-bot { align-self: flex-start; background: var(--field); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 3px; }
.ai-msg.ai-system { align-self: center; background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-text); font-size: .82rem; text-align: center; }
.ai-msg.ai-warn { align-self: stretch; background: var(--warn-soft); border: 1px dashed var(--warn-line); color: var(--warn-text); font-size: .8rem; }
.ai-typing span { display: inline-block; width: 6px; height: 6px; margin-inline-end: 4px; border-radius: 50%; background: var(--gray-dark); animation: aiTyping 1s infinite ease-in-out; }
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aiTyping { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.ai-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); background: var(--card); }
.ai-form input { flex: 1; background: var(--field); border: 1px solid var(--line-strong); border-radius: 999px; padding: .6rem 1rem; color: var(--text); font-size: .88rem; }
.ai-form input:focus { outline: none; border-color: var(--red); }
.ai-form button { flex: none; width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--red); color: #fff; cursor: pointer; font-size: 1rem; }
.ai-form button:hover { background: var(--red-dark); }
.ai-form button:disabled { opacity: .6; cursor: not-allowed; }
/* زرار المايك: الكلام بيتحول لنص في خانة السؤال */
.ai-form .ai-mic { background: transparent; color: var(--red); border: 1.5px solid var(--red); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.ai-form .ai-mic:hover { background: var(--danger-soft); }
.ai-form .ai-mic svg { width: 19px; height: 19px; }
.ai-form .ai-mic.is-rec { background: var(--red); color: #fff; animation: aiMicPulse 1.2s ease-in-out infinite; }
@keyframes aiMicPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(215, 38, 61, .45); } 50% { box-shadow: 0 0 0 7px rgba(215, 38, 61, 0); } }
@media (prefers-reduced-motion: reduce) { .ai-form .ai-mic.is-rec { animation: none; } }
@media (max-width: 480px) {
  .ai-panel { left: .6rem; bottom: 9.2rem; width: calc(100vw - 1.2rem); height: min(440px, calc(100vh - 10.5rem)); }
  .ai-fab { left: .6rem; }
}


/* =====================================================================
   زر تبديل الوضع (فاتح / غامق)
   ===================================================================== */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { border-color: var(--red); color: var(--red); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }
body { transition: background-color .25s ease, color .25s ease; }
@media (prefers-reduced-motion: reduce) { body, .theme-toggle { transition: none; } }

/* =====================================================================
   الوضع الغامق — نفس الهوية بألوان مريحة للعين
   (مشغل الفيديو والشهادة ثابتين في الوضعين)
   ===================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;

  --red: #E43A50;
  --red-dark: #C92A40;
  --red-deep: #9E1B2C;
  --red-soft: rgba(228, 58, 80, .16);
  --red-tint: rgba(228, 58, 80, .09);

  --gray: #5E5F55;
  --gray-dark: #8C8D80;
  --gray-soft: #34302B;

  --cream: #1E1A17;
  --cream-alt: #25201C;
  --cream-soft: #2E2823;
  --card: #2A2521;
  --paper: #2A2521;

  --ink: #F3EBDD;
  --text: #EDE4D6;
  --muted: #B5A999;
  --line: #3D3530;
  --line-strong: #4D433B;

  --ok: #5CC98A;
  --ok-soft: rgba(46, 160, 95, .16);
  --warn-soft: rgba(214, 140, 20, .16);
  --danger: #FF7A8A;
  --danger-soft: rgba(228, 58, 80, .16);

  --field: #221E1A;
  --header-bg: rgba(30, 26, 23, .92);
  --row-alt: rgba(255, 255, 255, .025);
  --footer-bg: #141110;
  --hero-bg: #B81E33;
  --badge-text: #FF9AA7;
  --pink-line: rgba(228, 58, 80, .45);
  --chip-bg: #3A322B;
  --chip-text: #E6D5BF;
  --placeholder: #7D7266;
  --ok-line: rgba(46, 160, 95, .45);  --ok-text: #86DDA9;
  --danger-line: rgba(228, 58, 80, .45);  --danger-text: #FFA3AE;
  --warn-line: rgba(214, 140, 20, .45);  --warn-text: #F2C27A;

  --shadow: 0 10px 28px rgba(0, 0, 0, .35);
  --shadow-lift: 0 18px 40px rgba(0, 0, 0, .45);
  --shadow-sm-c: rgba(0, 0, 0, .25);
}
html[data-theme="dark"] .site-header { box-shadow: 0 4px 18px rgba(0, 0, 0, .3); }
html[data-theme="dark"] .hero-band::after { border-color: rgba(60, 8, 16, .45); }
html[data-theme="dark"] .hero .btn-primary { background: #FFF9E3; border-color: #FFF9E3; color: #B81E33; }
html[data-theme="dark"] .band-gray .btn-primary { background: var(--red); border-color: var(--red); }
html[data-theme="dark"] .band-gray .btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
html[data-theme="dark"] .logo-plate { box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .side a.active { color: #fff; }
html[data-theme="dark"] .ai-fab.is-open { background: var(--gray); }
html[data-theme="dark"] .form-row select option { background: var(--card); color: var(--text); }

@media print {
  html[data-theme="dark"] body { background: #fff !important; color: #000 !important; }
}

/* حقل الفخ في صفحة التسجيل — مخفي عن البشر وقارئات الشاشة */
/* مخفي من غير ما نزقّه برّه الشاشة (الزق لبرّه كان بيوسّع الصفحة في العربي ويخلّي الموبايل يصغّرها) */
.hp-field {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; border: 0 !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important;
  white-space: nowrap !important; opacity: 0 !important; pointer-events: none !important;
}

/* =====================================================================
   المساعد الشخصي (للمتدربين والزوار) — فوق زر الواتساب
   ===================================================================== */
.fh-fab {
  position: fixed; left: 1rem; bottom: 5.4rem; z-index: 61;
  width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--cream);
  background: var(--red); color: #fff; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(215, 38, 61, .35);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.fh-fab::after { /* نقطة "متاح" */
  content: ""; position: absolute; top: 3px; right: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: #3DDC84; border: 2px solid var(--cream);
}
.fh-fab:hover { transform: scale(1.08); background: var(--red-dark); }
.fh-fab:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.fh-fab[aria-expanded="true"] { background: var(--footer-bg); }

/* لو المساعد الذكي كمان مفعّل: يطلع فوق المساعد الشخصي */
.fh-on .ai-fab { bottom: 9.8rem; }
.fh-on .ai-panel { bottom: 1rem; z-index: 70; height: min(520px, calc(100vh - 2rem)); }

.fh-panel {
  position: fixed; z-index: 70; left: 1rem; bottom: 1rem;
  width: min(410px, calc(100vw - 2rem)); height: min(640px, calc(100vh - 2rem));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--cream); color: var(--text);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 60px rgba(59, 52, 46, .28);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  animation: fhIn .22s ease-out;
}
.fh-panel[hidden] { display: none !important; }
@keyframes fhIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.fh-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: .65rem; flex-shrink: 0;
  padding: .8rem .9rem; background: var(--hero-bg); color: #fff;
}
.fh-head::before { /* نفس دواير البانر */
  content: ""; position: absolute; z-index: -1; width: 180px; height: 180px; border-radius: 50%;
  inset-inline-end: -60px; top: -90px; border: 16px solid rgba(255,255,255,.08);
}
.fh-mark {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; direction: ltr;
  display: grid; place-items: center; font-weight: 800; font-size: .85rem; letter-spacing: .03em;
  background: rgba(255,255,255,.14); border: 2px solid rgba(255,255,255,.7);
}
.fh-title { min-width: 0; line-height: 1.35; }
.fh-title strong { display: block; font-size: 1rem; color: #fff; }
.fh-title span { font-size: .78rem; opacity: .92; white-space: nowrap; }
.fh-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7CFF9B; margin-inline-end: .35rem; vertical-align: middle; }
.fh-topics-btn {
  margin-inline-start: auto; flex-shrink: 0; cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 700; color: #fff;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px; padding: .3rem .75rem; white-space: nowrap;
}
.fh-topics-btn:hover { background: rgba(255,255,255,.28); }
.fh-close {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  background: transparent; border: 0; color: #fff; font-size: 1rem;
}
.fh-close:hover { background: rgba(255,255,255,.18); }
.fh-head button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fh-chat {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 1rem .8rem .5rem; display: flex; flex-direction: column; gap: .6rem;
  font-size: .93rem; line-height: 1.75;
}
.fh-chat .msg { max-width: 88%; padding: .6rem .85rem; border-radius: 16px; word-wrap: break-word; animation: fhPop .18s ease-out; }
.fh-chat .bot { align-self: flex-start; background: var(--field); border: 1px solid var(--line); color: var(--ink); border-start-start-radius: 5px; }
.fh-chat .user { align-self: flex-end; background: var(--red); color: #fff; border-start-end-radius: 5px; }
.fh-chat .bot b { color: var(--red); }
.fh-chat .bot ul, .fh-chat .bot ol { margin: .35rem 0; padding-inline-start: 1.2rem; }
.fh-chat .bot li { margin: .1rem 0; }
.fh-chat .note { display: block; margin-top: .5rem; padding: .5rem .65rem; background: var(--red-soft); border-radius: 10px; font-size: .86rem; }
@keyframes fhPop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.fh-chat .chips { display: flex; flex-wrap: wrap; gap: .45rem; align-self: flex-start; max-width: 100%; }
.fh-chat .chip {
  font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
  padding: .3rem .75rem; border-radius: 999px;
  background: var(--field); color: var(--red); border: 1px solid var(--pink-line);
}
.fh-chat .chip:hover { background: var(--red-soft); }

.fh-chat .topics { align-self: stretch; display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.fh-chat .tile {
  font: inherit; text-align: start; cursor: pointer;
  display: flex; flex-direction: column; gap: .1rem;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: .7rem;
  transition: border-color .15s ease, transform .15s ease;
}
.fh-chat .tile:hover { border-color: var(--red); transform: translateY(-2px); }
.fh-chat .tile .ic { font-size: 1.35rem; line-height: 1.2; }
.fh-chat .tile .tt { font-weight: 700; font-size: .88rem; }
.fh-chat .tile .ct { font-size: .75rem; color: var(--muted); }

.fh-chat .qlist { align-self: stretch; display: flex; flex-direction: column; gap: .45rem; }
.fh-chat .qbtn {
  font: inherit; font-size: .88rem; text-align: start; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-inline-start: 4px solid var(--red); border-radius: 12px; padding: .55rem .8rem;
}
.fh-chat .qbtn:hover { background: var(--red-tint); }
.fh-chat .qbtn::after { content: "‹"; color: var(--red); font-size: 1.2rem; line-height: 1; }
.fh-chat .qbtn.back { border-inline-start-color: var(--gray); color: var(--muted); font-size: .82rem; }
.fh-chat .qbtn.back::after { content: ""; }
.fh-chat button:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.fh-chat .typing { display: flex; gap: 4px; align-items: center; padding: .8rem 1rem; }
.fh-chat .typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: fhBlink 1s infinite; }
.fh-chat .typing span:nth-child(2) { animation-delay: .15s; }
.fh-chat .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes fhBlink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.fh-form { display: flex; gap: .5rem; flex-shrink: 0; padding: .65rem .7rem .75rem; border-top: 1px solid var(--line); background: var(--card); }
.fh-input {
  flex: 1; min-width: 0; font: inherit; font-size: .9rem; color: var(--text);
  padding: .6rem 1rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--field);
  -webkit-user-select: text; user-select: text;
}
.fh-input::placeholder { color: var(--placeholder); }
.fh-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(215, 38, 61, .14); }
.fh-send {
  flex-shrink: 0; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
  border: 0; border-radius: 999px; padding: 0 1.1rem; background: var(--red); color: #fff;
}
.fh-send:hover { background: var(--red-dark); }
.fh-send:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

html[data-theme="dark"] .fh-panel { box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }

/* زر المساعد وهو مفتوح يبقى زر إغلاق ✕ */
.fh-fab[aria-expanded="true"] svg { display: none; }
.fh-fab[aria-expanded="true"]::before { content: "✕"; font-size: 1.25rem; font-weight: 700; line-height: 1; }
.fh-fab[aria-expanded="true"]::after { display: none; }

/* الموبايل: شباك عائم أصغر فوق الزرار، والصفحة تفضل ظاهرة وشغالة */
@media (max-width: 560px) {
  .fh-fab { left: .6rem; }
  .fh-panel {
    left: .6rem; right: .6rem; width: auto;
    bottom: calc(5.4rem + 58px + .6rem);
    height: min(430px, 56vh); height: min(430px, 56dvh);
    border-radius: 18px;
    box-shadow: 0 18px 44px rgba(59, 52, 46, .32);
  }
  .fh-head { padding: .6rem .7rem; gap: .5rem; }
  .fh-mark { width: 34px; height: 34px; font-size: .72rem; }
  .fh-title strong { font-size: .92rem; }
  .fh-title span { display: none; }
  .fh-topics-btn { font-size: .75rem; padding: .25rem .6rem; }
  .fh-chat { padding: .75rem .6rem .4rem; font-size: .88rem; }
  .fh-chat .topics { gap: .45rem; }
  .fh-chat .tile { padding: .55rem; }
  .fh-chat .tile .ic { font-size: 1.15rem; }
  .fh-form { padding: .5rem .55rem .6rem; }
  .fh-input { padding: .5rem .85rem; font-size: 16px; } /* 16px يمنع الآيفون من تكبير الصفحة */
  .fh-on .ai-fab { left: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .fh-panel, .fh-chat .msg { animation: none; }
  .fh-chat .typing span { animation: none; }
  .fh-chat .tile { transition: none; }
  .fh-chat .tile:hover { transform: none; }
}
@media print { .fh-fab, .fh-panel { display: none !important; } }

/* =====================================================================
   البحث عن الكورسات + كود الكورس + "مجاني"
   ===================================================================== */
.course-code {
  position: absolute; z-index: 2; top: .6rem; inset-inline-start: .6rem;
  direction: ltr; font-size: .72rem; font-weight: 800; letter-spacing: .04em;
  padding: .15rem .55rem; border-radius: 999px;
  background: rgba(31, 27, 24, .72); color: #fff; backdrop-filter: blur(4px);
}
.course-code-inline {
  position: static; display: inline-block; direction: rtl;
  background: var(--gray-soft); color: var(--ink); border: 1px solid var(--gray); backdrop-filter: none;
}
.price-free {
  display: inline-block; color: var(--ok-text); background: var(--ok-soft);
  border: 1px solid var(--ok-line); border-radius: 999px; padding: .05rem .75rem; font-size: .95em;
}

.course-finder {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 1rem; margin-bottom: 1.3rem; box-shadow: 0 4px 14px var(--shadow-sm-c);
}
.cf-search { position: relative; }
.cf-search svg {
  position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 1rem;
  width: 20px; height: 20px; color: var(--muted); pointer-events: none;
}
.cf-search input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--field); border: 1.5px solid var(--line-strong); border-radius: 999px;
  padding: .8rem 2.9rem; transition: border-color .2s ease, box-shadow .2s ease;
}
.cf-search input::placeholder { color: var(--placeholder); }
.cf-search input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(215, 38, 61, .14); }
.cf-search input::-webkit-search-cancel-button { display: none; }
.cf-clear {
  position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: .6rem;
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gray-soft); color: var(--ink); font-size: .85rem;
}
.cf-clear:hover { background: var(--red-soft); color: var(--red); }
.cf-clear[hidden] { display: none; }

.cf-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; margin-top: .85rem; }
.cf-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.cf-chip {
  font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  padding: .38rem 1rem; border-radius: 999px;
  background: var(--field); color: var(--ink); border: 1px solid var(--line-strong);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cf-chip:hover { border-color: var(--red); color: var(--red); }
.cf-chip.is-on { background: var(--red); border-color: var(--red); color: #fff; }
.cf-chip:focus-visible, .cf-select select:focus-visible, .cf-clear:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.cf-selects { display: flex; gap: .6rem; flex-wrap: wrap; }
.cf-select { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.cf-select select {
  font: inherit; font-size: .88rem; color: var(--text); cursor: pointer;
  background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; padding: .38rem .6rem;
}
.cf-select select:focus { outline: none; border-color: var(--red); }
html[data-theme="dark"] .cf-select select option { background: var(--card); color: var(--text); }

.cf-count { margin-top: .7rem; font-size: .85rem; color: var(--muted); font-weight: 600; min-height: 1.2em; }
.cf-empty { text-align: center; padding: 2rem 1rem; }
.cf-empty p { color: var(--muted); margin: .4rem 0 1rem; }
.grid[hidden], .card[hidden] { display: none !important; }

.nav-search svg { width: 19px; height: 19px; }

@media (max-width: 560px) {
  .course-finder { padding: .75rem; border-radius: 14px; }
  .cf-search input { font-size: 16px; padding: .7rem 2.6rem; }
  .cf-row { flex-direction: column; align-items: stretch; gap: .6rem; }
  .cf-chips { justify-content: space-between; }
  .cf-chip { flex: 1; text-align: center; padding: .38rem .5rem; }
  .cf-selects { display: grid; grid-template-columns: 1fr 1fr; }
  .cf-select { flex-direction: column; align-items: stretch; gap: .2rem; }
  .theme-toggle { width: 38px; height: 38px; }
  .nav-tools { gap: .35rem; }
}

/* =====================================================================
   الشحن بفودافون كاش
   ===================================================================== */
.vf-card { border-top: 4px solid #E60000; }
.vf-head { display: flex; gap: .8rem; align-items: center; margin-bottom: 1rem; }
.vf-logo {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.5rem;
  background: var(--red-soft); border: 1px solid var(--pink-line);
}
.vf-quick { display: flex; flex-wrap: wrap; gap: .45rem; }

.vf-summary { display: grid; gap: .5rem; margin-top: .6rem; }
.vf-summary > div {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .75rem 1rem; border-radius: 12px; background: var(--field); border: 1px solid var(--line);
}
.vf-summary span { color: var(--muted); font-size: .92rem; }
.vf-summary b { font-size: 1.05rem; }
.vf-summary .vf-sum-main { background: var(--ok-soft); border-color: var(--ok-line); }
.vf-summary .vf-sum-main b { color: var(--ok-text); font-size: 1.25rem; }

.vf-wait-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.vf-spinner {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  border: 4px solid var(--red-soft); border-top-color: var(--red);
  animation: vfSpin 1s linear infinite;
}
@keyframes vfSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .vf-spinner { animation-duration: 3s; } }

.vf-steps { margin: 0 0 1rem; padding-inline-start: 1.4rem; display: grid; gap: .6rem; font-size: 1.02rem; }
.vf-steps li::marker { color: var(--red); font-weight: 800; }
.vf-ussd {
  display: inline-block; direction: ltr; unicode-bidi: isolate; font-weight: 800; font-size: 1.15rem; letter-spacing: .05em;
  padding: .1rem .7rem; border-radius: 10px; background: var(--red); color: #fff !important; text-decoration: none;
}

.vf-result { text-align: center; padding: 1.2rem .5rem; }
.vf-result h2 { margin: .6rem 0 .4rem; }
.vf-result p { max-width: 34rem; margin: 0 auto .5rem; }
.vf-icon {
  width: 72px; height: 72px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 2rem; font-weight: 800;
  background: var(--gray-soft); color: var(--ink);
}
.vf-ok .vf-icon { background: var(--ok-soft); color: var(--ok-text); border: 2px solid var(--ok-line); }
.vf-bad .vf-icon { background: var(--danger-soft); color: var(--danger-text); border: 2px solid var(--danger-line); }
.vf-warn .vf-icon { background: var(--warn-soft); color: var(--warn-text); border: 2px solid var(--warn-line); }

.vf-review { display: grid; gap: .35rem; }
.vf-review input[name="tx"] {
  padding: .4rem .6rem; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--field); color: var(--text); direction: ltr; text-align: right;
}
.vf-review label { font-size: .78rem; color: var(--muted); display: flex; gap: .3rem; align-items: center; }

/* سجل الاتصال بادفعلي (صفحة المدفوعات) */
.vf-log summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.vf-log pre {
  margin: .6rem 0 0; max-height: 360px; overflow: auto; padding: .8rem; border-radius: 10px;
  background: #1F1B18; color: #E9E2D6; font-size: .75rem; line-height: 1.6; white-space: pre-wrap; word-break: break-all;
}
.vf-summary .vf-sum-total { background: var(--card); border-color: var(--line-strong); }
.vf-summary .vf-sum-total b { color: var(--red); font-size: 1.15rem; }


/* =====================================================================
   قايمة لوحات التحكم على الموبايل/التابلت: شريط تابات أفقي رفيع
   (بدل ما القايمة تاخد نص الشاشة وتزق المحتوى لتحت)
   ===================================================================== */
@media (max-width: 980px) {
  .layout-dash { gap: .75rem; padding-top: .75rem; }
  .side {
    --fs: 0px; --fe: 0px;                       /* بهتان الأطراف لما يكون فيه تابات مستخبية */
    position: sticky; top: var(--hdr-h, 72px); z-index: 20;
    display: flex; flex-wrap: nowrap; gap: .35rem;
    margin-inline: -.25rem; padding: .45rem .5rem;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scroll-padding-inline: 1.5rem;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    background: var(--header-bg);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 6px 18px var(--shadow-sm-c);
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--fs), #000 calc(100% - var(--fe)), transparent 100%);
            mask-image: linear-gradient(to left, transparent 0, #000 var(--fs), #000 calc(100% - var(--fe)), transparent 100%);
  }
  .side::-webkit-scrollbar { display: none; }
  .side.fade-start { --fs: 26px; }
  .side.fade-end { --fe: 26px; }

  .side a {
    flex: 0 0 auto; margin: 0; scroll-snap-align: center;
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .5rem 1rem; border-radius: 999px;
    font-size: .9rem; line-height: 1.2; white-space: nowrap;
    background: var(--field); border: 1px solid var(--line);
    color: var(--ink);
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .side a:active { transform: scale(.96); }
  .side a:hover { background: var(--red-soft); border-color: var(--pink-line); }
  .side a.active {
    background: var(--red); border-color: var(--red); color: #fff;
    box-shadow: 0 4px 12px rgba(215, 38, 61, .32);
  }
  .side a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
}
@media (max-width: 560px) {
  .side a { padding: .45rem .85rem; font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) {
  .side a { transition: none; }
}

/* أزرار المبالغ السريعة في المحفظة: صف واحد مرتب على الموبايل */
.vf-quick .cf-chip { white-space: nowrap; }
@media (max-width: 560px) {
  .vf-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
  .vf-quick .cf-chip { flex: none; padding: .5rem .2rem; font-size: .9rem; font-variant-numeric: tabular-nums; }
  .vf-quick .vf-cur { display: none; }
}

/* شريط وضع المعاينة (المدير / الدكتور) */
.preview-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem;
  margin-bottom: 1rem; padding: .7rem 1rem; border-radius: 14px;
  background: var(--warn-soft); border: 1px solid var(--warn-line);
}
.preview-tag { font-weight: 800; color: var(--warn-text); white-space: nowrap; }
.preview-note { flex: 1 1 260px; color: var(--muted); font-size: .88rem; }

/* =====================================================================
   خدمات الدفع (شحن رصيد الموبايل)
   ===================================================================== */
.svc-balance { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.svc-bal-box {
  display: grid; text-align: center; padding: .55rem 1.1rem; border-radius: 14px;
  background: var(--field); border: 1px solid var(--line);
}
.svc-bal-box span { color: var(--muted); font-size: .8rem; }
.svc-bal-box b { color: var(--red); font-size: 1.25rem; }
.svc-bal-box a { font-size: .78rem; color: var(--red-dark); text-decoration: underline; }

.svc-ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.svc-op {
  position: relative; cursor: pointer; display: grid; justify-items: center; gap: .35rem;
  padding: .9rem .4rem; border-radius: 16px; border: 2px solid var(--line); background: var(--field);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.svc-op input { position: absolute; opacity: 0; pointer-events: none; }
.svc-op-dot {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--op); color: #fff; font-weight: 800; font-size: 1.15rem;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--op) 35%, transparent);
}
.svc-op-name { font-weight: 700; font-size: .92rem; }
.svc-op:hover { transform: translateY(-2px); }
.svc-op:has(input:checked) { border-color: var(--op); box-shadow: 0 0 0 3px color-mix(in srgb, var(--op) 22%, transparent); }
.svc-op:has(input:checked)::after {
  content: "✓"; position: absolute; top: .35rem; inset-inline-end: .5rem;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--op); color: #fff; font-size: .72rem; font-weight: 800;
}
.svc-op:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }
.svc-note { margin: 0; padding: .55rem .8rem; border-radius: 10px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-text); font-size: .88rem; }
.svc-note[hidden] { display: none; }
.vf-quick .cf-chip:disabled { opacity: .35; cursor: not-allowed; }
.svc-chip { display: inline-block; padding: .05rem .55rem; border-radius: 999px; background: var(--op); color: #fff; font-size: .75rem; font-weight: 700; }

.svc-promo { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease; }
.svc-promo:hover { transform: translateY(-2px); border-color: var(--pink-line); }
.svc-promo small { color: var(--muted); }
.svc-promo-go { margin-inline-start: auto; font-size: 1.6rem; color: var(--red); line-height: 1; }

@media (max-width: 560px) {
  .svc-ops { grid-template-columns: repeat(2, 1fr); }
  .svc-bal-box { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .svc-op, .svc-promo { transition: none; } .svc-op:hover, .svc-promo:hover { transform: none; } }

/* رابط المحفظة في قايمة الموبايل (☰) بس */
.nav-links .nav-mobile-only { display: none; }
.nav-bal { display: inline-block; margin-inline-start: .35rem; padding: .05rem .55rem; border-radius: 999px; background: var(--red-soft); color: var(--badge-text); font-size: .82rem; font-weight: 800; }
@media (max-width: 980px) {
  .nav-links .nav-mobile-only { display: flex; align-items: center; justify-content: space-between; }
}

/* إدارة الخدمات */
.svc-edit { margin-top: 1rem; padding: 1rem; border-radius: 14px; background: var(--cream-alt); border: 1px solid var(--line); }
.svc-edit .form-row[hidden] { display: none; }
.svc-row-on td { background: var(--red-tint) !important; }
.svc-toggle { cursor: pointer; font: inherit; font-size: .8rem; }
.svc-del { color: var(--danger-text); border-color: var(--danger-line); }
.svc-op-name { text-align: center; line-height: 1.35; }
.svc-op-brand { font-size: .72rem; color: var(--muted); margin-top: -.2rem; }

/* الفواتير والخدمات اللي مبلغها من الاستعلام */
.form-row[hidden], .vf-quick[hidden], .svc-inq-hint[hidden] { display: none !important; }
.svc-inq-hint { margin: 0; padding: .55rem .8rem; border-radius: 10px; background: var(--gray-soft); color: var(--ink); font-size: .88rem; }
.vf-summary .svc-detail { align-items: flex-start; }
.vf-summary .svc-detail b { font-weight: 600; font-size: .9rem; text-align: left; max-width: 65%; overflow-wrap: anywhere; }
.svc-reamount { margin-top: .8rem; }
.svc-reamount summary { cursor: pointer; font-weight: 700; color: var(--red-dark); }
.svc-reamount-form { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.svc-reamount-form input { flex: 1 1 160px; padding: .55rem .8rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--field); color: var(--text); font: inherit; }
.svc-od { margin-top: .3rem; font-size: .78rem; color: var(--muted); }
.svc-od summary { cursor: pointer; color: var(--red-dark); }
.svc-od div { margin-top: .2rem; white-space: normal; }
.vf-summary .svc-detail b, .svc-od div { unicode-bidi: plaintext; text-align: start; }

/* مربعات الخدمات: أصغر عشان يبان منها كتير */
.svc-ops { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.svc-op { padding: .6rem .35rem .55rem; gap: .25rem; border-radius: 14px; }
.svc-op-dot { width: 34px; height: 34px; font-size: .95rem; }
.svc-op-name { font-size: .85rem; }
.svc-op-brand { font-size: .68rem; }
@media (max-width: 560px) {
  .svc-ops { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .svc-op { padding: .5rem .25rem .45rem; }
  .svc-op-dot { width: 30px; height: 30px; font-size: .85rem; }
  .svc-op-name { font-size: .78rem; }
  .svc-op:has(input:checked)::after { width: 17px; height: 17px; font-size: .62rem; top: .25rem; inset-inline-end: .3rem; }
}
.svc-picked { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem .8rem; border-radius: 10px; background: var(--red-tint); border: 1px solid var(--pink-line); font-size: .9rem; }
.svc-picked b { color: var(--red-dark); }
.svc-picked button { font: inherit; font-size: .82rem; font-weight: 700; color: var(--red); background: none; border: 0; cursor: pointer; text-decoration: underline; }

/* كروت الشحن بسعر ثابت + فلتر الشركات */
.svc-op-price { font-size: .78rem; font-weight: 800; color: var(--op); background: color-mix(in srgb, var(--op) 12%, transparent); padding: .05rem .55rem; border-radius: 999px; }
.svc-filter { display: flex; gap: .4rem; flex-wrap: wrap; }
.svc-filter .cf-chip.is-on { background: var(--op, var(--red)); border-color: var(--op, var(--red)); color: #fff; }
.svc-op[hidden] { display: none !important; }

/* أرقام ادفعلي (للتبليغ عن مشكلة) */
.svc-refs { display: inline-grid; gap: .35rem; margin-top: .8rem; padding: .6rem .9rem; border-radius: 12px; background: var(--field); border: 1px dashed var(--line-strong); text-align: start; }
.svc-refs div { display: flex; justify-content: space-between; gap: 1.2rem; align-items: center; }
.svc-refs span { color: var(--muted); font-size: .82rem; }
.svc-refs b { font-size: 1.05rem; letter-spacing: .04em; -webkit-user-select: all; user-select: all; }
.svc-refs small { color: var(--muted); font-size: .76rem; }
.svc-ref-cell { white-space: nowrap; }

/* شريط تقدم رفع الفيديو (للدكتور) */
.cu-box { padding: .8rem 1rem; border-radius: 12px; background: var(--field); border: 1px solid var(--line-strong); }
.cu-box[hidden] { display: none; }
.cu-head, .cu-foot { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.cu-pct { font-size: 1.4rem; color: var(--red); font-variant-numeric: tabular-nums; }
.cu-stat, .cu-eta { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.cu-msg { font-size: .88rem; font-weight: 600; }
.cu-track { height: 12px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; margin: .5rem 0; }
.cu-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--red), var(--red-dark)); transition: width .4s ease; }
.cu-done .cu-fill { background: var(--ok); }
.cu-done .cu-pct { color: var(--ok-text); }
.cu-error { border-color: var(--danger-line); background: var(--danger-soft); }
.cu-error .cu-msg { color: var(--danger-text); }
@media (prefers-reduced-motion: reduce) { .cu-fill { transition: none; } }

/* ===== كتالوج الخدمات (بحث + تصنيفات + أكتر من خانة) ===== */
.svc-search-row { margin: 0; }
.svc-search-row input { width: 100%; }
.svc-filter { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .35rem; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.svc-filter .cf-chip { white-space: nowrap; flex: 0 0 auto; }
.svc-empty { color: var(--muted); text-align: center; margin: .4rem 0; }
.svc-fields { display: grid; gap: .6rem; align-content: start; }
.svc-op-brand { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: center; }
.svc-groups { margin-top: .8rem; border: 1px solid var(--border, var(--line)); border-radius: 12px; padding: .5rem .8rem; }
.svc-groups > summary { cursor: pointer; font-weight: 800; }
.svc-group-head td { background: var(--red-tint); }
.svc-bulk { white-space: nowrap; }
.svc-bulk .btn { margin-inline-end: .2rem; }
.svc-fields-view { display: flex; flex-wrap: wrap; gap: .4rem; }
.svc-fields-view span { padding: .3rem .6rem; border-radius: 8px; background: var(--red-tint); font-size: .85rem; }
.svc-test { margin-top: 1rem; padding: .8rem; border: 1px dashed var(--pink-line); border-radius: 12px; }

/* ===== لوحة المدير: تجربة المساعد الذكي ===== */
.ai-test-reply { margin-top: .8rem; padding: .9rem 1rem; border-radius: 12px; background: var(--red-tint); line-height: 1.8; white-space: normal; }

/* =====================================================================
   تطبيق المنصة (PWA): رسالة التثبيت + نافذة الخطوات + التنبيهات
   ===================================================================== */
.nav-links .nav-pwa {
  background: none; border: 0; font: inherit; font-weight: 700; font-size: .95rem; color: var(--ink);
  cursor: pointer; text-align: start; padding: .55rem .4rem; border-radius: 8px;
}
.nav-links .nav-pwa:hover { background: var(--red-soft); color: var(--red); }
.nav-links .nav-pwa[hidden] { display: none !important; }
.footer-app { display: flex; gap: .5rem; flex-wrap: wrap; }
.footer-app button[hidden] { display: none; }
.footer-app .btn-app { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.footer-app .btn-app:hover { background: rgba(255,255,255,.2); }

.pwa-banner {
  position: fixed; z-index: 80; inset-inline: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  margin-inline: auto; max-width: 460px;
  display: grid; grid-template-columns: auto 1fr; gap: .35rem .85rem; align-items: center;
  padding: 1rem 1rem .95rem; padding-inline-start: 1rem; padding-inline-end: 2.3rem;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 44px rgba(59,52,46,.22), 0 2px 6px rgba(59,52,46,.08);
  opacity: 0; transform: translateY(24px); transition: opacity .3s ease, transform .3s cubic-bezier(.2,.9,.3,1.2);
}
.pwa-banner.is-on { opacity: 1; transform: none; }
.pwa-banner img { width: 56px; height: 56px; border-radius: 14px; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.1); grid-row: span 1; }
.pwa-banner-txt strong { display: block; font-size: 1rem; font-weight: 800; color: var(--ink); line-height: 1.4; }
.pwa-banner-txt span { display: block; font-size: .86rem; color: var(--muted); line-height: 1.65; margin-top: .15rem; }
.pwa-banner-actions { grid-column: 1 / -1; display: flex; gap: .5rem; margin-top: .45rem; }
.pwa-banner-actions .btn { flex: 1; justify-content: center; }
.pwa-bell { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 1.7rem; background: var(--red-soft); }
.pwa-x {
  position: absolute; top: .45rem; inset-inline-end: .45rem; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); font-size: .95rem; cursor: pointer; line-height: 1;
}
.pwa-x:hover { background: var(--red-soft); color: var(--red); }
.pwa-x:focus-visible, .nav-links .nav-pwa:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
/* الرسالة ظاهرة على الموبايل → الأزرار العايمة تختفي لحظياً عشان متتغطاش */
@media (max-width: 640px) {
  body.pwa-banner-on .floating-wa, body.pwa-banner-on .ai-fab, body.pwa-banner-on .fh-fab { opacity: 0; pointer-events: none; }
  .pwa-banner { inset-inline: .6rem; }
}

.pwa-sheet-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(31,27,24,.5);
  display: flex; align-items: flex-end; justify-content: center; padding: 1rem;
  animation: pwaFade .2s ease;
}
.pwa-sheet {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 2rem); overflow: auto;
  background: var(--card); color: var(--ink); border-radius: 20px; padding: 1.2rem 1.2rem 1.1rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); margin-bottom: env(safe-area-inset-bottom, 0px);
  animation: pwaUp .28s cubic-bezier(.2,.9,.3,1.1);
}
@media (min-width: 641px) { .pwa-sheet-back { align-items: center; } }
.pwa-sheet-head { display: flex; align-items: center; gap: .7rem; padding-inline-end: 2rem; }
.pwa-sheet-head img { border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.pwa-sheet-head strong { font-size: 1.08rem; font-weight: 800; }
.pwa-sheet-intro { color: var(--muted); font-size: .92rem; line-height: 1.75; margin: .8rem 0 0; }
.pwa-steps { list-style: none; margin: .9rem 0 1rem; padding: 0; display: grid; gap: .6rem; counter-reset: s; }
.pwa-steps li {
  display: flex; gap: .75rem; align-items: center; padding: .7rem .8rem; border-radius: 14px;
  background: var(--cream-alt); border: 1px solid var(--line); font-size: .93rem; line-height: 1.7;
}
.pwa-step-ic {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--card); color: var(--red); border: 1px solid var(--line); font-size: 1.05rem; font-weight: 800;
}
.pwa-sheet-ok { width: 100%; justify-content: center; }
body.pwa-sheet-open { overflow: hidden; }

.pwa-toast {
  position: fixed; z-index: 95; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 420px); padding: .75rem 1.1rem; border-radius: 14px;
  background: var(--footer-bg, #3B342E); color: #fff; font-weight: 700; font-size: .92rem; text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.25); transition: opacity .25s ease, transform .25s ease;
}
.pwa-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@keyframes pwaFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pwaUp { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pwa-banner, .pwa-toast { transition: none; }
  .pwa-sheet, .pwa-sheet-back { animation: none; }
}
/* جوه التطبيق المتثبت: مسافة للشريط اللي فوق في الآيفون */
@media (display-mode: standalone) {
  .site-header { padding-top: env(safe-area-inset-top, 0px); }
}
@media print { .pwa-banner, .pwa-sheet-back, .pwa-toast { display: none !important; } }
/* معاينة شكل الإشعار في صفحة المدير */
.notif-preview {
  display: flex; gap: .75rem; align-items: flex-start; max-width: 420px; padding: .8rem .9rem;
  border-radius: 16px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(59,52,46,.1);
}
.notif-preview img { border-radius: 10px; flex: 0 0 auto; }
.notif-preview small { display: block; color: var(--muted); font-size: .75rem; }
.notif-preview b { display: block; font-size: .95rem; color: var(--ink); margin: .1rem 0; }
.notif-preview span { display: block; font-size: .88rem; color: var(--text); line-height: 1.6; }
html[data-theme="dark"] .notif-preview { background: var(--card); }
[hidden].form-row { display: none !important; }

/* ===== جرس الإشعارات ===== */
.nav-bell { position: relative; }
.bell-badge {
  position: absolute; top: -4px; inset-inline-end: -4px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 800; line-height: 19px;
  text-align: center; box-shadow: 0 0 0 2px var(--header-bg, #fff); font-variant-numeric: tabular-nums;
}
.inbox-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.inbox-head [hidden] { display: none; }
.inbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.inbox-item {
  display: flex; gap: .85rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); transition: border-color .2s ease, transform .2s ease;
}
.inbox-item:hover { border-color: var(--red); transform: translateY(-1px); }
.inbox-item.is-new { background: var(--red-tint); border-color: var(--red-soft); border-inline-start: 4px solid var(--red); }
html[data-theme="dark"] .inbox-item.is-new { background: var(--red-soft); }
.inbox-ic { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; background: var(--cream-alt); border: 1px solid var(--line); }
.inbox-txt { display: grid; gap: .2rem; min-width: 0; }
.inbox-txt b { font-size: .98rem; line-height: 1.5; }
.inbox-txt span { color: var(--text); font-size: .9rem; line-height: 1.7; }
.inbox-txt small { color: var(--muted); font-size: .8rem; }
.inbox-dot { display: inline-block; margin-inline-start: .35rem; padding: 0 .5rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 800; vertical-align: middle; line-height: 1.6; }
.inbox-empty { display: grid; justify-items: center; gap: .35rem; padding: 2.6rem 1rem; border-radius: 18px; background: var(--card); border: 1px dashed var(--line-strong); text-align: center; }
.inbox-empty div { font-size: 2.4rem; }
.inbox-empty span { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .inbox-item { transition: none; } .inbox-item:hover { transform: none; } }
/* الهيدر على الموبايل: اللوجو والاسم ياخدوا المساحة الفاضية بس، والأزرار (الجرس + البحث + الوضع + القايمة) تفضل في نفس السطر */
@media (max-width: 980px) { .brand { flex: 1 1 0; } }
@media (max-width: 420px) {
  .nav-tools { gap: .35rem; }
  .nav-tools .theme-toggle, .nav-tools .nav-toggle { width: 38px; height: 38px; }
  .nav-tools .theme-toggle svg { width: 18px; height: 18px; }
  .brand { gap: .5rem; }
}
@media (max-width: 420px) {
  .brand > div { min-width: 0; overflow: hidden; }
  .brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 360px) { .brand img { width: 38px; height: 38px; } .brand strong { font-size: .98rem; } }
