/* XPanel Stream — واجهة غرفة التحكم
   خط Zain + شريط جانبي كحلي + ألوان دلالية للأيقونات والرسوم البيانية */

:root {
  --font: "Zain", system-ui, "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* ألوان دلالية: لكل نوع بيانات لون ثابت في الأيقونات والرسوم */
  --c-blue: #2563eb; --c-green: #059669; --c-amber: #d97706; --c-violet: #7c3aed;
  --c-rose: #e11d48; --c-cyan: #0891b2; --c-orange: #ea580c; --c-slate: #64748b;

  /* light */
  --bg: #f3f5f9; --card: #ffffff; --raised: #f5f7fb; --hover: #eef2f8;
  --text: #0f172a; --text-2: #475569; --muted: #7c8799;
  --line: rgba(15, 23, 42, 0.08); --line-strong: rgba(15, 23, 42, 0.15);
  --accent: #2563eb; --accent-soft: rgba(37, 99, 235, 0.12);
  --primary-bg: #2563eb; --primary-text: #ffffff;
  --on-air: #e11d48; --ok: #059669; --warn: #d97706; --bad: #e11d48;
  --ok-soft: rgba(5, 150, 105, 0.10); --bad-soft: rgba(225, 29, 72, 0.09); --warn-soft: rgba(217, 119, 6, 0.10);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
  --grid: rgba(15, 23, 42, 0.06);

  /* الشريط الجانبي كحلي في المظهرين */
  --sb-bg: #0f172a; --sb-text: #cbd5e1; --sb-muted: #6b7a93; --sb-line: rgba(255, 255, 255, 0.07);
  --sb-hover: rgba(255, 255, 255, 0.05); --sb-on: rgba(96, 165, 250, 0.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-blue: #60a5fa; --c-green: #34d399; --c-amber: #fbbf24; --c-violet: #a78bfa;
    --c-rose: #fb7185; --c-cyan: #22d3ee; --c-orange: #fb923c; --c-slate: #94a3b8;
    --bg: #0b1120; --card: #111a2d; --raised: #16213a; --hover: #1a2742;
    --text: #e6ebf4; --text-2: #a5b1c5; --muted: #7a879d;
    --line: rgba(226, 232, 240, 0.08); --line-strong: rgba(226, 232, 240, 0.15);
    --accent: #60a5fa; --accent-soft: rgba(96, 165, 250, 0.15);
    --primary-bg: #3b82f6; --primary-text: #ffffff;
    --on-air: #fb7185; --ok: #34d399; --warn: #fbbf24; --bad: #fb7185;
    --ok-soft: rgba(52, 211, 153, 0.12); --bad-soft: rgba(251, 113, 133, 0.12); --warn-soft: rgba(251, 191, 36, 0.12);
    --shadow: none; --grid: rgba(226, 232, 240, 0.07);
    --sb-bg: #080d19;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --c-blue: #60a5fa; --c-green: #34d399; --c-amber: #fbbf24; --c-violet: #a78bfa;
  --c-rose: #fb7185; --c-cyan: #22d3ee; --c-orange: #fb923c; --c-slate: #94a3b8;
  --bg: #0b1120; --card: #111a2d; --raised: #16213a; --hover: #1a2742;
  --text: #e6ebf4; --text-2: #a5b1c5; --muted: #7a879d;
  --line: rgba(226, 232, 240, 0.08); --line-strong: rgba(226, 232, 240, 0.15);
  --accent: #60a5fa; --accent-soft: rgba(96, 165, 250, 0.15);
  --primary-bg: #3b82f6; --primary-text: #ffffff;
  --on-air: #fb7185; --ok: #34d399; --warn: #fbbf24; --bad: #fb7185;
  --ok-soft: rgba(52, 211, 153, 0.12); --bad-soft: rgba(251, 113, 133, 0.12); --warn-soft: rgba(251, 191, 36, 0.12);
  --shadow: none; --grid: rgba(226, 232, 240, 0.07);
  --sb-bg: #080d19;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-weight: 700; margin: 0; }
h2 { font-size: 18px; line-height: 28px; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
code { background: var(--raised); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; word-break: break-all; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.red { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; font-weight: 700; }
.i { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* أيقونة ملوّنة داخل مربع بخلفية خفيفة من نفس اللون */
.tile { --c: var(--c-blue); flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.tile.sm { width: 32px; height: 32px; border-radius: 9px; }
.tile.xs { width: 28px; height: 28px; border-radius: 8px; }
.c-blue { --c: var(--c-blue); } .c-green { --c: var(--c-green); } .c-amber { --c: var(--c-amber); } .c-violet { --c: var(--c-violet); }
.c-rose { --c: var(--c-rose); } .c-cyan { --c: var(--c-cyan); } .c-orange { --c: var(--c-orange); } .c-slate { --c: var(--c-slate); }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--sb-bg); color: var(--sb-text);
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 6px; margin-bottom: 24px; font-size: 20px; font-weight: 800; color: #fff; }
.brand small { display: block; font-size: 12px; font-weight: 400; color: var(--sb-muted); line-height: 1; margin-top: 2px; }
.brand-txt { line-height: 1.1; }
.mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #3b82f6, #1d4ed8); box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a, .nav-btn {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px; border-radius: 10px;
  color: var(--sb-text); font: 400 16px var(--font); background: none; border: 0; width: 100%; cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.side nav a .tile { --c: #94a3b8; background: rgba(148, 163, 184, 0.10); transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.side nav a:hover, .nav-btn:hover { background: var(--sb-hover); color: #fff; }
.side nav a.on { background: var(--sb-on); color: #fff; font-weight: 700; }
.side nav a.on .tile, .side nav a:hover .tile { --c: var(--nc); background: color-mix(in srgb, var(--nc) 20%, transparent); }
.nav-btn .i { color: var(--sb-muted); margin: 0 6px; }
.count { margin-inline-start: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center;
  font: 700 13px var(--font); font-style: normal; color: #fff; background: rgba(255, 255, 255, 0.10); }
.count.live { background: #e11d48; }
.nav-label { font-size: 13px; color: var(--sb-muted); padding: 0 10px; margin: 20px 0 6px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid var(--sb-line); }
.sys-mini { padding: 12px 14px; margin-bottom: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--sb-line); }
.sys-mini div { display: flex; justify-content: space-between; font-size: 14px; color: var(--sb-muted); }
.sys-mini b { color: #fff; font-weight: 700; direction: ltr; }
.sys-mini .bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin: 4px 0 8px; overflow: hidden; display: block; }
.sys-mini .bar i { display: block; height: 100%; border-radius: 2px; }

.main { min-width: 0; }
.page-head {
  display: flex; align-items: center; gap: 12px; height: 72px; padding: 0 32px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5;
}
.page-head h1 { font-size: 24px; line-height: 32px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn.menu-btn { display: none; }
main { padding: 28px 32px 56px; max-width: 1560px; }

/* ---------- البطاقات ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: 14px; }
.card-head .end { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 12px; flex-wrap: wrap; }
.section-title .sub { color: var(--muted); font-size: 14px; }

/* ---------- الإحصائيات ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; gap: 12px; }
.stat .label { color: var(--text-2); font-size: 16px; }
.stat .value { font: 800 36px/1 var(--font); font-variant-numeric: tabular-nums; margin: 14px 0 4px; direction: ltr; text-align: right; }
.stat .value small { font-size: 18px; color: var(--muted); font-weight: 400; margin-inline-start: 2px; }
.stat .note { color: var(--muted); font-size: 14px; min-height: 22px; }
.stat .spark { height: 44px; margin: 8px -4px 0; }
.meter { height: 6px; border-radius: 3px; background: var(--raised); margin-top: 12px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 3px; transition: width 400ms var(--ease); }
.meter.hot i { background: var(--warn); }

/* ---------- الجداول ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; margin-bottom: 16px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
.card table, .table-wrap table { border: 0; }
th, td { padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { height: 44px; font-weight: 700; color: var(--muted); font-size: 14px; background: var(--raised); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 120ms var(--ease); }
tbody tr:hover { background: var(--hover); }
td.actions { white-space: nowrap; text-align: left; }
td.actions > * { margin-inline-start: 4px; }
td.empty { color: var(--muted); text-align: center; height: 120px; }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.name-cell .logo { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; background: var(--raised); border: 1px solid var(--line); flex: none; }
.name-cell .logo.blank { display: grid; place-items: center; color: var(--c-blue); background: color-mix(in srgb, var(--c-blue) 11%, transparent); border: 0; }
.name-cell b { font-weight: 700; display: block; line-height: 22px; }
.name-cell span { color: var(--muted); font-size: 14px; line-height: 18px; }

/* ---------- حالة القناة ---------- */
.tally { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px 0 10px; border-radius: 14px; white-space: nowrap;
  color: var(--text-2); background: var(--raised); font-size: 14px; }
.tally.dot { padding: 0; background: none; height: auto; }
.tally i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.tally.on { color: var(--on-air); background: var(--bad-soft); font-weight: 700; }
.tally.on i { background: var(--on-air); border-color: var(--on-air); animation: onair 1.6s ease-in-out infinite; }
.tally.run { color: var(--ok); background: var(--ok-soft); }
.tally.run i { background: var(--ok); border-color: var(--ok); }
.tally.wait { color: var(--warn); background: var(--warn-soft); }
.tally.wait i { background: var(--warn); border-color: var(--warn); }
.tally.sleep { color: var(--c-violet); background: color-mix(in srgb, var(--c-violet) 11%, transparent); }
.tally.sleep i { border-color: var(--c-violet); border-style: dashed; }
.tally.off i { background: transparent; }
.tally.err { color: var(--bad); }
.tally.err i { border-color: var(--bad); }
.tally.dot.on, .tally.dot.run, .tally.dot.wait, .tally.dot.sleep { background: none; }
@keyframes onair { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--on-air) 22%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tally.on i { animation: none; } }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font: 700 12px var(--font); border: 1px solid var(--line-strong); color: var(--text-2); vertical-align: middle; }
.tag.rec { color: var(--on-air); border-color: currentColor; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font: 700 15px var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease), box-shadow 150ms var(--ease);
}
.btn:hover { background: var(--hover); color: var(--text); }
.btn:active { transform: scale(0.98); }
.btn .i { color: var(--muted); }
.btn.primary { background: var(--primary-bg); color: var(--primary-text); border-color: transparent; box-shadow: 0 2px 10px color-mix(in srgb, var(--primary-bg) 30%, transparent); }
.btn.primary .i { color: inherit; }
.btn.primary:hover { background: color-mix(in srgb, var(--primary-bg) 88%, #000); color: var(--primary-text); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; gap: 6px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; }
.btn.red, .btn.red .i { color: var(--bad); }
.btn.red:hover { background: var(--bad-soft); }
.btn.green, .btn.green .i { color: var(--ok); }
.btn.green:hover { background: var(--ok-soft); }
.btn.done { color: var(--ok); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); cursor: pointer; }
form.inline { display: inline; }

/* تبويبات صغيرة (فترة الرسم البياني) */
.seg-tabs { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); }
.seg-tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font: 700 14px var(--font); cursor: pointer; }
.seg-tabs button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }

/* مفتاح تشغيل صغير (عند الطلب / ABR) */
.switch { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 6px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--text-2); font: 400 14px var(--font); cursor: pointer; transition: background-color 150ms var(--ease); }
.switch:hover { background: var(--hover); }
.switch .knob { width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); position: relative; transition: background-color 150ms var(--ease); }
.switch .knob::after { content: ""; position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform 180ms var(--ease); }
.switch.on { color: var(--text); }
.switch.on .knob { background: var(--c-green); }
.switch.on .knob::after { transform: translateX(-12px); }

/* ---------- النماذج ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .end { margin-inline-start: auto; display: flex; gap: 8px; }
input, select, textarea {
  font: 400 16px var(--font); color: var(--text); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 12px; height: 42px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
textarea { height: auto; padding: 10px 12px; line-height: 24px; resize: vertical; }
textarea.ltr, input.ltr { font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { height: 18px; width: 18px; accent-color: var(--accent); margin: 0; }
input[type="file"] { padding: 8px 12px; height: auto; }
.form label { display: block; margin-bottom: 16px; color: var(--text-2); font-size: 15px; }
.form label > input, .form label > select, .form label > textarea { display: block; width: 100%; margin-top: 6px; color: var(--text); }
.form label > input[type="checkbox"], .form label > input[type="radio"] { display: inline-block; width: 18px; margin: 0; flex: none; }
.hint { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 20px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 16px; }
.checks label, label.check { display: inline-flex !important; gap: 8px; align-items: center; margin: 0 !important; color: var(--text); font-size: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 16px; padding: 16px 20px 4px; }
legend { padding: 0 8px; color: var(--text); font-weight: 700; font-size: 16px; }
.form-actions { display: flex; gap: 8px; padding-top: 4px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); color: var(--text-2); font-size: 15px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--text); }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--ok-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); border-inline-start: 4px solid var(--ok); }
.flash.err { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); border-inline-start-color: var(--bad); }

/* ---------- قائمة مفاتيح وقيم ---------- */
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 0 16px; align-items: center; }
.kv > * { padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 52px; display: flex; align-items: center; }
.kv > :nth-last-child(-n+3) { border-bottom: 0; }
.kv dt { color: var(--text-2); font-size: 15px; margin: 0; }
.kv dd { margin: 0; min-width: 0; }
.kv dd code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }

