/*
   DashCast — أنماط الواجهة. بلا خطوة بناء: ورقة واحدة تُقرأ.

   نظام التصميم منتزَعٌ من صفحة الهبوط (`landing.blade.php`) لا مخترَعٌ هنا:
   ليلُ البطل ونيليُّه، والتدرّج نيليّ ← سماويّ ← نعناعيّ، وبطاقاتٌ بيضاء
   بحدٍّ رماديّ يكاد لا يُرى. فاللوحة التي يُريها الهبوطُ للزائر هي اللوحة
   التي يجدها حين يدخل — لا شقيقةٌ لها تشبهها من بعيد.

   والألوان كلّها متغيّرات على `:root`: لونٌ يُكتب بالرقم في قاعدتين يفترق
   عن نفسه عند أول تعديل.
*/

:root {
  /* الليل — السايدبار وصفحة الدخول ورأس اللوحة */
  --night: #050816;
  --night-2: #0a1026;
  --side: #0e1330;
  --side-ink: #eef2ff;
  --side-muted: #aab4d6;

  /* النهار — المحتوى */
  --bg: #f6f7fc;
  --card: #ffffff;
  --ink: #0b1020;
  --ink-2: #283048;
  --muted: #5d6680;          /* ٥٫٩:١ على الأبيض — نصٌّ يُقرأ لا زخرفة */
  --faint: #8a92ab;          /* للزخرفة وحدها: لا يحمل معنى يُفقد إن لم يُرَ */
  --line: #e8eaf2;
  --line-2: #f0f1f6;
  --line-strong: #dcdfea;
  --hover: #f8f9fe;

  /* العلامة */
  --indigo: #6366f1;
  --indigo-d: #4f46e5;
  --indigo-dd: #4338ca;
  --indigo-soft: #eef0ff;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --cyan-d: #0891b2;
  --mint: #6ee7b7;
  --grad: linear-gradient(100deg, #818cf8 0%, #22d3ee 50%, #6ee7b7 100%);
  --grad-btn: linear-gradient(135deg, #6366f1 0%, #4f46e5 40%, #0891b2 100%);

  /* الحالات — لكلٍّ لونُ نصٍّ وخلفية، والنصّ يجتاز ٤٫٥:١ على خلفيته */
  --ok: #047857;      --ok-bg: #dcfce7;      --ok-line: #a7f3d0;
  --bad: #b91c1c;     --bad-bg: #fee2e2;     --bad-line: #fecaca;
  --run: #4338ca;     --run-bg: #eef0ff;     --run-line: #c7d2fe;
  --wait: #0e7490;    --wait-bg: #e0f7fa;    --wait-line: #a5f3fc;
  --warn: #92400e;    --warn-bg: #fef3c7;    --warn-line: #fcd34d;
  --idle: #5d6680;    --idle-bg: #f1f2f7;

  /* أسماءٌ قديمة تُبقى لما يشير إليها */
  --brand: var(--indigo);
  --brand-dark: var(--indigo-d);
  --busy: var(--run);

  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -18px rgba(15, 23, 42, .18);
  --shadow-lg: 0 30px 60px -30px rgba(15, 23, 42, .3);
  --ring: 0 0 0 4px rgba(99, 102, 241, .16);

  --font: "IBM Plex Sans Arabic", "Inter", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-latin: "Inter", "IBM Plex Sans Arabic", system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/*
   ⚠️ لا `letter-spacing` سالباً في أي قاعدة تمسّ نصّاً عربياً: التباعد يُدخل
   فراغاً بين الحروف المتّصلة فيقطع وصلها. والسالب منه مسموحٌ على اللاتيني
   وحده (`.nm` و`.v`) حيث يُكتب الرقم أو الاسم بالإنجليزية.
*/
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--indigo-d); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* حلقةُ التركيز واحدةٌ في الشاشة كلّها — تُرى ولا تُخمَّن. */
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 6px; }

::selection { background: rgba(99, 102, 241, .22); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── الترويسة ─────────────────────────────────────────────── */
header.top {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
header.top .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .dot { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #818cf8, #22d3ee);
  display: grid; place-items: center; color: #fff; font-size: 16px; }
.spacer { margin-inline-start: auto; }

/* ── البطاقات ─────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card.pad { padding: 22px; }

h1 { font-size: 26px; margin: 26px 0 6px; font-weight: 700; line-height: 1.35; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 700; line-height: 1.45; color: var(--ink); }
.lede { color: var(--muted); margin: 0 0 22px; }

/* رأس بطاقة: عنوانٌ يميناً وما يخصّه يساراً، وحدٌّ يفصله عن جسمها. */
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.card-head h2 { margin: 0; }
.card-head .sp { margin-inline-start: auto; }
.count {
  font-family: var(--font-latin); font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--idle-bg); padding: 1px 9px; border-radius: 999px;
}

/* ── الأزرار ──────────────────────────────────────────────── */
/*
 * ارتفاعٌ أدنى لا ارتفاعٌ مقطوع: الزرّ يصطفّ مع الحقول (٤٠ بكسلاً) حين يكون
 * سطراً واحداً — وهو الغالب — ويتمدّد إن لفَّ نصُّه سطرين على شاشةٍ ضيّقة
 * بدل أن يفيض خارج حدّه.
 *
 * ومنقولٌ عن `.ui-btn` في الهبوط: أبيضُ بحدٍّ خفيف، والأساسيُّ وحده يتوهّج.
 * زرٌّ متوهّجٌ واحد في الشاشة يقول «هذا ما جئت له» — وثلاثةٌ لا تقول شيئاً.
 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2);
  padding: 8px 16px; min-height: 40px; line-height: 1.2;
  border-radius: 10px; font: inherit; font-weight: 600; font-size: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: background .15s, border-color .15s, box-shadow .2s, transform .15s, color .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:hover { background: var(--hover); border-color: #c9cddd; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: var(--grad-btn); border-color: transparent; color: #fff;
  box-shadow: 0 10px 26px -12px rgba(99, 102, 241, .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.primary:hover { background: var(--grad-btn); filter: brightness(1.06); box-shadow: 0 14px 32px -12px rgba(99, 102, 241, 1), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; border-radius: 9px; }
.btn:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ── الأنظمة والدورات (`admin/systems`) ──
 * كلُّ نظامٍ بطاقة: رأسٌ برمزه وحاله وأفعاله، ودوراته صفوفٌ تحته. والطيّ
 * يُخفي الصفوف ويُبقي الرأس، والبحث يفتح المطويّ ليُرى ما طابق. */
.sys-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.sys-search { position: relative; flex: 1; max-width: 380px; margin: 0; }
.sys-search svg { position: absolute; inset-inline-start: 12px; top: 50%; width: 16px; height: 16px;
  transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.sys-search input { width: 100%; padding-inline-start: 36px; }
.sys-none { margin: 0 0 14px; }
.sys-list { display: grid; gap: 16px; }
.sys { overflow: hidden; }
.sys[hidden], .crs[hidden] { display: none; }
.sys-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; flex-wrap: wrap; }
.sys-toggle { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--faint);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background .15s, color .15s; }
.sys-toggle:hover { background: var(--hover); color: var(--ink-2); }
.sys-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.sys.folded:not(.searching) .sys-toggle svg { transform: rotate(-90deg); }
[dir="rtl"] .sys.folded:not(.searching) .sys-toggle svg { transform: rotate(90deg); }
.sys-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 23px; flex-shrink: 0; }
.sys-id { flex: 1; min-width: 200px; }
.sys-id h2 { margin: 0 0 5px; font-size: 16.5px; }
.sys-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.sys-meta .sys-tag { color: var(--muted); }
.sys-acts, .crs-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sys-body { border-top: 1px solid var(--line-2); background: #fbfbfe; padding: 6px 0; }
.sys.folded:not(.searching) .sys-body { display: none; }
.crs { display: grid; grid-template-columns: 30px minmax(0, 1fr) 170px 150px auto; align-items: center; gap: 14px;
  padding: 11px 18px 11px 22px; }
[dir="rtl"] .crs { padding: 11px 22px 11px 18px; }
.crs + .crs { border-top: 1px dashed var(--line); }
.crs:hover { background: #fff; }
.crs-n { width: 26px; height: 26px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.crs-id { min-width: 0; }
.crs-id .nm { font-weight: 700; color: var(--ink); }
.crs-id .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crs-live { font-size: 13px; display: grid; gap: 5px; }
.crs-bar { display: block; height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.crs-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad-btn); }
.crs .badge { justify-self: start; }
.crs-acts { justify-content: flex-end; }
.crs-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 8px 18px; padding: 14px 16px; border: 1.5px dashed var(--line-strong); border-radius: 12px;
  color: var(--muted); font-size: 13.5px; }
@media (max-width: 900px) {
  .crs { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .crs-live { grid-column: 2; grid-row: 2; }
  .crs .badge { grid-column: 3; grid-row: 1; justify-self: end; }
  .crs-acts { grid-column: 2 / -1; grid-row: 3; justify-content: flex-start; }
  .sys-acts { width: 100%; }
}

/* ── منتقي رمز النظام (`partials/system-fields`) ── أزرار راديو مخفيّة خلف الرمز نفسه. */
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px;
  max-height: 156px; overflow-y: auto; padding: 2px; }
.icon-pick label { position: relative; margin: 0; cursor: pointer; }
.icon-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-pick span { display: grid; place-items: center; height: 42px; border-radius: 10px; font-size: 20px;
  border: 1px solid var(--line-strong); background: #fff; transition: border-color .15s, background .15s, transform .15s; }
.icon-pick label:hover span { background: var(--hover); border-color: #c9cddd; }
.icon-pick input:checked + span { border: 2px solid var(--indigo); background: var(--indigo-soft); transform: scale(1.04); }
.icon-pick input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ── المشاركة (`partials/share`) ── قائمةٌ تنسدل من الزرّ، بلا سكربتٍ لفتحها. */
.share { position: relative; display: inline-block; }
.share[hidden] { display: none; }
.share > summary { list-style: none; user-select: none; }
.share > summary::-webkit-details-marker { display: none; }
.share[open] > summary { border-color: var(--indigo); background: var(--indigo-soft); }
.share-menu { position: absolute; z-index: 30; inset-inline-end: 0; top: calc(100% + 8px);
  width: min(340px, calc(100vw - 32px)); padding: 12px; border-radius: 14px; text-align: start;
  border: 1px solid var(--line-strong); background: var(--card);
  box-shadow: 0 24px 50px -20px rgba(5, 8, 22, .45); }
.share-copy { display: flex; gap: 8px; }
.share-copy input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--muted); font: inherit; font-size: 13px; }
.share-nets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.share-nets a { padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff;
  color: var(--ink-2); font-size: 13px; font-weight: 600; }
.share-nets a:hover { border-color: var(--indigo); color: var(--indigo-d); text-decoration: none; }

/* ── الشارات ──────────────────────────────────────────────── */
/*
 * لكل حالةٍ لونٌ لا تشاركها فيه أخرى — والمعنى قبل الجمال:
 *
 *   مسودة       رماديّ            لم يبدأ شيء.
 *   في الطابور  سماويّ، نقطةٌ جوفاء  ينتظر دوره — لا يعمل بعد.
 *   قيد الإنتاج نيليّ، نقطةٌ تنبض    يعمل الآن.
 *   جاهز        أخضر             أُنتج.
 *   أخفق        أحمر             توقّف بخطأ.
 *   ناقص / قديم  كهرمانيّ          بين النجاح والإخفاق — لأنه بينهما.
 *   منشور       أخضرُ مُصمَت بعلامة  أمام العميل — غير «جاهز» الذي لا يراه أحد.
 *
 * والطابورُ والإنتاج يتقاسمان النبرة `busy` في المتحكّم وفي استطلاع صفحة
 * الدرس، فيفترقان هنا بـ`data-status` لا بنبرةٍ جديدة يجهلها الخادم.
 */
.badge {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.6;
  white-space: nowrap; border: 1px solid transparent;
}
.badge.ok, .badge.bad, .badge.busy, .badge.idle { gap: 7px; }
.badge.ok::before, .badge.bad::before, .badge.busy::before, .badge.idle::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.badge.ok   { background: var(--ok-bg);   color: var(--ok); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }
.badge.busy { background: var(--run-bg);  color: var(--run); }
.badge.idle { background: var(--idle-bg); color: var(--idle); }
.badge.idle::before { opacity: .55; }
.badge.busy::before { animation: pulse-ring 1.4s ease-out infinite; box-shadow: 0 0 0 0 rgba(67, 56, 202, .5); }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(67, 56, 202, .45); } 80%, 100% { box-shadow: 0 0 0 6px rgba(67, 56, 202, 0); } }

/* في الطابور: ينتظر ولا يعمل — نقطةٌ جوفاء ساكنة. */
.badge.busy[data-status="queued"] { background: var(--wait-bg); color: var(--wait); }
.badge.busy[data-status="queued"]::before {
  background: transparent; box-shadow: inset 0 0 0 1.6px currentColor; animation: none; width: 7px; height: 7px;
}

/* منشور: مُصمَتٌ بعلامة صحّ — يُرى من بعيد أنه أمام العميل. */
.badge.live { background: var(--ok); color: #fff; gap: 5px; }
.badge.live::before {
  content: ''; width: 11px; height: 11px; border-radius: 0; box-shadow: none; animation: none; opacity: 1;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/contain no-repeat;
}
/* منشورٌ بنسخةٍ قديمة: كهرمانٌ بحدٍّ متقطّع — منشورٌ، لكن لا كما ينبغي. */
.badge.live.stale { background: var(--warn-bg); color: var(--warn); border: 1px dashed #d97706; }
.badge.live.stale::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7'/%3E%3C/svg%3E");
}

/* ── الجدول ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: start; border-bottom: 1px solid var(--line-2); vertical-align: middle; }

/*
 * الجدول يتمرّر داخل حدوده، لا تتمدّد الصفحة كلّها.
 *
 * جدولُ الفيديوهات سبعة أعمدة وآخرها أربعة أزرار — وبلا هذا الغلاف يدفع
 * الصفحة عرضاً على الشاشات الضيّقة، فيصير التمرير الأفقي للنافذة كلّها:
 * تزحف الترويسة والقائمة الجانبية معه ويضيع التخطيط.
 *
 * و`.scroll-x.fit` للجداول الأقصر: تتمرّر على الهاتف ولا تُفرَض عليها
 * ثمانمئة بكسل على الحاسوب.
 */
.scroll-x { overflow-x: auto; }
.scroll-x > table { min-width: 880px; }
.scroll-x.fit > table { min-width: 620px; }
th {
  font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap;
  background: #fafbfe; padding-top: 11px; padding-bottom: 11px;
}
thead tr:first-child th:first-child { border-start-start-radius: inherit; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--hover); }
td .muted { font-size: 12.5px; line-height: 1.55; }
td a { color: var(--ink); }
td a:hover { color: var(--indigo-d); }
td > .badge + .badge { margin-inline-start: 4px; }

/* اسمٌ ورمزُ نظامٍ بجانبه — خليّة الصفّ الأولى في أكثر الجداول. */
.cell-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-id > div { min-width: 0; }
.cell-id b, .cell-id .nm { font-weight: 700; color: var(--ink); }

/* ── شريط إجراءات الصفّ — رموزٌ لا نصوص ─────────────────── */
/*
 * كان العمود أربعةَ أزرارٍ نصّية: عروضُها مختلفة لاختلاف كلماتها، وحدودُها
 * أربعة، وألوانُها — أزرقُ «أنتج» وأحمرُ «احذف» وأحمرُ «إلغاء النشر» — تتناثر
 * في كل صفّ، ثم تلتفّ سطرين إن ضاق العمود. فصار أضجَّ ما في الجدول وأقلَّه
 * قابليةً للمسح بالعين، والجدولُ إنما يُقرأ بالمسح.
 *
 * والعلاج مربّعاتٌ متساوية، في كلٍّ منها رمزٌ واحد. فالعروضُ تتساوى حتماً —
 * إذ لم يبقَ نصٌّ يطول ويقصر — ويقف كلُّ فعلٍ في موضعه من كل صفّ، فتتعلّمه
 * العينُ مرّةً ثم تقصده بلا قراءة. واللونُ يظهر عند الحوم لا قبله، فلا يزاحم
 * ألوانَ الحالات في الأعمدة الأخرى وهي التي تستحقّ أن تُرى.
 *
 * (جهاتٌ منطقية — `dir` على الجذر يتبع اللغة.)
 */
