/* desktop.css — مواءمة مركز إدارة المشاريع على الكمبيوتر (إدارة المهام والمستندات والبحث والتطوير والصلاحيات والإعدادات)
   مع هوية رتيم (2.9.31). يُحمَّل بعد style.css وlayers.css: يغيّر الشكل فقط — لا عنصر ولا وظيفة تُحذف. */
body { background: var(--rb-white); color: var(--rb-ink); font-family: var(--rb-font); }
button, input, select, textarea { font-family: inherit; }

/* ---------------- القائمة الجانبية الداكنة (يمين) ---------------- */
.sidebar { width: var(--rb-side-w); padding: 0 0 14px; background: var(--rb-dark); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff2e transparent; }
.sidebar .brand.rb-side-brand { display: flex; border: 0; padding: 22px 16px 16px; }
.sidebar .brand.rb-side-brand b { color: #fff; }
.sidebar nav { padding: 0; overflow: visible; flex: none; min-height: 0; }
.sidebar .rb-sub .nav { display: flex; align-items: flex-start; gap: 8px; width: 100%; margin: 1px 0; padding: 8px 12px; border-radius: 10px; color: #D8D2CB; font-size: 14px; line-height: 1.45; text-align: start; }
.sidebar .rb-sub .nav:hover { background: var(--rb-dark-hover); color: #fff; }
.sidebar [hidden], .sidebar .nav[hidden] { display: none !important; }
.sidebar .rb-sub .nav.active { background: #3A3631; color: #fff; font-weight: 700; box-shadow: inset -3px 0 0 var(--rb-olive); }
.sidebar > nav .nav { color: #D8D2CB; }
.side-note { margin: 14px 14px 0; background: #2B2823; border-color: #3A3631; }
.side-note small { color: #CFC8BF; }
.progress i { background: var(--rb-olive); }
#logoutBtn { margin: 10px 12px 0; width: calc(100% - 24px); color: #E9E5DF; }
#logoutBtn:hover { background: var(--rb-dark-hover); }

/* ---------------- المحتوى + الشريط العلوي ---------------- */
main { margin-right: var(--rb-side-w); padding: 0 32px 48px; max-width: none; }
main > header { position: sticky; top: 0; z-index: 30; margin: 0 -32px 22px; padding: 12px 32px; min-height: 68px; background: var(--rb-white); border-bottom: 1px solid var(--rb-line); }
main > header h1 { font-size: 24px; font-weight: 700; color: var(--rb-ink); }
main > header p { color: var(--rb-text-2); }
.header-side { gap: 10px; }
.dept-badge { background: var(--rb-bg2); color: var(--rb-olive-deep); border: 1px solid var(--rb-line); }
/* «التنقل بين الإدارات» في الشريط العلوي (نفس العنصر ومعرّفاته) */
/* 2.9.32: «التنقل بين الإدارات» انتقل إلى القائمة الجانبية تحت الهوية (نفس العنصر ومعرّفاته ووظيفته) */
.sidebar .rb-side-switch.dept-switch { margin: 0 0 6px; padding: 0; border: 0; position: relative; }
.sidebar .rb-side-switch .dept-switch-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin: 0; padding: 9px 14px; border-radius: 12px; border: 1px solid #4A4640; background: rgba(255, 255, 255, .04); color: #F3F1EE; font-weight: 600; font-size: 14.5px; }
.sidebar .rb-side-switch .dept-switch-toggle:hover, .sidebar .rb-side-switch .dept-switch-toggle[aria-expanded="true"] { background: var(--rb-dark-hover); border-color: #6b665e; color: #fff; }
.sidebar .rb-side-switch .dept-switch-caret { color: #CFC8BF; }
.sidebar .rb-side-switch .dept-switch-panel { position: static; margin-top: 6px; padding: 6px; max-height: none; background: #2B2925; border: 1px solid #4A4640; border-radius: 12px; box-shadow: none; }
.sidebar .rb-side-switch .dept-option { color: #E9E5DF; padding: 9px 12px; border-radius: 10px; }
.sidebar .rb-side-switch .dept-option:hover { background: var(--rb-dark-hover); color: #fff; }
.sidebar .rb-side-switch .dept-option.current { background: var(--rb-olive); color: #fff; }
.sidebar .rb-side-switch .dept-option::before { color: #fff; }
.notif-bell { border-radius: 999px; border-color: var(--rb-line); }
#userChip { border-inline-start: 1px solid var(--rb-line); padding-inline-start: 12px; }
#userChip b { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- المكوّنات ---------------- */
.primary { background: var(--rb-olive); border-color: var(--rb-olive); color: #fff; font-weight: 600; border-radius: var(--rb-r-sm); }
.primary:hover { background: var(--rb-olive-deep); border-color: var(--rb-olive-deep); }
.ghost { background: #fff; border-color: var(--rb-line); color: var(--rb-ink); border-radius: var(--rb-r-sm); }
.ghost:hover { background: var(--rb-bg2); }
select, input, textarea { border-color: var(--rb-line); border-radius: var(--rb-r-sm); }
select:focus, input:focus, textarea:focus { outline: 2px solid rgba(122, 125, 104, .35); outline-offset: 0; border-color: var(--rb-olive); }
.filters, .panel, .metrics article, .perm-card { border-color: var(--rb-line); border-radius: var(--rb-r); }
.filters { background: #fff; box-shadow: 0 1px 2px rgba(17, 17, 17, .04); }
th { background: var(--rb-thead); color: var(--rb-ink); font-weight: 700; }
th, td { border-top-color: var(--rb-line); }
tbody tr:hover td { background: #FDFCFA; }
.bar-fill { background: var(--rb-olive); }
.panel-title > strong { color: var(--rb-olive-deep); }
.badge.working, .badge.none { background: var(--rb-bg2); color: var(--rb-ink2); }
dialog { border-radius: 18px; }
dialog::backdrop { background: rgba(17, 17, 17, .55); }
.dialog-actions { border-top-color: var(--rb-line); }
.close { background: var(--rb-bg2); }
.metric-icon.blue { background: var(--rb-bg2); color: var(--rb-ink); }

/* التابلت الأفقي/الشاشات المتوسطة: قائمة أنحف وحواف أصغر حتى لا تضيق الجداول (مثل قائمة الصلاحيات) */
@media (max-width: 1100px) and (min-width: 721px) {
  :root { --rb-side-w: 228px; }
  main { padding: 0 20px 44px; }
  main > header { margin: 0 -20px 20px; padding: 12px 20px; }
  #userChip small { display: none; }
  /* 2.9.32: فلاتر الشاشات تتكيّف مع العرض المتاح بلا تمدد أفقي (عناصرها قابلة للانكماش) */
  .filters { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .filters > * { min-width: 0; }
  .filters .multi-select, .filters .multi-select-toggle, .filters select { max-width: 100%; min-width: 0; }
}
/* الشاشات الضيقة (التصميم الحالي للعرض الضيق يبقى: القائمة أعلى الصفحة) */
@media (max-width: 720px) {
  .sidebar { width: 100%; padding: 8px 12px; }
  .sidebar .brand.rb-side-brand { flex-direction: row; padding: 4px; gap: 10px; }
  .sidebar .brand.rb-side-brand img { height: 40px; }
  .sidebar .brand.rb-side-brand small { display: none; }
  main { margin: 0; padding: 0 14px 40px; }
  main > header { margin: 0 -14px 16px; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  main > header > div:first-child { min-width: 0; flex: 1 1 100%; }
  .header-side { flex-wrap: wrap; max-width: 100%; min-width: 0; justify-content: flex-start; }
  #userChip { display: none; }
}
