/* مساحة عمل ضلال — الصدفة الموحّدة.
   تستعمل متغيّرات styles.css نفسها؛ لا لون ولا خطّ ولا نصف قطر جديد. */

:root {
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 64px;
}

body.has-shell { margin: 0; }

.app {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* ===================== الشريط الجانبي (يمين) ===================== */

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-start: none;
  border-inline-end: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: flex-basis 0.16s ease, width 0.16s ease;
  z-index: 30;
}

.app.collapsed .sidebar {
  flex-basis: var(--sidebar-w-collapsed);
  width: var(--sidebar-w-collapsed);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.collapse-btn {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  line-height: 1;
  flex: 0 0 auto;
}
.collapse-btn:hover { background: var(--accent-soft); color: var(--accent); }

.nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  border-inline-start: 3px solid transparent;
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--accent-soft); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-inline-start-color: var(--accent);
}

.nav-icon { font-size: 1.06rem; flex: 0 0 auto; width: 22px; text-align: center; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.nav-count {
  background: var(--accent);
  color: var(--ink-inverse);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.74rem;
  font-weight: 600;
}

.nav-sep { height: 1px; background: var(--line); margin: 10px 12px; }

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
}

/* الوضع المطويّ: أيقونات فقط + تلميح عند التحويم */
.app.collapsed .sidebar-brand,
.app.collapsed .nav-label,
.app.collapsed .nav-count,
.app.collapsed .sidebar-foot { display: none; }

.app.collapsed .sidebar-head { justify-content: center; padding: 0 8px; }
.app.collapsed .nav-item { justify-content: center; padding: 10px 0; }

.app.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  inset-inline-end: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--ink-inverse);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 40;
}
.app.collapsed .nav-item:hover::after { opacity: 1; }

/* ===================== المنطقة الرئيسية ===================== */

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar-shell {
  height: var(--topbar-h);
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-heading {
  font-weight: 700;
  font-size: 1.06rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

.search-wrap { flex: 1 1 auto; max-width: 460px; position: relative; }

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 34px 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--ink);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.search-icon {
  position: absolute;
  inset-inline-start: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.search-hint {
  position: absolute;
  top: calc(100% + 5px);
  inset-inline-start: 0;
  font-size: 0.74rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 9px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
  flex: 0 0 auto;
}

.icon-btn {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

.icon-badge {
  position: absolute;
  top: -5px;
  inset-inline-start: -5px;
  background: var(--accent);
  color: var(--ink-inverse);
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* اللوحات المنسدلة (الإشعارات · الملف الشخصي) */
.pop {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(20, 30, 45, 0.14);
  min-width: 232px;
  padding: 12px 14px;
  z-index: 45;
  text-align: start;
}
.pop[hidden] { display: none; }
.pop h5 { margin: 0 0 8px; font-size: 0.86rem; color: var(--accent); }
.pop p { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }
.pop .pop-mail { color: var(--ink); font-size: 0.85rem; word-break: break-all; margin-bottom: 10px; }
.pop button {
  width: 100%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px;
  border-radius: 9px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}
.pop button:hover { opacity: 0.9; }

.pop-anchor { position: relative; }

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

.content { flex: 1 1 auto; min-width: 0; }

/* استغلال المساحة: قوائم أعرض، ونصّ قراءة يبقى مريحًا */
.content .view {
  max-width: 1120px;
  padding: 24px 26px 72px;
}
.content .section .body { max-width: 82ch; }

.menu-toggle { display: none; }
.scrim { display: none; }

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

/* محمول ١٣″–١٤″: يُطوى تلقائيًا ما لم يفتحه المستخدم صراحةً */
@media (max-width: 1200px) {
  .app:not(.user-set) .sidebar { flex-basis: var(--sidebar-w-collapsed); width: var(--sidebar-w-collapsed); }
  .app:not(.user-set) .sidebar-brand,
  .app:not(.user-set) .nav-label,
  .app:not(.user-set) .nav-count,
  .app:not(.user-set) .sidebar-foot { display: none; }
  .app:not(.user-set) .sidebar-head { justify-content: center; padding: 0 8px; }
  .app:not(.user-set) .nav-item { justify-content: center; padding: 10px 0; }
}

@media (max-width: 1000px) {
  .search-wrap { max-width: 260px; }
}

/* شاشات ضيّقة: الشريط ينزلق فوق المحتوى */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    flex-basis: var(--sidebar-w);
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: -8px 0 30px rgba(20, 30, 45, 0.12);
  }
  html[dir='rtl'] .sidebar { transform: translateX(100%); }
  html[dir='rtl'] .app.drawer-open .sidebar { transform: translateX(0); }
  .app.drawer-open .sidebar { transform: translateX(0); }

  .app.collapsed .sidebar-brand,
  .app.collapsed .nav-label,
  .app.collapsed .nav-count,
  .app.collapsed .sidebar-foot,
  .app:not(.user-set) .sidebar-brand,
  .app:not(.user-set) .nav-label,
  .app:not(.user-set) .nav-count,
  .app:not(.user-set) .sidebar-foot { display: revert; }
  .app.collapsed .nav-item,
  .app:not(.user-set) .nav-item { justify-content: flex-start; padding: 10px 12px; }
  .app.collapsed .sidebar-head,
  .app:not(.user-set) .sidebar-head { justify-content: flex-start; padding: 0 14px; }
  .app.collapsed .nav-item::after { content: none; }

  .menu-toggle { display: inline-flex; }
  .collapse-btn { display: none; }

  .app.drawer-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 45, 0.4);
    z-index: 25;
  }

  .content .view { padding: 18px 16px 64px; }
  .page-heading { font-size: 0.98rem; }
}

