/* ============================================================
   AURORA IOS — Futuristic Purple-Black Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* === AURORA DARK (forced dark mode) === */
  --bg-void:          #000000;
  --bg-primary:       #06030F;
  --bg-secondary:     #0D0820;
  --bg-card:          #110B24;
  --bg-card-hover:    #1A1135;
  --bg-input:         #0D0820;
  --bg-overlay:       rgba(0,0,0,0.85);
  --bg-glass:         rgba(17,11,36,0.8);

  --label-primary:    #F0EAFF;
  --label-secondary:  rgba(220,200,255,0.75);
  --label-tertiary:   rgba(180,150,255,0.5);
  --label-quaternary: rgba(150,120,220,0.25);

  --separator:        rgba(138,75,255,0.2);
  --separator-bright: rgba(138,75,255,0.4);

  /* Aurora accent palette */
  --aurora-primary:   #8A4BFF;
  --aurora-bright:    #A855FF;
  --aurora-glow:      #C084FC;
  --aurora-deep:      #6D28D9;
  --aurora-neon:      #D946EF;
  --aurora-teal:      #06B6D4;
  --aurora-ice:       #7DD3FC;

  /* Glow effects */
  --glow-sm:          0 0 8px rgba(138,75,255,0.4), 0 0 20px rgba(138,75,255,0.2);
  --glow-md:          0 0 15px rgba(138,75,255,0.5), 0 0 40px rgba(138,75,255,0.25);
  --glow-lg:          0 0 25px rgba(138,75,255,0.6), 0 0 60px rgba(138,75,255,0.3);
  --glow-neon:        0 0 10px rgba(217,70,239,0.6), 0 0 30px rgba(217,70,239,0.3);

  /* Status */
  --status-active:    #22C55E;
  --status-unused:    #8A4BFF;
  --status-expired:   #F59E0B;
  --status-banned:    #EF4444;

  --status-active-bg:  rgba(34,197,94,0.12);
  --status-unused-bg:  rgba(138,75,255,0.15);
  --status-expired-bg: rgba(245,158,11,0.12);
  --status-banned-bg:  rgba(239,68,68,0.12);

  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 28px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(138,75,255,0.1);
  --shadow-glow: 0 8px 32px rgba(138,75,255,0.25), 0 2px 8px rgba(0,0,0,0.5);

  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  --sidebar-w: 260px;
  --topbar-h:  64px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  background: var(--bg-void);
  color: var(--label-primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   Animated Aurora Background
   ============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(138,75,255,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(217,70,239,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 20% 60%, rgba(6,182,212,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: auroraPulse 8s ease-in-out infinite;
}

@keyframes auroraPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================================
   Keyframes
   ============================================================ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: var(--glow-sm); }
  50% { box-shadow: var(--glow-md); }
}

@keyframes spinOrb {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(138,75,255,0.3); }
  50% { border-color: rgba(138,75,255,0.7); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Login Page
   ============================================================ */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

.login-shell::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(138,75,255,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.3);
  border-radius: var(--radius-2xl);
  padding: 40px 32px 36px;
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: slideUp 0.5s cubic-bezier(0.16,1,0.3,1) both;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.login-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.8), rgba(217,70,239,0.6), transparent);
}

.login-box::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -20%;
  width: 140%;
  height: 200px;
  background: radial-gradient(ellipse, rgba(138,75,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

/* Aurora Logo */
.aurora-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.aurora-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6D28D9 0%, #8A4BFF 50%, #D946EF 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(138,75,255,0.5), 0 0 40px rgba(138,75,255,0.2);
  flex-shrink: 0;
  animation: glowPulse 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.aurora-logo-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 60%);
}

.aurora-wordmark {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #A855FF, #D946EF, #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.aurora-sub {
  font-size: 11px;
  color: var(--label-tertiary);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 3px;
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--label-primary);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 14px;
  color: var(--label-tertiary);
  margin-bottom: 28px;
  font-weight: 500;
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--label-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.login-field input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(138,75,255,0.25);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--label-primary);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  border-color: var(--aurora-primary);
  box-shadow: 0 0 0 3px rgba(138,75,255,0.15), var(--glow-sm);
}

