/* ============================================================
   XFX.SYSTEMS — Admin panel
   Restyles the existing .admin-* markup only (ids untouched).
   ============================================================ */
.admin-wrap {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 90px;
}
.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 22px 26px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 170% at 100% 0%, rgba(255, 255, 255, .15), transparent 60%),
    linear-gradient(180deg, #131317, #0d0d10);
}
.admin-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -.03em;
  text-transform: none;
  margin-bottom: 7px;
}
.admin-sub { color: var(--text-3); font-size: 13px; max-width: 78ch; line-height: 1.6; }
.admin-head-right { display: flex; align-items: center; gap: 10px; }
.admin-head-right .admin-badge { font-size: 10.5px; padding: 7px 13px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.admin-stat {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  transition: border-color .2s, transform .2s;
}
.admin-stat:hover { border-color: var(--line-3); transform: translateY(-2px); }
.admin-stat::after {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(255, 255, 255, 0));
}
.admin-stat-label {
  font-family: var(--xfx-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-3);
}
.admin-stat-val {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -.03em;
  color: var(--text);
  margin-top: 8px;
  line-height: 1;
}

.admin-tabs {
  display: flex; gap: 4px;
  margin-bottom: 22px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0c0c0f;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  position: relative;
  white-space: nowrap;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  font-family: var(--xfx-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3);
  transition: color .15s, background .15s;
}
.admin-tab:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.admin-tab.active {
  color: #0a0a0a;
  background: linear-gradient(180deg, #ffffff, #e6e6e6);
  box-shadow: 0 12px 26px -16px var(--accent-glow);
}
.admin-tab-count {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  font-size: 9.5px;
  letter-spacing: .08em;
}
.admin-panel { display: none; }
.admin-panel.active { display: block; animation: fadeIn .2s ease-out; }
.admin-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .014);
}
.admin-subhead {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--xfx-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-3);
  margin: 28px 0 12px;
}
.admin-subhead::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.admin-keys,
#keyOut,
#resellerOut {
  font-family: var(--xfx-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-2);
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.admin-keys.tall { max-height: 70vh; }
.admin-prod-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  font-size: 12px; color: var(--text-2);
}
.admin-prod-break { display: block; margin: 14px 0 8px; font-family: var(--xfx-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

@media (max-width: 700px) {
  .admin-wrap { padding: 20px 16px 70px; }
  .admin-head { padding: 18px; }
}

/* ── Panels / inner blocks ───────────────────────────────── */
.admin-panel .card { margin-bottom: 0; }
#statBoxes, .admin-stats { margin-bottom: 24px; }
.admin-badge.chip { padding: 5px 11px; }
#licSearch, #userSearch { min-width: 240px; }
.review-row, .audit-row { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 10px; background: rgba(255, 255, 255, .014); }
.reseller-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, var(--card-2), var(--card)); }
.reseller-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.reseller-cell { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0a0a0a; font-size: 12.5px; }
#coverGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
#coverGrid .card, #coverGrid > div { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: linear-gradient(180deg, var(--card-2), var(--card)); }

/* ── User drawer ─────────────────────────────────────────── */
.drawer-backdrop { background: rgba(4, 4, 6, .78); backdrop-filter: blur(4px); }
.drawer-panel {
  background: #0a0a0a;
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-2);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-title { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.drawer-sub { color: var(--text-3); font-size: 12.5px; }
.drawer-body, #drawerBody { padding: 20px 22px 40px; }
.drawer-meta { font-family: var(--xfx-mono); font-size: 11px; letter-spacing: .1em; color: var(--text-3); }

/* ── Security / audit accents ────────────────────────────── */
.sev-warn { color: #f2c979; }
.sev-info { color: var(--text-2); }
#alertTable, #auditTable, #onlineTable, #hwidTable, #reviewTable, #discTable { width: 100%; }
.admin-tab.active .admin-tab-count { background: rgba(255, 255, 255, .22); }

/* ── Admin-only gate screen (shown until role is confirmed) ── */
.admin-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  background: #060607;
}
.admin-gate .spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  animation: xfx-admin-spin .8s linear infinite;
}
.admin-gate.denied { color: var(--danger); }
@keyframes xfx-admin-spin { to { transform: rotate(360deg); } }
body.admin-locked { overflow: hidden; }