@media (max-width: 620px) {
  .search-wrap { display: none; }
}

/* ==========================================================================
   البحث الشامل — حقل واحد يغطّي المنصّة كلها
   ========================================================================== */

.gsearch { position: relative; flex: 1 1 260px; max-width: 420px; min-width: 180px; }
.gsearch .search-icon {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); font-size: 0.85rem; opacity: 0.55; pointer-events: none;
}
.gsearch .search-input {
  width: 100%;
  padding: 9px 34px 9px 14px;
  border: 1px solid var(--line, var(--line));
  border-radius: 10px;
  background: var(--surface-2, var(--surface-2));
  font: inherit;
  font-size: 0.86rem;
  color: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.gsearch .search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px rgba(36, 72, 63, 0.12);
}

.gsearch-panel {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 60;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line, var(--line));
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(18, 38, 32, 0.16);
  padding: 8px;
  animation: gsIn 0.14s ease-out;
}
@keyframes gsIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.gsearch-status, .gsearch-total {
  padding: 10px 12px; font-size: 0.8rem; color: var(--muted);
}
.gsearch-total { border-bottom: 1px solid var(--surface-hover); margin-bottom: 4px; }

.gsearch-group { padding: 4px 0; }
.gsearch-group + .gsearch-group { border-top: 1px solid var(--surface-hover); margin-top: 4px; }
.gsearch-group-t {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px 5px;
  font-size: 0.74rem; font-weight: 700; color: var(--ink-2); letter-spacing: 0.01em;
}
.gsearch-group-t span {
  background: var(--surface-hover); border-radius: 999px; padding: 1px 7px;
  font-size: 0.7rem; color: var(--muted);
}

.gsearch-item {
  display: block; padding: 8px 12px; border-radius: 9px;
  text-decoration: none; color: inherit;
  transition: background 0.12s ease;
}
.gsearch-item:hover { background: var(--brand-soft); }
.gsearch-item-t {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.85rem; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gsearch-item-s {
  font-size: 0.76rem; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gsearch-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: none; }

@media (max-width: 900px) {
  .gsearch { flex-basis: 100%; max-width: none; order: 5; }
}

/* ==========================================================================
   التقارير والملفات — قسمان حقيقيان
   ========================================================================== */

.rp {
  --rp-line: var(--line);
  --rp-soft: var(--surface-2);
  --rp-ink: var(--ink);
  --rp-ink-2: var(--ink-2);
  --rp-ink-3: var(--muted);
  --rp-brand: var(--brand);
  --rp-brand-soft: var(--brand-soft);
  --rp-brand-line: var(--brand-line);
  max-width: 940px;
  margin: 0 auto;
  padding: 22px 24px 48px;
  color: var(--rp-ink);
}

.rp-head { margin-bottom: 16px; }
.rp-back {
  display: inline-block; font-size: 0.79rem; font-weight: 600;
  color: var(--rp-brand); text-decoration: none; margin-bottom: 8px;
}
.rp-back:hover { text-decoration: underline; }
.rp-title { font-size: 1.3rem; font-weight: 700; line-height: 1.45; margin: 0 0 5px; }
.rp-sub { font-size: 0.86rem; color: var(--rp-ink-2); }
.rp-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 0.78rem; color: var(--rp-ink-3); margin-top: 6px;
}
.rp-badge {
  background: var(--rp-brand-soft); border: 1px solid var(--rp-brand-line);
  color: var(--rp-brand); border-radius: 999px; padding: 1px 9px; font-weight: 600;
}

