
/* ../shared/app.css */
/* ============================================================================
   لوحة القيادة التنفيذية — نظام التصميم
   ========================================================================== */

@property --p { syntax: '<number>'; initial-value: 0; inherits: false; }

:root {
  --bg:        #1A0733;
  --bg-2:      #2A0A4A;
  --grid:      rgba(255,45,101,.06);
  --panel:     rgba(55, 16, 90, .72);
  --panel-2:   rgba(72, 22, 110, .55);
  --panel-sol: #2E1050;
  --line:      rgba(255,200,230,.12);
  --line-2:    rgba(255,200,230,.22);
  --txt:       #FFF7FB;
  --txt-2:     #E8C8DC;
  --txt-3:     #C9A0BC;

  --ink:       #4F008C;
  --brand:     #FF2D55;
  --brand-2:   #7A2EA8;
  --accent:    #FF2D55;
  --gold:      #FFB81C;
  --on-brand:  #FFFFFF;
  --on-grad:   #FFFFFF;

  --ok:        #34D399;
  --warn:      #FFB81C;
  --bad:       #FF6B8A;
  --crit:      #FF2D55;
  --info:      #C084FC;

  --ok-dim:    rgba(52,211,153,.13);
  --warn-dim:  rgba(255,184,28,.14);
  --bad-dim:   rgba(255,107,138,.13);
  --crit-dim:  rgba(255,45,85,.16);
  --info-dim:  rgba(192,132,252,.13);

  /* ---- مقابض التحكم في المظهر (تُعدَّل من لوحة الأدمن) ---- */
  --glow: .30;          /* شدة التوهج: 0 = مسطّح تمامًا، 1 = نيون */
  --radius: 1;          /* معامل استدارة الحواف */
  --density: 1;         /* معامل التباعد الداخلي */
  --grid-on: 1;         /* إظهار شبكة الخلفية */
  --aura: .55;          /* شدة الهالات الخلفية */
  --font-scale: 1;      /* معامل حجم الخط */
  /* وحدة الخط: كل أحجام النصوص مضاعفات لها، فتحجيمها يسري على الواجهة كلها.
   * الاعتماد على تحجيم body وحده كان بلا أثر لأن كل عنصر يفرض حجمه المطلق. */
  --fs: calc(1px * var(--font-scale));

  --r-sm: calc(10px * var(--radius));
  --r:    calc(16px * var(--radius));
  --r-lg: calc(22px * var(--radius));
  --sh: 0 1px 2px rgba(0,0,0,.34), 0 10px 28px -18px rgba(0,0,0,.75);
  --sh-lg: 0 2px 6px rgba(0,0,0,.40), 0 26px 60px -30px rgba(0,0,0,.85);
  --nav-w: 238px;
  --font: "Dubai", "Segoe UI", "Sakkal Majalla", "Tahoma", "Noto Naskh Arabic", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

:root[data-theme="light"] {
  --primary-dark: #3B0764;
  --primary: #6D28D9;
  --primary-light: #8B5CF6;
  --secondary: #EC4899;
  --accent: #FF1F5A;
  --background: #F8F7FC;
  --card: #FFFFFF;
  --border: #E9DDF5;
  --text-main: #24123A;
  --text-muted: #8B7A9F;

  --bg:        var(--background);
  --bg-2:      #FFFFFF;
  --grid:      rgba(109,40,217,.04);
  --panel:     var(--card);
  --panel-2:   #F3EEF9;
  --panel-sol: var(--card);
  --line:      var(--border);
  --line-2:    #DCCAEB;
  --txt:       var(--text-main);
  --txt-2:     #5B4575;
  --txt-3:     var(--text-muted);

  --ink:       var(--primary-dark);
  --brand:     var(--accent);
  --brand-2:   var(--primary);
  --gold:      #C98900;
  --on-brand:  #FFFFFF;
  --on-grad:   #FFFFFF;

  --ok:        #0F7A56;
  --warn:      #A16207;
  --bad:       #C81E1E;
  --crit:      #C8104A;
  --info:      var(--primary);

  --ok-dim:    rgba(15,122,86,.10);
  --warn-dim:  rgba(201,137,0,.12);
  --bad-dim:   rgba(200,30,30,.09);
  --crit-dim:  rgba(200,16,74,.10);
  --info-dim:  rgba(109,40,181,.09);

  --sh: 0 4px 20px rgba(70, 30, 120, 0.06);
  --sh-lg: 0 8px 28px rgba(70, 30, 120, 0.10);
  --side-w: 240px;
  --r: 14px;
  --r-sm: 10px;
  --r-lg: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; min-height: 100%; }
html, body, #app { min-height: 100vh; min-height: 100dvh; }

/* لوح المظهر مثبَّت خارج الشاشة حين يكون مغلقًا، وكان يمدّ عرض التمرير
 * فيظهر شريط تمرير أفقي بلا محتوى. نقصّه على مستوى الجذر.
 * clip لا يُنشئ حاوية تمرير فيبقى position: sticky عاملًا، و hidden قبله
 * احتياط للمتصفحات التي لا تعرفه. الجداول العريضة لها حاوياتها الخاصة. */
html { overflow-x: hidden; overflow-x: clip; }

/* الأزرار العائمة في الزاويتين تتراكب مع أي شريط سفلي: زر المظهر z-index
 * أعلى من الشريط فيقف فوقه، وزر الأدوات أدنى فيختفي تحته.
 *
 * الرفع يجري من الشيفرة بنمط مضمَّن لا بقاعدة هنا. جرّبنا القاعدة بإزاحة
 * ثم بتحويل، وفي الحالتين لم تُحتسب رغم أولوية المحدد ووجودها في الورقة،
 * لأن أنماط الأداة تُحقن في نهاية الصفحة. النمط المضمَّن يعلو الجميع بيقين. */
.adm-fab, .corner-nav { transition: transform .2s ease; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--txt);
  font-size: calc(15px * var(--font-scale));
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* عناصر النموذج لا ترث الخط من الصفحة افتراضيًا، بل يفرض المتصفح مقاسه
 * الخاص (13.33 بكسل للأزرار في كروم)، فلا يطالها مقياس الخط. نجعلها ترث
 * ما لم تُحدَّد صراحة، حتى لا يفلت أي زر من التحجيم. */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* خلفية هادئة: تدرّج أساسي + هالتان خفيفتان تتبعان لون العلامة */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 88% -8%,
      color-mix(in srgb, var(--brand) calc(13% * var(--aura)), transparent), transparent 62%),
    radial-gradient(900px 520px at 4% 104%,
      color-mix(in srgb, var(--brand-2) calc(12% * var(--aura)), transparent), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: var(--grid-on);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
                    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 78%);
}

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--txt); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--txt-3); background-clip: content-box; }

/* ======================================================== شاشة التحميل === */

#boot {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--bg); transition: opacity .5s ease, visibility .5s;
}
#boot.hide { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-ring {
  width: 92px; height: 92px; margin: 0 auto 26px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, var(--brand) 72%, var(--brand-2) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
  animation: spin 1.05s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-title { font-size: calc(19 * var(--fs)); font-weight: 700; letter-spacing: .2px; }
.boot-sub { color: var(--txt-2); font-size: calc(13.5 * var(--fs)); margin-top: 7px; }

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

.shell { display: flex; min-height: 100vh; }

/* ------------------------------------------------------------- التنقل --- */

.nav {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--nav-w); height: 100vh; flex: 0 0 var(--nav-w);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  border-inline-start: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel) 0%, transparent 100%);
  backdrop-filter: blur(14px);
  z-index: 40;
}
.nav-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.nav-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--brand) 60%, transparent);
  color: var(--on-grad, #04121F); font-weight: 800; font-size: calc(15 * var(--fs));
}
.nav-name { font-weight: 700; font-size: calc(14.5 * var(--fs)); line-height: 1.3; }
.nav-name small { display: block; font-weight: 500; font-size: calc(11.5 * var(--fs)); color: var(--txt-3); letter-spacing: .3px; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 11px; cursor: pointer;
  color: var(--txt-2); font-size: calc(14 * var(--fs)); font-weight: 500;
  border: 1px solid transparent; position: relative;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
  user-select: none;
}
.nav-link:hover { background: var(--panel-2); color: var(--txt); transform: translateX(-2px); }
.nav-link.active { background: var(--panel-2); color: var(--txt); border-color: var(--line-2); }
.nav-link.active::before {
  content: ''; position: absolute; inset-inline-end: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 4px; background: linear-gradient(var(--brand), var(--brand-2));
  box-shadow: 0 0 calc(14px * var(--glow)) var(--brand);
}
.nav-link .ico { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-badge {
  margin-inline-start: auto; min-width: 20px; height: 19px; padding: 0 6px; border-radius: 99px;
  display: grid; place-items: center; font-size: calc(11 * var(--fs)); font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--line); color: var(--txt-2);
}
.nav-badge.crit { background: var(--crit-dim); color: var(--crit); animation: softPulse 2s ease-in-out infinite; }
.nav-badge.warn { background: var(--warn-dim); color: var(--warn); }

.nav-foot { margin-top: auto; padding: 12px 10px 2px; border-top: 1px solid var(--line); font-size: calc(11.5 * var(--fs)); color: var(--txt-3); }
.nav-foot b { color: var(--txt-2); font-weight: 600; }

/* ------------------------------------------------------------ المحتوى --- */

.main { flex: 1; min-width: 0; padding: 0 30px 90px; }

/* ------------------------------------------------------------ الترويسة -- */

.topbar {
  position: sticky; top: 0; z-index: 35; margin: 0 -30px 26px; padding: 14px 30px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: calc(18 * var(--fs)); font-weight: 700; letter-spacing: -.2px; }
.topbar .sub { font-size: calc(12.5 * var(--fs)); color: var(--txt-3); margin-top: 1px; }
.topbar .grow { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--txt-2); font-family: inherit; font-size: calc(13 * var(--fs)); font-weight: 600; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.btn:hover { color: var(--txt); border-color: var(--brand); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(90deg, #FF1F5A 0%, #7B00B5 100%);
  color: var(--on-grad, #fff); border-color: transparent;
  box-shadow: 0 8px 18px -10px rgba(255, 31, 90, .55);
}
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* مؤشر الاتصال الحي */
.live {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: calc(12.5 * var(--fs)); color: var(--txt-2); font-variant-numeric: tabular-nums;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.live-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ping 2s cubic-bezier(0,0,.2,1) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: .75; } 80%,100% { transform: scale(3.4); opacity: 0; } }
.live[data-state="offline"] .live-dot { background: var(--txt-3); }
.live[data-state="offline"] .live-dot::after { animation: none; }
.live[data-state="syncing"] .live-dot { background: var(--brand); }
.live[data-state="error"] .live-dot { background: var(--bad); }

/* ================================================== عناصر عامة ========== */

.section { scroll-margin-top: 86px; margin-bottom: 40px; }
.section-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
.section-head h2 {
  margin: 0; font-size: calc(16.5 * var(--fs)); font-weight: 700; letter-spacing: -.15px;
  display: flex; align-items: center; gap: 9px;
}
.section-head h2::before {
  content: ''; width: 10px; height: 10px; border-radius: 2px;
  background: var(--accent); box-shadow: none;
}
.section-head .desc { font-size: calc(12.5 * var(--fs)); color: var(--txt-3); }
.section-head .grow { flex: 1; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh); backdrop-filter: blur(12px); padding: 17px 19px; position: relative; overflow: hidden;
}
.card > h3 {
  margin: 0 0 3px; font-size: calc(13.5 * var(--fs)); font-weight: 700; color: var(--txt);
  display: flex; align-items: center; gap: 8px;
}
.card > .hint { font-size: calc(11.5 * var(--fs)); color: var(--txt-3); margin-bottom: 13px; }

.grid { display: grid; gap: 15px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 23px; padding: 0 10px;
  border-radius: 99px; font-size: calc(11.5 * var(--fs)); font-weight: 700; white-space: nowrap;
  background: var(--line); color: var(--txt-2); border: 1px solid transparent;
}
.pill.ok   { background: var(--ok-dim);   color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.pill.warn { background: var(--warn-dim); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.pill.bad  { background: var(--bad-dim);  color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.pill.crit { background: var(--crit-dim); color: var(--crit); border-color: color-mix(in srgb, var(--crit) 32%, transparent); }
.pill.info { background: var(--info-dim); color: var(--info); border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.beacon .dot { animation: softPulse 1.6s ease-in-out infinite; }

@keyframes softPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.78); } }

.num { font-variant-numeric: tabular-nums; }

/* ================================================== الشريط التنفيذي ===== */

.hero {
  display: grid; grid-template-columns: minmax(300px, 1.15fr) 2fr; gap: 15px; margin-bottom: 15px;
}

/* بطاقة الحالة العامة */
.rag-card { display: flex; gap: 20px; align-items: center; }
.rag-card.rag-red   { border-color: color-mix(in srgb, var(--crit) 42%, var(--line)); }
.rag-card.rag-amber { border-color: color-mix(in srgb, var(--warn) 42%, var(--line)); }
.rag-card.rag-green { border-color: color-mix(in srgb, var(--ok) 42%, var(--line)); }
.rag-card::after {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--rag-color, var(--ok)); box-shadow: 0 0 calc(22px * var(--glow)) 0 var(--rag-color, var(--ok));
  animation: edgeBreathe 3.4s ease-in-out infinite;
}
@keyframes edgeBreathe { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

.ring { position: relative; width: 132px; height: 132px; flex: none; overflow: visible; }
.ring .track, .ring .fill { fill: none; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--rag-color, var(--ok)); filter: drop-shadow(0 0 calc(7px * var(--glow)) var(--rag-color, var(--ok)));
  stroke-dasharray: var(--circ); stroke-dashoffset: var(--circ);
  transition: stroke-dashoffset 1.5s cubic-bezier(.16,1,.3,1); }