.row-actions { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
/* فجوةٌ قبل الحذف: الفعل الذي لا يُتراجَع عنه لا يُلاصِق ما قبله. */
.row-actions .act.del { margin-inline-start: 6px; }

.act {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--muted); cursor: pointer;
  font: inherit; line-height: 1;
  transition: background .14s, color .14s, border-color .14s, box-shadow .14s;
}
.act:hover { background: var(--hover); border-color: var(--line-strong); color: var(--ink); text-decoration: none; z-index: 3; }
.act:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; z-index: 3; }

/* نبرةُ كل فعل — رماديةٌ ساكنة، تتلوّن عند الحوم وحده. */
.act.go:hover   { background: var(--indigo-soft); border-color: var(--run-line); color: var(--indigo-dd); }
.act.run:hover  { background: #ecfdf5; border-color: var(--mint); color: var(--ok); }
.act.pub:hover  { background: #ecfeff; border-color: var(--wait-line); color: var(--wait); }
.act.warn:hover { background: #fffbeb; border-color: var(--warn-line); color: #b45309; }
.act.bad:hover  { background: #fef2f2; border-color: #fca5a5; color: var(--bad); }

.act[disabled] { color: #c3c8d6; background: #fafbfe; cursor: not-allowed; }
.act[disabled]:hover { background: #fafbfe; border-color: var(--line); color: #c3c8d6; }

/*
 * الاسم يظهر عند التأشير وحده — لافتةٌ ليلية فوق الزرّ.
 *
 * ⚠️ **فوقه** لا تحته: الجدول داخل `.scroll-x`، وهو يقصّ ما خرج عنه رأسياً
 * أيضاً (التمرير في محورٍ يُصيّر الآخر `auto` لا `visible`). واللافتةُ فوق
 * الزرّ تقع في مساحة الصفّ الذي قبله — أو في ترويسة الجدول إن كان الصفُّ
 * أوّلَ الصفوف — وكلاهما داخل الحاوية. أما تحته فتُقَصُّ في الصفّ الأخير.
 *
 * ⚠️ و**تتمدّد نحو بداية السطر** لا من المنتصف: عمود الإجراءات آخرُ الأعمدة، وهو في
 * RTL أقصى اليسار. فلافتةٌ موسَّطةٌ فوق زرٍّ عرضه ٣٤ بكسلاً يفيض نصفُها خارج
 * حدّ الجدول فيُقَصّ. وحين تُثبَّت حافتُها اليسرى عند الزرّ تنمو نحو داخل
 * الجدول — حيث المتّسع دائماً.
 *
 * ولا يُعتمد على `title`: يتأخّر قرابة الثانية ويرسمه النظامُ بخطّه، ونحن
 * نريد الاسم فوريّاً. ومع ذلك يُكتب `aria-label` لقارئ الشاشة.
 */
.act::after, .act::before {
  opacity: 0; pointer-events: none; position: absolute; z-index: 20;
  transform: translateY(4px);
  transition: opacity .13s ease, transform .13s ease;
}
.act::after {
  content: attr(data-tip);
  inset-inline-end: -4px; bottom: calc(100% + 8px);
  background: var(--side); color: #fff; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 1.45;
  padding: 5px 10px; border-radius: 8px;
  box-shadow: 0 10px 24px -8px rgba(5, 8, 22, .55);
}
.act::before {                                   /* سنُّ اللافتة — على منتصف الزرّ */
  content: ''; inset-inline-end: 11px; bottom: calc(100% + 3px);
  border: 5px solid transparent; border-top-color: var(--side);
}
.act:hover::after, .act:hover::before,
.act:focus-visible::after, .act:focus-visible::before {
  opacity: 1; transform: translateY(0);
}

/*
 * الرموز مُعرَّفةٌ مرّةً في `<symbol>` وتُستدعى بـ`<use>`.
 *
 * والتلوين بالوراثة: `stroke: currentColor` تنزل إلى شجرة `use` الظلّية،
 * فيأخذ الرمزُ لونَ زرّه في كل حالاته بلا قاعدةٍ لكل لون.
 */
.i {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.i.solid { fill: currentColor; stroke: none; }

/* ── شريط الترشيح ────────────────────────────────────────── */
/*
 * شبكةٌ لا صفٌّ مرن: الحقول تصطفّ أعمدةً بعروضٍ ثابتة تحت عناوينها، ولا
 * يتمدّد أحدها على حساب جاره حين يطول اسمُ دورة. والبحث أعرضُها لأنه
 * الحقل الذي يُكتب فيه.
 */
.filters { padding: 16px 18px; margin-bottom: 18px; }
.filters .grid {
  display: grid; gap: 12px 14px; align-items: end;
  grid-template-columns: minmax(200px, 1.6fr) minmax(170px, 1.2fr) repeat(3, minmax(125px, .9fr)) auto;
}
.filters .field { margin: 0; }
.filters .go { display: flex; gap: 8px; }
.filters .tally {
  margin: 14px 0 0; padding-top: 13px; border-top: 1px dashed var(--line);
}
.filters .tally b { color: var(--ink); font-family: var(--font-latin); }
@media (max-width: 1080px) {
  .filters .grid { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
  .filters .go { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .filters .grid { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child { grid-column: 1 / -1; }
  .filters .go .btn { flex: 1; }
}

/* ── الحقول ───────────────────────────────────────────────── */
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

/*
 * ⚠️ الأنواعُ كلُّها لا `text` وحده.
 *
 * كان المحدِّد `input[type=text]`، فحقلُ البحث — وهو `type=search` — يسقط إلى
 * شكل المتصفّح الخام: حدٌّ رماديّ رفيع وزوايا قائمة وزرُّ مسحٍ دائريّ، بين
 * قوائمَ مصمَّمةٍ حوله. وأظهرُ ما يكون ذلك في شريط الترشيح حيث يقف الخمسة
 * جنباً إلى جنب. والقاعدة: كلُّ حقلٍ نصّيٍّ يُكتب فيه يُعامَل معاملةً واحدة.
 */
input[type=text], input[type=search], input[type=password], input[type=email],
input[type=number], input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 10px;
  font: inherit; font-size: 14.5px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input[type=text], input[type=search], input[type=password], input[type=email],
input[type=number], input[type=url], input[type=date], select {
  height: 40px; padding-top: 0; padding-bottom: 0;   /* ارتفاعٌ واحد يصطفّ عليه الشريط */
}
input::placeholder, textarea::placeholder { color: var(--faint); }

input:hover, select:hover, textarea:hover { border-color: #c4c9da; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--indigo); box-shadow: var(--ring);
}
input[type=checkbox], input[type=radio] { accent-color: var(--indigo-d); }

/*
 * سهم القائمة — مرسومٌ لا متروكاً للمتصفّح.
 *
 * السهم الافتراضي يختلف بين المتصفّحات ويقف في **يمين** الحقل على بعض
 * محرّكات RTL فيصطدم بأول النصّ. والمرسومُ يقف يساراً دائماً، والحشوةُ
 * تُفرِغ له موضعه — في نهاية السطر، يساراً في RTL ويميناً في LTR.
 */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6680' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; background-size: 15px;
}
[dir="ltr"] select { background-position: right 12px center; }
select:hover { background-color: var(--hover); }

/* عدسةٌ داخل حقل البحث: تقول ما هو قبل أن يُقرأ عنوانه. */
input[type=search] {
  -webkit-appearance: none; appearance: none;
  padding-inline-start: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a92ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.8' cy='10.8' r='6.8'/%3E%3Cpath d='M20.2 20.2l-4.4-4.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
}
[dir="ltr"] input[type=search] { background-position: left 13px center; }
input[type=search]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; cursor: pointer; opacity: .4;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b1020' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center/contain no-repeat;
}
input[type=search]::-webkit-search-cancel-button:hover { opacity: .85; }

/* المحرّر ليليٌّ كشيفرة الهبوط: النصّ هنا شيفرةٌ تُقرأ لا فقرةٌ تُكتب. */
textarea.code {
  font: 13px/1.8 var(--mono);
  direction: ltr; text-align: left; min-height: 460px; resize: vertical;
  background: #0b1020; color: #c7d2fe; border-color: #1b2240;
  padding: 16px 18px; caret-color: #a5b4fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
textarea.code:hover { border-color: #2a3360; }
textarea.code:focus { border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(99, 102, 241, .25); }
textarea.code::placeholder { color: #5a648a; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.field + .field { margin-top: 16px; }

/* بادئةٌ ملتصقة بالحقل — نطاقُ الرابط قبل اسم المجلّد. */
.affix { display: flex; align-items: stretch; direction: ltr; }
.affix > span {
  display: flex; align-items: center; padding: 0 11px; white-space: nowrap;
  border: 1px solid var(--line-strong); border-right: 0; border-radius: 10px 0 0 10px;
  background: #fafbfe; color: var(--muted); font-size: 13px;
}
.affix > input { border-radius: 0 10px 10px 0; min-width: 0; flex: 1; }

/* مربّع اختيارٍ بعنوانه — سطرٌ واحد قابلٌ للنقر كلّه. */
.check-line {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 0;
  font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.check-line input { width: 17px; height: 17px; margin: 0; flex-shrink: 0; }

/* ── التنبيهات ────────────────────────────────────────────── */
.note {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 18px;
  font-size: 14px; font-weight: 500; border: 1px solid; line-height: 1.75;
  position: relative;
}
.note b { font-weight: 700; }
.note.ok  { background: #ecfdf5; border-color: var(--ok-line); color: #065f46; }
.note.err { background: #fef2f2; border-color: var(--bad-line); color: #991b1b; }
.note.info{ background: #f3f4ff; border-color: var(--run-line); color: #3730a3; }
/* الناقص لا الفاشل: كهرمانٌ بين خضرة النجاح وحمرة الإخفاق، لأنه بينهما. */
.note.warn{ background: #fffbeb; border-color: #fde68a; color: #92400e; }
.note a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* ── التقدّم والسجلّ ──────────────────────────────────────── */
.bar { height: 8px; background: #eef0f6; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #818cf8, #22d3ee); transition: width .5s ease; }
/* الشريط يملأ من اليمين — بداية السطر في RTL. */
[dir="rtl"] .bar > i { background: linear-gradient(270deg, #818cf8, #22d3ee); margin-right: 0; margin-left: auto; }
td .bar { height: 6px; margin-bottom: 5px; }

pre.log {
  background: #0b1020; color: #c7d2fe; padding: 16px 18px; border-radius: 12px;
  font: 12.5px/1.85 var(--mono);
  max-height: 340px; overflow: auto; margin: 0;
  direction: rtl; white-space: pre-wrap; word-break: break-word;
}
pre.log::-webkit-scrollbar, textarea.code::-webkit-scrollbar { width: 9px; }
pre.log::-webkit-scrollbar-thumb, textarea.code::-webkit-scrollbar-thumb { background: #2a3360; border-radius: 6px; }

video { width: 100%; border-radius: 12px; background: #000; display: block; }
/* لا يطول مشغّلٌ أكثر من الشاشة. وفيديو الموبايل (بالطول) يُضيَّق على قدر صورته ويتوسّط — بلا شرائط سوداء عريضة. `Video::isPortrait`. */
video { max-height: 72vh; }
video.portrait { width: auto; max-width: 100%; height: 72vh; aspect-ratio: 9 / 16; margin-inline: auto; }

/* ── فحص الجاهزية ─────────────────────────────────────────── */
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.chk.off { background: var(--bad-bg); color: var(--bad); }

/* ── النافذة المنبثقة ─────────────────────────────────────── */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(620px, 92vw); color: var(--ink);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .06), 0 40px 90px -30px rgba(5, 8, 22, .6);
}
dialog[open] { animation: dlg-in .22s var(--ease, ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog::backdrop { background: rgba(5, 8, 22, .6); backdrop-filter: blur(3px); }
dialog .head { padding: 18px 22px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff;
  border-radius: 18px 18px 0 0; }
dialog .head .sp { margin-inline-start: auto; }
dialog .body { padding: 22px; max-height: 65vh; overflow: auto; }
dialog .foot { padding: 14px 22px; border-top: 1px solid var(--line-2);
  display: flex; gap: 10px; justify-content: flex-start; background: #fafbfe;
  border-radius: 0 0 18px 18px; }
/* نموذج الحذف تحت التذييل — منطقة خطرٍ مفصولة لا زرٌّ بين «احفظ» و«إلغاء». */
dialog .danger-zone { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 22px 18px; border-top: 1px dashed var(--line); }
dialog .danger-zone form { margin: 0; }
dialog h3 { margin: 0; font-size: 17px; font-weight: 700; }
dialog .body h4 { margin: 20px 0 6px; font-size: 14.5px; font-weight: 700; color: var(--ink); }
dialog .body h4:first-child { margin-top: 0; }
dialog .body p, dialog .body li { font-size: 14px; color: var(--ink-2); }
dialog .body ol, dialog .body ul { padding-inline-start: 20px; margin: 6px 0; }
dialog .body details { margin: 12px 0; padding: 10px 14px; border-radius: 10px; background: #fafbfe; border: 1px solid var(--line); }
dialog .body summary { cursor: pointer; font-weight: 600; font-size: 14px; }

/* ── نافذة التأكيد — انظر `public/assets/confirm.js` ─────── */
/*
 * صغيرةٌ عمداً: سؤالٌ وزرّان، لا ترويسةَ ولا تذييلَ بحدود. والنبرة على
 * النافذة (`data-tone`) تلوّن الرمزَ وزرَّ التأكيد معاً.
 */
dialog.confirm { width: min(440px, calc(100vw - 32px)); background: var(--card); --tone: var(--bad); --tone-bg: var(--bad-bg); --tone-d: #991b1b; }
dialog.confirm[data-tone="warn"] { --tone: #b45309; --tone-bg: var(--warn-bg); --tone-d: #92400e; }
dialog.confirm form { margin: 0; }
dialog.confirm .cf-main { display: flex; gap: 16px; align-items: flex-start; padding: 24px 24px 20px; }
dialog.confirm .cf-ic {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tone-bg); color: var(--tone); box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone-bg) 45%, transparent);
}
dialog.confirm .cf-ic svg { width: 22px; height: 22px; }
dialog.confirm .cf-text { min-width: 0; padding-top: 2px; }
dialog.confirm h3 { font-size: 17px; line-height: 1.4; }
dialog.confirm p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
dialog.confirm .cf-foot {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 14px 24px; background: #fafbfe; border-top: 1px solid var(--line-2); border-radius: 0 0 18px 18px;
}
dialog.confirm .cf-ok { background: var(--tone); border-color: var(--tone); color: #fff; box-shadow: 0 8px 20px -10px var(--tone); }
dialog.confirm .cf-ok:hover { background: var(--tone-d); border-color: var(--tone-d); }
dialog.confirm .cf-ok:focus-visible { outline-color: var(--tone); }
@media (max-width: 480px) {
  dialog.confirm .cf-main { flex-direction: column; align-items: center; text-align: center; }
  dialog.confirm .cf-foot .btn { flex: 1; }
}

/* ── جدول الرموز في دليل الشاشة ─────────────────────────── */
/*
 * الرمزُ نفسه لا وصفُه: يُرى في الدليل كما يُرى في الصفّ، فيُربط به فوراً.
 * والمربّعُ حوله بحدّ الزرّ وقياسه ليكون الشبهُ تامّاً.
 */
.legend { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px 13px; margin: 10px 0 0; }
.legend .k {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--muted);
}
.legend > div { font-size: 14px; color: var(--ink-2); align-self: center; }

.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--mono); direction: ltr; display: inline-block; font-size: .92em; }
code { font-family: var(--mono); font-size: .9em; background: var(--idle-bg); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .em-ic {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--indigo-soft); color: var(--indigo-d);
}
.empty .em-ic svg { width: 24px; height: 24px; }
.empty .em-t { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.empty p { margin: 0 0 16px; }

@media (max-width: 960px) { .row { grid-template-columns: 1fr; } }

/* ── تبويبات التنقّل في الترويسة ─────────────────────────── */
.tabs { display: flex; gap: 4px; margin-inline-start: 10px; }
.tabs a { padding: 7px 13px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--muted); }
.tabs a:hover { background: var(--idle-bg); color: var(--ink); text-decoration: none; }
.tabs a.on { background: var(--indigo-soft); color: var(--indigo-dd); }

/* ── بطاقات المؤشّرات ───────────────────────────────────── */
/*
 * منقولةٌ عن `.kpi` في الهبوط: عنوانٌ صغير ثم رقمٌ كبير. والرقم لاتيني بخطّ
 * Inter ويُحاذى إلى بداية السطر — والمقياس تحته نسبةٌ حقيقية (المعروض من
 * الكلّ) يمرّرها المتحكّم، لا خطٌّ مرسومٌ للزينة.
 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.kpi-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-ic svg { width: 17px; height: 17px; }
.kpi .v { font-family: var(--font-latin); font-size: 30px; font-weight: 800; margin: 0; line-height: 1.15;
  letter-spacing: -.02em; color: var(--ink); }
.kpi .l { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.kpi .sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.meter { height: 5px; border-radius: 999px; background: #eef0f6; overflow: hidden; margin-top: 12px; display: flex; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--indigo)); }

/* ── سطر «ينتظر خطوة» ───────────────────────────────────── */
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line-2); }
.todo:last-child { border-bottom: 0; }
.todo a { font-weight: 700; color: var(--ink); }
.todo a:hover { color: var(--indigo-d); }
.todo .muted { flex: 1 1 200px; }

/* ── رمز النظام في الجدول ───────────────────────────────── */
.ico-sm { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 16px; flex-shrink: 0; }
.t-sky     { background: #e0f2fe; color: #0369a1; }
.t-violet  { background: #ede9fe; color: #6d28d9; }
.t-emerald { background: #d1fae5; color: #047857; }
.t-amber   { background: #fef3c7; color: #b45309; }
.t-rose    { background: #ffe4e6; color: #be123c; }
.t-slate   { background: #f1f2f7; color: #475569; }
.t-indigo  { background: var(--indigo-soft); color: var(--indigo-dd); }
.t-cyan    { background: #e0f7fa; color: #0e7490; }

header.top .wrap form { display: inline-flex; }

/* ── صندوق البرومبت ──────────────────────────────────────── */
.prompt-box {
  margin: 0; padding: 22px; max-height: 62vh; overflow: auto;
  background: #0b1020; color: #c7d2fe;
  font: 12.5px/1.95 var(--mono);
  white-space: pre-wrap; word-break: break-word;
  direction: rtl; text-align: right;
}
.prompt-box::-webkit-scrollbar { width: 9px; }
.prompt-box::-webkit-scrollbar-thumb { background: #2a3360; border-radius: 6px; }

/* ── رأس اللوحة: بطاقة البرومبت ليلاً ─────────────────────── */
/*
 * البطاقة الوحيدة الداكنة في المحتوى، ولها وحدها شفقُ الهبوط وشبكتُه.
 * ليلٌ في كل بطاقة يُطفئ الليل؛ وليلٌ واحد في رأس الصفحة يقول «ابدأ من هنا».
 */
.promo {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 20px; padding: 26px 28px; margin-bottom: 18px;
  border-radius: var(--radius-lg); text-decoration: none; color: #fff;
  background: radial-gradient(120% 160% at 100% 0%, #1e1b4b 0%, #0a1026 52%, #050816 100%);
  box-shadow: 0 30px 60px -36px rgba(79, 70, 229, .75), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  transition: transform .2s, box-shadow .2s;
}
.promo:hover { text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 36px 70px -36px rgba(79, 70, 229, .9), 0 0 0 1px rgba(255, 255, 255, .06) inset; }
.promo:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 3px; border-radius: var(--radius-lg); }
.promo > * { position: relative; z-index: 1; }
.promo > .sky, .promo > .grid-bg { position: absolute; z-index: 0; }
.promo .ico {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #22d3ee); color: #fff; font-size: 22px;
  flex-shrink: 0; box-shadow: 0 10px 28px -8px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.promo .ico svg { width: 24px; height: 24px; }
.promo .tx { flex: 1; min-width: 0; }
.promo .eyebrow { margin-bottom: 8px; }
.promo .tx b { display: block; font-size: 19px; font-weight: 700; color: #fff; margin-bottom: 4px; line-height: 1.4; }
.promo .tx > span:not(.eyebrow) { font-size: 14px; color: #aab4d6; line-height: 1.8; display: block; max-width: 640px; }
.promo .go {
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 12px;
  background: var(--grad-btn); box-shadow: 0 12px 30px -10px rgba(99, 102, 241, .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
@media (max-width: 700px) {
  .promo { flex-wrap: wrap; padding: 22px 20px; gap: 14px; }
  .promo .ico { width: 44px; height: 44px; border-radius: 13px; }
  .promo .go { width: 100%; justify-content: center; }
}

/* الشفق والشبكة — من البطل، أخفتُ منه، ولا يُرسمان إلا تحت الليل. */
.sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sky i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; animation: drift 22s ease-in-out infinite alternate; }
.sky i:nth-child(1) { width: 380px; height: 380px; background: #4338ca; top: -200px; right: -80px; }
.sky i:nth-child(2) { width: 320px; height: 320px; background: #0891b2; top: -160px; left: 8%; opacity: .32; animation-delay: -8s; }
.sky i:nth-child(3) { width: 340px; height: 260px; background: #9333ea; bottom: -200px; left: 40%; opacity: .22; animation-delay: -14s; }
@keyframes drift { to { transform: translate3d(40px, 30px, 0) scale(1.1); } }
.grid-bg { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 90% at 85% 0%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 60% 90% at 85% 0%, #000 20%, transparent 75%); }

/* عنوانٌ صغير فوق العنوان — بلا تباعد أحرف، فالنصّ عربي. */
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  padding: 3px 11px; border-radius: 999px;
  color: var(--indigo-d); background: rgba(99, 102, 241, .09); border: 1px solid rgba(99, 102, 241, .16);
}
.promo .eyebrow, .auth .eyebrow { color: #c7d2fe; background: rgba(129, 140, 248, .12); border-color: rgba(129, 140, 248, .25); }
.grad-t { background: linear-gradient(100deg, #a5b4fc 0%, #67e8f9 45%, #6ee7b7 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── اللوحة الرئيسية ─────────────────────────────────────── */
.dash { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.dash > * { min-width: 0; }
.stack { display: grid; gap: 18px; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }

/* صفٌّ في «قيد الإنتاج الآن» — اسمٌ وحالة وعدّاد، ثم شريطه أو سببُ انتظاره. */
.job { padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.job:last-child { border-bottom: 0; }
.job-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job-top a { font-weight: 700; color: var(--ink); }
.job-top .n { margin-inline-start: auto; font-family: var(--font-latin); }
.job .bar { margin-top: 10px; }
.queue-line { margin: 0; padding: 12px 20px; border-bottom: 1px solid var(--line-2); background: #fafbfe; }
.queue-line b { color: var(--ink-2); }

/* حلقة الجاهزية — نسبة الفحوص الناجحة، تُرسم من عددها لا تُزيَّن. */
.ring-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.ring { width: 64px; height: 64px; flex-shrink: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .trk { stroke: #eef0f6; }
.ring .val { stroke: var(--c, var(--indigo)); stroke-linecap: round; }
.ring-row b { font-family: var(--font-latin); font-size: 22px; font-weight: 800; display: block; line-height: 1.2; }
.ring-row span { font-size: 13px; color: var(--muted); }
.lgd { display: grid; gap: 9px; font-size: 13.5px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.lgd div { display: flex; align-items: center; gap: 9px; }
.lgd i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex-shrink: 0; }
.lgd b { margin-inline-start: auto; font-family: var(--font-latin); font-weight: 700; }

/* ── قيمة مشتقّة من الملفّ (لا تُحرَّر هنا) ──────────────── */
.from-file {
  display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--indigo-dd);
  background: var(--indigo-soft); padding: 0 8px; border-radius: 999px; margin-inline-start: 6px; line-height: 1.8;
}
.derived {
  margin: 0; padding: 10px 13px; border-radius: 10px;
  background: #fafbfe; border: 1px dashed var(--line-strong);
  font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.7;
}
.derived.empty { font-weight: 500; color: var(--muted); font-family: var(--mono); font-size: 12px; text-align: start; padding: 10px 13px; }

/* ── تبويبات داخل الصفحة ─────────────────────────────────── */
/* شرائح كـ`.chip` في الهبوط: المختار ليليٌّ مُصمَت، والباقي أبيض بحدّ. */
.tabs-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  padding: 7px 16px; border-radius: 999px; transition: background .16s, color .16s, border-color .16s;
}
.tab:hover { border-color: #b9bed1; }
.tab.on { color: #fff; background: var(--side); border-color: var(--side); }
.hidden { display: none; }


/* ── المستخدمون ──────────────────────────────────────────── */
.av-sm {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #22d3ee); color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.creds {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center;
  margin-top: 8px; font-weight: 500;
}
.creds span { font-size: 12.5px; color: #065f46; font-weight: 600; }
.creds code {
  font-family: var(--mono); direction: ltr; text-align: left;
  background: #fff; border: 1px solid var(--ok-line); border-radius: 8px;
  padding: 5px 10px; font-size: 13px; color: var(--ink); user-select: all; word-break: break-all;
}

/* ── «ما تريد شرحه»: الحقل الذي لا يعرفه غير كاتبه ───────── */
.scope-card {
  border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px;
  background: linear-gradient(120deg, #fffbeb 0%, #fffdf7 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 26px -18px rgba(217, 119, 6, .5);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.scope-card.filled {
  border-color: var(--mint); background: linear-gradient(120deg, #f0fdf4 0%, #f7fefb 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 26px -20px rgba(5, 150, 105, .45);
}
/* نبضةٌ عند النسخ وهو فارغ — تنبيهٌ لا منع. */
.scope-card.nudge { animation: scope-nudge .45s ease 2; }
@keyframes scope-nudge {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(6px); }
  70% { transform: translateX(-6px); }
}

.scope-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.scope-ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--amber, #f59e0b); color: #fff; font-size: 17px; transition: background .2s;
  box-shadow: 0 8px 18px -8px rgba(217, 119, 6, .8);
}
.scope-card.filled .scope-ico { background: #10b981; box-shadow: 0 8px 18px -8px rgba(5, 150, 105, .8); }
.scope-head b { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.5; }
.req {
  font-size: 10.5px; font-weight: 600; color: var(--warn); background: #fde68a;
  padding: 1px 8px; border-radius: 999px; margin-inline-start: 7px; vertical-align: 2px;
}
.scope-card.filled .req { color: var(--ok); background: var(--ok-line); }
.scope-state { font-size: 13px; font-weight: 500; color: #b45309; }
.scope-card.filled .scope-state { color: var(--ok); }

.scope-card textarea {
  width: 100%; display: block; resize: vertical; background: #fff;
  border: 1px solid var(--line-strong); border-radius: 11px; padding: 12px 14px;
  font: inherit; font-size: 14.5px; line-height: 1.8; color: var(--ink);
}
.scope-card textarea::placeholder { color: var(--faint); }
.scope-card textarea:focus {
  outline: 0; border-color: var(--indigo); box-shadow: var(--ring);
}

/* ── مجموعات الخيارات ───────────────────────────────────── */
.opts-toolbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 14px; }
.opts-toolbar b { font-size: 15px; font-weight: 700; }

/*
  عمودٌ واحد عريض لا عمودان: الخيار صفٌّ كامل — عنوانه يميناً وشرائحه تمتدّ
  يساراً — فتُقرأ الشرائح كلّها في سطرٍ واحد بلا لفٍّ ولا تمرير.
*/
.opt-card { margin: 0 0 16px; padding: 18px 20px; }

.opt-group { font-size: 12px; font-weight: 600; color: var(--indigo-d);
  margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }

.opt { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 18px; align-items: start; }
.opt + .opt { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.opt-label { padding-top: 5px; }
.opt-title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin: 0; }
.opt-desc { font-size: 12px; line-height: 1.7; font-weight: 400; color: var(--muted); margin: 6px 0 0; }

/*
  خيارٌ مُبرَز — لِما لا يصحّ أن يُمرَّ عليه. وأوّلُه «شاشات خلف تسجيل الدخول»:
  بلا حسابٍ صحيح يقف المتصفّح عند نموذج الدخول ويخرج الفيديو كلُّه تسجيلاً له.
*/
.opt.key {
  grid-template-columns: 230px minmax(0, 1fr); align-items: center;
  padding: 15px 17px; border-radius: 12px; border: 1px solid var(--run-line);
  background: linear-gradient(120deg, #f3f4ff 0%, #f5f3ff 100%);
}
.opt.key .opt-label { padding-top: 0; }
.opt.key .opt-title { font-size: 14px; color: var(--indigo-dd); }
.opt.key .opt-desc { color: var(--ink-2); font-size: 12.5px; }

/* اختيار واحد — شرائح */
.opt-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt { cursor: pointer; margin: 0; position: relative; }
.chip-opt input { position: absolute; opacity: 0; pointer-events: none; }
.chip-opt span {
  display: block; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: .14s;
}
.chip-opt span em { display: block; font-style: normal; font-size: 11px; font-weight: 400;
  color: var(--muted); margin-top: 1px; }
.chip-opt:hover span { border-color: #a5b4fc; }
.chip-opt input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 2px; }
.chip-opt input:checked + span {
  background: var(--indigo-soft); border-color: var(--indigo); color: var(--indigo-dd);
  box-shadow: inset 0 0 0 1px var(--indigo);
}
.chip-opt input:checked + span em { color: var(--indigo-d); }

/* اختيار متعدّد — مربّعات تتوزّع على العرض لا تتكدّس عموداً */
.opt-checks { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 6px; }
.check-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.check-opt input { width: 16px; height: 16px; accent-color: var(--indigo-d); flex-shrink: 0; margin: 0; }
.check-opt:hover { color: var(--ink); }

/* عنوان الخيار فوق شرائحه حين يضيق الصفّ عن الاثنين جنباً إلى جنب. */
@media (max-width: 720px) {
  .opt, .opt.key { grid-template-columns: 1fr; gap: 10px; align-items: start; }
  .opt-label { padding-top: 0; }
}

/* ── صفحة الإنشاء: النوع ثم طريقة الكتابة ─────────────────── */
/* عرضٌ واحد للاختيار ولما تحته: وعاءٌ أعرض من الاختيار فوقه يبدو صفحةً أخرى. */
.kind-pick, .kind-pane { max-width: 960px; }
.kind-pick.start-pick { margin: 0 0 22px; }
.kind-pick legend { font-size: 15px; font-weight: 700; color: var(--ink); }
.kind-pane[hidden] { display: none; }
.opt[hidden], .opt-card[hidden] { display: none; }

.start-pick { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.start-pick legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.start-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.start-opt { position: relative; cursor: pointer; margin: 0; display: block; }
.start-opt input { position: absolute; opacity: 0; pointer-events: none; }
.start-card {
  display: flex; gap: 12px; align-items: flex-start; height: 100%;
  padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line-strong); background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.start-opt:hover .start-card { border-color: #a5b4fc; }
.start-opt input:focus-visible + .start-card { outline: 2px solid var(--indigo); outline-offset: 2px; }
.start-opt input:checked + .start-card {
  border-color: var(--indigo); background: linear-gradient(120deg, #f3f4ff 0%, #f2fbff 100%);
  box-shadow: inset 0 0 0 1px var(--indigo), 0 12px 28px -20px rgba(79, 70, 229, .8);
}
.start-ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--idle-bg); color: var(--ink-2);
}
.start-ico svg { width: 19px; height: 19px; }
.start-ico.ai { color: #fff; background: linear-gradient(135deg, #818cf8, #22d3ee); box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .9); }
.start-tx { min-width: 0; }
.start-tx b { display: block; font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.start-tx > span { display: block; font-size: 12.5px; line-height: 1.75; color: var(--muted); margin-top: 3px; }
.start-rec {
  font-size: 10.5px; font-weight: 600; color: var(--indigo-dd); background: var(--indigo-soft);
  padding: 1px 8px; border-radius: 999px; margin-inline-start: 6px; vertical-align: 2px;
}
.start-brief { margin-top: 14px; }
.start-brief[hidden] { display: none; }
.start-brief label { display: block; margin-bottom: 6px; }
.start-brief textarea { resize: vertical; line-height: 1.8; }
@media (max-width: 640px) { .start-options { grid-template-columns: 1fr; } }

/* ── مساعد الكتابة في صفحة الدرس — `scenario-assist.js` ──── */
/*
 * فاتحٌ لا ليليّ: الليل في هذه الصفحة لمحرّر الشيفرة وحده، وبطاقةٌ داكنة فوقه
 * تتنازع معه العين. والنيليّ الخفيف يكفي ليقول «ابدأ من هنا» في الدرس الجديد.
 */
.assist {
  border: 1px solid var(--run-line); border-radius: var(--radius-lg); margin-bottom: 18px; overflow: hidden;
  background: linear-gradient(120deg, #f5f6ff 0%, #f2fbff 55%, #f1fdf7 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 16px 36px -28px rgba(79, 70, 229, .7);
}
.assist-head { display: flex; align-items: center; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.assist.is-fresh .assist-head { padding: 22px 24px; }
.assist-ico {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #818cf8, #22d3ee); color: #fff;
  box-shadow: 0 10px 24px -10px rgba(99, 102, 241, .95), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.assist-ico svg { width: 21px; height: 21px; }
.assist.is-fresh .assist-ico { width: 50px; height: 50px; border-radius: 15px; }
.assist.is-fresh .assist-ico svg { width: 24px; height: 24px; }
.assist-tx { flex: 1; min-width: 240px; }
.assist-tx .eyebrow { margin-bottom: 6px; }
.assist-tx b { display: block; font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.assist.is-fresh .assist-tx b { font-size: 18px; }
.assist-tx > span:not(.eyebrow) { display: block; font-size: 13px; line-height: 1.8; color: var(--muted); margin-top: 2px; max-width: 720px; }
.assist-flag {
  display: inline-block; font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-bg);
  border: 1px solid var(--warn-line); padding: 0 8px; border-radius: 999px; margin-inline-start: 6px; vertical-align: 2px;
}
.assist-acts { display: flex; gap: 8px; flex-wrap: wrap; }

.assist-body { border-top: 1px solid var(--run-line); background: #fff; padding: 6px 24px 22px; }
.assist-body[hidden] { display: none; }

.assist-steps { list-style: none; margin: 0; padding: 0; }
.assist-step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; padding: 18px 0; }
.assist-step + .assist-step { border-top: 1px dashed var(--line); }
.assist-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 700 13px/1 var(--font-latin, inherit); color: var(--indigo-dd); background: var(--indigo-soft);
  border: 1px solid var(--run-line);
}
.assist-main { min-width: 0; }
.assist-main h3 { margin: 4px 0 10px; font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.assist-hint { margin: 8px 0 0; font-size: 12.5px; line-height: 1.75; }

.assist-modes { margin-bottom: 10px; }
.assist-scope { margin: 0; padding: 12px; }
.assist-scope .scope-state { margin: 8px 2px 0; }
.assist-fix { margin-top: 10px; }
.assist-fix[hidden] { display: none; }

.assist-ctx { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; font-size: 12.5px; }
.assist-chip {
  font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--idle-bg);
  border: 1px solid var(--line); padding: 1px 9px; border-radius: 999px;
}

.assist-opts > summary { list-style: none; cursor: pointer; }
.assist-opts > summary::-webkit-details-marker { display: none; }
.assist-opts > summary h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.assist-opts > summary h3::after {
  content: ""; width: 8px; height: 8px; margin-inline-start: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
.assist-opts[open] > summary h3::after { transform: rotate(-135deg) translateY(-2px); }
.assist-opt { font-size: 12px; font-weight: 500; }
.assist-sum { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.assist-opts .opts-toolbar .muted { font-size: 12.5px; }
.assist-opts .opt-card { box-shadow: none; }

.assist-copy { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.assist-main h3 + .assist-copy { margin-top: 0; }
.assist-how { margin: 14px 0 0; padding-inline-start: 20px; font-size: 13px; line-height: 2; color: var(--ink-2); }
.assist-cmd {
  font-family: var(--mono); font-size: 12px; background: #0b1020; color: #c7d2fe;
  padding: 2px 9px; border-radius: 6px; margin-inline-start: 4px;
}
.assist-preview { margin-top: 12px; }
.assist-preview > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--indigo-d); }
.assist-preview .prompt-box { margin-top: 10px; border-radius: 12px; max-height: 50vh; }

textarea.code.assist-paste { min-height: 190px; }
.assist-main .note { margin: 10px 0 0; }

@media (max-width: 640px) {
  .assist-head, .assist.is-fresh .assist-head { padding: 16px; }
  .assist-body { padding: 4px 16px 18px; }
  .assist-acts { width: 100%; }
  .assist-acts .btn { flex: 1; justify-content: center; }
  .assist-step { grid-template-columns: 1fr; gap: 8px; }
}

/* ── صفحة الدخول — ليلُ البطل ─────────────────────────────── */
/*
 * الصفحة الوحيدة الداكنة كلّها: هي الباب بين الهبوط واللوحة، فتأخذ ليلَ
 * الأوّل وتسلّم إلى نهار الثانية. والبطاقة زجاجٌ على الشفق، وحقولها داكنة
 * بنصٍّ فاتح — حقلٌ أبيض في ليلٍ يقفز من الصفحة قبل عنوانه.
 */
body.auth {
  min-height: 100vh; margin: 0; display: grid; place-items: center; padding: 32px 16px;
  background: var(--night); color: #eef2ff; position: relative; overflow-x: hidden;
}
.auth > .sky, .auth > .grid-bg { position: fixed; }
.auth > .sky i:nth-child(1) { width: 640px; height: 640px; top: -320px; right: -160px; filter: blur(100px); opacity: .5; }
.auth > .sky i:nth-child(2) { width: 540px; height: 540px; top: -240px; left: -180px; filter: blur(100px); opacity: .45; }
.auth > .sky i:nth-child(3) { width: 600px; height: 400px; top: auto; bottom: -260px; left: 50%; margin-left: -300px; filter: blur(100px); opacity: .3; }
.auth > .grid-bg { background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 25%, transparent 75%); }
.auth-box { position: relative; z-index: 1; width: min(420px, 100%); }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .mark {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff;
  box-shadow: 0 14px 40px -10px rgba(99, 102, 241, .95), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.auth-brand .mark svg { width: 100%; height: 100%; }
.auth-brand h1 { margin: 12px 0 6px; font-size: 26px; font-weight: 700; color: #fff; }
.auth-brand p { margin: 0; color: var(--side-muted); font-size: 14.5px; }
.auth-card {
  border-radius: 20px; padding: 26px;
  background: rgba(14, 19, 48, .72); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 40px 100px -30px rgba(79, 70, 229, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.auth-card label { color: #c7d2fe; }
.auth-card input[type=text], .auth-card input[type=password], .auth-card input[type=email] {
  height: 46px; background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .16);
}
.auth-card input:hover { border-color: rgba(255, 255, 255, .28); }
.auth-card input:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(129, 140, 248, .25); }
.auth-card input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px #1a2050 inset; caret-color: #fff; }
.auth-card .check-line { color: #dfe5ff; font-weight: 500; }
.auth-card .btn.primary { height: 48px; font-size: 15px; width: 100%; margin-top: 20px; }
.auth-card .btn:focus-visible, .auth-card :focus-visible { outline-color: #a5b4fc; }
.auth-card .note.err { background: rgba(239, 68, 68, .14); border-color: rgba(248, 113, 113, .4); color: #fecaca; }
.auth-back { text-align: center; margin: 22px 0 0; font-size: 14px; }
.auth-back a { color: var(--side-muted); }
.auth-back a:hover { color: #fff; }
.auth-back a:focus-visible { outline-color: #a5b4fc; }

/* ── الحركة لمن طلب تقليلها ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* أرقامٌ في الجدول — بخطٍّ لاتيني وعرضٍ ثابت، فتصطفّ الخانات عمودياً. */
td.num { font-family: var(--font-latin); font-variant-numeric: tabular-nums; direction: ltr; text-align: right; white-space: nowrap; }

/* سطر الحالة أعلى صفحة الدرس — شاراته ثم معرّفه. */
.status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 0; }
.status-line .mono { margin-inline-start: 4px; }

/* ── الهاتف: المؤشّرات اثنين اثنين، والجداول بطاقات ─────────── */
/*
 * جدولٌ يتمرّر أفقياً على الهاتف يُريك عمودين ويُخفي الخمسة الباقية خلف
 * إيماءةٍ لا يدلّ عليها شيء — والحالة والنشر في المخفيّ. فالصفّ هنا يصير
 * بطاقة: الاسم سطرٌ كامل، وما بعده خاناتٌ متجاورة، والإجراءات ذيلُها.
 *
 * `.stack-sm` على الجدول، والترتيب الخاصّ بكل شاشة بـ`order` لا بإعادة
 * ترتيب الأعمدة في القالب — فالحاسوب لا يمسّه شيء.
 */
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-top { gap: 8px; margin-bottom: 6px; }
  .kpi-ic { width: 28px; height: 28px; border-radius: 9px; }
  .kpi-ic svg { width: 15px; height: 15px; }
  .kpi .l { font-size: 13px; }
  .kpi .v { font-size: 26px; }

  .card.pad { padding: 18px; }
  .card-head { padding: 14px 16px; }

  .scroll-x:has(> table.stack-sm) { overflow: visible; }
  .scroll-x > table.stack-sm { min-width: 0; }
  table.stack-sm, table.stack-sm tbody { display: block; }
  table.stack-sm thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  table.stack-sm tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--line-2);
  }
  table.stack-sm tr:last-child { border-bottom: 0; }
  table.stack-sm td { display: block; padding: 0; border: 0; min-width: 0; text-align: start !important; width: auto !important; }
  table.stack-sm td:first-child, table.stack-sm td:last-child { grid-column: 1 / -1; }
  table.stack-sm td:last-child:not(:first-child) { padding-top: 4px; }
  table.stack-sm td:nth-child(even):not(:last-child) { justify-self: end; }
  table.stack-sm td.num { direction: inherit; }
  /* الرقم بلا عمودٍ فوقه لا يُقرأ — فيحمل عنوانه معه. */
  table.stack-sm td[data-label]::before {
    content: attr(data-label) ' '; font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--muted);
  }
  table.stack-sm td[data-label] + td[data-label] { justify-self: end; }

  /* الفيديوهات: الاسم، الدورة، ثم الحالة بجانب النشر، ثم التقدّم بجانب المدّة. */
  table.stack-sm.videos-t td:nth-child(2) { grid-column: 1 / -1; justify-self: start; }
  table.stack-sm.videos-t td:nth-child(3) { order: 3; }
  table.stack-sm.videos-t td:nth-child(5) { order: 4; justify-self: end; }
  table.stack-sm.videos-t td:nth-child(4) { order: 5; justify-self: stretch; max-width: 220px; }
  table.stack-sm.videos-t td:nth-child(6) { order: 6; justify-self: end; }
  table.stack-sm.videos-t td:nth-child(7) { order: 7; }

  /* آخر ما عُمل عليه: الاسم، ثم الدورة بجانب الوقت، ثم الحالة بجانب النشر. */
  table.stack-sm.recent-t td:nth-child(2) { order: 2; justify-self: start; }
  table.stack-sm.recent-t td:nth-child(5) { order: 3; justify-self: end; }
  table.stack-sm.recent-t td:nth-child(3) { order: 4; justify-self: start; }
  table.stack-sm.recent-t td:nth-child(4) { order: 5; justify-self: end; }
  table.stack-sm.recent-t td:last-child { grid-column: auto; }
}

/* ── اللغات ذات الاتجاه LTR ─────────────────────────────────
 * ما لا خاصّية منطقية له يُعكس هنا: الأرقام تُحاذى إلى بداية عمودها، والبريد
 * إلى جهة صورته، وسهمُ «رجوع» المرسوم لـRTL ينقلب.
 * وخطوط اللاتينية وCJK والهندية: `Inter` أوّلاً، ثم خطوط النظام لما لا يغطّيه.
 */
:lang(en), :lang(zh), :lang(es), :lang(fr), :lang(de), :lang(pt), :lang(ru), :lang(ja),
:lang(ko), :lang(hi), :lang(id), :lang(tr), :lang(it), :lang(nl) {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans", "PingFang SC", "Hiragino Sans",
          "Microsoft YaHei", "Malgun Gothic", "Nirmala UI", sans-serif;
}
[dir="ltr"] td.num { text-align: left; }
[dir="ltr"] .side-foot .em { text-align: left; }
[dir="ltr"] .side { background:
    radial-gradient(120% 50% at 0% 0%, rgba(99, 102, 241, .22) 0%, transparent 60%),
    linear-gradient(180deg, var(--side) 0%, #0b1029 100%); }
[dir="ltr"] svg:has(> use[href="#n-back"]) { transform: scaleX(-1); }

/* قائمة اللغات في الهيدر — كرةٌ أرضية ثم الاسم بلغته. */
.langs { position: relative; display: inline-flex; align-items: center; color: var(--muted); flex-shrink: 0; }
.langs svg { position: absolute; inset-inline-start: 10px; width: 16px; height: 16px; pointer-events: none; }
.langs select {
  min-height: 38px; padding-block: 0; padding-inline-start: 32px; font-size: 13px; font-weight: 600;
  max-width: 150px; width: auto; border-radius: 10px;
}
.side-langs { display: none; margin-bottom: 10px; }
.side-langs select { width: 100%; max-width: none; background-color: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }
.side-langs option { background: #0e1330; color: #e6ebff; }
.side-langs svg { color: #c7d2fe; }
@media (max-width: 600px) {
  body.shell > .head .langs { display: none; }
  .side-langs { display: flex; }
}
/* صفحة الدخول: القائمة في الزاوية العليا، على الليل. */
.auth-langs { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 5; }
.auth-langs select { background-color: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #e6ebff; }
.auth-langs option { background: #0e1330; color: #e6ebff; }
.auth-langs svg { color: #c7d2fe; }

/* ══════════════ محرّر السيناريو بالخطوات — `scenario-editor.js` ══════════════
   بادئةٌ واحدة `se-` لئلّا يصطدم بغيره: صفحة التحرير فيها نماذج وبطاقات كثيرة. */
.scenario-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.scenario-top h2 { margin: 0; }
.scenario-top .tabs-bar { margin: 0; }
/* شريط الحفظ العائم — أسفل الشاشة ما دام هناك ما لم يُحفظ. */
.save-bar {
  position: fixed; z-index: 50; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  background: var(--card); color: var(--ink); border: 1px solid var(--warn-line);
  border-radius: 99px; padding-block: 8px; padding-inline: 18px 8px;
  box-shadow: 0 10px 30px rgba(11, 16, 32, .18); font-size: 14px; font-weight: 600;
  animation: save-bar-in .18s ease-out;
}
.save-bar[hidden] { display: none; }
.save-bar > span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-inline-end: 8px; vertical-align: middle; }
@keyframes save-bar-in { from { opacity: 0; transform: translate(-50%, 12px); } }
@media (prefers-reduced-motion: reduce) { .save-bar { animation: none; } }
.unsaved { font-size: 13px; font-weight: 600; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 99px; padding: 2px 10px; }

.se { display: grid; gap: 14px; }
.se[hidden], .se-words[hidden], .scenario-card textarea[hidden] { display: none; }
.se .mono { font-family: var(--mono); direction: ltr; text-align: left; }
.se input.mono::placeholder { text-align: left; }
.se-hint { margin: 0; font-size: 13px; color: var(--muted); }
.se-muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.se-bad { border-color: var(--bad-line) !important; background: #fffafa; }
.se-field { min-width: 0; }
.se-field .se-label-text { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.se-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.se-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .se-grid { grid-template-columns: minmax(0, 1fr); } }

/* الإعدادات */
.se-settings { border: 1px solid var(--line); border-radius: var(--radius); background: var(--hover); }
/* «افحص واجلب العناصر» بين الإعدادات والمشاهد — `scenario-editor.js` · `syncCheck`. */
.se-check { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 12px 0 0; padding: 12px 14px; border: 1px dashed var(--indigo); border-radius: var(--radius); background: var(--indigo-soft); }
.se-check[hidden] { display: none; }
.se-check .se-hint { flex: 1 1 260px; }
.se-settings > summary { cursor: pointer; padding: 12px 14px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; list-style: none; }
.se-settings > summary::-webkit-details-marker { display: none; }
.se-settings > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.se-settings[open] > summary::before { transform: rotate(90deg); }
[dir=rtl] .se-settings > summary::before { content: '◂'; }
[dir=rtl] .se-settings[open] > summary::before { transform: rotate(-90deg); }
.se-settings-body { padding: 4px 14px 16px; display: grid; gap: 14px; border-top: 1px solid var(--line); }
.se-settings h4 { margin: 6px 0 4px; font-size: 14px; }
.se-accounts { display: grid; gap: 8px; margin: 8px 0; }
.se-account { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
@media (max-width: 560px) { .se-account { grid-template-columns: minmax(0, 1fr) 34px; } .se-account input:not(:first-child) { grid-column: 1 / 2; } }

/* المشاهد */
.se-scenes { display: grid; }
.se-scene { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.se-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--hover); border-bottom: 1px solid var(--line); }
.se-scene.folded .se-head { border-bottom: 0; }
.se-scene.folded .se-body { display: none; }
.se-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--indigo); color: #fff; display: grid; place-items: center; font: 700 13px var(--font-latin); }
.se .se-label { flex: 1; min-width: 0; border-color: transparent; background: transparent; font-weight: 600; padding: 4px 8px; min-height: 0; height: 32px; }
.se .se-label:hover { border-color: var(--line-strong); background: var(--card); }
.se .se-label:focus { background: var(--card); }
.se-dur { flex: none; font-size: 12px; color: var(--wait); background: var(--wait-bg); border-radius: 99px; padding: 2px 9px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.se-icon { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; }
.se-icon:hover:not(:disabled) { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.se-icon.se-del:hover:not(:disabled) { color: var(--bad); border-color: var(--bad-line); }
.se-icon:disabled { opacity: .3; cursor: default; }
.se-body { padding: 14px; display: grid; gap: 12px; }
.se-where { display: grid; grid-template-columns: auto minmax(0, 1fr) 170px; gap: 10px; align-items: end; }
@media (max-width: 640px) { .se-where { grid-template-columns: minmax(0, 1fr); } }
.se-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.se-seg button { border: 0; background: var(--card); color: var(--muted); font: inherit; font-size: 13px; padding: 0 12px; min-height: 40px; cursor: pointer; white-space: nowrap; }
.se-seg button + button { border-inline-start: 1px solid var(--line-strong); }
.se-seg button[aria-pressed=true] { background: var(--indigo-soft); color: var(--indigo-dd); font-weight: 600; }
.se-seg button:disabled { opacity: .45; cursor: not-allowed; }
.se textarea { min-height: 84px; line-height: 1.9; resize: vertical; }
.se-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.se-count { color: var(--muted); font-weight: 400; }

/* شريط الكلمات: كل كلمةٍ زرّ — تُضيف فعلاً عندها، أو تربط الفعل المنتظر بها */
.se-words { display: flex; flex-wrap: wrap; gap: 6px 2px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 14px; line-height: 1.7; }
.se-words .se-hint { width: 100%; font-size: 12.5px; margin-bottom: 2px; }
.se-words.picking { border-color: var(--indigo); border-style: solid; background: var(--indigo-soft); }
.se-words.picking .se-hint { color: var(--indigo-dd); font-weight: 600; }
.se-w { position: relative; border: 0; background: none; font: inherit; color: var(--ink-2); padding: 0 4px; border-radius: 6px; cursor: pointer; }
.se-w:hover { background: var(--indigo-soft); color: var(--indigo-dd); }
.se-w.mark { background: var(--warn-bg); box-shadow: inset 0 -2px 0 var(--warn-line); color: var(--ink); }
.se-w.mark::after { content: attr(data-n); position: absolute; top: -9px; inset-inline-start: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px; background: var(--warn); color: #fff; font: 700 9.5px/15px var(--font-latin); text-align: center; }

/* الأفعال */
.se-acts { display: grid; gap: 8px; }
.se-act { display: grid; grid-template-columns: 22px 150px minmax(0, 1fr) auto 30px; gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--hover); }
.se-act.armed { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.se-act-n { width: 22px; height: 22px; margin-top: 9px; border-radius: 99px; background: var(--warn); color: #fff; display: grid; place-items: center; font: 700 11px var(--font-latin); }
.se-fields { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.se-fields > input { flex: 1 1 90px; min-width: 0; }
.se-fields > input[data-f=target] { flex: 3 1 200px; }
.se-when { display: grid; gap: 2px; justify-items: center; }
.se-when-row { display: flex; gap: 4px; }
.se-when input { width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
.se-svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.se-pick .se-svg { margin-inline-end: 4px; }
.se-pick { border: 1px solid var(--line-strong); background: var(--card); color: var(--indigo-dd); border-radius: 10px; min-height: 40px; padding: 0 9px; cursor: pointer; font: inherit; font-size: 12.5px; white-space: nowrap; }
.se-pick:hover { border-color: var(--indigo); }
.se-pick[aria-pressed=true] { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.se-word-tag { font-size: 12px; color: var(--muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .se-act { grid-template-columns: 22px minmax(0, 1fr) 30px; }
  .se-act > select { grid-column: 2; }
  .se-act > .se-del { grid-column: 3; grid-row: 1; }
  .se-act > .se-fields, .se-act > .se-when { grid-column: 2 / 4; }
  .se-when { justify-items: start; }
}

.se-add { width: 100%; border: 1px dashed var(--line-strong); background: none; color: var(--indigo-d); font: inherit; font-weight: 600; padding: 9px; border-radius: 10px; cursor: pointer; }
.se-add:hover { background: var(--indigo-soft); border-color: var(--indigo); }
.se-add-big { margin-top: 14px; padding: 14px; font-size: 15px; border-radius: var(--radius); }
.se-between { display: flex; justify-content: center; padding: 7px 0; }
.se-between button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--card); color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; opacity: .6; }
.se-between button:hover { opacity: 1; color: var(--indigo-d); border-color: var(--indigo); }
.se button:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }

/*
 * ── مخطّطات اللوحة ──
 * ألوانها من لوحةٍ فُحصت لعمى الألوان: الأزرق للنجاح، والأحمر لونُ حالة «أخفق»
 * — ولا لون يحمل المعنى وحده: المفتاح بالاسم والعدد، والتلميح بالأرقام، والجدول.
 */
.insights { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 18px; margin-top: 18px; align-items: stretch; }
.insights > * { min-width: 0; }
@media (max-width: 1100px) { .insights { grid-template-columns: 1fr; } }
.viz h2 { margin: 0; }
.viz-sub { margin: 3px 0 14px; font-size: 12.5px; color: var(--muted); }
.viz-head { display: flex; align-items: flex-start; gap: 12px; }
.viz-total { margin-inline-start: auto; text-align: end; }
.viz-total b { display: block; font-family: var(--font-latin); font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.viz-total span { font-size: 12px; color: var(--muted); }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2, var(--ink)); margin-bottom: 12px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 7px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.viz-legend b { font-family: var(--font-latin); }

.cols-wrap { position: relative; height: 170px; }
.cols-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cols-grid span { border-top: 1px dashed #e6e8f0; position: relative; height: 0; }
.cols-grid span:last-child { border-top: 1px solid #d5d9e6; }
.cols-grid span::after {
  content: attr(data-v); position: absolute; inset-inline-end: 0; top: -16px;
  font-family: var(--font-latin); font-size: 10.5px; color: var(--muted);
}
.cols { position: absolute; inset: 0; inset-inline-end: 22px; display: flex; align-items: flex-end; gap: 3px; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px; outline: 0; cursor: default; }
.col:not(.nil):hover, .col:focus-visible { background: rgba(99, 102, 241, .07); }
.col:focus-visible { box-shadow: 0 0 0 2px var(--indigo); }
.stk { width: 100%; max-width: 18px; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 3px; }
.stk i { background: var(--c); min-height: 2px; }
.cols-x { display: flex; gap: 3px; margin-inline-end: 22px; margin-top: 6px; }
.cols-x span { flex: 1; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: visible; width: 0; }
.viz-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 13px; color: var(--muted); }
.viz-empty.static { position: static; padding: 18px 0; }
.viz-table { margin-top: 14px; font-size: 13px; }
.viz-table summary { cursor: pointer; color: var(--muted); font-weight: 600; width: max-content; }
.viz-table table { margin-top: 8px; width: 100%; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { border: 1px solid var(--line-2, var(--line)); border-radius: 12px; padding: 12px 14px; background: #fbfbfe; }
.tile .l { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.tile b { display: block; font-family: var(--font-latin); font-size: 22px; font-weight: 800; color: var(--ink); margin-top: 4px; line-height: 1.2; text-align: start; }
.tile .s { font-size: 11px; color: var(--muted); }
.tile .meter { margin-top: 8px; }

.hbar { display: grid; grid-template-columns: minmax(70px, 30%) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 7px 4px; border-radius: 8px; outline: 0; }
.hbar:hover, .hbar:focus-visible { background: #f6f7fc; }
.hbar:focus-visible { box-shadow: 0 0 0 2px var(--indigo); }
.hbar .nm { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .trk { height: 12px; border-radius: 4px; background: #f1f2f8; overflow: hidden; display: flex; }
.hbar .all { height: 100%; background: #9ec5f4; border-radius: 0 4px 4px 0; display: flex; min-width: 3px; }
[dir="rtl"] .hbar .all { border-radius: 4px 0 0 4px; }
.hbar .all.solo { background: #2a78d6; }
.hbar .pub { height: 100%; background: #2a78d6; }
.hbar .v { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.hbar .v b { font-family: var(--font-latin); font-size: 14px; color: var(--ink); }

.viz-tip {
  position: fixed; z-index: 100; pointer-events: none; max-width: 260px;
  background: #0e1330; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.5;
  padding: 6px 10px; border-radius: 8px; box-shadow: 0 8px 24px -8px rgba(5, 8, 22, .5);
}

/* ── نافذة المشاهدة في جدول الفيديوهات ─────────────────── */
/* أعرضُ من النافذة العادية، وجسمُها أسود بلا حشو: الفيديو يملأ الإطار حتى حوافّه. */
dialog.watch { width: min(980px, 94vw); background: #000; }
dialog.watch .body { padding: 0; max-height: none; overflow: hidden; }
dialog.watch video { display: block; width: 100%; max-height: 78vh; background: #000; border-radius: 0 0 18px 18px; }

/* ── صفحات الأخطاء — بثوب صفحة الدخول ───────────────────── */
/* الرسالة جملةٌ كاملة لا شعار: أعرضُ قليلاً وأوضح من وصف صفحة الدخول. */
.err-box .auth-brand h1 { font-size: 28px; }
.err-box .auth-brand p { max-width: 380px; margin-inline: auto; line-height: 1.9; color: #c3cbe6; }
.err-box .eyebrow { font-family: Inter, sans-serif; letter-spacing: .04em; }
.err-actions { display: flex; flex-direction: column; gap: 10px; }
.err-actions .btn { width: 100%; height: 46px; justify-content: center; font-size: 15px; margin: 0; }
.err-actions .btn:not(.primary) { background: transparent; color: #dfe5ff; border-color: rgba(255, 255, 255, .18); }
.err-actions .btn:not(.primary):hover { background: rgba(255, 255, 255, .06); color: #fff; }

/* ── صفحات الحساب: التسجيل والاستعادة والتأكيد والخطوة الثانية ── */
.auth-card .note { margin-bottom: 16px; }
.auth-card .note.info { background: rgba(129, 140, 248, .12); border-color: rgba(129, 140, 248, .3); color: #dfe5ff; }
.auth-card .note.ok { background: rgba(16, 185, 129, .14); border-color: rgba(52, 211, 153, .35); color: #bbf7d0; }
.auth-card .hint { margin: 6px 0 0; font-size: 12.5px; color: var(--side-muted); }
.auth-card .label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.auth-card .label-row a { font-size: 13px; font-weight: 500; color: #a5b4fc; }
.auth-card .label-row a:hover { color: #fff; }
.auth-card .auth-text { margin: 0 0 4px; color: #dfe5ff; font-size: 14px; line-height: 1.8; }
.auth-card input[type=text].code-input { font-family: Inter, monospace; font-size: 20px; letter-spacing: .3em; text-align: center; }
.auth-back p { margin: 0 0 8px; }
.auth-back a.strong { color: #c7d2fe; font-weight: 600; }
.auth-back .link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--side-muted); cursor: pointer; }
.auth-back .link-btn:hover { color: #fff; }

/* ── إعدادات الحساب ─────────────────────────────────────── */
.acct-card { max-width: 640px; margin-bottom: 22px; }
.acct-card h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.acct-card .hint { margin: 6px 0 0; font-size: 13px; }
.acct-actions { margin-top: 18px; }
.acct-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; margin-top: 14px; }
.acct-split .btn { margin-top: 10px; }
.acct-steps { padding-inline-start: 20px; margin: 0 0 12px; }
.acct-steps li { margin-bottom: 8px; }
.acct-steps label { display: block; margin-bottom: 8px; font-weight: 600; }
.qr-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 0 0 18px; }
.qr { width: 180px; height: 180px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr svg { display: block; width: 100%; height: 100%; }
.secret { margin-top: 6px; font-size: 14px; letter-spacing: .06em; color: var(--ink); word-break: break-all; }
.code-sm { width: 170px; font-family: Inter, monospace; font-size: 18px; letter-spacing: .25em; text-align: center; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin: 10px 0; }
.recovery-codes code { background: #fff; border: 1px solid #fde68a; border-radius: 6px; padding: 5px 8px; font-size: 13.5px; text-align: center; direction: ltr; }

/* ── شاشة المستخدمين: صفُّ الإجراءات في آخر السطر ─────────── */
.users-actions { justify-content: flex-end; }
@media (max-width: 600px) { .users-actions { justify-content: flex-start; } }

/* ── إحصاءات الزوّار ────────────────────────────────────── */
.an-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.an-bar .tabs { margin-inline-start: 0; }
.an-live { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.an-live i { width: 9px; height: 9px; border-radius: 50%; background: #c4c9d8; }
.an-live i.on { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.delta { margin-inline-start: auto; font-family: var(--font-latin); font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.delta.good { color: #047857; }
.delta.bad { color: #be123c; }
/* المشاهدات عمودٌ فاتح، والزوّار منه الجزء الداكن من أسفل — جزءٌ من كلّ لا طبقةٌ فوق طبقة. */
.stk.ov { position: relative; background: #9ec5f4; }
.stk.ov i { position: absolute; inset-inline: 0; bottom: 0; background: #2a78d6; }
.an-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
@media (max-width: 1100px) { .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .an-grid { grid-template-columns: 1fr; } }
/* صفحة الإحصاءات: كل صفٍّ بطاقتان متساويتان عرضاً وطولاً (لا ١٫٧٥ : ١ كاللوحة). */
.an-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .an-pair { grid-template-columns: 1fr; } }
.an-subh { margin: 12px 0 2px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.an-grid > * { min-width: 0; }
.hbar a.nm { color: var(--ink); }
.hbar a.nm:hover { color: var(--indigo-d); }
/* ستّ بطاقات: صفّان من ثلاث لا خمسٌ وواحدةٌ يتيمة. */
.an-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .an-kpis { grid-template-columns: 1fr 1fr; } }

/*
 * «أخفق» في قائمة الفيديوهات — يُظهر سببه عند التأشير أو التركيز.
 * النافذة `fixed` وتضع موضعَها صفحةُ الفيديوهات (الجدول يقصّ ما يخرج عنه).
 */
.why { position: relative; display: inline-flex; cursor: help; border-radius: 999px; outline: none; }
.why .badge { text-decoration: underline dotted; text-underline-offset: 3px; }
.why:focus-visible .badge { box-shadow: 0 0 0 2px var(--bad-line); }
.why-pop {
  position: fixed; z-index: 60; width: max-content; max-width: 360px;
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity .13s ease, visibility .13s;
  background: var(--side); color: #fff; text-align: start;
  font-size: 12.5px; font-weight: 500; line-height: 1.7; white-space: normal; overflow-wrap: anywhere;
  padding: 8px 12px; border-radius: 10px;
  box-shadow: 0 12px 28px -10px rgba(5, 8, 22, .6);
}
.why-pop b { color: #fecaca; font-weight: 700; }
.why:hover .why-pop, .why:focus .why-pop { visibility: visible; opacity: 1; }

/* ── الخطط والرصيد ─────────────────────────────────────── */
/* بطاقة لكل خطة، والمميّزة بإطار البنفسجي — انظر `admin/billing.blade.php`. */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plan { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.plan.featured { border-color: var(--indigo); box-shadow: 0 0 0 1px var(--indigo); }
.plan h3 { margin: 0; font-size: 16px; }
.plan .tag { position: absolute; top: 14px; inset-inline-end: 14px; }
.plan .price { margin: 0; font-family: var(--font-latin); font-size: 28px; font-weight: 800; color: var(--ink); }
.plan .price small { font-size: 13px; font-weight: 600; color: var(--muted); font-family: inherit; }
.plan .mins { margin: 0; font-weight: 600; color: var(--ink-2); }
.plan .muted { margin: 0; font-size: 13px; }
.plan .field { margin: 0; }
.plan .field + .field { margin-top: 4px; }
.plan .btn { margin-top: auto; }
.rerenders { margin: 10px 0 0; font-size: 13px; }

/* ══════════════ محرّر السيناريو بالتايم لاين — `scenario-timeline.js` ══════════════
   بادئة `tl-`. المحور يجري من اليسار إلى اليمين في كل لغة (`dir=ltr` على المسارات):
   الزمن في برامج المونتاج لا ينقلب مع اتّجاه النصّ. */
.row.tl-wide { grid-template-columns: minmax(0, 1fr); }
.tl { display: grid; gap: 12px; --tl-voice: #0f766e; --tl-fx: #b45309; --tl-ac: #be185d; }
.tl[hidden] { display: none; }
.tl .mono { font-family: var(--mono); }
.tl .btn.on { background: var(--indigo-soft); border-color: var(--indigo); color: var(--indigo-dd); }
.tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tl-play { min-width: 92px; }
.tl-transport { display: flex; align-items: center; gap: 8px; padding: 3px 10px; border-bottom: 1px solid var(--line); background: var(--hover); }
.tl-transport { font-size: 13px; color: var(--ink-2); }
.tl-transport .tl-push { margin-inline-start: auto; }
.tl-scenebox { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.tl-scenebox .tl-scenes { padding: 10px 12px; }
.tl-bigplay { position: absolute; left: 50%; top: 50%; z-index: 2; width: 68px; height: 68px; margin: -34px 0 0 -34px; border: 0; border-radius: 50%; background: rgba(8, 12, 28, .62); color: #fff; font-size: 26px; line-height: 1; padding-left: 4px; cursor: pointer; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); transition: opacity .2s, transform .15s, background .15s; }
.tl-bigplay:hover { background: var(--indigo); transform: scale(1.06); }
.tl-bigplay.on { padding-left: 0; font-size: 20px; opacity: 0; }
.tl-stage:hover .tl-bigplay.on, .tl-bigplay.on:focus-visible { opacity: .85; }
.tl-time { font: 600 14px var(--mono); font-variant-numeric: tabular-nums; min-width: 104px; }
.tl-scenes { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 280px; min-width: 0; }
.tl-scn { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; border: 1px solid var(--line-strong); background: var(--card); border-radius: 99px; padding: 3px 10px 3px 4px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
[dir=rtl] .tl-scn { padding: 3px 4px 3px 10px; }
.tl-scn:hover { border-color: var(--indigo); }
.tl-scn.on { background: var(--indigo-soft); border-color: var(--indigo); color: var(--indigo-dd); font-weight: 600; }
.tl-scn-n { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--indigo); color: #fff; display: grid; place-items: center; font: 700 11px var(--font-latin); }
.tl-scn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tl-scn small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.tl-opts { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.tl-check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.tl-zoom { display: inline-flex; gap: 2px; }

.tl-desk { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .tl-desk { grid-template-columns: minmax(0, 1fr); } }
.tl-view, .tl-side, .tl-track { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); overflow: hidden; min-width: 0; }
.tl-view-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--hover); font-size: 13px; }
.tl-where { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tl-voice { font-size: 12px; border-radius: 99px; padding: 1px 9px; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.tl-voice.real { background: var(--ok-bg); color: var(--ok); }
.tl-voice.loading { background: var(--run-bg); color: var(--run); }
.tl-voice.failed { background: var(--warn-bg); color: var(--warn); }

.tl-stage { position: relative; aspect-ratio: 16 / 9; background: #0b1020; overflow: hidden; }
.tl-layer { position: absolute; inset: 0; transition: transform .6s cubic-bezier(.22, .61, .36, 1); }
@media (prefers-reduced-motion: reduce) { .tl-layer { transition: none; } }
.tl-layer img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.tl-fx { position: absolute; inset: 0; pointer-events: none; }
.tl-fx > div { position: absolute; }
/* كما في الفيديو (`engine/lib/cursor.js` · `.__nrt-spot`): إطارٌ أزرق وتوهّجٌ خفيف — بلا تعتيم ما حوله. */
.tl-spot { border-radius: 10px; outline: 3px solid #0EA5E9; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(14, 165, 233, .18); }
.tl-blur { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(255, 255, 255, .08); border-radius: 4px; }
.tl-ripple { width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid #fbbf24; animation: tl-rip .6s ease-out forwards; }
@keyframes tl-rip { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
.tl-typing { display: flex; align-items: center; padding: 0 8px; font-size: 13px; color: #0b1020; background: rgba(255, 255, 255, .92); border: 2px solid var(--indigo); border-radius: 6px; overflow: hidden; white-space: nowrap; }
.tl-cursor { width: 14px; height: 14px; margin: -2px 0 0 -2px; border-radius: 50%; background: rgba(15, 23, 42, .85); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: left .45s, top .45s; }
.tl-ghost { display: flex; align-items: center; justify-content: center; padding: 0 6px; border: 2px dashed rgba(255, 255, 255, .85); border-radius: 6px; background: rgba(99, 102, 241, .22); color: #fff; font: 11px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.tl-key { left: 50%; bottom: 10%; transform: translateX(-50%); padding: 6px 14px; border: 1px solid rgba(255, 255, 255, .45); border-bottom-width: 3px; border-radius: 8px; background: rgba(8, 12, 28, .82); color: #fff; font: 600 15px var(--mono); animation: tl-pop .18s ease-out; }
@keyframes tl-pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }
.tl-dropdown { margin-top: 3px; padding: 5px 9px; border: 1px solid var(--indigo); border-radius: 6px; background: #fff; color: #0b1020; font-size: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); white-space: nowrap; }
.tl-scrollhint { right: 12px; top: 50%; width: 34px; height: 34px; margin-top: -17px; display: grid; place-items: center; border-radius: 50%; background: rgba(8, 12, 28, .7); color: #fff; font-size: 18px; animation: tl-scroll .5s ease-in-out infinite alternate; }
@keyframes tl-scroll { from { transform: translateY(-8px); } to { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .tl-key, .tl-scrollhint { animation: none; } }
.tl-selbox { outline: 2px dashed var(--cyan); outline-offset: 2px; border-radius: 4px; }
.tl-picks { position: absolute; inset: 0; cursor: crosshair; }
.tl-pick { position: absolute; border: 0; padding: 0; background: transparent; cursor: crosshair; border-radius: 3px; }
.tl-pick:hover, .tl-pick:focus-visible { outline: 2px solid var(--cyan); background: rgba(34, 211, 238, .14); }
.tl-pickbar { position: absolute; inset-inline: 10px; top: 10px; display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--indigo-d); color: #fff; font-size: 13px; z-index: 2; }
.tl-pickbar button { border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.tl-shot-age { position: absolute; inset-inline-end: 8px; bottom: 8px; font-size: 11px; color: #fff; background: rgba(8, 12, 28, .6); border-radius: 99px; padding: 1px 8px; }
.tl-noshot { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 20px; text-align: center; color: #dfe4f5; }
.tl-noshot p { margin: 0; max-width: 46ch; font-size: 13px; color: #aab4d6; }
.tl-active { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: #fbbf24; }
.tl-caption { padding: 9px 12px; border-top: 1px solid var(--line); min-height: 42px; font-size: 14.5px; color: var(--faint); line-height: 1.7; }
.tl-cw.done { color: var(--ink-2); }
.tl-cw.now { color: var(--ink); background: var(--indigo-soft); border-radius: 4px; }

.tl-insp { padding: 12px; display: grid; gap: 12px; }
.tl-adds { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-row > input { flex: 1 1 140px; min-width: 0; }
.tl-insp-head { justify-content: space-between; align-items: end; }
.tl-insp-head .tl-field { flex: 1 1 160px; }
.tl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tl-field { display: grid; gap: 4px; min-width: 0; }
.tl-field.wide { grid-column: 1 / -1; }
.tl-field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.tl-when { display: grid; gap: 8px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--hover); font-size: 13px; }
.tl-when.pinned { border-color: var(--tl-voice); }
.tl-when-t i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-inline-end: 6px; }
.tl-when.pinned .tl-when-t i { background: var(--tl-voice); }
.tl-when input { width: 96px; flex: 0 0 auto; }
.tl-bad { color: var(--bad); font-size: 12.5px; margin: 0; }

.tl-scroll { overflow-x: auto; overflow-y: hidden; }
.tl-lanes { position: relative; user-select: none; -webkit-user-select: none; touch-action: pan-y; min-width: 100%; }
.tl-lane { position: relative; height: 40px; border-bottom: 1px solid var(--line); }
.tl-lab { position: sticky; left: 0; z-index: 3; width: 92px; height: 100%; display: flex; align-items: flex-start; gap: 6px; padding: 9px 10px; background: var(--card); border-right: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tl-sw { flex: none; width: 9px; height: 9px; margin-top: 3px; border-radius: 2px; }
.tl-sw.voice { background: var(--tl-voice); } .tl-sw.fx { background: var(--tl-fx); } .tl-sw.ac { background: var(--tl-ac); }
.tl-ruler { height: 26px; background: var(--hover); cursor: ew-resize; }
.tl-ruler .tl-lab { padding-top: 5px; background: var(--hover); }
.tl-tick { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--line-strong); }
.tl-tick.major { height: 11px; background: var(--faint); }
.tl-tick span { position: absolute; bottom: 11px; left: 3px; font: 10.5px var(--mono); color: var(--muted); white-space: nowrap; }
.tl-word { position: absolute; top: 8px; height: 24px; padding: 3px 3px 0; overflow: hidden; white-space: nowrap; font-size: 11px; color: var(--ink); border-radius: 3px; border-left: 2px solid var(--tl-voice); background: rgba(15, 118, 110, .13); }
.tl-word.est { border-left-style: dashed; background: rgba(15, 118, 110, .07); }
.tl-word.now { background: var(--tl-voice); color: #fff; }
.tl-word.target { outline: 2px solid var(--indigo); outline-offset: 1px; z-index: 1; }
.tl-empty { position: absolute; top: 11px; font-size: 12px; color: var(--faint); }
.tl-item { position: absolute; height: 24px; display: flex; align-items: center; padding: 0 9px; border-radius: 5px; font-size: 11.5px; color: var(--ink); white-space: nowrap; overflow: hidden; cursor: grab; touch-action: none; }
.tl-item:active { cursor: grabbing; }
.tl-item-t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-item.fx { background: #fdf0dc; border: 1px solid var(--tl-fx); }
.tl-item.ac { background: #fbe4ef; border: 1px solid var(--tl-ac); }
.tl-item.k-blur { background: repeating-linear-gradient(135deg, #fdf0dc 0 6px, #fff 6px 12px); border-style: dashed; }
.tl-item.open { border-right-style: dashed; -webkit-mask-image: linear-gradient(90deg, #000 85%, rgba(0, 0, 0, .35)); mask-image: linear-gradient(90deg, #000 85%, rgba(0, 0, 0, .35)); }
.tl-item.pinned::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--tl-voice); margin-right: 5px; }
.tl-item.sel { box-shadow: 0 0 0 2px var(--indigo); z-index: 2; }
.tl-item.miss { border: 1px dashed var(--bad); background: var(--bad-bg); }
.tl-item.late { opacity: .55; }
.tl-grip { position: absolute; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize; background: linear-gradient(90deg, transparent 3px, currentColor 3px 4px, transparent 4px 6px, currentColor 6px 7px, transparent 7px); opacity: .45; }
.tl-end { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--faint); pointer-events: none; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--indigo); z-index: 4; pointer-events: none; }
.tl-head::before { content: ''; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top: 8px solid var(--indigo); }
.tl-status { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 7px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); min-height: 34px; }
.tl-status .bad { color: var(--bad); font-weight: 600; }
.tl-status .warn { color: var(--warn); font-weight: 600; }
.tl-item:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; z-index: 3; }
.tl-spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--cyan); animation: tl-spin .9s linear infinite; }
@keyframes tl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tl-spin { animation: none; } }

/* الإيقاف المؤقّت للطابور — الشريط أعلى كل شاشة، والبطاقة في اللوحة. */
.pause-note, .pause-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pause-note form, .pause-card form { margin: 0; flex-shrink: 0; }
.pause-card { padding: 14px 18px; }
.pause-card p { margin: 4px 0 0; font-size: 13px; }

/* حارس النماذج — الحقل المخفيّ خارج الشاشة لا `display:none` (بعض الروبوتات تتخطّى المخفيّ صراحةً). */
.hp-field { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.captcha-field { min-height: 65px; display: flex; justify-content: center; }
.captcha-image { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.captcha-image img { border-radius: 8px; background: #f5f6fa; }
#captcha { text-transform: uppercase; letter-spacing: 4px; }

/* الدخول بحساب Google — زرٌّ أبيض بشعارها كما تشترط إرشاداتها، ثم فاصل «أو». */
.auth-card .google-btn { width: 100%; height: 48px; font-size: 15px; color: #1f2937; background: #fff; border-color: #fff; }
.auth-card .google-btn:hover { background: #f3f4f6; }
.google-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--side-muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .14); }

/* عرض التسجيل المجاني — `partials.free-offer`؛ وزرّ «أنشئ حساباً مجانياً» تحت نموذج الدخول. */
.free-offer { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: 14px; text-align: start;
  background: linear-gradient(135deg, rgba(16, 185, 129, .18), rgba(8, 145, 178, .14)); border: 1px solid rgba(52, 211, 153, .38); color: #d1fae5; }
.free-offer .fo-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #10b981, #0891b2); box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .8); }
.free-offer .fo-ic svg { width: 19px; height: 19px; }
.free-offer .fo-txt { display: grid; gap: 2px; font-size: 13.5px; line-height: 1.5; }
.free-offer .fo-txt b { font-size: 15px; font-weight: 800; color: #fff; }
.signup-cta { margin-top: 6px; }
.signup-cta .or-line { margin: 22px 0 14px; }
.signup-cta .free-offer { margin-bottom: 12px; }
.auth-card .signup-btn { width: 100%; height: 46px; font-size: 15px; font-weight: 700; color: #ecfdf5;
  background: rgba(16, 185, 129, .16); border-color: rgba(52, 211, 153, .5); }
.auth-card .signup-btn:hover { background: rgba(16, 185, 129, .28); border-color: #34d399; color: #fff; }
.kept-email { padding: 11px 14px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.auth-card .hint a { color: #a5b4fc; }

/* هدية أوّل فيديو في اللوحة — خضراء كعرض التسجيل المجاني، و`.done` بعد نيلها. */
.bonus-card { display: flex; align-items: center; gap: 16px; padding: 18px 22px; margin-bottom: 18px; border-radius: var(--radius-lg);
  text-decoration: none; color: #065f46; background: linear-gradient(135deg, #ecfdf5, #e0f7fa); border: 1px solid #a7f3d0;
  box-shadow: 0 18px 40px -30px rgba(16, 185, 129, .9); transition: transform .2s, box-shadow .2s; }
a.bonus-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 22px 46px -28px rgba(16, 185, 129, 1); }
a.bonus-card:focus-visible { outline: 3px solid #34d399; outline-offset: 3px; }
.bonus-card .ico { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #10b981, #0891b2); box-shadow: 0 10px 24px -10px rgba(16, 185, 129, .9); }
.bonus-card .ico svg { width: 22px; height: 22px; }
.bonus-card .tx { flex: 1; min-width: 0; display: grid; gap: 3px; }
.bonus-card .tx b { font-size: 17px; font-weight: 800; color: #064e3b; line-height: 1.4; }
.bonus-card .tx span { font-size: 13.5px; line-height: 1.7; }
.bonus-card .go { flex: none; display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 12px;
  background: #10b981; color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }
@media (max-width: 700px) { .bonus-card { flex-wrap: wrap; } .bonus-card .go { width: 100%; justify-content: center; } }

/* تجارب صفحة الهبوط — خمسة أرقامٍ صغيرة تحت العنوان. */
.an-demo { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; margin-top: 14px; }
.an-demo .l { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.an-demo .v { font-family: var(--font-latin); font-size: 24px; font-weight: 800; margin: 2px 0 0; text-align: start; }
.an-demo .v small { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }

/* ── معالج الإعداد — `scenario-setup.js` ── */
.scenario-top [data-open-setup] { margin-inline-start: auto; }
dialog.setup-dlg { width: min(560px, calc(100vw - 32px)); background: var(--card); }
.setup-lead { margin: 0 0 16px; color: var(--ink-2); font-size: 14.5px; }
.setup-form .field { margin-bottom: 16px; }
.setup-form input[type=url], .setup-form input[type=text], .setup-form input[type=password] { width: 100%; }
.setup-hint { margin: 6px 0 0; font-size: 12.5px; }
.setup-choice { display: flex; gap: 18px; flex-wrap: wrap; }
.setup-choice label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; cursor: pointer; }
.setup-login { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--hover); }
.setup-login[hidden] { display: none; }
.setup-login .field:last-child { margin-bottom: 0; }
.setup-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .setup-two { grid-template-columns: 1fr; } }
.setup-wait { display: flex; gap: 16px; align-items: center; padding: 10px 0; }
.setup-wait p { margin: 4px 0 0; font-size: 13px; }
.setup-spin { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; border: 3px solid var(--indigo-soft); border-top-color: var(--indigo-d); animation: tl-spin .8s linear infinite; }
.setup-shot { display: block; width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }

/* ── «اختر من الشاشة» — `scenario-editor.js` · `openPicker` ── */
.se-target { display: flex; gap: 6px; align-items: center; flex: 3 1 260px; min-width: 0; }
.se-target > select, .se-target > input { flex: 1 1 auto; min-width: 0; }
.se-pickscreen { flex-shrink: 0; white-space: nowrap; }
dialog.pick-dlg { width: min(1100px, calc(100vw - 32px)); background: var(--card); }
dialog.pick-dlg .body { max-height: 80vh; }
.pick-stage { position: relative; width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line-2); }
.pick-stage img { display: block; width: 100%; height: 100%; user-select: none; }
.pick-box { position: absolute; padding: 0; margin: 0; border: 2px solid transparent; border-radius: 4px; background: transparent; cursor: pointer; }
.pick-box:hover, .pick-box:focus-visible { border-color: var(--indigo-d); background: rgba(99, 102, 241, .14); outline: none; }
.pick-box.on { border-color: var(--ok); background: rgba(4, 120, 87, .12); }
.pick-label { min-height: 22px; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.pick-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; }
.pick-thumb { flex: 0 0 140px; padding: 4px; border: 2px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; font: inherit; font-size: 12px; color: var(--ink-2); }
.pick-thumb img { display: block; width: 100%; border-radius: 4px; margin-bottom: 4px; }
.pick-thumb[aria-pressed=true] { border-color: var(--indigo-d); color: var(--ink); font-weight: 600; }

/* ── التايم لاين بلا «الخطوات»: خصائص المشهد، «+ مشهد»، وإعدادات الدرس ── */
.tl-view-head .tl-push { margin-inline-start: auto; }
.tl-scn-add { border-style: dashed; color: var(--indigo-d); font-weight: 600; padding-inline: 12px; }
.tl-field textarea { width: 100%; min-height: 96px; resize: vertical; font: inherit; font-size: 14px; line-height: 1.6; }
.tl-field .se-seg { width: 100%; }
.tl-insp-head > b { font-size: 14px; }
.tl-insp-head > .tl-push { flex: 1; }
dialog.tl-settings-dlg { width: min(760px, calc(100vw - 32px)); background: var(--card); }
dialog.tl-settings-dlg .body { max-height: 72vh; }
dialog.tl-settings-dlg .se-settings > summary { display: none; }

/* ── التايم لاين: شريط أدوات (كفوتوشوب) · المشهد مطويّ · الخصائص وحدها ── */
.tl-desk { grid-template-columns: 46px minmax(0, 1.7fr) minmax(260px, 1fr); }
.tl-tools { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--side); position: sticky; top: 12px; }
.tl-tool { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--side-muted); cursor: pointer; padding: 0; }
.tl-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl-tool:hover, .tl-tool:focus-visible { background: rgba(255, 255, 255, .1); color: var(--side-ink); outline: none; }
.tl-tool.on { background: var(--indigo); color: #fff; }
.tl-tool-sep { display: block; width: 24px; height: 1px; background: rgba(255, 255, 255, .15); margin: 3px 0; }
.tl-tool-tip { position: absolute; inset-inline-start: calc(100% + 8px); top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 20; background: var(--night); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.tl-tool:hover .tl-tool-tip, .tl-tool:focus-visible .tl-tool-tip { opacity: 1; }
.tl-side { display: flex; flex-direction: column; }
.tl-tabs { display: flex; align-items: stretch; gap: 2px; padding: 0 6px 0 4px; border-bottom: 1px solid var(--line); background: var(--hover); font-size: 13px; flex: none; min-width: 0; }
.tl-tabs .tl-push { flex: 1; }
.tl-tabs .tl-voice { align-self: center; }
.tl-tab { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 9px 10px 7px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.tl-tab:hover { color: var(--ink); }
.tl-tab.on { color: var(--ink); border-bottom-color: var(--indigo); }
.tl-tab-sum { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tl-tabbody { overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.tl-tabbody[hidden] { display: none; }
.tl-sum-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 14ch; }
.tl-props-empty { margin: 0; }
@media (max-width: 900px) {
  .tl-desk { grid-template-columns: minmax(0, 1fr); }
  .tl-tools { flex-direction: row; flex-wrap: wrap; justify-content: center; position: static; }
  .tl-tool-sep { width: 1px; height: 24px; margin: 0 3px; }
  .tl-tool-tip { display: none; }
}
/* الشريط فوق المعاينة: `sticky` يصنع طبقةً بلا رتبة فكانت المعاينة (بعده) تُرسم فوق تلميحاته.
   والتلميح فاتحٌ بحدّ وظلّ — يُقرأ فوق المعاينة الداكنة. */
.tl-tools { z-index: 30; }
.tl-tool-tip { background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: 0 8px 24px -8px rgba(5, 8, 22, .45); font-size: 13px; padding: 5px 10px; }

/* ══ مساحة عمل التايم لاين — شاشةٌ ثابتة كبرامج المونتاج ══
   الأدوات يساراً، المعاينة وسطاً، المشهد والخصائص يميناً، والمشاهد والمحور أسفل —
   كلٌّ في مكانه لا يتحرّك، وما يطول منه يتمرّر داخل لوحته وحدها. وعلى الهاتف يبقى
   التخطيط العاديّ: لا تتّسع الشاشة لمحرّرٍ ثابت. */
@media (min-width: 901px) {
  html.tl-locked, html.tl-locked body { overflow: hidden; }
  html.tl-locked .save-bar { display: none; }
  .tl.tl-full {
    position: fixed; inset: 0; z-index: 45; background: var(--bg);
    display: grid; gap: 8px; padding: 8px;
    grid-template-columns: 50px minmax(0, 1fr) 168px minmax(300px, 24vw);
    grid-template-rows: auto minmax(0, 1fr) minmax(150px, 30vh);
    grid-template-areas: "top top top top" "tools view scenes side" "track track track track";
  }
  .tl.tl-full[hidden] { display: none; }
  .tl-full > .tl-desk { display: contents; }
  .tl-full > .se-hint { display: none; }

  .tl-full .tl-top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); min-width: 0; }
  .tl-top-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .tl-top .tl-push { flex: 1; }

  .tl-full .tl-tools { grid-area: tools; position: relative; top: 0; z-index: 5; align-self: stretch; }

  .tl-full .tl-view { grid-area: view; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
  .tl-stagebox { container-type: size; min-height: 0; display: grid; place-items: center; background: #05070f; }
  .tl-full .tl-stage { width: min(100cqw, calc(100cqh * var(--ar, 1.7778))); max-height: 100cqh; }
  .tl-full .tl-caption { min-height: 0; padding-block: 6px; }

  .tl-full .tl-side { grid-area: side; min-height: 0; }
  .tl-full .tl-tabbody { flex: 1; }

  /* المشاهد عموداً بين المعاينة واللوحة الجانبيّة — يتمرّر وحده إن كثرت. */
  .tl-full .tl-scenebox { grid-area: scenes; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
  .tl-full .tl-scenebox .tl-view-head { flex: none; }
  .tl-full .tl-scenebox .tl-scenes { flex: 1 1 auto; flex-direction: column; flex-wrap: nowrap; overflow-y: auto; min-height: 0; padding: 8px; overscroll-behavior: contain; }
  .tl-full .tl-scn { flex: none; max-width: none; width: 100%; border-radius: 10px; }

  .tl-full .tl-track { grid-area: track; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
  .tl-full .tl-scroll { overflow: auto; min-height: 0; }
}

/* شريط التشغيل والحالة نحيفان — الطول للمعاينة (2026-10-28). */
.tl-transport .btn.sm { padding-block: 2px; min-height: 0; line-height: 1.6; }
.tl-transport .se-icon { width: 24px; height: 24px; }
.tl-full .tl-status { padding: 2px 12px; min-height: 0; font-size: 12px; }
.tl-full .tl-top { padding-block: 4px; }
.tl-whole[aria-pressed=true] { background: var(--indigo-soft); border-color: var(--indigo); color: var(--indigo-dd); }

/* «الدرس كاملاً»: كل مشهدٍ شريحةٌ على المحور، وغير المحرَّر منها باهت. */
.tl-band { position: absolute; top: 0; bottom: 0; pointer-events: none; border-inline-start: 2px solid var(--indigo); }
.tl-band:not(.on) { background: rgba(120, 128, 160, .07); }
.tl-band.on { background: rgba(99, 102, 241, .05); }
.tl-band-n { position: absolute; top: 2px; left: 4px; font-size: 11px; font-weight: 700; color: var(--indigo-d); white-space: nowrap; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; background: var(--card); padding: 0 4px; border-radius: 4px; }
.tl-item.other { opacity: .55; }
.tl-item.other:hover { opacity: .85; }

/* التايم لاين مطويّاً — بطاقةٌ صغيرة تُعيده، والصفحة تحته تُرى (الإنتاج والسجلّ والإعدادات). */
.tl.tl-mini > :not(.tl-launch) { display: none !important; }
.tl-launch { display: none; }
.tl.tl-mini > .tl-launch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); }
.tl-launch .muted { font-size: 13px; }
.tl-launch .tl-push { flex: 1; }
@media (max-width: 900px) { .tl-exit { display: none; } }
@media (max-width: 900px) { .tl-top [data-open-setup] { display: none; } }

/* صفحة الدرس: أربع بطاقاتٍ 2×2 — السيناريو | التفاصيل، الإنتاج | النشر. كلّ صفٍّ بطولٍ
   واحد، والمحتوى من أعلى البطاقة. والملفّ (YAML) حين يُفتح يأخذ العرض كلّه. */
.row.vgrid, .row.vgrid.tl-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.row.vgrid > .card { margin: 0; align-self: stretch; }
.row.vgrid > .card > h2:first-child { margin-top: 0; }
.row.vgrid > .scenario-card:has(> textarea:not([hidden])) { grid-column: 1 / -1; }
.row.vgrid > .scenario-card { display: flex; flex-direction: column; }
.row.vgrid > .scenario-card > .tl.tl-mini:not([hidden]) { flex: 1; display: flex; }
.row.vgrid > .scenario-card > .tl.tl-mini > .tl-launch { flex: 1; flex-direction: column; justify-content: center; text-align: center; gap: 10px; padding: 24px 16px; }
.row.vgrid > .scenario-card > .tl.tl-mini > .tl-launch .tl-push { display: none; }
@media (max-width: 960px) { .row.vgrid, .row.vgrid.tl-wide { grid-template-columns: minmax(0, 1fr); } }

/* ── جولة التايم لاين التعريفية (`tour` في scenario-timeline.js) ── */
.tl-tour-shade { position: fixed; inset: 0; z-index: 70; background: transparent; }
.tl-tour-ring { position: fixed; z-index: 71; pointer-events: none; border-radius: 14px; border: 3px solid #0EA5E9; box-shadow: 0 0 0 6px rgba(14, 165, 233, .22); transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.tl-tour-card { position: fixed; z-index: 72; background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 18px 48px -12px rgba(5, 8, 22, .45); padding: 14px 16px 12px; transition: left .25s ease, top .25s ease; }
.tl-tour-card::before { content: ''; position: absolute; width: 14px; height: 14px; background: inherit; border: inherit; transform: rotate(45deg); }
.tl-tour-card[data-side=below]::before { top: -8px; left: calc(var(--ax) - 7px); border-right: 0; border-bottom: 0; }
.tl-tour-card[data-side=above]::before { bottom: -8px; left: calc(var(--ax) - 7px); border-left: 0; border-top: 0; }
.tl-tour-card[data-side=left]::before { right: -8px; top: calc(var(--ay) - 7px); border-left: 0; border-bottom: 0; }
.tl-tour-card[data-side=right]::before { left: -8px; top: calc(var(--ay) - 7px); border-right: 0; border-top: 0; }
.tl-tour-card[data-side=inside]::before { display: none; }
.tl-tour-head { display: flex; align-items: baseline; gap: 10px; font-size: 15px; }
.tl-tour-n { margin-inline-start: auto; color: var(--muted); font-size: 12px; font-family: var(--font-latin); }
.tl-tour-card p { margin: 6px 0 12px; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.tl-tour-foot { display: flex; align-items: center; gap: 8px; }
.tl-tour-foot .tl-push { flex: 1; }
.tl-tour-skip { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 2px; }
.tl-tour-skip:hover { color: var(--ink); }
.tl-tour-btn { min-width: 30px; font-weight: 700; }

/* ── استهلاك الذكاء الاصطناعي (/admin/ai-usage) ── */
.aiu-days { display: flex; align-items: flex-end; gap: 4px; height: 150px; margin-top: 12px; direction: ltr; }
.aiu-day { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.aiu-day i { display: block; width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #818cf8, #6366f1); }
.aiu-day span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.aiu-days:has(.aiu-day:nth-child(15)) .aiu-day span { display: none; }
.aiu-chain { margin: 8px 0 0; padding-inline-start: 22px; display: grid; gap: 12px; }
.aiu-chain .badge { margin-inline-start: 6px; }
.aiu-sec { margin-top: 18px; }
.aiu-head { padding: 18px 20px 4px; }
.aiu-head h2 { margin: 0; }
.aiu-head p { margin: 4px 0 0; font-size: 13px; max-width: 70ch; }
.aiu-quota { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 20px 6px; }
.aiu-q { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card, #fff); }
.aiu-q.off { opacity: .6; }
.aiu-q-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.aiu-q-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aiu-q-name b { font-size: 13.5px; overflow-wrap: anywhere; }
.aiu-q-name .muted { font-size: 12px; }
.aiu-q-top .badge { flex-shrink: 0; }
.aiu-q-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.aiu-q-nums div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aiu-q-nums span { font-size: 11.5px; }
.aiu-q-nums b { font-size: 18px; line-height: 1.2; white-space: nowrap; }
.aiu-q-nums b small { font-size: 12px; font-weight: 500; color: var(--muted); }
.aiu-q-nums div:last-child b { font-size: 14px; padding-top: 3px; }
.aiu-q .meter { margin-top: 0; height: 6px; }
.aiu-q-foot { margin: 0; font-size: 12px; line-height: 1.7; }
.aiu-q-foot .badge { font-size: 11px; padding: 1px 8px; margin-inline-end: 4px; }
.aiu-429 { color: var(--bad); }
/* كل نموذجٍ في سطر: الاسم والحالة | الأرقام | الشريط — والتفاصيل تحتها. */
@media (min-width: 761px) {
  .aiu-q { display: grid; grid-template-columns: minmax(230px, 1.2fr) minmax(300px, 1.5fr) minmax(140px, 1fr); align-items: center; column-gap: 22px; row-gap: 6px; padding: 10px 16px; }
  .aiu-q-top { align-items: center; }
  .aiu-q-foot { grid-column: 1 / -1; }
}
.aiu-note { margin: 0; padding: 4px 20px 16px; font-size: 12px; }
.aiu-members .meter.aiu-mini { margin-top: 6px; min-width: 90px; max-width: 140px; }
.aiu-members td { vertical-align: middle; }

/* ── نافذة متابعة السيناريو الآلي (`auto-progress.js`) ── */
.auto-modal { width: min(620px, calc(100vw - 32px)); padding: 0; }
.auto-modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; }
.auto-modal-head h2 { margin: 0 0 4px; font-size: 18px; }
.auto-modal-head p { margin: 0; font-size: 14px; }
.auto-spark { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: linear-gradient(135deg, #818cf8, #22d3ee); box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .9); }
.auto-modal:not(.finished) .auto-spark { animation: auto-pulse 1.6s ease-in-out infinite; }
@keyframes auto-pulse { 50% { transform: scale(.92); opacity: .75; } }
.auto-x { margin-inline-start: auto; background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.auto-x:hover { background: var(--line-2); }
.auto-events { list-style: none; margin: 0 22px; padding: 10px 0; max-height: 46vh; overflow: auto; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: grid; gap: 2px; font-size: 13.5px; text-align: left; }
.auto-events li { display: flex; gap: 10px; padding: 5px 6px; border-radius: 8px; animation: auto-in .25s ease; }
.auto-events li time { color: var(--muted); font-family: var(--mono, monospace); font-size: 12px; flex-shrink: 0; padding-top: 1px; }
.auto-events li span { min-width: 0; overflow-wrap: anywhere; }
.auto-events li.ok { color: var(--ok, #059669); font-weight: 600; }
.auto-events li.err { color: var(--err, #dc2626); font-weight: 600; }
.auto-events li.cur { background: color-mix(in srgb, var(--indigo, #6366f1) 10%, transparent); }
.auto-events li.cur span::after { content: ''; display: inline-block; width: 11px; height: 11px; margin-inline-start: 8px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: auto-spin .8s linear infinite; }
@keyframes auto-spin { to { transform: rotate(360deg); } }
@keyframes auto-in { from { opacity: 0; transform: translateY(4px); } }
.auto-done, .auto-fail { margin: 14px 22px 0; }
.auto-done p { margin: 0; }
.auto-modal-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 22px 18px; }
.auto-modal-foot .muted { flex: 1; font-size: 12.5px; min-width: 200px; }
.auto-modal.finished .auto-modal-foot { justify-content: flex-end; }

/* لقطة المعاينة في بطاقة مصمّم المشاهد المطويّة — `launchShot` في scenario-timeline.js. */
.tl-launch-shot { display: block; width: 100%; max-height: 300px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--line-strong); cursor: pointer; box-shadow: 0 10px 28px -14px rgba(15, 23, 42, .45); }
.tl-launch-shot[hidden] { display: none; }
.row.vgrid > .scenario-card > .tl.tl-mini > .tl-launch .tl-launch-shot { max-width: 520px; margin: 4px auto; }

/* السيناريو الآلي — الطريق الرئيسي في صفحة الإنشاء: بطاقةٌ بعرض الصفّ وأبرز من أختيها. */
.start-opt.start-hero { grid-column: 1 / -1; }
.start-hero .start-card {
  padding: 20px 22px; gap: 16px; border: 1.5px solid #a5b4fc;
  background: linear-gradient(120deg, #eef0ff 0%, #ecfbff 100%);
  box-shadow: 0 14px 34px -24px rgba(79, 70, 229, .9);
}
.start-hero .start-ico { width: 50px; height: 50px; border-radius: 15px; }
.start-hero .start-ico svg { width: 25px; height: 25px; }
.start-hero .start-tx b { font-size: 17px; }
.start-hero .start-tx > span { font-size: 13.5px; color: var(--ink-2); }
.start-hero input:checked + .start-card { background: linear-gradient(120deg, #e4e7ff 0%, #def7ff 100%); box-shadow: inset 0 0 0 1.5px var(--indigo), 0 18px 40px -22px rgba(79, 70, 229, .95); }
.btn.auto-go { padding: 12px 26px; font-size: 15px; background: linear-gradient(135deg, #6366f1, #0891b2); border-color: transparent; box-shadow: 0 12px 26px -14px rgba(79, 70, 229, .95); }
.auto-modal [hidden] { display: none !important; }
.start-tx > span.start-dev { color: var(--indigo-dd); font-weight: 600; }

/* صفحة الإنشاء: هامشٌ بين بطاقات الاختيار والقسم الذي تحتها، وحول «الموقع يحتاج تسجيل دخول» و«إعدادات الفيديو». */
#lesson-auto, #lesson-ai, #lesson-manual { margin-top: 20px; }
#auto-form .field:has(#auto-login) { margin: 18px 0; }
#auto-login-fields { margin-bottom: 18px; }
#auto-options { margin-top: 28px; }

/* ── التعديل الآلي في صفحة الدرس — `admin/partials/auto-edit.blade.php` ──── */
/* قبل مساعد الكتابة وبلونٍ أدفأ: هذا الطريق الأوّل لمن لا يبرمج، وذاك للمبرمجين. */
.assist.auto-edit { background: linear-gradient(120deg, #fff7ed 0%, #fdf4ff 55%, #f5f3ff 100%); border-color: #f5d0fe; }
.assist.auto-edit .assist-ico { background: linear-gradient(135deg, #f472b6, #8b5cf6); }
.assist.auto-edit .assist-body .field { max-width: 640px; }
.assist-tx > span.start-dev { color: var(--indigo-dd); font-weight: 600; font-size: 12.5px; margin-top: 6px; }
.assist-tx .eyebrow .start-rec { margin-inline-start: 6px; }
.auto-render { margin: 14px 22px 0; }
.auto-render p { margin: 6px 0 0; font-size: 13px; }
.auto-bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.auto-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #6366f1, #22d3ee); transition: width .6s ease; }
.auto-video { display: block; width: calc(100% - 44px); margin: 14px 22px 0; border-radius: 10px; background: #000; }

/* ══════════ نوع الفيديو — admin/partials/video-type.blade.php · video-type.js ══════════ */
.vtype { margin-top: 0; }
.vtype-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vtype-opt .start-card { padding: 12px 14px; }
.vtype-ico { background: var(--indigo-soft); color: var(--indigo); }
.vtype-ico svg { width: 20px; height: 20px; }
.vtype-opt input:checked + .start-card .vtype-ico { background: #fff; box-shadow: 0 0 0 1px #c7d2fe; }
.vtype-opt .start-tx b { font-size: 14px; }
.vtype-series { margin: 10px 0 0; font-size: 12.5px; }
.vtype-series:empty { display: none; }
.vtype-cta { margin: 14px 0 0; max-width: 560px; }
.vtype-cta[hidden] { display: none; }
.vtype-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.vtype-sum { font-size: 12.5px; min-width: 0; }
.vtype-flag { margin-inline-start: 0; }
.vtype-flag[hidden], .vtype-reset[hidden] { display: none; }
.vtype-notice { margin: 10px 0 0; }
.vtype-notice[hidden], .vtype-settings[hidden] { display: none; }
.vtype-settings { margin-top: 12px; }
.vtype-settings .opt-card { box-shadow: none; }
.vtype-saved { font-size: 12.5px; }
.vtype-card { margin: 0 0 18px; }
.vtype-badge { font-size: 11px; font-weight: 600; background: var(--indigo-soft); color: var(--indigo-dd); white-space: nowrap; margin-inline-start: 6px; vertical-align: 1px; }
@media (max-width: 900px) { .vtype-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .vtype-cards { grid-template-columns: 1fr; } }

/* ══════════ معالج صفحة الإنشاء — admin/videos/create.blade.php · create-wizard.js ══════════ */
.wz-off { display: none !important; }
.wz-bar { list-style: none; margin: 0 0 18px; padding: 0; display: flex; gap: 8px; counter-reset: none; }
.wz-dot { flex: 1; position: relative; min-width: 0; }
.wz-dot::after { content: ""; position: absolute; top: 15px; inset-inline-start: calc(50% + 20px); inset-inline-end: calc(-50% + 12px); height: 2px; background: var(--line-strong); }
.wz-dot:last-child::after { display: none; }
.wz-dot.is-done::after { background: var(--indigo); }
.wz-dot-btn { all: unset; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; text-align: center; cursor: default; }
.wz-dot-btn:not(:disabled) { cursor: pointer; }
.wz-dot-btn:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; border-radius: 8px; }
.wz-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: #fff; color: var(--muted); border: 1.5px solid var(--line-strong); position: relative; z-index: 1; }
.wz-lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.wz-dot.is-now .wz-num { background: var(--indigo); border-color: var(--indigo); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .8); }
.wz-dot.is-now .wz-lbl { color: var(--ink); }
.wz-dot.is-done .wz-num { background: var(--indigo-soft); border-color: var(--indigo); color: var(--indigo-dd); }
.wz-dot.is-done .wz-dot-btn:hover .wz-lbl { color: var(--indigo-dd); }
.wz-mobile { display: none; margin: -8px 0 14px; font-weight: 600; }
.wz-step { margin: 0; }
.wz-paths { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wz-paths .start-opt.start-hero { grid-column: auto; }
.wz-dev { margin: 22px 0 2px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.wz-dev-sub { margin: 0 0 10px; font-size: 12.5px; }
.wz-pane .card { margin: 0 0 16px; }
.wz-pane .assist { margin-top: 0; }
.wz-adv { margin-top: 16px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; }
.wz-adv > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.wz-adv[open] > summary { margin-bottom: 12px; }
.wz-adv .opt-card { box-shadow: none; }
.wz-sum { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--indigo-soft); color: var(--indigo-dd); font-weight: 600; font-size: 13.5px; }
.wz-sum:empty { display: none; }
.wz-go { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.wz-nav { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.wz-nav #wz-next { margin-inline-start: auto; }
.wz-nav #wz-back[hidden], .wz-nav #wz-next[hidden] { display: none; }
.wz-nav .btn.is-off { opacity: .5; }
@media (max-width: 640px) {
  .wz-lbl { display: none; }
  .wz-mobile { display: block; }
  .wz-paths { grid-template-columns: 1fr; }
}
/* الكاتب الآلي في المعالج بشكله في صفحة الدرس (`.assist.auto-edit`). */
.wz-auto { margin-bottom: 16px; }
.wz-auto .assist-body { padding-top: 16px; }
.wz-auto .assist-body .field { max-width: 640px; }
.wz-auto #auto-options .opt-card { box-shadow: none; }
.wz-auto .assist-body #auto-options { max-width: none; }

/* فيديو مكتمل — المعاينة فوق بنصف العرض وبجانبها التنزيل والنشر وزرّ «تعديل». انظر `admin/videos/edit.blade.php`. */
.done-hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; margin: 0 0 18px; }
.done-hero > .card { margin: 0; }
.done-hero .done-preview video { display: block; width: 100%; height: auto; border-radius: 8px; }
.done-hero .done-preview video.portrait { width: auto; height: min(72vh, 640px); }
.done-hero .done-side > h2:first-child { margin-top: 0; }
@media (max-width: 760px) { .done-hero { grid-template-columns: minmax(0, 1fr); } }

/* سيناريو جاهز لم يُنتَج — دعوةٌ بارزة في رأس الصفحة إلى «أنتج». */
.note.ready-render { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 15px; padding: 14px 16px; }
.note.ready-render .ready-render-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* الكاتب الآلي في المعالج — الخطوة ③ بشكل حقل البرومبت في خيار المبرمجين: خطواتٌ مرقّمة وحقولٌ بعرضها كلّه. */
.wz-auto .assist-steps { max-width: 760px; }
.wz-auto .assist-step:first-child { padding-top: 4px; }
.wz-auto .assist-main h3 label { font: inherit; color: inherit; margin: 0; display: inline; }
.wz-auto .assist-scope textarea { min-height: 150px; }
.wz-auto input.wz-big {
  width: 100%; display: block; background: #fff; height: auto;
  border: 1px solid var(--line-strong); border-radius: 11px; padding: 12px 14px;
  font-size: 14.5px; line-height: 1.6; color: var(--ink);
}
.wz-auto input.wz-big:focus { outline: 0; border-color: var(--indigo); box-shadow: var(--ring); }
.wz-auto .wz-login {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px;
  margin: 14px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .7);
}
.wz-auto .wz-login[hidden] { display: none; }
.wz-auto .wz-login .field { margin: 0; max-width: none; }
.wz-auto .wz-login .wz-login-url, .wz-auto .wz-login .wz-login-note { grid-column: 1 / -1; }
.wz-auto .wz-login .wz-login-note { margin: 0; }
@media (max-width: 640px) { .wz-auto .wz-login { grid-template-columns: minmax(0, 1fr); } }

/* نسخٌ أخرى من الفيديو (لغة / كمبيوتر ↔ موبايل) — `admin/videos/edit.blade.php`. */
.variant-card { margin: 0 0 18px; }
.variant-rows { display: grid; gap: 10px; }
.variant-row { display: grid; grid-template-columns: 170px minmax(0, 260px) auto; gap: 10px; align-items: center; margin: 0; }
.variant-row label { font-weight: 600; margin: 0; }
@media (max-width: 640px) { .variant-row { grid-template-columns: minmax(0, 1fr) auto; } .variant-row label { grid-column: 1 / -1; } }

/* ── رمز الدخول إلى موقع العميل (`signin-code.js`) ── */
.signin-code-modal { width: min(480px, calc(100vw - 32px)); }
.signin-code-body { padding: 0 22px; }
.signin-code-body input[data-code-input] { width: 100%; box-sizing: border-box; font-size: 26px; letter-spacing: .3em; text-align: center; font-family: ui-monospace, monospace; padding: 10px 12px; }
.signin-code-body p { margin: 8px 0 0; font-size: 13px; }
.signin-code-body p.err { color: var(--bad); }
.signin-code-body p.ok { color: var(--ok); }
.signin-code-modal .auto-modal-foot { justify-content: flex-end; }
/* أيقونات العلامات في الإحصاءات — `App\Support\BrandIcon`. */
.bi { width: 15px; height: 15px; flex: none; vertical-align: -2px; margin-inline-end: 6px; }
.bi-l { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font: 700 9.5px/1 var(--font-latin); }
.hbar .nm .bi { margin-inline-end: 7px; }
.flag { width: 18px; height: 13.5px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .1); vertical-align: -2px; margin-inline-end: 7px; object-fit: cover; }

/* Videos tabs: which tab holds the work that has the queue right now (render, check or AI scenario). */
.tabs a .tab-busy { display: inline-flex; align-items: center; gap: 5px; margin-inline-start: 7px; padding: 1px 8px 1px 7px;
  border-radius: 999px; background: var(--run-bg); color: var(--run); font-size: 12px; font-weight: 700; vertical-align: 1px; }
.tabs a .tab-busy i { width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 rgba(67, 56, 202, .5); animation: pulse-ring 1.4s ease-out infinite; }
