/* ============================================================
   الحركةُ واللمس — على مبادئ آبل (HIG)، والخطُّ «ثمانية» كما هو.

   · اللمس: كلُّ هدفٍ ٤٤×٤٤ نقطةً على الأقلّ — بمنطقةٍ شفّافةٍ حول
     الزرّ الصغير (::after) فلا يتغيّر شكلُه ولا يتحرّك شيء.
   · الضغط: الزرُّ ينكمش قليلاً ويغمق لحظةَ اللمس، والصفُّ العريض
     أخفّ — فتعرف أنّ اللمسة وصلت قبل أن يحدث شيء.
   · الانتقال: الصفحةُ تدخل بتلاشٍ وانزلاقٍ خفيف، والورقةُ تصعد من
     الأسفل، والنافذةُ تنبثق، والخلفيّةُ تُعتم تدريجاً.
   · من أطفأ الحركة من إعدادات جوّاله: لا حركةَ إطلاقاً.

   جذورُ تقارير PDF خارج النطاق كلّها.
   ============================================================ */

/* ── ١ · الضغط ── */
#root :is(button, [role="button"], summary, a[href]){
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#root :is(button, [role="button"]):not(:disabled):not([style*="transform"]){
  transition: transform .18s cubic-bezier(.2,.8,.2,1), filter .18s ease-out;
}
#root :is(button, [role="button"]):not(:disabled):not([style*="transform"]):active{
  transform: scale(.95);
  filter: brightness(.93);
  transition-duration: .06s;
}
/* الصفوفُ والبطاقاتُ العريضة — انكماشٌ أخفّ */
/* للأزرار وحدها: «:active» يسري على الأسلاف أيضاً، و«main» نفسه يحمل
   ‎.flex-1‎ — فلو لم يُقيَّد لانكمشت الصفحةُ كلُّها تحت الإصبع. */
#root :is(button, [role="button"]):is(.w-full, .flex-1, [data-repbanner], [data-tile], .fl-ac-lb, .fl-lg-name, .fl-ac-back, .fl-ac-out, .fl-skin):not(:disabled):not([style*="transform"]):active{
  transform: scale(.982);
  filter: brightness(.96);
}
:is(#period-print-root, #fleet-print-root, #loc-print-root, #emb-print-root) *{ transition:none !important; animation:none !important; }

/* ── ٢ · منطقةُ لمسٍ ٤٤ حول الأزرار الصغيرة — بلا تغيير شكل ── */
#root :is(
  .fl-eb,
  header > div:nth-child(2) > button,
  main button.w-7,
  main button.flex-1.text-right,
  main[data-tab="locs"] button[aria-label],
  main[data-tab="tasks"] button:not(.fl-dc):not(.fl-dcall):not(.fl-calmo):not(.fl-duebtn):not(.fl-tks-c):not(.fl-tks-n):not(.fl-tkb2):not(.fl-pickbtn),
  .fl-lg-more, .fl-lg-file, .fl-ac-edit, .fl-duebtn
):not([style*="position: absolute"]):not([style*="position: fixed"]){
  position: relative;
}
#root :is(
  .fl-eb,
  header > div:nth-child(2) > button,
  main button.w-7,
  main button.flex-1.text-right,
  main[data-tab="locs"] button[aria-label],
  main[data-tab="tasks"] button:not(.fl-dc):not(.fl-dcall):not(.fl-calmo):not(.fl-duebtn):not(.fl-tks-c):not(.fl-tks-n):not(.fl-tkb2):not(.fl-pickbtn),
  .fl-lg-more, .fl-lg-file, .fl-ac-edit
)::after{
  content: ""; position: absolute; inset: -10px; border-radius: inherit;
}
/* سطرُ السجلّ: اللوحةُ و⋯ بطول ٤٤ فعلاً — مساحةٌ في السطر لا تُزاحم أحداً */
#root .fl-lg-name{ min-height: 44px; }
/* «تصفية حسب المواقع» وزرُّ الأرشيف وصفوفُ المواقع: ٤٤ فعلاً */
#root main .w-full.flex.justify-between.items-center.py-2, #root main[data-tab="locs"] button.w-full, #root main[data-tab="log"] button.w-full{ min-height: 44px; }
#root .fl-lg-more{ min-width: 44px; min-height: 44px; }
/* المهام: «فعّل الإشعارات» والتصفية، و«الشهر كاملاً»، و📅 👤 — ٤٤ فعلاً (كانت ٣٠–٤٢) */
#root :is(.fl-tks-c, .fl-tks-n, .fl-calmo, .fl-duebtn){ min-height: 44px; }

