/* ═══════════════════════════════════════════════════════
   shared.css — نظام التصميم لـ مسار
   نفس عائلة ITSM: قرمزي + ذهبي + Tajawal
   يُوسَّع شاشة بشاشة، ولا يُضاف إليه إلا ما تحتاجه شاشة موجودة.
═══════════════════════════════════════════════════════ */

:root {
  --crimson:        #8B1A1A;
  --crimson-dark:   #6B1212;
  --crimson-light:  #A82020;
  --gold:           #C4952A;
  --gold-light:     #D4A840;

  --bg:             #F0F2F5;
  --surface:        #FFFFFF;
  --text:           #1A1A2E;
  --text-muted:     #6B7280;
  --border:         #E5E7EB;

  --grad-brand:     linear-gradient(135deg, #8B1A1A, #A82020);

  --radius:         12px;
  --radius-sm:      8px;

  --shadow-sm:      0 1px 3px rgba(26,26,46,.06), 0 1px 2px rgba(26,26,46,.04);
  --shadow-md:      0 6px 20px rgba(26,26,46,.09);
  --shadow-lg:      0 18px 50px rgba(26,26,46,.16);

  --ease:           cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

[dir="ltr"] body, body[dir="ltr"] { direction: ltr; }

a { color: var(--crimson); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* أيقونات SVG (CO.icon) — تأخذ لون النص وحجمه */
.ico { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }

/* ─── حركات ─── */
@keyframes fadeInSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-transition { animation: fadeIn .25s ease both; }

/* ─── الأزرار ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  background: var(--grad-brand); color: #fff;
  font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(139,26,26,.28);
  transition: box-shadow .18s var(--ease), opacity .18s;
}
.btn:hover { box-shadow: 0 7px 20px rgba(139,26,26,.34); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn .ico { width: 18px; height: 18px; }

.btn-ghost {
  background: #fff; color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}
.btn-ghost:hover { border-color: var(--crimson); color: var(--crimson); box-shadow: none; }

.btn-block { width: 100%; }

/* ─── الحقول ─── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 7px;
  font-size: 13.5px; font-weight: 700; color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px;
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(139,26,26,.10);
}
.form-hint { font-size: 12px; color: var(--text-muted); }

/* ─── التنبيهات ─── */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.8;
  border: 1px solid transparent;
}
.alert .a-icon {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; margin-top: 2px;
}
.alert-error { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.alert-error .a-icon { background: #DC2626; color: #fff; }
.alert-warn  { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.alert-warn .a-icon { background: #D97706; color: #fff; }
.alert-info  { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
.alert-info .a-icon { background: #2563EB; color: #fff; }
.alert-ok    { background: #F0FDF4; color: #166534; border-color: #BBF7D0; }
.alert-ok .a-icon { background: #16A34A; color: #fff; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.spinner.dark { border-color: rgba(139,26,26,.2); border-top-color: var(--crimson); }

/* ═══════════════════════════════════════════════════════
   هيكل التطبيق: القائمة الجانبية + الشريط العلوي + المحتوى
═══════════════════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

/* ─── القائمة الجانبية (بيضاء، شعار على خلفية قرمزية) ─── */
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sb-brand {
  background: var(--grad-brand); padding: 22px 20px; text-align: center; position: relative; overflow: hidden;
}
.sb-brand::after { content: ''; position: absolute; width: 190px; height: 190px; border-radius: 50%;
  top: -90px; inset-inline-end: -60px; background: rgba(255,255,255,.08); }
.sb-logo { position: relative; z-index: 1; background: #FAF8F6; border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: center; min-height: 54px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.sb-logo img { max-height: 36px; max-width: 100%; display: none; }
.sb-logo.has-img img { display: block; }
.sb-logo.has-img .sb-wm { display: none; }
.sb-wm { direction: ltr; font-style: italic; font-weight: 900; font-size: 19px; letter-spacing: -.7px; color: #1F2A6B; line-height: 1; }
.sb-wm b { color: var(--crimson-light); font-weight: 900; }
.sb-sub { position: relative; z-index: 1; margin-top: 9px; font-size: 11.5px; color: rgba(255,255,255,.78); }

.sb-brand, .sb-user { flex-shrink: 0; }
.sb-nav { padding: 6px 0 14px; flex: 1 0 auto; }
.sb-section { font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 18px 20px 8px; letter-spacing: .2px; }

/* عنصر مستقل (لوحة التحكم) — يملأ العرض كما في MyIT */
.sb-link {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  color: #4B5563; font-size: 14.5px; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s; position: relative;
}
.sb-link:hover { background: #FAF3F3; color: var(--crimson); text-decoration: none; }
.sb-link.active { background: var(--crimson); color: #fff; font-weight: 700; }
.sb-link.soon { opacity: .55; cursor: default; }
.sb-link.soon:hover { background: transparent; color: #4B5563; }
.sb-chip { margin-inline-start: auto; font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  background: #F3F4F6; border-radius: 10px; padding: 1px 8px; }
.sb-badge { margin-inline-start: auto; min-width: 22px; text-align: center; font-size: 11.5px; font-weight: 800;
  background: var(--crimson); color: #fff; border-radius: 11px; padding: 1px 7px; }
.sb-link.active .sb-badge { background: #fff; color: var(--crimson); }

/* مجموعة بخط ملوّن على الحافة وعنوان ملوّن */
.sb-group { margin: 14px 0 6px; border-inline-start: 3px solid var(--crimson); }
.sb-group.tone-gold  { border-inline-start-color: var(--gold); }
.sb-group.tone-blue  { border-inline-start-color: #3B82F6; }
.sb-group.tone-gray  { border-inline-start-color: #9CA3AF; }
.sb-group.tone-purple { border-inline-start-color: #7C3AED; }
.sb-gtitle { font-size: 15px; font-weight: 800; color: var(--crimson); padding: 12px 17px 6px; }
.sb-group.tone-gold .sb-gtitle { color: var(--gold); }
.sb-group.tone-blue .sb-gtitle { color: #3B82F6; }
.sb-group.tone-gray .sb-gtitle { color: #4B5563; }
.sb-group.tone-purple .sb-gtitle { color: #7C3AED; }
.sb-group .sb-link { padding: 11px 17px; font-size: 14px; }

.sb-user { border-top: 1px solid var(--border); padding: 14px 16px 16px; position: sticky; bottom: 0; background: var(--surface); }
.sb-ucard { display: flex; align-items: center; gap: 11px; background: #FDF0F0; border: 1px solid #F8DCDC;
  border-radius: 12px; padding: 11px 13px; }
.sb-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--crimson); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; direction: ltr; }
.sb-uinfo { flex: 1; min-width: 0; }
.sb-uname { font-size: 13.5px; font-weight: 800; color: var(--crimson); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: auto; }
.sb-urole { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-logout { margin-top: 10px; width: 100%; border: 1px solid var(--border); background: #fff; border-radius: 10px;
  padding: 11px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--crimson);
  display: flex; align-items: center; justify-content: center; gap: 9px; transition: all .15s; }
.sb-logout:hover { background: #FEF2F2; border-color: #FECACA; }
.sb-logout svg { width: 17px; height: 17px; }

/* ─── المنطقة الرئيسية ─── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px; position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 18px; font-weight: 800; line-height: 1.3; }
.topbar-sub { font-size: 12.5px; color: var(--text-muted); }
.topbar-date { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.tb-tools { display: flex; align-items: center; gap: 12px; }
.tb-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: #F1F2F6; display: inline-flex; align-items: center; justify-content: center; transition: background .15s; }
.tb-btn:hover { background: #E7E9F0; }
.tb-btn svg { width: 21px; height: 21px; }
.tb-dot { position: absolute; top: -3px; inset-inline-start: -3px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: #B91C1C; color: #fff; font-size: 11px; font-weight: 800;
  display: none; align-items: center; justify-content: center; border: 2px solid #fff; }
.tb-dot.show { display: inline-flex; }
.tb-lang { display: flex; background: #F1F2F6; border-radius: 12px; padding: 4px; gap: 3px; direction: ltr; }
.tb-lang button { border: none; background: transparent; padding: 7px 13px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700; color: #4B5563; }
.tb-lang button.on { background: #fff; color: var(--crimson); box-shadow: 0 1px 4px rgba(26,26,46,.14); }
.tb-pop { position: relative; }
.tb-menu { display: none; position: absolute; top: calc(100% + 12px); inset-inline-end: 0; width: 360px; max-width: 92vw;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 80; overflow: hidden; }
.tb-menu.open { display: block; }
.tb-menu-head { padding: 14px 18px; font-weight: 800; font-size: 14.5px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; }
.tb-menu-empty { padding: 28px 18px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.nt-item { display: block; padding: 12px 18px; border-bottom: 1px solid #F3F4F6; color: var(--text); text-decoration: none; }
.nt-item:hover { background: #FAF6F6; text-decoration: none; }
.nt-item b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.nt-item span { font-size: 12px; color: var(--text-muted); }
.pf-head { display: flex; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--border); }
.pf-av { width: 54px; height: 54px; border-radius: 50%; background: #E0E7FF; color: #4F46E5; font-weight: 800;
  font-size: 18px; display: flex; align-items: center; justify-content: center; direction: ltr; flex-shrink: 0; }
.pf-name { font-weight: 800; font-size: 15px; }
.pf-role { font-size: 12.5px; color: var(--text-muted); }
.pf-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; font-size: 13.5px; color: #374151; }
.pf-row .pf-ico { width: 24px; display: flex; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.pf-row .pf-ico .ico { width: 18px; height: 18px; }
.pf-row span:last-child { direction: auto; word-break: break-all; }
.content { padding: 26px 28px 48px; }
.page-wrap { max-width: 1240px; margin: 0 auto; }

/* ─── بطاقات عامة ─── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 9px; }
.card-title .ico { width: 19px; height: 19px; color: var(--text-muted); }
.card-body { padding: 18px 20px; }
.card-link { font-size: 13px; font-weight: 700; }

/* ─── شريط الترحيب ─── */
.welcome {
  position: relative; overflow: hidden; color: #fff; border-radius: 16px; padding: 28px 32px; margin-bottom: 22px;
  background: linear-gradient(135deg, #6B1212 0%, #8B1A1A 50%, #A82020 100%);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  box-shadow: 0 10px 28px rgba(139,26,26,.28);
}
.welcome::before, .welcome::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.welcome::before { width: 300px; height: 300px; top: -130px; inset-inline-start: -70px; background: rgba(255,255,255,.08); }
.welcome::after  { width: 220px; height: 220px; bottom: -110px; inset-inline-start: 190px; background: rgba(196,149,42,.18); }
.welcome > * { position: relative; z-index: 1; }
.welcome h2 { font-size: 24px; font-weight: 800; margin-bottom: 5px; }
.welcome p { font-size: 14px; opacity: .88; }
.welcome-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip { font-size: 12.5px; font-weight: 700; padding: 5px 13px; border-radius: 18px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.28); }
.chip.gold { background: rgba(196,149,42,.28); border-color: rgba(212,168,64,.6); }
.btn-light { background: #fff; color: var(--crimson); box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.btn-light:hover { box-shadow: 0 10px 22px rgba(0,0,0,.24); }

/* ─── بطاقات الإحصاء ─── */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { display: flex; align-items: center; gap: 15px; padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s; text-decoration: none; color: inherit; }
a.stat-card:hover { border-color: #E3CFCF; box-shadow: var(--shadow-md); text-decoration: none; }
.stat-ico { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-ico .ico { width: 24px; height: 24px; }
.stat-ico.red   { background: #FEE2E2; color: #B91C1C; } .stat-ico.blue  { background: #DBEAFE; color: #1D4ED8; }
.stat-ico.gold  { background: #FEF3C7; color: #B45309; } .stat-ico.green { background: #DCFCE7; color: #15803D; }
.stat-ico.gray  { background: #F3F4F6; color: #4B5563; } .stat-ico.purple { background: #EDE9FE; color: #6D28D9; }
.stat-val { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-lbl { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-grid.org .stat-card { padding: 15px 18px; }
.stat-grid.org .stat-val { font-size: 22px; }
.stat-grid.org .stat-ico { width: 42px; height: 42px; }
.stat-grid.org .stat-ico .ico { width: 20px; height: 20px; }
.section-label { font-size: 13px; font-weight: 800; color: var(--text-muted); margin: 0 2px 10px; letter-spacing: .2px; }

/* ─── الشبكات ─── */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; margin-bottom: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* ─── قوائم المعاملات ─── */
.tx-list { list-style: none; }
.tx-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid #F3F4F6;
  color: inherit; text-decoration: none; transition: background .15s; }
.tx-item:last-child { border-bottom: none; }
a.tx-item:hover { background: #FBF7F7; text-decoration: none; }
.tx-main { flex: 1; min-width: 0; }
.tx-subj { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tx-ref { font-family: Consolas, Menlo, monospace; direction: ltr; color: var(--crimson); font-weight: 700; font-size: 12px; }

/* ─── شارات الحالة (نبض للمفتوحة) ─── */
.badge-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 11px; border-radius: 14px; white-space: nowrap; }
.badge-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-status.draft    { background: #F3F4F6; color: #6B7280; }
.badge-status.open     { background: #DBEAFE; color: #1D4ED8; }
.badge-status.warn     { background: #FEF3C7; color: #B45309; }
.badge-status.closed   { background: #DCFCE7; color: #15803D; }
.badge-status.rejected { background: #FEE2E2; color: #B91C1C; }
.badge-prio { font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 9px; background: #FEE2E2; color: #B91C1C; }

/* ─── الحالة الفارغة ─── */
.empty-state { text-align: center; padding: 34px 20px; color: var(--text-muted); }
.empty-state .es-ico { display: flex; justify-content: center; margin-bottom: 10px; color: #9CA3AF; }
.empty-state .es-ico .ico { width: 32px; height: 32px; stroke-width: 1.6; }
.empty-state .es-ico .spinner { width: 26px; height: 26px; }
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; font-weight: 800; }
.empty-state p { font-size: 13px; line-height: 1.9; }

/* ─── إجراءات سريعة ─── */
.quick { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 18px;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s; }
a.quick:hover { border-color: var(--crimson); box-shadow: var(--shadow-md); text-decoration: none; }
.quick .q-ico { color: var(--crimson); }
.quick .q-ico .ico { width: 26px; height: 26px; stroke-width: 1.8; }
.quick .q-t { font-size: 14.5px; font-weight: 800; }
.quick .q-s { font-size: 12px; color: var(--text-muted); }
.quick.soon { opacity: .55; cursor: default; }

/* ─── الخط الزمني للنشاط ─── */
.tl { position: relative; padding-inline-start: 26px; }
.tl::before { content: ''; position: absolute; inset-inline-start: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 17px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; inset-inline-start: -26px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--border); }
.tl-dot.green { border-color: #22C55E; background: #DCFCE7; } .tl-dot.red { border-color: #DC2626; background: #FEE2E2; }
.tl-dot.amber { border-color: #D97706; background: #FEF3C7; } .tl-dot.blue { border-color: #3B82F6; background: #DBEAFE; }
.tl-title { font-size: 13.5px; font-weight: 700; }
.tl-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ─── تنبيه أعلى الصفحة ─── */
.page-alert { margin-bottom: 20px; }

/* ─── لوحة مدير النظام: من دخل النظام + بيانات تحتاج مراجعة ─── */
.rd-signin { padding: 26px 28px 22px; margin-bottom: 22px; }
.rd-figure { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.rd-n { font-size: 64px; font-weight: 800; line-height: .9; color: var(--crimson); font-variant-numeric: tabular-nums; }
.rd-of { display: flex; flex-direction: column; gap: 2px; }
.rd-of span { font-size: 14px; color: var(--text-muted); }
.rd-of b { font-size: 18px; font-weight: 700; }
/* مربع لكل حساب */
.rd-cells { display: grid; grid-template-columns: repeat(auto-fill, 12px); gap: 5px; }
.rd-cells i { width: 12px; height: 12px; border-radius: 3px; }
.rd-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.rd-cells i, .rd-bar i, .rd-key i { background: #E2E4E9; }
.rd-cells i.on,   .rd-bar i.on,   .rd-key i.on   { background: var(--crimson); }
.rd-cells i.wait, .rd-bar i.wait, .rd-key i.wait { background: var(--gold); }
.rd-cells i.stop, .rd-bar i.stop, .rd-key i.stop { background: transparent; box-shadow: inset 0 0 0 1.5px #C3C8D0; }
.rd-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px; }
.rd-key { display: inline-flex; align-items: center; gap: 8px; margin: -4px -6px; padding: 4px 6px; border-radius: 6px;
  font-size: 13.5px; color: var(--text); text-decoration: none; }
.rd-key:hover { background: #F6F1F1; text-decoration: none; }
.rd-key i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.rd-key b { font-weight: 800; font-variant-numeric: tabular-nums; }
.rd-key span { color: var(--text-muted); }
.rd-key.zero b { font-weight: 700; color: var(--text-muted); }

.rd-progress { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.rd-checks { list-style: none; }
.rd-check { display: grid; grid-template-columns: 18px auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid #F1F2F5; }
.rd-check:last-child { border-bottom: none; }
/* الذهبي = ينتظر منك إجراء */
.rd-mark { justify-self: center; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(196,149,42,.18); }
.rd-cnt { min-width: 2ch; font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rd-t { font-size: 14.5px; font-weight: 700; }
.rd-sub { margin-top: 2px; font-size: 12.5px; line-height: 1.7; color: var(--text-muted); }
.rd-check.done { grid-template-columns: 18px minmax(0, 1fr); padding-block: 12px; }
.rd-check.done .rd-mark { width: auto; height: auto; background: none; box-shadow: none; color: #A3A9B3; display: flex; }
.rd-check.done .rd-mark .ico { width: 18px; height: 18px; }
.rd-check.done .rd-t { font-weight: 500; color: var(--text-muted); }
.rd-note { margin: 2px 2px 0; font-size: 12.5px; color: var(--text-muted); }

@media (max-width: 560px) {
  .rd-signin { padding: 20px 18px 18px; }
  .rd-n { font-size: 48px; }
  .rd-of b { font-size: 16px; }
  .rd-cells { grid-template-columns: repeat(auto-fill, 10px); gap: 4px; }
  .rd-cells i { width: 10px; height: 10px; border-radius: 2px; }
  .rd-check { grid-template-columns: 18px auto minmax(0, 1fr); padding: 14px 16px; gap: 10px 12px; }
  .rd-check .btn { grid-column: 2 / -1; justify-self: start; }
}

/* ─── استجابة ─── */
@media (max-width: 1100px) { .stat-grid, .stat-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: minmax(0, 1fr); } }
/* الجوال: الأيقونة فوق الرقم حتى يتسع الوصف في عمود ضيق */
@media (max-width: 560px) {
  .stat-grid { gap: 10px; }
  .stat-card, .stat-grid.org .stat-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat-ico, .stat-grid.org .stat-ico { width: 38px; height: 38px; border-radius: 11px; }
  .stat-ico .ico, .stat-grid.org .stat-ico .ico { width: 20px; height: 20px; }
  .stat-val, .stat-grid.org .stat-val { font-size: 22px; }
  .stat-lbl { font-size: 12.5px; line-height: 1.5; }
}
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  .main { min-width: 0; }
  .topbar-date { display: none; }
  .tb-lang button { padding: 6px 10px; }
  .tb-tools { gap: 8px; }
  .tb-btn { width: 40px; height: 40px; }
  .tb-menu { position: fixed; top: 70px; inset-inline: 10px; width: auto; }
  .topbar-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
  .sidebar { position: fixed; z-index: 60; inset-block: 0; inset-inline-start: 0; transform: translateX(105%); visibility: hidden; transition: transform .3s var(--ease), visibility .3s; }
  [dir="ltr"] .sidebar { transform: translateX(-105%); }
  .sidebar.open { transform: none !important; visibility: visible; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex !important; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 0 16px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .welcome { padding: 22px 20px; }
}
.menu-btn { display: none; border: 1px solid var(--border); background: #fff; width: 38px; height: 38px; border-radius: 10px;
  align-items: center; justify-content: center; cursor: pointer; font-size: 18px; margin-inline-end: 10px; }

/* ═══════════════════════════════════════════════════════
   شاشات الإدارة والحوكمة: جداول، فلاتر، نوافذ، مصفوفة
═══════════════════════════════════════════════════════ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.page-head p { margin: 0; max-width: 72ch; color: var(--text-muted); font-size: 13.5px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-danger { background: #fff; color: #B91C1C; border: 1px solid #FECACA; box-shadow: none; }
.btn-danger:hover { background: #FEF2F2; box-shadow: none; border-color: #F87171; color: #B91C1C; }
.btn-ok { background: linear-gradient(135deg, #15803D, #16A34A); box-shadow: 0 4px 12px rgba(21,128,61,.25); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #FCFCFD; }
.filters input, .filters select, .inp {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 9px; background: #fff; font-family: inherit; font-size: 13.5px; min-width: 150px; }
.filters input { flex: 1; min-width: 200px; }
.filters input:focus, .filters select:focus, .inp:focus { outline: none; border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(139,26,26,.10); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; padding: 11px 16px; font-size: 12px; font-weight: 800; color: var(--text-muted); background: #F9FAFB; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid #F1F2F5; vertical-align: middle; }
.tbl tr:hover td { background: #FCFAFA; }
.tbl .nm { font-weight: 700; }
.tbl .sub { font-size: 12px; color: var(--text-muted); direction: auto; }
.tbl .acts { white-space: nowrap; text-align: end; }
.tbl-empty { padding: 40px 18px; text-align: center; color: var(--text-muted); }

.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: #F3F4F6; color: #4B5563; margin: 2px 3px 2px 0; }
.pill.r-it_admin { background: #FEE2E2; color: #B91C1C; }
.pill.r-dept_manager, .pill.r-section_head { background: #DBEAFE; color: #1D4ED8; }
.pill.r-auditor { background: #EDE9FE; color: #6D28D9; }
.pill.r-access_admin { background: #FEF3C7; color: #B45309; }
.pill.r-records_keeper { background: #DCFCE7; color: #15803D; }
.pill.r-custom { background: #CFFAFE; color: #0E7490; }
.pill.gray { background: #F3F4F6; color: #6B7280; }

.link-btn { background: none; border: none; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--crimson); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.link-btn:hover { background: #FAF0F0; }
.link-btn.red { color: #B91C1C; } .link-btn.green { color: #15803D; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button { border: none; background: none; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--text-muted);
  padding: 14px 16px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--crimson); border-bottom-color: var(--crimson); }

/* نافذة */
.modal-ov { position: fixed; inset: 0; background: rgba(20,12,12,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal b, .modal bdi { unicode-bidi: isolate; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-h h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-x { border: none; background: #F3F4F6; width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: #4B5563; }
.modal-x .ico { width: 16px; height: 16px; }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fgrid .full { grid-column: 1 / -1; }
.fld label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.fld .inp { width: 100%; }
.fld .hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.7; }
.chk-list { display: grid; gap: 8px; }
.fld label.chk { display: flex; font-weight: 400; margin: 0; align-items: flex-start; }
.chk input { width: 18px; height: 18px; flex: none; }
.chk { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.chk:hover { background: #FCFAFA; }
.chk input { margin-top: 3px; accent-color: var(--crimson); }
.chk b { display: block; font-size: 13.5px; } .chk span { font-size: 12px; color: var(--text-muted); }

/* إشعار سريع */
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 300; padding: 12px 22px; border-radius: 12px;
  color: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-lg); animation: fadeIn .2s; max-width: 90vw; }
.toast.ok { background: #15803D; } .toast.err { background: #B91C1C; }

/* مصفوفة الصلاحيات */
.matrix-wrap { overflow: auto; max-height: 70vh; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid #F1F2F5; text-align: center; background: #fff; }
.matrix thead th { position: sticky; top: 0; z-index: 3; background: #F9FAFB; font-size: 12px; font-weight: 800; white-space: nowrap; border-bottom: 1px solid var(--border); }
.matrix .pcol { position: sticky; inset-inline-start: 0; z-index: 2; text-align: start; min-width: 230px; background: #fff; border-inline-end: 1px solid var(--border); }
.matrix thead .pcol { z-index: 4; background: #F9FAFB; }
.matrix .grp td { background: #FAF3F3; color: var(--crimson); font-weight: 800; font-size: 12.5px; text-align: start; }
.matrix .pname b { display: block; font-size: 13px; } .matrix .pname span { font-size: 11.5px; color: var(--text-muted); font-weight: 400; }
.matrix input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--crimson); cursor: pointer; }
.matrix input:disabled { cursor: not-allowed; opacity: .5; }
.matrix .cnt { font-size: 11px; color: var(--text-muted); font-weight: 600; display: block; }

.rv-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin: 12px 18px; background: #fff; }
.rv-card .rv-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.prog { height: 8px; border-radius: 6px; background: #EEF0F4; overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, #15803D, #22C55E); }
.audit-det { font-size: 11.5px; color: var(--text-muted); direction: ltr; text-align: left; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 14px; align-items: center; font-size: 13px; color: var(--text-muted); }

@media (max-width: 860px) {
  .fgrid { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 10px 12px; }
}

/* ═══════════════════════════════════════════════════════
   إظهار التركيز للوحة المفاتيح — حلقة قرمزية لا تظهر عند النقر بالفأرة
═══════════════════════════════════════════════════════ */
:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }
/* عناصر بعرض كامل داخل حاويات تمرير: الحلقة للداخل حتى لا تُقص */
.sb-link:focus-visible, .nt-item:focus-visible, .tx-item:focus-visible,
.tabs button:focus-visible, .tbl a:focus-visible { outline-offset: -2px; }
/* داخل شريط الترحيب القرمزي: حلقة بيضاء */
.welcome :focus-visible { outline-color: #fff; }

/* ═══════════════════════════════════════════════════════
   تقليل الحركة: يحترم إعداد النظام
═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .spinner { animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}

/* ═══════════════════════════════════════════════════════
   مخطط البطاقات المتتالية — الهيكل التنظيمي والهيكل الإداري
   افتح بطاقة فتظهر ما تحتها بعد خط متقطع. CO.chart في app.js يرسم خطوط الربط ويدير قوائم «…».
═══════════════════════════════════════════════════════ */
/* سطر المشاكل: كل رقم يعرض أصحابه تحت المخطط، والذهبي = يحتاج قرارك */
.og-health { display:flex; flex-wrap:wrap; align-items:center; gap:8px 10px; padding:14px 18px; border-bottom:1px solid var(--border); }
.og-total { margin-inline-end:auto; font-size:13.5px; color:var(--text-muted); }
.og-total b { color:var(--text); font-weight:800; font-variant-numeric:tabular-nums; }
.og-hk { display:inline-flex; align-items:center; gap:7px; padding:5px 12px; border:1px solid var(--border); border-radius:999px; background:#fff; font-family:inherit; font-size:13px; color:var(--text); cursor:pointer; }
.og-hk i { width:8px; height:8px; border-radius:50%; background:#A3A9B3; flex-shrink:0; }
.og-hk.warn i { background:var(--gold); box-shadow:0 0 0 3px rgba(196,149,42,.18); }
.og-hk b { font-weight:800; font-variant-numeric:tabular-nums; }
.og-hk:hover { border-color:#D9C7C7; }
.og-hk.on { border-color:var(--crimson); background:#FBF4F4; color:var(--crimson); }
.og-hk.zero { border-style:dashed; color:var(--text-muted); cursor:default; }
.og-hk.zero i { display:none; }
.og-bar .og-co { min-width:190px; }
.og-scope { padding:10px 18px 0; font-size:12.5px; color:var(--text-muted); }
.og-bar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; padding:14px 18px; border-bottom:1px solid var(--border); background:#FCFCFD; }
.og-bar input { flex:1; min-width:200px; }
/* مخطط */
.og-chart { padding:22px 18px 8px; }
.og-crumbs { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:16px; font-size:13px; }
.og-crumbs button { border:none; background:#F3F4F6; border-radius:10px; padding:5px 11px; font-family:inherit; font-weight:700; font-size:12.5px; cursor:pointer; color:#4B5563; }
.og-crumbs button:hover { background:#FAF3F3; color:var(--crimson); }
.og-crumbs .sep { color:#9CA3AF; }
/* لوحة = موظف مفتوح وفريقه تحته؛ كل فتح جديد يضيف لوحة بخط متقطع */
.oc-panel { padding:6px 0 34px; scroll-margin-top:84px; }
.oc-panel.sub { margin-top:2px; padding-top:30px; border-top:1.5px dashed var(--border); }
.oc-head { display:flex; justify-content:center; }
.oc-head .oc-card { width:244px; }
.oc-kids { position:relative; padding-top:44px; }
.oc-kids::before { content:''; position:absolute; top:0; left:50%; height:22px; border-left:1.5px solid #D1D5DB; }
.oc-kids.single::before { height:44px; }
.oc-rail { position:absolute; top:22px; height:12px; border:1.5px solid #D1D5DB; border-bottom:none; border-radius:10px 10px 0 0; }
.oc-rail::before, .oc-rail::after { content:''; position:absolute; bottom:-4px; width:7px; height:7px; border-radius:50%; background:var(--crimson); }
.oc-rail::before { left:-4px; } .oc-rail::after { right:-4px; }
.oc-kids.single .oc-rail { display:none; }
.oc-grid { display:grid; grid-template-columns:repeat(auto-fit, 216px); justify-content:center; gap:42px 28px; }
/* البطاقة */
.oc-card { position:relative; width:216px; min-height:128px; padding:32px 14px 26px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); text-align:center; }
.oc-card.open { border:2px solid var(--crimson); padding:31px 13px 25px; }
.oc-card.hit { border:2px solid var(--gold); padding:31px 13px 25px; background:#FFFBEB; box-shadow:0 0 0 4px rgba(196,149,42,.16); }
.oc-no { position:absolute; top:9px; inset-inline-start:9px; max-width:104px; padding:2px 9px; border-radius:999px; background:#F3F4F6; color:#4B5563;
  font-size:11.5px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.oc-av { width:42px; height:42px; margin:0 auto 9px; border-radius:50%; background:#FDF0F0; border:1px solid #F8DCDC; color:var(--crimson);
  font-size:14px; font-weight:800; display:flex; align-items:center; justify-content:center; direction:ltr; }
.oc-name, .oc-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; unicode-bidi:plaintext; }
.oc-name { font-size:14.5px; font-weight:800; color:var(--text); }
.oc-title { margin-top:2px; font-size:12.5px; color:var(--text-muted); }
.oc-tag { display:inline-block; max-width:100%; margin-top:7px; padding:2px 10px; border-radius:999px; background:#F3F4F6; color:#4B5563;
  font-size:11px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; vertical-align:top; }
.oc-tag.miss { background:#FEF3C7; color:#92400E; }
.oc-flag { position:absolute; bottom:11px; inset-inline-start:11px; width:8px; height:8px; border-radius:50%; background:var(--gold); box-shadow:0 0 0 3px rgba(196,149,42,.18); }
/* عدد المرؤوسين المباشرين: قرمزي = مطوي، أبيض = مفتوح */
.oc-cnt { position:absolute; bottom:-15px; left:50%; transform:translateX(-50%); display:inline-flex; align-items:center; gap:5px; height:30px; padding:0 11px;
  border:1px solid var(--crimson); border-radius:var(--radius-sm); background:var(--crimson); color:#fff; font-family:inherit; font-size:13.5px; line-height:1; direction:ltr; white-space:nowrap; }
button.oc-cnt { cursor:pointer; }
button.oc-cnt:hover { background:var(--crimson-dark); border-color:var(--crimson-dark); }
.oc-cnt[aria-expanded="true"] { background:#fff; color:var(--crimson); border-color:#F0D2D2; }
.oc-cnt[aria-expanded="true"]:hover { background:#FDF5F5; }
span.oc-cnt { background:#F3F4F6; border-color:#F3F4F6; color:#6B7280; }
.oc-cnt b { font-weight:800; font-variant-numeric:tabular-nums; }
.oc-cnt .ico { width:14px; height:14px; }
/* قائمة «…» */
.oc-more { position:absolute; top:6px; inset-inline-end:6px; width:28px; height:28px; display:flex; align-items:center; justify-content:center;
  border:none; border-radius:8px; background:none; color:#6B7280; cursor:pointer; opacity:0; transition:opacity .12s; }
.oc-more .ico { width:18px; height:18px; }
.oc-more:hover, .oc-more[aria-expanded="true"] { background:#FAF3F3; color:var(--crimson); }
.oc-card:hover .oc-more, .oc-card:focus-within .oc-more, .oc-more[aria-expanded="true"] { opacity:1; }
@media (hover:none) { .oc-more { opacity:1; } }
.oc-menu { position:absolute; top:36px; inset-inline-end:6px; z-index:6; min-width:176px; padding:4px; background:#fff; border:1px solid var(--border);
  border-radius:14px; box-shadow:var(--shadow-lg); text-align:start; }
.oc-menu[hidden] { display:none; }
.oc-menu button { display:flex; align-items:center; gap:8px; width:100%; padding:8px 10px; border:none; border-radius:7px; background:none;
  font-family:inherit; font-size:13px; color:var(--text); cursor:pointer; text-align:start; }
.oc-menu button:hover { background:#FAF6F6; color:var(--crimson); }
.oc-menu .ico { width:16px; height:16px; color:var(--text-muted); }
/* نافذة «إضافة موظف للفريق» */
.am-hint { margin-bottom:12px; font-size:13px; line-height:1.8; color:var(--text-muted); }
.am-list { max-height:320px; overflow:auto; margin-top:10px; border:1px solid var(--border); border-radius:10px; }
.am-row { display:flex; align-items:center; gap:10px; padding:9px 12px; border-bottom:1px solid #F1F2F5; cursor:pointer; }
.am-row:last-child { border-bottom:none; }
.am-row:hover { background:#FAFAFB; }
.am-row:has(input:checked) { background:#FBF4F4; }
.am-row input { width:17px; height:17px; flex-shrink:0; accent-color:var(--crimson); }
.am-av { width:32px; height:32px; border-radius:50%; background:#FDF0F0; color:var(--crimson); font-size:12px; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0; direction:ltr; }
.am-txt { flex:1; min-width:0; }
.am-txt b, .am-txt span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; unicode-bidi:plaintext; text-align:start; }
.am-txt b { font-size:13.5px; }
.am-txt span { font-size:12px; color:var(--text-muted); }
.am-cur { max-width:42%; font-size:12px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.am-more { padding:10px 12px; font-size:12.5px; color:var(--text-muted); }
.am-sum { min-height:1.8em; margin-top:12px; font-size:13.5px; line-height:1.8; }
/* أصحاب رقم من سطر المشاكل: نفس البطاقات تحت المخطط */
.oc-set { margin:0 18px 22px; padding-top:22px; border-top:1.5px dashed var(--border); scroll-margin-top:84px; }
.oc-set-h { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:16px; }
.oc-set-h b { font-size:15.5px; font-weight:800; }
.oc-set-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:30px 16px; }
.oc-set-grid .oc-card { width:auto; }
.oc-empty { padding:18px; text-align:center; color:var(--text-muted); font-size:13.5px; }
@media (max-width:560px) {
  .og-chart { padding:18px 10px 4px; }
  .oc-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:38px 10px; }
  .oc-card { width:auto; min-height:120px; padding:30px 8px 24px; }
  .oc-card.open, .oc-card.hit { padding:29px 7px 23px; }
  .oc-head .oc-card { width:min(244px, 100%); }
  .oc-no { max-width:72px; font-size:10.5px; padding:2px 7px; }
  .oc-name { font-size:13.5px; }
}

/* ─── تصدير PDF (طباعة) للمخططات: html.print-mode يُضاف قبل الطباعة ويُزال بعدها ─── */
.print-head { display: none; }
@media print { @page { size: A4 landscape; margin: 12mm; } }
html.print-mode, html.print-mode body { background: #fff; }
html.print-mode * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html.print-mode .sidebar, html.print-mode .topbar, html.print-mode .page-head, html.print-mode .og-health, html.print-mode .og-bar,
html.print-mode .og-scope, html.print-mode .oc-more, html.print-mode .oc-menu, html.print-mode .menu-btn, html.print-mode .toast,
html.print-mode .oc-set .link-btn, html.print-mode .oc-cnt.sc-act { display: none !important; }
html.print-mode .main, html.print-mode .content { padding: 0; }
html.print-mode .page-wrap { max-width: none; animation: none; }
html.print-mode .card { border: none; box-shadow: none; }
/* عرض ثابت يناسب A4 بالعرض (≈1030px بعد الهوامش) فتبقى خطوط الربط في مكانها */
html.print-mode .og-chart, html.print-mode .oc-set, html.print-mode .print-head { width: 1000px; margin-inline: auto; }
html.print-mode .og-chart { padding: 0; }
html.print-mode .oc-card { box-shadow: none; break-inside: avoid; }
html.print-mode .oc-head { break-inside: avoid; break-after: avoid; }
html.print-mode .print-head { display: flex; align-items: center; gap: 18px; padding-bottom: 10px; margin-bottom: 20px; border-bottom: 2px solid var(--crimson); }
.print-head .ph-wm { direction: ltr; font-style: italic; font-weight: 900; font-size: 20px; letter-spacing: -.6px; color: #1F2A6B; }
.print-head .ph-wm b { color: var(--crimson-light); font-weight: 900; }
.print-head .ph-wm img { height: 30px; width: auto; display: block; }
.print-head .ph-t { flex: 1; display: flex; flex-direction: column; }
.print-head .ph-t b { font-size: 18px; font-weight: 800; }
.print-head .ph-t span { font-size: 13px; color: var(--text-muted); }
.print-head .ph-d { font-size: 12.5px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   التقارير القابلة للطباعة (CO.doc): مستند مستقل يحلّ محل الصفحة أثناء الطباعة
═══════════════════════════════════════════════════════ */
#printDoc { display: none; }
html.doc-mode, html.doc-mode body { background: #fff; }
html.doc-mode .app, html.doc-mode .toast, html.doc-mode .modal-ov { display: none !important; }
html.doc-mode #printDoc { display: block; }
html.doc-mode * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd { width: 1000px; margin: 0 auto; padding: 8px 0 24px; color: var(--text); font-size: 12.5px; line-height: 1.7; }
.pd-head { display: flex; align-items: center; gap: 18px; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 2px solid var(--crimson); }
.pd-wm { direction: ltr; font-style: italic; font-weight: 900; font-size: 21px; letter-spacing: -.6px; color: #1F2A6B; }
.pd-wm b { color: var(--crimson-light); font-weight: 900; }
.pd-wm img { height: 30px; width: auto; display: block; }
.pd-t { flex: 1; display: flex; flex-direction: column; }
.pd-t b { font-size: 19px; font-weight: 800; }
.pd-t span { font-size: 12.5px; color: var(--text-muted); }
.pd-d { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--text-muted); }
.pd-sec { margin-top: 22px; }
.pd-sec.newpage { break-before: page; margin-top: 0; }
.pd-h2 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pd-h2 b { font-size: 15px; font-weight: 800; color: var(--crimson); }
.pd-h2 span { font-size: 12px; color: var(--text-muted); }
.pd-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pd-kpi { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; }
.pd-kpi b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pd-kpi span { font-size: 12px; color: var(--text-muted); }
.pd-kpi.warn { border-color: #F1D9A6; background: #FFFBEB; } .pd-kpi.warn b { color: #92400E; }
.pd-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.pd-tbl th { padding: 7px 9px; background: var(--crimson); color: #fff; font-weight: 700; text-align: start; border: 1px solid var(--crimson); }
.pd-tbl td { padding: 6px 9px; border: 1px solid var(--border); vertical-align: top; }
.pd-tbl tbody tr:nth-child(even) td { background: #F9FAFB; }
.pd-tbl tr { break-inside: avoid; }
.pd-tbl thead { display: table-header-group; }
.pd-tbl .num { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-tbl .miss { color: #92400E; font-weight: 700; }
.pd-tbl .grp td { background: #FAF3F3 !important; color: var(--crimson); font-weight: 800; }
.pd-tbl .sub { display: block; font-size: 11px; color: var(--text-muted); }
/* المصفوفة */
.pd-mx { table-layout: fixed; }
.pd-mx th { text-align: center; font-size: 11px; line-height: 1.4; vertical-align: bottom; }
.pd-mx th:first-child { text-align: start; width: 280px; vertical-align: middle; }
.pd-mx td.ck { text-align: center; vertical-align: middle; }
.pd-mx td.ck.on { color: #15803D; font-weight: 800; font-size: 14px; }
.pd-mx td.ck.all { color: #9CA3AF; }
.pd-legend { margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }
.pd-foot { margin-top: 26px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* ═══ شاشة التحميل والانتقال (loader.js) ═══ */
#coLoader { position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center;
  background: rgba(34,36,48,.80); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .28s ease, visibility .28s; font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif; }
html.co-wait #coLoader { opacity: 1; visibility: visible; pointer-events: auto; transition: none; }
html:not(.co-wait) #coLoader .cl-in * { animation-play-state: paused; }
#coLoader .cl-in { display: flex; flex-direction: column; align-items: center; gap: 0; direction: ltr; }
#coLoader .cl-mark { position: relative; width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
#coLoader .cl-mark i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; }
#coLoader .cl-r1 { border-top-color: #C23B3B !important; border-inline-start-color: rgba(194,59,59,.55) !important; animation: clSpin 1.5s linear infinite; }
#coLoader .cl-r2 { inset: 9px !important; border-bottom-color: rgba(255,255,255,.55) !important; animation: clSpin 2.4s linear infinite reverse; }
#coLoader .cl-c { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 5px rgba(194,59,59,.18), 0 10px 30px rgba(0,0,0,.35); animation: clPulse 1.8s ease-in-out infinite; }
#coLoader .cl-c img { width: 54px; height: auto; display: block; }
#coLoader .cl-bars { display: flex; align-items: flex-end; gap: 5px; height: 30px; margin-top: 26px; }
#coLoader .cl-bars i { width: 4px; border-radius: 2px; background: linear-gradient(#E0524E, #A82020); height: 10px; animation: clBar 1s ease-in-out infinite; }
#coLoader .cl-bars i:nth-child(2) { animation-delay: .12s; } #coLoader .cl-bars i:nth-child(3) { animation-delay: .24s; }
#coLoader .cl-bars i:nth-child(4) { animation-delay: .36s; } #coLoader .cl-bars i:nth-child(5) { animation-delay: .48s; }
#coLoader .cl-t { margin-top: 14px; font-size: 17px; font-weight: 700; color: #E9EAF0; direction: rtl; letter-spacing: .2px; }
#coLoader .cl-s { margin-top: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 2.2px; color: rgba(233,234,240,.55); }
@keyframes clSpin { to { transform: rotate(360deg); } }
@keyframes clPulse { 50% { transform: scale(1.05); } }
@keyframes clBar { 0%, 100% { height: 8px; opacity: .55; } 50% { height: 28px; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #coLoader * { animation: none !important; } }
@media print { #coLoader { display: none !important; } }
