/* الواجهة الرئيسة للموظف والشريط الجانبي المضغوط — scripts/patch-staff-shell-compact.mjs */

/* ===== بطاقة الترحيب أعلى الواجهة الرئيسة =====
   يمين: الشعار ثم «مرحباً بك» والاسم ونوع الحساب و«تغيير كلمة المرور» وأزرار الحضور.
   وسط: التاريخ في إطار صغير وتحته عبارة اليوم التحفيزية.  يسار: «اقترح فكرة مشروع» فوق «الواجهة الرئيسة». */
#root main:has([data-feature="staff-home-banner-actions-v1"]) [data-feature="staff-top-row-v2"] { display: none !important; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) { padding: 22px 24px; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
  grid-template-areas: "id center idea" "id center home";
  align-items: center;
  gap: 10px 28px;
}
.bina-hero-actions { display: contents; }
/* الهوية: الشعار أكبر بجانب النصوص */
#root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) > div:first-child { grid-area: id; align-items: center; gap: 16px; min-width: 0; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) .bg-white\/95.rounded-lg { width: 92px; height: 92px; flex-shrink: 0; border-radius: 22px; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) .bg-white\/95.rounded-lg img { width: 74px; height: 74px; }
/* النصوص عمود واحد: الترحيب كاملًا، ثم الاسم، ثم نوع الحساب وكلمة المرور، ثم أزرار الحضور */
#root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) > div:first-child > div:last-child { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) > div:first-child > div:last-child > div:first-child { display: contents; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) h1 { order: 1; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.3; white-space: nowrap; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) p.text-white\/80 { order: 2; margin-top: 4px; font-size: 18px; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) :is(p.text-white\/60, .bina-role-switch) { order: 3; }
.bina-hero-account { order: 4; margin-top: 6px; }
.bina-hero-account .bina-ap-hero { font-size: 11.5px; }
#root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) > div:first-child > div:last-child > div:first-child > div:last-child { order: 5; margin-top: 10px; }