.ring.in .fill { stroke-dashoffset: var(--target); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center .v { font-size: calc(33 * var(--fs)); font-weight: 800; letter-spacing: -1.4px; line-height: 1; }
.ring-center .l { font-size: calc(10.5 * var(--fs)); color: var(--txt-3); margin-top: 5px; letter-spacing: .4px; }

.rag-info { min-width: 0; }
.rag-title { font-size: calc(12 * var(--fs)); color: var(--txt-3); }
.rag-value { font-size: calc(26 * var(--fs)); font-weight: 800; letter-spacing: -.6px; color: var(--rag-color); line-height: 1.25; }
.rag-reasons { margin: 9px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.rag-reasons li { font-size: calc(12.2 * var(--fs)); color: var(--txt-2); display: flex; gap: 7px; align-items: flex-start; line-height: 1.5; }
.rag-reasons li::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--rag-color); margin-top: 7px; flex: none; }

/* ------------------------------------------------------ بطاقات المؤشر --- */

.kpi {
  position: relative; padding: 15px 16px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--sh);
  backdrop-filter: blur(12px); overflow: hidden;
  opacity: 0; transform: translateY(12px);
  animation: rise .55s cubic-bezier(.16,1,.3,1) forwards; animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes rise { to { opacity: 1; transform: none; } }

.kpi::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(320px 120px at var(--mx,50%) var(--my,0%), color-mix(in srgb, var(--tone, var(--brand)) 16%, transparent), transparent 70%);
  transition: opacity .3s;
}
.kpi:hover::before { opacity: 1; }
.kpi:hover { border-color: color-mix(in srgb, var(--tone, var(--brand)) 40%, var(--line)); }

.kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kpi-label { font-size: calc(11.8 * var(--fs)); color: var(--txt-3); font-weight: 600; letter-spacing: .1px; }
.kpi-ico {
  margin-inline-start: auto; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone, var(--brand)) 14%, transparent); color: var(--tone, var(--brand));
}
.kpi-ico svg { width: 14px; height: 14px; }
.kpi-value { font-size: calc(27 * var(--fs)); font-weight: 800; letter-spacing: -1.1px; line-height: 1.1; color: var(--txt); }
.kpi-value small { font-size: calc(14 * var(--fs)); font-weight: 700; color: var(--txt-2); margin-inline-start: 2px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-size: calc(11.5 * var(--fs)); color: var(--txt-3); }
.kpi-delta { font-weight: 700; }
.kpi-delta.up { color: var(--ok); } .kpi-delta.down { color: var(--bad); }

/* شريط تقدم صغير مع لمعان متحرك */
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; position: relative; margin-top: 10px; }
.bar > i {
  display: block; height: 100%; border-radius: 99px; width: 0;
  background: linear-gradient(90deg, var(--tone, var(--brand)), color-mix(in srgb, var(--tone, var(--brand)) 55%, var(--brand-2)));
  transition: width 1.3s cubic-bezier(.16,1,.3,1);
  position: relative; overflow: hidden;
}
.bar > i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  transform: translateX(-100%); animation: sweep 2.6s ease-in-out infinite; animation-delay: 1.1s;
}
@keyframes sweep { 0% { transform: translateX(-100%); } 55%,100% { transform: translateX(220%); } }
.bar.ghost > i::after { animation: none; }
/* علامة خط الأساس المتوقع */
.bar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--txt-2); opacity: .85; border-radius: 2px; }
.bar-mark::after { content: ''; position: absolute; inset-inline-start: -3px; top: -4px; border: 4px solid transparent; border-top-color: var(--txt-2); }

/* ============================================== لوحة الإنذارات (الأعلام) = */

.ticker {
  display: flex; align-items: center; gap: 12px; margin-bottom: 15px;
  border: 1px solid color-mix(in srgb, var(--crit) 30%, var(--line));
  background: linear-gradient(90deg, var(--crit-dim), transparent 60%);
  border-radius: var(--r); padding: 9px 14px; overflow: hidden;
}
.ticker .flagico { flex: none; color: var(--crit); }
.ticker-track { flex: 1; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-move { display: inline-flex; gap: 34px; white-space: nowrap; animation: slide 44s linear infinite; }
.ticker:hover .ticker-move { animation-play-state: paused; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.ticker-item { font-size: calc(12.8 * var(--fs)); color: var(--txt-2); display: inline-flex; align-items: center; gap: 7px; }
.ticker-item b { color: var(--txt); font-weight: 700; }
.ticker-item .dot { width: 6px; height: 6px; border-radius: 50%; }

/* راية متحركة */
.flagico { width: 20px; height: 20px; transform-origin: 100% 50%; animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 0%,100% { transform: rotate(0) skewX(0); } 30% { transform: rotate(-4deg) skewX(-5deg); } 65% { transform: rotate(3deg) skewX(4deg); } }

.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.alert {
  position: relative; display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--sh);
  cursor: pointer; overflow: hidden;
  opacity: 0; transform: translateY(10px);
  animation: rise .5s cubic-bezier(.16,1,.3,1) forwards; animation-delay: calc(var(--i,0) * 45ms);
  transition: transform .16s, border-color .16s;
}
.alert:hover { transform: translateY(-2px); border-color: var(--line-2); }
.alert::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--tone); }
.alert-icon { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone) 15%, transparent); color: var(--tone); position: relative; }
.alert-icon svg { width: 15px; height: 15px; }
.alert.critical .alert-icon::after {
  content: ''; position: absolute; inset: -1px; border-radius: 10px; border: 2px solid var(--tone);
  animation: ping 1.9s cubic-bezier(0,0,.2,1) infinite;
}
.alert-body { min-width: 0; }
.alert-title { font-size: calc(13 * var(--fs)); font-weight: 700; display: flex; align-items: center; gap: 7px; }
.alert-detail { font-size: calc(12.2 * var(--fs)); color: var(--txt-2); margin-top: 3px; line-height: 1.55; }
.alert.critical { --tone: var(--crit); }
.alert.warning  { --tone: var(--warn); }
.alert.info     { --tone: var(--info); }

.empty-state { text-align: center; padding: 34px 16px; color: var(--txt-3); font-size: calc(13.5 * var(--fs)); }
.empty-state .big { font-size: calc(30 * var(--fs)); margin-bottom: 8px; }

/* ================================================== شريط المعالم ======== */

.mstrip { position: relative; padding: 44px 8px 16px; overflow-x: auto; }
.mstrip-line {
  position: absolute; inset-inline: 22px; top: 62px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--line), var(--line-2), var(--line));
}
.mstrip-prog {
  position: absolute; inset-inline-start: 22px; top: 62px; height: 3px; border-radius: 3px; width: 0;
  background: linear-gradient(90deg, var(--brand-2), var(--brand)); box-shadow: 0 0 calc(14px * var(--glow)) var(--brand);
  transition: width 1.6s cubic-bezier(.16,1,.3,1);
}
.mstrip-items { position: relative; display: flex; justify-content: space-between; gap: 14px; min-width: 620px; }
.ms { flex: 1; text-align: center; min-width: 0; position: relative; }
.ms-date { font-size: calc(11 * var(--fs)); color: var(--txt-3); margin-bottom: 9px; font-variant-numeric: tabular-nums; }
.ms-node {
  width: 21px; height: 21px; margin: 0 auto; transform: rotate(45deg); border-radius: 5px;
  background: var(--panel-sol); border: 2.5px solid var(--txt-3); position: relative; z-index: 2;
  transition: transform .3s, box-shadow .3s;
}
.ms:hover .ms-node { transform: rotate(45deg) scale(1.22); }
.ms.done .ms-node { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 calc(16px * var(--glow)) -2px var(--ok); }
.ms.next .ms-node { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 calc(20px * var(--glow)) -1px var(--warn); animation: msPulse 1.9s ease-in-out infinite; }
.ms.late .ms-node { background: var(--crit); border-color: var(--crit); box-shadow: 0 0 calc(20px * var(--glow)) -1px var(--crit); animation: msPulse 1.2s ease-in-out infinite; }
@keyframes msPulse { 0%,100% { transform: rotate(45deg) scale(1); } 50% { transform: rotate(45deg) scale(1.28); } }
.ms-name { font-size: calc(12.2 * var(--fs)); font-weight: 600; margin-top: 11px; line-height: 1.45; color: var(--txt-2); }
.ms.done .ms-name, .ms.next .ms-name { color: var(--txt); }
.ms-meta { font-size: calc(11 * var(--fs)); color: var(--txt-3); margin-top: 3px; }
.ms-owner { font-size: calc(11 * var(--fs)); color: var(--txt-3); }

/* ==================================================== الجانت ============= */

.gantt { overflow-x: auto; padding-bottom: 6px; }
.gantt-inner { min-width: 880px; position: relative; }
.gantt-head {
  display: grid; grid-template-columns: var(--label-w, 300px) 1fr; align-items: end;
  border-bottom: 1px solid var(--line); padding-bottom: 7px; margin-bottom: 9px;
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); z-index: 3;
}
.gantt-months { display: flex; position: relative; height: 22px; }
.gantt-month {
  position: absolute; top: 0; font-size: calc(11 * var(--fs)); color: var(--txt-3); font-variant-numeric: tabular-nums;
  border-inline-start: 1px solid var(--line); padding-inline-start: 6px; height: 100%; white-space: nowrap;
}
.gantt-row {
  display: grid; grid-template-columns: var(--label-w, 300px) 1fr; align-items: center;
  min-height: 34px; border-radius: 8px; transition: background .15s;
}
.gantt-row:hover { background: var(--panel-2); }
.gantt-row.phase-row { margin-top: 9px; }
.gantt-label { padding-inline-end: 14px; min-width: 0; display: flex; align-items: center; gap: 8px; }
.gantt-label .wbs { font-size: calc(10.5 * var(--fs)); color: var(--txt-3); font-family: var(--mono); flex: none; min-width: 38px; }
.gantt-label .nm { font-size: calc(12.6 * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-label .own { font-size: calc(10.5 * var(--fs)); color: var(--txt-3); margin-inline-start: auto; flex: none; }
.gantt-label.is-phase .nm { font-weight: 700; font-size: calc(13 * var(--fs)); }
.gantt-track { position: relative; height: 26px; }
.gantt-grid { position: absolute; inset: 0; pointer-events: none; }
.gantt-grid i { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--line); }

.gbar {
  position: absolute; top: 50%; transform: translateY(-50%) scaleX(0); transform-origin: right center;
  height: 15px; border-radius: 7px; min-width: 5px;
  background: color-mix(in srgb, var(--tone, var(--brand)) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--brand)) 48%, transparent);
  transition: transform 1s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i,0) * 35ms);
  overflow: hidden;
}
:root[dir="rtl"] .gbar { transform-origin: right center; }
.gantt.in .gbar { transform: translateY(-50%) scaleX(1); }
.gbar > b {
  position: absolute; inset-block: 0; inset-inline-start: 0; display: block; border-radius: 7px;
  background: linear-gradient(90deg, var(--tone, var(--brand)), color-mix(in srgb, var(--tone,var(--brand)) 60%, var(--brand-2)));
  box-shadow: 0 0 calc(12px * var(--glow)) -2px var(--tone, var(--brand));
}
.gbar.late { --tone: var(--crit); }
.gbar.done { --tone: var(--ok); }
.gbar.prog { --tone: var(--brand); }
.gbar.idle { --tone: var(--txt-3); }
.gbar.phase { height: 9px; border-radius: 4px; opacity: .8; }
.gbar-pct { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); font-size: calc(9.5 * var(--fs)); font-weight: 700; color: var(--txt); text-shadow: 0 1px 3px rgba(0,0,0,.6); }

.gms {
  position: absolute; top: 50%; width: 14px; height: 14px; margin-inline-start: -7px;
  transform: translateY(-50%) rotate(45deg) scale(0); border-radius: 3px;
  background: var(--tone, var(--warn)); box-shadow: 0 0 calc(13px * var(--glow)) -1px var(--tone, var(--warn));
  transition: transform .6s cubic-bezier(.34,1.56,.64,1); transition-delay: calc(var(--i,0) * 35ms + .3s);
}
.gantt.in .gms { transform: translateY(-50%) rotate(45deg) scale(1); }
.gms.done { --tone: var(--ok); }
.gms.late { --tone: var(--crit); animation: msPulse 1.3s ease-in-out infinite 1.4s; }

