/* rateim.css — نظام الهوية الموحّد لمركز إدارة المشاريع (2.9.31)
   المصدر: «رتيم براند قايد لاين» (الإصدار 1.1) + الصورتان المعتمدتان (الرئيسية والتصميم العام للإدارات).
   يُحمَّل في كل الواجهات (مركز الإدارات على الكمبيوتر، الجوال، إدارة التعميد، العروض والعقود، الرئيسية، إدارة المشاريع)
   ثم تطبّق كل واجهة طبقة مواءمة خاصة بها فوق أصنافها الحالية — لا تغيير في منطق أي شاشة.
   الخط: DIN NEXT™ ARABIC غير متوفر بترخيص ضمن أصول المشروع، فيُستخدم IBM Plex Sans Arabic (SIL OFL، مستضاف محلياً). */
@import url("/brand/fonts.css");

:root {
  /* الألوان الأساسية (دليل الهوية ص5–7) */
  --rb-white: #FBFBFB;       /* الأبيض الهادئ — الأرضية ومساحات القراءة */
  --rb-ink: #111111;         /* الحبر — النصوص والعناوين */
  --rb-stone: #D8D2CB;       /* الحجري الدافئ — الفواصل الكبيرة */
  --rb-olive: #7A7D68;       /* الزيتوني الأساسي — تأكيد محدود */
  --rb-olive-deep: #5F624D;  /* الزيتوني العميق — نص زيتوني/تباين أعلى */
  --rb-bg2: #F3F1EE;         /* خلفية ثانوية / خانات التعريف */
  --rb-thead: #E4E0DB;       /* رؤوس الجداول */
  --rb-line: #CFC8BF;        /* حدود خفيفة */
  --rb-dark: #211F1C;        /* خلفية داكنة عميقة (القائمة الجانبية) */
  --rb-dark2: #4A4640;       /* خلفية داكنة مساندة */
  /* الدرجات المساندة (ص7) */
  --rb-pearl: #F4F1EC; --rb-mist: #E9E5DF; --rb-ink2: #4A4540; --rb-dark-hover: #2B2823; --rb-muted: #948D83;
  --rb-text-2: #5C574F;      /* نص ثانوي مقروء (لا يُستخدم الرمادي #948D83 للمعلومات الأساسية) */
  /* ألوان دلالية للحالات التشغيلية والمالية — بدرجات هادئة متوافقة مع الهوية */
  --rb-good: #3F7D5E; --rb-good-bg: #E7F2EC;
  --rb-warn: #A86E10; --rb-warn-bg: #FBF0DC;
  --rb-bad: #B04A55;  --rb-bad-bg: #F9E8EA;
  --rb-info: #3D5F78; --rb-info-bg: #E8EFF4;
  --rb-font: "IBM Plex Sans Arabic", "DIN Next Arabic", Tahoma, Arial, sans-serif;
  --rb-r: 14px; --rb-r-sm: 10px; --rb-r-xs: 8px;
  --rb-side-w: 264px;
  --rb-shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 8px 24px -16px rgba(17, 17, 17, .18);
}

