/* ============================================================
   3almCore — لوحة التحكم · إصدار 2.0
   لوحة ألوان كحلية (Navy) — 80% داكن · 15% أزرق · 5% بنفسجي/سماوي
   ============================================================ */

:root {
  /* الخلفيات */
  --bg:        #050816;   /* خلفية رئيسية */
  --bg-2:      #080D20;   /* خلفية ثانوية */
  --bg-3:      #0A1128;   /* عنصر مرفوع خفيف */
  --card:      #0C142B;   /* البطاقات */
  --card-hover:#111E3D;   /* بطاقة مرتفعة / hover */
  --sidebar:   #070B18;   /* الشريط الجانبي */
  --active:    #102A4D;   /* العنصر النشط */

  /* الحدود */
  --border:    #1B2B52;
  --border-2:  #24396B;

  /* النصوص */
  --text:      #F4F7FF;
  --muted:     #9BA8C7;
  --faint:     #64718F;

  /* الألوان الأساسية */
  --primary:   #1687FF;
  --cyan:      #00D9FF;
  --purple:    #7C3AED;
  --neon:      #A855F7;

  /* الحالات */
  --ok:        #22D3A6;
  --warn:      #FBBF24;
  --danger:    #F43F5E;

  /* تدرّجات وظلال */
  --grad:      linear-gradient(135deg, #00D9FF 0%, #1687FF 45%, #7C3AED 100%);
  --grad-soft: linear-gradient(135deg, rgba(0,217,255,.16), rgba(22,135,255,.12), rgba(124,58,237,.16));
  --glow:      0 0 20px rgba(0,217,255,.20), 0 0 45px rgba(124,58,237,.12);
  --glow-sm:   0 0 14px rgba(0,217,255,.22);

  --radius:    14px;
  --radius-lg: 18px;
  --shadow:    0 14px 40px rgba(0,0,0,.45);
  --shadow-sm: 0 6px 18px rgba(0,0,0,.30);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Tajawal', system-ui, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* توهّج خفيف أعلى الصفحة + شبكة دقيقة — عمق بصري بدون صور */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 88% -8%,  rgba(0,217,255,.10) 0%, transparent 60%),
    radial-gradient(800px 520px at 8%  -12%, rgba(124,58,237,.10) 0%, transparent 62%),
    radial-gradient(1100px 700px at 50% 115%, rgba(22,135,255,.06) 0%, transparent 65%);
}

a { color: var(--cyan); text-decoration: none; transition: .15s; }
a:hover { color: var(--neon); }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--border-2), var(--border));
  border-radius: 10px; border: 2px solid var(--bg-2);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---------- الأيقونات (Lucide — SVG sprite) ---------- */
.ic {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 26px; height: 26px; stroke-width: 1.7; }

.layout { display: flex; min-height: 100vh; }

/* ============================================================
   الشريط الجانبي
   ============================================================ */
