/* ======================================================================
   Self-Bot Admin Panel — premium RTL dark theme
   ====================================================================== */
:root {
  --bg:            #080a12;
  --bg-2:          #0d1020;
  --panel:         rgba(255, 255, 255, 0.045);
  --panel-strong:  rgba(255, 255, 255, 0.07);
  --border:        rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text:          #eaecf6;
  --muted:         #8a90ab;
  --faint:         #5a607a;

  --accent-1: #7c5cff;
  --accent-2: #21d4fd;
  --accent-3: #ff5cf0;
  --grad: linear-gradient(135deg, #7c5cff 0%, #21d4fd 100%);
  --grad-soft: linear-gradient(135deg, rgba(124,92,255,.18), rgba(33,212,253,.12));

  --ok:   #34d399;
  --warn: #fbbf24;
  --err:  #fb6f8d;

  --radius:   18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, .65);
  --shadow-glow: 0 10px 40px -8px rgba(124, 92, 255, .45);
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Vazirmatn", "Tahoma", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ----- animated gradient mesh background ----- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(48rem 48rem at 85% -10%, rgba(124, 92, 255, .22), transparent 60%),
    radial-gradient(40rem 40rem at 5% 10%, rgba(33, 212, 253, .16), transparent 55%),
    radial-gradient(50rem 50rem at 50% 120%, rgba(255, 92, 240, .12), transparent 60%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.025'/%3E%3C/svg%3E");
  pointer-events: none;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
::selection { background: rgba(124,92,255,.4); }

a { color: var(--accent-2); text-decoration: none; }

/* ======================================================================
   Glass primitives
   ====================================================================== */
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.card:hover { border-color: var(--border-strong); }

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ======================================================================
   Buttons / inputs
   ====================================================================== */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.btn-primary {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: 0 14px 44px -8px rgba(124,92,255,.6); }

.btn-danger { background: rgba(251,111,141,.14); border-color: rgba(251,111,141,.3); color: #ffb3c1; }
.btn-ghost  { background: transparent; }
.btn-sm     { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.input, .select, textarea.input {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  color: var(--text);
  background: rgba(0,0,0,.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(124,92,255,.18);
  background: rgba(0,0,0,.35);
}
textarea.input { resize: vertical; min-height: 70px; line-height: 1.8; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }

/* ======================================================================
   Toggle switch
   ====================================================================== */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(255,255,255,.12);
  border: 1px solid var(--border);
  border-radius: 999px; transition: .25s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px;
  right: 4px; top: 3px; background: #fff; border-radius: 50%; transition: .25s;
}
.switch input:checked + .slider { background: var(--grad); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(-22px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ======================================================================
   Pills / badges
   ====================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
  background: var(--panel-strong); border: 1px solid var(--border);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok   { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.3); color: #9ff0cf; }
.pill.ok .dot   { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.err  { background: rgba(251,111,141,.14); border-color: rgba(251,111,141,.3); color: #ffb3c1; }
.pill.err .dot  { background: var(--err); box-shadow: 0 0 8px var(--err); }
.pill.warn { background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.3); color: #fde68a; }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

/* ======================================================================
   Login page
   ====================================================================== */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; padding: 40px 34px; text-align: center;
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.login-logo {
  width: 70px; height: 70px; margin: 0 auto 18px; border-radius: 20px;
  display: grid; place-items: center; font-size: 34px;
  background: var(--grad); box-shadow: var(--shadow-glow);
}
.login-card h1 { font-size: 23px; margin: 0 0 6px; }
.login-card p.sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.login-card .field { text-align: right; }
.error-msg {
  color: #ffb3c1; background: rgba(251,111,141,.1);
  border: 1px solid rgba(251,111,141,.25); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px; display: none;
}
.error-msg.show { display: block; animation: shake .35s; }

/* ======================================================================
   App shell
   ====================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  padding: 24px 16px; display: flex; flex-direction: column; gap: 6px;
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
  backdrop-filter: blur(10px);
  /* the menu can be taller than the viewport — let IT scroll on its own
     instead of dragging the main content; keep the scroll from chaining out */
  overflow-y: auto;
  overscroll-behavior: contain;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 22px; }
.brand .logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 22px;
  background: var(--grad); box-shadow: var(--shadow-glow);
}
.brand .name { font-size: 17px; font-weight: 800; }
.brand .name small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; transition: .18s; user-select: none;
}
.nav-item .ic { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active {
  color: #fff; background: var(--grad-soft);
  border-color: var(--border-strong);
}
.nav-item.active .ic { filter: drop-shadow(0 0 6px rgba(124,92,255,.7)); }
.nav-badge {
  margin-inline-start: auto; font-size: 11px; background: var(--grad);
  color: #fff; border-radius: 999px; padding: 1px 8px; font-weight: 700;
}
.sidebar .spacer { flex: 1; }

.main { padding: 26px 32px 60px; max-width: 1180px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 26px; flex-wrap: wrap;
}
.topbar h2 { margin: 0; font-size: 22px; }
.topbar .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.account-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--border);
}
.account-chip .av {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: var(--grad);
}
.account-chip .info { line-height: 1.3; }
.account-chip .info b { font-size: 13.5px; }
.account-chip .info span { display: block; font-size: 11.5px; color: var(--muted); }

/* ----- sections ----- */
.section { display: none; animation: rise .4s ease both; }
.section.active { display: block; }
.section-head { margin: 0 0 16px; }
.section-head h3 { margin: 0; font-size: 18px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

/* ----- grids ----- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ----- stat cards ----- */
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat .ic-box {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: var(--grad-soft); border: 1px solid var(--border);
}
.stat .val { font-size: 28px; font-weight: 800; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* ----- feature rows ----- */
.feature-row {
  display: flex; align-items: center; gap: 14px; padding: 15px 4px;
  border-bottom: 1px solid var(--border);
}
.feature-row:last-child { border-bottom: none; }
.feature-row .fr-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: none; font-size: 20px;
  display: grid; place-items: center; background: var(--grad-soft); border: 1px solid var(--border);
}
.feature-row .fr-text { flex: 1; }
.feature-row .fr-text b { font-size: 14.5px; }
.feature-row .fr-text span { display: block; font-size: 12.5px; color: var(--muted); }

/* ----- confirm checkbox (account cleanup) ----- */
.confirm-box {
  display: flex; align-items: flex-start; gap: 11px; margin: 16px 0 13px; padding: 13px 15px;
  border: 1px solid rgba(251, 111, 141, .45); background: rgba(251, 111, 141, .10);
  border-radius: var(--radius-sm); cursor: pointer;
}
.confirm-box input[type="checkbox"] {
  width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--err); cursor: pointer;
}
.confirm-box .cb-text { font-size: 13px; line-height: 1.75; color: var(--text); }
.confirm-box .cb-text b { color: var(--err); }

/* ----- tables ----- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.table .muted { color: var(--muted); }
.empty {
  text-align: center; color: var(--muted); padding: 30px; font-size: 14px;
}

/* ----- command reference ----- */
.cmd-cat-title {
  font-size: 15px; font-weight: 700; margin: 22px 0 12px; display: flex; gap: 8px; align-items: center;
}
.cmd-cat-title::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: var(--grad); }
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cmd {
  padding: 13px 15px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--border); transition: .18s;
}
.cmd:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.cmd code {
  font-family: "Vazirmatn", monospace; font-weight: 700; color: #fff;
  background: var(--grad-soft); padding: 2px 9px; border-radius: 7px; font-size: 13.5px;
}
.cmd .desc { color: var(--muted); font-size: 13px; margin-top: 7px; }
.cmd .usage { color: var(--faint); font-size: 12px; margin-top: 5px; direction: ltr; text-align: left; }
.cmd-aliases { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.cmd-aliases code {
  font-family: "Vazirmatn", monospace; font-weight: 600; color: var(--muted);
  background: transparent; border: 1px solid var(--border); padding: 1px 7px;
  border-radius: 6px; font-size: 12px;
}

/* ----- live log console ----- */
.console {
  background: #05060c; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; height: 460px; overflow-y: auto;
  font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12.7px; direction: ltr;
}
.log-line { padding: 3px 0; display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; }
.log-line .t { color: var(--faint); flex: none; }
.log-line.info  .m { color: #cdd3ee; }
.log-line.warn  .m { color: var(--warn); }
.log-line.error .m { color: var(--err); }
.log-line.ok    .m { color: var(--ok); }

/* ----- wizard / onboarding ----- */
.steps { display: flex; gap: 10px; margin-bottom: 22px; }
.step {
  flex: 1; text-align: center; padding: 10px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600;
}
.step .num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.08); margin-inline-end: 7px; font-size: 12px;
}
.step.active { color: #fff; border-color: var(--border-strong); background: var(--grad-soft); }
.step.active .num { background: var(--grad); }
.step.done .num { background: var(--ok); color: #05231a; }

/* ----- toast ----- */
.toast-host { position: fixed; bottom: 24px; left: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px; border-radius: 12px; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: rise .3s ease both; font-size: 14px; max-width: 340px;
}
.toast.ok   { border-color: rgba(52,211,153,.4); }
.toast.err  { border-color: rgba(251,111,141,.4); }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt { margin-top: 16px; } .mt-2 { margin-top: 24px; }
.text-muted { color: var(--muted); }

/* ======================================================================
   Animations / responsive
   ====================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}

.mobile-toggle { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; right: 0; top: 0; z-index: 100; width: 264px;
    transform: translateX(100%); transition: transform .3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-toggle { display: inline-flex; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}
@media (max-width: 560px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ======================================================================
   Onboarding mode (user must connect before seeing the panel)
   ====================================================================== */
.onboard-card { max-width: 460px; margin: 0 auto; }
.onboard-logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px;
  display: grid; place-items: center; font-size: 32px;
  background: var(--grad); box-shadow: var(--shadow-glow);
}
body.onboarding .sidebar,
body.onboarding .topbar { display: none; }
body.onboarding .app { grid-template-columns: 1fr; }
body.onboarding .main { display: grid; place-items: center; min-height: 100vh; padding: 24px; max-width: none; }
body.onboarding .section { display: none !important; }
body.onboarding #sec-account { display: block !important; width: 100%; }
/* during onboarding only the Telegram-connection card matters — hide the panel-password card */
body.onboarding #pwCard { display: none !important; }
/* connection card recentres itself when shown standalone during onboarding */
body.onboarding #connectCard { margin: 0 auto; }

/* hidden nav items (role-based) */
.nav-item[hidden] { display: none !important; }

/* users table helpers */
.link-cell { direction: ltr; text-align: left; max-width: 220px; }
.link-cell code { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.copy-btn { cursor: pointer; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-start: 6px; }
.online-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.online-dot.off { background: var(--faint); }

/* font preview box */
.font-preview {
  margin-top: 8px; background: rgba(0,0,0,.28); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: 19px; min-height: 26px;
  color: var(--text); word-break: break-word; direction: ltr; text-align: left;
}

/* ===== impersonation (admin support) banner ===== */
.imp-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 16px; font-size: 13px; font-weight: 700;
  background: linear-gradient(135deg, #fbbf24, #fb6f5f); color: #2a1602;
  box-shadow: 0 8px 24px -8px rgba(251,111,95,.65);
}
/* the class sets display:flex, which would override the [hidden] attribute —
   restore hiding so the support banner only shows during impersonation */
.imp-banner[hidden] { display: none !important; }
.imp-banner .btn { background: rgba(0,0,0,.16); color: #2a1602; border: 1px solid rgba(0,0,0,.28); }
.imp-banner .btn:hover { background: rgba(0,0,0,.28); }
body.impersonating .app { padding-top: 44px; }
body.impersonating .sidebar { top: 44px; height: calc(100vh - 44px); }

/* ===== store: receipt thumbnail + lightbox ===== */
.rcp-thumb {
  width: 54px; height: 54px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border-strong); cursor: zoom-in; background: var(--panel);
  transition: transform .15s ease, box-shadow .15s ease;
}
.rcp-thumb:hover { transform: scale(1.06); box-shadow: var(--shadow-glow); }
.lightbox {
  position: fixed; inset: 0; z-index: 400; cursor: zoom-out; padding: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 12, .86); backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw; max-height: 92vh; border-radius: var(--radius);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}

/* ===== users: per-row toggle, subscription bar, kebab action menu ===== */
.users-table td { vertical-align: middle; }

/* sliding active/inactive toggle — green when active, red when disabled */
.switch.usr input:checked + .slider { background: linear-gradient(135deg, #15b86b, #34d399); border-color: transparent; }
.switch.usr .slider { background: rgba(251,111,141,.55); border-color: rgba(251,111,141,.45); }
.switch.usr input:disabled + .slider { opacity: .55; cursor: not-allowed; }
.usr-state { display: inline-flex; align-items: center; gap: 9px; }
.usr-state .lbl { font-size: 12px; color: var(--muted); min-width: 44px; }

/* subscription remaining-days progress bar */
.subbar { min-width: 132px; }
.subbar .track {
  position: relative; height: 9px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.08); border: 1px solid var(--border);
}
.subbar .fill { position: absolute; inset: 0 auto 0 0; height: 100%; width: 0;
  border-radius: 999px; transition: width .5s ease, background .3s ease; }
.subbar .fill.ok   { background: linear-gradient(90deg, #15b86b, #34d399); }
.subbar .fill.warn { background: linear-gradient(90deg, #d99211, #fbbf24); }
.subbar .fill.err  { background: linear-gradient(90deg, #d23f5e, #fb6f8d); }
.subbar .cap { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.subbar .cap b { color: var(--text); font-weight: 600; }
.subbar.none .track { opacity: .45; }

/* kebab (⋮) action menu */
.kebab-wrap { position: relative; display: inline-block; }
.kebab-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 18px; line-height: 1;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.kebab-btn:hover { background: var(--panel-strong); border-color: var(--border-strong); }
.umenu {
  /* opened as position:fixed and placed by JS (see renderUsers) so the popup is
     never clipped by the table's overflow:auto wrapper — fixes the cut-off menu */
  position: absolute; inset-inline-start: 0; top: calc(100% + 6px); z-index: 200;
  min-width: 188px; padding: 6px; border-radius: 14px;
  background: #11142a; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); display: none; flex-direction: column; gap: 2px;
}
.umenu.open { display: flex; }
.umenu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: start;
  padding: 9px 11px; border-radius: 9px; font-size: 13.5px; font-family: inherit;
  background: transparent; border: 0; color: var(--text); cursor: pointer;
}
.umenu button:hover { background: var(--panel-strong); }
.umenu button.danger { color: #ffb3c1; }
.umenu button.danger:hover { background: rgba(251,111,141,.14); }
.umenu .sep { height: 1px; margin: 4px 2px; background: var(--border); }

/* ---------- account cleanup: two-way toggle + progress ---------- */
.cln-both {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 8px;
  cursor: pointer; user-select: none;
}
.cln-both input { width: 15px; height: 15px; accent-color: #ffb3c1; cursor: pointer; }
.cln-both span { display: inline !important; font-size: 12.5px; color: var(--muted); }
.cln-both input:disabled { opacity: .4; cursor: not-allowed; }
.cln-both input:disabled + span { opacity: .45; }
.cln-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cln-progress { margin-top: 14px; }
.cln-bar {
  height: 9px; border-radius: 99px; overflow: hidden;
  background: var(--panel-strong); border: 1px solid var(--border);
}
.cln-bar-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, #fb6f8d, #ffb3c1);
  transition: width .35s ease;
}

/* ---------- subscription card (user dashboard) ---------- */
.sub-card { display: flex; align-items: center; gap: 16px; }
.sub-card-ic {
  width: 54px; height: 54px; flex: none; border-radius: 16px;
  display: grid; place-items: center; font-size: 26px;
  background: var(--panel-strong); border: 1px solid var(--border);
}
.sub-card-body { flex: 1; min-width: 0; }
.sub-card-body b { display: block; font-size: 15px; }
.sub-card-body > span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.sub-track { height: 8px; border-radius: 99px; background: var(--panel-strong); border: 1px solid var(--border); overflow: hidden; margin-top: 10px; max-width: 360px; }
.sub-fill { height: 100%; width: 0%; border-radius: 99px; transition: width .4s ease; background: var(--ok); }
.sub-fill.warn { background: var(--warn); } .sub-fill.err { background: var(--err); }
.sub-days { flex: none; text-align: center; padding: 6px 14px; border-radius: 14px; background: var(--panel-strong); border: 1px solid var(--border); }
.sub-days b { display: block; font-size: 22px; line-height: 1; color: var(--ok); }
.sub-days span { font-size: 11px; color: var(--muted); }
.sub-days.warn b { color: var(--warn); } .sub-days.err b { color: var(--err); }
.sub-card.ok  { border-color: rgba(52,211,153,.35); }
.sub-card.warn{ border-color: rgba(251,191,36,.35); }
.sub-card.err { border-color: rgba(251,111,141,.35); }

/* ---------- centered user popup (admin) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 400; display: flex;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(5, 7, 18, .62); backdrop-filter: blur(4px);
  animation: modalIn .15s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: 100%; max-width: 640px; border-radius: 20px;
  padding: 22px; border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  max-height: calc(100vh - 36px); overflow-y: auto;
}
.modal-close {
  position: absolute; top: 12px; inset-inline-end: 12px; width: 32px; height: 32px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
}
.modal-close:hover { background: var(--panel-strong); color: var(--text); }
.modal-head { display: flex; align-items: center; gap: 13px; padding-inline-end: 30px; }
.modal-av {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
}
.modal-id { min-width: 0; }
.modal-id b { display: block; font-size: 17px; }
.modal-id span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
/* two columns so the popup stays short enough to fit on screen (half the rows
   on each side); collapses to one column on narrow screens */
.modal-body { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.modal-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.modal-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
@media (max-width: 560px) {
  .modal-card { max-width: 420px; }
  .modal-body { grid-template-columns: 1fr; }
}

/* ---------- top command users (leaderboard) ---------- */
.top-list { display: flex; flex-direction: column; gap: 8px; }
.top-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 13px; background: var(--panel); border: 1px solid var(--border);
}
.top-row:hover { border-color: var(--border-strong); }
.top-rank { flex: none; width: 34px; text-align: center; font-size: 15px; font-weight: 700; color: var(--muted); }
.top-rank.medal { font-size: 20px; }
.top-av {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}
.top-meta { flex: 1; min-width: 0; }
.top-meta b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta span { display: block; font-size: 12px; color: var(--muted); }
.top-count { flex: none; text-align: center; padding-inline: 6px; }
.top-count b { display: block; font-size: 18px; line-height: 1; color: var(--accent-2); }
.top-count span { font-size: 10.5px; color: var(--muted); }