/* ---------------- القائمة الجانبية الداكنة (يمين) ---------------- */
.rb-side { background: var(--rb-dark); color: #F4F1EC; font-family: var(--rb-font); }
.rb-side-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px 18px; text-align: center; text-decoration: none; color: inherit; }
.rb-side-brand img { height: 74px; width: auto; display: block; }
.rb-side-brand b { font-size: 19px; font-weight: 700; line-height: 1.3; color: #fff; }
.rb-side-brand small { font-size: 10.5px; letter-spacing: .22em; color: #CFC8BF; direction: ltr; }
.rb-depts { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; }
.rb-dept { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 9px 14px; border-radius: 12px; border: 0; background: none; color: #E9E5DF; font: inherit; font-size: 15px; font-weight: 500; line-height: 1.35; text-align: start; text-decoration: none; cursor: pointer; white-space: normal; overflow-wrap: anywhere; }
.rb-dept:hover { background: var(--rb-dark-hover); color: #fff; }
.rb-dept .rb-ic { width: 21px; height: 21px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rb-dept .rb-lbl { flex: 1; min-width: 0; }
.rb-dept .rb-caret { width: 16px; height: 16px; flex: none; opacity: .7; transition: transform .15s; }
.rb-dept[aria-expanded="false"] .rb-caret { transform: rotate(90deg); }
.rb-dept.on { background: var(--rb-olive); color: #fff; font-weight: 700; }
.rb-dept.on:hover { background: var(--rb-olive-deep); }
.rb-sub { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px; padding-inline-start: 18px; border-inline-start: 1px solid #4A4640; margin-inline-start: 22px; }
.rb-sub[hidden] { display: none !important; }
.rb-side-sep { height: 1px; margin: 10px 18px; background: #4A4640; }

/* ---------------- الشريط العلوي ---------------- */
.rb-top { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 24px; background: var(--rb-white); border-bottom: 1px solid var(--rb-line); font-family: var(--rb-font); color: var(--rb-ink); }
.rb-top-sp { flex: 1; }
.rb-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--rb-line); background: #fff; color: var(--rb-ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.rb-pill:hover { background: var(--rb-bg2); }
.rb-icon-btn { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--rb-line); background: #fff; color: var(--rb-ink); cursor: pointer; }
.rb-icon-btn:hover { background: var(--rb-bg2); }
.rb-user { display: flex; align-items: center; gap: 10px; padding-inline-start: 14px; border-inline-start: 1px solid var(--rb-line); }
.rb-user .rb-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: var(--rb-dark2); color: #fff; font-weight: 700; }
.rb-user b { display: block; font-size: 14px; line-height: 1.3; }
.rb-user small { display: block; font-size: 12px; color: var(--rb-text-2); }

/* ---------------- مكوّنات موحّدة ---------------- */
.rb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; border-radius: var(--rb-r-sm); border: 1px solid var(--rb-line); background: #fff; color: var(--rb-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.rb-btn:hover { background: var(--rb-bg2); }
.rb-btn--primary { background: var(--rb-olive); border-color: var(--rb-olive); color: #fff; }
.rb-btn--primary:hover { background: var(--rb-olive-deep); border-color: var(--rb-olive-deep); }
.rb-card { background: #fff; border: 1px solid var(--rb-line); border-radius: var(--rb-r); box-shadow: var(--rb-shadow); }
.rb-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--rb-bg2); color: var(--rb-ink2); }
.rb-badge::before { content: ""; width: 7px; height: 7px; border-radius: 9px; background: currentColor; }
.rb-badge.good { background: var(--rb-good-bg); color: var(--rb-good); }
.rb-badge.warn { background: var(--rb-warn-bg); color: var(--rb-warn); }
.rb-badge.bad { background: var(--rb-bad-bg); color: var(--rb-bad); }
.rb-num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* ---------------- الإطار الموحّد للصفحات المستقلة (الرئيسية وإدارة المشاريع) ---------------- */
.rb-page { margin: 0; background: var(--rb-white); color: var(--rb-ink); font-family: var(--rb-font); font-size: 15px; line-height: 1.6; }
.rb-page *, .rb-page *::before, .rb-page *::after { box-sizing: border-box; }
.rb-page [hidden] { display: none !important; }
.rb-shell { min-height: 100vh; display: grid; grid-template-columns: var(--rb-side-w) minmax(0, 1fr); background: linear-gradient(to left, var(--rb-dark) var(--rb-side-w), var(--rb-white) var(--rb-side-w)); }
.rb-shell-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.rb-side-foot { margin-top: auto; padding: 10px 12px 18px; border-top: 1px solid #3A3631; }
.rb-shell-main { min-width: 0; display: flex; flex-direction: column; }
.rb-top { position: sticky; top: 0; z-index: 40; padding-top: max(10px, env(safe-area-inset-top, 0px)); }
.rb-menu-btn { display: none; }
.rb-pop-wrap { position: relative; }
.rb-pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60; width: min(330px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto; padding: 6px; background: #fff; color: var(--rb-ink); border: 1px solid var(--rb-line); border-radius: var(--rb-r); box-shadow: 0 24px 50px -18px rgba(17, 17, 17, .35); }
.rb-pop--bell { width: min(390px, calc(100vw - 24px)); }
.rb-pop-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; font-weight: 700; }
.rb-pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--rb-r-sm); background: none; color: var(--rb-ink); font: inherit; font-size: 14.5px; text-align: start; text-decoration: none; cursor: pointer; }
.rb-pop-item:hover { background: var(--rb-bg2); }
.rb-pop-item.cur { background: var(--rb-thead); font-weight: 700; }
.rb-pop-item .rb-ic { width: 18px; height: 18px; color: var(--rb-olive-deep); }
.rb-pop-empty { padding: 18px; text-align: center; color: var(--rb-text-2); font-size: 13.5px; }
.rb-link { border: 0; background: none; color: var(--rb-olive-deep); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.rb-bell-n { position: absolute; top: -4px; inset-inline-start: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--rb-bad); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.rb-bell-f { display: flex; align-items: center; gap: 8px; padding: 0 10px 8px; font-size: 13px; color: var(--rb-text-2); }
.rb-bell-f select { flex: 1; min-width: 0; border: 1px solid var(--rb-line); border-radius: 8px; padding: 6px 8px; background: #fff; font: inherit; }
.rb-nt { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px; border-radius: var(--rb-r-sm); color: inherit; text-decoration: none; }
.rb-nt:hover { background: var(--rb-bg2); }
.rb-nt.unread { background: var(--rb-pearl); }
.rb-nt-i { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--rb-mist); }
.rb-nt.act .rb-nt-i { background: var(--rb-warn-bg); color: var(--rb-warn); }
.rb-nt b { display: block; font-size: 14px; line-height: 1.45; }
.rb-nt small { display: block; color: var(--rb-text-2); font-size: 12px; }
.rb-nt-chip { display: inline-block; margin-top: 3px; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--rb-bg2); color: var(--rb-text-2); }
button.rb-user { border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.rb-scrim { position: fixed; inset: 0; z-index: 85; background: rgba(17, 17, 17, .45); }
.rb-ic { width: 20px; height: 20px; }
@media (max-width: 900px) {
  .rb-shell { grid-template-columns: minmax(0, 1fr); background: var(--rb-white); }
  .rb-shell-side { position: fixed; z-index: 90; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); height: 100%; transform: translateX(105%); transition: transform .22s ease; padding-top: env(safe-area-inset-top, 0px); }
  .rb-shell.side-open .rb-shell-side { transform: none; }
  .rb-menu-btn { display: grid; }
  .rb-top { gap: 8px; padding-inline: max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
  .rb-hide-sm { display: none !important; }
  .rb-user { padding-inline-start: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) { .rb-shell-side { transition: none; } }

/* ---------- 2.9.32: داخل الإدارة — زر «التنقل بين الإدارات» تحت الهوية، ثم أقسام الإدارة الحالية فقط ---------- */
.rb-depts.rb-in { gap: 6px; }
.rb-switch { position: relative; margin: 0 0 6px; }
.rb-switch-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 9px 14px; border-radius: 12px; border: 1px solid #4A4640; background: rgba(255, 255, 255, .04); color: #F3F1EE; font: inherit; font-size: 14.5px; font-weight: 600; text-align: start; cursor: pointer; }
.rb-switch-btn:hover, .rb-switch-btn[aria-expanded="true"] { background: var(--rb-dark-hover); border-color: #6b665e; color: #fff; }
.rb-switch-btn .rb-ic { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; }
.rb-switch-btn .rb-lbl { flex: 1; min-width: 0; }
.rb-switch-btn .rb-caret { width: 16px; height: 16px; flex: none; opacity: .75; transition: transform .15s; }
.rb-switch-btn[aria-expanded="true"] .rb-caret { transform: rotate(180deg); }
.rb-switch-panel { margin-top: 6px; padding: 6px; border-radius: 12px; background: #2B2925; border: 1px solid #4A4640; display: flex; flex-direction: column; gap: 2px; animation: rb-sw-in .14s ease-out; }
.rb-switch-panel[hidden] { display: none !important; }
.rb-switch-panel .rb-pop-item { color: #E9E5DF; border-radius: 10px; padding: 9px 12px; font-size: 14px; text-decoration: none; }
.rb-switch-panel .rb-pop-item:hover { background: var(--rb-dark-hover); color: #fff; }
.rb-switch-panel .rb-pop-item .rb-ic { color: #CFC8BF; }
.rb-switch-panel .rb-pop-item.cur { background: var(--rb-olive); color: #fff; font-weight: 700; cursor: default; }
.rb-switch-panel .rb-pop-item.cur .rb-ic { color: #fff; }
.rb-sw-check { margin-inline-start: auto; font-size: 13px; }
.rb-dept.rb-cur { cursor: default; }
.rb-dept.rb-cur:hover { background: var(--rb-olive); }
@keyframes rb-sw-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 2.9.33 — التعديل المباشر من الجداول (public/task-inline.js) */
.ti { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; outline: none; transition: background .15s; max-width: 100%; }
.ti:hover, .ti:focus-visible { background: rgba(0,0,0,.055); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.ti::after { content: "✎"; font-size: 11px; opacity: 0; color: #777; transition: opacity .15s; }
.ti:hover::after, .ti:focus-visible::after { opacity: 1; }
.ti.ti-editing::after { content: none; }
.ti.ti-editing { background: transparent; box-shadow: none; cursor: default; }
.ti .ti-select, .ti .ti-input { font: inherit; font-size: 13px; min-height: 32px; padding: 4px 8px; border: 1px solid #1f1f1f; border-radius: 8px; background: #fff; color: #111; max-width: 260px; }
.ti .ti-input { min-width: 200px; width: 100%; }
.ti.ti-saving { opacity: .55; pointer-events: none; }
.ti .ti-select { min-width: 140px; }