.today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); z-index: 2; pointer-events: none; opacity: .85; }
.today-line::before {
  content: 'اليوم'; position: absolute; top: -20px; right: 50%; transform: translateX(50%);
  font-size: calc(10 * var(--fs)); font-weight: 700; color: var(--crit); background: var(--bg);
  padding: 1px 6px; border-radius: 5px; border: 1px solid color-mix(in srgb, var(--crit) 45%, transparent); white-space: nowrap;
}
:root[dir="ltr"] .today-line::before { content: 'Today'; }
.today-line::after {
  content: ''; position: absolute; inset: 0; background: var(--crit); filter: blur(4px); opacity: calc(.55 * var(--glow));
  animation: edgeBreathe 2.6s ease-in-out infinite;
}

/* =================================================== مصفوفة المخاطر ===== */

.heat { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 5px; align-items: stretch; }
.heat-ax { display: grid; place-items: center; font-size: calc(11 * var(--fs)); color: var(--txt-3); font-weight: 700; }
.heat-cell {
  position: relative; aspect-ratio: 1.5 / 1; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--line); font-size: calc(11 * var(--fs)); color: var(--txt-3); font-variant-numeric: tabular-nums;
  transition: transform .18s, box-shadow .18s;
}
.heat-cell:hover { transform: scale(1.06); z-index: 2; box-shadow: var(--sh-lg); }
.heat-cell[data-band="low"]  { background: color-mix(in srgb, var(--ok) 13%, transparent);   border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.heat-cell[data-band="med"]  { background: color-mix(in srgb, var(--warn) 15%, transparent); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.heat-cell[data-band="high"] { background: color-mix(in srgb, var(--crit) 17%, transparent); border-color: color-mix(in srgb, var(--crit) 30%, transparent); }
.heat-bubble {
  min-width: 27px; height: 27px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center;
  font-size: calc(12.5 * var(--fs)); font-weight: 800; color: var(--on-brand, #06111F);
  background: var(--tone); box-shadow: 0 0 calc(18px * var(--glow)) -3px var(--tone);
  animation: bob 4.2s ease-in-out infinite; animation-delay: var(--d, 0s);
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3.5px); } }
.heat-bubble.high { animation: bob 4.2s ease-in-out infinite, hot 1.8s ease-in-out infinite; }
@keyframes hot { 0%,100% { box-shadow: 0 0 calc(16px * var(--glow)) -3px var(--tone); } 50% { box-shadow: 0 0 calc(30px * var(--glow)) 0 var(--tone); } }
.heat-lbl { font-size: calc(10.5 * var(--fs)); color: var(--txt-3); text-align: center; padding-top: 4px; }

/* =============================================== الموارد ================ */

.res { display: flex; flex-direction: column; gap: 13px; }
.res-row { display: grid; grid-template-columns: 190px 1fr auto; gap: 14px; align-items: center; }
.res-who { min-width: 0; }
.res-name { font-size: calc(13.2 * var(--fs)); font-weight: 700; display: flex; align-items: center; gap: 7px; }
.res-role { font-size: calc(11.2 * var(--fs)); color: var(--txt-3); }
.res-meter { position: relative; height: 24px; border-radius: 8px; background: var(--line); overflow: visible; }
.res-fill {
  height: 100%; border-radius: 8px; width: 0; position: relative; overflow: hidden;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 70%, transparent), var(--tone));
  transition: width 1.25s cubic-bezier(.16,1,.3,1);
}
.res-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.38), transparent); transform: translateX(-100%); animation: sweep 3s ease-in-out infinite; }
.res-cap { position: absolute; top: -4px; bottom: -4px; inset-inline-start: 100%; width: 2px; background: var(--txt-2); border-radius: 2px; }
.res-cap span { position: absolute; top: -17px; right: 50%; transform: translateX(50%); font-size: calc(9.5 * var(--fs)); color: var(--txt-3); white-space: nowrap; }
.res-pct { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); font-size: calc(11.5 * var(--fs)); font-weight: 800; color: var(--txt); text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.res-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ================================================= الجداول ============== */

.tbl-wrap { overflow-x: auto; margin: 0 -19px -17px; padding: 0 19px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: calc(12.6 * var(--fs)); min-width: 560px; }
table.tbl th {
  text-align: start; font-weight: 700; font-size: calc(11.2 * var(--fs)); color: var(--txt-3); letter-spacing: .2px;
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
  position: sticky; top: 0; background: var(--panel-sol); z-index: 1;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr { transition: background .14s; }
table.tbl tbody tr:hover { background: var(--panel-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl td.w { min-width: 220px; }
table.tbl tr.flagged { background: color-mix(in srgb, var(--crit) 7%, transparent); }
table.tbl tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
:root[dir="rtl"] table.tbl tr.flagged td:first-child { box-shadow: inset -3px 0 0 var(--crit); }

.mini { font-size: calc(11 * var(--fs)); color: var(--txt-3); }
.trunc { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* شريط داخل الجدول */
.tbar { position: relative; height: 7px; width: 84px; border-radius: 99px; background: var(--line); overflow: hidden; display: inline-block; vertical-align: middle; }
.tbar > i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; background: var(--tone, var(--brand)); width: 0; transition: width 1.1s cubic-bezier(.16,1,.3,1); }

/* ============================================ رسوم SVG صغيرة =========== */

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 152px; height: 152px; flex: none; overflow: visible; }
.donut circle { fill: none; stroke-width: 11; transition: stroke-dasharray 1.2s cubic-bezier(.16,1,.3,1); }
.legend { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: calc(12.3 * var(--fs)); }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-row .lv { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--txt-2); }

.spark { width: 100%; height: 58px; display: block; }
.spark path.area { opacity: .18; }
.spark path.line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len); transition: stroke-dashoffset 1.8s ease-out; }
.spark.in path.line { stroke-dashoffset: 0; }

/* مصفوفة أصحاب المصلحة */
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; position: relative; }
.quad-cell { border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 12px; min-height: 122px; background: var(--panel-2); }
.quad-cell h4 { margin: 0 0 9px; font-size: calc(11.8 * var(--fs)); color: var(--txt-3); font-weight: 700; }
.quad-chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px 6px; padding: 4px 10px; border-radius: 99px;
  background: var(--panel-sol); border: 1px solid var(--line-2); font-size: calc(11.8 * var(--fs));
  transition: transform .16s, border-color .16s;
}
.quad-chip:hover { transform: translateY(-2px); border-color: var(--brand); }
.quad-cell.manage { border-color: color-mix(in srgb, var(--crit) 38%, transparent); }
.quad-cell.manage h4 { color: var(--crit); }

/* بطاقة درس مستفاد */
.lesson { border-inline-start: 3px solid var(--brand-2); padding: 11px 14px; background: var(--panel-2); border-radius: var(--r-sm); }
.lesson h4 { margin: 0 0 5px; font-size: calc(12.8 * var(--fs)); }
.lesson p { margin: 0 0 4px; font-size: calc(12.2 * var(--fs)); color: var(--txt-2); line-height: 1.6; }
.lesson .rec { color: var(--txt); }

/* ================================================= أدوات مساعدة ======== */

.flash { animation: flashBg 1.5s ease-out; }
@keyframes flashBg {
  0% { background-color: color-mix(in srgb, var(--brand) 30%, transparent); }
  100% { background-color: transparent; }
}

.drop-hint {
  position: fixed; inset: 0; z-index: 150; display: none; place-items: center;
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(6px);
}
.drop-hint.on { display: grid; }
.drop-box { border: 2px dashed var(--brand); border-radius: var(--r-lg); padding: 46px 62px; text-align: center; background: var(--panel); }
.drop-box .big { font-size: calc(40 * var(--fs)); }