.rp-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.rp-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--rp-line); background: var(--surface); border-radius: 8px;
  padding: 5px 11px; font: inherit; font-size: 0.79rem; font-weight: 600;
  color: var(--rp-ink-2); cursor: pointer; text-decoration: none;
  transition: all 0.13s ease;
}
.rp-chip:hover { background: var(--rp-brand-soft); border-color: var(--rp-brand-line); color: var(--rp-brand); }

/* ---------- القائمة ---------- */
.rp-list { display: flex; flex-direction: column; gap: var(--s-2); }
/* A sunken ground is what makes the rows above it read as raised. */
.rp { background: var(--bg); min-height: 100%; padding: var(--s-6) var(--s-5) var(--s-7); }
.rp-head { max-width: 1100px; margin: 0 auto var(--s-5); }
.rp-list { max-width: 1100px; margin: 0 auto; }
@media (max-width: 700px) {
  .rp { padding: var(--s-4) var(--s-3) var(--s-6); }
  .rp-row { padding: var(--s-3); }
  .rp-open { display: none; }
}
.rp-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface); text-decoration: none; color: inherit; cursor: pointer;
  text-align: start; width: 100%; font: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.rp-row:hover {
  border-color: var(--brand-line);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
/* The icon reads as a file object, not a character in a sentence. */
.rp-row-icon {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 1.05rem;
}
.rp-row:hover .rp-row-icon { background: var(--brand-soft); border-color: var(--brand-line); }
.rp-row-main { flex: 1; min-width: 0; }
.rp-row-t {
  font-size: 0.9rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  unicode-bidi: plaintext;
}
.rp-row-s { font-size: 0.76rem; color: var(--rp-ink-3); margin-top: 2px; }
.rp-open {
  font-size: 0.75rem; font-weight: 600; color: var(--rp-brand);
  flex: none; opacity: 0; transition: opacity 0.13s ease;
}
.rp-row:hover .rp-open { opacity: 1; }

/* ---------- نصّ التقرير ---------- */
.rp-body { font-size: 0.93rem; line-height: 1.95; }
.rp-body h1 { font-size: 1.2rem; margin: 26px 0 10px; }
.rp-body h2 { font-size: 1.03rem; margin: 24px 0 8px; color: var(--rp-brand); }
.rp-body h3 { font-size: 0.94rem; margin: 18px 0 6px; }
.rp-body p { margin: 0 0 10px; }
.rp-body ul { margin: 0 0 12px; padding-inline-start: 20px; }
.rp-body li { margin-bottom: 5px; }
.rp-body a { color: var(--rp-brand); word-break: break-all; }
.rp-tablewrap { overflow-x: auto; margin: 12px 0; }
.rp-body table { border-collapse: collapse; width: 100%; min-width: 460px; }
.rp-body th, .rp-body td {
  border: 1px solid var(--rp-line); padding: 7px 10px;
  text-align: right; font-size: 0.85rem;
}
.rp-body th { background: var(--rp-soft); font-weight: 650; }

.rp-sources {
  border: 1px solid var(--rp-line); border-radius: 11px;
  padding: 8px; margin-bottom: 16px; background: var(--surface-2);
  max-height: 280px; overflow-y: auto;
}
.rp-src { display: flex; align-items: center; gap: 9px; padding: 5px 7px; font-size: 0.8rem; }
.rp-src-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- الحالات ---------- */
.rp-skel {
  height: 44px; border-radius: 10px; margin-bottom: 6px;
  background: linear-gradient(90deg, var(--rp-soft) 25%, var(--line) 37%, var(--rp-soft) 63%);
  background-size: 400% 100%; animation: rpShimmer 1.4s ease-in-out infinite;
}
@keyframes rpShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.rp-empty { text-align: center; padding: 34px 20px; color: var(--rp-ink-3); }
.rp-empty-icon { font-size: 1.7rem; opacity: 0.4; margin-bottom: 8px; }
.rp-empty-t { font-size: 0.92rem; color: var(--rp-ink-2); font-weight: 600; margin-bottom: 4px; }
.rp-empty-s { font-size: 0.82rem; }

.rp-error {
  border: 1px solid var(--danger-line); background: var(--danger-soft); border-radius: 11px;
  padding: 16px 18px; text-align: center;
}
.rp-error-t { font-size: 0.88rem; color: var(--danger); margin-bottom: 10px; line-height: 1.6; }
.rp-error-actions { display: flex; gap: 7px; justify-content: center; }

/* ---------- معاينة الملفات ---------- */
.fl-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(17, 27, 24, 0.5);
  display: grid; place-items: center; padding: 28px;
  animation: flIn 0.14s ease-out;
}
@keyframes flIn { from { opacity: 0; } to { opacity: 1; } }
.fl-box {
  background: var(--surface); border-radius: 14px; overflow: hidden;
  width: min(920px, 96vw); height: min(82vh, 800px);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(17, 27, 24, 0.3);
}
.fl-head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-bottom: 1px solid var(--rp-line, var(--line));
  font-size: 0.88rem;
}
.fl-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.fl-body { flex: 1; overflow: auto; background: var(--bg); display: grid; }
.fl-body img { max-width: 100%; max-height: 100%; margin: auto; display: block; }
.fl-body iframe { width: 100%; height: 100%; border: 0; }
.fl-text {
  margin: 0; padding: 18px 22px; font-size: 0.84rem; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: start;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* زرّ الرجوع داخل التطبيق */
.back-btn {
  font-size: 1.05rem; line-height: 1; font-weight: 600;
  color: var(--muted, var(--ink-2)); flex: none;
}
.back-btn:hover { color: var(--brand); background: var(--brand-soft); }
.back-btn[hidden] { display: none; }

/* ==========================================================================
   وضع مساحة العمل
   ==========================================================================
   الرئيسية مركز تنقّل يظهر فيه الشريط الجانبي. وداخل أي وحدة يختفي الشريط
   وتأخذ الوحدة الشاشة كاملة، ويحلّ محلّه في الشريط العلوي: رجوع · الرئيسية ·
   اسم الوحدة. التبديل بصنف واحد على الجذر — لا تُفكَّك الصدفة ولا تُعاد
   الوحدة، فتُحفظ حالتها. */

.app.workspace .sidebar { display: none; }
.app.workspace .main { width: 100%; }
/* زرّ القائمة الجانبية لا معنى له بلا شريط جانبي */
.app.workspace .menu-toggle { display: none; }

.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-soft, var(--brand-soft));
  border: 1px solid var(--brand-line, var(--brand-line));
  color: var(--brand-ink, var(--brand-ink));
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
}
.ws-badge[hidden] { display: none; }
.ws-icon { font-size: 0.95rem; line-height: 1; }