.sidebar {
  width: 264px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar), #05070F 70%);
  border-inline-start: 1px solid var(--border);
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 18px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.brand .logo {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, #0A1730, #101B38);
  border: 1px solid var(--border-2);
  box-shadow: var(--glow-sm);
}
.brand .logo img, .brand .logo svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand h1 {
  font-size: 19px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15;
  background: linear-gradient(100deg, #F4F7FF 10%, var(--cyan) 55%, var(--neon) 95%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand span { font-size: 10.5px; color: var(--faint); display: block; margin-top: 2px; letter-spacing: .3px; }

/* مجموعة التنقّل */
.nav-group {
  font-size: 10px; font-weight: 800; color: var(--faint);
  letter-spacing: .8px; text-transform: uppercase;
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 11px;
  color: var(--muted); font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; transition: .16s;
  position: relative; cursor: pointer;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item:hover .ic { color: var(--cyan); }
.nav-item .ic { transition: .16s; }

.nav-item.active {
  background: var(--active);
  color: #fff;
  border-color: var(--border-2);
  box-shadow: inset 0 0 22px rgba(0,217,255,.08);
}
.nav-item.active .ic { color: var(--cyan); }
/* خطّ سماوي مضيء على حافة العنصر النشط */
.nav-item.active::before {
  content: ''; position: absolute; inset-inline-end: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(0,217,255,.75);
}
.nav-item .badge-dot {
  margin-inline-start: auto; font-size: 10.5px; font-weight: 800;
  background: rgba(0,217,255,.14); color: var(--cyan);
  padding: 2px 7px; border-radius: 20px;
}

.sidebar-foot {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--faint); text-align: center; line-height: 1.75;
}
.sidebar-foot b {
  color: var(--muted); font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================
   المحتوى الرئيسي
   ============================================================ */
.main { flex: 1; padding: 24px 30px 40px; overflow-x: hidden; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 23px; font-weight: 800; letter-spacing: -.4px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.token-box {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--border); padding: 8px 12px; border-radius: 12px;
}
.token-box input { background: transparent; border: none; color: var(--text); outline: none; width: 150px; font-family: monospace; }

/* ---------- بطاقات الإحصاء ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px,1fr)); gap: 15px; margin-bottom: 26px; }

.stat {
  background: linear-gradient(160deg, var(--card), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 18px; position: relative; overflow: hidden;
  transition: .2s;
}
.stat::after {
  content: ''; position: absolute; top: 0; inset-inline-start: 0;
  width: 100%; height: 2px; background: var(--grad);
  opacity: 0; transition: .25s;
}
.stat:hover { transform: translateY(-3px); background: var(--card-hover); border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.stat:hover::after { opacity: 1; }

.stat .ico {
  position: absolute; inset-inline-start: 15px; top: 15px;
  color: var(--primary); opacity: .85;
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(22,135,255,.10);
  border: 1px solid rgba(22,135,255,.18);
}
.stat .ico .ic { width: 17px; height: 17px; }
.stat .num {
  font-size: 29px; font-weight: 800; line-height: 1.1;
  background: linear-gradient(135deg, #fff, var(--cyan) 130%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 5px; font-weight: 600; }

/* ---------- اللوحات ---------- */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 19px; margin-bottom: 18px;
}
.panel h3 {
  font-size: 15px; margin-bottom: 14px; font-weight: 800;
  display: flex; align-items: center; gap: 9px;
}
.panel h3 .ic { color: var(--cyan); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--bg-3); color: var(--text);
  font-weight: 700; font-size: 13px; transition: .16s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); background: var(--card-hover); }
.btn .ic { width: 16px; height: 16px; }

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 18px rgba(22,135,255,.28);
}
.btn.primary:hover { filter: brightness(1.12); box-shadow: 0 6px 26px rgba(22,135,255,.42); }

.btn.accent {
  background: linear-gradient(135deg, var(--cyan), var(--primary));
  border-color: transparent; color: #04203A;
  box-shadow: 0 4px 18px rgba(0,217,255,.22);
}
.btn.accent:hover { filter: brightness(1.1); }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-3); }
.btn.danger { color: var(--danger); border-color: rgba(244,63,94,.32); }
.btn.danger:hover { background: rgba(244,63,94,.10); border-color: var(--danger); }
.btn.warn { color: var(--warn); border-color: rgba(251,191,36,.30); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn.sm .ic { width: 14px; height: 14px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- الحقول ---------- */
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 11px; color: var(--text);
  padding: 10px 13px; font-family: inherit; font-size: 13.5px;
  outline: none; transition: .16s; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,135,255,.15);
}
select option { background: var(--bg-2); color: var(--text); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

/* ---------- الجداول ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: right; padding: 11px 13px; border-bottom: 1px solid var(--border); }
th {
  color: var(--faint); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px;
  background: rgba(8,13,32,.6);
}
tbody tr { transition: .14s; }
tbody tr:hover td { background: var(--bg-3); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- الشارات ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 10.5px; font-weight: 800; white-space: nowrap;
}
.badge.ok    { background: rgba(34,211,166,.14); color: var(--ok); }
.badge.err   { background: rgba(244,63,94,.14);  color: var(--danger); }
.badge.warn  { background: rgba(251,191,36,.14); color: var(--warn); }
.badge.run   { background: rgba(22,135,255,.16); color: #6FB4FF; }
.badge.movie { background: rgba(0,217,255,.14);  color: var(--cyan); }
.badge.tv    { background: rgba(124,58,237,.20); color: #B98BFF; }
.badge.sub   { background: rgba(52,152,219,.16); color: #5DADE2; }
.badge.dub   { background: rgba(230,126,34,.16); color: #E8843C; }
.badge.qual  { background: rgba(34,211,166,.13); color: #4FD9B4; }
.badge.bluray{ background: rgba(168,85,247,.18); color: #C79BF7; }
.badge.age   { background: rgba(251,140,0,.14);  color: #F0A030; }
.badge.ep    { background: rgba(0,217,255,.12);  color: #62C6E0; }

/* ============================================================
   شبكة الوسائط (البوسترات)
   ============================================================ */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px,1fr)); gap: 17px; }

