/* ── خط البراند مُضمَّن ─────────────────────────────────────────────
   IBM Plex Sans Arabic — نفس خط الموقع، رخصة OFL فالتضمين مسموح.
   مُضمَّن لا محمَّل من الشبكة: اللوحة تشتغل بلا إنترنت، ورابط خارجي
   يعني خطًّا مكسورًا عند من لا اتصال له. ولأنه مُضمَّن يطلع الشكل
   نفسه على ماك وويندوز — كان ويندوز يقع على خطّ نظامٍ مختلف تمامًا
   لأن SF Arabic خطّ آبل وحدها.
   الأوزان ٤٠٠/٥٠٠/٦٠٠/٧٠٠ هي المستعملة هنا؛ و٨٠٠ يقع على ٧٠٠ لأن العائلة تقف عنده.
   ───────────────────────────────────────────────────────────────── */
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:400;font-display:swap;src:url(../assets/fonts/plex-arabic-400.woff2) format('woff2');unicode-range:U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:400;font-display:swap;src:url(../assets/fonts/plex-latin-400.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:500;font-display:swap;src:url(../assets/fonts/plex-arabic-500.woff2) format('woff2');unicode-range:U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:500;font-display:swap;src:url(../assets/fonts/plex-latin-500.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:600;font-display:swap;src:url(../assets/fonts/plex-arabic-600.woff2) format('woff2');unicode-range:U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:600;font-display:swap;src:url(../assets/fonts/plex-latin-600.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:700;font-display:swap;src:url(../assets/fonts/plex-arabic-700.woff2) format('woff2');unicode-range:U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-weight:700;font-display:swap;src:url(../assets/fonts/plex-latin-700.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}

/* Auto edit-thameen — بهوية ثَمين البصرية */

:root {
  --bg:        #08080b;
  --bg-soft:   #0d0d12;
  --panel:     #14141c;
  --panel-2:   #191922;
  --line:      rgba(91, 184, 232, .14);
  --line-2:    rgba(255, 255, 255, .07);

  --text:      #eef1f5;
  --dim:       rgba(238, 241, 245, .74);
  --faint:     rgba(238, 241, 245, .44);

  --primary:       #2C8DD0;
  --primary-light: #5BB8E8;
  --primary-soft:  #8FD9F0;
  --primary-tint:  rgba(91, 184, 232, .12);

  --go:     #2fbf85;
  --warn:   #e8a33d;
  --danger: #ff6b6b;

  --grad-diamond: linear-gradient(180deg, #8FD9F0 0%, #5BB8E8 35%, #2C8DD0 70%, #134870 100%);
  --grad-cta:     linear-gradient(135deg, #5BB8E8 0%, #2C8DD0 100%);
  --grad-title:   linear-gradient(180deg, #ffffff 0%, #8FD9F0 70%, #5BB8E8 100%);

  --r:    10px;
  --r-sm: 7px;
  --font-ar: "IBM Plex Sans Arabic", "SF Arabic", "Geeza Pro", "Damascus", "Tajawal", "Cairo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 13px/1.65 var(--font-ar);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
body { display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.hidden { display: none !important; }
/*
 * خاصية hidden نفسها، لا الكلاس وحده. قاعدة المتصفّح لها display:none
 * بأولوية دنيا، فأي قاعدة مؤلِّف تضع display تكسرها — و.icon-btn تضع
 * inline-flex. فكان زرّا المنحنى في الرأس (الكيبورد وعلامة الاستفهام)
 * يظهران في كل التبويبات رغم hidden، وضغطهما لا يفعل شيئًا: مستمعاتهما
 * لا تُركّب قبل فتح تبويب المنحنى، والمودال نفسه يسكن داخل لوحة المنحنى
 * فيبقى غير مرئي ما دامت غير نشطة.
 */
[hidden] { display: none !important; }

/* ── الرأس ───────────────────────────────────────────── */

.head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  background: radial-gradient(120% 180% at 100% 0%, rgba(91,184,232,.13), transparent 60%), var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.head h1 {
  font-size: 15px;
  background: var(--grad-title);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.head p {
  margin: 0; font-size: 11px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px;
}

/* الماسة — شعار ثَمين */
.logo {
  width: 22px; height: 22px; flex: 0 0 auto;
  background: url("../logo.png") center/contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(91, 184, 232, .45));
  position: relative;
}
.logo::before { content: none; }
.logo-lg { width: 26px; height: 26px; }

/* شريط تفاصيل المشروع — أسفل اللوحة */
.projbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-top: 1px solid var(--line);
  background: var(--bg-soft); color: var(--faint); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.projbar .ic { width: 12px; height: 12px; opacity: .7; }

.head-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.icon-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--dim);
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; transition: .15s;
}
.icon-btn:hover { color: var(--primary-soft); border-color: rgba(91,184,232,.45); background: var(--primary-tint); }
/*
 * زرّا المنحنى في الرأس خارج تبويبهما. الاختفاء المفاجئ يربك — يظنّ
 * المستخدم أن الزرّ راح — والخفوت يقول «موجود، لكن ليس هنا»، والتلميح
 * يقول أين. ولا نستعمل pointer-events:none لئلّا يموت التلميح معه.
 */
.icon-btn.is-off { opacity: .3; cursor: default; }
.icon-btn.is-off:hover {
  color: var(--dim); border-color: var(--line); background: var(--panel-2);
}

/* ── التبويبات ───────────────────────────────────────── */

.tabs {
  flex: 0 0 auto; display: flex; gap: 4px;
  padding: 9px 12px 0; background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--faint);
  padding: 9px 6px; cursor: pointer; font-size: 13px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .15s;
}
.tab:hover { color: var(--dim); }
.tab.is-active { color: var(--primary-soft); border-bottom-color: var(--primary-light); }

.pane { display: none; }
.pane.is-active { display: block; }

/* ── التخطيط ─────────────────────────────────────────── */

/*
 * شريط التمرير — قاعدة عامة لا لعناصر بعينها.
 * كانت مكتوبة لكل عنصر على حدة (main, .ltable, .dd-pop…)، فأي عنصر جديد
 * يُمرَّر يظهر بشريط النظام الأبيض وسط واجهة داكنة — كما حدث في نافذة
 * الاختصارات. القاعدة العامة تغطّي ما هو قائم وما سيُضاف.
 * وscrollbar-color للمحرّكات التي لا تعرف بادئة webkit.
 */
* { scrollbar-width: thin; scrollbar-color: rgba(91,184,232,.3) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(91,184,232,.26); border-radius: 5px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(91,184,232,.5); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

main { flex: 1 1 auto; overflow-y: auto; padding: 14px; }
main::-webkit-scrollbar, .preview::-webkit-scrollbar { width: 8px; }
main::-webkit-scrollbar-thumb, .preview::-webkit-scrollbar-thumb {
  background: rgba(91,184,232,.28); border-radius: 4px; border: 2px solid var(--bg);
}

.step {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 13px; padding: 15px; margin-bottom: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 2px 10px rgba(0,0,0,.25);
}
.step.is-locked { opacity: .32; pointer-events: none; }

.step-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.step-head h2 { font-size: 13px; color: var(--dim); font-weight: 600; }
.step-head .n {
  width: 20px; height: 20px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #04141f;
  background: var(--grad-cta); border-radius: 50%;
  box-shadow: 0 0 12px rgba(91,184,232,.4);
}
.step:not(.is-locked) .step-head h2 { color: var(--text); }

.field-sep { height: 1px; background: var(--line); margin: 15px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

/* ── الأزرار ─────────────────────────────────────────── */

.btn {
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 10px 15px; cursor: pointer; font-weight: 600; font-size: 13px; transition: .16s;
}
.btn:disabled { opacity: .35; cursor: default; }
.btn-block { display: block; width: 100%; }
.btn-primary {
  background: var(--grad-cta); color: #fff;
  box-shadow: 0 8px 24px rgba(44,141,208,.35), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:not(:disabled):hover { filter: brightness(1.12); }
.btn-go {
  background: linear-gradient(135deg, #8FD9F0 0%, #2C8DD0 100%); color: #04141f;
  box-shadow: 0 8px 26px rgba(143,217,240,.35), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-go:not(:disabled):hover { filter: brightness(1.1); }
.btn-ghost {
  background: var(--panel-2); border-color: var(--line); color: var(--dim);
  font-size: 12px; padding: 8px 12px; margin-top: 6px;
}
.btn-ghost:hover { color: var(--primary-soft); border-color: rgba(91,184,232,.45); background: var(--primary-tint); }

.segmented {
  display: flex; gap: 4px; background: var(--bg); padding: 4px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
}
.segmented.col { flex-direction: column; }
.segmented button {
  flex: 1; border: 0; background: transparent; color: var(--faint);
  padding: 8px 5px; border-radius: 5px; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: .15s;
}
.segmented button:hover { color: var(--dim); }
.segmented button.is-active {
  background: var(--grad-cta); color: #fff; box-shadow: 0 4px 14px rgba(44,141,208,.4);
}

.scope-note { margin: 9px 0 13px; font-size: 11px; color: var(--faint); }

/* ── الحقول ──────────────────────────────────────────── */

.ctl { display: block; margin-bottom: 15px; }
.lbl {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--dim); margin-bottom: 6px;
}
.lbl em {
  font-style: normal; font-weight: 700; color: var(--primary-soft);
  font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate;
}

/* المنزلق الموحَّد في كل التبويبات: مسارٌ رفيع ومقبضٌ بحلقة يكبر قليلًا عند التمرير */
input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px;
  background: var(--bg-3, #222731); outline: none; margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--acc, #4aa3ff); border: 2px solid var(--bg-1, #0d0f13);
  box-shadow: 0 0 0 1px var(--acc, #4aa3ff); cursor: pointer;
  transition: transform .16s cubic-bezier(.2, .8, .2, 1);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.06); cursor: grabbing; }

input[type="text"], input[type="password"], select, .dd-btn {
  width: 100%; padding: 8px 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm); outline: none; transition: .15s;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus, .dd-btn:focus {
  border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-tint);
}
input::placeholder { color: rgba(255,255,255,.3); }
select, .dd-btn {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--primary-light) 50%),
                    linear-gradient(135deg, var(--primary-light) 50%, transparent 50%);
  background-position: left 12px top 16px, left 7px top 16px;
  background-size: 5px 5px; background-repeat: no-repeat;
  padding-inline-start: 26px;
}
select:disabled, .dd-btn:disabled { opacity: .45; cursor: default; }
.ltr-input { direction: ltr; text-align: left; }

.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; padding: 5px 0; }

/*
 * علامة الصح: مربّع مرسوم بالهوية نفسها التي يرسم بها مفتاح .sw —
 * حدّ بلون --line وتعبئة متدرّجة عند التفعيل. مربّع النظام الافتراضي
 * كان يخرج أبيض بحوافّ حادّة وسط لوحة داكنة فيبان دخيلًا.
 * موضع الشرطة بـ left/top لا inset-inline: قلبها في العربية يعكس
 * اتّجاه علامة الصح نفسها.
 */
.check input[type="checkbox"],
.gate-terms input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto; position: relative; margin: 0;
  width: 16px; height: 16px;
  background: var(--line-2);
  border: 1px solid var(--line); border-radius: 5px;
  cursor: pointer; transition: background .16s, border-color .16s, box-shadow .16s;
}
.check input[type="checkbox"]::after,
.gate-terms input[type="checkbox"]::after {
  content: ''; position: absolute; left: 5px; top: 2px;
  width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; border-radius: 1px;
  transform: rotate(45deg) scale(.4); opacity: 0;
  transition: transform .16s, opacity .16s;
}
.check input[type="checkbox"]:hover,
.gate-terms input[type="checkbox"]:hover { border-color: var(--primary-light); }
.check input[type="checkbox"]:checked,
.gate-terms input[type="checkbox"]:checked {
  background: var(--grad-cta); border-color: var(--primary-light);
}
.check input[type="checkbox"]:checked::after,
.gate-terms input[type="checkbox"]:checked::after { opacity: 1; transform: rotate(45deg) scale(1); }
.check input[type="checkbox"]:focus-visible,
.gate-terms input[type="checkbox"]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--primary-tint);
}
.check input[type="checkbox"]:disabled { opacity: .45; cursor: default; }
.check:has(input:disabled) { opacity: .55; cursor: default; }

.legend { display: flex; justify-content: space-between; direction: ltr; font-size: 10px; color: var(--faint); }
.hint { display: block; font-size: 10.5px; color: var(--faint); margin: 5px 0 0; line-height: 1.55; }
.hint.center { text-align: center; margin-top: 10px; }
.key { direction: ltr; unicode-bidi: isolate; color: var(--primary-soft); font-weight: 700; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.warn {
  font-size: 11.5px; color: var(--warn); background: rgba(232,163,61,.09);
  border: 1px solid rgba(232,163,61,.28); border-radius: var(--r-sm);
  padding: 8px 10px; margin: 0 0 10px;
}

/* ── أشرطة التقدّم ───────────────────────────────────── */

.bar { height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; width: 35%; border-radius: 2px;
  background: var(--grad-cta); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(100%); } 100% { transform: translateX(-286%); } }
.dl { height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; margin-top: 9px; }
.dl i { display: block; height: 100%; width: 0; background: var(--grad-cta); transition: width .2s; }

/* ── النتيجة ─────────────────────────────────────────── */

.result {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-sm); overflow: hidden; margin-bottom: 10px;
}
.cell { background: var(--panel-2); padding: 9px 11px; display: flex; flex-direction: column; }
.cell .k { font-size: 10.5px; color: var(--faint); }
.cell .v {
  font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums;
  direction: ltr; unicode-bidi: isolate; text-align: right; letter-spacing: -.02em;
}
.cell .v.good { color: var(--primary-soft); }

.meter { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-bottom: 15px; }
/* يبدأ فارغًا: شريطٌ ممتلئ قبل التحليل يقرأ كأن عملًا تمّ فعلًا */
.meter i { display: block; height: 100%; width: 0; background: var(--grad-cta); transition: width .18s; }

/* ── الموجة ──────────────────────────────────────────── */

.wave-wrap { margin-bottom: 13px; }
.wave-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.zoom { display: flex; gap: 4px; }
.zoom button {
  min-width: 27px; height: 25px; padding: 0 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
  border-radius: var(--r-sm); cursor: pointer; font-size: 12px; font-weight: 600;
  line-height: 1; transition: .15s;
}
.zoom button:hover:not(:disabled) { color: var(--primary-soft); border-color: rgba(91,184,232,.45); background: var(--primary-tint); }
.zoom button:disabled { opacity: .3; cursor: default; }
.zoom-level {
  font-size: 11px; color: var(--primary-soft); font-weight: 600;
  font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate;
}

.wave {
  display: block; width: 100%; height: 116px; user-select: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: crosshair;
}
.wave:active { cursor: grabbing; }
.wave-time {
  display: flex; justify-content: space-between; direction: ltr;
  font-size: 10px; color: var(--faint); margin-top: 4px; font-variant-numeric: tabular-nums;
}
.wave-spk {
  display: block; width: 100%; height: 13px; margin-top: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
}
.wave-mini {
  display: block; width: 100%; height: 22px; margin-top: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; user-select: none;
}
.wave-legend {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  font-size: 10.5px; color: var(--faint); margin-top: 5px;
}
.wave-legend span { display: flex; align-items: center; gap: 5px; }
/* شارة لون في مفتاح الموجة. الاسم .lg-sw لا .sw لأن .sw صار المفتاح
   التبديلي في الإعدادات، وتعريفاهما كانا يتصادمان. */
.lg-sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.lg-sw.keep { background: var(--primary-light); }
.lg-sw.cut { background: var(--danger); }
.lg-sw.thr { background: transparent; border-top: 2px dotted rgba(255,255,255,.5); height: 0; width: 11px; }

/* ── المسارات الصوتية ────────────────────────────────── */

.trk {
  display: flex; align-items: center; gap: 9px;
  padding: 9px; margin-bottom: 7px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-sm); transition: .15s;
}
.trk-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 2px; transform: rotate(45deg); }
.trk-body { flex: 1 1 auto; min-width: 0; }
.trk-name { font-size: 12px; font-weight: 600; display: flex; gap: 7px; align-items: baseline; }
.trk-name small {
  color: var(--faint); font-weight: 400; font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trk-wave { display: block; width: 100%; height: 22px; margin-top: 5px; border-radius: 3px; }
.trk-cam { flex: 0 0 auto; }
.trk-cam select, .trk-cam .dd-btn {
  width: auto; min-width: 96px; padding: 6px 9px; font-size: 11.5px;
  background-position: left 9px top 13px, left 5px top 13px; padding-inline-start: 20px;
}
.trk.off { opacity: .4; }

/* ── معاينة الترجمة ──────────────────────────────────── */

.preview {
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg);
  max-height: 190px; overflow-y: auto; margin-bottom: 11px;
}
.pv-row {
  display: flex; gap: 9px; align-items: baseline;
  padding: 6px 10px; border-bottom: 1px solid var(--line-2);
  cursor: pointer; font-size: 12px; transition: .12s;
}
.pv-row:last-child { border-bottom: 0; }
.pv-row:hover { background: var(--primary-tint); }
.pv-t {
  flex: 0 0 auto; color: var(--primary-light); font-size: 10.5px;
  direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums;
}
.pv-x { flex: 1 1 auto; min-width: 0; }
.pv-more { padding: 7px 10px; font-size: 10.5px; color: var(--faint); text-align: center; }

/* ── السجل ───────────────────────────────────────────── */

.log-wrap {
  flex: 0 0 auto; padding: 8px 14px;
  background: var(--bg-soft); border-top: 1px solid var(--line);
}
.log { font-size: 11px; color: var(--faint); line-height: 1.6; min-height: 18px; }

/* الخلاصة سطر واحد لا يتجاوز عرض اللوحة، والتفصيل يُطوى خلف زرّ.
   قبلها كان صنف الشدّة يوضع على span داخلي فيلتقط .warn العامّة —
   صندوقًا بحاشية على عنصر سطريّ — فيطفح فوق شريط السيكوينس تحته. */
.log-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.log-dot {
  flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: none;
}
.log.is-ok .log-dot, .log.is-warn .log-dot, .log.is-err .log-dot { display: block; }
.log-txt {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  unicode-bidi: plaintext;   /* رسائل المحرّك تصل إنجليزية، فلا تتشظّى */
}
.log-txt.clickable { cursor: pointer; }
.log.is-ok   { color: var(--primary-soft); }
.log.is-warn { color: var(--warn); }
.log.is-err  { color: var(--danger); }

.log-more {
  flex: 0 0 auto; font: inherit; font-size: 10px; line-height: 1;
  color: inherit; background: transparent;
  border: 1px solid currentColor; border-radius: 999px;
  padding: 3px 8px; cursor: pointer; opacity: .75; white-space: nowrap;
}
.log-more:hover { opacity: 1; background: rgba(255,255,255,.08); }

.log-detail {
  position: relative; margin-top: 7px;
  max-height: 104px; overflow: auto;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: rgba(0,0,0,.22); border: 1px solid var(--line);
  color: var(--faint);
}
.log-detail-txt {
  line-height: 1.75; unicode-bidi: plaintext;
  overflow-wrap: anywhere; user-select: text; -webkit-user-select: text;
}
.log-copy {
  margin-top: 7px; font: inherit; font-size: 10px; line-height: 1;
  color: var(--faint); background: rgba(255,255,255,.06);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 4px 9px; cursor: pointer;
}
.log-copy:hover { color: var(--text); background: rgba(255,255,255,.12); }

/* ── تخطيط مضغوط: الموجة ثم التحكم مباشرة ───────────── */

.step-head .zoom { margin-inline-start: auto; align-items: center; }
.step-head .zoom .zoom-level { margin-inline-start: 6px; }

/* المقابض تتوزّع على عرض اللوحة بدل ما تتكدّس عموديًا */
.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px 20px;
  margin-top: 14px;
}
.sliders .ctl { margin-bottom: 4px; }

/* سطر نتائج واحد بدل أربع بطاقات */
.stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  margin-top: 12px; font-size: 12px; color: var(--faint);
}
.stats > span { display: flex; align-items: baseline; gap: 6px; }
.stats b {
  font-size: 16px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate;
}
.stats b.good { color: var(--primary-soft); }
.stats i { font-style: normal; color: var(--faint); }
.stats em { font-style: normal; }
.btn.mini { padding: 5px 11px; font-size: 11px; margin: 0; margin-inline-start: auto; }

.meter { margin: 10px 0 14px; }

.wave-legend .tip { color: var(--faint); opacity: .8; }
.foot-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 8px;
}
.foot-row .btn { margin-top: 0; }
.foot-row .hint { margin: 0; }

/* على اللوحة العريضة: الموجة أطول والمقابض في صف واحد */
@media (min-width: 720px) {
  .wave { height: 140px; }
  .step { padding: 15px; }
}

/* ── شاشة التفعيل ────────────────────────────────────── */

.gate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; overflow-y: auto; padding: 20px;
  background: radial-gradient(90% 70% at 50% 0%, rgba(44,141,208,.15), transparent 65%), var(--bg);
}
/* margin:auto يتمركز إذا وسِع، ويسمح بالتمرير بلا قصّ إذا طال المحتوى */
.gate-box { width: 100%; max-width: 320px; text-align: center; margin: auto; }
/*
 * الماسة كانت تختفي من شاشة البوابة: العنصر span مضمَّن، والعرض
 * والارتفاع لا يسريان على المضمَّن فينكمش إلى صفر. تعمل في الرأس
 * لأنه flex يُكتّل أبناءه. هنا نُكتّلها صراحةً، وتتنفّس بهدوء.
 */
.gate-box .logo { display: block; margin: 0 auto 16px; width: 52px; height: 52px;
  animation: gateGem 4.5s ease-in-out infinite; }
@keyframes gateGem {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(91,184,232,.35)); }
  50%      { filter: drop-shadow(0 0 20px rgba(91,184,232,.6)); }
}
.gate-box h2 { font-size: 17px; margin-bottom: 6px; }
.gate-sub { font-size: 12px; color: var(--faint); margin: 0 0 18px; line-height: 1.6; }
.gate-box input {
  text-align: center; letter-spacing: .16em; font-size: 15px;
  font-weight: 600; padding: 11px; margin-bottom: 12px;
}
.gate-err {
  font-size: 11.5px; color: var(--danger); background: rgba(255,107,107,.08);
  border: 1px solid rgba(255,107,107,.3); border-radius: var(--r-sm);
  padding: 8px 10px; margin: 0 0 12px;
}

#signupBox input { margin-bottom: 10px; text-align: center; letter-spacing: normal; font-size: 14px; }
#toggleMode { color: var(--primary-light); text-decoration: none; }
#toggleMode:hover { text-decoration: underline; }

/* ── شارة الترخيص ─────────────────────────────────────── */
.lic-badge {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 4px 11px;
  border-radius: 99px; white-space: nowrap; margin-inline-start: 10px;
  border: 1px solid transparent; transition: .15s;
}
.lic-badge.trial { background: var(--primary-tint); color: var(--primary-soft);
  border-color: rgba(91,184,232,.35); }
.lic-badge.paid  { background: rgba(47,191,133,.12); color: var(--go);
  border-color: rgba(47,191,133,.35); }
.lic-badge.warn  { background: rgba(232,163,61,.14); color: var(--warn);
  border-color: rgba(232,163,61,.4); }
.lic-badge[style*="pointer"]:hover { filter: brightness(1.25); }

.gate-terms { display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12px; color: var(--faint); margin-bottom: 12px; cursor: pointer; }

.gate-terms a { color: var(--primary-light); }

.gate-tabs{margin-bottom:12px}
.gate-tabs button{padding:7px 4px;font-size:12.5px}
#gatePass{letter-spacing:.14em}
.gate-wait{display:flex;align-items:center;justify-content:center;gap:9px;
  color:var(--faint);font-size:13px;padding:14px 0}
.gate-wait i{width:14px;height:14px;border:2px solid rgba(91,184,232,.25);
  border-top-color:var(--primary-light);border-radius:50%;display:block;
  animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}


/* ── عرض أقصى: لا تتمدد اللوحة بلا حدود على الشاشات العريضة ── */
.pane { max-width: 660px; margin-inline: auto; }
.help { max-width: 660px; }
@media (min-width: 760px) {
  main { padding: 16px 20px 8px; }
  .sliders { grid-template-columns: 1fr 1fr; }
}

/* ── شريط الحالة السفلي ── */
.statusbar {
  display: none; flex: 0 0 auto; align-items: center; gap: 10px;
  padding: 7px 12px; background: var(--bg-soft); border-top: 1px solid var(--line);
  font-size: 11.5px;
}
.statusbar.on { display: flex; }
.sb-acct {
  display: flex; align-items: center; gap: 7px; background: transparent; border: 0;
  color: var(--dim); cursor: pointer; padding: 3px 6px; border-radius: 6px;
  min-width: 0; font: inherit; transition: .15s;
}
.sb-acct:hover { background: var(--primary-tint); color: var(--primary-soft); }
.sb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--go); flex: 0 0 auto;
  box-shadow: 0 0 7px rgba(47,191,133,.6); }