.toast-wrap { position: fixed; inset-block-end: 22px; inset-inline-start: 22px; z-index: 160; display: flex; flex-direction: column; gap: 9px; }
.toast {
  padding: 11px 16px; border-radius: 11px; background: var(--panel-sol); border: 1px solid var(--line-2);
  box-shadow: var(--sh-lg); font-size: calc(13 * var(--fs)); max-width: 400px;
  animation: toastIn .4s cubic-bezier(.16,1,.3,1);
}
.toast.err { border-color: color-mix(in srgb, var(--bad) 50%, transparent); color: var(--bad); }
.toast.ok  { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ================================================== الاستجابة ========== */

@media (max-width: 1500px) { .g-6 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1240px) {
  .hero { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  :root { --nav-w: 0px; }
  .nav { display: none; }
  .main { padding: 0 15px 70px; }
  .topbar { margin: 0 -15px 20px; padding: 12px 15px; }
  .g-2, .g-3, .g-6 { grid-template-columns: 1fr; }
  .res-row { grid-template-columns: 1fr; gap: 7px; }
  .res-tags { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .g-4 { grid-template-columns: 1fr; }
  .rag-card { flex-direction: column; text-align: center; }
}

@media print {
  body::before, body::after { display: none; }
  .nav, .top-actions, .ticker { display: none !important; }
  .main { padding: 0; }
  .card, .kpi { break-inside: avoid; box-shadow: none; border-color: #ccd; }
  .section { break-inside: avoid-page; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .kpi, .alert { opacity: 1; transform: none; }
  .gbar { transform: translateY(-50%) scaleX(1); }
  .gms { transform: translateY(-50%) rotate(45deg) scale(1); }
}




/* assets/task.css */
/* ============================================================================
 * task.css — لوح المهام
 * ----------------------------------------------------------------------------
 * قاعدة الحركة، مأخوذة من عطل وقع فعلًا في أداة سابقة:
 * لا تتوقّف رؤية أي بطاقة أو شريط على اكتمال حركة. ساعة الحركة لا تتقدّم حين
 * تكون الصفحة غير مرئية، فتبقى عالقة عند حالة البداية ولا تصل لنهايتها أبدًا.
 * لذلك كل ما يحمل معلومة ثابت الأبعاد، والحركة على ما لا يخفي شيئًا.
 * ========================================================================== */


/* ───────────────────── لوحة ألوان هادئة خاصة باللوح ──────────────────────
 * اللوح مليء بالبطاقات، وكل بطاقة تحمل لونًا أو اثنين. الألوان الدلالية
 * المشتركة مضبوطة على سطوع عالٍ لأنها تُستعمل في مواضع قليلة ومتباعدة، وهنا
 * تجتمع بالعشرات فتُتعب العين وتفقد معناها لأن كل شيء يصرخ.
 *
 * نمزج كل لون دلالي نحو الرمادي المحايد، فتخفت حدّته ويبقى تمييزه. الدرجة
 * الكاملة محفوظة للنقاط الصغيرة جدًا وللنص، حيث المساحة صغيرة والوضوح مطلوب.
 * والمزج يتبع اللوحة المختارة والوضع الفاتح والداكن تلقائيًا. */
:root {
  --t-crit: color-mix(in srgb, var(--crit) 64%, var(--txt-3));
  --t-bad:  color-mix(in srgb, var(--bad) 64%, var(--txt-3));
  --t-warn: color-mix(in srgb, var(--warn) 64%, var(--txt-3));
  --t-ok:   color-mix(in srgb, var(--ok) 64%, var(--txt-3));
  --t-info: color-mix(in srgb, var(--info) 64%, var(--txt-3));
  --t-brand: color-mix(in srgb, var(--brand) 70%, var(--txt-3));

  /* ألوان التعبئة منفصلة عن ألوان النص.
   * المزج نحو الرمادي هدّأ الحدّة لكنه أطفأ الألوان فبدت كئيبة. التعبئة
   * تُمزج نحو الأبيض فتصير فاتحة وهادئة معًا، والنص يبقى بدرجته الأغمق
   * لأنه يحتاج تباينًا لا هدوءًا. المساحات الكبيرة تأخذ الفاتح، والحروف
   * والحدود تأخذ الغامق. */
  --f-ok:    color-mix(in srgb, var(--ok) 52%, white);
  --f-brand: color-mix(in srgb, var(--brand) 52%, white);
  --f-bad:   color-mix(in srgb, var(--bad) 52%, white);
  --f-warn:  color-mix(in srgb, var(--warn) 52%, white);
  --f-crit:  color-mix(in srgb, var(--crit) 52%, white);
  --f-info:  color-mix(in srgb, var(--info) 52%, white);
  --f-idle:  color-mix(in srgb, var(--txt-3) 26%, white);
}

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

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

.hd { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 0 14px; }
.hd-mark { font-size: calc(26 * var(--fs)); line-height: 1; }
.brand-mark {
  display: inline-flex; align-items: center; gap: 10px; min-width: 0;
}
.brand-sq {
  width: 13px; height: 13px; border-radius: 2px; flex: none;
  background: var(--accent);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-txt b {
  font-weight: 800; font-size: calc(16.5 * var(--fs)); letter-spacing: -.4px; color: var(--ink, var(--txt));
}
.brand-txt span {
  color: var(--txt-3); font-size: calc(10.6 * var(--fs)); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.hd .brand-txt span { display: none; }
.boot-inner .brand-txt span { display: block; max-width: none; }
:root[data-theme="dark"] .brand-txt b,
:root:not([data-theme="light"]) .brand-txt b { color: #fff; }
.hd-t h1 { margin: 0; font-size: calc(19 * var(--fs)); letter-spacing: -.4px; }
.hd-t span { color: var(--txt-3); font-size: calc(12.3 * var(--fs)); }
.hd-acts { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* شريط الرؤى */
.views { display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line-2); flex-wrap: wrap; }
.views button {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 15px;
  border: none; border-radius: 9px; cursor: pointer; background: none; font-family: inherit;
  color: var(--txt-2); font-size: calc(12.8 * var(--fs)); font-weight: 600;
  transition: background .15s, color .15s;
}
.views button:hover { color: var(--txt); }
.views button.on { background: var(--panel-sol); color: var(--brand); box-shadow: var(--sh); }
.views button svg { width: 15px; height: 15px; }

/* ────────────────────────── شريط المؤشرات ─────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 11px; margin-bottom: 16px; }
.stat {
  position: relative; overflow: hidden; padding: 13px 15px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line-2);
  transition: transform .18s, border-color .18s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--brand); }
.stat::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
  background: color-mix(in srgb, var(--c, var(--brand)) 68%, transparent);
}
.stat-l { color: var(--txt-3); font-size: calc(11.6 * var(--fs)); font-weight: 600; }
.stat-v { margin-top: 6px; font-size: calc(25 * var(--fs)); font-weight: 800; line-height: 1.1;
  letter-spacing: -.9px; color: var(--c, var(--txt)); font-variant-numeric: tabular-nums; }
.stat-s { margin-top: 4px; color: var(--txt-3); font-size: calc(11.3 * var(--fs)); line-height: 1.55; }

/* شريط تقدّم رفيع أسفل البطاقة */
.stat-bar { margin-top: 9px; height: 5px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.stat-bar > i { display: block; height: 100%; width: var(--w, 0%); border-radius: 99px; background: var(--c); }

/* ─────────────────────────────── الكانبان ─────────────────────────────── */

.kb-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.kb-bar .lbl { color: var(--txt-3); font-size: calc(12.2 * var(--fs)); font-weight: 600; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 13px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--txt-2);
  font-family: inherit; font-size: calc(12.2 * var(--fs)); font-weight: 600;
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--txt); border-color: var(--brand); }
.chip.on { background: var(--info-dim); color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 34%, transparent); }

.kb { display: flex; gap: 13px; align-items: flex-start; overflow-x: auto; padding-bottom: 10px; }
.kb-col {
  flex: 0 0 288px; display: flex; flex-direction: column; gap: 9px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px; max-height: 74vh;
}
.kb-h { display: flex; align-items: center; gap: 8px; padding: 2px 3px 8px;
  border-bottom: 1px solid var(--line); }
.kb-h i { width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--txt-3)); flex: none; }
.kb-h b { font-size: calc(12.8 * var(--fs)); }
.kb-h span { margin-inline-start: auto; color: var(--txt-3); font-size: calc(11.6 * var(--fs));
  background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px;
  font-variant-numeric: tabular-nums; }
.kb-body { overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 2px; }
.kb-col.over { border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  background: color-mix(in srgb, var(--brand) 7%, transparent); }
.kb-empty { color: var(--txt-3); font-size: calc(11.8 * var(--fs)); text-align: center; padding: 16px 6px; }

/* بطاقة المهمة */
.tk {
  background: var(--panel-sol); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 11px 12px; cursor: grab; position: relative;
  border-inline-start: 3px solid color-mix(in srgb, var(--c, var(--line-2)) 62%, transparent);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.tk:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.tk:active { cursor: grabbing; }
.tk.dragging { opacity: .45; }
.tk-top { display: flex; align-items: flex-start; gap: 7px; }
.tk-code { color: var(--txt-3); font-size: calc(10.8 * var(--fs)); font-variant-numeric: tabular-nums; }
.tk-t { font-weight: 700; font-size: calc(12.9 * var(--fs)); line-height: 1.5; margin-top: 3px; }
.tk-meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.tk-date { color: var(--txt-3); font-size: calc(11 * var(--fs)); font-variant-numeric: tabular-nums; }
.tk-prog { margin-top: 9px; height: 4px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.tk-prog > i { display: block; height: 100%; width: var(--w, 0%); border-radius: 99px; background: var(--c); }

/* شارات على البطاقة: الحرج والمتأخر والعرقلة */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px;
  font-size: calc(10.6 * var(--fs)); font-weight: 700; white-space: nowrap;
  background: color-mix(in srgb, var(--c, var(--txt-3)) 12%, transparent);
  color: var(--c, var(--txt-3));
  border: 1px solid color-mix(in srgb, var(--c, var(--txt-3)) 24%, transparent);
}
/* المسار الحرج ينبض وحده: لو نبض كل شيء لم يعد النبض يعني شيئًا */
.tag.beat { animation: tagbeat 3.2s ease-in-out infinite; }
@keyframes tagbeat { 0%, 100% { opacity: 1; } 50% { opacity: .74; } }

/* أفاتار المسؤول */
.av {
  width: 25px; height: 25px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--c, var(--brand)); color: var(--on-c, #fff);
  font-size: calc(10.6 * var(--fs)); font-weight: 800;
}
.av.emoji { background: color-mix(in srgb, var(--c) 22%, transparent); font-size: calc(13 * var(--fs)); }
.who { display: inline-flex; align-items: center; gap: 6px; }
.who span { font-size: calc(11.6 * var(--fs)); color: var(--txt-2); }


/* ─────────────────── تنبيه التغييرات غير المحفوظة ────────────────────────
 * أزرق لا أحمر: هذه ليست حالة خطأ بل حالة انتظار. الأحمر يُستهلك بسرعة فيصير
 * خلفية لا يراها أحد، والأزرق يُقرأ كمعلومة تستدعي فعلًا.
 * ويحمل زر الحفظ في داخله: التنبيه الذي يقول «اضغط هناك» أضعف من الذي يتيح
 * الفعل في مكانه. */
/* بطاقة عائمة فوق الزرّين العائمين، لا شريط ملتصق بالحافة.
 * الالتصاق بالحافة كان يزاحم زر المظهر وزر الأدوات في الزاويتين، ومحاولات
 * رفعهما بقاعدة CSS أو بنمط مضمَّن لم تُحتسب. تغيير موضع الشريط نفسه يحلّ
 * المشكلة من جذرها بلا اعتماد على ترتيب الأنماط. */
.dirty {
  position: fixed; inset-block-end: 84px; inset-inline: 16px; z-index: 190;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-radius: var(--r);
  background: color-mix(in srgb, var(--info) 13%, var(--panel-sol));
  border: 1px solid color-mix(in srgb, var(--info) 42%, transparent);
  box-shadow: var(--sh-lg);
}
@media (max-width: 560px) { .dirty { inset-block-end: 78px; inset-inline: 10px; } }
.dirty-i {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--info) 20%, transparent);
  color: var(--info); font-weight: 800; font-size: calc(14 * var(--fs));
  /* توهّج خافت حول العلامة: يلفت النظر بلا أن يخفي شيئًا لو تجمّد */
  animation: dirtyGlow 2.6s ease-in-out infinite;
}
@keyframes dirtyGlow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--info) 34%, transparent); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}
.dirty-t { font-size: calc(12.8 * var(--fs)); line-height: 1.6; }
.dirty-t b { color: var(--info); }
.dirty-t span { display: block; color: var(--txt-3); font-size: calc(11.6 * var(--fs)); }
.dirty-a { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) { .dirty-a { margin-inline-start: 0; width: 100%; } }
@media print { .dirty { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .dirty-i { animation: none !important; } }


/* ═══════════════════════════════ الجانت ════════════════════════════════ */

.gt { display: flex; align-items: stretch; border: 1px solid var(--line-2);
  border-radius: var(--r); overflow: hidden; background: var(--panel); }

/* عمود الأسماء ثابت، والمحور الزمني وحده يتمرّر أفقيًا */
.gt-names { flex: 0 0 252px; border-inline-end: 1px solid var(--line-2); background: var(--panel-2); }
.gt-scroll { flex: 1; min-width: 0; overflow-x: auto; }

/* المحور الزمني يمشي من اليسار لليمين حتى في الواجهة العربية: هذا عرف أدوات
 * الجدولة، وقلبه يعني قلب كل الأسهم والحسابات بلا فائدة للقارئ. */
.gt-canvas { direction: ltr; position: relative; }

.gt-row { height: 34px; display: flex; align-items: center; box-sizing: border-box;
  border-block-end: 1px solid var(--line); }
.gt-row:last-child { border-block-end: none; }
.gt-names .gt-row { padding: 0 12px; gap: 8px; }
.gt-names .gt-row.head { background: var(--panel); font-weight: 700; }

.gt-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: calc(12.2 * var(--fs)); }
/* أفاتار المسؤول داخل صف الجانت: بلا هذا لا يعرف القارئ من يعمل على ماذا */
.gt-av { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid;
  place-items: center; font-size: calc(9.4 * var(--fs)); font-weight: 800;
  background: var(--c, var(--brand)); color: var(--on-c, #fff); }
.gt-av.emoji { background: color-mix(in srgb, var(--c) 22%, transparent); font-size: calc(11 * var(--fs)); }
.gt-av.none { background: var(--panel); border: 1px dashed var(--line-2); color: var(--txt-3); }
.gt-code { color: var(--txt-3); font-size: calc(10.6 * var(--fs)); flex: none;
  font-variant-numeric: tabular-nums; }
.gt-names .gt-row.head .gt-nm { font-size: calc(12.6 * var(--fs)); }
.gt-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; background: var(--c, var(--txt-3)); }

/* الترويسة: شهور فوق وأسابيع تحت */
.gt-head { height: 44px; position: relative; border-block-end: 1px solid var(--line-2);
  background: var(--panel-2); }
/* الشهر مقصوص داخل عموده: كان النص يفيض فيلتصق بالشهر التالي */
.gt-mo { position: absolute; top: 0; height: 22px; display: flex; align-items: center;
  padding-inline-start: 7px; font-size: calc(11.4 * var(--fs)); font-weight: 700;
  color: var(--txt-2); border-inline-start: 1px solid var(--line-2);
  white-space: nowrap; overflow: hidden; box-sizing: border-box; }
/* الرقم يقف عند اليوم الذي يسمّيه لا في منتصف كتلة أسبوعه.
 * التوسيط كان يزيح الرقم ثلاثة أيام ونصفًا إلى اليمين، فيبدو خط اليوم
 * سابقًا للرقم الذي يليه زمنيًا. علامة رأسية صغيرة تثبّت الموضع للعين. */
.gt-wk { position: absolute; top: 22px; height: 22px; display: flex; align-items: center;
  justify-content: flex-start; padding-inline-start: 4px; box-sizing: border-box;
  font-size: calc(10 * var(--fs)); color: var(--txt-3);
  border-inline-start: 1px solid var(--line); overflow: hidden; }
.gt-wk::before { content: ''; position: absolute; inset-inline-start: 0; top: 0;
  width: 1px; height: 6px; background: var(--txt-3); opacity: .55; }
.gt-names .gt-head { display: flex; align-items: flex-end; padding: 0 12px 6px;
  font-size: calc(11.4 * var(--fs)); color: var(--txt-3); font-weight: 600; }

/* خطوط الشبكة ونهايات الأسبوع */
/* شارة تاريخ اليوم فوق خطه: الترويسة صارت أسابيع لا أيامًا */
.gt-todaytag {
  position: absolute; top: 24px; transform: translateX(-50%); z-index: 6;
  padding: 1px 7px; border-radius: 99px; white-space: nowrap;
  font-size: calc(9.8 * var(--fs)); font-weight: 800;
  background: color-mix(in srgb, var(--info) 82%, transparent);
  color: var(--on-info, #fff);
}
.gt-grid { position: absolute; inset-block: 0; width: 1px; background: var(--line); }
.gt-wend { position: absolute; inset-block: 0; background: color-mix(in srgb, var(--txt-3) 4%, transparent); }
/* خط اليوم: العلامة الوحيدة الملوّنة بقوة في الخلفية، فهي مرجع القراءة */
.gt-today { position: absolute; inset-block: 0; width: 2px;
  background: color-mix(in srgb, var(--info) 62%, transparent); z-index: 3; }
.gt-today::after {
  content: ''; position: absolute; top: -1px; left: -3px; width: 8px; height: 8px;
  border-radius: 50%; background: color-mix(in srgb, var(--info) 70%, transparent);
}

/* الأشرطة */
.gt-bars { position: relative; }
.gt-bar {
  position: absolute; height: 18px; border-radius: 6px; cursor: pointer;
  background: color-mix(in srgb, var(--c, var(--brand)) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 52%, transparent);
  display: flex; align-items: center; overflow: hidden; z-index: 2;
  transition: filter .15s, box-shadow .15s;
}
.gt-bar:hover { filter: brightness(1.12); box-shadow: var(--sh); z-index: 4; }
/* التقدّم يملأ الشريط من بدايته: القياس ثابت لا تكشفه حركة */
.gt-bar > i { display: block; height: 100%; width: var(--p, 0%);
  background: color-mix(in srgb, var(--c, var(--brand)) 62%, transparent); }
.gt-bar > b { position: absolute; inset-inline-start: 7px; font-size: calc(10.2 * var(--fs));
  font-weight: 700; color: var(--txt-2); white-space: nowrap; pointer-events: none; }
/* اسم المسؤول خارج الشريط: داخله يزاحم نسبة الإنجاز في الأشرطة القصيرة */
.gt-who { position: absolute; height: 18px; display: flex; align-items: center;
  font-size: calc(10.4 * var(--fs)); color: var(--txt-3); white-space: nowrap;
  pointer-events: none; z-index: 2; }
/* المسار الحرج: إطار مصمت يميّزه بلا لون صارخ */
.gt-bar.crit { border-color: var(--t-crit); border-width: 1.5px; }
.gt-bar.done { opacity: .62; }
.gt-bar.late { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--t-bad) 55%, transparent); }

