/* الشاشات الرقمية: مسرح العرض (مشترك بين الجهاز والمعاينة) + صفحات الإدارة */
@import url('/css/fonts.css');

/* ============================================================ المسرح */
.sg-root {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  border-radius: inherit;
}
.sg-mode-player {
  position: fixed;
  inset: 0;
  height: 100%;
  cursor: none;
}
.sg-stage {
  --sg-primary: #5b1a2e;
  --sg-accent: #d9a441;
  --sg-bg: #1a0910;
  --sg-bg2: #4a1426;
  --sg-text: #fff;
  --sg-scale: 1;
  --sg-card: rgba(255, 255, 255, 0.08);
  --sg-card-line: rgba(255, 255, 255, 0.14);
  --sg-muted: rgba(255, 255, 255, 0.72);
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  overflow: hidden;
  direction: rtl;
  color: var(--sg-text);
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  font-size: calc(26px * var(--sg-scale));
  display: flex;
  flex-direction: column;
  translate: var(--sg-shift, 0) 0;
}
.sg-stage.light {
  --sg-card: rgba(255, 255, 255, 0.86);
  --sg-card-line: rgba(20, 33, 61, 0.12);
  --sg-muted: rgba(31, 41, 55, 0.7);
}
.sg-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, var(--sg-bg) 0%, var(--sg-bg2) 100%);
}
.sg-stage.bg-solid .sg-bg {
  background: var(--sg-bg);
}
.sg-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sg-stage.bg-image .sg-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
}
.sg-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background: radial-gradient(
      1200px 600px at 110% -10%,
      color-mix(in srgb, var(--sg-accent) 22%, transparent),
      transparent 60%
    ),
    radial-gradient(900px 700px at -10% 120%, color-mix(in srgb, var(--sg-primary) 55%, transparent), transparent 60%);
}
.sg-stage > * {
  position: relative;
  z-index: 1;
}
.sg-stage > .sg-bg {
  position: absolute;
  z-index: 0;
}

/* الترويسة */
.sg-header {
  height: 128px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 0 48px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--sg-primary) 92%, #000), var(--sg-primary));
  border-bottom: 4px solid var(--sg-accent);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  color: #fff;
}
.sg-h-brand {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}
.sg-h-logo {
  height: 88px;
  width: 88px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px;
}
.sg-h-glyph {
  height: 84px;
  width: 84px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 52px;
  background: var(--sg-accent);
  color: var(--sg-primary);
}
.sg-h-title {
  font-family: 'Zain', 'Cairo', sans-serif;
  font-weight: 800;
  font-size: calc(48px * var(--sg-scale));
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 1000px;
}
.sg-h-sub {
  font-size: calc(24px * var(--sg-scale));
  opacity: 0.85;
  margin-top: 4px;
}
.sg-h-clock {
  text-align: left;
  direction: rtl;
}
.sg-h-time {
  font-size: calc(58px * var(--sg-scale));
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  direction: ltr;
}
.sg-h-date {
  font-size: calc(21px * var(--sg-scale));
  opacity: 0.9;
  margin-top: 8px;
  white-space: nowrap;
}

/* جسم المسرح والمناطق */
.sg-body {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 26px;
  padding: 28px 40px;
}
.sg-body.tpl-full,
.sg-body.tpl-main_ticker {
  grid-template-areas: 'main';
}
.sg-body.tpl-main_side,
.sg-body.tpl-main_side_ticker {
  grid-template-columns: minmax(0, 1fr) 36%;
  grid-template-areas: 'main side';
}
.sg-body.tpl-split,
.sg-body.tpl-split_ticker {
  grid-template-columns: 1fr 1fr;
  grid-template-areas: 'start end';
}
.sg-body.tpl-l_shape {
  grid-template-columns: minmax(0, 1fr) 34%;
  grid-template-rows: minmax(0, 1fr) 30%;
  grid-template-areas: 'main side' 'bottom bottom';
}
.sg-body.tpl-quad {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas: 'a b' 'c d';
}
.sg-stage[data-orientation='portrait'] .sg-body.tpl-main_side,
.sg-stage[data-orientation='portrait'] .sg-body.tpl-main_side_ticker {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) 34%;
  grid-template-areas: 'main' 'side';
}
.sg-stage[data-orientation='portrait'] .sg-body.tpl-split,
.sg-stage[data-orientation='portrait'] .sg-body.tpl-split_ticker {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas: 'start' 'end';
}
.sg-stage[data-orientation='portrait'] .sg-body.tpl-l_shape {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) 26% 22%;
  grid-template-areas: 'main' 'side' 'bottom';
}
.sg-zone {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 30px;
  overflow: hidden;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
}
.z-main {
  grid-area: main;
}
.z-side {
  grid-area: side;
}
.z-start {
  grid-area: start;
}
.z-end {
  grid-area: end;
}
.z-bottom {
  grid-area: bottom;
}
.z-a {
  grid-area: a;
}
.z-b {
  grid-area: b;
}
.z-c {
  grid-area: c;
}
.z-d {
  grid-area: d;
}
.sg-zone-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 14px;
  color: var(--sg-muted);
  font-size: 0.9em;
}
.sg-zone-empty span {
  font-size: 70px;
  opacity: 0.6;
}