.media-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: .2s; cursor: pointer;
  position: relative;
}
.media-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--glow), var(--shadow-sm);
}
.media-card .poster {
  width: 100%; aspect-ratio: 2/3; object-fit: cover;
  background: linear-gradient(160deg, var(--bg-3), var(--bg-2)); display: block;
}
.media-card .info { padding: 10px 12px; }
.media-card .info .t {
  font-size: 12.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-card .info .m {
  font-size: 10.5px; color: var(--muted); margin-top: 5px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* شريط تعدّد الصفحات + السكرول اللانهائي */
.pager-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.seg {
  display: inline-flex; gap: 3px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 11px; padding: 3px;
}
.seg button {
  background: transparent; border: none; color: var(--muted);
  font-weight: 700; font-size: 12px; padding: 6px 12px; border-radius: 8px; transition: .15s;
}
.seg button:hover { color: var(--text); background: var(--bg-3); }
.seg button.active { background: var(--grad); color: #04121F; box-shadow: var(--glow-sm); }

/* ============================================================
   اختيار الموقع بالصور
   ============================================================ */
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px,1fr)); gap: 14px; }

.src-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: .2s; text-align: center; position: relative;
}
.src-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.src-card.sel {
  border-color: var(--cyan);
  box-shadow: var(--glow), inset 0 0 30px rgba(0,217,255,.06);
}
.src-card.sel::after {
  content: ''; position: absolute; inset-inline-end: 9px; top: 9px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(0,217,255,.6);
}
.src-card .thumb {
  width: 100%; aspect-ratio: 16/10;
  background: linear-gradient(150deg, var(--bg-3), var(--bg-2));
  display: grid; place-items: center; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.src-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.src-card .thumb .ph {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.src-card .nm { padding: 9px 10px; font-size: 12.5px; font-weight: 700; }
.src-card .nm small { display: block; color: var(--faint); font-size: 10.5px; font-weight: 600; margin-top: 2px; }

/* تبويبات الأقسام */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs .tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700; color: var(--muted); transition: .15s;
}
.tabs .tab:hover { color: var(--text); border-color: var(--border-2); }
.tabs .tab.active { background: var(--grad-soft); border-color: var(--border-2); color: #fff; }
.tabs .tab.active .ic { color: var(--cyan); }

/* ============================================================
   المودال
   ============================================================ */
.modal-bg {
  position: fixed; inset: 0; background: rgba(3,5,14,.82);
  backdrop-filter: blur(6px); z-index: 50;
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); width: 100%; max-width: 840px;
  box-shadow: var(--shadow); animation: modalin .22s ease;
}
@keyframes modalin { from { transform: translateY(14px); opacity: 0; } }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-body { padding: 20px 22px; }
.close-x {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--muted);
  width: 34px; height: 34px; border-radius: 10px; font-size: 17px;
  display: grid; place-items: center; transition: .15s; flex-shrink: 0;
}
.close-x:hover { color: var(--danger); border-color: rgba(244,63,94,.4); }

