/* ═══════════════════════════════════════════════════════════════
   admin.css (v6.62) · «الإدارة» المرحلة 1
   ورقة الإجراءات (object-sheet) ونافذة أثر الإجراء (impact-dialog). الألوان من tokens.css فقط.
   ═══════════════════════════════════════════════════════════════ */

.os-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: transparent; }
.os-backdrop.os-dim { background: rgba(0,0,0,0.32); }
.os-sheet {
  position: fixed; z-index: calc(var(--z-modal) + 1);
  background: var(--paper); color: var(--ink-1);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-3);
  font-size: var(--fs-md); direction: rtl;
}
.os-pop { width: 290px; max-height: 70vh; overflow: auto; border-radius: var(--r-md); }
.os-bottom {
  inset-inline: 0; bottom: 0; max-height: 80vh; overflow: auto;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom, 0);
}
.os-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.os-kind { font-size: var(--fs-xs); color: var(--ink-3); }
.os-name { font-weight: 700; font-size: var(--fs-lg); }
.os-path, .os-kids { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; }
.os-list { padding: 4px 0; }
.os-sep { height: 1px; background: var(--line); margin: 4px 0; }
.os-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 14px; min-height: 40px; border: 0; background: none;
  font: inherit; color: inherit; text-align: start; cursor: pointer;
}
.os-bottom .os-item { min-height: 48px; }
.os-item:hover, .os-item:focus-visible { background: var(--softer); outline: none; }
.os-item:focus-visible { box-shadow: inset 0 0 0 2px var(--line-vstrong); }
.os-item[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }
.os-item.danger { color: var(--danger); }
.os-item.danger:hover, .os-item.danger:focus-visible { background: var(--danger-bg); }
.os-item.danger[aria-disabled="true"] { color: var(--ink-3); }
.os-ic { width: 1.2em; text-align: center; }
.os-lbl { flex: 1; }
.os-why { font-size: var(--fs-xs); color: var(--ink-3); }

/* ─── أثر الإجراء ─── */
.imp-sum { margin: 0 0 6px; }
.imp-list { margin: 0 0 8px; padding-inline-start: 18px; color: var(--ink-2); font-size: var(--fs-sm); }
.imp-list .more { color: var(--ink-3); list-style: none; }
.imp-note { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--ink-2); }
.imp-alts { display: grid; gap: 8px; margin-top: 10px; }
.imp-card {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--softest); cursor: pointer;
}
.imp-card:has(input:checked) { border-color: var(--ink-2); background: var(--paper); }
.imp-card.danger:has(input:checked) { border-color: var(--danger); background: var(--danger-bg); }
.imp-card input { margin-top: 3px; }
.imp-tx { display: flex; flex-direction: column; gap: 2px; }
.imp-tx small { color: var(--ink-3); font-size: var(--fs-xs); }
.imp-card.danger b { color: var(--danger); }
.imp-card.is-off { opacity: .6; cursor: not-allowed; }
.imp-rec { font-style: normal; font-size: var(--fs-xs); color: var(--good); margin-inline-start: 6px; }

/* ─── دورة الحياة (v6.64): شارتا «موقوف» و«مؤرشف» ─── */
.badge-paused, .badge-archived {
  display: inline-block; padding: 1px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; vertical-align: middle; white-space: nowrap;
}
.badge-paused { color: var(--status-paused); background: var(--status-paused-bg); }
.badge-archived { color: var(--status-archived); background: var(--status-archived-bg); }
.os-inherit { margin-top: 4px; font-size: var(--fs-xs); color: var(--ink-3); }
.ar-group { margin-bottom: 18px; }
.ar-group-h { margin: 0 0 8px; font-size: var(--fs-lg); }
.ar-owner-note { color: var(--ink-3); font-size: var(--fs-sm); }
.cn-archived { margin-top: 18px; }
.cn-arch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cn-arch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--softest); }
.is-archived-row { opacity: .55; }
.bd-bar i.paused, .ss-seg.paused { background: var(--status-paused); }

/* ═══════════════════════════════════════════════════════════════
   v6.65 · «الإدارة» المرحلة 3: المركز والترتيب. الألوان من tokens.css فقط.
   ═══════════════════════════════════════════════════════════════ */

/* ─── الترتيب ─── */
.order-slot { display: inline-flex; flex: none; }
.order-slot:empty { display: none; }
.drag-handle {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; min-height: 28px; margin-inline-end: 4px;
  border-radius: var(--r-sm); color: var(--ink-3); cursor: grab;
  font-size: var(--fs-sm); letter-spacing: -2px; line-height: 1; user-select: none;
  touch-action: none;   /* المقبض وحده: لا يُعطَّل تمرير الصفحة */
}
.drag-handle:hover, .drag-handle:focus-visible { background: var(--soft); color: var(--ink-1); }
.drag-handle[aria-disabled="true"] { cursor: not-allowed; opacity: .45; }
.drag-handle[data-alone] { visibility: hidden; }
.is-reordering .drag-handle { cursor: grabbing; }
.is-dragging { opacity: .55; outline: 1px dashed var(--line-vstrong); outline-offset: 2px; }
.reorder-line {
  position: fixed; height: 2px; background: var(--accent); border-radius: var(--r-pill);
  z-index: calc(var(--z-modal) + 2); pointer-events: none;
}
@media (pointer: coarse) { .drag-handle { width: 36px; min-height: 40px; font-size: var(--fs-lg); } }