/* الشرائح والانتقالات */
.sg-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition:
    opacity 0.9s ease,
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.sg-slide.in {
  opacity: 1;
  transform: none;
}
.sg-slide.out {
  opacity: 0;
}
.sg-slide.t-slide {
  transform: translateX(-6%);
}
.sg-slide.t-slide.out {
  transform: translateX(6%);
}
.sg-slide.t-zoom {
  transform: scale(1.06);
}
.sg-slide.t-zoom.out {
  transform: scale(0.97);
}
.sg-slide.t-none {
  transition: none;
}
.sg-media {
  position: absolute;
  inset: 0;
  background: #000;
}
.sg-media-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sg-media.fit-contain .sg-media-main {
  object-fit: contain;
}
.sg-media-blur {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(34px) brightness(0.55);
}
.sg-caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 70px 44px 30px;
  font-size: 1.25em;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent);
}

/* الشريحة النصية */
.sg-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 70px 90px;
  color: var(--t-fg);
  overflow: hidden;
}
.sg-text-card {
  background: linear-gradient(145deg, var(--t-bg), var(--t-bg2));
}
.sg-text-gradient {
  background: radial-gradient(circle at 20% 20%, var(--t-bg2), var(--t-bg) 70%);
}
.sg-text-plain {
  background: var(--t-bg);
}
.sg-text-banner {
  background: var(--t-bg);
}
.sg-text-banner::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 26px;
  background: var(--t-accent);
}
.sg-text-quote {
  background: linear-gradient(160deg, var(--t-bg), var(--t-bg2));
}
.sg-text-quote .sg-text-heading::before {
  content: '❝ ';
  color: var(--t-accent);
}
.sg-text-card::after {
  content: '';
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  inset-inline-end: -160px;
  top: -200px;
  background: color-mix(in srgb, var(--t-accent) 22%, transparent);
}
.sg-text-bgimg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}
.sg-text-inner {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sg-text.align-center .sg-text-inner {
  text-align: center;
  align-items: center;
}
.sg-text-icon {
  font-size: 2.6em;
  line-height: 1;
}
.sg-text-eyebrow {
  display: inline-block;
  align-self: flex-start;
  padding: 8px 22px;
  border-radius: 999px;
  background: var(--t-accent);
  color: #111;
  font-weight: 800;
  font-size: 0.8em;
}
.sg-text.align-center .sg-text-eyebrow {
  align-self: center;
}
.sg-text-heading {
  font-family: 'Zain', 'Cairo', sans-serif;
  font-weight: 800;
  line-height: 1.15;
}
.sg-text-body {
  line-height: 1.6;
  opacity: 0.95;
  white-space: pre-line;
}
.sg-text-footer {
  margin-top: 12px;
  padding-top: 18px;
  border-top: 2px solid color-mix(in srgb, var(--t-fg) 25%, transparent);
  font-weight: 700;
  color: var(--t-accent);
}
.sg-text.size-md .sg-text-heading {
  font-size: 2.2em;
}
.sg-text.size-md .sg-text-body {
  font-size: 1.1em;
}
.sg-text.size-lg .sg-text-heading {
  font-size: 3.1em;
}
.sg-text.size-lg .sg-text-body {
  font-size: 1.35em;
}
.sg-text.size-xl .sg-text-heading {
  font-size: 4.2em;
}
.sg-text.size-xl .sg-text-body {
  font-size: 1.6em;
}
.z-side .sg-text,
.z-bottom .sg-text,
.z-a .sg-text,
.z-b .sg-text,
.z-c .sg-text,
.z-d .sg-text {
  padding: 40px 44px;
  font-size: 0.62em;
}

/* الأدوات: عناصر مشتركة */
.sg-widget-host {
  position: absolute;
  inset: 0;
}
.sg-w {
  position: absolute;
  inset: 0;
  padding: 34px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sg-w-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.sg-w-head h3 {
  margin: 0;
  font-family: 'Zain', 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 1.55em;
  line-height: 1.1;
}
.sg-w-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: color-mix(in srgb, var(--sg-accent) 22%, transparent);
  font-size: 36px;
  flex: none;
}
.sg-w-meta {
  margin-inline-start: auto;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
  font-size: 0.78em;
  font-weight: 700;
  color: var(--sg-muted);
  white-space: nowrap;
}
.sg-w-empty {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 18px;
  font-size: 1.15em;
  color: var(--sg-muted);
}
.sg-w-empty-icon {
  font-size: 3.4em;
}
.sg-sub-title {
  font-weight: 800;
  color: var(--sg-accent);
  font-size: 0.95em;
}
.sg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sg-text) 12%, transparent);
  font-size: 0.76em;
  font-weight: 700;
  white-space: nowrap;
}
.sg-chip.warn {
  background: var(--sg-accent);
  color: #1a1a1a;
}
.sg-pager {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sg-pager-body {
  flex: 1;
  min-height: 0;
}
.sg-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.sg-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sg-text) 25%, transparent);
  transition: all 0.4s;
}
.sg-dots span.on {
  width: 40px;
  border-radius: 8px;
  background: var(--sg-accent);
}
.sg-page-in {
  animation: sgPageIn 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes sgPageIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* الساعة */
.sg-w-clock {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}
.sg-clock-time {
  font-size: 4.4em;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.sg-clock-day {
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 1.7em;
  color: var(--sg-accent);
  margin-top: 14px;
}
.sg-clock-date {
  font-size: 1.15em;
}
.sg-clock-hijri {
  font-size: 1em;
  color: var(--sg-muted);
}
.z-main .sg-clock-time,
.z-start .sg-clock-time,
.z-end .sg-clock-time {
  font-size: 8em;
}

/* الحصة الحالية */
.sg-now-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 20px;
  padding: 20px 28px;
  border-radius: 22px;
  background: linear-gradient(90deg, var(--sg-primary), color-mix(in srgb, var(--sg-primary) 60%, var(--sg-accent)));
  color: #fff;
}
.sg-now-banner.break {
  background: linear-gradient(90deg, #0f766e, #14b8a6);
}
.sg-now-title {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 1.15em;
}
.sg-now-title strong {
  font-family: 'Zain', sans-serif;
  font-size: 1.35em;
}
.sg-now-pill {
  padding: 4px 18px;
  border-radius: 999px;
  background: #fff;
  color: var(--sg-primary);
  font-weight: 800;
  font-size: 0.8em;
  animation: sgPulse 2s infinite;
}
.sg-now-time {
  opacity: 0.9;
  font-weight: 700;
}
.sg-now-left {
  text-align: left;
  display: flex;
  flex-direction: column;
  font-size: 0.8em;
}
.sg-now-left b {
  font-size: 1.5em;
}
.sg-progress {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
.sg-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: 10px;
  transition: width 1s;
}
@keyframes sgPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
}
.sg-lesson-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.sg-stage[data-orientation='portrait'] .sg-lesson-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sg-lesson {
  padding: 18px 22px;
  border-radius: 20px;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.sg-lesson.sub {
  border-color: var(--sg-accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sg-accent) 55%, transparent);
}
.sg-lesson-class {
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 1.25em;
  color: var(--sg-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-lesson-subject {
  font-weight: 800;
  font-size: 1.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.74em;
  color: var(--sg-muted);
  align-items: center;
}

/* الغرف */
.sg-counters {
  display: flex;
  gap: 18px;
}
.sg-counter {
  flex: 1;
  padding: 16px 22px;
  border-radius: 20px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.sg-counter b {
  font-size: 2.2em;
  line-height: 1;
}
.sg-counter.busy {
  background: rgba(220, 38, 38, 0.22);
}
.sg-counter.free {
  background: rgba(22, 163, 74, 0.22);
}
.sg-room-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.sg-room {
  padding: 14px 16px;
  border-radius: 16px;
  border-inline-start: 8px solid;
  background: var(--sg-card);
  min-width: 0;
}
.sg-room.busy {
  border-color: #ef4444;
}
.sg-room.free {
  border-color: #22c55e;
}
.sg-room-name {
  font-weight: 800;
  font-size: 0.95em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-room-state {
  font-size: 0.7em;
  color: var(--sg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* التبديلات */
.sg-sub-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sg-sub {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 16px 20px;
  border-radius: 20px;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
}
.sg-sub.uncovered {
  border-color: var(--sg-accent);
}
.sg-sub-period {
  width: 96px;
  flex: none;
  text-align: center;
  padding: 8px 0;
  border-radius: 16px;
  background: var(--sg-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.sg-sub-period b {
  font-size: 1.7em;
  line-height: 1;
}
.sg-sub-period span {
  font-size: 0.62em;
  opacity: 0.9;
}
.sg-sub-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sg-sub-class {
  font-weight: 800;
  font-size: 1.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-sub-who {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.86em;
}
.sg-sub-who b {
  color: var(--sg-accent);
}
.sg-sub-absent {
  color: var(--sg-muted);
  font-size: 0.9em;
}

/* جدول الحصص */
.sg-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.sg-tl {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 0.86em;
}
.sg-tl-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--sg-muted);
}
.sg-tl.done {
  opacity: 0.45;
}
.sg-tl.done .sg-tl-dot {
  background: var(--sg-muted);
}
.sg-tl.now {
  background: var(--sg-accent);
  color: #1a1a1a;
  font-weight: 800;
}
.sg-tl.now .sg-tl-dot {
  border-color: #1a1a1a;
  background: #fff;
}
.sg-tl.brk {
  font-style: italic;
}
.sg-tl-time {
  font-variant-numeric: tabular-nums;
}

/* الحكمة */
.sg-w-wisdom {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 50px 70px;
}
.sg-quote-mark {
  font-size: 5em;
  line-height: 0.6;
  color: var(--sg-accent);
  font-family: serif;
}
.sg-quote {
  margin: 0;
}
.sg-quote p {
  margin: 0 0 22px;
  font-family: 'Zain', 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 2.1em;
  line-height: 1.5;
}
.sg-quote cite {
  font-style: normal;
  color: var(--sg-accent);
  font-weight: 700;
  font-size: 1em;
}
.sg-quote-label {
  margin-top: 12px;
  padding: 6px 22px;
  border-radius: 999px;
  border: 1px solid var(--sg-card-line);
  font-size: 0.75em;
  color: var(--sg-muted);
}
.z-side .sg-quote p,
.z-bottom .sg-quote p,
.z-a .sg-quote p,
.z-b .sg-quote p,
.z-c .sg-quote p,
.z-d .sg-quote p {
  font-size: 1.35em;
}

/* الفعاليات والامتحانات */
.sg-events,
.sg-exam-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.sg-event {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 20px;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
}
.sg-event-date {
  width: 92px;
  flex: none;
  text-align: center;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  color: var(--sg-primary);
  display: flex;
  flex-direction: column;
}
.sg-event-date b {
  font-size: 1.8em;
  line-height: 1.2;
}
.sg-event-date span {
  background: var(--sg-primary);
  color: #fff;
  font-size: 0.62em;
  padding: 3px 0;
  font-weight: 700;
}
.sg-event-title {
  font-weight: 800;
  font-size: 1.02em;
}
.sg-event-when {
  font-size: 0.74em;
  color: var(--sg-muted);
}
.sg-exam {
  padding: 18px 22px;
  border-radius: 20px;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sg-exam-subject {
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 1.3em;
  color: var(--sg-accent);
}
.sg-exam-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sg-exam-line {
  font-size: 0.8em;
  color: var(--sg-muted);
}

/* الحضور */
.sg-att-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 30px;
}
.sg-ring-wrap {
  position: relative;
  width: 340px;
  height: 340px;
}
.sg-ring {
  width: 100%;
  height: 100%;
}
.sg-ring-bg {
  fill: none;
  stroke: color-mix(in srgb, var(--sg-text) 15%, transparent);
  stroke-width: 18;
}
.sg-ring-fg {
  fill: none;
  stroke: var(--sg-accent);
  stroke-width: 18;
  stroke-linecap: round;
}
.sg-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.sg-ring-label b {
  font-size: 2.4em;
}
.sg-ring-label span {
  font-size: 0.72em;
  color: var(--sg-muted);
}
.sg-att-stats {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sg-att-stats div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.sg-att-stats b {
  font-size: 1.8em;
}
.z-side .sg-ring-wrap,
.z-bottom .sg-ring-wrap,
.z-a .sg-ring-wrap,
.z-b .sg-ring-wrap,
.z-c .sg-ring-wrap,
.z-d .sg-ring-wrap {
  width: 220px;
  height: 220px;
}

/* العدّ التنازلي و QR */
.sg-w-count,
.sg-w-qr {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sg-count-title {
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 1.8em;
}
.sg-count-nums {
  display: flex;
  gap: 22px;
}
.sg-count-cell {
  min-width: 170px;
  padding: 22px 14px;
  border-radius: 24px;
  background: var(--sg-card);
  border: 1px solid var(--sg-card-line);
  display: flex;
  flex-direction: column;
}
.sg-count-cell b {
  font-size: 3.4em;
  line-height: 1;
  color: var(--sg-accent);
  font-variant-numeric: tabular-nums;
}
.sg-count-done {
  font-size: 2em;
  font-weight: 800;
}
.sg-count-date {
  color: var(--sg-muted);
}
.sg-qr {
  width: min(70%, 520px);
  height: auto;
  border-radius: 18px;
  image-rendering: pixelated;
}
.sg-qr-caption {
  font-weight: 800;
  font-size: 1.2em;
}

/* شريط الأخبار */
.sg-ticker {
  height: 84px;
  flex: none;
  display: flex;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.55);
  border-top: 3px solid var(--sg-accent);
  color: #fff;
}
.sg-stage.light .sg-ticker {
  background: var(--sg-primary);
}
.sg-ticker-label {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 34px;
  background: var(--sg-accent);
  color: #1a1a1a;
  font-weight: 800;
  font-size: 1.05em;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 26px 50%);
  padding-inline-start: 44px;
}
.sg-ticker-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  direction: ltr;
}
.sg-ticker-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}
.sg-ticker-track.run {
  animation: sgMarquee 40s linear infinite;
}
.sg-ticker-half {
  display: flex;
  align-items: center;
  direction: rtl;
}
.sg-ticker-item {
  font-size: 1.05em;
  font-weight: 600;
  padding: 0 30px;
}
.sg-ticker-sep {
  color: var(--sg-accent);
  font-size: 0.7em;
}
.sg-ticker-static {
  display: flex;
  align-items: center;
  height: 100%;
  justify-content: center;
  direction: rtl;
  font-weight: 700;
}
@keyframes sgMarquee {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

/* البث الطارئ والسكون والتعريف */
.sg-alert {
  position: absolute;
  z-index: 20;
  color: #fff;
}
.sg-alert.banner {
  top: 150px;
  inset-inline: 60px;
  border-radius: 26px;
  padding: 26px 40px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: sgAlertIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.sg-alert.full {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 80px;
  text-align: center;
}
.sg-alert.sev-info {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
}
.sg-alert.sev-warning {
  background: linear-gradient(90deg, #b45309, #d97706);
}
.sg-alert.sev-emergency {
  background: #b91c1c;
  animation: sgEmergency 1.6s infinite;
}
.sg-alert-inner {
  display: flex;
  gap: 30px;
  align-items: center;
}
.sg-alert.full .sg-alert-inner {
  flex-direction: column;
}
.sg-alert-icon {
  font-size: 3.2em;
}
.sg-alert.full .sg-alert-icon {
  font-size: 7em;
}
.sg-alert-label {
  display: inline-block;
  padding: 4px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 800;
  font-size: 0.8em;
}
.sg-alert-title {
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 2em;
  line-height: 1.2;
  margin-top: 8px;
}
.sg-alert.full .sg-alert-title {
  font-size: 4.2em;
}
.sg-alert-msg {
  font-size: 1.1em;
  margin-top: 8px;
  white-space: pre-line;
}
.sg-alert.full .sg-alert-msg {
  font-size: 1.7em;
  max-width: 1500px;
}
@keyframes sgEmergency {
  0%,
  100% {
    background: #b91c1c;
  }
  50% {
    background: #7f1d1d;
  }
}
@keyframes sgAlertIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sg-sleep {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #000;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.35);
}
.sg-sleep-time {
  font-size: 5em;
  font-weight: 700;
  direction: ltr;
}
.sg-identify {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
}
.sg-identify-box {
  padding: 60px 100px;
  border-radius: 40px;
  background: var(--sg-accent);
  color: #111;
  text-align: center;
  font-size: 2.4em;
  animation: sgPulse 1.5s infinite;
}
.sg-identify-box div {
  font-size: 2em;
}
.sg-fallback-note {
  position: absolute;
  z-index: 5;
  bottom: 20px;
  left: 20px;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7em;
}

/* ============================================================ جهاز العرض (display.html) */
body.sg-player {
  margin: 0;
  background: #000;
  overflow: hidden;
  font-family: 'Cairo', sans-serif;
}
.sgp-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(circle at 30% 20%, #4a1426, #12060a 70%);
  text-align: center;
  padding: 40px;
}
.sgp-card {
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.2vh, 26px);
  align-items: center;
}
.sgp-logo {
  width: clamp(64px, 10vh, 110px);
  height: clamp(64px, 10vh, 110px);
  border-radius: 30px;
  display: grid;
  place-items: center;
  background: #d9a441;
  color: #4a1426;
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: 70px;
}
.sgp-title {
  font-family: 'Zain', sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 56px);
  margin: 0;
}
.sgp-code {
  direction: ltr;
  white-space: nowrap;
  font-size: clamp(44px, 7.5vw, 130px);
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 24px 50px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(217, 164, 65, 0.7);
  color: #f3c969;
  font-variant-numeric: tabular-nums;
}
.sgp-steps {
  display: grid;
  gap: 12px;
  text-align: start;
  font-size: clamp(16px, 1.8vw, 24px);
  color: rgba(255, 255, 255, 0.85);
}
.sgp-steps b {
  color: #f3c969;
}
.sgp-muted {
  color: rgba(255, 255, 255, 0.55);
  font-size: clamp(13px, 1.3vw, 18px);
}
.sgp-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.15);
  border-top-color: #d9a441;
  animation: sgSpin 1s linear infinite;
}
@keyframes sgSpin {
  to {
    transform: rotate(360deg);
  }
}
.sgp-status {
  position: fixed;
  z-index: 50;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.sgp-status.show {
  opacity: 1;
}
.sgp-status i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
}
.sgp-hint {
  position: fixed;
  z-index: 50;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  transition: opacity 1s;
}

/* ============================================================ صفحات الإدارة */
.sg-page .m-kpis {
  margin-bottom: 18px;
}
.sg-screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.sg-screen-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 20px rgba(20, 33, 61, 0.05);
}
.sg-screen-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
}
.sg-screen-thumb.portrait {
  aspect-ratio: 16 / 9;
}
.sg-screen-thumb .sg-root {
  position: absolute;
  inset: 0;
  height: 100% !important;
}
.sg-screen-thumb-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  gap: 8px;
  font-size: 14px;
  background: linear-gradient(135deg, #1f2937, #111827);
}
.sg-screen-thumb-empty b {
  font-size: 34px;
}
.sg-status-dot {
  position: absolute;
  z-index: 5;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.sg-status-dot i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.sg-status-dot.online i {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}
.sg-status-dot.offline i {
  background: #ef4444;
}
.sg-status-dot.sleeping i {
  background: #a78bfa;
}
.sg-status-dot.unpaired i {
  background: #9ca3af;
}
.sg-status-dot.disabled i {
  background: #6b7280;
}
.sg-screen-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sg-screen-body h4 {
  margin: 0;
  font-size: 16px;
}
.sg-screen-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12.5px;
  color: var(--slate);
}
.sg-screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px 14px;
  border-top: 1px dashed var(--line);
  margin-top: auto;
}
.sg-pair-code {
  direction: ltr;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.sg-guide {
  display: grid;
  gap: 10px;
  counter-reset: sgstep;
}
.sg-guide div {
  counter-increment: sgstep;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
}
.sg-guide div::before {
  content: counter(sgstep);
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}
.sg-url {
  direction: ltr;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--gold) 12%, var(--panel));
  font-family: ui-monospace, monospace;
  font-size: 13px;
  user-select: all;
}

.sg-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.sg-media-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}
.sg-media-card.pick {
  cursor: pointer;
}
.sg-media-card.pick:hover,
.sg-media-card.selected {
  outline: 3px solid var(--gold);
}
.sg-media-thumb {
  aspect-ratio: 16 / 10;
  background: #111 center / cover no-repeat;
  position: relative;
  display: grid;
  place-items: center;
}
.sg-media-thumb img,
.sg-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.sg-media-kind {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
}
.sg-media-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--slate);
}
.sg-media-info b {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-media-actions {
  display: flex;
  gap: 4px;
  padding: 0 10px 10px;
}
.sg-drop {
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--slate);
  transition: all 0.2s;
  cursor: pointer;
}
.sg-drop.over {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--panel));
  color: var(--ink);
}
.sg-upload-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.sg-upload-row {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
}
.sg-upload-row progress {
  width: 100%;
}

