:root {
  --bg0: #020204;
  --bg1: #050508;
  --bg2: #0a0a0d;
  --text: #ffffff;
  --muted: rgba(210, 210, 224, 0.62);
  --muted-strong: rgba(230, 230, 240, 0.82);
  --neon: #ff0033;
  --neon-hot: #ff123a;
  --neon-deep: #c8001f;
  --glass: rgba(14, 14, 20, 0.62);
  --glass2: rgba(22, 22, 30, 0.5);
  --border: rgba(255, 0, 51, 0.22);
  --discord: #5865f2;
  --ok: #3dff8b;
  --warn: #ffb020;
  --radius: 18px;
  --font-display: "Orbitron", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: #050505;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 75% at 25% 35%, #1a0008 0%, transparent 55%),
    radial-gradient(ellipse 85% 70% at 78% 55%, #140008 0%, transparent 50%),
    #050505;
}

.aurora {
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(ellipse 60% 50% at 25% 35%, rgba(255, 0, 51, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 75% 70%, rgba(255, 0, 51, 0.12) 0%, transparent 60%);
  animation: aurora 22s linear infinite;
  filter: blur(40px);
  pointer-events: none;
}

.grid-floor {
  position: absolute;
  left: -40%;
  bottom: -12vh;
  width: 180%;
  height: 92vh;
  background:
    linear-gradient(to right, rgba(255, 0, 51, 0.28) 1px, transparent 1px),
    linear-gradient(to top, rgba(255, 0, 51, 0.28) 1px, transparent 1px);
  background-size: 80px 80px;
  transform: perspective(1100px) rotateX(60deg);
  transform-origin: bottom center;
  opacity: 0.55;
  mask-image: linear-gradient(to top, #000 0%, #000 45%, transparent 90%);
  animation: gridScroll 6.5s linear infinite;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.12), rgba(0,0,0,.12) 1px, transparent 1px, transparent 3px);
  opacity: .22;
}

@keyframes aurora {
  0%, 100% { transform: translate(0,0) rotate(0) scale(1); }
  33% { transform: translate(-8%,-5%) rotate(120deg) scale(1.05); }
  66% { transform: translate(6%,4%) rotate(240deg) scale(.95); }
}
@keyframes gridScroll {
  from { background-position: 0 0; }
  to { background-position: 0 80px; }
}

.login-wrap {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: linear-gradient(180deg, rgba(18,18,24,.78), rgba(8,8,12,.86));
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 36px 32px 28px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.03), 0 30px 80px rgba(255,0,51,.12), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
  text-align: center;
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #ff3355, #8b0018);
  box-shadow: 0 0 32px rgba(255,0,51,.45);
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: .08em;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: .16em;
  margin-bottom: 8px;
}

.login-card p.lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 700;
  letter-spacing: .04em;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, background .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-discord {
  width: 100%;
  background: linear-gradient(180deg, #6b75ff, var(--discord));
  color: #fff;
  box-shadow: 0 10px 28px rgba(88,101,242,.35);
}

.btn-primary {
  background: var(--neon);
  color: #fff;
  box-shadow: 0 0 18px rgba(255,0,51,.35);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
}

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,0,51,.12);
  border: 1px solid rgba(255,0,51,.35);
  color: #ffd0d8;
  font-size: 13px;
}

.app-shell {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid rgba(255,255,255,.06);
  background: rgba(5,5,8,.72);
  backdrop-filter: blur(16px);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.logo-row strong {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .12em;
}

.logo-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.nav-btn {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted-strong);
  border-radius: 12px;
  padding: 11px 12px;
  font-weight: 600;
}

.nav-btn.active, .nav-btn:hover {
  background: rgba(255,0,51,.12);
  border-color: rgba(255,0,51,.28);
  color: #fff;
}

.user-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}

.user-box img, .avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a0010;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.user-box .meta { min-width: 0; flex: 1; }
.user-box .meta b { display: block; font-size: 13px; }
.user-box .meta small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.main {
  padding: 28px 32px 48px;
  position: relative;
}

.hero h2 {
  font-family: var(--font-display);
  letter-spacing: .08em;
  font-size: 22px;
  margin-bottom: 6px;
}

.hero p { color: var(--muted); margin-bottom: 22px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.stat span { color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.stat b { display: block; margin-top: 8px; font-size: 26px; font-family: var(--font-display); }

.panel {
  background: rgba(10,10,14,.7);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 20px;
  padding: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.product {
  text-align: left;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 14px;
}

.product.active {
  border-color: var(--neon);
  box-shadow: 0 0 0 1px rgba(255,0,51,.35), 0 0 24px rgba(255,0,51,.15);
}

.product small { color: var(--muted); display: block; margin-top: 4px; font-size: 12px; }
.product b { font-family: var(--font-display); letter-spacing: .06em; font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr;
  gap: 12px;
  margin-bottom: 14px;
}

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .08em; text-transform: uppercase; }

select, input[type="text"], input[type="number"] {
  width: 100%;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

select:focus, input:focus { border-color: rgba(255,0,51,.6); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.keys-out, .history, .result-box {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 10px 12px;
}

.key-row code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: auto;
}

.view { display: none; }
.view.active { display: block; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th, .table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.table th { color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.table td code { font-family: var(--font-mono); font-size: 12px; }

.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.badge-admin { background: rgba(255,0,51,.18); color: #ff8aa3; }
.badge-reseller { background: rgba(61,255,139,.12); color: var(--ok); }
.badge-pending { background: rgba(255,176,32,.12); color: var(--warn); }

.pending-card {
  max-width: 520px;
  margin: 8vh auto;
  text-align: center;
  padding: 32px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  background: #12040a;
  border: 1px solid rgba(255,0,51,.4);
  padding: 12px 14px;
  border-radius: 12px;
  display: none;
  max-width: 320px;
}

.hidden { display: none !important; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 6; flex-direction: row; flex-wrap: wrap; }
  .user-box { width: 100%; }
  .products, .stats, .form-grid { grid-template-columns: 1fr; }
  .main { padding: 18px 14px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora, .grid-floor { animation: none; }
}