/* المواسم والحلقات */
.season-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.season-tab {
  padding: 7px 14px; border-radius: 10px; background: var(--bg-2);
  border: 1px solid var(--border); font-size: 12.5px; font-weight: 700;
  color: var(--muted); transition: .15s; cursor: pointer;
}
.season-tab:hover { color: var(--text); border-color: var(--border-2); }
.season-tab.active { background: var(--grad); color: #04121F; border-color: transparent; }
.season-edit-btn {
  margin-left: 6px; padding: 2px 6px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 11px; line-height: 1;
  transition: .15s; vertical-align: middle;
}
.season-edit-btn:hover { background: var(--bg-3); border-color: var(--accent); color: var(--accent); }
.season-tab.active .season-edit-btn { color: var(--text); border-color: var(--border-2); }
.season-tab.active .season-edit-btn:hover { background: rgba(255,255,255,.2); color: #04121F; border-color: transparent; }

.season-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.season-poster {
  width: 92px; border-radius: 12px; flex-shrink: 0;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}

.ep-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 11px;
  margin-bottom: 8px; gap: 10px; background: var(--bg-3); transition: .15s;
}
.ep-row:hover { border-color: var(--border-2); }
.ep-still {
  width: 96px; height: 54px; object-fit: cover; border-radius: 8px;
  flex-shrink: 0; background: var(--bg-2);
}
.ep-still.ph { display: grid; place-items: center; color: var(--faint); }

.server-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 9px; font-size: 11px; margin: 2px; transition: .15s; color: var(--text);
}
.server-chip:hover { border-color: var(--primary); background: var(--card-hover); }
.server-chip.dl { border-color: rgba(34,211,166,.35); }
.server-chip .q { color: var(--ok); font-size: 10px; font-weight: 700; }

/* ---------- حالات ---------- */
.empty { text-align: center; color: var(--faint); padding: 48px 20px; font-size: 13.5px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--cyan); border-radius: 50%;
  animation: spin .85s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-wrap {
  position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--card); border: 1px solid var(--border-2);
  border-inline-start: 3px solid var(--primary);
  padding: 12px 17px; border-radius: 12px;
  box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600;
  animation: slidein .25s; max-width: 360px;
}
.toast.ok  { border-inline-start-color: var(--ok); }
.toast.err { border-inline-start-color: var(--danger); }
@keyframes slidein { from { transform: translateY(18px); opacity: 0; } }