.sb-dot.warn { background: var(--warn); box-shadow: 0 0 7px rgba(232,163,61,.6); }
.sb-mail { direction: ltr; unicode-bidi: isolate; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.sb-sep { width: 1px; height: 12px; background: var(--line); flex: 0 0 auto; }
.sb-left { color: var(--faint); white-space: nowrap; }
.sb-btn {
  margin-inline-start: auto; flex: 0 0 auto; background: var(--grad-cta); color: #fff;
  border: 0; border-radius: 6px; padding: 5px 12px; font: 700 11px var(--font-ar); cursor: pointer;
}
.sb-btn:hover { filter: brightness(1.12); }

/* ── لوحة تفاصيل الحساب ── */
.sheet {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px); display: none; overflow-y: auto; padding: 16px;
}
.sheet.on { display: flex; }
.sheet-box {
  width: 100%; max-width: 340px; margin: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px;
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
}
.sheet-box h3 { font-size: 15px; margin: 0; flex: 1; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet-head .logo { width: 24px; height: 24px; }
.sheet-x {
  flex: 0 0 auto; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--faint); cursor: pointer; border-radius: 8px; padding: 0;
}
.sheet-x .ic { width: 16px; height: 16px; }
.sheet-x:hover { color: var(--text); background: var(--line-2); }

/* بطاقة هوية الحساب */
.acct-id {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 12px; margin-bottom: 14px;
}
.acct-avatar {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff; background: var(--grad-diamond);
  text-transform: uppercase; box-shadow: 0 4px 14px rgba(44,141,208,.4);
}
.acct-meta { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.acct-mail {
  font-size: 13px; color: var(--text); font-weight: 600; direction: ltr; unicode-bidi: isolate;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px;
}
.pill {
  align-self: flex-start; font-size: 10.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: var(--line-2); color: var(--faint);
}
.pill.ok   { background: rgba(47,191,133,.15); color: #4fd6a0; border: 1px solid rgba(47,191,133,.3); }
.pill.warn { background: rgba(232,163,61,.15); color: #f0bd5e; border: 1px solid rgba(232,163,61,.3); }

.sh-group {
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 2px 12px; margin-bottom: 16px;
}
.sh-group .sh-row:last-child { border-bottom: 0; }
.sh-ver { text-align: center; color: var(--faint); font-size: 11px; margin-top: 14px; }

/* تفعيل الكود داخل الإعدادات */
.sh-code { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.sh-code-lbl { display: block; font-size: 12px; color: var(--faint); margin-bottom: 8px; }
.sh-code-row { display: flex; gap: 8px; }
.sh-code-in {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font-size: 13px; letter-spacing: .06em;
}
.sh-code-in:focus { outline: none; border-color: var(--primary); }
.sh-code .btn-go { flex: 0 0 auto; padding: 10px 18px; }
.sh-code-msg { font-size: 12px; margin: 8px 0 0; }
.sh-code-msg.ok  { color: var(--go); }
.sh-code-msg.err { color: var(--danger); }
.sh-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; color: var(--faint);
}
/* الاتجاه من المحتوى لا مفروضًا: كان `direction: ltr` يصيب كل <b> في الصف،
   فيشمل العناوين العربية داخل .sh-lbl وقيمًا عربية مثل «اشتراك مدفوع»
   و«14 يومًا» فتُحاذى يسارًا وتنعكس أجزاؤها. plaintext يقرأ أول حرف قويّ:
   العربي يمينًا، ومعرّف الجهاز ins_… يسارًا، والتاريخ يبقى سليمًا.
   والمحدّد `>` يستثني عناوين .sh-lbl أصلًا فهي ليست أبناءً مباشرين. */
.sh-row > b { color: var(--text); font-weight: 600; unicode-bidi: plaintext; }
.sh-lbl b { unicode-bidi: plaintext; }
.sh-row b.mono-sm { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.sheet-box .btn { margin-top: 9px; }
.btn-quiet {
  background: transparent; border: 1px solid transparent; color: var(--faint);
}
/* التمرير الأحمر لِما يهدم فقط. «حفظ SRT» و«تفعيل الكل» أزرارٌ عادية،
   واحمرارها عند المرور كان يوحي بأنها تحذف شيئًا. */
.btn-quiet:hover { color: var(--primary-soft); border-color: rgba(91,184,232,.35); background: var(--primary-tint); }
.btn-quiet.danger:hover { color: var(--danger); border-color: rgba(255,107,107,.3); background: rgba(255,107,107,.08); }

/* ── نافذة حفظ الترجمة ──────────────────────────────── */
.srt-quick { margin-bottom: 14px; }
.srt-quick button { font-size: 11.5px; }
/* المجلد والاسم سطران منفصلان: مسارٌ لاتيني واسمٌ عربي في سطر واحد
   يتشابكان بقواعد الاتجاه فيصير المسار غير مقروء. */
.srt-path {
  margin: 0 0 4px; padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line-2);
  font: 11px ui-monospace, Menlo, monospace;
  direction: ltr; text-align: left; line-height: 1.55;
}
.srt-path span { display: block; overflow-wrap: anywhere; }
.srt-path .p-dir { color: var(--faint); }
.srt-path .p-name { color: var(--primary-soft); font-weight: 600; unicode-bidi: plaintext; }
.srt-warn {
  margin: 8px 0 0; font-size: 11.5px; color: var(--warn);
  background: rgba(232,163,61,.1); border: 1px solid rgba(232,163,61,.3);
  border-radius: var(--r-sm); padding: 8px 10px;
}
#srtSheet .foot-row { margin-top: 14px; }
#srtSheet .foot-row .btn { flex: 1 1 auto; }

/* نافذة التحديث */
.upd-box { max-width: 300px; text-align: center; }
.upd-box h3 { text-align: center; margin: 0 0 6px; }
.upd-sub { text-align: center; margin: 0 0 18px; min-height: 18px; }
.upd-icon {
  width: 60px; height: 60px; margin: 4px auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-tint); border: 1px solid var(--line);
}
.upd-icon svg { width: 30px; height: 30px; fill: none; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round; }
.upd-icon.ok  { background: rgba(47,191,133,.14); border-color: rgba(47,191,133,.35); }
.upd-icon.ok svg  { stroke: var(--go); }
.upd-icon.err { background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.35); }
.upd-icon.err svg { stroke: var(--danger); }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--primary-light);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }



/* ══════════ التخطيط المجمّع ══════════ */

.pane { max-width: 1150px; margin-inline: auto; }
.help { max-width: 1150px; }

/* ── شريط القرار العلوي ── */
.toolbar {
  position: relative; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 12px;
}
.tb-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tb-grow { flex: 1 1 200px; }
.tb-lbl { font-size: 11px; color: var(--faint); font-weight: 600; }
.tb-cell select, .tb-cell .dd { min-width: 0; }
.tb-go { flex: 0 0 auto; gap: 4px; }
.tb-go .btn { padding: 10px 22px; white-space: nowrap; }
.tb-go .scope-note {
  margin: 0; font-size: 10.5px; color: var(--faint); max-width: 230px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toolbar .bar { position: absolute; inset-inline: 0; bottom: 0; margin: 0; border-radius: 0 0 var(--r) var(--r); }
.toolbar .segmented button { padding: 7px 12px; font-size: 11.5px; white-space: nowrap; }
.toolbar .segmented { flex-wrap: nowrap; }

/* شريط القص: ثلاثة أعمدة مضغوطة — حبّة مختارة + بدائل صغيرة تحتها */
.cut-tools { display: block; padding: 16px; }
.cut-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 560px) { .cut-grid { grid-template-columns: 1fr; } }
.cut-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.cut-tools .tb-lbl { font-size: 12px; color: var(--dim); }
.cut-tools .tb-lbl .ic { width: 13px; height: 13px; opacity: .85; }

/* كل الخيارات ظاهرة كأزرار — المختار مضيء والبقية قابلة للنقر */
.cut-tools .segmented {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  padding: 4px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 11px;
}
.cut-tools .segmented button {
  position: relative; padding: 9px 30px;
  border: 0; border-radius: 8px;
  background: var(--panel-2); color: var(--dim);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cut-tools .segmented button:not(.is-active):not(:disabled):hover {
  background: var(--primary-tint); color: var(--primary-soft);
}
.cut-tools .segmented button.is-active {
  background: var(--grad-cta); color: #fff;
  box-shadow: 0 4px 14px rgba(44,141,208,.35);
}
.cut-tools .segmented button.is-active::after {
  content: '\2713'; position: absolute; inset-inline-start: 10px; top: 50%;
  transform: translateY(-50%); font-size: 12px; font-weight: 700; opacity: .9;
}
.cut-tools .segmented button:disabled {
  background: rgba(255,255,255,.025); color: var(--faint); opacity: .55; cursor: default;
}

/* ملاحظة تحت العمود تشرح سبب تعطّل خيار */
.col-note { font-size: 11px; line-height: 1.5; color: var(--faint); text-align: center; }

/* العمود الثالث: معلومات مسار الصوت (عرض فقط — بلا مظهر زر) */
.info-pill {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 14px; border-radius: 11px; font-size: 13px; font-weight: 600;
  color: var(--dim); background: var(--bg); border: 1px solid var(--line-2);
}
.info-sub { text-align: center; font-size: 11px; color: var(--faint); }

.cut-tools .cut-go { margin-top: 2px; padding: 15px 18px; font-size: 14.5px; border-radius: 12px; }
.cut-tools .cut-go .ic { width: 17px; height: 17px; }

/* ── بطاقة الأصوات والكاميرات ── */
.tracks-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .tracks-grid { grid-template-columns: 1fr 1fr; } }

/* ── مقابض الضبط بجوار ملخص النتائج ── */
.tune-grid { display: grid; gap: 12px; margin-top: 10px; }
@media (min-width: 720px) { .tune-grid { grid-template-columns: 1fr 210px; align-items: start; } }
.tune-grid .sliders { display: grid; gap: 12px; margin: 0; }
@media (min-width: 560px) { .tune-grid .sliders { grid-template-columns: repeat(3, 1fr); } }

.summary {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 13px;
}
.summary h3 { font-size: 11.5px; color: var(--primary-soft); margin-bottom: 9px; font-weight: 700; }
.sm-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 5px 0; font-size: 11.5px; color: var(--faint);
}
.sm-row b { color: var(--text); font-weight: 700; font-size: 13px;
  direction: ltr; unicode-bidi: isolate; }
.sm-row b.good, .sm-row .good { color: var(--go); }
.sm-row i { color: var(--faint); font-style: normal; }
.summary .meter { margin: 8px 0 10px; }
.summary .mini { width: 100%; }

/* ── بطاقات أرقام التفريغ ── */
.statrow { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 620px) { .statrow { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.stat b { font-size: 17px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: 10.5px; color: var(--faint); }

/* ── الأسطر بجوار الإعدادات ── */
.sub-grid { display: grid; gap: 12px; align-items: start; }
@media (min-width: 820px) { .sub-grid { grid-template-columns: 1fr 260px; } }
.step.side { margin: 0; }
.step.side .ctl { margin-bottom: 10px; }

.ltable {
  position: relative;                       /* مرجع القياس عند تتبّع السطر الجاري */
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  max-height: 460px; overflow-y: auto; overscroll-behavior: contain; background: var(--bg-soft);
}
/* في لوحةٍ قصيرة كان الصندوق أطول من النافذة، فيقع نصفه خارجها ويختفي
   السطر الجاري الموسَّط داخله رغم أن التتبّع يعمل. نقيّده بارتفاع النافذة. */
@media (max-height: 820px) { .ltable { max-height: 55vh; } }
/* شريط التمرير بلون الهوية بدل رمادي النظام العريض */
.ltable::-webkit-scrollbar { width: 8px; }
.ltable::-webkit-scrollbar-track { background: transparent; }
.ltable::-webkit-scrollbar-thumb {
  background: rgba(91,184,232,.28); border-radius: 4px; border: 2px solid var(--bg-soft);
}
.ltable::-webkit-scrollbar-thumb:hover { background: rgba(91,184,232,.45); }
/* سطر الشرح ومفتاح التتبّع فوق الجدول */
.lt-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
}
.lt-bar .note { margin: 0; }
.follow-sw { padding: 0; font-size: 11.5px; color: var(--faint); white-space: nowrap; }


.lt-head, .lt-row {
  display: grid; grid-template-columns: 26px 74px 50px minmax(64px, 1fr) 52px;
  align-items: center; gap: 7px; padding: 7px 9px;
  /* حافة محجوزة دائمًا ليُلوّنها السطر الجاري بلا أن تزيح الأعمدة */
  border-inline-start: 3px solid transparent;
}
/* أعمدةٌ ثابتة العرض كانت تخنق عمود النص عند تضييق اللوحة، فينكسر
   «النص» إلى حرف في كل سطر. أرضيةٌ للنص، ومنعُ الالتفاف في الترويسة،
   وإسقاطُ «المدة» في اللوحات الضيّقة بدل خنق الجميع. */
.lt-head span, .lt-row .c-n, .lt-row .c-t, .lt-row .c-d {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 340px) {
  .lt-head, .lt-row { grid-template-columns: 22px 66px minmax(58px, 1fr) 46px; gap: 6px; padding: 7px 7px; }
  .lt-head .c-d, .lt-row .c-d { display: none; }
}
/* أضيق من الحدّ الأدنى للوحة: نُسقط رقم السطر ونضغط الوقت */
@media (max-width: 300px) {
  .lt-head, .lt-row { grid-template-columns: 58px minmax(46px, 1fr) 42px; gap: 5px; padding: 7px 6px; }
  .lt-head .c-n, .lt-row .c-n { display: none; }
}
.lt-head {
  position: sticky; top: 0; z-index: 1; background: var(--panel);
  border-bottom: 1px solid var(--line); font-size: 10.5px; color: var(--faint); font-weight: 600;
}
.lt-row { border-bottom: 1px solid var(--line-2); font-size: 12px; }
.lt-row:last-child { border-bottom: 0; }
.lt-row:hover { background: var(--primary-tint); }
/* السطر الجاري تحت مؤشر بريمير — يتتبّعه تلقائيًا (js/main.js: followPlayhead).
   إضاءة واحدة هادئة تنتقل من سطر إلى سطر: لا وميض داخل السطر يشدّ العين. */
.lt-row.is-now {
  background: rgba(91,184,232,.17);
  border-inline-start-color: var(--primary-light);
}
.lt-row { transition: background .18s ease, border-color .18s ease; }
.lt-row.is-now .c-n { color: var(--primary-soft); }
.lt-row.is-now .c-x { color: #fff; }
/* الكلمة الجارية داخل السطر المُضاء: علامةٌ واحدة تنتقل كلمةً كلمة، وهي
   نفسها هدف التمرير فتبقى في وسط الإطار (js/main.js: followPlayhead).
   الإضاءة على السطر وحده لا تقول أين وصل الكلام داخل السطر. */
.lt-row .c-x .w { border-radius: 4px; padding: 0 2px; transition: background .12s ease; }
.lt-row.is-now .c-x .w.is-word { background: var(--primary-light); color: #06202b; font-weight: 700; }
.c-n { color: var(--faint); font-size: 10.5px; text-align: center; }
.c-t {
  background: transparent; border: 0; color: var(--primary-soft); cursor: pointer;
  font: 600 11px ui-monospace, Menlo, monospace; direction: ltr; unicode-bidi: isolate;
  padding: 2px 0; text-align: start;
}
.c-t:hover { text-decoration: underline; }
.c-d { color: var(--faint); font-size: 10.5px; direction: ltr; unicode-bidi: isolate; }
.c-x {
  color: var(--text); line-height: 1.55; padding: 3px 6px; border-radius: 5px;
  border: 1px solid transparent; outline: 0; min-width: 0; word-break: break-word;
}
.c-x:hover { border-color: var(--line); }
.c-x:focus { border-color: var(--primary); background: var(--bg); }
button.c-a {
  background: transparent; border: 0; color: var(--faint); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 3px; border-radius: 5px; opacity: 0;
}
.lt-row:hover button.c-a { opacity: 1; }
button.c-a:hover { color: var(--danger); background: rgba(255,107,107,.12); }

.foot-row.wrap { flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.foot-row.wrap .btn { flex: 1 1 auto; }

/* مجموعة الإجراء: صف واحد متى اتسع العرض */
@media (min-width: 520px) { .segmented.col { flex-direction: row; } .segmented.col button { flex: 1; } }


/* ══════════ الأيقونات ══════════ */
.ic {
  width: 15px; height: 15px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px; pointer-events: none;
}

/* الأزرار: أيقونة ثم نص، بمحاذاة واحدة */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn .ic { width: 15px; height: 15px; opacity: .95; }
.btn-block { display: flex; }
.icon-btn .ic { width: 15px; height: 15px; vertical-align: 0; }

/* التبويبات */
.tab { display: inline-flex; align-items: center; gap: 7px; }
.tab .ic { width: 15px; height: 15px; opacity: .8; }
.tab.is-active .ic { opacity: 1; }

/* عناوين البطاقات */
.step-head h2 { display: inline; }
.step-head > .ic { width: 15px; height: 15px; color: var(--primary-light); margin-inline-end: 2px; }
.summary h3 { display: flex; align-items: center; gap: 6px; }
.summary h3 .ic { width: 13px; height: 13px; }
.tb-lbl { display: flex; align-items: center; gap: 5px; }
.tb-lbl .ic { width: 12px; height: 12px; opacity: .7; vertical-align: 0; }

/* بطاقات الأرقام: أيقونة على اليمين ثم الرقم ووصفه */
.stat { flex-direction: row; align-items: center; gap: 10px; }
.stat > .ic {
  width: 26px; height: 26px; padding: 5px; border-radius: 8px;
  background: var(--primary-tint); color: var(--primary-light); stroke-width: 1.6;
  box-sizing: content-box;
}
.stat > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* شريط الحساب */
.sb-btn { display: inline-flex; align-items: center; gap: 5px; }
.sb-btn .ic { width: 12px; height: 12px; }

/* أزرار السطر في جدول الترجمة */
.lt-acts { display: flex; gap: 2px; justify-content: flex-end; }
button.c-a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
}
button.c-a .ic { width: 13px; height: 13px; }
button.c-a.edit:hover { color: var(--primary-soft); background: var(--primary-tint); }


/* ── القوائم المنسدلة داخل اللوحة (js/dropdown.js) ──────
   بريمير لا يعرض قائمة <select> الأصلية داخل لوحة CEP، فنخفيها
   ونرسم بديلًا من عناصر الصفحة نفسها. */
.dd { position: relative; width: 100%; min-width: 0; }
.trk-cam .dd { width: auto; }
.dd-native {
  position: absolute; inset-inline-start: 0; top: 0;
  width: 1px; height: 1px; opacity: 0; pointer-events: none;
  clip: rect(0 0 0 0); overflow: hidden;
}
.dd-btn {
  display: block; text-align: start; cursor: pointer; line-height: 1.35;
}
.dd-btn.is-open { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-tint); }
.dd-val { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dd-pop {
  position: fixed; z-index: 9000; max-height: 280px; overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel-2); border: 1px solid rgba(91,184,232,.22); border-radius: var(--r-sm);
  box-shadow: 0 14px 40px rgba(0,0,0,.55); padding: 4px;
}
/* شريط التمرير بلون الهوية بدل رمادي النظام الفاتح */
.dd-pop::-webkit-scrollbar { width: 8px; }
.dd-pop::-webkit-scrollbar-track { background: transparent; }
.dd-pop::-webkit-scrollbar-thumb {
  background: rgba(91,184,232,.28); border-radius: 4px; border: 2px solid var(--panel-2);
}
.dd-pop::-webkit-scrollbar-thumb:hover { background: rgba(91,184,232,.45); }
.dd-opt {
  padding: 7px 10px; border-radius: 5px; font-size: 12.5px; cursor: pointer;
  color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dd-opt.is-hot { background: rgba(91,184,232,.20); color: var(--text); }
.dd-opt.is-sel { color: var(--primary-light); font-weight: 600; }
.dd-opt.is-sel.is-hot { background: rgba(91,184,232,.28); color: var(--primary-soft); }
.dd-opt.is-off { opacity: .4; cursor: default; }


/* ══════════ تبويب المونتاج ══════════ */

.tools-bar { align-items: center; }
.sel-note {
  margin: 0; font-size: 12.5px; color: var(--dim); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis;
}
.sel-note b { color: var(--primary-soft); font-weight: 600; }
.sel-note.empty { color: var(--faint); }

.tools-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; align-items: stretch; }
.tools-grid > #stepLayers { grid-column: 1 / -1; }
.tools-grid > .step { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 720px) { .tools-grid { grid-template-columns: 1fr; } }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.btn-row .btn { flex: 1 1 auto; justify-content: center; }

.btn-danger {
  background: rgba(255,107,107,.1); border-color: rgba(255,107,107,.32); color: #ff9d9d;
}
.btn-danger:hover:not(:disabled) { background: rgba(255,107,107,.18); border-color: var(--danger); color: #ffc2c2; }

/* قائمة افكتات المقطع المحدّد */
.fx-list {
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg);
  flex: 1 1 auto; min-height: 96px; max-height: 220px; overflow-y: auto; padding: 4px;
}
.fx-row {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 9px;
  border-radius: 5px; font-size: 12.5px;
}
.fx-row + .fx-row { border-top: 1px solid var(--line-2); }
.fx-row b { font-weight: 600; color: var(--text); }
.fx-row small { color: var(--faint); font-size: 10.5px; margin-inline-start: auto; direction: ltr; }
.fx-row.is-intrinsic b { color: var(--faint); font-weight: 500; }
.fx-empty { padding: 16px 10px; text-align: center; color: var(--faint); font-size: 12px; }

/* حفظ بريست */
.save-row { display: flex; gap: 8px; margin-bottom: 10px; }
.save-row input { flex: 1 1 auto; }
.save-row .btn { flex: 0 0 auto; }

.preset-list {
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg);
  flex: 1 1 auto; min-height: 96px; max-height: 260px; overflow-y: auto; padding: 4px;
}
.pr-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; }
.pr-row:hover { background: var(--primary-tint); }
.pr-row + .pr-row { border-top: 1px solid var(--line-2); }
.pr-apply {
  flex: 1 1 auto; text-align: start; background: none; border: 0; cursor: pointer;
  color: var(--text); font: inherit; padding: 4px 4px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.pr-apply:hover { color: var(--primary-soft); }
.pr-apply small { color: var(--faint); font-size: 10.5px; margin-inline-start: 7px; }
.pr-del {
  flex: 0 0 auto; background: none; border: 0; cursor: pointer; color: var(--faint);
  padding: 4px 7px; border-radius: 5px; font-size: 15px; line-height: 1;
}
.pr-del:hover { color: var(--danger); background: rgba(255,107,107,.12); }

/* منتقي لون السولد: شريحته كلّها عند ‎.qt .tg-swatch‎ أدناه */

.log-line {
  margin: 12px 0 0; font-size: 12px; color: var(--faint); min-height: 18px;
  text-align: center; line-height: 1.6;
}
.log-line.ok { color: var(--go); }
.log-line.bad { color: var(--danger); }


/* ══════════ متصفّح الافكتات (لوحة البحث) ══════════ */

/* ── متصفّح الافكتات ─────────────────────────────
 * الطبقة تحمل إطارًا يعرض صفحة الشريط العائم نفسها (engine/fxbar/ui)،
 * فلا قواعد هنا لصفوف القائمة: تنسيقها كلّه في ui.css داخل الإطار،
 * ولا يمكن أن يتصادم اسم صنف فيه مع اسم في هذا الملف كما وقع سابقًا.
 */
.fxp {
  position: fixed; inset: 0; z-index: 8000; display: flex;
  padding: 8px; background: rgba(4,4,8,.62);
}
.fxp.hidden { display: none; }
.fxp-frame {
  flex: 1 1 auto; width: 100%; border: 1px solid rgba(91,184,232,.42);
  border-radius: 12px; box-shadow: 0 18px 48px rgba(0,0,0,.72);
  background: var(--panel);
}

/* حقل البحث الثابت داخل قسم الافكتات */
.fxq {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 4px;
  padding: 7px 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm); transition: .15s;
}
.fxq:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-tint); }
.fxq > .ic { flex: 0 0 auto; opacity: .55; }
.fxq input {
  flex: 1 1 auto; min-width: 0; background: none; border: 0; outline: none;
  color: var(--text); font: 12.5px/1.5 var(--font-ar); padding: 0;
}



/* ══════════ منتقي الألوان (بديل input[type=color]) ══════════ */
/* لوحة ألوان النظام لا تفتح داخل CEP على ماك، فنرسمها بأنفسنا. */