.home-btn { flex: none; font-size: 1rem; text-decoration: none; }
.home-btn[hidden] { display: none; }
.home-btn:hover { background: var(--brand-soft, var(--brand-soft)); }

/* العنوان النصّي يكرّر الشارة داخل مساحة العمل */
.app.workspace .page-heading { display: none; }

@media (max-width: 720px) {
  .ws-badge { padding: 4px 9px; font-size: 0.78rem; }
}

/* ============================================================================
   تحديث بصري — الصدفة: إطار هادئ يجمع الوحدات في منتج واحد
   ============================================================================
   الشريط الجانبي كان أبيض كالمحتوى، فبدا امتدادًا له لا إطارًا حوله. الآن
   أرضيته غائرة قليلًا فيتراجع بصريًّا، ويتقدّم المحتوى. والوحدة النشطة
   تُعرف من لمحة: خلفية العلامة وحدّ جانبي، لا لونُ نصّ فقط. */

.sidebar {
  background: var(--bg-sunken);
  border-inline-end: 1px solid var(--line-soft);
}

.nav-item {
  color: var(--ink-2);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 650;
  border-inline-start-color: var(--brand);
}
.nav-item.active .nav-icon { filter: none; opacity: 1; }
.nav-count {
  background: var(--brand);
  color: var(--ink-inverse);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 1px 7px;
}