/* شريط المرحلة: أرفع وبلا تفاصيل، يلخّص مدى أبنائه */
.gt-bar.phase { height: 9px; border-radius: 4px;
  background: color-mix(in srgb, var(--c) 44%, transparent); border: none; }

/* أسهم الاعتماديات فوق كل شيء بلا التقاط للفأرة */
.gt-arrows { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: visible; }
.gt-arrows path { fill: none; stroke: var(--txt-3); stroke-width: 1.3; opacity: .5; }
.gt-arrows path.crit { stroke: var(--t-crit); opacity: .85; stroke-width: 1.7; }
.gt-arrows polygon { fill: var(--txt-3); opacity: .5; }
.gt-arrows polygon.crit { fill: var(--t-crit); opacity: .85; }

.gt-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 11px;
  color: var(--txt-3); font-size: calc(11.6 * var(--fs)); }
.gt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gt-legend i { width: 14px; height: 9px; border-radius: 3px; background: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); }
.gt-legend i.line { width: 16px; height: 2px; border-radius: 0; border: none; }

/* ──────────────────────────────── مشترك ───────────────────────────────── */

.panel { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 15px 17px; }
.panel + .panel { margin-top: 11px; }
.panel-note { color: var(--txt-2); font-size: calc(12.3 * var(--fs)); line-height: 1.8; }
.sec { margin-top: 24px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 11px; flex-wrap: wrap; }
.sec-h h2 { margin: 0; font-size: calc(15.5 * var(--fs)); letter-spacing: -.3px; }
.sec-h span { color: var(--txt-3); font-size: calc(12.1 * var(--fs)); }
.empty { color: var(--txt-3); font-size: calc(12.4 * var(--fs)); text-align: center; padding: 20px; line-height: 1.8; }

@media (max-width: 700px) {
  .wrap { padding: 0 13px 70px; }
  .kb-col { flex-basis: 246px; }
}

@media print {
  .hd-acts, .views, .kb-bar { display: none !important; }
  .kb { display: block; }
  .kb-col { max-height: none; break-inside: avoid; margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .tag.beat { animation: none !important; }
}

/* ═══════════════════════ اللوحة التنفيذية ═════════════════════════════ */

/* ───────────────────── نافذة تحرير المهمة ────────────────────────────────
 * كانت أنماطها معرّفة في أداة أخرى ولم تُنقل هنا، فظهرت النافذة صندوقًا
 * عاديًا في آخر الصفحة بدل أن تعلو فوقها. */
.sheet-back {
  position: fixed; inset: 0; z-index: 250; background: rgba(3, 7, 14, .55);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(520px, 100%); max-height: 88vh; overflow: auto;
  background: var(--panel-sol); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--sh-lg);
  animation: rise .22s cubic-bezier(.22,.8,.3,1);
}
@keyframes rise { from { transform: translateY(14px) scale(.985); opacity: 0; } }
.sheet h3 { margin: 0 0 4px; font-size: calc(16 * var(--fs)); }
.sheet .sub { color: var(--txt-3); font-size: calc(12 * var(--fs)); margin-bottom: 15px; }
.fld { margin-bottom: 12px; }
.fld label { display: block; color: var(--txt-2); font-size: calc(12.2 * var(--fs)); margin-bottom: 5px; }
.fld input, .fld select, .fld textarea {
  width: 100%; height: 38px; padding: 0 11px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt);
  font-family: inherit; font-size: calc(13 * var(--fs));
}
.fld textarea { height: 68px; padding: 9px 11px; resize: vertical; }
.fld textarea.task-desc { height: 120px; min-height: 110px; line-height: 1.55; }
.sheet.sheet-wide { width: min(560px, 100%); max-width: 560px; }
.attach-fld .attach-hint { margin: 0 0 10px; color: var(--txt-3); font-size: calc(12 * var(--fs)); }
.attach-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.attach-input { display: none; }
.attach-box { display: flex; flex-direction: column; gap: 8px; }
.attach-empty { margin: 0; color: var(--txt-3); font-size: calc(12.4 * var(--fs)); }
.attach-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2, rgba(79, 0, 140, .03));
}
.attach-thumb, .attach-ico {
  width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; background: #F3EEF8; color: #7A5D8F;
  font-size: calc(10 * var(--fs)); font-weight: 800; letter-spacing: .4px;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.attach-name {
  color: var(--txt); font-weight: 600; font-size: calc(12.8 * var(--fs));
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-size { color: var(--txt-3); font-size: calc(11.5 * var(--fs)); }
.attach-del { padding: 6px 10px; font-size: calc(12 * var(--fs)); color: var(--t-bad); }
.act-panel .act-list { display: flex; flex-direction: column; gap: 10px; }
.act-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: start;
}
.act-dot {
  width: 10px; height: 10px; margin-top: 5px; border-radius: 50%;
  background: linear-gradient(135deg, #FF1F5A, #7B00B5);
}
.act-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act-body b { font-size: calc(13 * var(--fs)); font-weight: 700; }
.act-body span { color: var(--txt-3); font-size: calc(11.8 * var(--fs)); }
.pj-dates {
  margin: 4px 0 8px;
  color: var(--txt-3);
  font-size: calc(11.8 * var(--fs));
}
.sheet-acts {
  display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 16px; padding-top: 12px; padding-bottom: 2px;
  position: sticky; bottom: -1px;
  background: var(--panel-sol);
  box-shadow: 0 -10px 16px -12px rgba(20, 8, 40, .18);
  z-index: 2;
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-back { animation: none !important; } }

/* بطاقات المراحل وحمل الفريق: قالب واحد */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 12px; }
.ph-card { padding: 14px; border-radius: var(--r-sm); background: var(--panel-2);
  border: 1px solid var(--line-2); border-block-start: 3px solid var(--c); text-align: center; }
.ph-card .ld-hd b { font-size: calc(12.9 * var(--fs)); }
.ph-add { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 12px; flex-wrap: wrap; }


/* منتقي الأفاتار: شبكة تُختار منها بضغطة. الحقل النصي كان يفترض أن
 * المستخدم يعرف كيف يُدخل إيموجي، وهو افتراض يسقط على أغلب الأجهزة. */
.av-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px; max-height: 176px; overflow: auto; padding: 4px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel-2); }
.av-opt { height: 38px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; cursor: pointer; font-size: calc(19 * var(--fs)); line-height: 1;
  display: grid; place-items: center; transition: background .14s, border-color .14s, transform .14s; }
.av-opt:hover { background: var(--panel); transform: translateY(-1px); }
.av-opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, transparent); }
.av-opt.none { font-size: calc(10.5 * var(--fs)); font-weight: 700; color: var(--txt-3); }



/* ───────────────────────── تعليمات الاستخدام ───────────────────────────── */
.acc { border: 1px solid var(--line-2); border-radius: var(--r-sm); margin-bottom: 9px; overflow: hidden; }
.acc-h { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer;
  background: var(--panel-2); user-select: none; }
.acc-h:hover { background: color-mix(in srgb, var(--brand) 7%, var(--panel-2)); }
.acc-h b { font-size: calc(13.5 * var(--fs)); flex: 1; }
.acc-h .chev { color: var(--txt-3); font-size: calc(12 * var(--fs)); transition: transform .2s; }
.acc.open .acc-h .chev { transform: rotate(180deg); }
.acc-b { display: none; padding: 16px 18px; }
.acc.open .acc-b { display: block; }

.steps { margin: 0 0 4px; padding-inline-start: 20px; }
.steps li { font-size: calc(13 * var(--fs)); line-height: 1.9; color: var(--txt-2); margin-bottom: 7px; }
.steps li b { color: var(--txt); font-weight: 700; }

.gl { display: flex; flex-direction: column; }
.gl-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line); }
.gl-row:last-child { border-bottom: none; }
.gl-t { font-size: calc(13 * var(--fs)); color: var(--txt); font-weight: 600; }
.gl-d { font-size: calc(12.8 * var(--fs)); line-height: 1.85; color: var(--txt-2); }
.gl-d b { color: var(--txt); font-weight: 700; }
@media (max-width: 620px) { .gl-row { grid-template-columns: 1fr; gap: 3px; } }

/* شبكة الألوان: نافذة اللون الأصلية في النظام تُفتح وتُغلق بلا انضباط
 * داخل نافذة منبثقة، فاستبدلناها بشبكة تُختار منها بضغطة واحدة. */
.cl-pick { display: flex; flex-wrap: wrap; gap: 7px; }
.cl-opt { width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; background: var(--c);
  transition: transform .14s, border-color .14s, box-shadow .14s; }
.cl-opt:hover { transform: scale(1.12); }
.cl-opt.on { border-color: var(--txt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 34%, transparent); }

/* بطاقات حمل الفريق */
.ld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 12px; }
.ld-card { padding: 14px; border-radius: var(--r-sm); background: var(--panel-2);
  border: 1px solid var(--line-2); text-align: center; }
.ld-hd { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 10px; }
.ld-hd b { font-size: calc(12.8 * var(--fs)); }
.ld-ring { width: 108px; height: 108px; margin: 0 auto; display: block; }
.ld-ring text.n { fill: var(--txt); font-size: 21px; font-weight: 800; text-anchor: middle; }
.ld-ring text.s { fill: var(--txt-3); font-size: 8.5px; text-anchor: middle; }
.ld-foot { margin-top: 9px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }


/* ───────────────────── قائمة منبثقة عند المرور ───────────────────────────
 * الرقم وحده لا يكفي: «3 متأخرة» تدفع المدير للسؤال أيّها. القائمة تجيب
 * قبل أن يُسأل. نسخة واحدة في body بمواضع فيزيائية صريحة، لأن
 * inset-inline-start ينقلب في RTL فيتجاوز ما يحسبه جافاسكربت. */
.pop {
  position: fixed; z-index: 400; max-width: 430px; min-width: 250px;
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--panel-sol); border: 1px solid var(--line-2); box-shadow: var(--sh-lg);
  opacity: 0; visibility: hidden; transform: translateY(5px);
  transition: opacity .14s, transform .14s, visibility .14s; pointer-events: none;
}
.pop.on { opacity: 1; visibility: visible; transform: translateY(0); }
.pop-h { font-size: calc(12.6 * var(--fs)); font-weight: 800; margin-bottom: 8px; }
.pop table { width: 100%; border-collapse: collapse; }
.pop th { text-align: start; padding: 4px 6px; color: var(--txt-3);
  font-size: calc(10.6 * var(--fs)); font-weight: 600; border-block-end: 1px solid var(--line); }
.pop td { padding: 5px 6px; font-size: calc(11.6 * var(--fs)); border-block-end: 1px solid var(--line); }
.pop tr:last-child td { border-block-end: none; }
.pop .more { color: var(--txt-3); font-size: calc(11 * var(--fs)); margin-top: 7px; }
.pop .none { color: var(--txt-3); font-size: calc(11.6 * var(--fs)); text-align: center; padding: 8px; }
.stat.has-pop { cursor: help; }

/* مفتاح ألوان الشريط المقسّم */
.lgd { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 12px;
  padding-bottom: 11px; border-block-end: 1px solid var(--line);
  color: var(--txt-3); font-size: calc(11.5 * var(--fs)); }
.lgd span { display: inline-flex; align-items: center; gap: 6px; }
.lgd i { width: 13px; height: 10px; border-radius: 3px; background: var(--c); }

/* عنق الزجاجة كبطاقات لا كجدول */
.bn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 11px; }
.bn {
  padding: 13px 14px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-inline-start: 3px solid var(--c, var(--t-warn));
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.bn:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.bn-t { font-weight: 700; font-size: calc(12.9 * var(--fs)); line-height: 1.5; }
.bn-s { color: var(--txt-3); font-size: calc(11 * var(--fs)); margin-top: 2px; }
.bn-b { display: flex; align-items: center; gap: 9px; margin-top: 11px; flex-wrap: wrap; }
/* عدّاد المحجوز: هو مربط القسم، فيأخذ أكبر وزن بصري */
.bn-n {
  display: inline-flex; align-items: center; gap: 6px; cursor: help;
  padding: 3px 11px; border-radius: 99px;
  background: color-mix(in srgb, var(--t-warn) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--t-warn) 32%, transparent);
}
.bn-n b { font-size: calc(15.5 * var(--fs)); font-weight: 800; color: var(--t-warn);
  font-variant-numeric: tabular-nums; }