.cp { position: relative; display: inline-flex; }
input.cp-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  border: 0; opacity: 0; pointer-events: none; clip: rect(0 0 0 0); overflow: hidden;
}
.cp-btn {
  width: 30px; height: 26px; padding: 3px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.cp-btn:hover { border-color: rgba(91,184,232,.45); }
.cp-btn.is-open { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-tint); }
.cp-chip {
  display: block; width: 100%; height: 100%; border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.cp-pop {
  position: fixed; z-index: 9500; width: 196px; padding: 10px;
  background: var(--panel-2); border: 1px solid rgba(91,184,232,.3);
  border-radius: var(--r); box-shadow: 0 18px 48px rgba(0,0,0,.66);
}
.cp-sv { position: relative; width: 176px; height: 112px; border-radius: 6px; overflow: hidden; cursor: crosshair; }
.cp-sv canvas { display: block; width: 176px; height: 112px; }
.cp-svdot {
  position: absolute; width: 11px; height: 11px; margin: -6px 0 0 -6px;
  border: 2px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.55);
}
.cp-hue {
  position: relative; height: 12px; margin-top: 9px; border-radius: 6px; cursor: pointer;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.cp-huedot {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border: 2px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.55);
}
.cp-row { margin-top: 9px; }
.cp-hex {
  width: 100%; padding: 6px 8px; text-align: center; letter-spacing: .04em;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); outline: none; font-size: 12.5px; direction: ltr;
  font-variant-numeric: tabular-nums;
}
.cp-hex:focus { border-color: var(--primary-light); }
.cp-presets { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 9px; }
.cp-sw {
  height: 18px; padding: 0; cursor: pointer; border-radius: 4px;
  border: 1px solid rgba(255,255,255,.16);
}
.cp-sw:hover { border-color: var(--primary-light); }
/* سطر الإغلاق: زرٌّ واحد عريض بلون الهوية — اللون مطبَّقٌ أصلًا وهذا
   إقرارٌ وإغلاق، لا «موافقة» تُلغى بجانبها. */
.cp-foot { margin-top: 10px; }
.cp-done {
  display: block; width: 100%; padding: 7px 0; cursor: pointer;
  border: 0; border-radius: 6px; background: var(--grad-cta); color: #fff;
  font: 600 12px/1 var(--font-ar); letter-spacing: .01em;
  box-shadow: 0 3px 10px rgba(44,141,208,.28);
}
.cp-done:hover { filter: brightness(1.07); }
.cp-done:active { transform: translateY(1px); }

/* صفوف الإعدادات ذات تحكّم */
/* عناوين أقسام الإعدادات — تفصل إعدادات الأداة عن الحساب عن الإضافة */
.sh-sec {
  margin: 20px 2px 8px; font-size: 11px; font-weight: 700;
  color: var(--primary-soft); letter-spacing: .02em;
}
.sheet-box .sh-sec:first-of-type { margin-top: 4px; }

/* مسجّل الاختصار: حقل إدخال لأن بريمير لا يوصل المفاتيح للوحة إلا
   وحقلُ نصٍّ مركَّز عليه، فلا يلتقط زرٌّ عاديٌّ الضغطة */
.hk-rec {
  flex: 0 0 auto; width: 108px; text-align: center; cursor: pointer;
  padding: 5px 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12px; transition: .15s;
}
.hk-rec:focus {
  outline: none; cursor: text;
  border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-tint);
  color: var(--primary-soft);
}
.sh-hint.ok  { color: var(--go); }
.sh-hint.bad { color: var(--warn); }

.sh-row-ctl { align-items: center; gap: 10px; }
.sh-row-ctl > span { min-width: 0; }
.sh-key {
  padding: 4px 12px; font-size: 12px; min-width: 74px; direction: ltr;
  font-variant-numeric: tabular-nums;
}
.sh-key.is-rec { border-color: var(--primary-light); color: var(--primary-soft); }
.sh-hint { font-size: 10.5px; color: var(--faint); margin: 7px 2px 0; line-height: 1.55; }
.sh-note {
  margin: 2px 2px 8px; padding: 0 0 9px; font-size: 10.5px; line-height: 1.55;
  color: var(--faint); border-bottom: 1px solid var(--line-2); unicode-bidi: plaintext;
}

/* مفتاح تبديل */
.sw { position: relative; display: inline-flex; cursor: pointer; flex: 0 0 auto; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw i {
  flex: 0 0 auto; width: 36px; height: 20px; min-width: 36px; border-radius: 10px; background: var(--line-2);
  border: 1px solid var(--line); transition: .16s; display: block; position: relative;
}
.sw i::after {
  content: ''; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--faint); transition: .16s;
}
.sw input:checked + i { background: var(--primary-tint); border-color: var(--primary-light); }
.sw input:checked + i::after { inset-inline-start: 18px; background: var(--primary-light); }

/* ══════════════════════════════════════════════════════════════
   إعادة التصميم — بطاقات مضغوطة، أيقونات موحّدة، انتقالات ناعمة
   ══════════════════════════════════════════════════════════════ */

.sprite { display: none; }

/* الأيقونات كلها من رمز واحد الآن، فسماكتها تُضبط من مكان واحد */
.ic { width: 16px; height: 16px; flex: 0 0 auto;
      fill: none; stroke: currentColor; stroke-width: 1.75;
      stroke-linecap: round; stroke-linejoin: round; }

/* ── شاشة الترحيب ──────────────────────────────── */
.splash {
  position: fixed; inset: 0; z-index: 9500;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; background: var(--bg);
  transition: opacity .5s ease, visibility .5s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash-logo {
  width: 68px; height: 68px;
  animation: splashIn .55s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes splashIn {
  from { opacity: 0; transform: scale(.82) translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.splash-bar {
  width: 108px; height: 2px; border-radius: 2px; overflow: hidden;
  background: var(--line-2);
}
.splash-bar i {
  display: block; width: 40%; height: 100%; border-radius: 2px;
  background: var(--grad-cta);
  animation: splashSlide 1.05s cubic-bezier(.5,0,.5,1) infinite;
}
@keyframes splashSlide {
  from { transform: translateX(-120%); }
  to   { transform: translateX(320%); }
}

/* ── الانتقالات ────────────────────────────────── */
/* التبويب يدخل بانزلاق خفيف بدل الظهور المفاجئ */
.pane.is-active { animation: paneIn .26s cubic-bezier(.2,.7,.3,1) both; }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.tab { transition: color .16s, border-color .16s; }
.card { transition: opacity .22s ease, border-color .16s, background .16s; }
.btn { transition: background .15s, border-color .15s, color .15s, transform .08s; }
.btn:active { transform: scale(.985); }
.sheet { transition: opacity .2s ease; opacity: 0; }
.sheet.on { opacity: 1; }
.sheet-box { animation: sheetIn .26s cubic-bezier(.2,.8,.25,1) both; }
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pane.is-active, .sheet-box, .splash-logo { animation: none; }
  .splash { transition: none; }
}

/* ── البطاقة ───────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 12px; margin-bottom: 10px;
}
/* القسم المقفل: البطاقة نفسها تبقى كاملة الوضوح — إطارها وأرضيّتها —
   ويبهت محتواها وحده. وضع الشفافية على البطاقة كان يضاعفها على العنوان
   (٤٥٪ للبطاقة × ٨٥٪ للعنوان = ٣٨٪) فيصير العنوان أبهت من محتواه، عكس
   المقصود. الاستثناء «حلّل الصوت أولًا» — هو الذي يفسّر سبب البهتان. */
.card.is-locked { pointer-events: none; }
.card.is-locked > :not(.card-head):not(.wave-stack) { opacity: .26; }
.card.is-locked > .wave-stack > .wave,
.card.is-locked > .wave-stack > .wave-time,
.card.is-locked > .wave-stack > .wave-spk,
.card.is-locked > .wave-stack > .wave-mini { opacity: .26; }
.card.is-locked > .card-head { opacity: .58; }
.card.is-locked > .card-head .zoom { opacity: .45; }
.card-head {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: 12.5px; font-weight: 700; color: var(--text);
}
.card-head .ic { color: var(--primary-light); }
.card-head .note { margin-inline-start: auto; }
.card.setup { background: var(--bg-soft); }

.note {
  margin: 6px 0 0; font-size: 11px; line-height: 1.55; color: var(--faint);
}
.note.warn { color: var(--warn); }
.note.center { text-align: center; }

/* ── صفّ الاختيارات ────────────────────────────── */
.seg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-cell { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.seg-cell > .lbl {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--faint); font-weight: 600;
}
.seg-cell > .lbl .ic { width: 13px; height: 13px; }

.segmented.mini button { padding: 5px 12px; font-size: 11.5px; }

/* سطر المصدر: مسار الصوت أو المقطع المحدّد */
.src-row {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 8px 10px; background: var(--bg); border-radius: var(--r-sm);
  font-size: 12px; color: var(--dim); min-width: 0;
}
.src-row .ic { color: var(--primary-light); }
.src-row b { color: var(--text); font-weight: 600;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row span { color: var(--faint); font-size: 11px;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row .btn { margin-inline-start: auto; }

.sliders.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.sliders.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0 0; }

/* ── شريط النتائج ──────────────────────────────── */
/* كان بطاقة جانبية بأربعة أسطر؛ صار شريطًا أفقيًا واحدًا */
.result {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding: 9px 11px;
  background: var(--bg); border-radius: var(--r-sm);
}
.r-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.r-cell b { font-size: 14px; font-weight: 700; color: var(--text); }
.r-cell b.good { color: var(--go); }
.r-cell i { font-style: normal; font-size: 10px; color: var(--faint); }
.r-cell.wide b { font-size: 12.5px; }
.r-cell.wide em { font-style: normal; color: var(--faint); margin: 0 3px; }
.result .link {
  margin-inline-start: auto; background: none; border: 0; cursor: pointer;
  color: var(--primary-light); font: 11px/1.4 var(--font-ar); padding: 3px 4px;
}
.result .link:hover { color: var(--primary-soft); text-decoration: underline; }

/* ── صفّ الإحصاءات ─────────────────────────────── */
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 6px; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
}
.stat b { font-size: 14px; font-weight: 700; color: var(--text); }
.stat span { font-size: 10px; color: var(--faint); }

/* ── الإنجليزية ────────────────────────────────── */
/* الخط العربي لا يخدم اللاتينية جيدًا، فنبدّله مع اللغة */
body.is-en {
  font-family: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
body.is-en .ltr-input { text-align: start; }

/* وصف تحت كل مفتاح في الإعدادات: الاسم وحده لم يكن يشرح الفرق بين
   الشريط الداخلي والعائم */
.sh-lbl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sh-lbl b { font-weight: 600; color: var(--text); font-size: 12.5px; }
.sh-lbl i { font-style: normal; font-size: 10.5px; color: var(--faint); line-height: 1.5; }
.sh-row-ctl { align-items: flex-start; }
.sh-row-ctl .sw { margin-block-start: 2px; }

/* زرّ التحديث يدور أثناء عمله: كان ينفّذ بصمت فيبدو معطّلًا */
.icon-btn.is-busy { color: var(--primary-light); pointer-events: none; }
.icon-btn.is-busy .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn .ic { transition: transform .2s; transform-origin: 50% 50%; }
@media (prefers-reduced-motion: reduce) { .icon-btn.is-busy .ic { animation: none; } }

/* ══════════ تبويب المونتاج — مربعات ══════════ */

/* كل إجراء مربّع واحد: أيقونة فوق واسم تحت. أوضح من صفّ أزرار نصّية،
   ويعطي التبويب إيقاعًا واحدًا. */
/* عرض محكوم: بلا حدّ أعلى تمدّدت المربعات إلى ١٩٣px على لوحة عريضة
   فصارت مستطيلات ضخمة. الآن تبقى مربّعة ومتوسّطة مهما اتّسعت اللوحة. */
.tiles {
  display: grid; grid-template-columns: repeat(3, minmax(84px, 104px));
  justify-content: center; gap: 8px;
}
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; aspect-ratio: 1 / .9; padding: 8px 5px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r); color: var(--dim);
  font: 11.5px/1.3 var(--font-ar); text-align: center;
  transition: background .14s, border-color .14s, color .14s, transform .08s;
}
.tile .ic { width: 19px; height: 19px; }
.tile:hover:not(:disabled) {
  background: #232330; color: var(--text); border-color: var(--line);
}
.tile:active:not(:disabled) { transform: scale(.97); }
.tile:disabled { opacity: .38; cursor: default; }
.tile.is-danger:hover:not(:disabled) {
  color: var(--danger); border-color: rgba(255,107,107,.4);
  background: rgba(255,107,107,.08);
}
/* مربّع اللون: نفس المقاس، والحقل الأصلي مخفي تحته */
.tile.as-color { position: relative; }
.tile.as-color input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tile.as-color .ic { color: var(--primary-light); }
.tile.as-color span { font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; }

/* ── ترتيب اللقطات ─────────────────────────────────────────────
 * أيقونات هذه البطاقة قضبان مصمتة لا خطوطًا مفرّغة: عند ١٩ بكسل تذوب
 * حدود المستطيل المفرّغ فتتشابه الأشكال الثلاثة، والقضب المصمت يشبه
 * اللقطة على التايم‌لاين فيشرح الزرّ نفسه بلا قراءة.
 */
.tile .ic-bars { width: 23px; height: 23px; }
/* «اعكس الترتيب» يقلب الأيقونة رأسًا على عقب: الصورة تُري النتيجة قبل الضغط */
.ic-flip { transition: transform .18s ease; }
#stepArrange.is-rev .ic-flip { transform: scaleY(-1); }

.src-row .note { margin: 0; flex: 0 0 auto; }

/* ══════════ شاشة الترخيص — تسلسل بصري ══════════ */
/* كانت كل الأزرار بنفس اللون فلا يُعرف الأساسي من الثانوي */
.gate-box .btn { margin-top: 8px; }
.gate-box .btn-primary { background: var(--grad-cta); border: 0; color: #fff; font-weight: 600; }
.gate-box .btn-go {
  background: transparent; color: var(--primary-light);
  border: 1px solid rgba(91,184,232,.42); box-shadow: none;
}
.gate-box .btn-go:hover { background: var(--primary-tint); color: var(--primary-soft); }
.gate-box .ltr-input { margin-bottom: 4px; }
.gate-box h2 { margin-bottom: 4px; }
.gate-sub { margin-bottom: 14px; line-height: 1.6; }
.gate-box .hint.center { margin-top: 10px; }
.gate-box #gateHelp { margin-top: 6px; opacity: .72; font-size: 10.5px; }

/* ══════════ شاشة انتهاء المدّة — عرضٌ لا إعلان ══════════ */
/*
 * الشاشة القديمة كانت سؤالًا مجرّدًا: «اشترك». وهذه تُجيب قبل السؤال —
 * تُري العمل يجري، ثم تضع الأسعار في العين، ثم تفتح للكود سطرًا واحدًا
 * فيه اللصق والتفعيل معًا. الصندوق يتّسع قليلًا لأن ثلاث بطاقات لا
 * تُقرأ في ٣٢٠ بكسل، ويبقى محكومًا موسَّطًا لا ممتدًّا بعرض اللوحة.
 */
.gate.is-show  .gate-box { max-width: 400px; }
.gate.is-offer .gate-box { max-width: 440px; }
.offer { margin-bottom: 16px; }

/* حقائق التجربة: ثلاث حبّات بدل سطر نثر — تُمسح بالعين لا تُقرأ */
.facts {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px; margin: 0 0 14px;
}
.facts span {
  font-size: 10.5px; color: var(--dim); line-height: 1.7;
  background: rgba(255,255,255,.035); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 3px 10px 3px 8px;
}
.facts span::before {
  content: '✓'; color: var(--primary-light); font-weight: 700;
  margin-inline-end: 5px; font-size: 10px;
}
/* زرّ الدخول: الإجراء الأول في الشاشة، فيكبر قليلًا عن أزرار اللوحة */
#gateBrowser { padding: 12px 16px; font-size: 13.5px; }

/* ── العرض المتحرّك ─────────────────────────────────── */
.showcase {
  border: 1px solid var(--line); border-radius: 14px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(44,141,208,.16), transparent 62%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 26px rgba(0,0,0,.35);
  padding: 12px 12px 10px; margin-bottom: 14px; overflow: hidden;
}
.sc-stage { position: relative; height: 76px; }
.sc-scene {
  position: absolute; inset: 0;
  opacity: 0; transform: translateY(7px); pointer-events: none;
  transition: opacity .42s ease, transform .42s cubic-bezier(.2,.8,.25,1);
}
.sc-scene.is-on { opacity: 1; transform: none; }

/* التسمية تحت المسرح: ثابتة الارتفاع كي لا يقفز ما تحتها عند التبديل */
.sc-cap { margin-top: 9px; min-height: 34px; }
.sc-cap b { display: block; font-size: 12.5px; color: var(--text); }
.sc-cap em { display: block; font-style: normal; font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.sc-cap.is-swap b, .sc-cap.is-swap em { opacity: 0; transform: translateY(4px); }
.sc-cap b, .sc-cap em { transition: opacity .22s ease, transform .22s ease; }

.sc-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.sc-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.18);
  cursor: pointer; transition: .22s;
}
.sc-dots i:hover { background: rgba(143,217,240,.5); }
.sc-dots i.on { width: 15px; border-radius: 3px; background: var(--grad-cta); }

/* ١ · قص الفراغات */
.sc-wave { display: flex; align-items: center; justify-content: center; height: 100%; }
.sc-wave .seg {
  position: relative; height: 36px; border-radius: 6px; flex: 0 0 auto;
  border: 1px solid rgba(91,184,232,.42);
  background: linear-gradient(180deg, rgba(91,184,232,.20), rgba(44,141,208,.08));
  overflow: hidden;
}
.sc-wave .seg::after {
  content: ''; position: absolute; inset: 26% 4px;
  background: repeating-linear-gradient(90deg, rgba(143,217,240,.85) 0 2px, transparent 2px 5px);
  opacity: .85;
}
.sc-wave .gap {
  height: 36px; border-radius: 6px; flex: 0 0 auto;
  border: 1px dashed rgba(255,107,107,.45); background: rgba(255,107,107,.07);
  transition: none;
}
.sc-scene.is-on .gap { animation: gapCut .6s cubic-bezier(.22,.85,.25,1) 1.05s both; }
@keyframes gapCut { to { width: 0; opacity: 0; border-width: 0; } }

/* المؤشّر يمرّ فيُفهم أن الحذف وقع أثناء التشغيل لا قبله */
.sc-head {
  position: absolute; top: 12px; bottom: 12px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--primary-soft), transparent);
  box-shadow: 0 0 10px rgba(143,217,240,.7); opacity: 0;
}
.sc-scene.is-on .sc-head { animation: headSweep 2.2s cubic-bezier(.4,0,.4,1) .15s both; }
@keyframes headSweep {
  0% { inset-inline-start: 12%; opacity: 0; }
  12% { opacity: .95; }
  85% { opacity: .95; }
  100% { inset-inline-start: 88%; opacity: 0; }
}

/* ٢ · التفريغ والترجمة */
.sc-subs {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; height: 100%;
}
.sc-subs .ln {
  font-size: 11.5px; color: var(--dim); line-height: 1.5;
  background: rgba(0,0,0,.4); border: 1px solid var(--line);
  border-radius: 7px; padding: 2px 9px; opacity: 0;
}
.sc-scene.is-on .ln { animation: lnType .45s cubic-bezier(.2,.8,.25,1) both; }
.sc-scene.is-on .ln:nth-child(2) { animation-delay: .5s; }
.sc-scene.is-on .ln:nth-child(3) { animation-delay: 1s; }
/* الكشف من اليمين لأن النصّ عربي؛ يُقلب في الإنجليزية */
@keyframes lnType {
  from { clip-path: inset(0 0 0 100%); opacity: .2; }
  to   { clip-path: inset(0 0 0 0);    opacity: 1; }
}
body.is-en .sc-scene.is-on .ln { animation-name: lnTypeEn; }
@keyframes lnTypeEn {
  from { clip-path: inset(0 100% 0 0); opacity: .2; }
  to   { clip-path: inset(0 0 0 0);    opacity: 1; }
}

/* ٣ · منحنى الحركة */
.sc-curve { position: relative; width: 150px; height: 60px; margin: 8px auto 0; }
.sc-curve svg { position: absolute; inset: 0; overflow: visible; }
.sc-curve .grid { stroke: rgba(255,255,255,.07); stroke-width: 1; fill: none; }
.sc-curve .track { stroke: rgba(91,184,232,.18); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.sc-curve .draw {
  stroke: var(--primary-light); stroke-width: 2.5; fill: none; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(91,184,232,.55));
  stroke-dasharray: 190; stroke-dashoffset: 190;
}
.sc-scene.is-on .draw { animation: curveDraw 1.7s cubic-bezier(.35,0,.25,1) .2s both; }
@keyframes curveDraw { to { stroke-dashoffset: 0; } }
.sc-dot {
  position: absolute; top: 0; left: 0; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 12px rgba(143,217,240,.9);
  offset-path: path("M4 54C42 54 54 8 146 8"); offset-distance: 0%; opacity: 0;
}
.sc-scene.is-on .sc-dot { animation: dotRide 1.7s cubic-bezier(.35,0,.25,1) .2s both; }
@keyframes dotRide {
  0% { offset-distance: 0%; opacity: 0; }
  8% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 1; }
}

/* ٤ · نقل الإفكتات */
.sc-fx { position: relative; display: flex; align-items: center; justify-content: center; gap: 46px; height: 100%; }
.sc-fx .clip {
  width: 54px; height: 38px; border-radius: 7px;
  border: 1px solid rgba(91,184,232,.35);
  background: linear-gradient(180deg, rgba(91,184,232,.16), rgba(44,141,208,.06));
}
.sc-fx .clip { position: relative; }
/* المصدر يحمل علامته ساكنة: بلا مصدرٍ ظاهر يصير الطيران بلا قصّة */
.sc-fx .from::after {
  content: 'fx'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; color: rgba(143,217,240,.55);
}
.sc-fx .to { border-style: dashed; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.03); }
.sc-fx .to::after {
  content: '✓'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: var(--primary-soft); opacity: 0;
}
.sc-scene.is-on .to::after { animation: fxTick .5s cubic-bezier(.2,.8,.25,1) 1.5s both; }
@keyframes fxTick { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.sc-scene.is-on .to { animation: fxLand .6s ease-out 1.25s both; }
@keyframes fxLand {
  0% { border-color: rgba(255,255,255,.18); }
  45% { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(91,184,232,.16); }
  100% { border-style: solid; border-color: rgba(91,184,232,.35);
         background: linear-gradient(180deg, rgba(91,184,232,.16), rgba(44,141,208,.06)); }
}
.sc-fx .chip {
  position: absolute; top: 50%; margin-top: -11px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; color: #04141f;
  background: var(--grad-cta); border-radius: 6px; padding: 3px 8px;
  box-shadow: 0 6px 16px rgba(44,141,208,.45); opacity: 0;
}
.sc-scene.is-on .chip { animation: fxFly 1.5s cubic-bezier(.3,.75,.25,1) .25s both; }
@keyframes fxFly {
  0%   { inset-inline-start: 26%; opacity: 0; transform: scale(.8); }
  18%  { opacity: 1; transform: scale(1); }
  70%  { inset-inline-start: 62%; opacity: 1; transform: scale(1); }
  100% { inset-inline-start: 62%; opacity: 0; transform: scale(.9) translateY(-6px); }
}

/* ── الباقات ────────────────────────────────────────── */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.plan {
  position: relative; text-align: center; cursor: pointer; min-width: 0;
  padding: 15px 6px 11px; border-radius: 12px;
  border: 1px solid var(--line); color: inherit;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  transition: transform .18s cubic-bezier(.2,.8,.25,1), border-color .18s,
              box-shadow .18s, opacity .18s;
}
.plan:hover {
  transform: translateY(-3px); border-color: rgba(91,184,232,.5);
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
}
.plan:active { transform: translateY(-1px); }
.plan .p-name { font-size: 11px; color: var(--faint); font-weight: 600; }
.plan .p-amt {
  display: block; font-size: 21px; font-weight: 800; line-height: 1.25; letter-spacing: -.02em;
  background: var(--grad-title); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; direction: ltr;
}
.plan .p-per { display: block; font-size: 9.5px; color: var(--faint); direction: ltr; }
.plan .p-save {
  display: inline-block; margin-top: 7px; font-size: 9.5px; font-weight: 700;
  color: var(--go); background: rgba(47,191,133,.12);
  border: 1px solid rgba(47,191,133,.3); border-radius: 99px; padding: 1px 7px;
}
.plan .p-tag {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; white-space: nowrap;
  padding: 2px 8px; border-radius: 99px; color: var(--primary-soft);
  background: #10161f; border: 1px solid rgba(91,184,232,.4);
}
/* الأفضل قيمة: يُميَّز بالحدّ والوهج، لا بحجمٍ يكسر الصفّ */
.plan.is-best {
  border-color: rgba(91,184,232,.55);
  background: linear-gradient(180deg, rgba(44,141,208,.16), var(--panel));
  box-shadow: 0 0 0 1px rgba(91,184,232,.14), 0 12px 30px rgba(44,141,208,.18);
}
.plan.is-best .p-tag { color: #04141f; background: var(--grad-cta); border-color: transparent; }
/*
 * لمعة بطيئة تمرّ مرّة كل ست ثوانٍ — إشارة حياة لا وميض. تسكن في طبقة
 * داخلية تقصّ ما يخرج عنها، لأن قصّ البطاقة نفسها كان يبتلع شارة
 * «الأفضل قيمة» المعلّقة فوق حدّها، وقصّ الطبقة بـ clip-path وحده
 * يُقصّ قبل الإزاحة فتظهر اللمعة على البطاقة المجاورة.
 */
.plan .p-glow {
  position: absolute; inset: 0; border-radius: 12px;
  overflow: hidden; pointer-events: none;
}
.plan.is-best .p-glow::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.10) 50%, transparent 58%);
  transform: translateX(-120%); animation: planSheen 6s ease-in-out infinite;
}
@keyframes planSheen { 0%, 62% { transform: translateX(-120%); } 92%, 100% { transform: translateX(120%); } }

