:root {
  --paper: #eef1ed;
  --surface: #ffffff;
  --surface-2: #f7f9f6;
  --ink: #16221f;
  --muted: #5e6e69;
  --faint: #8a958f;
  --primary: #0e5c54;
  --primary-deep: #0a413b;
  --primary-soft: #e3efec;
  --brass: #b0883b;
  --brass-soft: #f3ead7;
  --line: #dce3dd;
  --line-strong: #c7d1cb;

  --new: #b5811f;
  --new-soft: #f7eed7;
  --approved: #0e5c54;
  --approved-soft: #e0efec;
  --published: #2e7d46;
  --published-soft: #e3f1e6;
  --hidden: #8a938f;
  --hidden-soft: #ebeeec;
  --danger: #b3422f;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 34, 31, 0.04), 0 6px 20px rgba(16, 34, 31, 0.06);
  --font: 'Readex Pro', system-ui, 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--primary); }

#app { display: flex; min-height: 100vh; }

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: 11px;
  font-family: 'Amiri', serif;
  font-size: 26px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 0 4px var(--primary-soft);
}
.brand-text h1 {
  font-family: 'Amiri', serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.1;
}
.brand-text span { font-size: 12px; color: var(--muted); }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section {
  font-size: 11px;
  color: var(--faint);
  font-weight: 600;
  letter-spacing: .4px;
  padding: 16px 12px 6px;
  text-transform: uppercase;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  text-align: start;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.nav-item .ic { width: 18px; text-align: center; opacity: .8; font-size: 15px; }
.nav-add { color: var(--primary); font-weight: 500; }
.nav-channels .nav-item { justify-content: space-between; }
.nav-channels .badge { font-size: 11px; }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.btn-sync {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--primary-deep);
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s;
}
.btn-sync:hover { background: var(--primary-soft); }
.btn-sync.spinning .ic { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.version { text-align: center; font-size: 11px; color: var(--faint); margin-top: 10px; }

/* ---------- المحتوى ---------- */
.content { flex: 1; padding: 0; min-width: 0; }
.page-head {
  padding: 26px 34px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
}
.page-head::after {
  content: ''; position: absolute; bottom: -1px; inset-inline-start: 34px;
  width: 56px; height: 2px; background: var(--brass);
}
.page-head h2 { font-size: 22px; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-body { padding: 26px 34px 60px; }

.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- بطاقات الإحصائيات ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 30px; font-weight: 700; line-height: 1; }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 7px; }
.stat-card.accent .num { color: var(--primary); }

.section-title { font-size: 16px; font-weight: 700; margin: 26px 0 14px; }

