/* ═══════════════════════════════════════════════════════════════════════════
   femto · NAV RAIL (carbon) — سكّة تنقّل مُعنونة على الجانب
   ─────────────────────────────────────────────────────────────────────────────
   • إضافة بحتة: ملف جديد، لا يعدّل أي ملف موجود.
   • يستخدم توكنز السكِن الكربوني الموجودة (--bg/--surface/--text/--accent/...).
   • ديسكتوب فقط (≥1025px). الموبايل (<1025px) يبقى على قشرته الأصلية.
   • كل القواعد مربوطة تحت html.fnrp-active — لا تتسرّب للثيم/الأدمن.
   • RTL عبر logical properties · يحترم prefers-reduced-motion.
   • rollback: احذف سطرَي الـ enqueue في findex-news-runtime-pro.php.
   ═══════════════════════════════════════════════════════════════════════════ */

.fznav{
  position: fixed; inset-block: 0; inset-inline-start: 0; width: 92px; z-index: 1100;
  background: var(--bg-2, #0b0c0e);
  border-inline-end: 1px solid var(--border, rgba(255,255,255,.06));
  display: none; flex-direction: column; align-items: stretch;
  padding: 8px 0; gap: 1px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.fznav::-webkit-scrollbar{ width: 0 }

/* يظهر + يزحزح المحتوى فقط على الديسكتوب */
@media (min-width: 1025px){
  html.fnrp-active .fznav{ display: flex; }
  html.fnrp-active #fnrp-root{ padding-inline-start: 92px; }
  html.fnrp-active .fb-ribbon{ inset-inline-start: 92px !important; }
  /* خدمات الـ Services Rail منقولة للسكّة الجديدة → نخفي الشريط القديم لتفادي التداخل */
  html.fnrp-active #fsv-rail{ display: none !important; }
}

.fznav-brand{
  display: flex; align-items: center; justify-content: center; height: 46px;
  font-family: "Poppins", system-ui, sans-serif; font-weight: 700; font-size: 19px;
  letter-spacing: -.02em; color: var(--text, #fbfbfc); margin-bottom: 4px;
}
.fznav-brand .dot{ color: var(--accent, #5e9eff) }
.fznav-sp{ flex: 1 }
.fznav-sep{ height: 1px; background: var(--border, rgba(255,255,255,.07)); margin: 7px 14px }

.fznav-i{
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 4px 9px; color: var(--muted, #666b75); background: none; border: 0; cursor: pointer;
  font-family: inherit; width: 100%;
  transition: color .15s cubic-bezier(.2,0,0,1), background .15s cubic-bezier(.2,0,0,1);
}
.fznav-i svg{ width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.fznav-i .lab{ font-size: 10.5px; font-weight: 500; letter-spacing: .01em; line-height: 1; text-align: center }
.fznav-i:hover{ color: var(--text-2, #9ea3ad); background: rgba(255,255,255,.025) }
.fznav-i.on{ color: var(--text, #fbfbfc); background: rgba(255,255,255,.06) }
.fznav-i.on::before{
  content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--text, #fff); border-radius: 0 2px 2px 0;
}
.fznav-i:active{ transform: translateY(.5px) }

/* الثيم الفاتح */
[data-fnrp-theme="light"] .fznav{ background: var(--bg-2, #f5f6f7) }
[data-fnrp-theme="light"] .fznav-i:hover{ background: rgba(10,12,16,.04) }
[data-fnrp-theme="light"] .fznav-i.on{ background: rgba(10,12,16,.05) }
[data-fnrp-theme="light"] .fznav-i.on::before{ background: var(--text) }

@media (prefers-reduced-motion: reduce){
  .fznav-i{ transition: none }
  html.fnrp-active{ scroll-behavior: auto }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PERFORMANCE — قتل backdrop-filter على العناصر الثابتة/اللاصقة
   ─────────────────────────────────────────────────────────────────────────────
   السبب الرئيسي للبطء/الهنج: blur على عناصر دائمة الظهور (هيدر/شريط/أسعار) +
   تحديثات حيّة متكرّرة = إعادة رسم مكلفة كل لحظة. نستبدله بخلفيات صلبة.
   ═══════════════════════════════════════════════════════════════════════════ */
html.fnrp-active .fh-bar,
html.fnrp-active .fb-ribbon,
html.fnrp-active .fp-strip,
html.fnrp-active #fnrp-price-strip,
html.fnrp-active .fznav{
  -webkit-backdrop-filter: none !important;
          backdrop-filter: none !important;
}
html.fnrp-active .fh-bar{ background: var(--bg-2, #0b0c0e) !important; }
html.fnrp-active .fb-ribbon{ background: var(--bg-2, #0b0c0e) !important; }
[data-fnrp-theme="light"] .fh-bar{ background: var(--bg-2, #f5f6f7) !important; }
[data-fnrp-theme="light"] .fb-ribbon{ background: var(--bg-2, #f5f6f7) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDAR → SIDEBAR — الكلندر الأفقي يصير بطاقة مدمجة في الـ sidebar
   ─────────────────────────────────────────────────────────────────────────────
   ننقله (عبر JS) لأعلى الـ sidebar فوق الـ watchlist، ونعيد تنسيقه ليكون
   عمودياً مدمجاً: العنوان، صفّ الأيام السبعة المصغّر، بطاقة "التالي"، الزر.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px){
  /* إخفاء الكلندر في منطقة النيوز افتراضياً — بالـ id والـ class معاً (متانة).
     يظهر فقط داخل الـ sidebar تحت. نغطّي نسختي التقويم: القديمة
     (#fnrp-econ-strip / .fn-econ-strip) و«v2» التي تستبدلها (#fnrp-ec2-strip /
     .fn-ec2-strip) — هذا هو سبب بقاء التقويم بالنص سابقاً.
     مهم (دفاع في العمق): الإخفاء مشروط بعلامة .fznav-cal-relocated التي يضيفها
     الـ JS فور نجاح أوّل نقل، ومقصور على نسخة الجذر (#fnrp-root >) — فلو فشل
     النقل لأي سبب يبقى التقويم ظاهراً في الجذر (سلوك قديم) بدل أن يختفي. */
  html.fznav-cal-relocated.fnrp-active #fnrp-root > #fnrp-econ-strip,
  html.fznav-cal-relocated.fnrp-active #fnrp-root > .fn-econ-strip,
  html.fznav-cal-relocated.fnrp-active #fnrp-root > #fnrp-ec2-strip,
  html.fznav-cal-relocated.fnrp-active #fnrp-root > .fn-ec2-strip{ display: none !important; }
  /* البطاقة داخل الـ sidebar (مُعرّفان من الـ id = أولوية أعلى → تتغلّب على الإخفاء) */
  html.fnrp-active #fnrp-sidebar #fnrp-econ-strip,
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip{
    display: block !important;
    width: 100% !important;
    margin: 0 0 12px 0 !important;
    padding: 12px !important;
    background: var(--surface, #0e1014) !important;
    border: 1px solid var(--border, rgba(255,255,255,.06)) !important;
    border-radius: var(--radius-lg, 10px) !important;
    box-sizing: border-box !important;
  }
  /* ── النسخة القديمة: صفّ الأيام السبعة مصغّر ──────────────────────────────── */
  html.fnrp-active #fnrp-sidebar #fnrp-econ-spine{
    display: flex !important;
    gap: 3px !important;
    width: 100% !important;
  }
  html.fnrp-active #fnrp-sidebar .fn-econ-spine-cell{
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 6px 2px !important;
  }
  html.fnrp-active #fnrp-sidebar .fn-econ-spine-dow{ font-size: 9px !important; }
  html.fnrp-active #fnrp-sidebar .fn-econ-spine-day{ font-size: 13px !important; }
  html.fnrp-active #fnrp-sidebar .fn-econ-next{ margin-top: 10px !important; width: 100% !important; }
  html.fnrp-active #fnrp-sidebar .fn-econ-cta{ margin-top: 8px !important; width: 100% !important; justify-content: center !important; }

  /* ── النسخة v2: تكديس عمودي مدمج داخل الـ sidebar ─────────────────────────── */
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip{
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  /* صفّ الأيام السبعة (rail) — يتقلّص ليزبط في عرض الـ sidebar */
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-rail{
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    width: 100% !important;
    overflow: visible !important;
  }
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-day{
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 7px 2px !important;
    box-sizing: border-box !important;
  }
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-day-dow{ font-size: 9px !important; }
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-day-num{ font-size: 13px !important; }
  /* بطاقة «التالي» + زر فتح التقويم → بعرض كامل تحت الأيام */
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-focus{
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-nx{ width: 100% !important; box-sizing: border-box !important; }
  html.fnrp-active #fnrp-sidebar #fnrp-ec2-strip .fn-ec2-open{
    width: 100% !important;
    justify-content: center !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DECLUTTER — مطابقة أقرب للنموذج
   ─────────────────────────────────────────────────────────────────────────────
   • إخفاء شريط الأسعار العلوي (الأسعار متوفّرة في الـ sidebar/watchlist).
   • دمج صفوف الفلاتر (sentiment + impact + breaking + sort) في صفّ واحد.
   ديسكتوب فقط · تقديمي بحت · لا يحذف وظيفة (الفلاتر تبقى تعمل، تمرير أفقي عند الحاجة).
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px){
  /* 1) إخفاء شريط الأسعار العلوي (.fp-strip منفصل عن .fb-ribbon — آمن) */
  html.fnrp-active .fp-strip,
  html.fnrp-active #fnrp-price-strip{ display: none !important; }

  /* 2) صفّ فلاتر واحد نظيف */
  html.fnrp-active #fnrp-topic-bar.ff-bar{
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 9px !important;
    scrollbar-width: none;
    align-items: center !important;
  }
  html.fnrp-active #fnrp-topic-bar.ff-bar::-webkit-scrollbar{ height: 0 !important; }
  html.fnrp-active #fnrp-topic-bar .ff-chip,
  html.fnrp-active #fnrp-topic-bar .ff-sort{ white-space: nowrap !important; flex-shrink: 0 !important; }
  html.fnrp-active #fnrp-topic-bar .ff-sort{ padding-block: 6px !important; }
}

/* ════════════════════════════════════════════════════════════════════════════
   التقويم الكامل كـ«صفحة» كربونية احترافية — override لطبقة المودال فقط، بلا أي
   مساس بوحدة التقويم (fnrp-econ-calendar.js/.css). يُحمَّل هذا الملف بعد CSS
   التقويم فتفوز قواعدنا. النتيجة: طبقة معتمة من حافة لحافة تبدأ بعد السكّة (فتبقى
   السكّة ظاهرة وفعّالة)، بمحتوى موسّط مريح، بلا مظهر البطاقة العائمة.
   ═══════════════════════════════════════════════════════════════════════════ */
/* Re-theme the WHOLE calendar module to the carbon palette by overriding its own
   --ec2-* variables (cohesive, low-risk: colours only). Applies to the full
   overlay and the sidebar strip. */
html.fnrp-active .fn-ec2-overlay,
html.fnrp-active .fn-ec2-strip{
  /* page tokens — several module rules read these directly as var(--x, fallback) */
  --accent:#5e9eff; --bg:#08090b; --surface:#0d0f13; --surface-2:#15181e;
  --border:rgba(255,255,255,.06); --border-2:rgba(255,255,255,.13);
  --text:#f7f8fa; --text-2:#a7adb8; --muted:#646b76;
  --up:#26c281; --down:#fb5266; --warn:#f3b13c;
  /* module tokens */
  --ec2-accent:#5e9eff; --ec2-bg:#08090b; --ec2-surface:#0d0f13; --ec2-surface2:#15181e;
  --ec2-border:rgba(255,255,255,.06); --ec2-border2:rgba(255,255,255,.13);
  --ec2-text:#f7f8fa; --ec2-text2:#a7adb8; --ec2-muted:#646b76;
  --ec2-high:#fb5266; --ec2-med:#f3b13c; --ec2-low:#5e9eff; --ec2-up:#26c281; --ec2-down:#fb5266;
}
/* full-page carbon layer beside the rail */
html.fnrp-active .fn-ec2-overlay{
  align-items: stretch; justify-content: center; padding: 0;
  background: #08090b; -webkit-backdrop-filter: none; backdrop-filter: none;
}
@media (min-width: 1025px){ html.fnrp-active .fn-ec2-overlay{ inset-inline-start: 92px !important; } }
html.fnrp-active .fn-ec2-overlay .fn-ec2-sheet{
  width: 100%; max-width: 1280px; height: 100%; max-height: none; margin: 0 auto;
  border: 0; border-radius: 0; box-shadow: none; transform: none !important;
  background: radial-gradient(135% 78% at 50% 0%, #0c0e12, #08090b 62%);
}
/* header — clean carbon bar */
html.fnrp-active .fn-ec2-overlay .fn-ec2-hd{
  padding: 16px 26px; background: rgba(12,14,18,.72); border-bottom: 1px solid rgba(255,255,255,.07);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
html.fnrp-active .fn-ec2-overlay .fn-ec2-hd-title{ font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-hd button{ border-radius: 9px; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-hd > button:last-child{ width: 34px; height: 34px; }
/* filters / search / chips */
html.fnrp-active .fn-ec2-overlay .fn-ec2-filters{ padding: 14px 26px; background: rgba(10,11,13,.45); border-bottom: 1px solid rgba(255,255,255,.06); }
html.fnrp-active .fn-ec2-overlay .fn-ec2-search{ background: rgba(0,0,0,.34); border: 1px solid rgba(255,255,255,.09); border-radius: 10px; color: #f7f8fa; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-search:focus{ border-color: rgba(94,158,255,.5); box-shadow: 0 0 0 3px rgba(94,158,255,.12); }
html.fnrp-active .fn-ec2-overlay .fn-ec2-chip{ background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.09); border-radius: 9px; color: #a7adb8; font-weight: 600; padding: 6px 12px; transition: .15s; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-chip:hover{ border-color: rgba(255,255,255,.2); color: #f7f8fa; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-chip.is-active{ background: #5e9eff; border-color: #5e9eff; color: #06101d; font-weight: 700; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-chip--high.is-active{ background: #fb5266; border-color: #fb5266; color: #16060a; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-chip--medium.is-active{ background: #f3b13c; border-color: #f3b13c; color: #1c1402; }
/* list + sticky day header */
html.fnrp-active .fn-ec2-overlay .fn-ec2-list{ padding: 14px 24px 34px; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-day-hd{ background: #08090b; padding: 18px 6px 10px; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-day-label{ font-size: 13px; font-weight: 700; color: #f7f8fa; }
/* event rows — carbon surface, clear hierarchy, glowing importance */
html.fnrp-active .fn-ec2-overlay .fn-ec2-row{ background: #0d0f13; border: 1px solid rgba(255,255,255,.06); border-radius: 12px; margin-bottom: 8px; transition: border-color .15s, background .15s; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row:hover{ border-color: rgba(94,158,255,.32); background: #101319; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row-head{ padding: 14px 14px; gap: 12px; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row-name{ font-size: 13.5px; font-weight: 600; color: #f7f8fa; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row-time{ font-size: 12.5px; color: #a7adb8; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-cc{ background: #15181e; color: #a7adb8; border-radius: 6px; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-val-num.is-released{ color: #5e9eff; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row-imp.high{ box-shadow: 0 0 9px rgba(251,82,102,.65); }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row-imp.medium{ box-shadow: 0 0 9px rgba(243,177,60,.5); }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row--high{ border-inline-start: 2px solid #fb5266; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row--medium{ border-inline-start: 2px solid #f3b13c; }
html.fnrp-active .fn-ec2-overlay .fn-ec2-row-detail:not(:empty){ border-top: 1px solid rgba(255,255,255,.06); }
/* in-overlay side panel */
html.fnrp-active .fn-ec2-overlay .fn-ec2-side{ background: rgba(13,15,19,.5); border-inline-start: 1px solid rgba(255,255,255,.06); }

/* ════════════════════════════════════════════════════════════════════════════
   شريط العواجل (breaking ribbon) — تثبيت صارم لظهوره كشريط سفلي ثابت.
   ─────────────────────────────────────────────────────────────────────────────
   السكِن يجعله position:fixed bottom:0 ويظهر عند وجود عناصر (.visible). هنا نضمن
   ذلك بشكل دفاعي: نُعيد فرض الموضع الثابت السفلي + إزاحته بعد السكّة (92px) +
   z-index فوق المحتوى، حتى لو فشلت/تعارضت أي قاعدة أخرى. نظهره فقط حين يحمل
   عناصر (.visible) — لا نُظهر شريطاً فارغاً. ونؤكّد المساحة السفلية للجذر.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px){
  html.fnrp-active .fb-ribbon.visible{
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    inset-inline-start: 92px !important;
    inset-inline-end: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    margin: 0 !important;
    height: 38px !important;
    z-index: 1200 !important;
    transform: none !important;
    pointer-events: auto !important;
    background: var(--bg-2, #0b0c0e) !important;
    border-top: 1px solid var(--border-2, rgba(255,255,255,.10)) !important;
  }
  /* مساحة سفلية مضمونة كي لا يختبئ آخر المحتوى خلف الشريط */
  html.fnrp-active #fnrp-root{ padding-bottom: 46px !important; }
}
[data-fnrp-theme="light"] .fb-ribbon.visible{ background: var(--bg-2, #f5f6f7) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   تطبيقات داخل الصفحة (overlay/iframe) — تُفتح بجانب السكّة والسكّة تبقى.
   تُستخدم لـ«التداول» (Femto Flow) و«الوسطاء» (Femto Brokers).
   ─────────────────────────────────────────────────────────────────────────────
   • كل تطبيق يُحمَّل داخل iframe (نفس الأصل) فيحدث استحواذه الكامل داخل الإطار
     فقط — دون تعارض مع تطبيق الأخبار ودون تعديل أي إضافة خارجية.
   • الإطار يبدأ بعد عرض السكّة (92px) على جهة البداية، ويملأ بقية الشاشة.
   • z فوق عناصر الأخبار الطافية في منطقة المحتوى؛ السكّة لا تُغطّى (مزاحة 92px).
   • ديسكتوب فقط (السكّة نفسها ديسكتوب ≥1025px).
   ═══════════════════════════════════════════════════════════════════════════ */
.fznav-app-ov{
  display: none; position: fixed; inset-block: 0;
  inset-inline-start: 92px; inset-inline-end: 0;
  z-index: 100000; background: var(--bg, #0a0c10);
  border-inline-start: 1px solid var(--border, rgba(255,255,255,.08));
}
.fznav-app-ov.is-open{ display: block; }
.fznav-app-fr{
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; display: block; background: var(--bg, #0a0c10);
  opacity: 0; transition: opacity .18s ease;
}
.fznav-app-ov.is-ready .fznav-app-fr{ opacity: 1; }
/* مؤشّر تحميل بسيط حتى يجهز الإطار */
.fznav-app-ld{
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.fznav-app-ov.is-ready .fznav-app-ld{ display: none; }
.fznav-app-spin{
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border, rgba(255,255,255,.14));
  border-top-color: var(--accent, #5e9eff);
  animation: fznav-app-spin .8s linear infinite;
}
@keyframes fznav-app-spin{ to{ transform: rotate(360deg); } }
/* زرّ الإغلاق — يطفو في الزاوية العلوية على جهة النهاية فوق الإطار */
.fznav-app-x{
  position: fixed; top: 12px; inset-inline-end: 14px; z-index: 100001;
  width: 36px; height: 36px; display: none; align-items: center; justify-content: center;
  padding: 0; border-radius: 10px; cursor: pointer; color: var(--text, #fbfbfc);
  background: var(--bg-2, rgba(20,22,28,.85));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--border, rgba(255,255,255,.14));
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.fznav-app-ov.is-open .fznav-app-x{ display: flex; }
.fznav-app-x svg{ width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.fznav-app-x:hover{ filter: brightness(1.15); }

@media (min-width: 1025px){
  /* أثناء فتح المنصّة: اقفل تمرير الخلفية وأخفِ شريط العواجل السفلي (دفاعي) */
  html.fnrp-app-open, html.fnrp-app-open body{ overflow: hidden !important; }
  html.fnrp-app-open .fb-ribbon{ display: none !important; }
}
@media (max-width: 1024px){
  /* دون عتبة الديسكتوب لا سكّة ولا منصّة مدمجة */
  .fznav-app-ov, .fznav-app-x{ display: none !important; }
}