/* ── الاختيار ────────────────────────────────────────
 * ثلاث بطاقات متساوية الحضور تعني أن لا قرار اتُّخذ بعد. المختارة
 * تُضاء وتحمل علامتها، وأختاها تخفتان قليلًا — فيُقرأ الاختيار بلمحة
 * قبل أن يُقرأ السعر. الخفوت خفيف كي يبقى السعران مقروءين للمقارنة.
 */
.plan:not(.is-sel) { opacity: .74; }
.plan.is-sel {
  opacity: 1; border-color: var(--primary-light);
  background: linear-gradient(180deg, rgba(44,141,208,.2), var(--panel));
  box-shadow: 0 0 0 1px rgba(91,184,232,.45), 0 12px 30px rgba(44,141,208,.22);
}
/* العلامة في الزاوية العليا المقابلة للشارة، فلا يزدحم رأس البطاقة */
.plan .p-pick {
  position: absolute; top: 7px; inset-inline-start: 7px;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(0,0,0,.25);
  transition: .18s;
}
.plan.is-sel .p-pick {
  border-color: transparent; background: var(--grad-cta);
  box-shadow: 0 2px 8px rgba(44,141,208,.5);
}
.plan.is-sel .p-pick::after {
  content: ''; position: absolute; top: 2.5px; inset-inline-start: 5px;
  width: 3px; height: 7px; border: solid #04141f;
  border-width: 0 1.7px 1.7px 0; transform: rotate(45deg);
}
.plan:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }

/* زرّ الشراء يلي البطاقات مباشرة: الاختيار ثم الفعل، بلا فاصل بينهما */
.offer #gatePlans { margin-top: 12px; padding: 12px 16px; font-size: 13.5px; }
.offer #gatePlans .b-sub {
  font-weight: 600; font-size: 11.5px; opacity: .8;
  margin-inline-start: 7px;
}
/* العنوان يكبر في شاشة الانتهاء: هو الخبر، وما تحته إجابته */
.gate.is-offer .gate-box h2 { font-size: 19px; }
.gate.is-offer .gate-box .logo { width: 44px; height: 44px; margin-bottom: 13px; }

#gateCompare { color: var(--primary-light); text-decoration: none; }
#gateCompare:hover { text-decoration: underline; }

/* ── فاصل «أو» ──────────────────────────────────────
 * بلا فاصل يُقرأ سطر الكود ذيلًا لزرّ الشراء، فيُظنّ خطوةً تاليةً له
 * لا طريقًا بديلًا عنه.
 */
.gate-or {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px; color: var(--faint); font-size: 10.5px;
}
.gate-or::before, .gate-or::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ── سطر الكود: اللصق والتفعيل معًا ─────────────────── */
.gate-code { margin-top: 4px; }
.gate-code .gc-lbl { display: block; font-size: 11px; color: var(--faint); margin-bottom: 6px; }
.gate-code .gc-row { display: flex; gap: 7px; align-items: stretch; }
.gate-box .gate-code input {
  flex: 1 1 auto; min-width: 0; margin: 0;
  font-size: 13px; letter-spacing: .05em; padding: 10px 8px;
}
.gate-code .btn { flex: 0 0 auto; margin: 0; padding: 10px 14px; min-width: 86px; white-space: nowrap; }
.gate-code .btn:disabled { opacity: .5; }
/* في شاشة الانتهاء الاشتراكُ هو الفعل الأساسي، فيتنازل زرّ التفعيل عن وهجه */
.gate-box .gate-code .btn.is-second {
  background: var(--panel-2); border-color: var(--line);
  color: var(--dim); box-shadow: none; font-weight: 600;
}
.gate-box .gate-code .btn.is-second:not(:disabled):hover {
  filter: none; color: var(--primary-soft);
  border-color: rgba(91,184,232,.45); background: var(--primary-tint);
}

/* ── هدوءٌ لمن طلبه ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sc-scene, .sc-cap b, .sc-cap em { transition: none; }
  .sc-scene.is-on .gap, .sc-scene.is-on .sc-head, .sc-scene.is-on .ln,
  .sc-scene.is-on .draw, .sc-scene.is-on .sc-dot, .sc-scene.is-on .chip,
  .sc-scene.is-on .to, .sc-scene.is-on .to::after,
  .plan.is-best .p-glow::after { animation: none; }
  .sc-scene.is-on .ln { opacity: 1; clip-path: none; }
  .sc-scene.is-on .to::after { opacity: 1; }
  .gate-box .logo { animation: none; }
  .sc-scene.is-on .draw { stroke-dashoffset: 0; }
  .plan:hover { transform: none; }
}

/* ── إعلان التحديث ───────────────────────────────────── */
/*
 * بطاقة تنزلق من الأسفل بدل شريط مسطّح. تُعلن ولا تقاطع: لا تحجب زرًّا،
 * ولها «لاحقًا» صريح — الإعلان الذي لا يمكن صرفه يصير إزعاجًا.
 */
.upd-card {
  position: fixed; inset-inline: 10px; bottom: 10px; z-index: 7000;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 13px;
  background: linear-gradient(135deg, rgba(25,32,46,.98), rgba(14,18,28,.98));
  border: 1px solid rgba(91,184,232,.34);
  box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset;
  animation: updIn .42s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes updIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* الماسة تتنفّس بهدوء — إشارة حياة لا لمعان صاخب */
.upd-gem {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(91,184,232,.28), transparent 70%);
}
.upd-gem .logo { width: 20px; height: 20px; animation: updGem 2.6s ease-in-out infinite; }
@keyframes updGem {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(91,184,232,.4)); }
  50%      { filter: drop-shadow(0 0 13px rgba(143,217,240,.85)); }
}

.upd-txt { flex: 1 1 auto; min-width: 0; line-height: 1.45; }
.upd-txt strong {
  display: block; font-size: 12.5px; font-weight: 700;
  background: var(--grad-title); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.upd-txt b {
  display: block; font-weight: 400; font-size: 10.5px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.upd-go {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--grad-cta); color: #04121d;
  font: 700 11px/1.3 var(--font-ar);
  box-shadow: 0 3px 12px rgba(44,141,208,.42); transition: .16s;
}
.upd-go:hover { filter: brightness(1.09); box-shadow: 0 5px 16px rgba(44,141,208,.55); }
.upd-x {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 0; color: var(--faint); font-size: 15px; line-height: 1;
  transition: .16s;
}
.upd-x:hover { background: rgba(255,255,255,.07); color: var(--text); }

/*
 * تأكيد ما بعد التحديث. يظهر مرّة واحدة بعد إعادة التشغيل ثم ينسحب وحده:
 * التحديث الصامت كان يتمّ بلا خبر، فيبقى المستخدم شاكًّا هل نجح أم لا.
 */
.upd-done {
  position: fixed; inset: 0; z-index: 7500; display: flex;
  align-items: center; justify-content: center;
  background: rgba(6,8,12,.62); backdrop-filter: blur(3px);
  animation: updFade .3s ease both;
}
.upd-done.out { animation: updFade .45s ease both reverse; pointer-events: none; }
@keyframes updFade { from { opacity: 0; } }

.upd-done-box {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 26px 34px; border-radius: 17px; text-align: center;
  background: linear-gradient(160deg, rgba(28,36,52,.99), rgba(13,17,26,.99));
  border: 1px solid rgba(91,184,232,.3);
  box-shadow: 0 18px 48px rgba(0,0,0,.6);
  animation: updPop .5s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes updPop { from { opacity: 0; transform: translateY(12px) scale(.94); } }

.upd-check {
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(47,191,133,.3), rgba(47,191,133,.09));
  border: 1px solid rgba(47,191,133,.55);
}
.upd-check svg { width: 26px; height: 26px; fill: none; stroke: var(--go); stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 34; stroke-dashoffset: 34;
  animation: updTick .5s .18s cubic-bezier(.6,0,.4,1) forwards; }
@keyframes updTick { to { stroke-dashoffset: 0; } }

.upd-done-box strong {
  font-size: 14px; font-weight: 700;
  background: var(--grad-title); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.upd-done-v { font-size: 11px; color: var(--faint); direction: ltr; }

@media (prefers-reduced-motion: reduce) {
  .upd-card, .upd-done, .upd-done-box { animation: none; }
  .upd-gem .logo { animation: none; }
  .upd-check svg { animation: none; stroke-dashoffset: 0; }
}

/* ── صفّ النموذج: القائمة وزرّ تحميلها جنبًا إلى جنب ───────────── */
.model-row { display: flex; gap: 6px; align-items: stretch; }
.model-row .dd { flex: 1; min-width: 0; }
.dl-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  padding: 0 10px; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 11px; white-space: nowrap;
  color: #04141f; border: 0;
  background: linear-gradient(135deg, #8FD9F0 0%, #2C8DD0 100%);
  box-shadow: 0 4px 14px rgba(143,217,240,.3);
}
.dl-btn:hover:not(:disabled) { filter: brightness(1.08); }
.dl-btn:disabled { opacity: .45; cursor: default; }
.dl-btn .ic { width: 13px; height: 13px; }
.dl-stat {
  margin: 5px 0 0; font-size: 11px; color: var(--faint);
  display: flex; gap: 2px; align-items: baseline;
}
.dl-stat b { color: var(--primary-soft); font-size: 12px; font-variant-numeric: tabular-nums; }

.dl-acts { margin-inline-start: auto; display: inline-flex; gap: 4px; }
.dl-act {
  width: 20px; height: 20px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0; cursor: pointer; border-radius: 5px;
  background: transparent; color: var(--faint);
  border: 1px solid rgba(255,255,255,.14);
}
.dl-act:hover { color: var(--primary-soft); border-color: rgba(91,184,232,.45); }
.dl-act .ic { width: 11px; height: 11px; }

/* ── خيارات التفريغ: صفوف مفاتيح بدل مربّعات وتلميحات سائبة ──────
   المربّعات العارية كانت تترك الوصف معلّقًا بلا انتماء بصري، فيبدو
   القسم مكوّمًا. الصفّ يجمع العنوان ووصفه ومفتاحه في وحدة واحدة. */
.opt-group {
  border: 1px solid var(--line-2); border-radius: 10px;
  overflow: hidden; margin: 2px 0 12px; background: rgba(255,255,255,.015);
}
.opt-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 10px 11px; cursor: pointer;
}
.opt-row + .opt-row { border-top: 1px solid var(--line-2); }
.opt-row:hover { background: var(--primary-tint); }
.opt-lbl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.opt-lbl b { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.4; }
.opt-lbl i {
  font-style: normal; font-size: 10.5px; color: var(--faint); line-height: 1.55;
}
.opt-row .sw { margin-block-start: 2px; }

/* الزرّ الأساسي أثناء التفريغ: إلغاء */
.btn-primary.is-cancel {
  background: linear-gradient(135deg, #ff9b9b 0%, #d94f4f 100%);
  box-shadow: 0 8px 24px rgba(217,79,79,.32), inset 0 1px 0 rgba(255,255,255,.25);
}
/* إعدادات تغيّرت بعد تفريغ: نلفت إليه بلا وميض مزعج */
.btn-primary.is-stale {
  box-shadow: 0 0 0 2px rgba(143,217,240,.5), 0 8px 24px rgba(44,141,208,.35);
}

/* ══════════ تبويب المونتاج — المحاذاة وأدوات التايم‌لاين ══════════ */

/* «إلى الإطار/التحديد» في رأس البطاقة، على الطرف المقابل للعنوان */
.card-head .al-to { margin-inline-start: auto; font-weight: 600; }
.card-head .al-to button { padding: 3px 10px; font-size: 11px; }

/* صفّا أزرار أيقونية على نسق لوحة Align في أدوبي؛ الاتجاه ltr في الـ HTML
   لأن «يسار/يمين» هنا اتجاه على الشاشة لا في النصّ */
.al-row {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin-top: 8px;
}
.al-btn {
  width: 34px; height: 30px; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); color: var(--dim);
  transition: background .14s, border-color .14s, color .14s, transform .08s;
}
.al-btn .ic { width: 18px; height: 18px; }
.al-btn:hover:not(:disabled) { background: #232330; color: var(--text); border-color: var(--line); }
.al-btn:active:not(:disabled) { transform: scale(.95); }
.al-btn:disabled { opacity: .38; cursor: default; }
.al-sep { width: 1px; height: 18px; margin: 0 5px; background: var(--line-2); }

.al-gap {
  display: inline-flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 8px; margin-inline-start: 6px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); color: var(--faint);
  font: 11px ui-monospace, Menlo, monospace;
}
.al-gap:focus-within { border-color: var(--primary-light); }
.al-gap input[type=text] {
  width: 46px; padding: 0; margin: 0; border: 0; outline: 0; box-shadow: none;
  background: transparent; color: var(--text); text-align: right;
  font: 12px ui-monospace, Menlo, monospace;
}
.al-gap input[type=text]::placeholder { color: var(--faint); font-family: var(--font-ar); }

/* بطاقة بمربّعين: عمودان بدل ثلاثة حتى لا يبقى المربّعان منحازين لطرف */
.tiles.two { grid-template-columns: repeat(2, minmax(84px, 124px)); }


/* ══════════════ مجموعات شكل الترجمة ══════════════
 * كانت عشرة مزالج متتابعة ومعها أربعة مفاتيح في الذيل منفصلة عمّا
 * تشغّله — فلا يُعرف أي مقبض يخصّ أي شيء. الآن كل مجموعة تحمل مفتاحها
 * في رأسها وتُطوى، والمطويّ لا يشغل إلا سطرًا.
 */
.cap-g {
  margin-top: 8px; border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--bg-soft); overflow: hidden;
}
.cap-gh {
  display: flex; align-items: center; gap: 7px; margin: 0; padding: 6px 9px;
  font-size: 11.5px; font-weight: 700; color: var(--text);
  cursor: pointer; user-select: none; transition: background .14s;
}
.cap-gh:hover { background: rgba(255,255,255,.025); }
.cap-gh > b { flex: 0 0 auto; }
.cap-gh .hd-ico { width: 18px; height: 18px; border-radius: 5px; }
.cap-gh .hd-ico .ic { width: 11px; height: 11px; }
.cap-gh > .cv {
  flex: 0 0 auto; margin-inline-start: auto; width: 0; height: 0;
  border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-top: 5.5px solid var(--faint);
  transition: transform .24s cubic-bezier(.2,.7,.2,1);
}
.cap-gh .cap-sw ~ .cv { margin-inline-start: 0; }
.cap-g.is-fold > .cap-gh > .cv { transform: rotate(-90deg); }
.cap-g.is-fold > .cap-gb { display: none; }
.cap-gb { padding: 0 9px 8px; }

/* مفتاح المجموعة: شريحة في الرأس، نفس مفاتيح تبويب المونتاج */
.cap-sw.chip {
  flex: 0 0 auto; margin-inline-start: auto; padding: 0 8px 0 6px;
  display: inline-flex; align-items: center; gap: 6px; min-height: 22px;
  border: 1px solid var(--line-2); border-radius: 20px; background: var(--panel-2);
  font-size: 10.5px; font-weight: 600; color: var(--faint); cursor: pointer;
  transition: background .16s, border-color .16s, color .16s;
}
.cap-sw.chip input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.cap-sw.chip .sw {
  flex: 0 0 auto; position: relative; width: 22px; height: 13px; border-radius: 10px;
  background: #171a21; border: 1px solid rgba(139,149,163,.34);
  transition: background .18s, border-color .18s;
}
.cap-sw.chip .sw::after {
  content: ''; position: absolute; top: 50%; inset-inline-start: 2px; margin-top: -4.5px;
  width: 9px; height: 9px; border-radius: 50%; background: #7d8794;
  transition: transform .2s cubic-bezier(.2,.7,.2,1), background .18s;
}
.cap-sw.chip:hover { border-color: rgba(139,149,163,.45); color: var(--dim); }
.cap-sw.chip.is-on {
  background: var(--primary-tint); border-color: rgba(91,184,232,.42); color: var(--primary-soft);
}
.cap-sw.chip.is-on .sw { background: rgba(44,141,208,.3); border-color: var(--primary); }
.cap-sw.chip.is-on .sw::after { background: var(--primary-soft); transform: translateX(-7px); }
body.is-en .cap-sw.chip.is-on .sw::after { transform: translateX(7px); }
/* المجموعة المطفأة تخفت: يُرى أن مقابضها لا أثر لها الآن */
.cap-g:has(.cap-sw.chip:not(.is-on)) > .cap-gb { opacity: .5; }

/* صفّا مزالج: القيمة شريحة تُقرأ بطرف العين أثناء السحب */
/* صفوف المزالج مضغوطة: اثنان وعشرون مزلاجًا، فكل بكسل في الصفّ
   يتضاعف اثنتي عشرة مرة على طول البطاقة. */
.cap-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 5px; }
.cap-rows .ctl { margin: 0; }
.cap-rows .lbl { margin-bottom: 1px; }
.cap-rows input[type="range"] { margin: 2px 0 6px; }
.cap-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.cap-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ed-ui .cap-f > .lbl { margin-bottom: 0; }

/* الألوان: عيّنة واسمها، لا أيقونة عامّة بلا اسم */
.cap-cols { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cap-col {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 5px;
  border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel-2);
  font-size: 11px; color: var(--dim); cursor: pointer; transition: border-color .15s;
}
.cap-col:hover { border-color: rgba(91,184,232,.4); }
.cap-col .cp-btn { width: 22px; height: 20px; }

/* أنواع الحركة سبعة: تلتفّ في سطرين بدل أن تُضغط في سطر */
.cap-anim { flex-wrap: wrap; margin-top: 5px; gap: 3px; }
.cap-anim button { flex: 1 1 52px; padding: 5px 4px; font-size: 11px; }

/* المعاينة الراسية فوق كل شيء */
.ed-ui .cap-dock { z-index: 8; }

/* ══════════════ تبويب القص ══════════════
 * نفس لغة تبويب المونتاج: رأسٌ بشارة أيقونة وعنوان و ⓘ، وبطاقة بنفس
 * الحشو والاستدارة. الخاص بهذا التبويب هنا فقط.
 */

/* صفّ خيار خاصّ بالقص. الاسم ليس ‎.opt-row‎ لأن ذاك صفُّ مفتاحٍ قائم في
 * تبويب الترجمة: حشوه وخلفيةُ مروره وخطُّه الفاصل كانت تتسرّب إلى هنا.
 * تسمية ثم مجموعة أزرار بعرض ما تبقّى.
 * كانا عمودين متجاورين بعرض ١٩٠ بكسل، فينكسر «قص الفراغات» سطرين
 * ويطول مربّعه عن جاره — وهو أظهر ما يكسر اتزان الشاشة. */
.ed-ui .cut-opt {
  display: flex; align-items: center; gap: 9px; margin-bottom: 7px;
}
.ed-ui .cut-opt-lbl {
  flex: 0 0 62px; font-size: 11.5px; font-weight: 600; color: var(--faint);
}
.ed-ui .cut-opt .segmented { flex: 1 1 auto; min-width: 0; }
.ed-ui .cut-opt .segmented button { white-space: nowrap; padding: 7px 6px; font-size: 11.5px; }

/* المجموعة المختارة: حبّة واحدة تنزلق تحت الأزرار.
 * كان كل زرّ يحمل تدرّجه بنفسه، والتدرّج لا يقبل الانتقال، فالاختيار
 * يقفز من مكان إلى مكان بلا حركة. الآن الحبّة عنصر واحد يُزاح، واللون
 * وحده ينتقل على النصّ. والهالة خفّت لأنها كانت تسحب العين إلى الخيار
 * بدل الزرّ الرئيسي تحته. */
.ed-ui .segmented {
  position: relative; background: var(--bg); padding: 3px; gap: 3px;
  border-radius: 9px; border-color: var(--line-2);
}
.ed-ui .seg-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; opacity: 0;
  border-radius: 7px; background: var(--grad-cta); pointer-events: none;
  box-shadow: 0 2px 8px rgba(44,141,208,.3);
  transition: transform .34s cubic-bezier(.2,.7,.2,1), width .34s cubic-bezier(.2,.7,.2,1), opacity .2s;
}
.ed-ui .segmented button {
  position: relative; z-index: 1; border-radius: 7px;
  transition: color .28s ease-out;
}
.ed-ui .segmented button.is-active { background: transparent; color: #fff; box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
  .ed-ui .seg-pill { transition: opacity .2s; }
}

/* زرّ التنفيذ قبل التحليل: مطفأ بوضوح لا لامعًا معطَّلًا. الهيئة العامة
   تكتفي بـ opacity:.35 فيبقى التدرّج والهالة يقولان «اضغطني». */
.ed-ui .btn-go:disabled {
  opacity: 1; background: var(--panel-2); color: var(--faint);
  border: 1px solid var(--line-2); box-shadow: none; cursor: default;
}
.ed-ui .btn-go:disabled .ic { opacity: .5; }

/* سطر المصدر: بطاقة صغيرة داخل البطاقة، تفصل «ما اخترته» عن «ما سينفَّذ» */
.ed-ui .src-row {
  margin-top: 9px; padding: 8px 10px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line-2); gap: 8px; font-size: 11.5px;
}
.ed-ui .src-row .ic { width: 15px; height: 15px; }

/* الزرّ الرئيسي: نفس استدارة النظام الجديد، وظلٌّ أهدأ */
.ed-ui .btn-block { margin-top: 10px; border-radius: 10px; padding: 11px 15px; font-size: 13px; }
.ed-ui .btn-primary { box-shadow: 0 4px 16px rgba(44,141,208,.28), inset 0 1px 0 rgba(255,255,255,.2); }
.ed-ui .btn-go { box-shadow: 0 4px 16px rgba(143,217,240,.26), inset 0 1px 0 rgba(255,255,255,.35); }

/* أزرار التكبير في الرأس: بمقاس أزرار الرأس الأخرى */
.ed-ui .card-head .zoom { margin-inline-start: auto; align-items: center; gap: 3px; }
.ed-ui .card-head .zoom button {
  min-width: 24px; height: 22px; padding: 0 7px; border-radius: 7px;
  font-size: 11.5px; border-color: var(--line-2); color: var(--faint);
}
.ed-ui .card-head .zoom .zoom-level { margin-inline-start: 5px; font-size: 10.5px; }

/* كدسة الموجة: إطار واحد يجمع الثلاثة بدل ثلاثة إطارات متجاورة */
.ed-ui .wave-stack {
  padding: 7px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2);
}
.ed-ui .wave { height: 104px; border-radius: 7px; border-color: var(--line-2); }
.ed-ui .wave-stack { position: relative; }
.ed-ui .wave-empty { display: none; }
.ed-ui .card.is-locked .wave-empty {
  display: flex; align-items: center; justify-content: center;
  position: absolute; inset-inline: 7px; top: 7px; height: 104px;
  font-size: 11px; color: var(--faint); text-align: center; pointer-events: none;
}
.ed-ui .wave-spk, .ed-ui .wave-mini { border-color: var(--line-2); }
.ed-ui .wave-time { margin-top: 3px; }
.ed-ui .wave-legend { margin-top: 7px; font-size: 10px; gap: 10px; }

/* المقابض: القيمة شريحة صغيرة تُقرأ بطرف العين أثناء السحب */
.ed-ui .sliders { margin-top: 11px; gap: 6px 14px; }
.ed-ui .sliders.three { gap: 6px 12px; margin-top: 11px; }
.ed-ui .lbl { font-size: 11px; margin-bottom: 4px; }
.ed-ui .lbl em {
  padding: 1px 6px; border-radius: 20px; font-size: 10.5px;
  background: var(--primary-tint); border: 1px solid rgba(91,184,232,.22);
}