/* ---------- جدول القنوات ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: start; font-size: 14px; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12.5px; }
tr:last-child td { border-bottom: none; }
td .mini { color: var(--faint); font-size: 12px; }

/* ---------- شارات الحالة ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.new { background: var(--new-soft); color: var(--new); }
.badge.approved { background: var(--approved-soft); color: var(--approved); }
.badge.published { background: var(--published-soft); color: var(--published); }
.badge.hidden { background: var(--hidden-soft); color: var(--hidden); }
.badge.dot::before { content: '●'; font-size: 8px; }

/* ---------- تبويبات الحالة ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  padding: 7px 14px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; color: var(--muted); font-size: 13.5px; font-weight: 500;
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .count { opacity: .7; margin-inline-start: 4px; }

/* ---------- لوحة قوائم التشغيل ---------- */
.pl-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.pl-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pl-panel-head .search { margin: 0; flex: 1; }
.pl-panel-count { font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.pl-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 340px; overflow-y: auto; padding-inline-end: 4px;
}
.pl-row {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.pl-row:hover { background: var(--surface-2); }
.pl-row.active { border-color: var(--primary); background: var(--primary-soft); }
.pl-row.all { padding: 0; }
.pl-row.all.active { background: var(--ink); border-color: var(--ink); }
.pl-row.all.active .pl-row-title { color: #fff; }
.pl-row-pick, .pl-row.all {
  flex: 1; border: none; background: transparent; font-family: inherit; text-align: start;
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; min-width: 0;
}
.pl-row-title {
  font-size: 13.5px; color: var(--ink); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.pl-row.active .pl-row-title { color: var(--primary-deep); font-weight: 600; }
.pl-row-count {
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; flex-shrink: 0;
}
.pl-row.active .pl-row-count { background: #fff; color: var(--primary-deep); }
.pl-yt {
  display: grid; place-items: center; padding: 0 13px; color: var(--muted);
  text-decoration: none; border-inline-start: 1px solid var(--line); font-size: 13px; flex-shrink: 0;
}
.pl-yt:hover { background: var(--primary); color: #fff; }
.pl-empty { color: var(--faint); font-size: 13px; padding: 16px; text-align: center; }
.active-pl {
  background: var(--primary-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 14px; margin-bottom: 16px; font-size: 13.5px; color: var(--primary-deep);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.pl-clear { border: none; background: transparent; color: var(--danger); font-weight: 600; font-family: inherit; font-size: 13px; cursor: pointer; }
.pl-clear:hover { text-decoration: underline; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 200px;
  padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; font-family: inherit;
}
.search:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

/* ---------- شبكة المقاطع ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.video-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.video-thumb { position: relative; aspect-ratio: 16/9; background: var(--surface-2); }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-thumb .dur {
  position: absolute; bottom: 8px; inset-inline-start: 8px;
  background: rgba(0,0,0,.78); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 5px;
}
.video-thumb .st { position: absolute; top: 8px; inset-inline-end: 8px; }
.video-thumb .short-tag {
  position: absolute; top: 8px; inset-inline-start: 8px;
  background: var(--brass); color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 5px;
}
.video-thumb .privacy-badge {
  position: absolute; top: 8px; inset-inline-end: 8px;
  background: rgba(0,0,0,0.7); color: #fff; font-size: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.video-thumb .privacy-badge.unlisted { background: rgba(196, 127, 23, 0.9); }
.video-thumb .privacy-badge.private { background: rgba(122, 63, 191, 0.9); }
.video-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.video-title { font-size: 14.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.video-meta { display: flex; gap: 12px; color: var(--faint); font-size: 12px; margin-top: 8px; }
.video-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- أزرار ---------- */
.btn {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary-deep); }
.btn-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: #f7e9e6; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- الحالة الفارغة ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .em-icon { font-size: 42px; opacity: .35; margin-bottom: 12px; }
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--ink); }

/* ---------- النوافذ المنبثقة ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,34,31,.45);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-head { padding: 22px 24px 0; }
.modal-head h3 { font-size: 19px; font-weight: 700; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 0 24px 22px; display: flex; gap: 10px; justify-content: flex-start; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 5px; line-height: 1.5; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); font-family: inherit; font-size: 14px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* ---------- إشعارات ---------- */
.toasts { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 14px; max-width: 360px;
  animation: slidein .25s ease; border-inline-start: 3px solid var(--brass);
}
.toast.success { border-inline-start-color: var(--published); }
.toast.error { border-inline-start-color: var(--danger); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- شريط التقدّم ---------- */
.progress-track { height: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }
.progress-fill.indeterminate {
  background: linear-gradient(90deg, var(--primary-soft), var(--primary), var(--primary-soft));
  background-size: 200% 100%;
  animation: indet 1.2s linear infinite;
}
@keyframes indet { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.progress-msg { font-size: 14px; color: var(--ink); margin-top: 12px; font-weight: 500; }
.progress-stat { font-size: 12.5px; color: var(--faint); margin-top: 4px; }

@media (max-width: 820px) {
  .sidebar { position: fixed; transform: translateX(100%); transition: transform .2s; z-index: 50; }
  .sidebar.open { transform: none; }
  .page-body, .page-head { padding-inline: 18px; }
}

/* =============== صفحة الدخول =============== */
#login-page {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, #1a5f5f 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-container {
  width: 100%; max-width: 380px; padding: 20px;
}
.login-box {
  background: #fff; border-radius: var(--radius); padding: 40px;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.login-box h1 {
  font-size: 24px; font-weight: 700; margin: 0 0 4px; color: var(--ink);
  font-family: 'Amiri', serif;
}
.login-subtitle {
  font-size: 13px; color: var(--muted); margin: 0 0 28px; font-weight: 500;
}
.login-box .field { margin-bottom: 18px; }
.login-box .field label {
  display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--ink);
}
.login-box .field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; background: var(--surface);
}
.login-box .field input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft);
}
.error-box {
  background: var(--danger-soft); border: 1px solid var(--danger); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; color: var(--danger-deep); text-align: center;
}
.login-info {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.6; color: var(--muted);
}
.login-info p { margin: 8px 0; }

/* =============== وضع التجميع والمجموعات =============== */
.select-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--primary-soft, #e6f2f0); border: 1px solid var(--primary, #1f7a6d);
  border-radius: var(--radius, 10px); padding: 12px 16px; margin-bottom: 14px;
  position: sticky; top: 8px; z-index: 20;
}
.select-info { font-size: 13.5px; color: var(--ink, #1a2a2a); }
.select-info strong { color: var(--primary, #1f7a6d); font-size: 15px; }
.select-actions { display: flex; gap: 8px; }

.video-card.selectable { cursor: pointer; transition: transform .08s, box-shadow .12s; }
.video-card.selectable:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.video-card.selectable.selected { outline: 3px solid var(--primary, #1f7a6d); outline-offset: -1px; }
.pick-check {
  position: absolute; top: 8px; inset-inline-start: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--muted, #667);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.pick-check.on { background: var(--primary, #1f7a6d); color: #fff; }

.col-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.col-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.col-card {
  display: flex; flex-direction: column; justify-content: space-between;
  background: #fff; border: 1px solid var(--line, #e3e8e6);
  border-radius: var(--radius, 10px); padding: 16px; gap: 12px;
}
.col-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.col-title-row h4 {
  margin: 0; font-size: 15px; line-height: 1.4; color: var(--ink, #1a2a2a);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.col-desc {
  margin: 0 0 8px; font-size: 13px; color: var(--muted, #667); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.col-meta { font-size: 12px; color: var(--faint, #99a); }
.col-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal-sub { font-size: 13.5px; color: var(--muted, #667); margin: -4px 0 16px; line-height: 1.6; }
.modal-sub strong { color: var(--primary, #1f7a6d); }

/* =============== محرّر المجموعة =============== */
.edit-vid-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--line, #e3e8e6);
  border-radius: var(--radius-sm, 8px); padding: 6px;
}
.edit-vid-row {
  display: flex; align-items: center; gap: 10px; padding: 6px;
  border-radius: 6px;
}
.edit-vid-row:hover { background: var(--surface, #f6f8f7); }
.edit-vid-num {
  flex: 0 0 22px; height: 22px; border-radius: 50%;
  background: var(--primary, #1f7a6d); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.edit-vid-row img { width: 52px; height: 30px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }
.edit-vid-title {
  flex: 1; font-size: 13px; color: var(--ink, #1a2a2a);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.edit-vid-controls { display: flex; gap: 4px; flex: 0 0 auto; }
.ivbtn {
  width: 26px; height: 26px; border: 1px solid var(--line, #d8e0dd); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted, #556);
}
.ivbtn:hover:not(:disabled) { background: var(--surface, #eef3f1); }
.ivbtn:disabled { opacity: .35; cursor: default; }
.ivbtn.del { color: var(--danger, #c0392b); border-color: #e6c3bd; }
.col-empty-vids { padding: 16px; text-align: center; color: var(--faint, #99a); font-size: 13px; }

.pick-list {
  max-height: 340px; overflow-y: auto; border: 1px solid var(--line, #e3e8e6);
  border-radius: var(--radius-sm, 8px); padding: 4px;
}
.pick-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; cursor: pointer;
  border-radius: 6px;
}
.pick-row:hover { background: var(--surface, #f6f8f7); }
.pick-row img { width: 52px; height: 30px; object-fit: cover; border-radius: 4px; }
.pick-row span {
  flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-row input { flex: 0 0 auto; width: 17px; height: 17px; }

/* =============== سلاسل المحاضرات =============== */
.lec-list {
  display: flex; flex-direction: column; gap: 8px;
}
.lec-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--line, #e3e8e6);
  border-radius: var(--radius-sm, 8px); padding: 12px 14px;
}
.lec-row:hover { border-color: var(--primary, #1f7a6d); }
.lec-num {
  flex: 0 0 40px; height: 40px; border-radius: 8px;
  background: var(--primary, #1f7a6d); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.lec-main { flex: 1; min-width: 0; }
.lec-title { font-size: 14.5px; font-weight: 600; color: var(--ink, #1a2a2a); margin-bottom: 4px; }
.lec-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lec-tag {
  font-size: 11.5px; background: var(--surface, #eef3f1); color: var(--muted, #556);
  padding: 2px 8px; border-radius: 20px;
}
.lec-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* =============== منتقي التصنيفات =============== */
.cat-list {
  max-height: 200px; overflow-y: auto;
  border: 1px solid var(--line, #e3e8e6); border-radius: var(--radius-sm, 8px);
  padding: 4px;
}
.cat-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  cursor: pointer; border-radius: 6px;
}
.cat-row:hover { background: var(--surface, #f6f8f7); }
.cat-row input { flex: 0 0 auto; width: 16px; height: 16px; }
.cat-name { flex: 1; font-size: 13.5px; color: var(--ink, #1a2a2a); }
.cat-count {
  flex: 0 0 auto; font-size: 11px; color: var(--muted, #667);
  background: var(--surface, #eef3f1); padding: 1px 7px; border-radius: 10px;
}
.cat-empty {
  padding: 14px; text-align: center; font-size: 13px; color: var(--faint, #99a);
  border: 1px dashed var(--line, #d8e0dd); border-radius: var(--radius-sm, 8px);
}

/* =============== نافذة المحاضرة الطويلة =============== */
.modal-scroll { max-height: 60vh; overflow-y: auto; padding-inline-end: 4px; margin-bottom: 8px; }

/* =============== مبدّل المواقع =============== */
.site-switch { padding: 4px 10px 10px; }
.site-switch select {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line, #d8e0dd); background: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink, #1a2a2a);
  cursor: pointer;
}
.site-switch select:focus { outline: none; border-color: var(--primary, #1f7a6d); }
.nav-item.nav-sub { padding-inline-start: 26px; font-size: 13px; }

/* =============== نظرة عامة الموقع =============== */
.site-hero {
  background: linear-gradient(135deg, var(--primary, #1f7a6d), #145c52);
  color: #fff; border-radius: 14px; padding: 22px 24px; margin-bottom: 22px;
}
.site-hero-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.site-hero .mini { color: rgba(255,255,255,.85); }

.section-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 24px; }
.section-card {
  display: flex; align-items: center; gap: 14px; text-align: start;
  background: #fff; border: 1px solid var(--line, #e3e8e6); border-radius: 12px;
  padding: 16px 18px; cursor: pointer; transition: border-color .15s, transform .1s;
}
.section-card:hover { border-color: var(--primary, #1f7a6d); transform: translateY(-1px); }
.sc-icon {
  flex: 0 0 44px; height: 44px; border-radius: 10px;
  background: var(--surface, #eef3f1); color: var(--primary, #1f7a6d);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.sc-body { flex: 1; }
.sc-title { font-size: 15px; font-weight: 700; color: var(--ink, #1a2a2a); display: flex; align-items: center; gap: 8px; }
.sc-count { background: var(--primary, #1f7a6d); color: #fff; font-size: 12px; border-radius: 20px; padding: 1px 9px; }
.sc-sub { font-size: 12.5px; color: var(--muted, #667); margin-top: 3px; }
.sc-arrow { color: var(--faint, #aab); font-size: 18px; }

/* =============== الإحصائيات الغنية =============== */
.istat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.istat { background: #fff; border: 1px solid var(--line, #e3e8e6); border-radius: 12px; padding: 15px 16px; }
.istat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.istat-num { font-size: 26px; font-weight: 700; color: var(--ink, #1a2a2a); line-height: 1.1; }
.istat-lbl { font-size: 12.5px; color: var(--muted, #667); margin-top: 6px; }
.istat-icon {
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex: 0 0 auto;
}
.istat[data-statclick] { cursor: pointer; transition: border-color .15s, transform .1s; }
.istat[data-statclick]:hover { border-color: var(--primary, #1f7a6d); transform: translateY(-1px); }
.istat-accent  .istat-icon { background: #e7f0fb; color: #1f6fb2; }
.istat-purple  .istat-icon { background: #efeafb; color: #6a4bbd; }
.istat-success .istat-icon { background: #e3f5ec; color: #1f7a6d; }
.istat-warning .istat-icon { background: #fbf1dd; color: #b8791a; }
.istat-neutral .istat-icon { background: var(--surface, #eef3f1); color: var(--muted, #667); }
.istat-danger  .istat-icon { background: #fbe9e7; color: #c0392b; }

/* شريط النسبة */
.pcard { background: #fff; border: 1px solid var(--line, #e3e8e6); border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.pbar-wrap { }
.pbar-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted, #556); margin-bottom: 7px; }
.pbar-pct { font-weight: 700; color: var(--primary, #1f7a6d); }
.pbar { height: 9px; border-radius: 6px; background: #fbf1dd; overflow: hidden; }
.pbar-fill { height: 100%; background: var(--primary, #1f7a6d); border-radius: 6px; transition: width .4s; }
.pbar-sub { font-size: 11.5px; color: var(--faint, #99a); margin-top: 6px; }

/* فُتات المسار */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; }
.crumb { background: none; border: none; color: var(--primary, #1f7a6d); cursor: pointer; padding: 2px 4px; font: inherit; border-radius: 5px; }
.crumb:hover { background: var(--surface, #eef3f1); }
.crumb-sep { color: var(--faint, #aab); }
.crumb-cur { color: var(--ink, #1a2a2a); font-weight: 600; }

/* بطاقة يحتاج انتباهك */
.attention { background: #fbf7ec; border: 1px solid #ead9b0; border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; }
.att-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #8a6516; font-size: 14px; margin-bottom: 10px; }
.att-ic { font-size: 16px; }
.att-body { display: flex; flex-wrap: wrap; gap: 10px; }
.att-item {
  background: #fff; border: 1px solid #ead9b0; border-radius: 8px; padding: 8px 12px;
  font: inherit; font-size: 13px; color: var(--ink, #1a2a2a); cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.att-item:hover { border-color: #b8791a; }
.att-num { font-weight: 700; color: #b8791a; font-size: 15px; }

/* =============== تبديل العرض وزر الاختيار =============== */
.view-toggle { display: inline-flex; border: 1px solid var(--line, #d8e0dd); border-radius: 8px; overflow: hidden; }
.vt-btn { background: #fff; border: none; padding: 7px 12px; cursor: pointer; font-size: 15px; color: var(--muted, #667); }
.vt-btn.active { background: var(--primary, #1f7a6d); color: #fff; }
.vt-btn + .vt-btn { border-inline-start: 1px solid var(--line, #d8e0dd); }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: 6px; }

/* =============== جدول المقاطع الاحترافي =============== */
.vlt-wrap { overflow-x: auto; }
.vlt { width: 100%; border-collapse: collapse; font-size: 13px; }
.vlt thead th { background: var(--surface, #eef3f1); color: var(--muted, #556); font-weight: 600; text-align: start; padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; }
.vlt td { padding: 9px 12px; border-top: 1px solid var(--line, #eef1f0); vertical-align: middle; }
.vlt tr:hover td { background: var(--surface-2, #f6f9f8); }
.vlt-title { min-width: 240px; max-width: 380px; }
.vlt-t { font-weight: 600; color: var(--ink, #1a2a2a); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vlt-pl { color: var(--muted, #667); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vlt-date { color: var(--faint, #99a); white-space: nowrap; }
.vlt-actions { white-space: nowrap; display: flex; gap: 4px; flex-wrap: wrap; }
.vlt-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.vlt-col { font-size: 11px; background: #eae4fb; color: #6a4bbd; border-radius: 5px; padding: 1px 7px; white-space: nowrap; }

/* =============== الأوامر الجماعية =============== */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--primary-soft, #e3f5ec); border: 1px solid var(--primary, #1f7a6d);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}
.bulk-count { font-weight: 700; color: var(--primary-deep, #145c52); font-size: 13.5px; }
.vlt-check { text-align: center; width: 44px; }
.vlt-check input { width: 17px; height: 17px; cursor: pointer; }
.vlt tr.vlt-checked td { background: var(--primary-soft, #e3f5ec) !important; }
.video-card.bulkable { cursor: pointer; }
.video-card.bulkable.selected { outline: 2px solid var(--primary, #1f7a6d); outline-offset: 1px; }

/* =============== الترقيم =============== */
.list-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.list-bottombar { display: flex; justify-content: center; margin-top: 18px; }
.pagination { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line, #d8e0dd);
  background: #fff; color: var(--ink, #1a2a2a); border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.pg-btn:hover:not(:disabled):not(.active) { border-color: var(--primary, #1f7a6d); }
.pg-btn.active { background: var(--primary, #1f7a6d); color: #fff; border-color: var(--primary, #1f7a6d); font-weight: 700; }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-ellipsis { padding: 0 4px; color: var(--faint, #99a); }

/* =============== تبويب القناة (المقاطع/القوائم) =============== */
.ch-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line, #e3e8e6); margin-bottom: 16px; }
.ch-tab {
  background: none; border: none; padding: 10px 18px; cursor: pointer; font: inherit; font-size: 14.5px; font-weight: 600;
  color: var(--muted, #667); border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.ch-tab.active { color: var(--primary, #1f7a6d); border-bottom-color: var(--primary, #1f7a6d); }
.ch-tab .count { background: var(--surface, #eef3f1); border-radius: 20px; padding: 1px 8px; font-size: 12px; margin-inline-start: 6px; }
.pl-hidden-row td { opacity: .55; }

/* =============== مبدّل مجزّأ (مقالة/صفحة) =============== */
.seg { display: inline-flex; border: 1px solid var(--line, #d8e0dd); border-radius: 8px; overflow: hidden; }
.seg-btn { background: #fff; border: none; padding: 8px 16px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--muted, #667); }
.seg-btn.active { background: var(--primary, #1f7a6d); color: #fff; }
.seg-btn:disabled { opacity: .55; cursor: default; }
.seg-btn + .seg-btn { border-inline-start: 1px solid var(--line, #d8e0dd); }

/* =============== نتائج البحث في المقالات (إلحاق قائمة) =============== */
.ap-results { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; border: 1px solid var(--line, #e3e8e6); border-radius: 8px; padding: 6px; }
.ap-row { text-align: start; background: #fff; border: 1px solid transparent; border-radius: 6px; padding: 8px 10px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink, #1a2a2a); }
.ap-row:hover { background: var(--surface-2, #f6f9f8); }
.ap-row.sel { background: var(--primary-soft, #e3f5ec); border-color: var(--primary, #1f7a6d); font-weight: 600; }

/* =============== قائمة إضافات القائمة للمقالات =============== */
.append-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line, #e3e8e6); border-radius: 8px; margin-bottom: 6px; }
.append-info a { color: var(--primary-deep, #145c52); font-weight: 600; text-decoration: none; font-size: 13.5px; }
.append-info a:hover { text-decoration: underline; }

/* =============== كتلة الإحصائيات الاحترافية =============== */
.sm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.sm-metric { background: var(--surface, #f6f9f8); border-radius: 12px; padding: 16px 18px; }
.sm-num { font-size: 30px; font-weight: 800; color: var(--primary-deep, #145c52); line-height: 1.1; }
.sm-label { font-size: 13.5px; color: var(--ink, #333); margin-top: 4px; font-weight: 600; }
.sm-sub { font-size: 11.5px; color: var(--faint, #8a9a95); margin-top: 2px; }
.stats-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 780px) { .stats-2col { grid-template-columns: 1fr; } }
.pcard-title { font-size: 14px; font-weight: 700; color: var(--ink, #223); margin-bottom: 12px; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.hbar-label { flex: 0 0 42%; font-size: 12.5px; color: var(--ink, #333); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { flex: 1; height: 9px; background: var(--line, #e8eeec); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; transition: width .4s ease; min-width: 2px; }
.hbar-val { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--ink, #223); min-width: 30px; text-align: end; }
.hbar-extra { font-weight: 400; color: var(--faint, #8a9a95); font-size: 11px; }

/* =============== المحرّر المبسّط والمعاينة =============== */
.rte { border: 1px solid var(--line, #d8e0dd); border-radius: 10px; overflow: hidden; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--surface, #f4f8f7); border-bottom: 1px solid var(--line, #e3e8e6); }
.rte-toolbar button { background: #fff; border: 1px solid var(--line, #dde5e2); border-radius: 6px; padding: 5px 9px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink, #223); min-width: 32px; }
.rte-toolbar button:hover { background: var(--primary-soft, #e3f5ec); border-color: var(--primary, #1f7a6d); }
.rte-sep { width: 1px; background: var(--line, #dde5e2); margin: 2px 3px; }
.rte-body { min-height: 140px; max-height: 340px; overflow-y: auto; padding: 12px 14px; font-size: 14.5px; line-height: 1.8; outline: none; }
.rte-body:focus { background: #fffef9; }
.rte-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; }
.rte-body h2 { font-size: 18px; color: var(--primary-deep, #145c52); margin: 10px 0 6px; }
.rte-body ul, .rte-body ol { padding-inline-start: 24px; }
.preview-frame { border: 1px solid var(--line, #e3e8e6); border-radius: 10px; padding: 18px 20px; max-height: 60vh; overflow-y: auto; line-height: 1.9; font-size: 15px; background: #fff; }
.preview-frame img { max-width: 100%; height: auto; border-radius: 8px; }
.preview-frame h2 { color: var(--primary-deep, #145c52); }

/* عمود المزامنة في جدول القوائم */
.vlt-sync { white-space: nowrap; }
.vlt-sync .btn { margin-inline-start: 2px; }

/* منتقي قوائم يوتيوب (بحث حيّ) */
.pl-picker { position: relative; }
.pl-results { position: absolute; top: 100%; inset-inline: 0; background: #fff; border: 1px solid var(--line, #d8e0dd); border-radius: 8px; max-height: 260px; overflow-y: auto; z-index: 100; margin-top: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.pl-row { padding: 8px 12px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--line, #eef2f0); transition: background .1s; }
.pl-row:last-child { border-bottom: 0; }
.pl-row:hover { background: var(--primary-soft, #e3f5ec); }
.pl-empty { padding: 12px; text-align: center; color: var(--faint, #8a9a95); font-size: 13px; }