.bn-n span { font-size: calc(11 * var(--fs)); color: var(--txt-2); }


.mix { flex: 1; height: 16px; border-radius: 6px; overflow: hidden; display: flex;
  background: var(--panel-2); }
.mix > i { display: block; height: 100%; background: var(--c); }

.ph-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.ph-row + .ph-row { border-block-start: 1px solid var(--line); }
.ph-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--c); }
.ph-n { width: 170px; flex: none; }
.ph-n b { display: block; font-size: calc(12.6 * var(--fs)); }
.ph-n span { color: var(--txt-3); font-size: calc(11.2 * var(--fs)); }
.ph-p { width: 46px; flex: none; text-align: end; font-weight: 800;
  font-size: calc(13 * var(--fs)); font-variant-numeric: tabular-nums; }

.big { font-weight: 800; font-size: calc(15 * var(--fs)); font-variant-numeric: tabular-nums;
  color: var(--t-warn); }

.ld-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; flex-wrap: wrap; }
.ld-row + .ld-row { border-block-start: 1px solid var(--line); }
.ld-w { width: 150px; flex: none; display: flex; align-items: center; gap: 8px;
  font-size: calc(12.4 * var(--fs)); }
.ld-b { flex: 1; min-width: 90px; height: 14px; border-radius: 5px; background: var(--panel-2);
  overflow: hidden; }
.ld-b > i { display: block; height: 100%; border-radius: 5px; background: var(--c); }
.ld-n { width: 84px; flex: none; text-align: end; color: var(--txt-2);
  font-size: calc(11.8 * var(--fs)); font-variant-numeric: tabular-nums; }

.iss { display: flex; gap: 11px; padding: 11px 0; }
.iss + .iss { border-block-start: 1px solid var(--line); }
.iss-i { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid;
  place-items: center; font-weight: 800; font-size: calc(12.5 * var(--fs));
  background: color-mix(in srgb, var(--t-warn) 16%, transparent); color: var(--t-warn); }
.iss-t { font-weight: 700; font-size: calc(12.7 * var(--fs)); }
.iss-w { color: var(--txt-2); font-size: calc(11.9 * var(--fs)); line-height: 1.7; margin-top: 2px; }
.iss-l { color: var(--txt-3); font-size: calc(11 * var(--fs)); margin-top: 3px;
  font-variant-numeric: tabular-nums; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: start; padding: 8px 10px; color: var(--txt-3);
  font-size: calc(11.4 * var(--fs)); font-weight: 600; border-block-end: 1px solid var(--line-2); }
table.t td { padding: 9px 10px; border-block-end: 1px solid var(--line);
  font-size: calc(12.3 * var(--fs)); }
table.t tbody tr:last-child td { border-block-end: none; }
table.t tbody tr { transition: background .15s; }
table.t tbody tr:hover { background: var(--panel-2); }
.tscroll { overflow-x: auto; }

@media (max-width: 700px) { .ph-n { width: 118px; } .ld-w { width: 116px; } }




/* ============================================================================
   استوديو المظهر — واجهة الأدمن (تُحمَّل في نسخة الأدمن فقط)
   ========================================================================== */

.adm {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: 340px; z-index: 300;
  display: flex; flex-direction: column;
  background: var(--panel-sol); border-inline-end: 1px solid var(--line-2);
  box-shadow: 0 0 60px -20px rgba(0,0,0,.8);
  /* الإزاحة عبر متغيّر: الانتقال يبقى بين قيمتي translateX من نفس النوع.
     الانتقال إلى transform:none لا يُستكمل بشكل موثوق من إزاحة نسبية. */
  --adm-x: -102%;
  transform: translateX(var(--adm-x));
  transition: transform .34s cubic-bezier(.16,1,.3,1);
  font-family: var(--font);
}
:root[dir="rtl"] .adm { --adm-x: 102%; }
/* يجب أن تتفوّق في التحديد على قاعدة الاتجاه أعلاه */
:root[dir] body.adm-open .adm { --adm-x: 0%; }

.adm header {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.adm header strong { font-size: calc(15 * var(--fs)); }
.adm-x {
  margin-inline-start: auto; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt-2);
  font-size: calc(19 * var(--fs)); line-height: 1;
}
.adm-x:hover { color: var(--txt); }

#adm-body { flex: 1; overflow-y: auto; padding: 6px 18px 18px; }
.adm section { padding: 15px 0; border-bottom: 1px solid var(--line); }
.adm section:last-child { border-bottom: none; }
.adm h4 {
  margin: 0 0 11px; font-size: calc(12.5 * var(--fs)); font-weight: 700; color: var(--txt);
  display: flex; align-items: center; gap: 8px;
}
.adm-hint { font-size: calc(11 * var(--fs)); color: var(--txt-3); font-weight: 500; }

.adm-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.adm-row > label { font-size: calc(12.2 * var(--fs)); color: var(--txt-2); display: flex; flex-direction: column; }

.adm-slider { display: flex; align-items: center; gap: 10px; }
.adm-slider input { flex: 1; accent-color: var(--brand); }
.adm-slider output {
  min-width: 52px; text-align: center; font-size: calc(11.5 * var(--fs)); font-variant-numeric: tabular-nums;
  color: var(--txt-2); background: var(--panel-2); border-radius: 6px; padding: 2px 6px;
}

.adm select {
  width: 100%; height: 32px; padding: 0 9px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt);
  font-family: inherit; font-size: calc(12.5 * var(--fs));
}

/* لوحات الألوان */
.adm-palettes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.adm-pal {
  display: flex; flex-direction: column; gap: 7px; padding: 10px; cursor: pointer;
  font-family: inherit; font-size: calc(12.5 * var(--fs));
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 11px;
  transition: border-color .16s, transform .16s;
}
.adm-pal:hover { transform: translateY(-2px); }
.adm-pal.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.adm-pal-dots { display: flex; gap: 4px; }
.adm-pal-dots i { width: 16px; height: 16px; border-radius: 5px; }
.adm-pal-name { font-size: calc(11.5 * var(--fs)); color: var(--txt-2); text-align: start; }

/* حوامل الألوان */
.adm-swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.adm-swatch { display: flex; align-items: center; gap: 8px; font-size: calc(11.8 * var(--fs)); color: var(--txt-2); }
.adm-swatch input[type="color"] {
  width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-2); border-radius: 7px;
  background: none; cursor: pointer;
}

/* مفتاح تبديل */
.adm-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.adm-toggle input { opacity: 0; width: 0; height: 0; }
.adm-toggle span {
  position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .2s;
}
.adm-toggle span::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 3px; inset-inline-start: 3px;
  background: #fff; transition: transform .2s;
}
.adm-toggle input:checked + span { background: var(--brand); }
.adm-toggle input:checked + span::before { transform: translateX(18px); }
:root[dir="rtl"] .adm-toggle input:checked + span::before { transform: translateX(-18px); }

/* مجموعة أزرار */
.adm-seg { display: flex; gap: 6px; }
.adm-seg button {
  flex: 1; height: 32px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: calc(12.5 * var(--fs));
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt-2);
}
.adm-seg button.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand, #06121F); font-weight: 700; }

/* أزرار */
.adm-btn {
  height: 34px; padding: 0 13px; border-radius: 9px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt-2);
  font-family: inherit; font-size: calc(12.5 * var(--fs)); font-weight: 600;
}
.adm-btn:hover { color: var(--txt); border-color: var(--brand); }
.adm-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand, #06121F); }
.adm-btn.ghost { background: none; }

.adm-note {
  margin: 0 18px 12px; padding: 11px 13px; border-radius: 10px;
  background: var(--info-dim); border: 1px solid color-mix(in srgb, var(--info) 26%, transparent);
  display: flex; flex-direction: column; gap: 4px;
}
.adm-note strong { font-size: calc(12 * var(--fs)); color: var(--info); }
.adm-note span { font-size: calc(11.5 * var(--fs)); color: var(--txt-2); line-height: 1.65; }

.adm footer {
  display: flex; gap: 7px; padding: 13px 18px; border-top: 1px solid var(--line);
  background: var(--panel-2); flex-wrap: wrap;
}
.adm footer .adm-btn:last-child { flex: 1; }

/* زر عائم */
.adm-fab {
  position: fixed; inset-block-end: 22px; inset-inline-start: 22px; z-index: 299;
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: var(--on-brand, #06121F);
  border: none; box-shadow: 0 8px 26px -8px rgba(0,0,0,.7);
  display: grid; place-items: center; transition: transform .18s;
}
.adm-fab:hover { transform: scale(1.07); }

/* نبضة تلميح لأول زيارة فقط، حتى لا يضيع الزر عن المستخدم */
body.adm-hint .adm-fab { animation: admPing 2.2s ease-out infinite; }
@keyframes admPing {
  0%   { box-shadow: 0 8px 26px -8px rgba(0,0,0,.7), 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); }
  70%  { box-shadow: 0 8px 26px -8px rgba(0,0,0,.7), 0 0 0 18px transparent; }
  100% { box-shadow: 0 8px 26px -8px rgba(0,0,0,.7), 0 0 0 0 transparent; }
}
body.adm-hint .adm-fab::after {
  content: 'غيّر الألوان من هنا';
  position: absolute; inset-inline-start: 62px; top: 50%; transform: translateY(-50%);
  background: var(--panel-sol); color: var(--txt); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 13px; font-size: calc(12.5 * var(--fs)); font-weight: 600;
  white-space: nowrap; box-shadow: 0 6px 20px -8px rgba(0,0,0,.6); font-family: var(--font);
}
:root[dir="ltr"] body.adm-hint .adm-fab::after { content: 'Change colors here'; }
@media (prefers-reduced-motion: reduce) { body.adm-hint .adm-fab { animation: none; } }
.adm-fab svg { width: 23px; height: 23px; }
body.adm-open .adm-fab { transform: translateX(-352px); }
:root[dir="rtl"] body.adm-open .adm-fab { transform: translateX(352px); }

/* نافذة النشر */
.adm-dialog {
  border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel-sol); color: var(--txt);
  max-width: 560px; padding: 22px; font-family: var(--font);
}
.adm-dialog::backdrop { background: rgba(0,0,0,.6); }
.adm-dialog h3 { margin: 0 0 10px; font-size: calc(16 * var(--fs)); }
.adm-dialog p { font-size: calc(13 * var(--fs)); color: var(--txt-2); line-height: 1.7; margin: 0 0 10px; }
.adm-cmd {
  direction: ltr; text-align: left; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 13px; font-family: var(--mono); font-size: calc(11.8 * var(--fs));
  overflow-x: auto; margin: 0 0 12px; color: var(--txt-2); max-height: 240px;
}
.adm-dialog form { text-align: end; margin-top: 12px; }
.adm-dialog details summary { cursor: pointer; font-size: calc(12 * var(--fs)); color: var(--txt-3); margin-bottom: 8px; }

/* بوابة الدخول */
.adm-gate {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  background: var(--bg); font-family: var(--font);
}
.adm-gate form {
  width: min(360px, 90vw); padding: 28px; border-radius: 18px;
  background: var(--panel-sol); border: 1px solid var(--line-2); text-align: center;
}
.adm-gate h3 { margin: 0 0 6px; font-size: calc(18 * var(--fs)); }
.adm-gate input {
  width: 100%; height: 40px; margin: 16px 0 8px; padding: 0 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt);
  font-family: inherit; font-size: calc(14 * var(--fs)); text-align: center;
}
.adm-gate .adm-btn { width: 100%; height: 40px; }
.adm-err { color: var(--bad); font-size: calc(12 * var(--fs)); min-height: 18px; margin-bottom: 6px; }

@media (max-width: 720px) {
  .adm { width: 100%; }
  body.adm-open .adm-fab { display: none; }
}
@media print { .adm, .adm-fab { display: none !important; } }




/* صف مرن بدل تثبيت كل زر بمسافة محسوبة يدويًا: عرض النص يختلف بين
 * اللغتين، والمسافة الثابتة كانت تجعل الزرّين يتراكبان. */
.corner-nav{position:fixed;inset-block-end:22px;inset-inline-end:22px;z-index:150;
 display:flex;align-items:center;gap:10px}
@media print{.corner-nav{display:none}}
.lang-switch{display:flex;align-items:center;height:44px;padding:0 16px;border-radius:99px;
 text-decoration:none;background:var(--panel-sol);border:1px solid var(--line-2);color:var(--txt-2);
 font-family:var(--font);font-size:calc(13.5px * var(--font-scale));font-weight:600;box-shadow:var(--sh);
 transition:color .18s,border-color .18s,transform .18s}