.login-field input::placeholder {
  color: var(--label-quaternary);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #6D28D9, #8A4BFF, #A855FF);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(138,75,255,0.4);
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 2.5s infinite;
}

.login-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.login-btn:active:not(:disabled) { transform: translateY(0); opacity: 1; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-err {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: #FCA5A5;
  font-size: 13px;
  font-weight: 500;
}

.login-telegram {
  margin-top: 20px;
  text-align: center;
}

.login-telegram a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--label-tertiary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(138,75,255,0.2);
  transition: all 0.2s;
}

.login-telegram a:hover {
  color: var(--aurora-glow);
  border-color: rgba(138,75,255,0.5);
  background: rgba(138,75,255,0.08);
}

/* ============================================================
   App Shell
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(138,75,255,0.2);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.6), transparent);
}

.sidebar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 200px;
  background: radial-gradient(ellipse at bottom, rgba(138,75,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(138,75,255,0.15);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6D28D9, #A855FF, #D946EF);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 12px rgba(138,75,255,0.5);
  flex-shrink: 0;
  animation: glowPulse 4s ease-in-out infinite;
}

.sidebar-wordmark {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #A855FF, #D946EF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.sidebar-role-tag {
  font-size: 10px;
  color: var(--label-tertiary);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label-quaternary);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(138,75,255,0.1);
  color: var(--label-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(109,40,217,0.3), rgba(138,75,255,0.2));
  color: var(--aurora-glow);
  border: 1px solid rgba(138,75,255,0.25);
  box-shadow: var(--glow-sm);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(to bottom, var(--aurora-primary), var(--aurora-neon));
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(138,75,255,0.15);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6D28D9, #A855FF);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(138,75,255,0.4);
}

.user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--label-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--label-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.logout-btn {
  width: 100%;
  padding: 9px 14px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  color: #FCA5A5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 50;
  width: 40px; height: 40px;
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sidebar-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--aurora-glow);
  border-radius: 1px;
  transition: all 0.3s;
}

/* ============================================================
   Main Area
   ============================================================ */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(138,75,255,0.15);
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 16px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--label-primary);
  letter-spacing: -0.3px;
  flex: 1;
}

.topbar-credit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(138,75,255,0.1);
  border: 1px solid rgba(138,75,255,0.25);
  border-radius: 20px;
}

.topbar-credit-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.topbar-credit-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--aurora-glow);
  letter-spacing: -0.2px;
}

.topbar-credit-label {
  font-size: 11px;
  color: var(--label-tertiary);
  font-weight: 600;
}

.content {
  padding: 24px;
  flex: 1;
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   Stats Row
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.15);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  animation: countUp 0.4s ease both;
}

.stat-card:hover {
  border-color: rgba(138,75,255,0.35);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.4), transparent);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label-tertiary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--label-primary);
}

.stat-value.purple { color: var(--aurora-bright); }
.stat-value.green  { color: var(--status-active); }
.stat-value.amber  { color: var(--status-expired); }
.stat-value.red    { color: var(--status-banned); }

.stat-icon {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  opacity: 0.15;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(138,75,255,0.3);
  background: rgba(138,75,255,0.08);
  color: var(--label-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

.btn:hover {
  background: rgba(138,75,255,0.15);
  border-color: rgba(138,75,255,0.5);
  color: var(--label-primary);
}

.btn:active { transform: scale(0.97); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #6D28D9, #8A4BFF);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 12px rgba(138,75,255,0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7C3AED, #A855FF);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 20px rgba(138,75,255,0.5);
}

.btn-success {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.3);
  color: #86EFAC;
}

.btn-success:hover {
  background: rgba(34,197,94,0.18);
  border-color: rgba(34,197,94,0.5);
  color: #86EFAC;
}

.btn-warn {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.3);
  color: #FCD34D;
}

.btn-warn:hover {
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.5);
  color: #FCD34D;
}

.btn-danger {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #FCA5A5;
}

.btn-danger:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.5);
  color: #FCA5A5;
}

/* ============================================================
   Inputs & Form
   ============================================================ */