.sg-two-col {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.sg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sg-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  text-align: start;
  font: inherit;
  color: inherit;
  width: 100%;
}
.sg-list-item:hover {
  border-color: var(--gold);
}
.sg-list-item.active {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, var(--panel));
}
.sg-list-item small {
  color: var(--slate);
  display: block;
  font-size: 12px;
}
.sg-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sg-item {
  display: grid;
  grid-template-columns: 28px 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.sg-item.dragging {
  opacity: 0.45;
}
.sg-item.drop-before {
  box-shadow: 0 -3px 0 var(--gold);
}
.sg-item.drop-after {
  box-shadow: 0 3px 0 var(--gold);
}
.sg-item.pending {
  border-style: dashed;
  border-color: var(--gold);
}
.sg-item.rejected {
  opacity: 0.6;
}
.sg-handle {
  cursor: grab;
  color: var(--slate);
  font-size: 18px;
  text-align: center;
  user-select: none;
}
.sg-item-thumb {
  width: 96px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: #1f2937;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  position: relative;
}
.sg-item-thumb img,
.sg-item-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.sg-item-main {
  min-width: 0;
}
.sg-item-main b {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-item-main small {
  color: var(--slate);
  font-size: 12px;
}
.sg-item-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sg-text-preview {
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  font-size: 9px;
}
.sg-text-preview .sg-text {
  font-size: 9px;
  padding: 20px 26px;
}
.sg-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sg-swatch {
  width: 44px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
}
.sg-swatch.active {
  border-color: var(--ink);
}
.sg-colors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.sg-colors label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--slate);
}
.sg-colors input[type='color'] {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  background: var(--panel);
}