/* الشريط العلوي: خفيف، وحدّه شعرة لا خطّ */
.topbar-shell {
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}

/* البحث الشامل: عنصر واضح مدعوّ للاستعمال، لا حقل منسيّ */
.gsearch .search-input {
  background: var(--bg-sunken);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding-block: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.gsearch .search-input:focus {
  background: var(--surface);
  border-color: var(--brand-line);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}
.gsearch-panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  overflow: hidden;
}
.gsearch-group-t {
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: var(--s-2) var(--s-4);
  border-block: 1px solid var(--line-soft);
}
.gsearch-item { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line-soft); }
.gsearch-item:hover { background: var(--surface-hover); }
.gsearch-item-t { font-size: var(--fs-md); font-weight: 550; unicode-bidi: plaintext; }
.gsearch-item-s { font-size: var(--fs-xs); color: var(--muted); unicode-bidi: plaintext; }
.gsearch-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); margin-inline-end: 6px; vertical-align: middle;
}

/* أهداف لمس مريحة على الشاشات الصغيرة */
@media (max-width: 700px) {
  .nav-item { padding: 12px; }
  .gsearch-item { padding: var(--s-4); }
  .gsearch-panel { border-radius: var(--r-md); }
}


/* ============================================================================
   الصدفة — القسم ب حرفًا بحرف
   ============================================================================ */

/* الشريط الجانبي: ٢٢٠ بكسل، سطح ثانوي، وحدّ من الجهة الداخلية */
.sidebar {
  background: var(--surface-2);
  border-inline-end: 1px solid var(--line);
}

/* عنصر التنقّل: ٤٤ ارتفاعًا، حافة ١٠، حشو أفقي ١٢، نصّ ١٤ */
.nav-item {
  height: 44px;
  padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  color: var(--ink-2);
  background: transparent;
  /* المواصفة: الحالة النشطة خلفية خضراء فاتحة كاملة، لا خطّ جانبي */
  border-inline-start: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  border-inline-start: none;
}
.nav-count {
  background: var(--brand);
  color: var(--ink-inverse);
  border-radius: var(--r-badge);
  font-size: var(--fs-meta);
  font-weight: 600;
  padding: 1px 6px;
}

/* الشريط العلوي: ٦٤، أبيض، حدّ سفليّ واحد */
.topbar-shell {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* البحث الشامل: ٤٠ ارتفاعًا، ٥٦٠ عرضًا، بلا حدّ، على لون الخلفية */
.gsearch { max-width: 560px; width: 100%; }
.gsearch .search-input {
  height: 40px;
  background: var(--bg);
  border: none;
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  color: var(--ink);
}
.gsearch .search-input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: var(--focus-ring);
}

/* المحتوى الرئيسي: خلفية التطبيق لا الأبيض، وحشو ٣٢ */
.shell-main, .content, .workspace { background: var(--bg); }

/* لوحة نتائج البحث: ٧٢٠ عرضًا، حافة ١٦، ظلّ مرتفع (القسم ح) */
.gsearch-panel {
  width: 720px;
  max-width: calc(100vw - var(--s-6));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-dialog);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.gsearch-group-t {
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-meta);
  font-weight: 600;
  padding: var(--s-2) var(--s-4);
  border-block: 1px solid var(--line);
}
.gsearch-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.gsearch-item:last-child { border-bottom: 0; }
.gsearch-item:hover { background: var(--surface-hover); }
.gsearch-item-t { font-size: var(--fs-body); font-weight: 500; unicode-bidi: plaintext; }
.gsearch-item-s { font-size: var(--fs-meta); color: var(--ink-2); unicode-bidi: plaintext; }
.gsearch-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); margin-inline-end: 6px; vertical-align: middle;
}