.lang-switch:hover{color:var(--txt);border-color:var(--brand);transform:translateY(-2px)}
.tool-switch{display:flex;align-items:center;gap:8px;height:44px;padding:0 16px;
 border-radius:99px;text-decoration:none;
 background:var(--panel-sol);border:1px solid var(--line-2);color:var(--txt-2);
 font-family:var(--font);font-size:calc(13.5px * var(--font-scale));font-weight:600;box-shadow:var(--sh);
 /* لا نستعمل all: كانت تُحرِّك حجم الخط أيضًا فيتمطّط عند تغيير مقياس الخط */
 transition:color .18s,border-color .18s,transform .18s,box-shadow .18s}
.tool-switch:hover{color:var(--txt);border-color:var(--brand);transform:translateY(-2px)}
.tool-switch svg{width:17px;height:17px}
.tool-switch i{font-style:normal;font-size:calc(11px * var(--font-scale));background:var(--brand);color:var(--on-brand,#06121F);
 min-width:18px;height:18px;border-radius:99px;display:grid;place-items:center;font-weight:700}
@media print{.tool-switch{display:none}}


/* ===== Ageed login — abstract aurora backdrop + centered card ===== */
html:has(.login-page),
body:has(.login-page) {
  height: 100%;
  overflow: auto;
}
body:has(.login-page) {
  background: #160428;
}
body:has(.login-page)::before,
body:has(.login-page)::after { display: none; }

.login-page {
  position: relative;
  isolation: isolate;
  direction: ltr;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px 20px;
  box-sizing: border-box;
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.login-bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(18, 4, 36, .18), rgba(10, 2, 24, .52) 78%),
    linear-gradient(180deg, rgba(12, 2, 28, .12) 0%, rgba(12, 2, 28, .38) 100%);
}

.login-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
}

.login-brand {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  padding: 0 4px;
  color: #fff;
  text-align: center;
  direction: ltr;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35);
}
.login-brand .brand-sq {
  width: 18px;
  height: 18px;
  margin-top: 10px;
  flex: 0 0 auto;
  background: #FF1F5A;
  border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(255, 31, 90, .22);
}
.login-brand .brand-txt {
  min-width: 0;
  gap: 6px;
  align-items: center;
}
.login-brand .brand-txt b {
  display: block;
  color: #fff;
  font-size: calc(30 * var(--fs));
  font-weight: 800;
  letter-spacing: -.3px;
  line-height: 1.2;
}
.login-brand .brand-txt span {
  display: block;
  max-width: none;
  white-space: normal;
  color: rgba(255, 245, 255, .88);
  font-size: calc(15 * var(--fs));
  font-weight: 500;
  line-height: 1.45;
}

.login-card {
  width: 100%;
  padding: 36px 32px 32px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(8, 0, 24, .38);
}

.login-copy {
  margin: 4px 0 0;
  text-align: center;
  color: rgba(255, 245, 255, .82);
  font-size: calc(12.4 * var(--fs));
  font-weight: 600;
  letter-spacing: .2px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
}