/* شريط النتيجة: خلايا بفواصل، والرقم أكبر من تسميته */
.ed-ui .result {
  gap: 0; margin-top: 11px; padding: 8px 4px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line-2);
}
.ed-ui .r-cell {
  flex: 1 1 auto; align-items: center; text-align: center; gap: 2px; padding: 0 10px;
  border-inline-start: 1px solid var(--line-2);
}
.ed-ui .r-cell:first-child { border-inline-start: 0; }
.ed-ui .r-cell b { font-size: 15px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ed-ui .r-cell.wide b { font-size: 12px; }
.ed-ui .r-cell i { font-size: 9.5px; }
.ed-ui .result .link { flex: 0 0 auto; margin-inline-start: 0; padding-inline: 8px; font-size: 10.5px; }

.ed-ui .meter { margin: 9px 0 0; height: 4px; }
.ed-ui .foot-row { margin-top: 9px; }
.ed-ui .foot-row .note { margin: 0; }

/* البهتان نفسه محكومٌ بقاعدة .card.is-locked العامّة أعلاه — لا تُضاعَف
   هنا بشفافية ثانية على البطاقة. */

/* ══════════════ تبويب المونتاج ══════════════
 * قاعدة واحدة تحكم التبويب كلّه بعد أن كانت طبقتان متعارضتان: طبقةٌ
 * مضغوطة وفوقها طبقةٌ فسيحة تلغيها، فبقيت البطاقة تأخذ ١٩٠ بكسل لثلاثة
 * أوامر. المقاس هنا مقصود لا افتراضيّ: رأسٌ من سطر واحد (٢٤)، صفّ أوامر
 * (٣٦)، وسطر نتيجة لا يظهر إلا إن وُجد. الهدف أن يُرى التبويب كلّه بلا
 * تمرير على لوحة بارتفاع عاديّ.
 */

.pane[data-pane="tools"].is-active {
  /* أعمدة تتراص لا شبكة صفوف: الشبكة تجعل ارتفاع الصفّ = أطول بطاقة فيه
     فتترك فجوات تحت القصيرة. العتبة ٢٧٠ لأن الصفّ الواحد يحتاجها ليُبقي
     ثلاثة أوامر في سطر؛ دونها تلتفّ الأوامر وتطول البطاقة. */
  display: block; column-width: 400px; column-gap: 12px;
}
/*
 * ٢٧٠ كانت مقاس البطاقة القديمة: ثلاثة أوامر في سطر. بعد أن صارت
 * «أدوات سريعة» بطاقةً واحدة فيها صفّ محاذاة من ثمانية أزرار، حشرها
 * العمودُ الضيّق في ٢٧٠ بكسل ولو كانت الشاشة ١٤٠٠ — فتُقصّ الأسماء على
 * الشاشة الكبيرة أكثر ممّا تُقصّ على اللوحة المرصوفة. ٤٠٠ هو أقلّ عرضٍ
 * يُبقي صفّ المحاذاة في سطر واحد.
 *
 * والسقف هنا أضيق من بقيّة التبويبات: أربع بطاقاتٍ قصيرة في عرض ١١٥٠
 * تملأ عمودين وتترك عمودين فارغين — فراغٌ أسود يقرأ كأن شيئًا سقط.
 */
.pane[data-pane="tools"] { max-width: 860px; }
/* بين العمود الواحد والعمودين (٨٣٠ فما دون) يبقى عمودٌ واحد: نحصر عرضه
   ونوسّطه بدل أن يتمدّد فيصير الزرّ بعرض نصف الشاشة. */
@media (max-width: 830px) { .pane[data-pane="tools"] { max-width: 560px; } }
.ed-ui > .card {
  margin: 0 0 8px; padding: 10px 12px 9px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.022), transparent 42%), var(--panel);
  border: 1px solid var(--line-2);
  break-inside: avoid; -webkit-column-break-inside: avoid;
}
.ed-ui > .card:hover { border-color: rgba(91,184,232,.2); }
/*
 * تراصّ «ماسونري» بدل أعمدة CSS. الأعمدة لا تقسم البطاقة، فحين تجاور
 * بطاقةٌ طويلة قصيرةً يبقى تحت القصيرة فراغٌ أسود، وفتحُ بطاقة يعيد توزيع
 * الأعمدة كلها فتقفز. هنا شبكة بصفوف من ٢ بكسل، وكل بطاقة تمتدّ بعدد
 * صفوف يساوي طولها (يحسبه js/edittools.js)، و‎dense‎ يرفع ما بعدها إلى
 * أول فراغ. البطاقات تبقى أبناءً مباشرين فلا تنكسر قواعد ‎.ed-ui > .card‎.
 */
.pane[data-pane="tools"].is-active.is-masonry {
  display: grid; column-gap: 12px; row-gap: 0;
  grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));   /* min(): على الهاتف اللوحة أضيق من ٤٠٠ فكانت البطاقة تنقصّ من الجانب */
  grid-auto-rows: 2px; grid-auto-flow: row dense; align-items: start;
}
.pane[data-pane="tools"].is-masonry > .card { align-self: start; }
.pane[data-pane="tools"].is-masonry > .card.ed-ctx { grid-column: 1 / -1; }

/* ── شريط السياق: على أيّ مقطع يقع كل ما تحت ──
 * كان ملتصقًا بأعلى التبويب (position: sticky) ليبقى التحديد مرئيًا وقت
 * الضغط على أمر. أُلغي الالتصاق بطلب عمر: مع فتح الأقسام صار يعلّق نفسه
 * فوق المحتوى ويزاحمه عند التمرير، والاسم يظهر في كل بطاقة تحتاجه.
 * column-span يبقى: ليأخذ عرض اللوحة كلّها حين تنقسم إلى عمودين.
 */
.pane[data-pane="tools"] > .card.ed-ctx {
  column-span: all;
  margin-bottom: 10px; padding: 9px 11px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--line);
  box-shadow: 0 6px 18px -8px rgba(0,0,0,.75);
}

.sel-row { display: flex; align-items: center; gap: 9px; }
.sel-ico {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-tint); border: 1px solid rgba(91,184,232,.25); color: var(--primary-light);
}
.sel-ico .ic { width: 15px; height: 15px; }
.sel-txt { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.sel-txt > b { font-size: 12.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-txt > .note { margin: 0; font-style: normal; font-size: 10.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* لا تحديد: الأيقونة تخفت فيُقرأ الحال قبل قراءة السطر */
.sel-note.empty { color: var(--dim); font-weight: 600; }
.icon-btn.sq { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.sq .ic { width: 14px; height: 14px; }

.ed-ui .fxq { margin-top: 7px; border-radius: 10px; padding: 6px 10px; }

/* ── رأس القسم: سطرٌ واحد ──
 * كان سطرين (عنوان ووصف) وهامشًا ١٢: أربعون بكسلًا في كل بطاقة لوصفٍ
 * يعيد صياغة العنوان. الوصف انتقل إلى ⓘ، والرأس كلّه يطوي القسم.
 */
.ed-ui .card-head {
  display: flex; align-items: center; gap: 7px; margin: 0 0 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text);
  cursor: pointer; user-select: none;
}
.ed-ui .card-head > b { flex: 0 0 auto; letter-spacing: -.01em; }
.ed-ui .hd-ico {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-tint); color: var(--primary-light);
  border: 1px solid rgba(91,184,232,.18);
}
.ed-ui .hd-ico .ic { width: 14px; height: 14px; }

/* الوصف تحت علامة استفهام هادئة بدل سطرٍ دائم */
.hd-hint {
  flex: 0 0 auto; display: inline-flex; align-items: center; color: var(--faint);
  opacity: .55; cursor: help; transition: opacity .15s, color .15s;
}
.hd-hint .ic { width: 13px; height: 13px; }
.hd-hint:hover { opacity: 1; color: var(--primary-light); }

/* زرّ صغير في الرأس (ترس المجلدات) */
.hd-btn {
  flex: 0 0 auto; margin-inline-start: auto; width: 22px; height: 22px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--faint);
  border-radius: 7px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: .15s;
}
.hd-btn .ic { width: 13px; height: 13px; }
.hd-btn:hover { color: var(--primary-soft); border-color: rgba(91,184,232,.4); background: var(--primary-tint); }

/* سهم الطيّ: آخر عنصر دائمًا، ويدور مع حالة القسم */
.ed-ui .card-head > .cv {
  flex: 0 0 auto; margin-inline-start: auto; width: 0; height: 0; cursor: pointer;
  border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-top: 5.5px solid var(--faint);
  transition: transform .24s cubic-bezier(.2,.7,.2,1), border-top-color .16s;
}
.ed-ui .card-head:hover > .cv { border-top-color: var(--dim); }
.ed-ui .hd-btn ~ .cv,
.ed-ui .check.chip ~ .cv,
.ed-ui .al-to ~ .cv { margin-inline-start: 0; }
/* رأس البطاقة يلتفّ عند الضيق: شريحة المفتاح كانت تنضغط فوق سهم الطيّ
   فيتراكبان — العمود الضيّق لا يسع العنوان والمفتاح في سطر واحد. */
.ed-ui .card > .card-head { flex-wrap: wrap; row-gap: 6px; }
.ed-ui .card.is-fold > .card-head > .cv { transform: rotate(-90deg); }
.ed-ui .card.is-fold > .card-head { margin-bottom: 0; }
/*
 * ‎!important مقصودة: صفّ الأوامر يُنسَّق لاحقًا بـ
 * ‎.pane[data-pane="tools"] .tiles.two/.four{display:flex}‎ وهي بنفس
 * أولوية قاعدة الطيّ وتأتي بعدها، فكانت تغلبها — فتبقى «أدوات
 * التايم‌لاين» و«البروجكت» مفتوحتين مهما ضغط المستخدم السهم. أي قاعدة
 * display لاحقة تكسر الطيّ بلا هذا، تمامًا كما تكسر خاصية hidden.
 */
.ed-ui .card.is-fold:not(.is-anim) > :not(.card-head) { display: none !important; }

/*
 * حركة الفتح والطيّ. ‎display لا يقبل الانتقال، والمتصفّح هنا (كروميوم ٨٨
 * داخل CEP) لا يعرف ‎interpolate-size‎ ولا ‎allow-discrete‎، فنحرّك
 * الارتفاع بقيمة صريحة يحسبها الجافاسكربت ثم يرفعها فور انتهاء الحركة
 * كي يعود القسم مرنًا مع أيّ تغيّر في محتواه.
 *
 * ‏.is-anim تبقي الأبناء مرسومين أثناء الطيّ (وإلا اختفوا قبل أن تبدأ
 * الحركة فتبدو قفزة)، وoverflow مقصورٌ عليها وحدها لأن الإخفاء الدائم
 * يقصّ ما يخرج عن البطاقة كمنتقي الألوان وقوائم البحث.
 */
.ed-ui .card.is-anim {
  overflow: hidden;
  transition: height .24s cubic-bezier(.25,.8,.35,1);
}
@media (prefers-reduced-motion: reduce) {
  .ed-ui .card.is-anim { transition: none; }
}

/* ── صفّ الأوامر ──
 * أيقونة وكلمة في سطر. flex لا grid: الأوامر الأربعة تلتفّ من نفسها حين
 * يضيق العمود بدل أن تُقصّ.
 */
.pane[data-pane="tools"] .tiles,
.pane[data-pane="tools"] .tiles.two,
.pane[data-pane="tools"] .tiles.four {
  display: flex; flex-wrap: wrap; gap: 5px; justify-content: stretch;
}
.pane[data-pane="tools"] .tile {
  position: relative; flex: 1 1 76px; aspect-ratio: auto; min-height: 36px;
  flex-direction: row; gap: 6px; padding: 0 8px; border-radius: 9px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--dim);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.pane[data-pane="tools"] .tile .ic { width: 16px; height: 16px; flex: 0 0 auto; opacity: .9; }
.pane[data-pane="tools"] .tile:hover:not(:disabled) .ic { opacity: 1; color: var(--primary-light); }
.pane[data-pane="tools"] .tile.is-danger:hover:not(:disabled) .ic { color: var(--danger); }
/* الأربعة في عمود ضيّق تنقسم اثنين واثنين لا ثلاثة وواحدًا */
.pane[data-pane="tools"] .tiles.four .tile { flex: 1 1 calc(50% - 3px); }
/* عيّنة اللون تتمدّد مثل جارتيها: كانت بعرض ثابت فتُترك وحدها في سطر
   وبقيّة السطر فراغ حين يضيق العمود */
.pane[data-pane="tools"] .tile.as-color { flex: 1 1 92px; gap: 8px; }

/* حالة مختارة: يملؤها لون الهوية */
.pane[data-pane="tools"] .tile.is-on {
  background: var(--grad-cta); border-color: transparent; color: #fff;
  box-shadow: 0 5px 14px rgba(44,141,208,.26);
}
.pane[data-pane="tools"] .tile.is-on .ic { color: #fff; opacity: 1; }

/* ── شريحة المفتاح في الرأس ──
 * كان مفتاحًا في سطرٍ مستقلّ أسفل البطاقة (٣٤ بكسلًا) واسمه جملة كاملة.
 * صار شريحة بجانب العنوان: الاسم مختصر، والجملة في التلميح.
 */
.ed-ui .check.chip {
  flex: 0 1 auto; min-width: 0; margin: 0 0 0 auto; padding: 0 8px 0 6px;
  display: inline-flex; align-items: center; gap: 6px; min-height: 22px;
  border: 1px solid var(--line-2); border-radius: 20px; background: var(--panel-2);
  font-size: 10.5px; font-weight: 600; color: var(--faint); cursor: pointer;
  transition: background .16s, border-color .16s, color .16s;
}
body.is-en .ed-ui .check.chip { margin: 0 auto 0 0; }
.ed-ui .check.chip > span {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ed-ui .check.chip input[type=checkbox] {
  position: absolute; opacity: 0; width: 0; height: 0; margin: 0;
}
/* المفتاح نفسه عنصرٌ حقيقيّ لا ::before: الشريحة تحتاج ترتيبًا في الصفّ،
   وappearance:none لا تُطبَّق في CEF بريمير فلا يصحّ الاعتماد عليها. */
.ed-ui .check.chip .sw {
  flex: 0 0 auto; position: relative; width: 22px; height: 13px; border-radius: 10px;
  background: #171a21; border: 1px solid rgba(139,149,163,.34);
  transition: background .18s, border-color .18s;
}
.ed-ui .check.chip .sw::after {
  /* المقبض يبدأ عند بداية المسار وينتقل إلى نهايته عند التشغيل. كان عند
     النهاية فيخرج من المسار حين يُشغَّل (والاتجاهان يعكسان معنى الطرفين). */
  content: ''; position: absolute; top: 50%; inset-inline-start: 2px; margin-top: -4.5px;
  width: 9px; height: 9px; border-radius: 50%; background: #7d8794;
  transition: transform .2s cubic-bezier(.2,.7,.2,1), background .18s;
}
.ed-ui .check.chip:hover { border-color: rgba(139,149,163,.45); color: var(--dim); }
.ed-ui .check.chip.is-on {
  background: var(--primary-tint); border-color: rgba(91,184,232,.42); color: var(--primary-soft);
}
.ed-ui .check.chip.is-on .sw { background: rgba(44,141,208,.3); border-color: var(--primary); }
.ed-ui .check.chip.is-on .sw::after { background: var(--primary-soft); transform: translateX(-7px); }
body.is-en .ed-ui .check.chip.is-on .sw::after { transform: translateX(7px); }

/* ── سطر النتيجة ──
 * لا يشغل مكانًا وهو فارغ. كان كل قسم يحمل سطر إرشاد ثابتًا يقرؤه
 * المستخدم مرّة ثم يبقى يأخذ مكانه أبدًا؛ الإرشاد صار في ⓘ، وهذا السطر
 * لِما يحدث فعلًا: عدد ما نُقل، أو سبب التعذّر.
 */
.ed-ui .note { margin: 8px 0 0; font-size: 10.5px; line-height: 1.5; }
/*
 * ‎!important مقصودة: قاعدة ‎.ed-ui .note.meta{display:flex}‎ أدناه بنفس
 * الأولوية وتأتي بعدها فتغلبها، فيبقى السطر الفارغ صندوق فليكس بحدٍّ
 * علويّ. وداخل أعمدة التبويب كان كروميوم القديم في CEP يفجّر ارتفاعه
 * إلى ٢^٢٤ بكسل فتنكسر البطاقة عبر عمودين ويظهر تمرير أفقي — حدث في
 * بطاقة التتبّع ثم في بطاقة التنزيل. الأصل أن الفارغ لا يشغل مكانًا.
 */
.ed-ui .note:empty { display: none !important; }
.ed-ui .note.meta {
  display: flex; align-items: center; gap: 6px; margin-top: 7px;
  padding-top: 6px; border-top: 1px solid var(--line-2); color: var(--faint);
}

/* سطر الرسالة: الفشل يُقرأ تحت الزرّ نفسه لا في أسفل اللوحة وحده */
.ed-ui .note.bad { color: var(--danger); }
.tile.err-flash, .al-btn.err-flash {
  animation: edErr .8s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes edErr {
  0%, 100% { border-color: var(--line-2); }
  12%, 70% { border-color: rgba(255,107,107,.75); background: rgba(255,107,107,.1); }
}
@media (prefers-reduced-motion: reduce) {
  .tile.err-flash, .al-btn.err-flash { animation: none; border-color: rgba(255,107,107,.75); }
}

/* ── المحاذاة ──
 * صفٌّ واحد يلتفّ عند الضيق. كان صفّين ثابتين، فلمّا صار التبويب عمودين
 * فاض الصفّ عن عرض العمود وخرجت الأزرار من البطاقة. */
.pane[data-pane="tools"] .al-row {
  gap: 3px; margin-top: 0; flex-wrap: wrap; row-gap: 5px; justify-content: flex-start;
}
/* الأزرار الثمانية وحقل المسافة في سطر واحد داخل عمود اللوحة الضيّق:
   ٣٤ بكسلًا للزرّ كانت تملأ السطر وتدفع الحقل إلى سطر ثانٍ */
.pane[data-pane="tools"] .al-btn { width: 30px; height: 28px; }
.pane[data-pane="tools"] .al-btn .ic { width: 17px; height: 17px; }
.pane[data-pane="tools"] .al-sep { margin: 0 3px; }
.pane[data-pane="tools"] .al-gap { flex: 1 1 56px; min-width: 54px; height: 28px; margin-inline-start: 4px; }
.pane[data-pane="tools"] .al-row + .al-row { margin-top: 6px; }
.card-head .al-to { flex: 0 0 auto; margin-inline-start: auto; font-weight: 600; }
.card-head .al-to button { padding: 3px 9px; font-size: 10.5px; }

/* ── مجموعات البطاقة السريعة ──
 * خمس بطاقات صارت بطاقةً واحدة بمجموعات. كل مجموعة عنوانٌ صغير وصفُّ
 * أزرار: العنوان يقول ما تفعله الأزرار دون أن يحجز رأس بطاقةٍ كاملًا
 * (٣٢ بكسلًا وحاشية وسطر رسائل لكل واحدة).
 */
.qt .tg { margin-top: 11px; }
.qt .tg:first-of-type { margin-top: 2px; }
.qt .tg + .tg { padding-top: 11px; border-top: 1px solid var(--line-2); }

.qt .tg-head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 8px; margin-bottom: 7px; min-height: 20px;
}
.qt .tg-lbl {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--faint);
}
/* أدوات المجموعة (مفتاح، «الإطار/التحديد») إلى الطرف المقابل للعنوان */
/* الضبطيات تلتصق بطرف الرأس المقابل للعنوان. ‎margin-inline-start:auto‎
   وحدها لم تكفِ: قاعدةٌ أخرى تضع ‎auto‎ على الطرف الثاني أيضًا، فينقسم
   الفراغ نصفين وتطفو الشريحة في وسط السطر — لا هي عند العنوان ولا عند
   الطرف. تصفير الطرف الثاني يحسمها. */
.qt .tg-head > .check.chip,
.qt .tg-head > .tg-swatch,
.qt .tg-head > .segmented { margin-inline-start: auto; margin-inline-end: 0; }
/* وحين اجتمع أكثر من ضبطيّة تتلاصق: الأولى وحدها تدفع الفراغ */
.qt .tg-head > .check.chip ~ .check.chip,
.qt .tg-head > .tg-swatch ~ .check.chip,
.qt .tg-head > .tg-swatch ~ .segmented { margin-inline-start: 0; }

/* عيّنة لون «سولد»: ضبطٌ لا أمر، فمكانها رأس المجموعة فوق الزرّ الذي
   تخصّه — لا خليّة في صفّ الأوامر تُحسب أمرًا خامسًا وتترك فراغًا. */
/* شكلها شكل شريحة المفتاح المجاورة تمامًا: الحواف نفسها والارتفاع نفسه
   ومقاس النقطة كمقاس المفتاح. كانت مستطيلًا حادّ الزوايا يسكنه زرٌّ أطول
   منه (٣٠×٢٦ داخل ٢٤) فينتأ مربّعٌ ملوّن كبير يسرق النظر من الأوامر. */
.qt .tg-swatch {
  display: inline-flex; align-items: center; gap: 6px; position: relative;
  min-height: 22px; padding: 0 8px 0 6px; border-radius: 20px;
  background: var(--panel-2); border: 1px solid var(--line-2); cursor: pointer;
  font-size: 10.5px; font-weight: 600; color: var(--faint);
  transition: border-color .16s, color .16s;
}
.qt .tg-swatch:hover { border-color: rgba(139,149,163,.45); color: var(--dim); }
/* نقطة اللون بمقاس مفتاح الشريحة المجاورة (٢٢×١٤) فيستوي الطرفان.
   وحلقة الفتح ٢ لا ٣: ٣ تفيض من شريحةٍ ارتفاعها ٢٢. */
.qt .tg-swatch .cp-btn { width: 22px; height: 14px; padding: 1px; border-radius: 8px; }
.qt .tg-swatch .cp-btn.is-open { box-shadow: 0 0 0 2px var(--primary-tint); }
.qt .tg-swatch .cp-chip { border-radius: 7px; }
.qt .tg-swatch .sw-lbl { white-space: nowrap; }
#stepAlign .card-head .al-to button { padding: 3px 9px; font-size: 10.5px; }
/* هذه المجموعة بلا .seg-pill المتحرّكة، فالمختار يُطلى مباشرةً — كان
   نصًّا أبيض بلا خلفية، لا يُفرّق عن جاره إلا بتدقيق. */
#stepAlign .card-head .al-to button.is-active {
  background: var(--grad-cta); box-shadow: 0 2px 8px rgba(44,141,208,.3);
}

/*
 * «إضافة إلى التايم‌لاين» أربعة أوامر. عددُ أعمدتها يُختار من قواسم
 * الأربعة وحدها (٤ أو ٢ أو ١)، فلا يبقى في آخر السطر مربّعٌ فارغ يقرأ
 * كأن شيئًا سقط. الشبكة الحرّة كانت تعطي ثلاثة فتترك خليّة معلّقة.
 */
/* عمودان ثابتان لا استفتاءَ عرضِ نافذة: استعلام الوسائط يقيس النافذة
   لا البطاقة، والبطاقة هنا تعيش في عمودٍ عرضه ٤٠٠ مهما اتّسعت الشاشة —
   فكانت «٤٧٠ فأكثر» تعطي أربعة أعمدة داخل ٣٥٦ بكسل وتقصّ كل اسم. */
.card.qt #stepLayers .tiles { grid-template-columns: repeat(2, 1fr); }
.icons-only .card.qt #stepLayers .tiles { grid-template-columns: repeat(4, 1fr); }

.qt .note.meta { margin: 6px 0 0; }
.qt .note.warn { margin: 7px 0 0; }
/* سطر الرسائل المشترك: لا يحجز ارتفاعًا وهو فارغ */
.qt > .note.msg { margin: 9px 0 0; }
.qt > .note.msg:empty { display: none; }

/* ── شبكة البطاقة السريعة ──
 * كل صفّ أزرار شبكةٌ تملأ عرض البطاقة بخلايا متساوية، فتتحاذى حواف
 * المجموعات كلها يمينًا ويسارًا. قبلها كان الصفّ flex يرصّ الأزرار إلى
 * أول السطر بمقاساتها الطبيعية، فينتهي كل صفٍّ عند موضع مختلف ويبقى
 * فراغٌ معلّق في طرفه — يبدو غير مرتّب مهما نُسّقت الأزرار نفسها.
 * ارتفاعٌ واحد (٣٤) ونصف قطرٍ واحد (٩) لكل زرّ: المحاذاة كانت ٢٨×٣٠
 * والبلاطات ٣٦، فاختلفت أحجامها في البطاقة الواحدة.
 */
/* ‎.card.qt‎ لا ‎.qt‎ وحدها: ‎.pane[data-pane="tools"] .tiles‎ تفرض
   ‎display:flex‎ بترجيحٍ أعلى، فتبقى الصفوف مرصوصة مهما تأخّرت القاعدة.
   والأعمدة تُسمّى صراحةً لكل مجموعة: ‎grid-auto-columns:1fr‎ على مسارات
   ضمنيّة لا توزّع الفائض في كروميوم ٨٨ (قيست: ٣ أعمدة ١٠٤ في حاوية ٣٤٣)
   فيبقى طرف الصفّ فارغًا — وهو عين ما نصلحه. */
/* ‎auto-fit‎ لا عددًا ثابتًا: العمود الضيّق كان يدفع الأزرار خارج البطاقة
   لأن ‎repeat(3,1fr)‎ تُبقي ثلاثة أعمدة مهما ضاق. الآن يقلّ عدد الأعمدة
   من نفسه وتنزل البقيّة سطرًا تحتها، والخلايا تبقى متساوية ومُحاذاة. */
.card.qt .tiles {
  display: grid; gap: 5px;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
/* ‎.qt .tiles .tile‎ لا صنفين فقط: قاعدة التبويب
   ‎.pane[data-pane="tools"] .tile‎ ترجيحها أعلى (صنف + سمة + صنف)
   فتغلب أي قاعدة بصنفين مهما تأخّرت في الملف. */
.qt .tiles .tile {
  flex: initial; width: auto; min-width: 0; min-height: 34px;
  padding: 0 8px; border-radius: 9px; justify-content: center;
}
.qt .tiles .tile > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* بالأسماء: «إضافة إلى التايم‌لاين» خمسةٌ لا تتّسع أسماؤها في سطر واحد،
   فثلاثة أعمدة تنزل بها ٣ + ٢. وبلا أسماء تعود صفًّا واحدًا. */
/* بلا أسماء يكفي الزرّ عرض أيقونته، فتتّسع الصفوف لأكثر من خمسة */
.icons-only .card.qt .tiles { grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); }

/* المحاذاة: ثلاث مجموعاتٍ في صفّ، بينها فرجةٌ أوسع وفاصلٌ خفيف يفرّق
   «حاذِ الحواف» عن «وزّع المسافات» — كانت ثمانية أزرار متلاصقة لا يُعرف
   أين ينتهي معنًى ويبدأ آخر. النِّسب ٣:٣:٢ تجعل كل الخلايا متساوية. */
/* ‎.card.qt‎ لا ‎.qt‎: ‎.pane[data-pane="tools"] .al-row‎ تفرض ‎gap:3px‎
   بترجيحٍ أعلى (صنف + سمة + صنف). بقيت ٣ بكسل، فوقع الفاصل — المرسوم
   على بُعد ٨ من حافّة المجموعة التالية — فوق آخر زرٍّ في المجموعة
   السابقة، فبدا حدًّا مزدوجًا للزرّ لا فاصلًا بين مجموعتين. */
#stepAlign .al-row {
  display: flex; flex-wrap: wrap; gap: 7px 15px; margin-top: 0;
}
#stepAlign .al-grp {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
  flex: 3 1 104px; min-width: 104px; max-width: 168px;
}
/* السقف يمنع المجموعة التي نزلت وحدها سطرًا من التمدّد على عرضه كلّه:
   زرّان بعرض نصف اللوحة يقرآن كأنهما الأمر الرئيسي. النِّسبة ٣:٢ في
   السقفين تُبقي كل الخلايا الثماني بعرضٍ واحد في كل الحالات. */