/* ---------- الرسوم البيانية ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 15px; padding: 24px; }

/* ---------- المشغّل والسجل ---------- */
.player-wrap { background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; max-height: 70vh; }
.player { width: 100%; height: 100%; display: block; background: #000; }
.player-bar { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
pre.log { background: #0b1120; color: #c5cfdf; padding: 16px 20px; border-radius: 14px; border: 1px solid var(--line); max-height: 70vh; overflow: auto; font: 12px/20px var(--mono); white-space: pre-wrap; margin: 0 0 16px; }

/* ---------- الدخول ---------- */
body.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.login-pane { display: grid; place-items: center; padding: 32px 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { padding: 0; margin-bottom: 40px; color: var(--text); }
.login-box .brand small { color: var(--muted); }
.login-box h1 { font-size: 32px; line-height: 40px; font-weight: 800; margin-bottom: 4px; }
.login-box .lead { color: var(--text-2); margin-bottom: 32px; font-size: 17px; }
.login-box label { display: block; margin-bottom: 16px; color: var(--text-2); font-size: 15px; }
.login-box input { width: 100%; margin-top: 6px; height: 48px; }
.login-box .btn { width: 100%; height: 48px; margin-top: 8px; font-size: 17px; }
.login-art { background: radial-gradient(120% 80% at 100% 0%, #1e3a8a 0%, #0f172a 55%, #080d19 100%); color: #e6ebf4; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 12px; overflow: hidden; }
.rack { display: flex; flex-direction: column; gap: 10px; max-width: 480px; width: 100%; margin: 0 auto; }
.rack-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 72px; gap: 16px; align-items: center; height: 60px; padding: 0 20px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; }
.rack-row .lamp { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #5b6b86; }
.rack-row.on .lamp { background: #fb7185; border-color: #fb7185; box-shadow: 0 0 0 4px rgba(251,113,133,.18); }
.rack-row.run .lamp { background: #34d399; border-color: #34d399; }
.rack-row b { font-weight: 700; font-size: 16px; }
.rack-row span { font: 12px var(--mono); color: #8a99b4; }
.vu { display: flex; gap: 2px; align-items: flex-end; height: 22px; direction: ltr; }
.vu i { width: 4px; border-radius: 1px; background: rgba(255,255,255,.12); }
.vu i.l { background: #34d399; }
.vu i.h { background: #fbbf24; }
.rack-caption { max-width: 480px; margin: 24px auto 0; width: 100%; color: #8a99b4; font-size: 16px; }

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 0 0 auto; width: 276px; z-index: 20; transform: translateX(100%); transition: transform 240ms var(--ease); box-shadow: -8px 0 32px rgba(0,0,0,.3); }
  .side.open { transform: none; }
  .icon-btn.menu-btn { display: grid; }
  .page-head { padding: 0 16px; height: 64px; }
  .page-head h1 { font-size: 20px; }
  main { padding: 16px 16px 40px; }
  body.login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr) auto; }
  .kv dt { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 0; min-height: 0; }
  .chart-box { height: 240px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .head-actions .btn span { display: none; }
  .card { padding: 16px; }
}
.chart-empty[hidden] { display: none; }
.chart-box canvas, .spark canvas, .donut-wrap canvas { direction: ltr; }
td.num { white-space: nowrap; }