/* ─── مركز الإدارة ─── */
.adm-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs .hub-tab { flex: none; }
.adm-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-2) 0; }
.adm-q { flex: 1 1 200px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); font: inherit; background: var(--paper); color: var(--ink-1); }
.adm-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; }
.adm-seg-b { border: 0; background: var(--paper); color: var(--ink-2); padding: 7px 10px; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.adm-seg-b + .adm-seg-b { border-inline-start: 1px solid var(--line); }
.adm-seg-b.on { background: var(--brand-green); color: var(--on-brand); }
.adm-seg-b i { font-style: normal; opacity: .75; }
.adm-sum { margin: 0 0 var(--s-2); font-size: var(--fs-sm); }
.adm-sec { margin: var(--s-4) 0; }
.adm-h { font-size: var(--fs-lg); margin: 0 0 var(--s-2); }
.adm-gh { font-size: var(--fs-sm); color: var(--ink-3); margin: var(--s-3) 0 var(--s-1); }
.adm-list { display: flex; flex-direction: column; gap: 2px; }
.adm-node { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); margin-bottom: var(--s-2); padding: 2px; }
.adm-sub { margin-inline-start: 28px; padding-inline-start: var(--s-2); border-inline-start: 2px solid var(--line); }
.adm-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--s-2);
  padding: 6px 8px; border-radius: var(--r-sm); background: var(--paper);
}
/* مواضع ثابتة: إخفاء مقبض الترتيب أو مربع التحديد لا يزيح الاسم إلى عمود غير قابل للانكماش */
.adm-row > .order-slot { grid-column: 1; }
.adm-row > .adm-ck { grid-column: 2; }
.adm-row > .adm-main { grid-column: 3; }
.adm-row > .adm-kids { grid-column: 4; }
.adm-row > .adm-gear { grid-column: -2 / -1; }
.adm-row:hover { background: var(--softest); }
.adm-row.is-sel { background: var(--gold-bg); box-shadow: inset -3px 0 0 var(--accent); }
[dir="ltr"] .adm-row.is-sel { box-shadow: inset 3px 0 0 var(--accent); }
.adm-ck input { width: 18px; height: 18px; accent-color: var(--brand-green); }
.adm-main { min-width: 0; display: flex; flex-direction: column; }
.adm-name { font-weight: 700; color: var(--ink-1); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-name:hover { text-decoration: underline; }
.adm-path { color: var(--ink-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-kids { color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; }
.adm-gear { border: 1px solid var(--line); background: var(--paper); cursor: pointer; width: 32px; height: 32px; border-radius: var(--r-sm); }
.adm-wb-sum { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-2) 0; color: var(--ink-2); }
.adm-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.adm-gov { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-2); }
.adm-gov-b { display: flex; flex-direction: column; gap: 2px; text-align: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); font: inherit; cursor: pointer; color: var(--ink-1); }
.adm-gov-b:hover { background: var(--softest); border-color: var(--line-strong); }
.adm-gov-b small, .adm-switch small { color: var(--ink-3); font-size: var(--fs-xs); }
.adm-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.adm-switch > span { display: flex; flex-direction: column; }
.sw { position: relative; width: 44px; height: 26px; flex: none; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--soft); cursor: pointer; padding: 0; }
.sw-knob { position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); box-shadow: var(--shadow-1); transition: inset-inline-start .15s; }
.sw[aria-checked="true"] { background: var(--brand-green); }
.sw[aria-checked="true"] .sw-knob { inset-inline-start: 20px; }
.dh-fix { margin-inline-start: 6px; }
@media (max-width: 640px) {
  .adm-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .adm-kids { display: none; }
  .adm-sub { margin-inline-start: 12px; }
}

/* ─── شريط التحديد ─── */
.bulk-bar {
  position: sticky; bottom: 0; z-index: var(--z-header);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  margin-top: var(--s-3); padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0));
  background: var(--brand-green); color: var(--on-brand); border-radius: var(--r-md); box-shadow: var(--shadow-3);
}
.bulk-bar[hidden] { display: none; }
.bulk-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.bulk-bar .btn { background: var(--paper); color: var(--ink-1); }
.bulk-bar .btn.danger { color: var(--danger); }
@media (pointer: coarse) { .bulk-bar { bottom: calc(72px + env(safe-area-inset-bottom, 0)); } }

/* ─── قائمة ⚙ المجمّعة وقائمة الحساب ─── */
.tools-head { padding: 6px 12px 2px; font-size: var(--fs-2xs); font-weight: 700; color: var(--ink-3); }
.tools-pop a.tools-item { text-decoration: none; display: block; }
.acct-menu { position: relative; }
.acct-btn { cursor: pointer; font: inherit; font-size: var(--fs-xs); color: var(--ink-1); }
.acct-ic { font-size: var(--fs-sm); }
.acct-pop { inset-inline-start: auto; inset-inline-end: 0; }
@media (max-width: 720px) { .acct-btn .user-email, .acct-btn .user-role, .acct-caret { display: none; } .acct-btn { padding: 4px 8px; } }

/* ─── الورشة: تبويبا الجوال ─── */
.wb-mtabs { display: none; }
.formation .order-slot .drag-handle { margin-inline-end: 2px; }
.card-ind .ci-gear { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 0 2px; font: inherit; }
@media (max-width: 640px) {
  .wb-mtabs { display: flex; margin: 0 0 var(--s-3); }
  .workbench[data-pane="forms"] > .pool { display: none; }
  .workbench[data-pane="pool"] > .wb-forms-col { display: none; }
}
