/* ============================================================
   طبقة الهوية البصرية v6.5 — لوحة عمليات الأسطول
   لوحة قيادة مؤسسية: كحلي القيادة يحمل الهيبة،
   والقرمزي محجوز لما يستدعي الانتباه (زر الإضافة، التنبيهات).
   هذه الطبقة تلمس واجهة التطبيق فقط — جذور تقارير PDF
   (fleet/period/loc/emb-print-root) خارج نطاقها بالكامل.
   ============================================================ */

:root{
  --navy-900:#0A1A3A;
  --navy-800:#10264E;
  --navy-700:#16346B;
  --ink:#0F1E3D;
  --muted:#5C6B85;
  --crimson:#C41E3A;
  --crimson-deep:#8E1616;
  --green:#0E8A5F;
  --amber:#D97706;
  --canvas:#EEF2F7;
  --surface:#FFFFFF;
  --inset:#F4F6FA;
  --hairline:#E2E8F2;
  --sh-card:0 1px 2px rgba(15,30,61,.05), 0 10px 28px -16px rgba(15,30,61,.14);
  --sh-float:0 14px 38px -10px rgba(15,30,61,.24);
  --r-card:16px;
  --r-hero:26px;
}

/* ---------- القماشة العامة ---------- */
html, body{
  background:var(--canvas);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
/* غسيل لوني هادئ يجعل البطاقات البيضاء "تطفو" فوق الخلفية */
body::before{
  content:"";
  position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(60% 42% at 85% -6%, rgba(16,38,78,.10), transparent 60%),
    radial-gradient(46% 34% at -8% 12%, rgba(196,30,58,.05), transparent 55%),
    var(--canvas);
}
::selection{ background:rgba(196,30,58,.16); }

/* ---------- بطاقة الجاهزية (الهيرو) ---------- */
/* الحاوية: نصف قطر أوسع وظل عائم — تشمل أيضاً بطاقة الدخول */
#root .rounded-3xl.overflow-hidden{
  border-radius:var(--r-hero);
  border:1px solid var(--hairline);
  box-shadow:var(--sh-card);
}
/* رأس الهيرو: من الأحمر المسطّح إلى كحلي غرفة القيادة */
#root .rounded-3xl.overflow-hidden > .p-5:first-child{
  position:relative;
  background:
    radial-gradient(120% 160% at 88% -20%, rgba(226,74,95,.28), transparent 52%),
    linear-gradient(140deg, var(--navy-900) 0%, var(--navy-800) 52%, var(--navy-700) 100%) !important;
}
/* شبكة دقيقة خافتة — ملمس تقني لا زخرفة */
#root .rounded-3xl.overflow-hidden > .p-5:first-child::before{
  content:""; position:absolute; inset:0; z-index:0; pointer-events:none;
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size:26px 26px;
  mask-image:radial-gradient(140% 120% at 70% 0%, #000 40%, transparent 85%);
  -webkit-mask-image:radial-gradient(140% 120% at 70% 0%, #000 40%, transparent 85%);
}
#root .rounded-3xl.overflow-hidden > .p-5:first-child > *{
  position:relative; z-index:1;
}
/* حلقة الجاهزية: توهّج ناعم ومسار أوضح */
#root .rounded-3xl.overflow-hidden svg circle:first-of-type{
  stroke:rgba(255,255,255,.16);
}
#root .rounded-3xl.overflow-hidden svg circle:last-of-type{
  filter:drop-shadow(0 0 7px rgba(255,255,255,.65));
}
/* الأرقام القيادية: أرقام جدولية متراصة */
.text-4xl.font-extrabold,
.text-2xl.font-extrabold{
  font-variant-numeric:tabular-nums;
  letter-spacing:-.02em;
}