.input {
  background: var(--bg-input);
  border: 1px solid rgba(138,75,255,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--label-primary);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.input:focus {
  border-color: var(--aurora-primary);
  box-shadow: 0 0 0 3px rgba(138,75,255,0.12);
}

.input::placeholder { color: var(--label-quaternary); }

.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label-tertiary);
  margin-bottom: 8px;
}

/* ============================================================
   Panel / Cards
   ============================================================ */
.panel {
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.15);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.5), transparent);
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--label-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   Key Generation — Duration Tiles
   ============================================================ */
.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.price-tile {
  background: var(--bg-input);
  border: 1px solid rgba(138,75,255,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.price-tile:hover {
  border-color: rgba(138,75,255,0.4);
  background: rgba(138,75,255,0.08);
}

.price-tile.selected {
  border-color: var(--aurora-primary);
  background: rgba(138,75,255,0.15);
  box-shadow: var(--glow-sm);
}

.price-tile .dur {
  font-size: 13px;
  font-weight: 700;
  color: var(--label-primary);
  margin-bottom: 4px;
}

.price-tile .cr {
  font-size: 12px;
  color: var(--label-tertiary);
  font-weight: 600;
}

.price-tile.selected .dur { color: var(--aurora-glow); }
.price-tile.selected .cr { color: var(--aurora-bright); }

/* Cost summary block */
.cost-block {
  background: var(--bg-secondary);
  border: 1px solid rgba(138,75,255,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================================
   Key Table
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(138,75,255,0.15);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

thead {
  background: rgba(138,75,255,0.06);
  border-bottom: 1px solid rgba(138,75,255,0.15);
}

th {
  padding: 12px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label-tertiary);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(138,75,255,0.08);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: rgba(138,75,255,0.04);
}

.key-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--aurora-glow);
  letter-spacing: 0.03em;
  background: rgba(138,75,255,0.08);
  padding: 3px 7px;
  border-radius: 4px;
}

.copy-btn {
  border: none;
  background: rgba(138,75,255,0.15);
  color: var(--label-tertiary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.copy-btn:hover {
  background: rgba(138,75,255,0.3);
  color: var(--aurora-glow);
}

.td-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.empty-row td {
  text-align: center;
  padding: 48px;
  color: var(--label-tertiary);
  font-size: 14px;
  font-weight: 500;
}

/* ============================================================
   Status Pills
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.active  { background: var(--status-active-bg);  color: var(--status-active);  border: 1px solid rgba(34,197,94,0.25); }
.pill.unused  { background: var(--status-unused-bg);  color: var(--aurora-bright);  border: 1px solid rgba(138,75,255,0.3); }
.pill.expired { background: var(--status-expired-bg); color: var(--status-expired); border: 1px solid rgba(245,158,11,0.25); }
.pill.banned  { background: var(--status-banned-bg);  color: var(--status-banned);  border: 1px solid rgba(239,68,68,0.25); }
.pill.vip     { background: rgba(138,75,255,0.1);     color: var(--aurora-bright);  border: 1px solid rgba(138,75,255,0.25); }
.pill.global  { background: rgba(6,182,212,0.1);       color: var(--aurora-teal);    border: 1px solid rgba(6,182,212,0.25); }

/* Dot indicator */
.pill.active::before  { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--status-active); }
.pill.unused::before  { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--aurora-bright); }
.pill.expired::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--status-expired); }
.pill.banned::before  { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--status-banned); }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.3);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-glow);
  animation: slideUp 0.3s cubic-bezier(0.16,1,0.3,1);
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.8), transparent);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--label-primary);
}

.modal-sub {
  font-size: 13px;
  color: var(--label-tertiary);
  margin-top: 4px;
  font-weight: 500;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid rgba(138,75,255,0.1);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-secondary);
  gap: 12px;
}

.hwid-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--label-secondary);
  word-break: break-all;
}

.device-meta {
  font-size: 11px;
  color: var(--label-tertiary);
  font-weight: 500;
  flex-shrink: 0;
}

/* ============================================================
   Toast
   ============================================================ */
.toast-area {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 320px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  animation: toastSlide 0.3s cubic-bezier(0.16,1,0.3,1) both;
  backdrop-filter: blur(12px);
  border: 1px solid;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.toast.ok {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.3);
  color: #86EFAC;
}