#stepAlign .al-grp.al-grp-2 {
  grid-template-columns: repeat(2, 1fr); flex: 2 1 70px;
  min-width: 70px; max-width: 112px;
}
/*
 * الفاصل عنصرٌ زائف في منتصف الفرجة لا حدٌّ بحشوة: الحشوة كانت تقتطع من
 * عرض المجموعة فتصير أزرارها أضيق من جارتها (قيست ٣٧ مقابل ٤١)، والزائف
 * خارج التخطيط فتبقى الخلايا الثماني متساوية تمامًا.
 * ويُرسم فقط مع الصنف ‎is-1row‎ الذي يضعه الجافاسكربت حين تكون المجموعات
 * الثلاث في سطر واحد فعلًا (edittools.js). استعلام الوسائط لا يصلح هنا:
 * يقيس عرض النافذة، والبطاقة تعيش في عمودٍ عرضه ٤٠٠ مهما اتّسعت الشاشة —
 * فيظهر الفاصل في أوّل سطرٍ ثانٍ معلّقًا لا يفصل شيئًا.
 */
#stepAlign .al-row.is-1row .al-grp + .al-grp::before {
  content: ''; position: absolute; inset-inline-start: -8px;
  top: 4px; bottom: 4px; width: 1px; background: rgba(255,255,255,.2);
}
#stepAlign .al-btn { width: auto; height: 34px; border-radius: 9px; }
#stepAlign .al-btn .ic { width: 17px; height: 17px; }

/* حقل المسافة و«الإطار/التحديد» في رأس القسم قبل سهم الطيّ: الحقل كان
   يحجز سطرًا كاملًا بعرض البطاقة لخانةِ رقمٍ اختيارية. */
#stepAlign .card-head .al-gap { margin-inline-start: auto; }
#stepAlign .card-head .al-to { margin-inline-start: 6px; }
#stepAlign .card-head .al-gap {
  /* ‎margin-block‎ لا ‎margin‎: الاختصار يمسح ‎auto‎ التي تدفع الضبطيات
     إلى طرف الرأس، فتطفو في وسط السطر. */
  flex: 0 0 auto; width: 78px; height: 24px; margin-block: 0;
}
#stepAlign .card-head .al-gap input[type=text] { font-size: 10.5px; }

/* ── أزرار بلا أسماء (إعداد «العرض») ──
 * الاسم تحت الأيقونة تكرارٌ لعنوان المجموعة فوقها، وحذفه يجمع خمسة
 * أزرار في سطر بدل سطرين. الخلايا تبقى بعرض الشبكة نفسها كي لا ينكسر
 * التحاذي بين المجموعات — التوفير في الأسطر لا في عرض الزرّ.
 * اسم كل زرّ يبقى في عنوان المرور، ولذلك لكل زرّ هنا data-i18n-title.
 */
/* ‎:not(.cp)‎ مقصودة: منتقي اللون نفسه ‎<span class="cp">‎ ابنٌ مباشر
   مثل الاسم، فإخفاء كل الأبناء كان يُخفيه — خليّةٌ فارغة لا تُضغط. */
.icons-only .qt .tiles .tile > span:not(.cp) { display: none; }
.icons-only .qt .tiles .tile { gap: 0; padding: 0; }

/* عيّنة اللون هي زرّ المنتقي (‎.cp-chip‎) لا ‎.cSwatch‎: الأخيرة بقيّةٌ
   من قبل المنتقي، وإعطاؤها حجمًا يُرجع مربّعين أسودين متجاورين.
   نُخفيها صراحةً بدل تركها بلا أبعاد.
   وبلا اسمٍ تحت الزرّ يبقى المربّع وحده، فحاشيته تُبرزه ولو كان أسود. */
.qt .tiles .tile.as-color .cp ~ .cSwatch { display: none; }
.qt .tiles .tile.as-color .cp { flex: 0 0 auto; }
.icons-only .qt .tiles .tile.as-color .cp-chip {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.34);
}

/* دخولٌ هادئ متدرّج: ارتفاع خفيف وتلاشٍ بتباطؤ — لا قفز ولا تكبير */
.ed-ui.is-active > .card { animation: edCardIn .34s cubic-bezier(.2,.7,.2,1) both; }
.ed-ui.is-active > .card:nth-child(2) { animation-delay: .04s; }
.ed-ui.is-active > .card:nth-child(3) { animation-delay: .08s; }
.ed-ui.is-active > .card:nth-child(4) { animation-delay: .12s; }
.ed-ui.is-active > .card:nth-child(5) { animation-delay: .16s; }
.ed-ui.is-active > .card:nth-child(6) { animation-delay: .20s; }
.ed-ui.is-active > .card:nth-child(7) { animation-delay: .24s; }
@keyframes edCardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ومضة نجاح بلون الهوية على الزرّ المنفَّذ */
.tile.ok-flash::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(150deg, var(--primary-light), var(--primary));
  animation: edFlash .7s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes edFlash { 0% { opacity: 0; } 25% { opacity: .45; } 100% { opacity: 0; } }

/* ── محرّر أسماء المجلدات: صفٌّ لكل نوع، ومجلداتك شرائح تُضاف وتُحذف ──
   كان حقلًا نصّيًا بفواصل وزرَّ حفظ بلا صنف لون (فخرج أبيض النظام). الآن
   الحفظ تلقائيّ عند التغيير، ويبقى زرّ هادئ واحد للعودة للافتراضي. */
.binsCfg { overflow: hidden; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.binsCfg .bRow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.binsCfg .bRow > .ic { width: 14px; height: 14px; flex: 0 0 auto; color: var(--primary-light); opacity: .85; }
.binsCfg .bRow > span { flex: 0 0 58px; font-size: 11px; color: var(--dim); }
.binsCfg input[type=text] {
  flex: 1 1 auto; min-width: 0; background: var(--bg-soft); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 5px 9px; color: var(--text); font: 11.5px var(--font-ar);
  transition: border-color .15s, background .15s;
}
.binsCfg input[type=text]:focus { outline: 0; border-color: var(--primary); background: var(--panel-2); }
.binsCfg .bSep { display: flex; align-items: center; gap: 8px; margin: 12px 0 7px; font-size: 11px; color: var(--faint); }
.binsCfg .bSep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.binsChips { display: flex; flex-wrap: wrap; gap: 6px; }
.binsChips:empty::after { content: attr(data-empty); font-size: 11px; color: var(--faint); opacity: .7; }
.binChip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 6px 4px 11px;
  border-radius: 20px; background: var(--primary-tint); border: 1px solid rgba(91,184,232,.3);
  color: var(--primary-soft); font-size: 11px; animation: binChipIn .22s cubic-bezier(.2,.7,.2,1) both;
}
.binChip button {
  width: 16px; height: 16px; flex: 0 0 auto; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.07); color: inherit; font-size: 11px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; transition: .14s;
}
.binChip button:hover { background: var(--danger); color: #fff; }
@keyframes binChipIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.binAdd { display: flex; gap: 6px; margin-top: 8px; }
.binsCfg .bFoot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.binsCfg .btn.mini { margin: 0; }
.binSaved { margin-inline-end: auto; font-size: 10.5px; color: var(--go); opacity: 0; transition: opacity .25s; }
.binSaved.on { opacity: 1; }

/* المحرّر يحتاج عرضًا: البطاقة تتمدّد عمودين ما دام مفتوحًا */
#stepOrganize.cfg-open { column-span: all; }


/* ── شكل الترجمة ─────────────────────────────────────── */

/* المعرض: عنوان تصنيف ثم شبكة مربّعات متحرّكة */
.cap-tiles { display: block; }
.cap-cat {
  margin: 12px 0 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--primary-light); text-transform: none;
}
.cap-cat:first-child { margin-top: 0; }
/* الشبكة تتكيّف مع عرض اللوحة: عمودان في الضيّقة وأكثر في الواسعة */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }

.cap-tile {
  display: block; width: 100%; padding: 0; cursor: pointer; overflow: hidden;
  background: #000; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s, transform .12s;
}
.cap-tile canvas { display: block; width: 100%; height: auto; }
.cap-tile b {
  display: block; padding: 5px 4px 6px; font-size: 11.5px; font-weight: 600;
  color: var(--dim); background: var(--panel-2);
}
.cap-tile:hover { border-color: rgba(91,184,232,.4); }
.cap-tile.is-active { border-color: var(--primary-light); }
.cap-tile.is-active b { color: var(--text); background: var(--primary-tint); }

/* المعاينة على خلفية تشبه لقطة فيديو، فتُقرأ الحدود والظل على الحقيقة */
.cap-prev {
  margin-top: 10px; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--line-2);
  background: linear-gradient(160deg, #4a4a52 0%, #2b2b33 45%, #55474a 100%);
}
.cap-prev canvas { display: block; width: 100%; height: auto; }

.cap-more, .cap-tune .link {
  display: block; padding: 4px 8px; background: none; border: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--primary-light);
}
.cap-more { margin: 9px auto 0; }
.cap-more:hover, .cap-tune .link:hover { color: var(--primary-soft); text-decoration: underline; }
.cap-tune { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.cap-tune .seg-row { margin-bottom: 12px; }

.cap-colors { display: flex; gap: 8px; margin: 4px 0 12px; }
.cap-col {
  flex: 1 1 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; font-size: 11.5px; color: var(--dim);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
}

/* اللوحة ضيّقة: صفّان فوق بعض أوضح من عمودين متزاحمين */
.cap-anim { display: block; margin-top: 12px; }
.cap-anim .seg-cell + .seg-cell { margin-top: 10px; }
.cap-anim #capAnim { width: 100%; }
.cap-anim #capAnim button { flex: 1 1 0; white-space: nowrap; }
.cap-hi-row { display: flex; align-items: center; gap: 12px; }
.cap-hi-row .check { padding: 0; }
.cap-hi-row input[type="color"] { flex: 0 0 auto; }

.cap-mode { width: 100%; margin-bottom: 8px; }
.cap-mode button { flex: 1 1 0; }
#capNativeBox .seg-row { margin-bottom: 8px; }
/* الخطّ والحجم مشتركان بين وضعَي «نصّ» و«مقطع»، فيبقيان ظاهرين فوقهما */
#capShared { margin-bottom: 10px; }
#capShared .seg-row { margin-bottom: 10px; }
#capShared .sliders.three { margin-top: 0; }

/* ── بطاقة الترجمة: اتجاه ثابت ونصّ أقلّ ───────────────── */

/* الأرقام والأسماء اللاتينية داخل سطر عربي كانت تقفز يمينًا ويسارًا:
   العزل يثبّت كل قيمة في مكانها مهما كان أول حرف فيها. */
.cap-mode button .ic { margin-inline-end: 6px; }
#stepCapStyle .ctl em,
#stepCapStyle .card-head .note { direction: ltr; unicode-bidi: isolate; }
#stepCapStyle .dd-val,
#stepCapStyle select option { unicode-bidi: plaintext; }

/* التسميات سطر واحد لا تلتفّ، والقيمة على الطرف المقابل دائمًا */
#stepCapStyle .ctl .lbl {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  white-space: nowrap;
}
#stepCapStyle .ctl .lbl > span:first-child { overflow: hidden; text-overflow: ellipsis; }
/*
 * ثلاثة مقابض تلتفّ بحسب العرض: ثلاثة ثم اثنان ثم واحد.
 * كانت `repeat(3, minmax(0,1fr))` تُبقيها ثلاثة مهما ضاقت اللوحة فتُقصّ
 * العناوين (مقيس: فيض ٢٢ بكسل عند عرض ٣٨١). و`auto-fit` تحلّ الضيق لكنها
 * تفتح مساراتٍ فارغة بعرض صفر في اللوحة العريضة فتتبدّد الفجوات بينها
 * (مقيس عند ٩٠٠: خمسة مسارات لثلاثة مقابض). فـ flex-wrap: يلتفّ بالضيق
 * ولا يخترع مساراتٍ بالسعة.
 */
#stepCapStyle .sliders.three { display: flex; flex-wrap: wrap; gap: 10px 14px; }
#stepCapStyle .sliders.three > .ctl { flex: 1 1 150px; min-width: 0; margin-bottom: 0; }
#stepCapStyle .seg-cell .lbl { display: flex; align-items: center; gap: 6px; min-width: 0; }

/* سطر «ماذا سيُضاف»: أيقونة + جملة قصيرة */
.cap-will { display: flex; align-items: center; gap: 7px; }
.cap-will .ic { flex: 0 0 auto; color: var(--primary-light); }

/* ══════════════════════════════════════════════════════════════════
 * تبويب الترجمة — التخطيط والمعاينة الراسية
 *
 * كل ما تحت هذا السطر مقصورٌ على `.pane[data-pane="sub"]` أو على أصناف
 * لا تُستعمل خارجه. السبب: `.sliders.three` و`.seg-row` و`.segmented.mini`
 * مشتركة مع تبويبَي القصّ والمنحنى، وأي تعديل عامّ عليها يغيّرهما معها.
 * ══════════════════════════════════════════════════════════════════ */

/*
 * ثلاثة مقابض في صفّ ثابت كانت تفيض عن اللوحة الضيّقة.
 * مقيس على عرض لوحة 381 (عرض المحتوى 319): كل مقبض ٩٨ بكسل بينما
 * «أقصى عرض 80%» يحتاج ١١٩ — ففاض ٢٢ بكسل وخرجت القيمة عن حدّها.
 * auto-fit ينزل إلى عمودين ثم عمود بدل أن يقصّ.
 */
.pane[data-pane="sub"] .sliders.three { gap: 10px 14px; }
.pane[data-pane="sub"] .seg-row {
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

/*
 * عنوان المقبض: النصّ يُقصّ بنقاط والقيمة لا تُقصّ أبدًا.
 * كانت القيمة (em) تنكمش تحت ضغط النصّ فتخرج خارج الحدّ.
 */
.pane[data-pane="sub"] .ctl > .lbl { min-width: 0; gap: 6px; }
.pane[data-pane="sub"] .ctl > .lbl > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pane[data-pane="sub"] .ctl > .lbl em { flex: 0 0 auto; }
.pane[data-pane="sub"] .seg-cell > .lbl { min-width: 0; }
.pane[data-pane="sub"] .seg-cell > .lbl > span:not(.ic) {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* أزرار المجموعات تُقصّ بدل أن تتمدّد خارج إطارها */
.pane[data-pane="sub"] .segmented { min-width: 0; }
.pane[data-pane="sub"] .segmented button {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-inline: 4px;
}

/* صفّ القوائم: الزرّ الصغير لا ينكمش والقائمة تأخذ الباقي */
.pane[data-pane="sub"] .model-row { display: flex; gap: 6px; min-width: 0; }
.pane[data-pane="sub"] .model-row > select,
.pane[data-pane="sub"] .model-row > .dd { flex: 1 1 auto; min-width: 0; }
.pane[data-pane="sub"] .model-row > .dl-btn { flex: 0 0 auto; }

/* صفّ الأزرار السفلي يلتفّ ولا يقصّ */
.pane[data-pane="sub"] .foot-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pane[data-pane="sub"] .foot-row .btn { flex: 1 1 auto; min-width: 0; }
.pane[data-pane="sub"] .foot-row .btn span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── المعرض الموحّد: شرائح تصفية + شبكة واحدة ──────────────────── */

.cap-gal { margin-top: 12px; }


/* مربّعات متساوية مهما اختلف طول الاسم */
.pane[data-pane="sub"] .cap-grid {
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 7px;
}
.pane[data-pane="sub"] .cap-tile b {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* علامة الاختيار: حدٌّ وحلقة، لا نصّ إضافي */
.pane[data-pane="sub"] .cap-tile.is-active {
  box-shadow: 0 0 0 1px var(--primary-light);
}

/* ── المعاينة الراسية في ذيل التبويب ───────────────────────────── */

/*
 * `main` هو وعاء التمرير، فـ sticky هنا تلتصق بأسفله: يبقى المحتوى
 * فوقها قابلًا للتمرير وحده وتبقى هي ظاهرة. وارتفاعها محكوم حتى لا
 * تبتلع اللوحة القصيرة.
 */
.pane[data-pane="sub"] .cap-dock {
  position: sticky; bottom: 0; z-index: 6; margin-top: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, .38);
}

/* المعاينة على خلفية تشبه لقطة فيديو فتُقرأ الحدود والظل على الحقيقة */
.cap-dock-prev {
  display: flex; justify-content: center; align-items: center;
  max-height: 168px; padding: 6px; background: var(--bg);
  background-image: linear-gradient(160deg, #4a4a52 0%, #2b2b33 45%, #55474a 100%);
  border-top: 1px solid var(--line);
}
/* المقاس يضبطه capFitPreview بالبكسل من نسبة السيكوينس الحقيقية */
.cap-dock-prev canvas { display: block; border-radius: 3px; }

/* لوحة قصيرة: المعاينة تنكمش بدل أن تزاحم المقابض */
@media (max-height: 720px) { .cap-dock-prev { max-height: 104px; } }
@media (max-height: 560px) { .cap-dock-prev { max-height: 76px; } }

/* ── تبويب الترجمة: ضبطٌ ظاهر في مكان واحد ─────────────────────── */

/*
 * إطار المعاينة هو الكانفس لا الحاوية.
 *
 * كان التدرّج (خلفية تشبه لقطة فيديو) على الحاوية وهي بعرض اللوحة كاملًا،
 * والكانفس شفّافٌ فوقها — فالمستطيل الذي تراه العين ليس إطار السيكوينس
 * إطلاقًا، بل صندوقٌ نسبتُه نسبةُ اللوحة. النصّ يبدو ضائعًا في مساحة
 * خاطئة. التدرّج الآن على الكانفس نفسه، وهو وحده المضبوط على نسبة
 * السيكوينس، فما تراه هو الإطار فعلًا.
 */
.cap-dock-prev { background-image: none; background: var(--bg); }
.cap-dock-prev canvas {
  background-image: linear-gradient(160deg, #4a4a52 0%, #2b2b33 45%, #55474a 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}

/* الألوان الخمسة صفٌّ واحد: أيقونة + عيّنة، والاسم في التلميح */
#stepCapStyle .cap-colors {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0;
}
#stepCapStyle .cap-col {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; padding: 5px 8px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
}
#stepCapStyle .cap-col .ic { width: 13px; height: 13px; flex: 0 0 auto; color: var(--faint); }
#stepCapStyle .cap-col:hover { border-color: var(--line-2); }
#stepCapStyle .cap-col:hover .ic { color: var(--dim); }

/* المفاتيح: شرائح قابلة للضغط بدل أربعة أسطر بجُمَل طويلة */
.cap-switches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cap-sw {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--faint); font-size: 11px; font-weight: 600; font-family: inherit;
  transition: color .14s, border-color .14s, background .14s;
}
.cap-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.cap-sw .ic { width: 12px; height: 12px; flex: 0 0 auto; }
.cap-sw:hover { color: var(--dim); border-color: var(--line-2); }
/* الصنف يضبطه الكود لا :has — غير مدعومة في كروميوم 99 الذي يشغّل CEP */
.cap-sw.is-on {
  color: var(--text); background: var(--primary-tint); border-color: var(--primary-light);
}
.cap-sw-btn { margin-inline-start: auto; }

/* المقابض أربعة الآن: أرضيةٌ أضيق تُبقيها صفّين لا أربعة */
#stepCapStyle .sliders.three > .ctl { flex: 1 1 128px; }

/* ── رصيف المعاينة: شريطٌ واحد قابل للضغط ─────────────────────── */

/*
 * الشريط كلّه زرّ، لا أيقونة صغيرة في طرفه: الهدف كبير فلا يُخطئه المؤشّر،
 * والسهم يدور بدل أن يُستبدل. الفتح والإغلاق بانتقال ارتفاعٍ محسوب لا
 * بـ display، وإلا قفز الرصيف قفزة بلا حركة.
 */
.cap-dock-bar {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0;
  padding: 8px 11px; border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: 11.5px; color: var(--faint); text-align: start;
  transition: background .16s ease;
}
.cap-dock-bar:hover { background: var(--line-2); }
.cap-dock-eye {
  display: inline-flex; flex: 0 0 auto; padding: 4px; border-radius: 7px;
  background: var(--primary-tint); color: var(--primary-light);
}
.cap-dock-eye .ic { width: 13px; height: 13px; }
.cap-dock-bar > b {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--text);
}
.cap-dock-dim {
  flex: 0 0 auto; font-size: 10.5px; color: var(--faint);
  padding: 2px 7px; border-radius: 999px; background: var(--bg);
  direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums;
}
.cap-dock-note {
  flex: 1 1 auto; min-width: 0; text-align: end;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cap-dock-arrow {
  display: inline-flex; flex: 0 0 auto; color: var(--faint);
  transition: transform .28s cubic-bezier(.2,.8,.25,1), color .16s;
}
.cap-dock-arrow .ic { width: 15px; height: 15px; }
.cap-dock-bar:hover .cap-dock-arrow { color: var(--text); }

/* الطيّ بانتقال مقاسٍ حقيقي، والمحتوى يتلاشى قبل أن يُطوى */
.cap-dock-prev {
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.2,.8,.25,1),
              padding .3s cubic-bezier(.2,.8,.25,1), opacity .2s ease;
}
.cap-dock.is-min .cap-dock-prev {
  max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; border-top-color: transparent;
}
.cap-dock.is-min .cap-dock-arrow { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .cap-dock-prev, .cap-dock-arrow { transition: none; }
}

/* ── المعرض المسطّح: مربّعات متساوية ومتنفّسة ──────────────────── */
.pane[data-pane="sub"] .cap-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px;
}
#stepCapStyle .cap-tiles { margin: 2px 0 14px; }
#stepCapStyle .cap-tile b { padding: 6px 6px 7px; font-size: 11px; }

/* فواصل خفيفة بين مجموعات الضبط بدل تكديسها */
#stepCapStyle .cap-colors { margin: 12px 0 2px; }
#stepCapStyle .sliders.three { margin-top: 12px; }
#stepCapStyle .cap-switches {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2);
}

/* إيقاع رأسي واحد داخل بطاقة الشكل بدل مسافات متفرّقة */
#stepCapStyle .seg-row { margin-top: 2px; }
#stepCapStyle .seg-cell > .lbl { margin-bottom: 2px; }
#stepCapStyle .sliders.three > .ctl { padding: 2px 0; }
#stepCapStyle .ctl .lbl { margin-bottom: 8px; }
#stepCapStyle .cap-col { padding: 6px 8px; }
/* المدخل الأصلي يخفيه منتقي الألوان خلف زرّه ويضبط مقاسه بنفسه،
   فلا نمسّه — الضبط لغير المرقّى فقط. */