/* ---------- مساعدات ---------- */
.hide { display: none !important; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
code {
  background: var(--bg-3); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 6px; font-size: 11.5px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; color: var(--cyan);
}

/* ============================================================
   صفحات الدخول / التنصيب
   ============================================================ */
.auth-body { display: grid; place-items: center; padding: 30px 16px; }
.auth-card {
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 20px; padding: 32px 30px;
  width: 100%; max-width: 448px; box-shadow: var(--shadow);
  text-align: center; position: relative; overflow: hidden;
}
.auth-card::before {
  content: ''; position: absolute; top: 0; inset-inline: 0; height: 2px; background: var(--grad);
}
.auth-logo {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px;
  background: linear-gradient(135deg, #0A1730, #101B38);
  border: 1px solid var(--border-2);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: var(--glow);
}
.auth-logo img, .auth-logo svg { width: 100%; height: 100%; object-fit: cover; }
.auth-card h1 {
  font-size: 23px; font-weight: 800; letter-spacing: -.4px;
  background: linear-gradient(100deg, #F4F7FF 10%, var(--cyan) 60%, var(--neon) 95%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-card .tagline { color: var(--faint); font-size: 12px; margin-top: 4px; font-style: normal; }
.auth-card form { text-align: right; margin-top: 16px; }
.auth-card .sec {
  font-size: 11px; font-weight: 800; color: var(--cyan);
  text-transform: uppercase; letter-spacing: .6px;
  margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
  text-align: right;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert {
  padding: 11px 14px; border-radius: 11px; font-size: 13px;
  font-weight: 600; margin-bottom: 14px; text-align: right;
}
.alert.err { background: rgba(244,63,94,.12); color: var(--danger); border: 1px solid rgba(244,63,94,.25); }
.alert.ok  { background: rgba(34,211,166,.12); color: var(--ok);   border: 1px solid rgba(34,211,166,.25); }

/* ---------- صندوق المستخدم ---------- */
.user-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  padding: 6px 10px 6px 13px; border-radius: 13px;
}
.user-box .avatar {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--grad); display: grid; place-items: center;
  font-weight: 800; color: #04121F; text-transform: uppercase; font-size: 15px;
}
.user-box .uname { font-weight: 700; font-size: 12.5px; }
.user-box .logout, .user-box .logout a { font-size: 10.5px; color: var(--faint); }
.user-box .logout a:hover { color: var(--danger); }

/* ---------- الرقائق ---------- */
.chip {
  display: inline-block; padding: 4px 11px; border-radius: 20px;
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 11.5px; margin: 3px 3px 0 0; color: var(--muted);
}
.chips { margin: 10px 0; }

/* ---------- تفاصيل العمل ---------- */
.modal-hero {
  height: 172px; margin: -20px -22px 10px; background-size: cover;
  background-position: center; border-radius: var(--radius-lg) var(--radius-lg) 0 0; position: relative;
}
.modal-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-2) 4%, transparent 78%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.detail-poster { width: 138px; border-radius: 13px; box-shadow: var(--shadow); flex-shrink: 0; border: 1px solid var(--border); }
.tagline { font-style: italic; color: var(--cyan); margin: 8px 0; font-size: 13.5px; }
.meta-row { color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.rating-badge {
  background: linear-gradient(135deg, var(--warn), #F59E0B);
  color: #2A1B00; padding: 2px 10px; border-radius: 8px;
  font-weight: 800; font-size: 12.5px;
}
.overview { line-height: 1.85; margin: 12px 0; font-size: 13.5px; color: #D6DEF0; }

/* الطاقم */
.cast-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.cast-card { flex: 0 0 90px; text-align: center; }
.cast-card img, .cast-card .cast-ph {
  width: 90px; height: 120px; object-fit: cover; border-radius: 12px;
  background: var(--bg-3); display: block; border: 1px solid var(--border);
}
.cast-card .cast-ph { display: grid; place-items: center; color: var(--faint); }
.cast-card .cn { font-size: 11.5px; font-weight: 700; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-card .cc { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* شعارات المنصّات */
.logo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.logo-chip {
  height: 46px; min-width: 46px; padding: 6px 10px; background: #fff;
  border-radius: 10px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #1A1A1A;
}
.logo-chip img { max-height: 34px; max-width: 90px; object-fit: contain; }

/* ============================================================
   قسم استخراج الـ API + التوثيق
   ============================================================ */
.api-key-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-3); margin-bottom: 9px; flex-wrap: wrap;
}
.api-key-row .kv {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 13px; color: var(--cyan); font-weight: 700; direction: ltr;
}

.endpoint {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--bg-3); margin-bottom: 8px; flex-wrap: wrap;
}
.endpoint .m {
  font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 6px;
  background: rgba(34,211,166,.14); color: var(--ok); letter-spacing: .5px;
}
.endpoint .u {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 12.5px; direction: ltr; color: var(--text);
}
.endpoint .d { color: var(--muted); font-size: 12px; margin-inline-start: auto; }

pre.code {
  background: #04060F; border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; overflow: auto;
  font-size: 12px; line-height: 1.75; direction: ltr; text-align: left;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  color: #A8C4E8; white-space: pre; max-height: 460px;
}

/* ============================================================
   تحديد متعدّد في تصفّح المواقع
   ============================================================ */
.media-card.picked { border-color: var(--cyan); box-shadow: var(--glow); }
.media-card.picked::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(160deg, rgba(0,217,255,.10), rgba(124,58,237,.08));
}
.pick-box {
  position: absolute; inset-inline-start: 8px; inset-block-start: 8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 7px; cursor: pointer;
  background: rgba(5,8,22,.78); border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.pick-box .ic { width: 15px; height: 15px; color: transparent; }
.media-card.picked .pick-box { background: var(--grad); border-color: transparent; }
.media-card.picked .pick-box .ic { color: #04121F; }

/* ============================================================
   زر قائمة الجوال
   ============================================================ */
.menu-toggle {
  display: none; background: var(--card); border: 1px solid var(--border);
  color: var(--text); width: 44px; height: 44px; border-radius: 12px;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.menu-toggle .ic { width: 21px; height: 21px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 45; }
.sidebar-backdrop.show { display: block; }

/* ============================================================
   الريسبونس
   ============================================================ */
@media (max-width: 1200px) {
  .src-grid { grid-template-columns: repeat(auto-fill, minmax(142px,1fr)); }
}

@media (max-width: 992px) {
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(146px,1fr)); gap: 12px; }
  .main { padding: 20px 18px 34px; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar {
    position: fixed; top: 0; right: 0; height: 100vh; z-index: 50;
    transform: translateX(100%); transition: transform .26s ease;
    box-shadow: -12px 0 44px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 15px 13px 30px; width: 100%; }
  .topbar { margin-bottom: 16px; padding-bottom: 12px; }
  .topbar h2 { font-size: 19px; }
  .user-box { padding: 5px 9px; }
  .user-box .uname { font-size: 11.5px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 13px 15px; }
  .stat .num { font-size: 22px; }
  .stat .ico { width: 28px; height: 28px; inset-inline-start: 12px; top: 12px; }
  .stat .ico .ic { width: 14px; height: 14px; }

  .media-grid { grid-template-columns: repeat(auto-fill, minmax(112px,1fr)); gap: 11px; }
  .src-grid { grid-template-columns: repeat(auto-fill, minmax(126px,1fr)); gap: 10px; }

  .row { flex-direction: column; }
  .row > * { width: 100%; min-width: 0; }

  .panel { padding: 14px; overflow-x: auto; }
  table { min-width: 620px; }

  .modal { max-width: 100%; }
  .modal-body { padding: 15px; }
  .detail-poster { width: 100px; }
  .modal-hero { height: 118px; margin: -15px -15px 8px; }
  .flex { flex-wrap: wrap; }

  .cast-card { flex: 0 0 74px; }
  .cast-card img, .cast-card .cast-ph { width: 74px; height: 100px; }

  .logo-chip { height: 40px; min-width: 40px; }
  .logo-chip img { max-height: 28px; max-width: 70px; }

  .auth-card { padding: 24px 19px; }
  .grid2 { grid-template-columns: 1fr; }

  .season-tabs { gap: 6px; }
  .season-tab { padding: 6px 11px; font-size: 12px; }
  .ep-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .ep-row > div:last-child { max-width: 100% !important; text-align: right !important; }
  .tabs .tab { padding: 6px 11px; font-size: 11.5px; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .src-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar h2 { font-size: 17px; }
  .brand h1 { font-size: 17px; }
}

/* محرك السحب */
.engine-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.engine-btn {
  position: relative;
  padding: 20px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: all .2s ease;
  text-align: center;
}
.engine-btn:hover:not(.disabled) {
  border-color: var(--cyan);
  background: rgba(34,211,166,.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34,211,166,.15);
}
.engine-btn.active {
  border-color: var(--cyan);
  background: rgba(34,211,166,.12);
  box-shadow: 0 0 0 3px rgba(34,211,166,.2);
}
.engine-btn.disabled {
  opacity: .45;
  cursor: not-allowed;
}
.engine-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.engine-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.engine-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.engine-check {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(34,211,166,.2);
  color: var(--ok);
  font-weight: 700;
}
.hint-box {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.3);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.6;
}
.hint-box code {
  background: rgba(0,0,0,.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============================================================
   عُقد السحب (Scraper Nodes)
   ============================================================ */
.nodes-hero {
  background:
    radial-gradient(760px 320px at 92% -30%, rgba(0,217,255,.16) 0%, transparent 62%),
    radial-gradient(620px 300px at 6% 120%, rgba(124,58,237,.14) 0%, transparent 60%),
    var(--card);
  border-color: var(--border-2);
}
.nodes-speed {
  text-align: center; padding: 14px 26px; border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(0,217,255,.12), rgba(124,58,237,.10));
  border: 1px solid var(--border-2); flex-shrink: 0;
}
.nodes-speed-num {
  font-size: 34px; font-weight: 800; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nodes-speed-lbl { font-size: 11px; color: var(--muted); margin-top: 6px; font-weight: 700; }

.nodes-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px; margin-top: 18px;
}
.nodes-stat {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
}
.nodes-stat b { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.nodes-stat span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.nodes-stat.ok b { color: var(--ok); }
.nodes-stat.warn b { color: var(--warn); }

.nodes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 15px; margin-top: 12px;
}
.node-card {
  position: relative; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; transition: .18s;
  display: flex; flex-direction: column; gap: 10px;
}
.node-card::after {
  content: ''; position: absolute; inset-inline-start: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 3px; background: var(--grad); opacity: .85;
}
.node-card:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.node-card.off { opacity: .58; }
.node-card.off::after { background: var(--faint); }

.node-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.node-prov {
  font-size: 9.5px; font-weight: 800; letter-spacing: .9px; color: var(--cyan);
  background: rgba(0,217,255,.10); border: 1px solid rgba(0,217,255,.22);
  padding: 3px 9px; border-radius: 6px;
}
.node-card-name { font-size: 15.5px; font-weight: 800; letter-spacing: -.3px; }
.node-card-url {
  font-size: 11.5px; color: var(--muted); direction: ltr; text-align: left;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.node-card-metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 11px; padding: 10px 8px;
}
.node-card-metrics > div { text-align: center; }
.node-card-metrics b { display: block; font-size: 14.5px; font-weight: 800; }
.node-card-metrics span { font-size: 10px; color: var(--faint); font-weight: 700; }
.node-card-meta {
  font-size: 11px; color: var(--faint); display: flex; align-items: center;
  gap: 5px; flex-wrap: wrap;
}
.node-card-meta .ic { width: 12px; height: 12px; }
.node-card-actions {
  display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; padding-top: 4px;
}

.nodes-steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 13px; margin-top: 14px;
}
.nodes-step {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 13px;
  padding: 15px 16px; position: relative;
}
.nodes-step-n {
  display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px;
  background: var(--grad); color: #04121F; font-weight: 800; font-size: 13px;
  margin-bottom: 9px;
}
.nodes-step b { font-size: 13.5px; }
.nodes-step p { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.75; }

/* ============================================================
   الرئيسية — بطاقات إحصائية محسّنة + نبض حي
   ============================================================ */
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 15px; margin-bottom: 22px;
}
.dash-card {
  position: relative; overflow: hidden; cursor: default;
  background: linear-gradient(165deg, var(--card), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 17px 19px; transition: .18s;
  display: flex; flex-direction: column; gap: 5px;
}
.dash-card[data-go] { cursor: pointer; }
.dash-card::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent, var(--primary)); opacity: .9;
}
.dash-card::after {
  content: ''; position: absolute; inset-inline-end: -34px; top: -34px;
  width: 108px; height: 108px; border-radius: 50%;
  background: var(--accent, var(--primary)); opacity: .07; transition: .25s;
}
.dash-card:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.dash-card:hover::after { opacity: .14; transform: scale(1.16); }
.dash-card .dc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-card .dc-ico {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  color: var(--accent, var(--primary));
  background: rgba(255,255,255,.045);
  border: 1px solid var(--border-2);
}
.dash-card .dc-num {
  font-size: 27px; font-weight: 800; letter-spacing: -1px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.dash-card .dc-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dash-card .dc-sub { font-size: 10.5px; color: var(--faint); font-weight: 600; }

.dash-live { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.dash-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(34,211,166,.65); animation: dashPulse 2.1s infinite;
}
@keyframes dashPulse {
  70% { box-shadow: 0 0 0 9px rgba(34,211,166,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,211,166,0); }
}
.dash-pulse.off { background: var(--faint); animation: none; box-shadow: none; }

.dash-bar {
  height: 7px; border-radius: 5px; overflow: hidden; display: flex;
  background: var(--bg-3); margin-top: 4px;
}
.dash-bar i { display: block; height: 100%; transition: width .5s ease; }

.dash-cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .dash-cols { grid-template-columns: 1fr; } }

.dash-health { display: flex; flex-direction: column; gap: 11px; }
.dash-health-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.dash-health-row .k { color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.dash-health-row .v { font-weight: 800; font-variant-numeric: tabular-nums; }
.dash-health-row .ic { width: 15px; height: 15px; }

@media (max-width: 768px) {
  .nodes-grid { grid-template-columns: 1fr; }
  .node-card-metrics { grid-template-columns: repeat(2, 1fr); }
  .nodes-speed { padding: 11px 18px; }
  .nodes-speed-num { font-size: 27px; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .dash-card { padding: 14px; }
  .dash-card .dc-num { font-size: 21px; }
}