/* الملفات والتقارير: صفوف ٦٤، وأيقونة محايدة لا بلاطة ملوّنة (القسمان و/ط) */
.rp { background: var(--bg); padding: var(--s-6); }
.rp-title { font-size: var(--fs-page); font-weight: 600; }
.rp-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); gap: 0; overflow: hidden; }
.rp-row {
  min-height: 64px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
  transform: none;
}
.rp-row:last-child { border-bottom: 0; }
.rp-row:hover { background: var(--surface-hover); transform: none; box-shadow: none; }
.rp-row.selected { background: var(--brand-soft); }
.rp-row-icon {
  width: 36px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-badge);
}
.rp-row:hover .rp-row-icon { background: var(--surface-2); border-color: var(--line); }
.rp-row-t { unicode-bidi: plaintext; font-size: var(--fs-body); }
.rp-row-s { unicode-bidi: plaintext; font-size: var(--fs-meta); color: var(--ink-2); }

/* ---- الاستجابة (القسم ل) ------------------------------------------------ */
@media (max-width: 1199px) {
  .shell-main, .content, .workspace { padding: 20px; }
  .rp { padding: 20px; }
}
@media (max-width: 767px) {
  .shell-main, .content, .workspace { padding: var(--s-3); }
  .rp { padding: var(--s-3); }
  .gsearch-panel { width: 100%; border-radius: var(--r-md); }
  .nav-item { height: 44px; }
  .rp-open { display: none; }
}

/* ============================================================================
   الهيكل — هوية ضلال: بيج دافئ وأخضر داكن
   ============================================================================
   ٨: الشريط العلوي يهدأ. البحث بارز موضعًا لا لونًا، وما عداه يخفت. */

.app, .content, body { background: var(--bg); }

/* الشريط الجانبي: بيج أعمق قليلًا، بلا حدّ صارخ */
.sidebar { background: var(--bg-sunken); border-inline-end: 1px solid var(--line); }

.nav-item {
  color: var(--ink-2);
  font-weight: 500;
  border-inline-start: none;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
/* المفعَّل: أخضر ضلال صريحًا */
.nav-item.active {
  background: var(--brand);
  color: var(--ink-inverse);
  font-weight: 600;
  border-inline-start: none;
}
.nav-item.active .nav-icon { opacity: 1; filter: none; }

/* الشريط العلوي: شفّاف فوق البيج، بحدّ سفليّ خافت وحده */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

/* البحث: بارز بالحجم، هادئ باللون */
.gsearch .search-input {
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: var(--fs-body);
}
.gsearch .search-input::placeholder { color: var(--muted); }
.gsearch .search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}
.gsearch-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.gsearch-group-t { background: var(--surface-2); color: var(--ink-2); }
.gsearch-item:hover, .gsearch-item.active { background: var(--brand-soft); }
.gsearch-dot { background: var(--brand); }

/* ---- ١٠ + ١١: الملفات والتقارير من المنصّة نفسها -------------------- */
.rp { background: var(--bg); }
.rp-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: none;
}
.rp-row {
  min-height: 60px;
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
}
.rp-row:last-child { border-bottom: 0; }
.rp-row:hover { background: var(--surface-hover); }
.rp-row.active { background: var(--beige-deep); }
.rp-row-icon {
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--r-sm);
  border: none;
}
.rp-row-t { font-size: var(--fs-body); font-weight: 600; color: var(--ink); }
.rp-row-s { font-size: var(--fs-meta); color: var(--ink-2); }

/* ١١: التقرير يُقرأ — عرض مريح وتباعد عربيّ، بلا صناديق ثقيلة حول كل قسم */
.rp-body {
  max-width: 780px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
}
.rp-body h1, .rp-body h2, .rp-body h3 {
  color: var(--ink);
  font-weight: 650;
  margin: var(--s-5) 0 var(--s-2);
}
.rp-body h2 { font-size: var(--fs-section); }
.rp-body h3 { font-size: var(--fs-card); }
.rp-body p, .rp-body li { line-height: 1.85; }
.rp-body section {
  border: none;
  background: none;
  padding: 0;
  box-shadow: none;
}
/* الفصل بين الأقسام خطّ خافت لا صندوق */
.rp-body h2 + * { margin-top: var(--s-2); }
.rp-body hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