.toast.err {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #FCA5A5;
}

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast.ok .toast-dot  { background: var(--status-active); box-shadow: 0 0 6px var(--status-active); }
.toast.err .toast-dot { background: var(--status-banned); box-shadow: 0 0 6px var(--status-banned); }

/* ============================================================
   Manage Actions Bar
   ============================================================ */
.manage-actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(138,75,255,0.05);
  border: 1px solid rgba(138,75,255,0.15);
  border-radius: var(--radius);
}

/* ============================================================
   User Cards (Manage Resellers/Admins)
   ============================================================ */
.user-card {
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.15);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 10px;
  transition: border-color 0.2s, transform 0.2s;
  animation: slideUp 0.35s ease both;
  position: relative;
  overflow: hidden;
}

.user-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.3), transparent);
}

.user-card:hover {
  border-color: rgba(138,75,255,0.3);
  transform: translateY(-1px);
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.user-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6D28D9, #A855FF);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.user-card-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--label-primary);
}

.user-card-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.user-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label-quaternary);
}

.user-meta-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--label-primary);
}

.user-card-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

/* ============================================================
   Ban Notice
   ============================================================ */
.ban-notice {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.ban-card {
  max-width: 380px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-2xl);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 0 40px rgba(239,68,68,0.15);
  animation: slideUp 0.45s ease;
}

.ban-icon {
  font-size: 64px;
  margin-bottom: 20px;
  filter: grayscale(0.3);
}

.ban-title {
  font-size: 22px;
  font-weight: 900;
  color: #FCA5A5;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.ban-text {
  font-size: 13px;
  color: var(--label-tertiary);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ============================================================
   Spinner
   ============================================================ */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spinOrb 0.6s linear infinite;
}

/* ============================================================
   Reseller Detail Panel
   ============================================================ */
.detail-panel {
  background: var(--bg-card);
  border: 1px solid rgba(138,75,255,0.25);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--glow-sm);
  animation: slideUp 0.3s ease;
  position: relative;
  overflow: hidden;
}

.detail-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,75,255,0.6), transparent);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--label-primary);
}

.detail-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

/* ============================================================
   Form Row
   ============================================================ */
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-row .input {
  flex: 1;
  min-width: 140px;
}

/* ============================================================
   Telegram Banner
   ============================================================ */
.tg-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(6,182,212,0.06);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius);
  color: var(--aurora-ice);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.tg-banner:hover {
  background: rgba(6,182,212,0.12);
  border-color: rgba(6,182,212,0.35);
}

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   Mobile Key Cards — replaces table on small screens
   ============================================================ */
.key-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(138,75,255,0.15);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  display: none;
}

.key-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.key-card-key {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--aurora-glow);
  background: rgba(138,75,255,0.1);
  padding: 4px 8px;
  border-radius: 5px;
  letter-spacing: 0.05em;
  word-break: break-all;
  flex: 1;
}

.key-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.key-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.key-card-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.key-card-meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-quaternary);
}

.key-card-meta-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
}

.key-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0,0,0,0.5);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-area {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px 0 64px;
  }

  .content {
    padding: 12px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .price-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar-title {
    font-size: 15px;
  }

  .panel {
    padding: 16px 14px;
  }

  .modal {
    padding: 20px 16px;
  }

  /* Hide desktop table, show mobile cards */
  .table-wrap {
    display: none;
  }

  .key-card {
    display: block;
  }

  .filter-bar {
    gap: 6px;
  }

  .filter-bar .input {
    max-width: 100% !important;
    width: 100%;
  }

  .manage-actions-bar {
    gap: 6px;
    padding: 10px 12px;
  }

  .user-card {
    padding: 14px;
  }

  .user-card-meta {
    gap: 10px 16px;
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .input {
    width: 100%;
  }

  .topbar-credit {
    padding: 5px 10px;
  }

  .topbar-credit-val {
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 10px;
  }

  .login-box {
    padding: 28px 18px 24px;
  }

  .content {
    padding: 10px;
  }

  .panel {
    padding: 14px 12px;
  }
}