/* ---------- البطاقات ---------- */
#root .bg-white.rounded-2xl,
#root .rounded-2xl.bg-white{
  border:1px solid var(--hairline);
  box-shadow:var(--sh-card);
  border-radius:var(--r-card);
}
/* مؤشر التقدم داخل صفوف المواقع */
#root .h-1\.5.rounded-full{
  box-shadow:inset 0 1px 2px rgba(15,30,61,.10);
}

/* ---------- الشريط السفلي: زجاج مثبّت ---------- */
nav.fixed.bottom-0{
  background:rgba(252,253,255,.82) !important;
  -webkit-backdrop-filter:saturate(1.7) blur(18px);
  backdrop-filter:saturate(1.7) blur(18px);
  border-top:1px solid var(--hairline) !important;
  box-shadow:0 -10px 30px -18px rgba(15,30,61,.28) !important;
}
/* زر الإضافة العائم: قرمزي متدرّج بوهج ملوّن */
nav.fixed.bottom-0 button.rounded-2xl{
  background:linear-gradient(160deg, #D62641 0%, var(--crimson) 45%, var(--crimson-deep) 100%) !important;
  box-shadow:0 12px 26px -8px rgba(196,30,58,.55), 0 3px 8px rgba(142,22,22,.30) !important;
}
nav.fixed.bottom-0 button.rounded-2xl:active{
  box-shadow:0 6px 14px -6px rgba(196,30,58,.5), 0 2px 5px rgba(142,22,22,.28) !important;
}

/* ---------- عناصر الإدخال والتفاعل ---------- */
input, select, textarea{ border-radius:12px; }
button{ -webkit-tap-highlight-color:transparent; }
:focus-visible{
  outline:2px solid var(--crimson);
  outline-offset:2px;
  border-radius:10px;
}

/* طبقات الحوارات: عمق خلفي خفيف */
#root .fixed.inset-0{
  -webkit-backdrop-filter:blur(4px);
  backdrop-filter:blur(4px);
}

/* ---------- تفاصيل النظام ---------- */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{
  background:rgba(15,30,61,.18);
  border-radius:8px;
  border:3px solid transparent;
  background-clip:padding-box;
}
::-webkit-scrollbar-thumb:hover{ background-color:rgba(15,30,61,.30); }
::-webkit-scrollbar-track{ background:transparent; }

/* ---------- عزل جذور الطباعة (حزام أمان) ----------
   تقارير PDF تُصوَّر من هذه الجذور؛ نمنع أي أثر بصري من الطبقة */
#fleet-print-root, #period-print-root, #loc-print-root, #emb-print-root,
#fleet-print-root *, #period-print-root *, #loc-print-root *, #emb-print-root *{
  transition:none !important;
  animation:none !important;
  filter:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
  box-shadow:none;
}

/* ---------- احترام تفضيل تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}

/* ============================================================
   v7.0 — عدّتا غرفة الإرسال + الوضع الليلي الاختياري
   ============================================================ */

