/* ═══════════════════════════════════════════════════════════════
   لوحة الإدارة
   ═══════════════════════════════════════════════════════════════ */

/* ── التبويبات ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  color: var(--text-dim);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.tab:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.tab.active { background: var(--accent); color: #fff; }

.tab-count {
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: .78rem;
  min-width: 24px;
  text-align: center;
}
.tab:not(.active) .tab-count { background: var(--bg-soft); }

/* ── صفوف الاشتراكات ───────────────────────────────────────────── */
.admin-list { display: grid; gap: 8px; }

.admin-row {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
  transition: border-color var(--fast) var(--ease);
}
.admin-row[open] { border-color: var(--accent); }

.admin-row summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.admin-row summary::-webkit-details-marker { display: none; }
.admin-row summary:hover { background: var(--bg-card); }

.admin-row-id { font-size: .82rem; }
.admin-row-state { margin-inline-start: auto; }

.admin-row-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  animation: fadeIn var(--mid) var(--ease);
}

.kv-tight { grid-template-columns: auto 1fr; gap: 5px 16px; font-size: .9rem; margin-bottom: 16px; }

/* ── أزرار العمليات ────────────────────────────────────────────── */
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-form { display: flex; gap: 6px; align-items: center; }

.input-xs { max-width: 78px; padding: 6px 10px; font-size: .85rem; }
.inline-form .input-sm { max-width: 190px; padding: 6px 10px; font-size: .85rem; }

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #c93034; box-shadow: 0 6px 18px rgba(237, 66, 69, .3); }

/* ── فورم توليد الأكواد ────────────────────────────────────────── */
.gen-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}
.gen-form-wide { grid-column: 1 / -1; }
.gen-form .btn { height: fit-content; }

/* ── الإحصائيات ────────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px;
  text-align: center;
  transition: transform var(--fast) var(--spring), border-color var(--fast) var(--ease);
}
.stat:hover { transform: translateY(-2px); border-color: var(--accent); }

.stat-num { display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat-lbl { display: block; color: var(--text-dim); font-size: .82rem; }

/* ── الأكواد المولّدة ──────────────────────────────────────────── */
.code-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.code-list code {
  background: rgba(0, 0, 0, .3);
  border-color: rgba(87, 242, 135, .35);
  font-size: .92rem;
  padding: 5px 11px;
  animation: popIn var(--mid) var(--spring) both;
}
.code-list code:nth-child(2) { animation-delay: .05s; }
.code-list code:nth-child(3) { animation-delay: .10s; }
.code-list code:nth-child(4) { animation-delay: .15s; }
.code-list code:nth-child(5) { animation-delay: .20s; }

/* ── الجوال ────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .admin-actions { flex-direction: column; align-items: stretch; }
  .inline-form { width: 100%; }
  .inline-form .input-sm, .input-xs { max-width: none; flex: 1; }
  .admin-row summary { flex-wrap: wrap; }
  .admin-row-state { margin-inline-start: 0; width: 100%; }
}

/* ── قوائم الاختيار المتعدد الطويلة ───────────────────────────── */
/* سيرفر فيه ٦٠ رتبة يخلي الصفحة تمتد بلا نهاية — نحدّها ونخليها تنزلق */
.checks-scroll {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(0, 0, 0, .16);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.checks-scroll::-webkit-scrollbar { width: 9px; }
.checks-scroll::-webkit-scrollbar-track { background: transparent; }
.checks-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9px;
}
.checks-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.field-roles .check span,
.field-role  .check span { font-weight: 600; }