#stepCapStyle input[type="color"]:not(.cp-native) { width: 26px; height: 18px; }
#stepCapStyle .card-head { margin-bottom: 10px; }

/* اللوحة الضيّقة: الأبعاد والعنوان يكفيان، والوصف في التلميح */
/* الجملة الإنجليزية أطول، فلا تظهر إلا حين يتّسع لها الشريط فعلًا */
@media (max-width: 520px) { .cap-dock-note { display: none; } }

/* ── التتبّع ──────────────────────────────────────────
   مسرح المعاينة يأخذ عرض البطاقة كاملًا وارتفاعه يتبع نسبة الإطار،
   فلا يقفز عند تبديل مقطع أفقي بعمودي. */

/*
 * تبويب المونتاج متعدّد الأعمدة (‏column-width أعلاه)، والبطاقة هنا أطول
 * من عمود فكانت تنكسر عبر عمودين: نصفها يقفز إلى عمود آخر فيبدو التبويب
 * مبعثرًا ويظهر تمرير أفقي. البطاقة تمتدّ بعرض اللوحة كلّها فلا تنكسر.
 */
/* (عولج أعلاه لكل أسطر الملاحظات، لا لبطاقة واحدة) */

.tk-stage {
  position: relative; margin: 10px 0 2px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #000; overflow: hidden; min-height: 92px;
  display: flex; justify-content: center;
}
/* مقاس الكانفس يُضبط بالجافاسكربت (محدود الارتفاع) لا بـ100٪:
   لقطة عمودية 4K كانت تعطي معاينة بطول ٦٧٧ بكسل تبتلع اللوحة */
.tk-stage canvas { display: block; cursor: crosshair; max-width: 100%; }
.tk-hint {
  position: absolute; inset-inline: 8px; bottom: 8px; text-align: center;
  font-size: 11px; color: var(--dim); pointer-events: none;
  background: rgba(8,8,11,.66); border-radius: 5px; padding: 4px 6px;
}
.tk-stage canvas:focus { outline: none; }
.tk-stage canvas.is-pan { cursor: grab; }
.tk-stage canvas.is-panning { cursor: grabbing; }
.tk-stage canvas.is-move { cursor: move; }
.tk-stage canvas.is-nw, .tk-stage canvas.is-se { cursor: nwse-resize; }
.tk-stage canvas.is-ne, .tk-stage canvas.is-sw { cursor: nesw-resize; }