/* ── ٣ · انتقالُ الصفحات ──
   «backwards» لا «both»: حركةُ transform الساريةُ بعد انتهائها تجعل العنصرَ
   إطاراً لكلّ position:fixed بداخله، فتُحبس الأوراقُ في الصفحة (patch_fixbox). */
@keyframes flTabIn{ from{ opacity:0; transform:translate3d(0,10px,0) } to{ opacity:1; transform:none } }
#root main[data-tab] > *{ animation: flTabIn .28s cubic-bezier(.2,.8,.2,1) backwards; }

/* اللوحة: البطاقاتُ تدخل متتاليةً بدل الصفحة دفعةً واحدة (patch_dashanim) */
#root main[data-tab="dash"] > *{ animation:none; }
#root main[data-tab="dash"] > * > :not(.fixed):not([style*="position: fixed"]){ animation-name:flTabIn; animation-duration:.42s;
  animation-timing-function:cubic-bezier(.2,.8,.2,1); animation-fill-mode:backwards; }  /* بلا اختصار: لا يمحو التأخير تحته */
#root main[data-tab="dash"] > * > :nth-child(2){ animation-delay:.06s }
#root main[data-tab="dash"] > * > :nth-child(3){ animation-delay:.10s }
#root main[data-tab="dash"] > * > :nth-child(4){ animation-delay:.14s }
#root main[data-tab="dash"] > * > :nth-child(5){ animation-delay:.18s }
#root main[data-tab="dash"] > * > :nth-child(n+6){ animation-delay:.22s }
/* تغيّرٌ حقيقيٌّ في رقم: ومضةٌ خضراء أو حمراء بحسب معناه */
@keyframes flGood{ 30%{ transform:scale(1.14); text-shadow:0 0 14px rgba(45,212,160,.95), 0 0 2px rgba(45,212,160,.9) } }
@keyframes flBad{ 30%{ transform:scale(1.14); text-shadow:0 0 14px rgba(255,92,116,.95), 0 0 2px rgba(255,92,116,.9) } }
.fl-cnt{ display:inline-block; font-variant-numeric:tabular-nums; }
.fl-cnt.fl-good{ animation: flGood .9s ease-out; }
.fl-cnt.fl-bad{ animation: flBad .9s ease-out; }

/* ── ٣ب · الأيقوناتُ تنبثق (patch_iconpop) ── */
@keyframes flIconIn{ 0%{ opacity:0; transform:scale(.35) } 55%{ opacity:1; transform:scale(1.14) }
  78%{ transform:scale(.96) } 100%{ transform:scale(1) } }
@keyframes flTabPop{ 0%{ transform:scale(.82) } 55%{ transform:scale(1.2) } 100%{ transform:scale(1.06) } }
@keyframes flGoIn{ 0%{ opacity:0; transform:translate3d(-10px,0,0) } 100%{ opacity:1; transform:none } }
/* الترويسة والشريطُ السفليّ — مرّةً عند فتح الموقع */
#root .fl-hgrp > *, #root nav.fixed.bottom-0 > div > :not(.fl-navpill){
  animation-name:flIconIn; animation-duration:.5s; animation-timing-function:cubic-bezier(.2,.8,.2,1); animation-fill-mode:backwards; }
#root .fl-hgrp > :nth-child(1){ animation-delay:.12s } #root .fl-hgrp > :nth-child(2){ animation-delay:.16s }
#root .fl-hgrp > :nth-child(3){ animation-delay:.20s } #root .fl-hgrp > :nth-child(4){ animation-delay:.24s }
#root .fl-hgrp > :nth-child(5){ animation-delay:.28s } #root .fl-hgrp > :nth-child(6){ animation-delay:.32s }
#root .fl-hgrp > :nth-child(7){ animation-delay:.36s } #root .fl-hgrp > :nth-child(n+8){ animation-delay:.40s }
/* الأوّلُ ‎.fl-navpill‎ — شريحةُ التبويب الفعّال، تتموضع بـtransform في السطر فلا
   تُكبَّر؛ تظهر بتلاشٍ فقط. ثم: اللوحة، المركبات، «+»، المواقع، السجل */