@media (max-width: 700px) {
  .drawer-panel { width: 100% !important; max-width: 100% !important; }
  #coverGrid { grid-template-columns: 1fr; }
}

/* ── Security strip in the admin header ──────────────────── */
.admin-secure { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 22px; }
.admin-secure .admin-badge { font-size: 9.5px; padding: 5px 10px; color: var(--text-3); }
.admin-secure .admin-badge.warn { color: #f2c979; border-color: rgba(255, 215, 0, .38); background: rgba(255, 215, 0, .1); }
.admin-gate-note {
  margin: 0 0 22px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 215, 0, .32);
  border-radius: 14px;
  background: rgba(255, 215, 0, .07);
  color: #f2c979;
  font-size: 12.5px;
  line-height: 1.6;
}
/* ============================================================
   Admin panel — pass 2: density, depth, and 2,000-row scrolling
   ============================================================ */
.admin-wrap { max-width: 1720px; padding: 34px 30px 110px; }

/* ── Header ──────────────────────────────────────────────── */
.admin-head { gap: 22px; padding-bottom: 22px; }
.admin-title { font-size: 34px; letter-spacing: -.035em; }
.admin-sub { font-size: 13.5px; }
.admin-head-right .admin-badge { font-size: 11px; padding: 8px 15px; }

/* ── Security strip ─────────────────────────────────────── */
.admin-secure { gap: 9px; }
.admin-secure .admin-badge {
  font-size: 9.5px; padding: 6px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .035);
}

/* ── Stat grid ──────────────────────────────────────────── */
.admin-stats { gap: 13px; margin-bottom: 28px; }
.admin-stat {
  position: relative; overflow: hidden;
  padding: 17px 18px; border-radius: 16px;
  border-color: var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, .042), rgba(255, 255, 255, .01));
}
.admin-stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent); opacity: .55;
}
.admin-stat-val { font-size: 23px; font-weight: 800; letter-spacing: -.035em; }
.admin-stat-label { font-size: 9px; letter-spacing: .22em; }

/* ── Tabs ───────────────────────────────────────────────── */
.admin-tabs {
  gap: 5px; padding: 6px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .014);
}
.admin-tab { padding: 9px 15px; border-radius: 10px; font-size: 11.5px; }
.admin-tab-count { font-size: 10px; }

/* ── Toolbar sits above the table and stays put while you scroll ── */
.admin-toolbar {
  position: sticky; top: 76px; z-index: 5;
  padding: 13px 14px; border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(12, 12, 13, .88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-1);
}

/* ── Tables: sticky header inside a scroll box (2,000 rows) ── */
.admin-table-scroll {
  /* Sizes to its rows, then scrolls — so a 2-row result isn't padded out with
     a large empty box, and a 2,000-row result stays usable. */
  max-height: calc(100vh - 330px);
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: #0b0b0c;
}
.admin-table { border: 0; border-radius: 0; }
.admin-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #0e0e0f;
  box-shadow: inset 0 -1px 0 var(--line-2);
}
.admin-table th, .admin-table td { padding: 12px 14px; }
.admin-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .012); }
.admin-table tbody tr:hover { background: rgba(255, 255, 255, .04); }
.admin-table td .btn, .admin-actions .btn { padding: 6px 11px; font-size: 10px; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Section heads, review/audit rows, reseller cards ────── */
.admin-subhead { font-size: 10.5px; letter-spacing: .2em; }
.review-row, .audit-row { border-radius: 14px; transition: border-color .18s, background .18s; }
.review-row:hover, .audit-row:hover { border-color: var(--line-3); background: rgba(255, 255, 255, .028); }
.reseller-card { border-radius: 17px; }
.admin-keys, .admin-keys.tall { border-radius: 14px; border: 1px solid var(--line); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1180px) {
  .admin-wrap { padding: 26px 18px 90px; }
  .admin-toolbar { position: static; }
  .admin-table-scroll { max-height: 70vh; }
}
@media (max-width: 640px) {
  .admin-title { font-size: 26px; }
  .admin-stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}