/* ---------- ♥ نبض الأسطول — تخطيط قلب أحمر (داكن في الوضعين) ---------- */
.fl-ecg{background:#0A1428;border:1px solid rgba(255,255,255,.10);border-radius:12px;padding:8px 10px 4px;margin-top:12px;position:relative}
.fl-ecg-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:2px;gap:8px}
.fl-ecg-ttl{display:flex;align-items:center;gap:5px;font-size:10px;font-weight:700;color:#9FB0CC}
.fl-heart{display:inline-block;color:#FF3B5C;font-size:11px;animation:flHeart 1.2s ease-in-out infinite;transform-origin:center}
@keyframes flHeart{0%,100%{transform:scale(1)}14%{transform:scale(1.35)}28%{transform:scale(1)}42%{transform:scale(1.22)}56%{transform:scale(1)}}
.fl-ecg-side{display:flex;align-items:center;gap:8px}
.fl-ecg-side b{font-size:10px;font-weight:800;color:#fff;font-variant-numeric:tabular-nums}
.fl-eb{width:26px;height:26px;border-radius:9px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.08);color:#EAF0F9;font-size:12px;line-height:1;cursor:pointer;flex-shrink:0}
.fl-ecg-svg{width:100%;height:48px;display:block}
.fl-ecg-grid{stroke:#fff;stroke-opacity:.05;stroke-width:1}
.fl-ecg-base{fill:none;stroke:#FF3B5C;stroke-opacity:.22;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.fl-ecg-comet{fill:none;stroke:#FF3B5C;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16 84;filter:drop-shadow(0 0 6px #FF3B5C) drop-shadow(0 0 14px rgba(255,59,92,.4));animation:flSweep2 2.4s linear infinite}
@keyframes flSweep2{from{stroke-dashoffset:100}to{stroke-dashoffset:0}}

@media (prefers-reduced-motion: reduce){
  .fl-heart,.fl-ecg-comet{animation:none}
  .fl-ecg-comet{stroke-dasharray:none}
}

/* ============================================================
   الوضع الليلي — قشرة CSS تقلب هيكل الواجهة كاملاً.
   كل قاعدة تطابق أنماطاً سطرية محروسة بعزل جذور تقارير PDF:
   :not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *)
   ============================================================ */
html.night{background:#070D1E}
html.night body{background:#070D1E;color:#F2F6FD}
html.night body::before{background:
  radial-gradient(72% 48% at 88% -10%, rgba(29,58,122,.6), transparent 62%),
  radial-gradient(50% 36% at -12% 18%, rgba(196,30,58,.11), transparent 58%), #070D1E}
html.night ::selection{background:rgba(255,92,116,.28)}
html.night ::-webkit-scrollbar-thumb{background-color:rgba(159,176,204,.28)}

html.night #root .bg-white{background:#0B152E !important}
html.night #root .bg-white.rounded-2xl,
html.night #root .rounded-2xl.bg-white{border-color:rgba(148,163,184,.16);
  box-shadow:0 24px 48px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.05)}
html.night #root .rounded-3xl.overflow-hidden{border-color:rgba(148,163,184,.16);
  box-shadow:0 24px 48px -30px rgba(0,0,0,.9)}
html.night #root .h-1\.5.rounded-full{box-shadow:none}
html.night nav.fixed.bottom-0{background:rgba(8,15,32,.8) !important;
  border-top-color:rgba(148,163,184,.16) !important;
  box-shadow:0 -14px 34px -20px rgba(0,0,0,.9) !important}
html.night input,html.night select,html.night textarea{background:#0F1D3C;color:#F2F6FD;border-color:#233258}

/* — خرائط الألوان السطرية (نص) — */
html.night [style*="color: rgb(15, 30, 61)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#F2F6FD !important}
html.night [style*="color: rgb(100, 116, 139)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#9FB0CC !important}
html.night [style*="color: rgb(148, 163, 184)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#8FA0BC !important}
html.night [style*="color: rgb(196, 30, 58)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#FF7A8C !important}
html.night [style*="color: rgb(14, 138, 95)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#2DD4A0 !important}
html.night [style*="color: rgb(217, 151, 6)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#FBBF24 !important}
html.night [style*="color: rgb(155, 28, 28)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#FF8B9B !important}
html.night [style*="color: rgb(3, 84, 63)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#7CF0CB !important}
html.night [style*="color: rgb(27, 122, 61)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){color:#3BE0AE !important}

/* — خرائط الخلفيات السطرية — */
html.night [style*="background: rgb(255, 255, 255)"]:not(canvas):not(img):not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:#0B152E !important}
html.night [style*="background: rgb(247, 248, 250)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:#101E3F !important}
html.night [style*="background: rgb(245, 245, 244)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:#0F1D3C !important}
html.night [style*="background: rgb(239, 239, 239)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:#101E3F !important}
html.night [style*="background: rgb(234, 238, 245)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:#13224A !important}
html.night [style*="background: rgb(252, 232, 236)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:rgba(255,92,116,.14) !important}
html.night [style*="background: rgb(227, 244, 236)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:rgba(45,212,160,.16) !important}
html.night [style*="background: rgb(222, 247, 236)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:rgba(45,212,160,.18) !important}
html.night [style*="background: rgb(252, 240, 221)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){background:rgba(251,191,36,.16) !important}

/* — خرائط الحدود السطرية — */
html.night [style*="rgb(231, 235, 240)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){border-color:#20304F !important}
html.night [style*="rgb(207, 207, 207)"]:not(:is(#fleet-print-root,#period-print-root,#loc-print-root,#emb-print-root) *){border-color:#2A3A5F !important}

/* — عناصر v8.0 في الليل — */
html.night .fl-eb{border-color:rgba(148,163,184,.22)}

/* ---------- v7.2: نسب الإنجاز إلى صاحبه لحظة الإتمام ---------- */
.fl-whochip{display:inline-block;margin-top:6px;padding:2px 9px;border-radius:8px;font-size:10px;font-weight:800;
  background:rgba(14,138,95,.12);color:#0E8A5F;border:1px solid var(--hairline)}
html.night .fl-whochip{background:rgba(45,212,160,.14);color:#2DD4A0;border-color:rgba(148,163,184,.16)}

.fl-pickov{position:fixed;inset:0;z-index:80;background:rgba(7,13,30,.5);
  -webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);
  display:flex;align-items:flex-end;justify-content:center;padding:16px}
.fl-picksheet{width:100%;max-width:392px;background:var(--surface);border:1px solid var(--hairline);
  border-radius:20px;box-shadow:var(--sh-float);padding:16px;margin-bottom:env(safe-area-inset-bottom)}
.fl-pickttl{font-size:14px;font-weight:800;color:var(--ink);margin-bottom:4px}
.fl-pickhint{font-size:10.5px;color:var(--muted);margin-bottom:12px;line-height:1.7}
.fl-pickgrid{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.fl-pickbtn{border:1px solid var(--hairline);background:var(--inset);color:var(--ink);border-radius:12px;
  padding:9px 13px;font-size:12.5px;font-weight:800;cursor:pointer;font-family:inherit;transition:transform .12s}
.fl-pickbtn:active{transform:scale(.97)}
.fl-pickgen{background:rgba(16,38,78,.07);color:#10264E}
.fl-pickghost{width:100%;border:1px solid var(--hairline);background:none;color:var(--muted);border-radius:12px;
  padding:10px 0;font-size:12px;font-weight:800;cursor:pointer;font-family:inherit}

html.night .fl-picksheet{background:#0B152E;border-color:rgba(148,163,184,.16);
  box-shadow:0 24px 50px -20px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,255,255,.06)}
html.night .fl-pickttl{color:#F2F6FD}
html.night .fl-pickhint,html.night .fl-pickghost{color:#9FB0CC}
html.night .fl-pickbtn{background:rgba(255,255,255,.05);border-color:rgba(148,163,184,.16);color:#F2F6FD}
html.night .fl-pickgen{background:rgba(255,255,255,.09);color:#C9D6EC}
html.night .fl-pickghost{border-color:rgba(148,163,184,.16)}

/* ---------- v8.1: تقويم المهام ---------- */
.fl-cal{margin-bottom:14px}
.fl-calrow{display:flex;gap:6px;align-items:stretch}
.fl-dcall{padding:0 12px;border-radius:12px;font-size:11px;font-weight:800;font-family:inherit;cursor:pointer;background:var(--surface);color:var(--muted);border:1.5px solid var(--hairline)}
.fl-calstrip{display:flex;gap:5px;flex:1}
.fl-dc{flex:1;min-width:0;padding:7px 2px;border-radius:12px;cursor:pointer;font-family:inherit;background:var(--surface);color:var(--ink);border:1.5px solid var(--hairline);display:flex;flex-direction:column;align-items:center;gap:3px}
.fl-dcm{flex:none;padding:6px 0}
.fl-dcn{font-size:8.5px;font-weight:700;opacity:.7}
.fl-dc b{font-size:13px;font-weight:800;font-variant-numeric:tabular-nums}
.fl-dcm b{font-size:11px}
.fl-dcd{display:flex;gap:2px;height:4px}
.fl-dcd i{width:4px;height:4px;border-radius:99px;display:inline-block}
.fl-dot-a{background:#D97706}.fl-dot-r{background:#C41E3A}.fl-dot-g{background:#0E8A5F}
.fl-dct{border-color:#C41E3A}
.fl-dcs,.fl-dcall.fl-dcs{background:#10264E;color:#fff;border-color:#10264E}
.fl-dcs .fl-dcd i{background:#fff}
.fl-calmo{width:100%;margin-top:8px;padding:6px 0;border-radius:10px;font-size:10.5px;font-weight:800;font-family:inherit;cursor:pointer;background:none;border:1px dashed var(--hairline);color:var(--muted)}
.fl-calgrid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;background:var(--surface);border:1px solid var(--hairline);border-radius:16px;box-shadow:var(--sh-card);padding:12px;margin-top:8px}
.fl-calh{text-align:center;font-size:9px;font-weight:800;color:var(--muted)}
.fl-duewrap{position:relative;display:inline-flex}
.fl-duebtn{width:44px;border-radius:12px;border:1.5px solid var(--hairline);background:var(--surface);color:var(--muted);font-size:15px;cursor:pointer;font-family:inherit;font-weight:800}
.fl-dueon{background:#10264E;color:#fff;border-color:#10264E;font-variant-numeric:tabular-nums}
.fl-duepanel{position:absolute;top:calc(100% + 6px);left:0;z-index:60;display:flex;flex-wrap:wrap;gap:6px;width:248px;padding:8px;border-radius:14px;background:var(--surface);border:1px solid var(--hairline);box-shadow:var(--sh-float)}
.fl-duec{padding:6px 10px;border-radius:10px;font-size:11px;font-weight:800;font-family:inherit;cursor:pointer;background:var(--inset);color:var(--ink);border:1px solid var(--hairline)}
.fl-duecs{background:#10264E;color:#fff;border-color:#10264E}
.fl-duect{border-color:#C41E3A}
.fl-duechip{display:inline-block;margin-top:6px;margin-left:6px;padding:2px 9px;border-radius:8px;font-size:10px;font-weight:800;background:var(--inset);color:var(--muted);border:1px solid var(--hairline)}
.fl-late{background:#FCE8EC;color:#C41E3A}

html.night .fl-dcall,html.night .fl-dc,html.night .fl-duebtn,html.night .fl-duec{background:rgba(255,255,255,.05);border-color:rgba(148,163,184,.16);color:#F2F6FD}
html.night .fl-dcall{color:#9FB0CC}
html.night .fl-dot-a{background:#FBBF24}html.night .fl-dot-r{background:#FF5C74}html.night .fl-dot-g{background:#2DD4A0}
html.night .fl-dcs,html.night .fl-duecs,html.night .fl-dueon{background:#10264E;border-color:#16346B;color:#fff}
html.night .fl-dct,html.night .fl-duect{border-color:#FF5C74}
html.night .fl-calmo{border-color:rgba(148,163,184,.25);color:#9FB0CC}
html.night .fl-calgrid,html.night .fl-duepanel{background:#0B152E;border-color:rgba(148,163,184,.16)}
html.night .fl-calh{color:#9FB0CC}
html.night .fl-duechip{background:rgba(255,255,255,.05);border-color:rgba(148,163,184,.16);color:#9FB0CC}
html.night .fl-late{background:rgba(255,92,116,.14);color:#FF5C74}