#root nav.fixed.bottom-0 > div > .fl-navpill{ animation: flFade .3s ease-out .42s backwards; }
#root nav.fixed.bottom-0 > div > :nth-child(2){ animation-delay:.18s } #root nav.fixed.bottom-0 > div > :nth-child(3){ animation-delay:.23s }
#root nav.fixed.bottom-0 > div > :nth-child(4){ animation-delay:.34s } #root nav.fixed.bottom-0 > div > :nth-child(5){ animation-delay:.28s }
#root nav.fixed.bottom-0 > div > :nth-child(n+6){ animation-delay:.33s }
/* تبديلُ التبويب: أيقونتُه تقفز */
#root nav.fixed.bottom-0 button[data-on] > span:first-child{ animation: flTabPop .38s cubic-bezier(.2,.8,.2,1) backwards; }
/* اللوحة — بُعيد ظهور بطاقتها */
#root main[data-tab="dash"] :is([data-repicon], .fl-bic, [data-tile] > div:first-child){
  animation-name:flIconIn; animation-duration:.5s; animation-timing-function:cubic-bezier(.2,.8,.2,1); animation-fill-mode:backwards; animation-delay:.22s; }
#root main[data-tab="dash"] [data-repgo]{ animation: flGoIn .4s cubic-bezier(.2,.8,.2,1) .36s backwards; }
#root main[data-tab="dash"] > * > :nth-child(2) .fl-bic{ animation-delay:.28s }
#root main[data-tab="dash"] > * > :nth-child(3) .fl-bic{ animation-delay:.33s }
#root main[data-tab="dash"] > * > :nth-child(4) .fl-bic{ animation-delay:.38s }
#root main[data-tab="dash"] [data-tile] > div:first-child{ animation-delay:.40s }

/* ── ٤ · الأوراقُ والنوافذ ── */
@keyframes flFade{ from{ opacity:0 } to{ opacity:1 } }
@keyframes flSheetUp{ from{ transform:translate3d(0,100%,0) } to{ transform:none } }
@keyframes flPop{ from{ opacity:0; transform:scale(.94) } to{ opacity:1; transform:none } }
#root :is([style*="position: fixed"][style*="inset: 0px"][style*="rgba(15, 30, 61, 0.45)"], .fixed.inset-0.flex.items-end), .fl-pickov{
  animation: flFade .22s ease-out backwards;
}
#root [style*="position: fixed"][style*="inset: 0px"][style*="rgba(15, 30, 61, 0.45)"][style*="align-items: flex-end"] > :first-child,
#root .fixed.inset-0.flex.items-end > :first-child,
.fl-pickov > .fl-picksheet{
  animation: flSheetUp .34s cubic-bezier(.22,.9,.28,1) backwards;
}
#root [style*="position: fixed"][style*="inset: 0px"][style*="rgba(15, 30, 61, 0.45)"][style*="align-items: center"] > :first-child{
  animation: flPop .24s cubic-bezier(.2,.9,.3,1.15) backwards;
}
/* الورقةُ وهي تُسحب بالإصبع (motion.js) */
.fl-dragging{ transition:none !important; animation:none !important; }
.fl-snap{ transition: transform .28s cubic-bezier(.22,.9,.28,1) !important; }

/* ── ٥ · السحبُ من الحافّة للرجوع (motion.js) ── */
#fl-back{ position:fixed; z-index:9999; top:50%; right:-46px; width:40px; height:40px; margin-top:-20px; border-radius:50%;
  background:rgba(15,30,61,.86); color:#fff; display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:800;
  box-shadow:0 8px 20px -8px rgba(0,0,0,.45); pointer-events:none; opacity:0; }
#fl-back.go{ background:#1B5F72; }

/* ── ٧ · نبضُ اللوحة: ثلاثُ نبضاتٍ عند الفتح ثم يسكن ──
   كان يتحرّك بلا نهاية: رسمُ stroke-dashoffset يعيد تلوين الخطّ كلَّ
   إطار — ٣٠٨١ms من المعالج في ١٠ ثوانٍ خاملة (×٤)، و٤١ms بدونه.
   يعود ينبض كلّما فُتحت اللوحة. */
.fl-ecg .fl-ecg-comet{ animation: flSweep2 2.4s linear 3, flEcgRest .6s ease-out 7.2s forwards; }
.fl-ecg .fl-heart{ animation-iteration-count: 3; }
@keyframes flEcgRest{ to{ stroke-opacity:0 } }   /* لا opacity: ‏theme.css يثبّتها بـ!important */

/* ── من أطفأ الحركة: لا حركة ── */
@media (prefers-reduced-motion: reduce){
  #root *, #root *::before, #root *::after, .fl-pickov, .fl-pickov *{ animation:none !important; transition:none !important; }
  #root :is(button, [role="button"]):active{ transform:none !important; }
}