/* الوسط: التاريخ في إطار صغير واضح، وتحته عبارة اليوم */
.bina-hero-actions > .rounded-lg {
  grid-area: center;
  align-self: start;
  justify-self: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .1) !important;
  border-color: rgba(234, 217, 176, .45) !important;
}
.bina-hero-actions > .rounded-lg .text-right { text-align: center; }
.bina-hero-actions > .rounded-lg p:first-child { font-size: 14px; font-weight: 800; color: #fff; }
.bina-hero-actions > .rounded-lg p:last-child { font-size: 12px; color: var(--tb-gold-light, #ead9b0); }
.bina-hero-quote {
  grid-area: center;
  align-self: end;
  margin: 62px 0 0;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(234, 217, 176, .3);
  background: rgba(15, 42, 49, .22);
  text-align: center;
}
.bina-hero-quote-text { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.9; color: #fff; }
.bina-hero-quote-source { margin-top: 2px; font-size: 11.5px; font-weight: 700; color: var(--tb-gold-light, #ead9b0); }
.bina-hero-quote-note { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; line-height: 1.7; color: rgba(255, 255, 255, .85); }

/* اليسار: الزران أحدهما فوق الآخر بعرض واحد */
.bina-hero-actions > [data-feature="propose-project-idea"] { grid-area: idea; align-self: end; }
.bina-hero-actions > .bina-hero-home { grid-area: home; align-self: start; }
.bina-hero-actions > :is([data-feature="propose-project-idea"], .bina-hero-home) { justify-content: center; width: 210px; height: 44px; }
.bina-hero-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(234, 217, 176, .55);
  border-radius: 14px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: background-color .15s, color .15s, transform .15s;
}
.bina-hero-home svg { color: var(--tb-gold-light, #ead9b0); }
.bina-hero-home:hover { color: var(--tb-900, #163840); background: var(--tb-gold, #c8a96a); transform: translateY(-1px); }
.bina-hero-home:hover svg { color: var(--tb-900, #163840); }
.bina-hero-home:focus-visible { outline: 3px solid rgba(234, 217, 176, .8); outline-offset: 2px; }

/* شاشات متوسطة: الوسط تحت الهوية والزران يسارًا */
@media (max-width: 1279px) {
  #root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "id idea" "id home" "center center";
  }
  .bina-hero-actions > .rounded-lg { justify-self: center; }
}
/* الجوال والتابلت: عمود واحد، والزران في الشريط العلوي للجوال فلا يتكرران */
@media (max-width: 1023px) {
  #root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) { padding: 18px 16px; }
  #root .from-\[\#4a7c83\].via-\[\#5d8f96\] > .relative.z-10:has([data-feature="staff-home-banner-actions-v1"]) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "id" "center";
  }
  .bina-hero-actions > [data-feature="propose-project-idea"],
  .bina-hero-actions > .bina-hero-home { display: none; }
  #root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) .bg-white\/95.rounded-lg { width: 72px; height: 72px; }
  #root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) .bg-white\/95.rounded-lg img { width: 58px; height: 58px; }
  #root .from-\[\#4a7c83\].via-\[\#5d8f96\]:has([data-feature="staff-home-banner-actions-v1"]) h1 { white-space: normal; }
  .bina-hero-quote { margin-top: 58px; }
}

/* ===== نوع الحساب تحت الاسم (لمن له أكثر من نوع) ===== */
.bina-role-switch { position: relative; display: inline-flex; align-items: center; max-width: 100%; margin-top: 4px; }
.bina-role-switch-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bina-role-switch select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 100%;
  padding: 2px 10px;
  padding-inline-end: 26px;
  border-radius: 999px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: left 8px center;
  background-size: 12px 12px;
}
.bina-role-switch-hero select {
  color: var(--tb-gold-light, #ead9b0);
  background-color: rgba(200, 169, 106, .16);
  border: 1px solid rgba(234, 217, 176, .5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ead9b0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.bina-role-switch-hero select option { color: #12323a; background: #fff; }
.bina-role-switch-chip { margin-top: 1px; }
.bina-role-switch-chip select {
  padding-top: 0;
  padding-bottom: 0;
  font-size: 10.5px;
  color: var(--tb-800, #24555f);
  background-color: var(--tb-50, #eef6f6);
  border: 1px solid #cfe1e4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2324555f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.bina-role-switch select:focus-visible { outline: 2px solid var(--tb-gold, #c8a96a); outline-offset: 2px; }

/* ===== السطر العلوي في بقية الصفحات: الاسم والدور بجانب الزرين ===== */
#root [data-feature="staff-top-row-v2"] { min-height: 42px; }

/* ===== الشريط الجانبي ===== */
/* الترويسة: التنبيهات وزر الطي فقط (الشعار في بطاقة الترحيب)، ثم سطر «رجوع» و«تقدّم» */
#root aside.bg-sidebar > div > div:first-child:has([data-bina-sidebar-head]) { padding: 8px 10px; }
#root aside.bg-sidebar [data-bina-sidebar-head] > div:last-child { gap: 2px; }
@media (min-width: 1024px) {
  #root aside.bg-sidebar [data-bina-sidebar-head="collapsed"] > div:last-child { flex-direction: column; }
}

/* بطاقة الاسم: في بطاقة الترحيب والسطر العلوي فقط، والقائمة الجانبية للتنقل */
#root aside.bg-sidebar [data-bina-account-password] { display: none; }

/* إخفاء القائمة كلها وإظهارها (الحاسب) */
[data-bina-sidebar-show] { display: none; }
@media (min-width: 1024px) {
  html[data-bina-sidebar-hidden] #root aside.bg-sidebar { display: none; }
  html[data-bina-sidebar-hidden] body:has(#root aside.bg-sidebar) [data-bina-sidebar-show] {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 7px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 14px 0 0 14px;
    background: linear-gradient(180deg, var(--tb-800, #24555f), var(--tb-600, #3c7884));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: -6px 8px 20px -10px rgba(29, 71, 80, .8), inset 2px 0 0 var(--tb-gold, #c8a96a);
  }
  html[data-bina-sidebar-hidden] [data-bina-sidebar-show] svg { color: var(--tb-gold-light, #ead9b0); }
  html[data-bina-sidebar-hidden] [data-bina-sidebar-show] span { writing-mode: vertical-rl; }
  html[data-bina-sidebar-hidden] [data-bina-sidebar-show]:hover { background: linear-gradient(180deg, var(--tb-900, #163840), var(--tb-700, #2e6874)); }
  html[data-bina-sidebar-hidden] [data-bina-sidebar-show]:focus-visible { outline: 3px solid rgba(200, 169, 106, .8); outline-offset: 2px; }
}

/* «محاكاة مستخدم»: سطر واحد — العنوان ثم الأدوار */
#root aside.bg-sidebar [data-bina-sim] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  row-gap: 6px;
}
#root aside.bg-sidebar [data-bina-sim] > .bina-sim-label { margin: 0; font-size: 11.5px; white-space: nowrap; }
#root aside.bg-sidebar [data-bina-sim] > .grid,
#root aside.bg-sidebar [data-bina-sim] > .mb-1\.5 { margin: 0; }
#root aside.bg-sidebar [data-bina-sim] > .mb-1\.5 > .grid { margin: 0; }
/* اسم الحساب المُحاكى و«إنهاء» في الشريط البرتقالي أعلى الصفحة، فلا يتكرران هنا */
#root aside.bg-sidebar [data-bina-sim] .bg-amber-500\/20 { display: none; }
#root aside.bg-sidebar [data-bina-sim] .grid.grid-cols-3 > button { padding-top: 4px; padding-bottom: 4px; font-size: 11.5px; border-radius: 8px; }
#root aside.bg-sidebar [data-bina-sim] > .bg-slate-900 { grid-column: 1 / -1; margin-top: 0; }
#root aside.bg-sidebar [data-bina-sim] > .bg-slate-900 .max-h-44 { max-height: 9.5rem; }

/* «تحديث» و«خروج» متجاوران بحجم صغير */
#root aside.bg-sidebar [data-bina-sidebar-actions] { margin-top: 0; gap: 6px; }
#root aside.bg-sidebar [data-bina-sidebar-actions] > button {
  justify-content: center;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
}
#root aside.bg-sidebar [data-bina-sidebar-actions] > button svg { width: 16px; height: 16px; flex-shrink: 0; }
#root aside.bg-sidebar [data-bina-sidebar-actions] > button span { margin-right: 6px; font-size: 12px; font-weight: 700; }
#root aside.bg-sidebar > div > div:last-child:has([data-bina-sidebar-actions]) { padding: 8px 10px 10px; }