.sg-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 16px;
  align-items: start;
}
.sg-preview-box {
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}
.sg-preview-box.portrait {
  max-width: 420px;
  margin: 0 auto;
}
.sg-tpl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.sg-tpl {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  cursor: pointer;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  font: inherit;
  color: inherit;
  font-size: 11px;
}
.sg-tpl.active {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, var(--panel));
}
.sg-tpl-mini {
  aspect-ratio: 16 / 9;
  display: grid;
  gap: 3px;
  padding: 3px;
  background: #1f2937;
  border-radius: 6px;
}
.sg-tpl-mini span {
  background: var(--gold);
  border-radius: 3px;
  opacity: 0.85;
}
.sg-tpl-mini span.t {
  background: #9ca3af;
}
.sg-zone-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: color-mix(in srgb, var(--parchment) 40%, var(--panel));
}
.sg-zone-card h5 {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sg-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.sg-seg button {
  border: 0;
  background: var(--panel);
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--ink);
}
.sg-seg button.active {
  background: var(--primary, #173f5f);
  color: var(--primary-text, #fff);
}
.sg-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sg-widget-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.sg-widget-opt {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  background: var(--panel);
  text-align: start;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sg-widget-opt.active,
.sg-widget-opt:hover {
  border-color: var(--gold);
}
.sg-widget-opt b {
  font-size: 13px;
}
.sg-widget-opt small {
  font-size: 11.5px;
  color: var(--slate);
}

.sg-week {
  display: grid;
  grid-template-columns: 90px repeat(7, 1fr);
  gap: 4px;
  font-size: 12px;
}
.sg-week-h {
  text-align: center;
  font-weight: 700;
  color: var(--slate);
  padding: 4px;
}
.sg-week-row-label {
  color: var(--slate);
  padding: 6px 4px;
  font-size: 12px;
}
.sg-week-cell {
  min-height: 26px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--line) 50%, transparent);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
}
.sg-week-cell span {
  border-radius: 4px;
  padding: 1px 4px;
  color: #fff;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-alert-btns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.sg-alert-btn {
  border: 0;
  border-radius: 16px;
  padding: 18px;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.sg-alert-btn small {
  font-weight: 400;
  opacity: 0.9;
  font-size: 12px;
}
.sg-alert-btn.emergency {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
}
.sg-alert-btn.warning {
  background: linear-gradient(135deg, #b45309, #f59e0b);
}
.sg-alert-btn.info {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}
.sg-live-alert {
  border: 2px solid #ef4444;
  border-radius: 16px;
  padding: 14px 18px;
  background: rgba(239, 68, 68, 0.08);
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  animation: sgLive 2s infinite;
}
@keyframes sgLive {
  50% {
    background: rgba(239, 68, 68, 0.18);
  }
}
@media (max-width: 1100px) {
  .sg-two-col,
  .sg-editor {
    grid-template-columns: 1fr;
  }
  .sg-tpl-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 640px) {
  .sg-item {
    grid-template-columns: 24px 70px minmax(0, 1fr);
  }
  .sg-item-actions {
    grid-column: 1 / -1;
  }
  .sg-tpl-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sg-opts {
    grid-template-columns: 1fr;
  }
}
.m-fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.m-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

/* أحجام المناطق: الأعمدة والكثافة */
.sg-pager-body {
  overflow: hidden;
}
.size-half .sg-lesson-grid,
.size-quad .sg-lesson-grid,
.size-portrait .sg-lesson-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.size-side .sg-lesson-grid {
  grid-template-columns: 1fr;
}
.size-strip .sg-lesson-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.size-half .sg-room-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.size-side .sg-room-grid,
.size-quad .sg-room-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.size-portrait .sg-room-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.size-strip .sg-sub-list,
.size-strip .sg-exam-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.size-quad .sg-w,
.size-strip .sg-w {
  font-size: 0.8em;
  padding: 22px 28px;
  gap: 14px;
}
.size-quad .sg-w-icon,
.size-strip .sg-w-icon {
  width: 50px;
  height: 50px;
  font-size: 28px;
}
.size-quad .sg-now-banner,
.size-strip .sg-now-banner {
  padding: 12px 18px;
}
.size-quad .sg-counter,
.size-strip .sg-counter {
  padding: 10px 16px;
}
.size-quad .sg-counter b,
.size-strip .sg-counter b {
  font-size: 1.7em;
}
.size-quad .sg-ring-wrap,
.size-strip .sg-ring-wrap,
.size-side .sg-ring-wrap {
  width: 220px;
  height: 220px;
}
.size-quad .sg-ring-label b,
.size-strip .sg-ring-label b,
.size-side .sg-ring-label b {
  font-size: 1.6em;
}
.size-strip .sg-w-head h3 {
  font-size: 1.25em;
}
.size-strip .sg-clock-time {
  font-size: 3em;
}
.sg-editor > :first-child {
  position: sticky;
  top: 16px;
}
.sg-widget-opt small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .sg-editor > :first-child {
    position: static;
  }
}

/* إدارة الشاشات: أدوات واضحة، استهداف مرئي، ومعاينة قابلة للوصول. */
.sg-page {
  min-width: 0;
}
.sg-page [hidden] {
  display: none !important;
}
.sg-fleet-filters {
  display: grid;
  grid-template-columns: minmax(210px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.sg-fleet-filters .m-field {
  min-width: 0;
}
.sg-fleet-filters input,
.sg-fleet-filters select {
  width: 100%;
}
.sg-bulk-bar {
  position: sticky;
  top: 12px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--gold);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 6px 24px rgba(20, 33, 61, 0.12);
}
.sg-bulk-bar b {
  margin-inline-end: auto;
}
.sg-screen-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 40%, transparent);
}
.sg-screen-select {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: var(--control-height-field, 48px);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  background: color-mix(in srgb, var(--gold) 6%, var(--panel));
}
.sg-screen-select input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}
.sg-screen-body {
  overflow-wrap: anywhere;
}
.sg-screen-actions button,
.sg-screen-actions a,
.sg-bulk-bar button {
  min-height: 38px;
}
.sg-page :is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.sg-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}
.sg-health-grid > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow-wrap: anywhere;
}
.sg-health-grid small {
  color: var(--slate);
}
.sg-health-grid b {
  color: var(--ink);
}
.sg-preview-message {
  position: absolute;
  z-index: 45;
  inset-inline: 10px;
  bottom: 10px;
  border: 1px solid #e2b85a;
  border-radius: 10px;
  padding: 10px;
  background: #392c0c;
  color: #ffedb8;
  font-size: 13px;
}
.sg-preview-message[hidden] {
  display: none;
}
.sg-media-card.pick {
  text-align: start;
  color: inherit;
  font: inherit;
  padding: 0;
}
.sg-media-card.pick:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.sg-week-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-radius: 10px;
  padding-bottom: 8px;
}
.sg-week {
  min-width: 720px;
}
.sg-target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
}
.sg-target-grid label {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.sg-editor-toolbar {
  position: sticky;
  top: 8px;
  z-index: 7;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.sg-seg {
  flex-wrap: wrap;
}
.sg-seg button,
.sg-tpl,
.sg-swatch {
  min-height: 40px;
}
@media (max-width: 900px) {
  .sg-fleet-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .sg-screens-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sg-fleet-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .sg-live-alert {
    align-items: stretch;
    flex-direction: column;
  }
  .sg-bulk-bar {
    position: static;
  }
  .sg-screen-actions :is(button, a),
  .sg-bulk-bar button {
    min-height: 44px;
  }
  .sg-editor-toolbar {
    position: static;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sg-page .sg-live-alert,
  .sg-page .sg-page-in {
    animation: none;
  }
  .sg-page .sg-slide,
  .sg-page .sg-dots span {
    transition: none;
  }
}
.sg-att-coverage {
  text-align: center;
  font-size: 0.65em;
  opacity: 0.9;
  line-height: 1.7;
  margin-top: 12px;
}
