/* آلية تشغيل الأنظمة — عرض كامل + شبكات متجاوبة */

body[data-hub-page="system-ops"] main.container[data-system-ops] {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.25rem clamp(14px, 2vw, 28px) 3.5rem;
  box-sizing: border-box;
}

body[data-hub-page="system-ops"] {
  overflow-x: hidden;
}

body[data-hub-page="system-ops"] .hub-feature-hero {
  width: 100%;
  box-sizing: border-box;
}

body[data-hub-page="system-ops"] .hub-feature-hero h1 {
  max-width: none;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1.35;
}

body[data-hub-page="system-ops"] .hub-feature-hero > p {
  max-width: 64rem;
}

.sysops-system-badge {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 235, 238, 0.95);
  font-weight: 900;
  font-size: 13px;
}

.sysops-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
  width: 100%;
}

.sysops-sidebar {
  position: sticky;
  top: 88px;
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 6px;
  box-shadow: 0 8px 22px rgba(12, 14, 17, 0.06);
  min-width: 0;
}

.sysops-sidebar a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #303848;
  font-weight: 800;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 12px;
}

.sysops-sidebar a.is-active,
.sysops-sidebar a:hover {
  background: rgba(215, 0, 0, 0.08);
  color: #d70000;
}

/* مؤشرات — حتى ~11 عنصرًا في صف واحد على الشاشات الواسعة */
.sysops-kpis {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
  width: 100%;
}

.sysops-kpi {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  min-width: 0;
  box-sizing: border-box;
}

.sysops-kpi strong {
  display: block;
  color: #d70000;
  font-size: 18px;
}

.sysops-kpi span {
  font-size: 11px;
  font-weight: 800;
  color: #667085;
  line-height: 1.35;
  display: block;
}

/* بطاقات القدرات — حتى 6 في الصف */
.sysops-caps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
}

.sysops-cap {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  box-sizing: border-box;
}

.sysops-cap:hover {
  border-color: #f0b4b4;
  box-shadow: 0 8px 18px rgba(215, 0, 0, 0.08);
}

.sysops-cap:focus-visible {
  outline: 2px solid #d70000;
  outline-offset: 2px;
}

.sysops-cap:active {
  transform: scale(0.985);
}

.sysops-cap.is-active {
  border-color: #d70000;
  background: rgba(215, 0, 0, 0.05);
  box-shadow: 0 0 0 2px rgba(215, 0, 0, 0.15);
}

.sysops-cap.is-active::after {
  content: '✓';
  margin-inline-start: auto;
  color: #d70000;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  padding-top: 2px;
  flex-shrink: 0;
}

.sysops-cap i {
  color: #d70000;
  margin-top: 3px;
  flex-shrink: 0;
}

.sysops-cap strong {
  display: block;
  font-size: 12px;
  line-height: 1.45;
}

.sysops-cap small {
  color: #8891a0;
  font-weight: 700;
  font-size: 11px;
}

.sysops-section {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  scroll-margin-top: 96px;
  min-width: 0;
}

.sysops-section.is-flash {
  animation: sysops-section-flash 1.4s ease;
}

@keyframes sysops-section-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(215, 0, 0, 0.35);
    border-color: #d70000;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    border-color: #e8eaf0;
  }
}

.sysops-section h2,
.sysops-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.sysops-form,
.sysops-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.sysops-form input,
.sysops-form select,
.sysops-form textarea,
.sysops-form-row input,
.sysops-form-row select {
  font: inherit;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

.sysops-form label,
.sysops-form-row label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

.sysops-list {
  display: grid;
  gap: 8px;
}

.sysops-list article {
  border: 1px solid #edf0f5;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafbfc;
}

.sysops-list strong {
  display: block;
  font-size: 13px;
}

.sysops-list span,
.sysops-list small {
  font-size: 12px;
  color: #667085;
  font-weight: 700;
}

.sysops-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sysops-mod {
  border: 1px solid #e6eaf2;
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  color: #303848;
}

.sysops-mod.is-on {
  background: #d70000;
  border-color: #d70000;
  color: #fff;
}

.sysops-modules--dense .sysops-mod {
  font-size: 11px;
  padding: 6px 10px;
}

.sysops-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sysops-chips span {
  background: #fff5f5;
  color: #b00000;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
}

.sysops-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sysops-note {
  font-size: 13px;
  font-weight: 700;
  color: #505868;
}

.sysops-empty {
  color: #8891a0;
  font-weight: 700;
}

.sysops-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 100;
}

.sysops-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* —— Responsive —— */
@media (max-width: 1400px) {
  .sysops-caps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .sysops-kpis {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .sysops-caps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sysops-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .sysops-layout {
    grid-template-columns: 1fr;
  }
  .sysops-sidebar {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }
  .sysops-caps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sysops-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .sysops-section {
    scroll-margin-top: 80px;
  }
  .sysops-caps {
    grid-template-columns: 1fr;
  }
  .sysops-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body[data-hub-page="system-ops"] main.container[data-system-ops] {
    padding-inline: 12px;
  }
}

@media (max-width: 400px) {
  .sysops-kpis {
    grid-template-columns: 1fr;
  }
}