/* أدوات التكبير: فوق الصورة لا تحتها، كي لا تسرق سطرًا من البطاقة */
.tk-zoom {
  position: absolute; top: 6px; inset-inline-start: 6px;
  display: flex; align-items: center; gap: 3px;
  background: rgba(8,8,11,.72); border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px; padding: 3px; opacity: .5; transition: opacity .18s ease;
}
.tk-stage:hover .tk-zoom, .tk-zoom.is-on { opacity: 1; }
.tk-zbtn {
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--dim); border-radius: 5px; cursor: pointer;
}
.tk-zbtn:hover { background: rgba(255,255,255,.1); color: #fff; }
.tk-zbtn .ic { width: 14px; height: 14px; }
.tk-zval { font-size: 10px; color: var(--faint); padding: 0 4px; min-width: 34px; text-align: center; }

/* صفّ المدى: كلمات صريحة بدل مفتاح صامت، والمدة تظهر رقمًا */
.tk-range { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tk-range .tk-lbl { font-size: 11px; color: var(--faint); }
/*
 * منتقي المدى: اختيارٌ ثانويّ، فلا يأخذ اللون الأزرق. الأزرق محجوز
 * لنداءَي العمل وحدهما («ابدأ التتبّع» و«طبّق») ولتحديد الوضع، وإلا
 * ضاعت أهميتهما بين ثلاثة أزرق متساوية.
 */
.tk-pick {
  position: relative; display: inline-flex; gap: 2px; padding: 2px;
  background: rgba(255,255,255,.035); border: 1px solid var(--line-2); border-radius: 9px;
  flex: 1 1 auto;
}
.tk-pick > .pk {
  position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; opacity: 0;
  border-radius: 7px; background: rgba(255,255,255,.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  transition: transform .3s cubic-bezier(.2,.8,.3,1), width .3s cubic-bezier(.2,.8,.3,1),
              opacity .2s ease;
  pointer-events: none;
}
.tk-pick button {
  position: relative; z-index: 1; flex: 1 1 auto; border: 0; background: none; cursor: pointer;
  color: var(--faint); font-size: 11px; font-weight: 600; padding: 5px 9px; border-radius: 7px;
  transition: color .24s ease;
}
.tk-pick button:hover { color: var(--dim); }
.tk-pick button.is-active { color: var(--text); }
.tk-pick button:disabled { opacity: .45; cursor: default; }
@media (prefers-reduced-motion: reduce) { .tk-pick > .pk { transition: opacity .2s; } }
.tk-dur { font-size: 10.5px; color: var(--faint); font-style: normal; }

.tk-run { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.tk-run .btn { flex: 0 0 auto; }
/* المفتاحان يلتفّان معًا لا فرادى: أحدهما تحت الآخر يبدو سهوًا */
.tk-chips { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }

/* التقدّم: شريط + مرحلة + نسبة. يختفي تمامًا وهو ساكن */
.tk-prog { margin-top: 9px; animation: tkFade .2s ease both; }
.tk-bar { margin-top: 0; }
.tk-bar i { transition: width .16s cubic-bezier(.3,.8,.4,1); }
.tk-prog-row { display: flex; align-items: baseline; gap: 8px; margin-top: 5px; }
.tk-stage-lbl { font-size: 10.5px; color: var(--faint); flex: 1 1 auto; }
.tk-pct { font-size: 11.5px; color: var(--primary-soft); font-variant-numeric: tabular-nums; }
@keyframes tkFade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* شريط الثقة: إطارٌ إطارًا بلونه، وهو نفسه المؤشّر للمراجعة */
.tk-review { margin: 9px 0 2px; animation: tkFade .22s ease both; }
.tk-strip-row { border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: #0b0d11; }
#tkStrip { display: block; width: 100%; height: 34px; cursor: ew-resize; }
.tk-strip-legend {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 5px; font-size: 10px; color: var(--faint);
}
.tk-keys { display: flex; align-items: center; gap: 5px; }
.tk-keys .k { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tk-keys .k.good { background: #5BB8E8; }
.tk-keys .k.mid { background: #e0a45c; }
.tk-keys .k.bad { background: #e05c5c; }

.tk-opts { margin-top: 8px; animation: tkFade .18s ease both; }
.tk-opts:empty { margin: 0; }
.tk-opts .sliders { margin-top: 8px; }
#stepTrack .segmented { margin-top: 10px; }
#stepTrack .sel-row { margin-top: 2px; }

/* التلميحات: بعضها سطران (مثل «الاختصار المربوط في بريمير»)، فلا تُدمج */
.tipBox { white-space: pre-line; }

/* ── تنزيل من رابط ────────────────────────────────────── */

.gb-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.gb-row input[type=text] {
  flex: 1 1 auto; min-width: 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); padding: 8px 10px;
  font: 11.5px/1.5 var(--font-ar); outline: none; direction: ltr; text-align: left;
}
.gb-row input[type=text]:focus { border-color: rgba(91,184,232,.45); }
.gb-run { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.gb-run select, .gb-run .dd { flex: 0 0 auto; min-width: 118px; }
.gb-run .btn { flex: 0 0 auto; }
#gbEngine { word-break: break-all; }
#gbEngine .btn.mini { margin-inline-start: 6px; }

/* ── قوالب الموشن جرافكس في بطاقة «شكل الترجمة» ──────────────────
   البطاقة تعرض صورة القالب، وفيديو معاينته يُركَّب فوقها عند المرور
   وحده (js/mgtiles.js): تشغيلها كلّها معًا يأكل إطارات اللوحة. */

.cap-mode {
  display: flex; gap: 6px; margin: 0 0 10px;
  background: var(--bg-2, #15181d); border-radius: 10px; padding: 4px;
}
.cap-mode-b {
  flex: 1; border: 0; border-radius: 7px; padding: 8px 10px;
  background: transparent; color: var(--fg-2, #9aa3ad);
  font: inherit; font-size: 12.5px; cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.cap-mode-b:hover { color: var(--fg-1, #e7ecf2); }
.cap-mode-b.is-active {
  background: var(--bg-3, #222731); color: var(--fg-1, #e7ecf2);
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
}

.mg-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px; margin-bottom: 12px;
}
.mg-tile {
  border: 1px solid var(--line, #262b33); border-radius: 10px;
  background: var(--bg-2, #15181d); padding: 0; overflow: hidden;
  cursor: pointer; text-align: center;
  transition: border-color .16s ease;
}
.mg-tile:hover { border-color: var(--acc, #4aa3ff); }
.mg-tile.is-active { border-color: var(--acc, #4aa3ff); box-shadow: 0 0 0 1px var(--acc, #4aa3ff) inset; }
.mg-thumb {
  display: block; position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #000; overflow: hidden;
}
.mg-thumb img, .mg-thumb video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.mg-thumb video { z-index: 1; }
.mg-tile > b {
  display: block; padding: 6px 8px; font-size: 11.5px; font-weight: 500;
  color: var(--fg-2, #9aa3ad); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.mg-tile.is-active > b { color: var(--fg-1, #e7ecf2); }

.mg-empty { color: var(--fg-3, #6b727c); font-size: 12px; padding: 14px 4px; text-align: center; }
.mg-note  { color: var(--fg-3, #6b727c); font-size: 11.5px; margin: 0 0 10px; line-height: 1.6; }

.mg-tune { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.mg-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--fg-2, #9aa3ad);
}
.mg-row .mg-lbl {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mg-row input[type="range"] { flex: 1.2; min-width: 90px; }
/* الحقل الأصلي يبقى مخفيًّا بعد الترقية: قاعدةٌ بأسبقيّةٍ أعلى هنا كانت
   تغلب `input.cp-native` فيظهر الحقل ويفتح منتقي المتصفّح فوق اللوحة
   (مرصود). فالمقاس لمن لم يُرقَّ بعدُ وحده. */
.mg-row input[type="color"]:not(.cp-native) {
  width: 34px; height: 22px; border: 1px solid var(--line, #262b33);
  border-radius: 5px; background: none; padding: 0; cursor: pointer;
}
.mg-row select { min-width: 110px; }
.mg-val {
  min-width: 34px; text-align: left; font-style: normal;
  font-variant-numeric: tabular-nums; color: var(--fg-3, #6b727c);
}
.mg-row.mg-live {
  margin: 2px 0 8px; padding: 7px 9px;
  background: var(--bg-2, #15181d); border-radius: 8px;
  color: var(--fg-1, #e7ecf2);
}
/* منتقي اللوحة يلفّ الحقل بـ .cp، فالصفّ يوازن عرضه كما يوازن الحقول */
.mg-row .cp { flex: 0 0 auto; }

/* شريط المعاينة: إطاراتٌ حقيقية من بريمير تُعرض تتابعًا */
.mg-pv {
  margin: 0 0 10px; padding: 8px;
  background: var(--bg-2, #15181d); border-radius: 10px;
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
}
.mg-pv img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain;
  background: #000; border-radius: 6px;
}
.mg-pv .mg-note { margin: 0; text-align: center; }
.mg-pv .btn { align-self: center; }
/* معاينة القوالب تشغل مكان القماشة نفسه في الرصيف */
.cap-dock-prev img#capPrevImg {
  display: block; width: 100%; height: auto; border-radius: 6px; background: #000;
}
.cap-dock-eye:hover { opacity: .75; }


.mg-find {
  display: flex; align-items: center; gap: 7px; margin: 0 0 8px;
  padding: 6px 9px; background: var(--bg-2, #15181d);
  border: 1px solid var(--line, #262b33); border-radius: 8px;
}
.mg-find .ic { width: 13px; height: 13px; opacity: .55; flex: 0 0 auto; }
.mg-find input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  color: var(--fg-1, #e7ecf2); font: inherit; font-size: 12px;
}
.mg-count {
  flex: 0 0 auto; font-size: 11px; color: var(--fg-3, #6b727c);
  font-variant-numeric: tabular-nums;
}
.mg-hidden-row { align-items: center; gap: 8px; }
.mg-hidden-row .mg-note { margin: 0; }

/* زرّ إخفاء البطاقة: لا يظهر إلا بمرور الماوس فلا يزاحم الصورة */
.mg-tile { position: relative; }
.mg-x {
  position: absolute; top: 4px; inset-inline-end: 4px; z-index: 2;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border-radius: 50%; background: rgba(0,0,0,.66); color: #fff;
  font-size: 15px; opacity: 0; transition: opacity .14s ease, background .14s ease;
}
.mg-tile:hover .mg-x { opacity: 1; }
.mg-x:hover { background: #c0392b; }
/* إطارات معاينةٍ صنعناها نحن، تُقلَّب فوق الصورة الساكنة */
.mg-thumb img.mg-fr { z-index: 1; }
/* دعوةٌ لصنع معاينةٍ للقالب الذي لا يحمل واحدة */
.mg-make {
  position: absolute; inset-inline-start: 4px; bottom: 4px; z-index: 2;
  padding: 3px 7px; border-radius: 6px;
  background: rgba(0,0,0,.7); color: #dfe6ee; font-size: 10.5px;
  opacity: 0; transition: opacity .14s ease, background .14s ease;
}
.mg-tile:hover .mg-make { opacity: 1; }
.mg-make:hover { background: var(--acc, #4aa3ff); color: #06121f; }

/* ── رأس الاختيار: القالب المختار والمعرض خلفه مطويّ ────────────── */
.mg-chosen {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 0 0 10px; padding: 8px 10px; text-align: start;
  background: var(--bg-2, #15181d); border: 1px solid var(--line, #262b33);
  border-radius: 10px; cursor: pointer;
  transition: border-color .16s ease;
}
.mg-chosen:hover { border-color: var(--acc, #4aa3ff); }
.mg-chosen-thumb {
  flex: 0 0 auto; width: 64px; aspect-ratio: 16 / 9; border-radius: 6px;
  background: #000; overflow: hidden;
}
.mg-chosen-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-chosen-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mg-chosen-txt b {
  font-size: 12.5px; font-weight: 600; color: var(--fg-1, #e7ecf2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mg-chosen-txt em {
  font-style: normal; font-size: 11px; color: var(--fg-3, #6b727c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mg-chosen-act {
  flex: 0 0 auto; padding: 4px 10px; border-radius: 6px;
  background: var(--bg-3, #222731); color: var(--fg-2, #9aa3ad); font-size: 11.5px;
}
.mg-chosen:hover .mg-chosen-act { background: var(--acc, #4aa3ff); color: #06121f; }

/* البحث بارزٌ: هو مدخل المعرض الحقيقي حين تكون البطاقات بالمئات */
.mg-find {
  padding: 9px 12px; border-width: 2px;
  border-color: var(--acc, #4aa3ff);
  background: var(--bg-1, #0f1216);
}
.mg-find .ic { width: 15px; height: 15px; opacity: .9; }
.mg-find input { font-size: 13px; }
.mg-find input::placeholder { color: var(--fg-3, #6b727c); }

/* المعرض محدود الارتفاع: ثلاثة صفوف تُرى، والبقية بسكرولٍ داخله —
   فلا تصير اللوحة نفسها سكرولًا لا ينتهي. */
.mg-grid {
  max-height: 340px; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px; border-radius: 8px;
}

/* رقمٌ يُسحب ويُنقر فيُكتب — كما في Effect Controls */
.mg-val.mg-drag {
  cursor: ew-resize; padding: 1px 5px; border-radius: 4px;
  border: 1px solid transparent; user-select: none;
  transition: background .12s ease, border-color .12s ease;
}
.mg-val.mg-drag:hover { background: var(--bg-3, #222731); border-color: var(--line, #262b33); }
.mg-val.mg-drag.is-edit {
  cursor: text; user-select: text; background: var(--bg-1, #0f1216);
  border-color: var(--acc, #4aa3ff); color: var(--fg-1, #e7ecf2); outline: none;
}
/* المفتاح في صفوف القوالب يأخذ مكانه في الطرف */
.mg-row .sw { margin-inline-start: auto; }

/* القائمة المنسدلة داخل صفّ ضبطٍ: `.dd` عرضها ١٠٠٪ في الأصل لأنها
   تُستعمل في حقولٍ تملأ سطرها، فكانت تبتلع الصفّ وتطرد اسم الضابط —
   فتظهر قائمةٌ بلا اسم ولا يعرف المستخدم ما هي (مرصود على «BG style»). */
.mg-row .dd { width: auto; flex: 0 1 auto; min-width: 118px; max-width: 58%; }
.mg-row .mg-lbl { flex: 1 1 40%; }


/* معاينة القوالب: مطفأة حتى تُشغَّل، وزرّ تشغيل/إيقاف فوق الإطار */
.cap-dock-prev { position: relative; min-height: 96px; }
.cap-dock-prev img { max-width: 100%; max-height: 156px; border-radius: 3px; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.mg-pv-idle { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 14px; text-align: center; }
.mg-pv-idle[hidden] { display: none !important; }
.mg-pv-idle p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--dim, #9aa); max-width: 320px; }
.mg-pv-toggle {
  position: absolute; inset-inline-end: 12px; bottom: 12px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(10, 12, 18, .78); color: #fff; font-size: 13px; cursor: pointer;
}
.mg-pv-toggle[hidden] { display: none !important; }

/* ── لوح ضبط القالب: تنظيم وحركة هادئة (عند التمرير فقط، لا حركة تلقائية) ── */
.mg-tune { gap: 4px; margin-top: 4px; }
.mg-h {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 4px; padding: 0 2px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--fg-1, #e7ecf2);
}
.mg-h::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--acc, #4aa3ff); }
.mg-h::after { content: ""; flex: 1; height: 1px; background: var(--line, #262b33); }

.mg-row {
  min-height: 30px; padding: 2px 8px; border-radius: 9px;
  transition: background-color .18s cubic-bezier(.2, .8, .2, 1);
}
.mg-row:hover { background: var(--bg-2, #15181d); }
.mg-row .mg-lbl { flex: 0 0 38%; color: var(--fg-2, #9aa3ad); transition: color .18s cubic-bezier(.2, .8, .2, 1); }
.mg-row:hover .mg-lbl { color: var(--fg-1, #e7ecf2); }
.mg-row.mg-live { flex: none; }
.mg-row.mg-live .mg-lbl { flex: 1; }
.mg-val {
  min-width: 52px; padding: 2px 7px; border-radius: 999px; text-align: center;
  background: var(--bg-2, #15181d); border: 1px solid transparent;
  color: var(--fg-1, #e7ecf2); font-size: 11.5px;
  transition: background-color .18s cubic-bezier(.2, .8, .2, 1), border-color .18s cubic-bezier(.2, .8, .2, 1);
}
.mg-row:hover .mg-val { background: var(--bg-3, #222731); border-color: var(--line, #262b33); }

/* كتلة الخط: بطاقة واحدة متناسقة مع بقية الضوابط */
.mg-font {
  display: flex; flex-direction: column; gap: 10px;
  margin: 12px 0 4px; padding: 12px; border-radius: 12px;
  background: var(--bg-2, #15181d); border: 1px solid var(--line, #262b33);
}
.mg-font > .lbl { font-size: 11.5px; font-weight: 700; color: var(--fg-1, #e7ecf2); }
.mg-font .model-row { margin: 0; }
.mg-font .segmented { margin: 0; }
.mg-font .segmented button { transition: background-color .18s cubic-bezier(.2, .8, .2, 1), color .18s cubic-bezier(.2, .8, .2, 1); }
.mg-font .ctl { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.mg-font .ctl .lbl { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--fg-2, #9aa3ad); }
.mg-font .ctl .lbl em { font-style: normal; padding: 2px 8px; border-radius: 999px; background: var(--bg-3, #222731); color: var(--fg-1, #e7ecf2); font-variant-numeric: tabular-nums; }

/* بطاقة القالب المختار والبطاقات: رفعةٌ خفيفة عند التمرير */
.mg-chosen, .mg-tile { transition: border-color .18s cubic-bezier(.2, .8, .2, 1), transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s cubic-bezier(.2, .8, .2, 1); }
.mg-chosen:hover, .mg-tile:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .28); }
.mg-note { margin: 8px 2px 4px; }

/* ── منتقي الخط: أيقونة Aa، الاسم بخطّه، سهمٌ يدور، وقائمةٌ تنفتح بانسياب ── */
.mg-font { gap: 12px; margin: 14px 0 6px; }
.fp { position: relative; }
.fp-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; direction: rtl; text-align: right;
  padding: 10px 12px; border-radius: 11px; cursor: pointer;
  background: var(--bg-1, #0d0f13); border: 1px solid var(--line, #262b33); color: var(--fg-1, #e7ecf2);
  transition: border-color .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s cubic-bezier(.2, .8, .2, 1), background-color .2s cubic-bezier(.2, .8, .2, 1);
}
.fp-btn:hover { border-color: var(--acc, #4aa3ff); background: var(--bg-2, #15181d); }
.fp.is-open .fp-btn { border-color: var(--acc, #4aa3ff); box-shadow: 0 0 0 3px rgba(74, 163, 255, .16); }
.fp-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  font: 700 15px/1 system-ui, -apple-system, sans-serif; letter-spacing: -.02em; direction: ltr;
  color: var(--acc, #4aa3ff); background: rgba(74, 163, 255, .12); border: 1px solid rgba(74, 163, 255, .28);
}
.fp-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fp-txt em { font-style: normal; font-size: 10.5px; color: var(--fg-3, #6b727c); }
.fp-txt b { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; direction: auto; }
.fp-chev { flex: 0 0 auto; display: grid; place-items: center; color: var(--fg-2, #9aa3ad); transition: transform .28s cubic-bezier(.2, .8, .2, 1), color .2s; }
.fp-chev .ic { width: 16px; height: 16px; }
.fp.is-open .fp-chev { transform: rotate(180deg); color: var(--acc, #4aa3ff); }

.fp-pop {
  max-height: 0; opacity: 0; overflow: hidden; visibility: hidden;
  transform: translateY(-6px);
  transition: max-height .32s cubic-bezier(.2, .8, .2, 1), opacity .22s cubic-bezier(.2, .8, .2, 1), transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s;
}
.fp.is-open .fp-pop {
  max-height: 330px; opacity: 1; visibility: visible; transform: none;
  transition: max-height .32s cubic-bezier(.2, .8, .2, 1), opacity .22s cubic-bezier(.2, .8, .2, 1), transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
.fp-in { margin-top: 8px; border-radius: 11px; overflow: hidden; background: var(--bg-1, #0d0f13); border: 1px solid var(--line, #262b33); }
.fp-q {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line, #262b33);
  background: transparent; color: var(--fg-1, #e7ecf2); font-size: 13px; direction: rtl; outline: none;
}
.fp-list { max-height: 262px; overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
.fp-list::-webkit-scrollbar { width: 8px; }
.fp-list::-webkit-scrollbar-thumb { background: rgba(91, 184, 232, .28); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.fp-grp { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 700; color: var(--fg-3, #6b727c); }
.fp-opt {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; direction: rtl;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  color: var(--fg-2, #9aa3ad); font-size: 15px; text-align: right;
  transition: background-color .14s cubic-bezier(.2, .8, .2, 1), color .14s cubic-bezier(.2, .8, .2, 1), transform .14s cubic-bezier(.2, .8, .2, 1);
}
.fp-opt[hidden] { display: none; }
.fp-opt:hover { background: rgba(74, 163, 255, .12); color: var(--fg-1, #e7ecf2); transform: translateX(-2px); }
.fp-opt.is-sel { color: var(--acc, #4aa3ff); background: rgba(74, 163, 255, .10); }
.fp-ck { font-style: normal; opacity: 0; font-size: 13px; }
.fp-opt.is-sel .fp-ck { opacity: 1; }

/* ── معرض القوالب: فتحٌ وإغلاقٌ بانسياب، بحثٌ أنيق (الحركة تبدأ بنقرة المستخدم فقط) ── */
.mg-browse {
  max-height: 0; opacity: 0; visibility: hidden; overflow: hidden; transform: translateY(-10px);
  transition: max-height .42s cubic-bezier(.2, .8, .2, 1), opacity .24s cubic-bezier(.2, .8, .2, 1),
              transform .42s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .42s;
}
.mg-browse.is-open {
  max-height: 780px; opacity: 1; visibility: visible; transform: none;
  transition: max-height .42s cubic-bezier(.2, .8, .2, 1), opacity .3s cubic-bezier(.2, .8, .2, 1) .05s,
              transform .42s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
.mg-browse-in { padding: 6px 0 10px; }
@keyframes mgTileIn { from { opacity: 0; transform: translateY(12px) scale(.965); } to { opacity: 1; transform: none; } }
.mg-browse.is-open .mg-tile { animation: mgTileIn .44s cubic-bezier(.2, .8, .2, 1) backwards; }
.mg-browse.is-open .mg-tile:nth-child(1) { animation-delay: .06s; }
.mg-browse.is-open .mg-tile:nth-child(2) { animation-delay: .09s; }
.mg-browse.is-open .mg-tile:nth-child(3) { animation-delay: .12s; }
.mg-browse.is-open .mg-tile:nth-child(4) { animation-delay: .15s; }
.mg-browse.is-open .mg-tile:nth-child(5) { animation-delay: .18s; }
.mg-browse.is-open .mg-tile:nth-child(6) { animation-delay: .21s; }
.mg-browse.is-open .mg-tile:nth-child(n+7) { animation-delay: .24s; }

/* سهم البطاقة المختارة: ينقلب مع الفتح */
.mg-chosen-act { display: inline-flex; align-items: center; }
.mg-chosen-act::after {
  content: ""; width: 6px; height: 6px; margin-inline-start: 8px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.mg-chosen.is-open .mg-chosen-act::after { transform: rotate(-135deg) translateY(-2px); }
.mg-chosen.is-open { border-color: var(--acc, #4aa3ff); }

/* شريط البحث */
.mg-find {
  gap: 10px; margin: 2px 0 12px; padding: 0 12px; min-height: 44px; border-width: 1px;
  border-color: var(--line, #262b33); border-radius: 12px; background: var(--bg-1, #0d0f13);
  transition: border-color .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s cubic-bezier(.2, .8, .2, 1), background-color .2s cubic-bezier(.2, .8, .2, 1);
}
.mg-find:hover { border-color: rgba(74, 163, 255, .45); }
.mg-find:focus-within { border-color: var(--acc, #4aa3ff); background: var(--bg-2, #15181d); box-shadow: 0 0 0 3px rgba(74, 163, 255, .16); }
.mg-find .ic { width: 16px; height: 16px; opacity: .55; color: var(--fg-2, #9aa3ad); transition: opacity .2s, color .2s; }
.mg-find:focus-within .ic { opacity: 1; color: var(--acc, #4aa3ff); }
.mg-find input { font-size: 14px; padding: 11px 0; }
.mg-clear {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  display: grid; place-items: center; font-size: 15px; line-height: 1;
  color: var(--fg-2, #9aa3ad); background: var(--bg-3, #222731);
  transition: background-color .16s cubic-bezier(.2, .8, .2, 1), color .16s cubic-bezier(.2, .8, .2, 1), transform .16s cubic-bezier(.2, .8, .2, 1);
}
.mg-clear[hidden] { display: none; }
.mg-clear:hover { background: var(--acc, #4aa3ff); color: #06121f; transform: scale(1.08); }
.mg-count {
  padding: 3px 9px; border-radius: 999px; background: var(--bg-3, #222731);
  color: var(--fg-2, #9aa3ad); font-size: 11px; white-space: nowrap;
}
.mg-find input[type="text"], .mg-find input[type="text"]:focus {
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  outline: none !important; border-radius: 0; height: auto; min-height: 0;
}

/* قوائم ضوابط القالب: اتجاه عربي وسهمٌ واضح بدل الرمز المائل */
#capMgBox .dd-btn {
  position: relative; text-align: right; direction: rtl; padding-inline: 12px 32px;
  background-image: none; border-radius: 10px;
  transition: border-color .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s cubic-bezier(.2, .8, .2, 1);
}
#capMgBox .dd-btn::after {
  content: ""; position: absolute; inset-inline-end: auto; inset-inline-start: 12px; top: 50%;
  width: 6px; height: 6px; margin-top: -5px; border: solid var(--fg-2, #9aa3ad); border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .28s cubic-bezier(.2, .8, .2, 1), border-color .2s;
}
#capMgBox .dd-btn.is-open::after { transform: rotate(-135deg); margin-top: -1px; border-color: var(--acc, #4aa3ff); }
#capMgBox .dd-val { text-align: right; }
#capMgBox .mg-row .dd { min-width: 156px; }
#capMgBox .dd-btn { padding-inline-start: 30px; }

/* أقسام الضبط القابلة للطيّ */
.mg-acc {
  width: 100%; margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--line, #262b33); border-radius: 11px; cursor: pointer;
  background: var(--bg-2, #15181d); color: var(--fg-1, #e7ecf2); text-align: right; font: inherit; font-size: 13px;
  justify-content: space-between; direction: rtl;
  transition: border-color .2s cubic-bezier(.2, .8, .2, 1), background-color .2s cubic-bezier(.2, .8, .2, 1);
}
.mg-acc::before, .mg-acc::after { display: none; }
.mg-acc:hover { border-color: rgba(74, 163, 255, .5); }
.mg-grp.is-open > .mg-acc { border-color: var(--acc, #4aa3ff); background: rgba(74, 163, 255, .08); }
.mg-acc-chev {
  width: 7px; height: 7px; border: solid var(--fg-2, #9aa3ad); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), border-color .2s;
}
.mg-grp.is-open > .mg-acc .mg-acc-chev { transform: rotate(-135deg) translateY(-2px); border-color: var(--acc, #4aa3ff); }
.mg-body { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .38s cubic-bezier(.2, .8, .2, 1), opacity .24s cubic-bezier(.2, .8, .2, 1); }
.mg-grp.is-open > .mg-body { max-height: 1600px; opacity: 1; overflow: visible; transition: max-height .42s cubic-bezier(.2, .8, .2, 1), opacity .3s cubic-bezier(.2, .8, .2, 1) .04s; }
.mg-body-in { padding: 6px 2px 8px; display: flex; flex-direction: column; gap: 4px; }

/* لا يعدّل المتصفح السكرول تلقائيًا أثناء طيّ الأقسام: نثبّت العنوان بأنفسنا */
.mg-tune, .mg-tune * { overflow-anchor: none; }

/* مربّعات الألوان معًا */
.mg-sw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin: 2px 0 8px; }
.mg-sw {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 6px 9px; border-radius: 11px;
  background: var(--bg-2, #15181d); border: 1px solid var(--line, #262b33);
  transition: border-color .2s cubic-bezier(.2, .8, .2, 1), transform .2s cubic-bezier(.2, .8, .2, 1);
}
.mg-sw:hover { border-color: rgba(74, 163, 255, .55); transform: translateY(-1px); }
.mg-sw-l { font-size: 11px; color: var(--fg-2, #9aa3ad); text-align: center; line-height: 1.35; }
.mg-sw .cp { display: block; }
.mg-sw .cp-btn { width: 44px; height: 30px; border-radius: 8px; }
.mg-sw .cp-chip { border-radius: 6px; }
/* اتجاه التدرّج: أزرار */
.mg-seg-row { flex-direction: column; align-items: stretch; gap: 8px; padding-block: 6px; }
.mg-seg-row .mg-lbl { flex: none; }
.mg-seg { width: 100%; }
.mg-seg button { flex: 1; transition: background-color .18s cubic-bezier(.2, .8, .2, 1), color .18s cubic-bezier(.2, .8, .2, 1); }

/* شريط الأوامر: ثابت أسفل بطاقة الترجمة ليبقى في متناولك وأنت تعدّل */
.cap-actions {
  position: sticky; bottom: -14px; z-index: 9; display: flex; gap: 8px; align-items: stretch; direction: rtl;
  margin: 14px -6px -6px; padding: 14px 6px 12px;
  background: linear-gradient(to top, rgb(20, 20, 28) 66%, rgba(20, 20, 28, 0));
}
.cap-actions .btn { height: 40px; margin: 0; padding: 0 14px; border-radius: 10px; gap: 8px; white-space: nowrap; justify-content: center; font-size: 13px; font-weight: 600; box-shadow: none; }
.cap-actions .ic { width: 17px; height: 17px; stroke-width: 1.8; }
.cap-primary {
  flex: 1 1 auto; min-width: 0; border: 0; color: #08131f; background: var(--acc, #4aa3ff);
  transition: background-color .2s cubic-bezier(.2, .8, .2, 1), transform .15s cubic-bezier(.2, .8, .2, 1);
}
.cap-primary:not(:disabled):hover { background: #6bb6ff; }
.cap-primary:not(:disabled):active { transform: translateY(1px); }
.cap-primary:disabled { opacity: .45; }
.cap-primary.is-apply { background: #3fcf8e; }
.cap-primary.is-apply:not(:disabled):hover { background: #5bdca4; }
.cap-ghost {
  flex: 0 0 auto; background: transparent; color: var(--fg-2, #9aa3ad); border: 1px solid var(--line, #262b33);
  transition: border-color .2s cubic-bezier(.2, .8, .2, 1), color .2s cubic-bezier(.2, .8, .2, 1), background-color .2s cubic-bezier(.2, .8, .2, 1);
}
.cap-ghost:not(:disabled):hover { color: var(--fg-1, #e7ecf2); border-color: rgba(74, 163, 255, .55); background: rgba(74, 163, 255, .08); }
.cap-icon { width: 40px; padding: 0 !important; }
#btnCapClear:hover { color: #ff8b8f; border-color: rgba(229, 72, 77, .6); background: rgba(229, 72, 77, .1); }

/* ── توحيد الواجهة عبر كل التبويبات: أزرار وأقسام مقسَّمة وقيمٌ بنفس لغة تبويب الترجمة ── */
.btn { border-radius: 10px; }
.btn-primary, .btn-go {
  background: var(--acc, #4aa3ff); color: #08131f; box-shadow: none; border: 0;
  transition: background-color .2s cubic-bezier(.2, .8, .2, 1), transform .15s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.btn-primary:not(:disabled):hover, .btn-go:not(:disabled):hover { background: #6bb6ff; filter: none; }
.btn-primary:not(:disabled):active, .btn-go:not(:disabled):active { transform: translateY(1px); }
.btn-primary .ic, .btn-go .ic { stroke: currentColor; }
.segmented { border-radius: 11px; }
.segmented button { border-radius: 8px; transition: background-color .2s cubic-bezier(.2, .8, .2, 1), color .2s cubic-bezier(.2, .8, .2, 1); }
.segmented button.is-active { background: var(--acc, #4aa3ff); color: #08131f; box-shadow: none; }
.lbl em {
  padding: 2px 9px; border-radius: 999px; background: var(--bg-3, #222731); color: var(--fg-1, #e7ecf2);
}
.cap-actions .cap-primary.is-apply { background: #3fcf8e; }

/* زرّ القص وزرّ التفريغ أثناء التنفيذ: إيقاف — بعد قواعد التوحيد أعلاه كي لا
   يغلبه hover الأزرق العام (كان زرّ «إلغاء التفريغ» يصير أزرق تحت الماوس) */
.btn-go.is-cancel, .btn-go.is-cancel:not(:disabled):hover,
.btn-primary.is-cancel, .btn-primary.is-cancel:not(:disabled):hover { background: #d94f4f; color: #fff; }
.btn-go.is-cancel:not(:disabled):hover,
.btn-primary.is-cancel:not(:disabled):hover { background: #e56464; }

/* بعد الإيقاف: سؤالٌ واحد وخياران صريحان */
.cut-stopped {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line-2);
}
.cut-stopped p { margin: 0 0 8px; font-size: 12px; line-height: 1.6; color: var(--text); }
.cut-stopped .row { display: flex; gap: 8px; }
.cut-stopped .row .btn { flex: 1; justify-content: center; }
/* البطاقة تُقفل تلقائيًا حين يتغيّر التايم‌لاين (والقص يغيّره)، فسؤال
   الإيقاف داخلها يبقى حيًّا وإلا علق المستخدم بلا خيار */
.card.is-locked > .cut-stopped:not(.hidden) { opacity: 1; pointer-events: auto; }

/*
 * حقل الكلمات المساعدة بشرائح (js/taginput.js). الحقل في الأعلى بعرضه
 * الكامل وشكل الحقول النصية نفسه، والشرائح تحته — لا داخله، حتى لا ينزل
 * مكان الكتابة وحده إلى سطر فارغ حين يمتلئ السطر.
 */
.tagin-row {
  position: relative; display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.tagin.is-focus .tagin-row { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-tint); }
.tagin.is-disabled .tagin-row { opacity: .45; }
input[type="text"].tagin-typer {
  flex: 1; min-width: 0; padding: 8px 10px; background: transparent; border: 0; box-shadow: none;
}
input[type="text"].tagin-typer:focus { border: 0; box-shadow: none; }
.tagin-add {
  flex: none; margin-inline-end: 5px; padding: 3px 12px; border: 0; border-radius: 6px;
  background: var(--grad-cta); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
  opacity: 0; transform: translateX(-6px); pointer-events: none;
  transition: opacity .18s cubic-bezier(.16, 1, .3, 1), transform .18s cubic-bezier(.16, 1, .3, 1);
}
.tagin.has-text .tagin-add { opacity: 1; transform: none; pointer-events: auto; }
.tagin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tagin.has-chips .tagin-chips { margin-top: 9px; }
.tagin-chip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
  padding: 3px 11px 3px 4px; border-radius: 999px;
  background: var(--primary-tint); border: 1px solid rgba(91, 184, 232, .32);
  color: var(--primary-soft); font-size: 12.5px; line-height: 1.6;
}
.tagin-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagin-chip-x, .tagin-sugg-x {
  display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--faint);
  font-size: 14px; line-height: 1; cursor: pointer; transition: .12s;
}
.tagin-chip-x:hover, .tagin-sugg-x:hover { background: rgba(255, 107, 107, .16); color: var(--danger); }
.tagin-chip-x:disabled { display: none; }
.tagin-help { margin-top: 7px; font-size: 11.5px; color: var(--faint); }
.tagin-help:empty { display: none; }
.tagin-help.is-warn { color: var(--warn); }
.tagin-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 9px; }
.tagin-sugg:empty { display: none; }
.tagin-sugg-lbl { font-size: 11.5px; color: var(--faint); margin-inline-end: 2px; }
.tagin-sugg-item {
  display: inline-flex; align-items: center; border-radius: 999px;
  border: 1px dashed var(--line-2); transition: .15s;
}
.tagin-sugg-item:hover { border-color: var(--line); background: var(--primary-tint); }
.tagin-sugg-add {
  padding: 1px 10px; border: 0; background: transparent;
  color: var(--dim); font-size: 12px; cursor: pointer;
}
/* زرّ النسيان يظهر عند التمرير فقط، فلا يترك فراغًا في الشريحة */
.tagin-sugg-item .tagin-sugg-x { display: none; width: 16px; height: 16px; font-size: 12px; margin-inline-end: 3px; }
.tagin-sugg-item:hover .tagin-sugg-add { padding-inline-end: 3px; }
.tagin-sugg-item:hover .tagin-sugg-x { display: inline-grid; }


/* ══════════════════════════════════════════════════════════════════
   تمريرة التصميم (2026-09-27، من نموذج ~/auto-edit-redesign):
   ١. الخيار المختار لونٌ خفيف جدًا لا أزرق مصمت
   ٢. لا شرح ظاهر في كل مكان: التلميحات في ⓘ وحدها
   ٣. اللغة والنموذج بأيقونة بلا عناوين
   ٤. جدول الأسطر: رقم ووقت مختصر فقط
   ٥. أقسام القالب الثلاثة بفواصل
   ٦. معاينة الأدوات: تايم‌لاين بريمير مصغّر
   الكتلة كلها هنا — احذفها ترجع اللوحة كما كانت.
   ══════════════════════════════════════════════════════════════════ */

/* ١ ── الاختيار: صبغة خفيفة وحدّ رفيع، والنص أبيض. الحبّة المنزلقة تُخفى
   لأن بعض المجموعات بلا حبّة؛ الصبغة على الزرّ نفسه تصحّ في كلها. */
.segmented button.is-active,
.ed-ui .segmented button.is-active,
.pane[data-pane="sub"] .segmented button.is-active,
.mg-font .segmented button.is-active,
#stepAlign .card-head .al-to button.is-active,
.cut-tools .segmented button.is-active,
.cap-mode-b.is-active {
  background: rgba(91, 184, 232, .11); color: #eef6fb;
  box-shadow: inset 0 0 0 1px rgba(91, 184, 232, .24);
}
.cut-tools .segmented button.is-active::after { display: none; }
.ed-ui .seg-pill { display: none; }
.segmented button:not(.is-active):hover { color: var(--text); }

/* ٢ ── الشرح الثابت يختفي؛ التحذيرات ونتائج الأوامر تبقى */
.wave-legend .tip, #subEditHint, .foot-row > span.note, #tkModeHint,
.mg-note:not(#mgLiveScope) { display: none !important; }
p.note:empty, .note.meta:empty, .note.msg:empty { display: none; }
.hd-hint { opacity: .55; }
.hd-hint:hover { opacity: 1; }

/* ٣ ── اللغة والنموذج: أيقونة ثم القائمة، بلا عنوان فوقها */
.seg-cell.pick-cell { flex-direction: row; align-items: center; gap: 7px; }
.pick-ic {
  flex: 0 0 auto; width: 20px; display: grid; place-items: center;
  font-size: 15px; line-height: 1; color: var(--faint); cursor: default;
}
.pick-ic .ic { width: 15px; height: 15px; }
.pick-cell > select, .pick-cell > .dd, .pick-cell > .model-row { flex: 1 1 auto; min-width: 0; }
#modelHint:empty { display: none; }

/* ٤ ── جدول الأسطر: الرقم والوقت والنص فقط */
.lt-head, .lt-row .c-d { display: none !important; }
.lt-row { grid-template-columns: 20px 44px minmax(64px, 1fr) 52px; gap: 6px; }
@media (max-width: 300px) { .lt-row { grid-template-columns: 44px minmax(46px, 1fr) 42px; } }
.lt-row .c-t { font-weight: 500; color: var(--dim); font-variant-numeric: tabular-nums; }
.lt-row .c-t:hover { color: var(--primary-soft); text-decoration: none; }
.lt-row.is-now .c-t { color: var(--primary-soft); }
.c-t.is-copied { color: var(--go) !important; }

/* ٥ ── أقسام القالب: فاصلٌ رفيع بين مجموعات «الإعدادات» */
.mg-sep { display: block; height: 1px; margin: 8px 0; background: var(--line-2); }
.mg-gen:empty { display: none; }

/* ٦ ── معاينة الأدوات: ألوان بريمير نفسها (رماديّات، مقاطع بنفسجية، fx صفراء) */
.td-stage {
  position: relative; height: 118px; margin: 2px 0 12px; overflow: hidden; direction: ltr;
  border: 1px solid #2c2c2c; border-radius: 8px; background: #1a1a1a;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
.td-tl { position: absolute; inset: 0; }
.td-rul { position: absolute; top: 0; left: 34px; right: 0; height: 16px; background: #232323; border-bottom: 1px solid #2f2f2f; }
.td-tc { position: absolute; top: 2px; font-size: 8.5px; color: #8a8a8a; padding-left: 3px; border-left: 1px solid #3a3a3a; line-height: 12px; }
.td-row { position: absolute; left: 0; right: 0; height: 26px; border-bottom: 1px solid #262626; }
.td-hd { position: absolute; left: 0; top: 0; bottom: 0; width: 34px; background: #232323; border-right: 1px solid #2f2f2f;
  display: flex; align-items: center; justify-content: center; }
.td-hd b { font-size: 9.5px; font-weight: 600; color: #d0d0d0; background: #2d6bd6; border-radius: 2px; padding: 1px 3px; line-height: 11px; }
.td-row.a .td-hd b { background: #3a3a3a; color: #bdbdbd; }
.td-lane { position: absolute; left: 34px; right: 0; top: 0; bottom: 0; }
.td-clip { position: absolute; top: 3px; height: 20px; border-radius: 2px; overflow: hidden; box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, .45); font-size: 9px; line-height: 18px; padding: 0 4px; white-space: nowrap; color: #1b1b2b; }
.td-clip span { position: relative; z-index: 1; }
.td-clip.vid { background: linear-gradient(180deg, #a79ff0 0%, #9189dc 100%); }
.td-clip.nest { background: linear-gradient(180deg, #e2d56f, #cfbe52); }
.td-clip.adj { background: linear-gradient(180deg, #d6a8f0, #bf8fe0); }
.td-clip.img { background: linear-gradient(180deg, #f0a5c7, #dc8db1); }
.td-clip.solid { color: #fff; }
.td-clip.free { top: auto; }
.td-clip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 55%; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0) 15%, rgba(255,255,255,.75) 50%, rgba(255,255,255,0) 85%);
  transform: translateX(calc(var(--s, -1.2) * 100%)); }
.td-clip.nw { box-shadow: 0 0 0 1px rgba(255,255,255,calc(var(--g, 0) * .9)), 0 0 calc(var(--g, 0) * 16px) rgba(150,200,255,calc(var(--g, 0) * .7)); }
.td-fx { position: absolute; right: 3px; top: 3px; z-index: 2; font: italic 700 8px/12px Georgia, serif; color: #5b5b6e;
  background: rgba(255, 255, 255, .35); border-radius: 2px; padding: 0 2px; transition: background .25s, color .25s; }
.td-fx.on { background: #f5d34a; color: #3a2e00; }
.td-fx.fly { right: auto; z-index: 5; }
.td-ph { position: absolute; top: 0; bottom: 0; width: 1px; background: #2d8ceb; z-index: 4; }
.td-ph::before { content: ""; position: absolute; top: 1px; left: -5px; width: 11px; height: 12px; background: #2d8ceb;
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
.td-img { position: absolute; top: 10px; right: 12px; width: 74px; height: 48px; border-radius: 4px; overflow: hidden; z-index: 6;
  background: linear-gradient(180deg, #6fb4e0, #355d80); box-shadow: 0 8px 18px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.25); }
.td-img svg { display: block; width: 100%; height: 100%; }
.td-keys { position: absolute; right: 94px; top: 25px; z-index: 6; display: flex; gap: 3px; }
.td-keys b { font: 600 10px/18px -apple-system, system-ui, sans-serif; color: #e8e8e8; background: #2c2c2c; border: 1px solid #444;
  border-bottom-width: 2px; border-radius: 4px; min-width: 18px; text-align: center; padding: 0 3px; }
/* الزرّ الذي تُعرض أداته الآن */
.qt .is-demo { border-color: rgba(91, 184, 232, .45) !important; }
/* اللغة أقصر من اسم النموذج وزرّ تحميله، فتأخذ أقل */
.pane[data-pane="sub"] .seg-row { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
/* عمود الوقت يأخذ عرضه من أطول وقت (--tw من main.js)، ولا نقاط قصّ أبدًا */
.lt-row { grid-template-columns: 20px var(--tw, 44px) minmax(64px, 1fr) 52px; }
.lt-row .c-t { overflow: visible; text-overflow: clip; }
@media (max-width: 300px) { .lt-row { grid-template-columns: var(--tw, 44px) minmax(46px, 1fr) 42px; } }
/* أيقونتا اللغة والنموذج: خطّيتان بلون النص الخافت (الإيموجي يظهر رماديًا باهتًا داخل بريمير) */
.pick-ic svg { width: 17px; height: 17px; }
.pick-ic { color: var(--dim); }
.pick-cell:hover .pick-ic { color: var(--primary-soft); }

/* حجم النص داخل «الموضع والحجم»: نفس صفّ الموضع (الاسم ثم المنزلق ثم الرقم) */
.mg-row.mg-size { display: flex !important; flex-direction: row; margin: 0; }
.mg-size > .lbl { display: contents; }
.mg-size > .lbl > span { order: 1; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--fg-2, #9aa3ad); }
.mg-size > input[type="range"] { order: 2; flex: 1.2; min-width: 90px; margin: 0; }
.mg-size > .lbl > em { order: 3; }

/* رأس القسم المفتوح بلا إطار أزرق ولا خلفية ملوّنة: الطيّ يكفي أن يقوله السهم.
   والاتجاه يتبع لغة الواجهة (كان مثبّتًا rtl فيقلب العنوان في الإنجليزية). */
.mg-acc { direction: inherit; text-align: start; }
.mg-acc:hover { border-color: rgba(255, 255, 255, .16); }
.mg-grp.is-open > .mg-acc { border-color: var(--line, #262b33); background: var(--bg-2, #15181d); }
.mg-grp.is-open > .mg-acc .mg-acc-chev { border-color: var(--fg-2, #9aa3ad); }
.mg-row.mg-size > .lbl { display: contents !important; }
.mg-row.mg-size > .lbl > span { font-weight: 400 !important; font-size: 12px !important; }
.mg-row.mg-size > .lbl > em {
  order: 3; min-width: 34px; margin: 0; padding: 3px 9px; border-radius: 8px; border: 0;
  background: var(--bg-2, #15181d); color: var(--fg-1, #e7ecf2); font-weight: 400; font-size: 12px; text-align: center;
}

/* «ابدأ التتبّع» بلون «تطبيق» في المنحنى: أزرق بريمير مصمت ونص أبيض، بلا توهّج */
#tkGo.btn-primary { background: #1473e6; color: #fff; box-shadow: none; filter: none; }
#tkGo.btn-primary:not(:disabled):hover { background: #0d66d0; }
#tkGo.btn-primary:not(:disabled):active { background: #095aba; }
#tkGo.btn-primary .ic { stroke: currentColor; }