.login-lang {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin: 0 0 28px;
}
.login-page .lang-pills {
  background: #F0EAF6;
  border-color: rgba(79, 0, 140, .12);
}
.login-page .lang-pill { color: #7A5D8F; }
.login-page .lang-pill.on {
  background: #fff;
  color: #FF1F5A;
  box-shadow: 0 1px 4px rgba(79, 0, 140, .08);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: calc(28 * var(--fs));
  font-weight: 800;
  letter-spacing: -.4px;
  color: #4F008C;
  line-height: 1.2;
}
.login-card .sub {
  color: #7A5D8F;
  font-size: calc(13.6 * var(--fs));
  margin: 0 0 26px;
  line-height: 1.65;
}
.login-card > label {
  display: block;
  font-size: calc(12.8 * var(--fs));
  font-weight: 700;
  margin: 0 0 7px;
  color: #3A1A5C;
}

.login-field {
  position: relative;
  margin-bottom: 16px;
}
.login-field .login-ico {
  position: absolute;
  inset-inline-start: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9B7FB3;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.login-field .login-ico svg { width: 18px; height: 18px; }

.login-card input[type=text],
.login-card input[type=password] {
  width: 100%;
  height: 52px;
  padding: 0 44px;
  border-radius: 14px;
  margin: 0;
  background: #F3EEF8;
  border: 1px solid rgba(79, 0, 140, .14);
  color: #2A1248;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.login-card input[type=text]::placeholder,
.login-card input[type=password]::placeholder {
  color: #A38DB8;
}
.login-card input[type=text]:focus,
.login-card input[type=password]:focus {
  outline: none;
  border-color: #7B00B5;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(123, 0, 181, .16);
}

.login-eye {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #9B7FB3;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.login-eye:hover { color: #4F008C; background: rgba(79, 0, 140, .06); }
.login-eye svg { width: 18px; height: 18px; }

.login-card input[type=checkbox] { accent-color: #FF1F5A; width: 16px; height: 16px; }
.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 22px;
  font-size: calc(13 * var(--fs));
  color: #5A3A72;
  font-weight: 500;
  cursor: pointer;
}

.login-card .btn.login-submit,
.login-submit {
  width: 100%;
  height: 52px;
  justify-content: center;
  border: none;
  border-radius: 14px;
  font-size: calc(16 * var(--fs));
  font-weight: 700;
  letter-spacing: .2px;
  color: #fff !important;
  background: linear-gradient(90deg, #FF1F5A 0%, #7B00B5 100%) !important;
  box-shadow: 0 12px 28px -10px rgba(255, 31, 90, .55);
}
.login-submit:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.login-err {
  background: rgba(200, 16, 74, .08);
  color: #C8104A;
  border: 1px solid rgba(200, 16, 74, .22);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: calc(12.8 * var(--fs));
}

@media (max-width: 520px) {
  .login-page { padding: 16px 12px; }
  .login-panel { gap: 16px; }
  .login-brand .brand-txt b { font-size: calc(22 * var(--fs)); }
  .login-brand .brand-txt span { font-size: calc(13 * var(--fs)); }
  .login-card { padding: 26px 18px 22px; }
  .login-card h1 { font-size: calc(24 * var(--fs)); }
}

@media (max-height: 700px) {
  .login-card { padding: 24px 26px 22px; }
  .login-card h1 { font-size: calc(22 * var(--fs)); }
  .login-lang { margin-bottom: 16px; }
}
.users-tbl { width: 100%; border-collapse: collapse; }
.users-tbl th, .users-tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: start; font-size: calc(13 * var(--fs)); }
.ld-list { display: flex; flex-direction: column; }
.ld-nums { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini { font-size: calc(11.2 * var(--fs)); color: var(--txt-3); }

/* ===== قائمة المشاريع ===== */
.pj-home { padding-bottom: 20px; }
.app-copy {
  margin: 28px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--border, #E9DDF5);
  text-align: center;
  color: var(--txt-3);
  font-size: calc(12.2 * var(--fs));
  font-weight: 600;
  letter-spacing: .2px;
}
.pj-lead {
  margin: 0 0 18px; color: var(--txt-2); font-size: calc(13.4 * var(--fs)); line-height: 1.75; max-width: 46rem;
}
.pj-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}
.pj-card {
  display: flex; flex-direction: column; align-items: stretch; text-align: start;
  padding: 18px 16px 14px; border-radius: var(--r-lg, 16px);
  background: var(--panel); border: 1px solid var(--line-2); cursor: pointer;
  font-family: inherit; color: inherit; box-shadow: var(--sh);
  position: relative; overflow: hidden; min-height: 148px;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.pj-card::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline: 0; height: 4px;
  background: var(--c, var(--brand));
}
.pj-card:hover { transform: translateY(-3px); border-color: var(--c, var(--brand)); }
.pj-icon {
  width: 44px; height: 44px; border-radius: 12px; margin-top: 6px;
  background: color-mix(in srgb, var(--c, var(--brand)) 18%, var(--panel-2));
  color: var(--c, var(--brand));
  display: grid; place-items: center; overflow: hidden;
  font-size: calc(17 * var(--fs)); font-weight: 800; letter-spacing: -.3px;
  border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 28%, transparent);
  flex-shrink: 0;
}
.pj-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-icon.sm { width: 32px; height: 32px; border-radius: 9px; font-size: calc(13 * var(--fs)); }
.pj-icon-picker {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.pj-icon-preview {
  width: 72px; height: 72px; border-radius: 16px;
  background: color-mix(in srgb, var(--c, var(--brand)) 18%, var(--panel-2));
  color: var(--c, var(--brand));
  display: grid; place-items: center; overflow: hidden;
  font-size: 28px; font-weight: 800;
  border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 28%, transparent);
  flex-shrink: 0;
}
.pj-icon-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-icon-actions { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.pj-acts {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.pj-act {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border, #E9DDF5);
  background: #fff;
  color: var(--txt-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 4px 12px rgba(70, 30, 120, .08);
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.pj-act svg { width: 15px; height: 15px; }
.pj-act:hover { transform: translateY(-1px); color: var(--primary-dark, #4F008C); border-color: rgba(79, 0, 140, .25); }
.pj-act.del:hover { color: #C8104A; border-color: rgba(200, 16, 74, .28); background: rgba(200, 16, 74, .06); }
.pj-name { font-size: calc(16.5 * var(--fs)); font-weight: 800; letter-spacing: -.3px; margin-top: 4px; padding-inline-end: 76px; }
.pj-mgr { margin-top: 6px; color: var(--txt-3); font-size: calc(12.4 * var(--fs)); }
.pj-bar { margin-top: auto; padding-top: 16px; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.pj-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--brand)); }
.pj-nums {
  display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px;
  color: var(--txt-3); font-size: calc(11.8 * var(--fs)); font-weight: 600;
}
.pj-late { color: var(--t-bad, var(--bad)); }
.pj-card.pj-add {
  border-style: dashed; background: color-mix(in srgb, var(--panel) 70%, transparent);
  box-shadow: none; justify-content: center; align-items: center; text-align: center;
}
.pj-card.pj-add::before { display: none; }
.pj-plus {
  width: 42px; height: 42px; border-radius: 99px; display: grid; place-items: center;
  background: var(--panel-2); font-size: calc(22 * var(--fs)); font-weight: 700; color: var(--brand); margin-bottom: 8px;
}
.pj-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.pj-sw {
  width: 26px; height: 26px; border-radius: 99px; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.pj-sw.on { border-color: var(--txt); outline: 2px solid var(--panel-sol); }
.lang-pills {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2);
}
.lang-pill {
  height: 28px; padding: 0 10px; border: none; border-radius: 8px; background: none;
  cursor: pointer; font-family: inherit; font-size: calc(12 * var(--fs)); font-weight: 700;
  color: var(--txt-2); text-decoration: none; display: inline-flex; align-items: center;
}
button.lang-pill { appearance: none; }
.lang-pill.on { background: var(--panel-sol); color: var(--brand); box-shadow: var(--sh); }
.pj-sw.on { border-color: var(--txt); outline: 2px solid var(--panel-sol); }
.hook-box { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 8px; }
.hook-hint { margin: 0; color: var(--txt-3); font-size: calc(12 * var(--fs)); line-height: 1.7; }
.hook-check { display: flex; align-items: center; gap: 8px; font-size: calc(13 * var(--fs)); font-weight: 600; }
.hook-row { display: flex; gap: 8px; align-items: center; }
.hook-row input, .hook-box input[type=url], .hook-box input.hook-in {
  flex: 1; direction: ltr; text-align: left; font-family: var(--mono, ui-monospace, Consolas, monospace);
  font-size: calc(12.2 * var(--fs));
}
@media (max-width: 720px) {
  .pj-grid { grid-template-columns: 1fr; }
}

/* ── لوحة القيادة: صحة + اعمل الآن + نافذة الأسبوع ── */
.hz {
  display: flex; gap: 18px; align-items: stretch; margin-bottom: 14px;
  padding: 16px 18px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--panel); position: relative; overflow: hidden;
}
.hz::before {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
  background: var(--hz, var(--t-ok));
}
.hz-ok { --hz: var(--t-ok); }
.hz-watch { --hz: var(--t-warn); }
.hz-risk { --hz: var(--t-bad); }
.hz-idle { --hz: var(--txt-3); }
.hz-score { min-width: 92px; display: flex; flex-direction: column; justify-content: center; }
.hz-n {
  font-size: calc(42 * var(--fs)); font-weight: 800; letter-spacing: -1.6px; line-height: .95;
  color: var(--hz, var(--txt)); font-variant-numeric: tabular-nums;
}
.hz-l { margin-top: 4px; color: var(--txt-3); font-size: calc(11.4 * var(--fs)); font-weight: 600; }
.hz-body { flex: 1; min-width: 0; }
.hz-tone { font-weight: 800; font-size: calc(15.5 * var(--fs)); }
.hz-hint { margin: 6px 0 0; color: var(--txt-2); font-size: calc(12.6 * var(--fs)); line-height: 1.7; max-width: 46rem; }
.hz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hz-chip {
  height: 26px; padding: 0 10px; border-radius: 99px; display: inline-flex; align-items: center;
  font-size: calc(11.4 * var(--fs)); font-weight: 700; color: var(--txt-2);
  background: var(--panel-2); border: 1px solid var(--line-2);
}
.dash-split {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; align-items: start;
  margin: 4px 0 8px;
}
.dash-split > .sec { margin-top: 0; }
.fx-row {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 10px 8px; border: none; border-radius: 10px; cursor: pointer;
  background: none; color: inherit; font-family: inherit; text-align: start;
}
.fx-row + .fx-row { border-block-start: 1px solid var(--line); }
.fx-row:hover { background: var(--panel-2); }
.fx-why { flex: none; margin-top: 2px; }
.fx-main { min-width: 0; flex: 1; }
.fx-title { font-weight: 700; font-size: calc(13 * var(--fs)); line-height: 1.45; }
.fx-meta { margin-top: 2px; color: var(--txt-3); font-size: calc(11.2 * var(--fs)); }
.wk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wk-col {
  padding: 12px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line);
}
.wk-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.wk-h b { font-size: calc(12.8 * var(--fs)); }
.wk-h span { color: var(--txt-3); font-size: calc(11.6 * var(--fs)); font-weight: 700; font-variant-numeric: tabular-nums; }
.pj-health {
  align-self: flex-start; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: calc(10.6 * var(--fs)); font-weight: 800; display: inline-flex; align-items: center;
  margin-bottom: 6px;
}
.pj-health.ok { color: var(--t-ok); background: color-mix(in srgb, var(--t-ok) 14%, transparent); }
.pj-health.watch { color: var(--t-warn); background: color-mix(in srgb, var(--t-warn) 16%, transparent); }
.pj-health.risk { color: var(--t-bad); background: color-mix(in srgb, var(--t-bad) 16%, transparent); }
.pj-health.idle { color: var(--txt-3); background: var(--panel-2); }
@media (max-width: 980px) {
  .dash-split, .wk-grid { grid-template-columns: 1fr; }
  .hz { flex-direction: column; gap: 8px; }
}


/* ===== Ageed app shell (sidebar + topbar + dashboard) ===== */
:root[data-theme="light"] body {
  background: var(--background, #F8F7FC);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(900px 480px at 100% 0%, rgba(236,72,153,.07), transparent 55%),
    radial-gradient(700px 420px at 0% 100%, rgba(109,40,217,.06), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
:root[data-theme="light"] .btn.primary,
:root[data-theme="light"] .login-submit {
  background: linear-gradient(90deg, #FF1F5A 0%, #7B00B5 100%) !important;
  color: #fff !important;
  border: none;
}
:root[data-theme="light"] .panel,
:root[data-theme="light"] .stat,
:root[data-theme="light"] .pj-card,
:root[data-theme="light"] .sheet,
:root[data-theme="light"] .kb-col,
:root[data-theme="light"] .hz {
  background: var(--card, #fff);
  border: 1px solid var(--border, #E9DDF5);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(70, 30, 120, 0.06);
}

.app-shell {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  padding-inline-start: var(--side-w, 240px);
  box-sizing: border-box;
}
.app-shell.side-collapsed { --side-w: 76px; }
.app-shell.side-collapsed .side-label,
.app-shell.side-collapsed .side-brand span,
.app-shell.side-collapsed .side-foot span { display: none; }
.app-shell.side-collapsed .side-brand { justify-content: center; padding-inline: 0; }
.app-shell.side-collapsed .side-link { justify-content: center; padding-inline: 0; }

.side {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: var(--side-w, 240px);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #3B0764 0%, #4C1D95 55%, #5B21B6 100%);
  color: #fff;
  padding: 18px 12px;
  z-index: 40;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 18px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.side-brand .brand-sq { width: 14px; height: 14px; background: #FF1F5A; border-radius: 3px; }
.side-brand b { font-size: calc(14.5 * var(--fs)); font-weight: 800; color: #fff; letter-spacing: -.3px; line-height: 1.25; }
.side-brand span { display: block; font-size: calc(10.2 * var(--fs)); color: rgba(255,255,255,.65); font-weight: 600; line-height: 1.3; max-width: 168px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; padding-top: 8px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 12px; border: none; border-radius: 11px;
  background: transparent; color: rgba(255,255,255,.78);
  font-family: inherit; font-size: calc(13.2 * var(--fs)); font-weight: 600;
  cursor: pointer; text-align: start; width: 100%;
  transition: background .18s, color .18s, transform .15s;
}
.side-link svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-link.on {
  background: linear-gradient(90deg, rgba(255,31,90,.92), rgba(139,92,246,.85));
  color: #fff; box-shadow: 0 8px 20px -10px rgba(255,31,90,.55);
}
.side-sep { height: 1px; background: rgba(255,255,255,.1); margin: 10px 8px; }
.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: 4px; }
.side-toggle {
  display: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; align-items: center; justify-content: center;
}

.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar-ageed {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(248, 247, 252, .97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border, #E9DDF5);
  box-shadow: 0 8px 24px -18px rgba(59, 7, 100, .35);
}
.top-search {
  flex: 1; min-width: 180px; max-width: 420px; height: 40px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-radius: 11px;
  background: #fff; border: 1px solid var(--border, #E9DDF5);
}
.top-search svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.top-search input {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: inherit; font-size: calc(13 * var(--fs)); color: var(--txt);
  min-width: 0;
}
.top-acts { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; }
.top-logout { margin: 0; display: inline-flex; }
.top-logout-btn {
  color: #C8104A !important;
  border-color: rgba(200, 16, 74, .22) !important;
  background: #fff !important;
}
.top-logout-btn:hover {
  background: rgba(200, 16, 74, .08) !important;
}
.top-logout-btn svg { width: 16px; height: 16px; }
.top-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 99px;
  background: #fff; border: 1px solid var(--border, #E9DDF5);
}
.top-user .av { width: 32px; height: 32px; font-size: 12px; }
.top-user b { font-size: calc(12.6 * var(--fs)); display: block; line-height: 1.2; }
.top-user span { font-size: calc(10.8 * var(--fs)); color: var(--txt-3); }
.menu-fab {
  display: none; width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  align-items: center; justify-content: center; color: var(--primary-dark);
}
.menu-fab svg { width: 18px; height: 18px; }

.app-content { padding: 18px 22px 40px; max-width: 1560px; width: 100%; margin: 0 auto; box-sizing: border-box; overflow-x: auto; }
.app-content .wrap { max-width: none; padding: 0; margin: 0; }

.dash-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-hello h1 { margin: 0; font-size: calc(24 * var(--fs)); font-weight: 800; color: var(--primary-dark); letter-spacing: -.4px; }
.dash-hello p { margin: 6px 0 0; color: var(--txt-3); font-size: calc(13.4 * var(--fs)); line-height: 1.6; }
.proj-crumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  color: var(--primary); font-weight: 700; font-size: calc(12.2 * var(--fs)); margin-bottom: 4px;
}
.crumb-link {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--primary); font: inherit; font-weight: 700; text-decoration: underline;
  text-underline-offset: 2px;
}
.crumb-sep { color: var(--txt-3); font-weight: 600; }
.sub-card { min-height: 132px; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px;
}
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 15px; box-shadow: 0 4px 20px rgba(70,30,120,.06);
  display: flex; flex-direction: column; gap: 6px; min-height: 108px;
}
.kpi-ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--kc, var(--primary)) 14%, #fff);
  color: var(--kc, var(--primary));
}
.kpi-ico svg { width: 17px; height: 17px; }
.kpi-l { color: var(--txt-3); font-size: calc(11.8 * var(--fs)); font-weight: 600; }
.kpi-v { font-size: calc(26 * var(--fs)); font-weight: 800; color: var(--txt); letter-spacing: -.8px; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-s { color: var(--txt-3); font-size: calc(11.2 * var(--fs)); }

.dash-grid-2 {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-bottom: 14px;
}
.dash-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 17px; box-shadow: 0 4px 20px rgba(70,30,120,.06); min-width: 0;
}
.dash-card h3 { margin: 0 0 4px; font-size: calc(15 * var(--fs)); font-weight: 800; color: var(--primary-dark); }
.dash-card .sub { margin: 0 0 14px; color: var(--txt-3); font-size: calc(12.2 * var(--fs)); }
.prog-rows { display: flex; flex-direction: column; gap: 12px; }
.prog-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.prog-row b { font-size: calc(12.6 * var(--fs)); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-row span { font-size: calc(11.6 * var(--fs)); font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.prog-bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: #F0EAF7; overflow: hidden; }
.prog-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FF1F5A, #7B00B5); }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-leg { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 120px; }
.donut-leg div { display: flex; align-items: center; gap: 8px; font-size: calc(12.2 * var(--fs)); color: var(--txt-2); }
.donut-leg i { width: 10px; height: 10px; border-radius: 99px; background: var(--c); flex: none; }
.donut-leg b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }

.act-list { display: flex; flex-direction: column; }
.act-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.act-item:last-child { border-bottom: none; }
.act-dot {
  width: 28px; height: 28px; border-radius: 99px; flex: none;
  display: grid; place-items: center; font-size: 12px;
  background: color-mix(in srgb, var(--primary) 12%, #fff); color: var(--primary);
}
.act-t { font-size: calc(12.8 * var(--fs)); font-weight: 700; color: var(--txt); }
.act-s { font-size: calc(11.4 * var(--fs)); color: var(--txt-3); margin-top: 2px; }

.proj-tabs {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); margin-bottom: 14px; width: fit-content; max-width: 100%;
}
.proj-tabs button {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border: none; border-radius: 9px; cursor: pointer; background: none; font-family: inherit;
  color: var(--txt-2); font-size: calc(12.6 * var(--fs)); font-weight: 600;
  transition: background .15s, color .15s;
}
.proj-tabs button.on { background: linear-gradient(90deg, rgba(255,31,90,.12), rgba(109,40,217,.12)); color: var(--primary-dark); }
.proj-tabs button svg { width: 15px; height: 15px; }

.side-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(36,18,58,.45); z-index: 45;
}
body.side-open .side-backdrop { display: block; }

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .app-content { padding: 16px 16px 36px; }
}
@media (max-width: 1100px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
  .app-shell { --side-w: 76px; }
  .app-shell .side-label,
  .app-shell .side-brand span { display: none; }
  .app-shell .side-brand { justify-content: center; }
  .app-shell .side-link { justify-content: center; padding-inline: 0; }
  .top-user > div { display: none; }
}
@media (max-width: 820px) {
  .app-shell {
    padding-inline-start: 0;
  }
  .side {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(280px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 50;
  }
  html[dir="rtl"] .side { transform: translateX(105%); }
  body.side-open .side { transform: translateX(0); }
  .menu-fab { display: inline-flex; }
  .app-content { padding: 12px 12px 32px; }
  .topbar-ageed { padding: 10px 12px; }
  .top-search { max-width: none; min-width: 0; flex: 1 1 160px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-hello h1 { font-size: calc(20 * var(--fs)); }
  .pj-grid { grid-template-columns: 1fr; }
  .ph-tl { overflow-x: auto; }
  .users-tbl { display: block; overflow-x: auto; }
  .sheet-back { padding: 10px; align-items: end; }
  .sheet { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .top-acts .btn span { display: none; }
  .top-logout-btn span { display: none; }
  .proj-tabs { width: 100%; }
  .proj-tabs button { flex: 1; justify-content: center; }
}

/* Phase horizontal timeline */
.ph-tl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  position: relative;
  margin-top: 8px;
}
.ph-tl::before {
  content: '';
  position: absolute;
  inset-inline: 24px;
  top: 28px;
  height: 2px;
  background: linear-gradient(90deg, #E9DDF5, #C4B5FD, #E9DDF5);
  z-index: 0;
}
.ph-tl-card {
  position: relative; z-index: 1;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; margin: 8px 6px; box-shadow: 0 4px 20px rgba(70,30,120,.06);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.ph-tl-ico {
  width: 40px; height: 40px; border-radius: 99px; color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--border);
  margin-bottom: 4px;
}
.ph-tl-dates { font-size: calc(11.4 * var(--fs)); color: var(--txt-3); }
.ph-st {
  display: inline-flex; align-self: flex-start; padding: 3px 9px; border-radius: 99px;
  font-size: calc(10.8 * var(--fs)); font-weight: 700;
}
.ph-st.done { background: rgba(15,122,86,.1); color: var(--ok); }
.ph-st.doing { background: rgba(109,40,217,.1); color: var(--primary); }
.ph-st.upcoming { background: rgba(139,122,159,.12); color: var(--txt-3); }
.ph-st.late { background: rgba(255,31,90,.1); color: var(--accent); }

:root[data-theme="light"] .btn,
:root[data-theme="light"] .lang-pill {
  transition: background .18s, color .18s, border-color .18s, transform .15s, box-shadow .18s;
}
:root[data-theme="light"] .pj-card:hover,
:root[data-theme="light"] .kpi:hover,
:root[data-theme="light"] .dash-card:hover {
  border-color: #D6C2EC;
  box-shadow: 0 8px 24px rgba(70, 30, 120, 0.09);
}
:root[data-theme="light"] .section-head h2 { color: var(--primary-dark); }
:root[data-theme="light"] .stats .stat,
:root[data-theme="light"] .panel {
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(70, 30, 120, 0.06);
}
