@font-face {
  font-family: "Alexandria";
  src: url("/overlay/fonts/Alexandria.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --line: #dde3ec;
  --text: #0e1a2b;
  --muted: #5d6b80;
  --brand: #0b4f9c;
  --brand-ink: #ffffff;
  --accent: #f2a900;
  --danger: #d4111e;
  --ok: #138a52;
  --warn: #b7791f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 4px 16px rgba(14, 26, 43, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a121f; --surface: #111c2d; --surface-2: #17243a; --line: #24344d; --text: #e8eef7; --muted: #93a3ba;
    --brand: #3d8bea; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a121f; --surface: #111c2d; --surface-2: #17243a; --line: #24344d; --text: #e8eef7; --muted: #93a3ba;
  --brand: #3d8bea; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Alexandria", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
img, video { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: #071a33; color: #dfe8f5; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand { flex-direction: column; align-items: flex-start; gap: 6px; color: #fff; }
.brand svg { height: 34px; width: 94px; flex: none; }
.brand small { color: var(--accent); font-size: 13px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c4d2e6; font-weight: 500; }
.nav a svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.on { background: rgba(61,139,234,.22); color: #fff; }
.nav a .badge { margin-inline-start: auto; }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 8px; }
.who { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); color: #c4d2e6; }
.who svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.who b { display: block; color: #fff; font-weight: 600; line-height: 1.3; }
.who small { color: var(--accent); font-size: 12px; }
main { padding: 24px 28px 80px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.top h1 { flex: 1; }
.pending-btn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.pending-btn .badge { background: var(--warn); }
@media (max-width: 560px) { .pending-btn span:not(.badge) { display: none; } }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 270px; z-index: 50; transform: translateX(100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: -10px 0 40px rgba(0,0,0,.4); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  main { padding: 16px 16px 90px; }
  .menu-btn { display: inline-flex; }
}

/* ---------- عناصر ---------- */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h2 { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card > h2 .grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 26px; font-weight: 700; direction: ltr; text-align: right; }
.kpi span { color: var(--muted); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; }
.chips button svg { width: 15px; height: 15px; vertical-align: -3px; }
.ico { display: inline-flex; vertical-align: -3px; }
.ico svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.big { padding: 14px 22px; font-size: 17px; }

label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 14px; }
label.f small { color: var(--muted); font-weight: 400; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }
input[type="color"] { padding: 2px; height: 40px; }
.ltr { direction: ltr; text-align: left; }
/* حقل يُكتب فيه رابط أو رقم وتلميحه عربي: التلميح يُقرأ من اليمين ما دام الحقل فارغًا */
.ltr.ar-hint:placeholder-shown { direction: rtl; text-align: right; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill.info { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.live { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.badge { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; line-height: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table-wrap { overflow-x: auto; }

.list { display: flex; flex-direction: column; }
.list > .item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .5s; }

.thumb { aspect-ratio: 16 / 9; background: #0b1626 center / cover no-repeat; border-radius: 10px; position: relative; overflow: hidden; }
.thumb .dur { position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; padding: 0 6px; border-radius: 6px; direction: ltr; }
.prog-card { display: flex; flex-direction: column; gap: 10px; }
.prog-card h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }

.screen { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.screen img, .screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.screen iframe.scaled { width: 1920px; height: 1080px; transform-origin: top right; }
.screen .tag { position: absolute; top: 10px; right: 10px; z-index: 2; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; font: inherit; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--brand); font-weight: 600; }
.tabs .badge { margin-inline-start: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 99px; cursor: pointer; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.breaking-box textarea { font-size: 20px; font-weight: 600; min-height: 110px; border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.breaking-live { background: var(--danger); color: #fff; border-radius: 10px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.breaking-live b { background: #fff; color: var(--danger); padding: 2px 12px; border-radius: 6px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.log { background: #0b1626; color: #cfe0f5; border-radius: 10px; padding: 12px; font-family: ui-monospace, monospace; font-size: 12px; direction: ltr; text-align: left; white-space: pre-wrap; max-height: 260px; overflow: auto; }

/* ---------- نافذة منبثقة وتنبيهات ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(760px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(5, 12, 24, .6); }
dialog.wide { width: min(1180px, calc(100vw - 32px)); }
/* مراجعة النص: نص المصدر بجانب النص المكتوب للمقارنة (وتحته على الشاشة الضيقة) */
.rv-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.rv-src { position: sticky; top: 0; margin-top: 14px; max-height: 62vh; overflow-y: auto; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.rv-src h3 { margin: 0 0 8px; }
.rv-src .small { white-space: pre-wrap; line-height: 1.8; }
@media (max-width: 900px) { .rv-cols { grid-template-columns: 1fr; } .rv-src { position: static; max-height: 40vh; } }
dialog .dh { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog .dh h2 { flex: 1; }
dialog .db { padding: 20px; max-height: 70vh; overflow-y: auto; }
dialog .df { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
.toasts { position: fixed; bottom: 20px; left: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast { background: #0e1a2b; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); max-width: min(360px, calc(100vw - 40px)); animation: up .25s ease; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* ---------- تسجيل الدخول ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 78% 30%, rgba(242,169,0,.18), transparent 40%), linear-gradient(135deg, #072f5f, #04152b 60%, #0b4f9c 140%); }
.login > form { background: var(--surface); width: min(400px, 100%); padding: 30px; border-radius: 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login .brand { justify-content: center; padding-bottom: 6px; }
.login .brand { align-items: center; color: var(--text); }
.login .brand svg { height: 56px; width: 155px; }

/* ---------- الهاتف: لا عناصر مقصوصة ولا نصوص محشورة ---------- */
@media (max-width: 640px) {
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs button { padding: 8px 10px; }
  .list > .item { flex-wrap: wrap; row-gap: 6px; }
  .item .grow { min-width: 60%; }
  .pill { white-space: normal; }
  /* جدول البث: كل موعد بطاقة (الوقت والعنوان، ثم المصدر والحالة، ثم الأزرار) */
  table.plan, table.plan tbody { display: block; width: 100%; }
  table.plan thead { display: none; }
  table.plan tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.plan td { border: 0; padding: 0; }
  table.plan td:nth-child(2) { flex: 1 1 65%; min-width: 0; }
  table.plan td:nth-child(2) > div { max-width: 100% !important; overflow-wrap: anywhere; }
  table.plan td:last-child { flex-basis: 100%; justify-content: flex-start; }
  table.plan td:last-child:empty { display: none; }
}

/* «النشرة القادمة»: العنوان كاملًا في سطر (أو سطرين)، والتفاصيل والأزرار تحته */
.list > .item.nx-item { align-items: flex-start; }
.nx-head { font-weight: 600; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nx-open { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: inherit; text-align: start; cursor: pointer; }
.nx-open:hover, .nx-open:focus-visible { color: var(--brand); text-decoration: underline; }
.nx-act { display: flex; gap: 2px; margin-inline-start: auto; }
.nx-act .btn { padding: 3px 7px; }
.nx-act .btn svg { width: 15px; height: 15px; }
.nx-item[draggable] { cursor: grab; }
.nx-item.dragging { opacity: .45; }
.nx-item.drop-before { box-shadow: inset 0 3px 0 var(--brand); }
.nx-item.drop-after { box-shadow: inset 0 -3px 0 var(--brand); }
.nx-anchor { gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.nx-anchor b svg { width: 15px; height: 15px; vertical-align: -3px; }
.anchor-lines textarea { min-height: 0; }
.nx-intro { margin: 0; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- أرقام غرفة الأخبار: رسوم بيانية هادئة (أعمدة رفيعة، ولون واحد لما يهم والرمادي لما حوله) ---------- */
.viz { --viz-main: #2a78d6; --viz-rest: #b8c2d1; --viz-base: #c3c9d4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .viz { --viz-main: #3987e5; --viz-rest: #3b4b66; --viz-base: #33445f; }
}
:root[data-theme="dark"] .viz { --viz-main: #3987e5; --viz-rest: #3b4b66; --viz-base: #33445f; }
.kpi small { font-size: 12px; }
.viz-key { display: inline-flex; align-items: center; gap: 6px; }
.viz-key i { width: 12px; height: 12px; border-radius: 3px; }
.viz-main { background: var(--viz-main); }
.viz-rest { background: var(--viz-rest); }
.viz-cols { display: flex; gap: 4px; }
.viz-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; border-radius: 8px; outline: none; }
.viz-col:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.viz-plot { width: 100%; height: calc(var(--plot) + 24px); display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  border-bottom: 1px solid var(--viz-base); }
.viz-cap { font-size: 13px; font-weight: 600; line-height: 22px; }
.viz-stack { width: min(24px, 70%); display: flex; flex-direction: column; gap: 2px; }
.viz-stack i { display: block; min-height: 2px; }
.viz-stack i:first-child { border-radius: 4px 4px 0 0; }
.viz-col:hover .viz-stack, .viz-col:focus-visible .viz-stack { filter: brightness(1.12); }
.viz-day { font-size: 12px; color: var(--muted); padding-top: 6px; white-space: nowrap; }
.viz-day.on { color: var(--text); font-weight: 600; }
.viz-hbars { display: flex; flex-direction: column; gap: 4px; }
.viz-hrow { display: grid; grid-template-columns: minmax(0, 13em) 1fr; gap: 12px; align-items: center; padding: 4px 6px; border-radius: 8px; outline: none; }
.viz-hrow:hover, .viz-hrow:focus-visible { background: var(--surface-2); }
.viz-hlabel { font-size: 13px; }
@media (max-width: 600px) {
  .viz-hrow { grid-template-columns: 1fr; gap: 2px; }
}
.viz-htrack { display: flex; align-items: center; gap: 8px; min-width: 0; }
.viz-htrack i { display: block; height: 12px; min-width: 2px; background: var(--viz-main); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.viz-htrack b { font-size: 13px; font-weight: 600; }
.viz-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.viz-tip { position: fixed; z-index: 120; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; pointer-events: none; max-width: 280px; }

/* ---------- أمان الحساب: التحقق بخطوتين والرموز الاحتياطية ---------- */
.login .setup { background: var(--surface); width: min(560px, 100%); padding: 28px; border-radius: 18px; display: flex;
  flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login .setup .brand { justify-content: center; padding-bottom: 0; }
.login .setup .brand { align-items: center; color: var(--text); }
.login .setup .brand svg { height: 48px; width: 133px; }
.steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.steps .btn { white-space: normal; flex-wrap: wrap; text-align: center; }   /* زر طويل يلتف على الهاتف بدل أن يوسّع الصفحة */
.steps li::marker { font-weight: 700; color: var(--brand); }
.qr-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qr { width: 200px; height: 200px; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.secret { font-size: 15px; letter-spacing: 1px; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.code-in { font-size: 22px; letter-spacing: 6px; text-align: center; max-width: 220px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.codes code { background: var(--surface-2); border-radius: 8px; padding: 8px; text-align: center; font-size: 15px; letter-spacing: 1px; }
.err-text { color: var(--danger); min-height: 1em; }

/* ---------- جدول البث: الفواصل الثابتة والترتيب التقديري ---------- */
table.plan tr.brk td { padding-top: 4px; padding-bottom: 4px; }
table.plan tr.can-open { cursor: pointer; }
table.plan tr.can-open:hover td, table.plan tr.can-open:focus-visible td { background: rgba(61,139,234,.07); }
.fc-hint { color: var(--brand); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.fc-hint svg { width: 14px; height: 14px; }
.fc-list { display: flex; flex-direction: column; gap: 4px; }
.fc-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; min-width: 0; }
.fc-item:nth-child(odd) { background: var(--surface-2); }
.fc-item.now { outline: 2px solid var(--danger); outline-offset: -2px; }
.fc-item .grow { min-width: 0; }
@media (max-width: 640px) {
  table.plan tr.fc-row td { flex: 1 1 100%; min-width: 0; }
  /* الهاتف: الوقت والنوع والمدة في سطر، والعنوان كاملًا تحته */
  .fc-item { flex-wrap: wrap; gap: 4px 8px; }
  .fc-item .grow { order: 5; flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
}

/* دليل الربط في المصادر الحية: خطوات كل أداة، وعلامة وصول البث */
ol.guide { margin: 0; padding-inline-start: 22px; display: grid; gap: 10px; font-size: 14px; }
ol.guide .row { margin-top: 4px; }
.arrive { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); line-height: 1.8; }
.arrive.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.arrive.ok .small { color: var(--text); }
.arrive svg { width: 18px; height: 18px; vertical-align: -4px; stroke: currentColor; }

/* الهاتف: الأزرار ذات العناوين الطويلة تلتف بدل أن تخرج من الشاشة */
@media (max-width: 560px) { .btn { white-space: normal; text-align: center; } }

/* ---------- الهوية البصرية الموسّعة: هوية كل برنامج، والمساعد الذكي، ونسخ القوالب ---------- */
.row .grow { flex: 1; min-width: 0; }
.id-list { display: flex; flex-direction: column; gap: 8px; }
.id-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font: inherit; color: var(--text); cursor: pointer; }
.id-row:hover { background: var(--surface-2); }
.id-row .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.id-row > svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.id-sw { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: #16181b; flex: none; }
.id-ed { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.id-ed h3 { margin: 6px 0 0; font-size: 15px; }
.id-prev-col { position: sticky; top: 0; }
.id-prev { display: grid; gap: 8px; }
.id-prev img, .id-prev video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: #000; }
.id-chips button { display: inline-flex; align-items: center; gap: 6px; }
.id-chips button svg { width: 16px; height: 16px; }
.id-chips .sw { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(127, 127, 127, .5); }
/* «لون آخر»: شريحة فيها منتقي الألوان */
.id-chips .cc { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 13px; padding: 3px 10px 3px 6px; border-radius: 99px; cursor: pointer; }
.id-chips .cc.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.id-chips .cc input[type=color] { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
/* الأشكال المعتمدة: شكلان لكل مجموعة، بصورة لكل شكل */
.look-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.look { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
  color: inherit; font: inherit; text-align: start; cursor: pointer; min-width: 0; }
.look:hover { background: var(--surface-2); }
.look.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); cursor: default; }
.look-img { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 8px; background: #0d0e10; overflow: hidden; }
.look-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.look-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; }
.pick { border: 2px solid transparent; border-radius: 10px; padding: 0; background: var(--surface-2); cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; font: inherit; color: var(--text); text-align: start; min-width: 0; }
.pick.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.pick img, .pick video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; pointer-events: none; }
.pick span { padding: 4px 6px; display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pick span svg { width: 12px; height: 12px; vertical-align: -2px; margin-inline-end: 3px; }
.id-tpl { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: start; font: inherit; color: var(--text); cursor: pointer; }
.id-tpl:hover { background: var(--surface-2); }
.id-steps { margin: 0; padding-inline-start: 20px; line-height: 1.9; }
.id-checks { list-style: none; margin: 0; padding: 0; line-height: 1.8; }
.id-checks .ok { color: var(--ok); }
.id-checks .bad { color: var(--danger); }
.id-ba { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.id-ba figure { margin: 0; }
.id-ba img { width: 100%; border-radius: 8px; background: #000; display: block; }
.id-sample { width: 100%; border-radius: 10px; background: #000; }
.id-prop blockquote, .id-ver blockquote { margin: 0; padding: 6px 10px; border-inline-start: 3px solid var(--line); color: var(--muted); }
.id-notes ul, .id-change ul { margin: 4px 0; padding-inline-start: 20px; }
.id-change { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.id-change .id-prev { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 900px) { .id-ed { grid-template-columns: 1fr; } .id-prev-col { position: static; } }
/* قسم «الموسيقى» */
.mu-how b { display: block; margin-bottom: 2px; }
.mu-how p { margin: 0; }
.mu-slots, .mu-list { display: flex; flex-direction: column; gap: 8px; }
.mu-slot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.mu-slot select { width: auto; flex: 1 1 220px; min-width: 0; max-width: min(380px, 100%); }
.mu-title { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mu-track { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.mu-track[hidden] { display: none; }
.mu-track.off { opacity: .6; }
.mu-meta { gap: 8px 12px; }
.mu-meta select { width: auto; min-width: 0; max-width: 100%; padding: 5px 10px; font-size: 13px; }
.mu-tags button { padding: 3px 10px; font-size: 12px; }
.mu-play { width: 34px; height: 34px; padding: 0; border-radius: 50%; flex: none; }
.mu-play svg { width: 14px; height: 14px; }
.mu-play.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mu-warn { color: var(--warn); }
label.btn.busy { pointer-events: none; opacity: .7; }
/* الأشكال: خانة «الشكل» في النوافذ، والبطاقات في التبويب، ونافذة «طبّقه على…» */
.look.static { cursor: default; }
.look.static:hover { background: var(--surface); }
.look-choices.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.look-choices.mini .look { padding: 6px; }
.look-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; max-height: 52vh; overflow: auto; }

/* تخطيط الشاشة: اسم العنصر ووصفه، ثم مكانه وزر ظهوره (يلتفّان تحته على الشاشة الضيقة) */
.ly-row { flex-wrap: wrap; }
.ly-row .grow { flex: 1 1 220px; }
.ly-ctl { display: flex; align-items: center; gap: 12px; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.ly-ctl select { width: auto; min-width: 0; max-width: 270px; flex: 0 1 auto; }
.ly-ctl .check, .ly-ctl .pill { flex: none; }
