/* الهيكل التنظيمي — grouped views (departments, products & projects) */
.ogx-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.ogx-box { position: relative; background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--dc) 45%, var(--border)); border-radius: 16px;
  padding: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); border-top: 5px solid var(--dc); min-width: 0; }
.ogx-box.wide { grid-column: 1 / -1; }
.ogx-box.dashed { border-style: dashed; border-top-style: solid; background: var(--surface-2); }
.ogx-box.faded { opacity: .7; }
.ogx-box.nested { background: color-mix(in srgb, var(--dc) 4%, var(--surface)); border-top-width: 3px; padding: 12px; }
.ogx-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ogx-head h3 { font-size: 15.5px; font-weight: 700; color: var(--text); margin: 0; }
.ogx-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--dc); flex-shrink: 0; }
.ogx-headname { font-size: 12px; color: var(--muted); }
.ogx-edit { margin-inline-start: auto; }
.ogx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ogx-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed color-mix(in srgb, var(--dc) 35%, var(--border)); }

.ogx-person { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .15s, box-shadow .15s, opacity .15s; min-width: 0; }
.ogx-person:hover { border-color: var(--dc, var(--brand)); box-shadow: var(--shadow); }
.ogx-person:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ogx-person.hit { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.ocx-dim .ogx-person:not(.hit) { opacity: .4; }
.ogx-pname { font-weight: 700; font-size: 13px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ogx-psub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ogx-psub2 { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ogx-tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 7px; border-radius: 999px; vertical-align: 1px;
  background: color-mix(in srgb, var(--dc, var(--brand)) 14%, #fff); color: color-mix(in srgb, var(--dc, var(--brand)) 80%, #000); }
.ogx-dchip { color: color-mix(in srgb, var(--dc) 80%, #000); font-weight: 600; }
.ogx-dchip::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dc); margin-inline-end: 4px; vertical-align: 1px; }

.ogx-kind { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 6px; color: #fff; background: var(--dc); }
.ogx-kind.product { border-radius: 999px; }
.ogx-st { font-size: 11px; font-weight: 600; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2); }
.ogx-st.active { background: var(--success-bg); color: var(--success); border-color: #a7f3d0; }
.ogx-st.planned { background: var(--info-bg); color: #1d4ed8; border-color: #bfdbfe; }
.ogx-st.on_hold { background: var(--warning-bg); color: var(--warning); border-color: #fde68a; }
.ogx-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.ogx-meta b { color: var(--text-2); }
.ogx-desc { font-size: 12.5px; color: var(--text-2); margin: -2px 0 12px; line-height: 1.6; }
.ogx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }

/* Editor */
.ogx-swatches { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.ogx-sw { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px #fff; }
.ogx-sw.on { border-color: var(--text); }
.ogx-picker { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ogx-plist { max-height: 300px; overflow-y: auto; }
.ogx-prow { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.ogx-prow:last-child { border-bottom: 0; }
.ogx-prow.on { background: var(--brand-50); }
.ogx-role { width: 180px; flex-shrink: 0; height: 34px; }

@media (max-width: 700px) {
  .ogx-wrap, .ogx-subs { grid-template-columns: 1fr; }
  .ogx-grid { grid-template-columns: 1fr; }
  .ogx-prow { flex-wrap: wrap; }
  .ogx-role { width: 100%; }
}
@media print {
  .ogx-box, .ogx-kind, .ogx-tag, .ogx-dot, .ogx-st { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ogx-box { break-inside: avoid; box-shadow: none; }
  .ocx-dim .ogx-person:not(.hit) { opacity: 1; }
}