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

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-hover: #818cf8;
  --primary-dim: rgba(99, 102, 241, .08);
  --primary-border: rgba(99, 102, 241, .20);
  --primary-glow: rgba(99, 102, 241, .06);
  --primary-extra-light: #a5b4fc;
  --primary-ultra-light: #c7d2fe;

  --accent: #8b5cf6;
  --accent-light: #a78bfa;

  --game-valorant: #fd4556;
  --game-fortnite: #9d4dbb;
  --game-arc: #00d4ff;

  --success: #10b981;
  --success-light: #34d399;
  --success-dim: rgba(16, 185, 129, .08);
  --success-border: rgba(16, 185, 129, .20);

  --danger: #ef4444;
  --danger-light: #f87171;
  --danger-dim: rgba(239, 68, 68, .08);
  --danger-border: rgba(239, 68, 68, .20);

  --warn: #f59e0b;
  --warn-light: #fbbf24;
  --warn-dim: rgba(245, 158, 11, .08);
  --warn-border: rgba(245, 158, 11, .20);

  --bg: #050507;
  --bg-deep: #050507;
  --bg-surface: #09090b;
  --bg-alt: #07080c;
  --bg-card: #18181b;
  --bg-elevated: #18181b;
  --bg-hover: #27272a;
  --bg-active: #27272a;

  --text: #e4e4e7;
  --text-secondary: #71717a;
  --text-muted: #52525b;
  --text-dim: #3f3f46;

  --border: #27272a;
  --border-light: rgba(255, 255, 255, .04);
  --border-hover: rgba(255, 255, 255, .10);

  --glass: #09090b;
  --glass-border: #27272a;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 8px;
  --radius-xl: 8px;

  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --shadow: 0 2px 12px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);

  --ease: cubic-bezier(.4,0,.2,1);
  --transition: .18s var(--ease);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-light); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.12); }

/* ==================== AUTH SCREENS ==================== */
.auth-container,
.login-overlay {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; background: var(--bg-surface);
}
.login-overlay { position: fixed; inset: 0; z-index: 9999; transition: opacity .4s; }
.login-overlay.hidden { opacity: 0; pointer-events: none; }

.auth-particles { display: none !important; }
.auth-glow { display: none !important; }

.auth-box,
.login-box {
  width: 400px; max-width: 92vw; padding: 36px 32px;
  background: var(--bg-surface); border: 1px solid rgba(255,255,255,.04);
  border-radius: 14px; position: relative; z-index: 1;
  opacity: 0; transform: translateY(12px);
  animation: authUp .45s cubic-bezier(.22,1,.36,1) .1s forwards;
  box-shadow: 0 16px 48px rgba(0,0,0,.3);
}
.auth-box::before,
.login-box::before {
  display: none;
}
@keyframes authUp { to { opacity: 1; transform: translateY(0); } }

.auth-icon {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  margin-bottom: 16px;
  background: rgba(99,102,241,.08); color: #818cf8;
  border: 1px solid rgba(99,102,241,.15);
}
.auth-icon svg { width: 22px; height: 22px; }
.auth-theme-customer .auth-icon { background: rgba(99,102,241,.08); color: #818cf8; }
.auth-theme-reseller .auth-icon { background: rgba(99,102,241,.08); color: #818cf8; }
.auth-theme-admin .auth-icon { background: rgba(99,102,241,.08); color: #818cf8; }

.auth-logo {
  font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 4px; color: #e4e4e7;
}
.auth-sub,
.login-sub { color: #52525b; font-size: 13px; margin-bottom: 24px; font-weight: 400; }

.auth-box .form-group { margin-bottom: 14px; }
.auth-box label,
.auth-box .form-group label {
  display: block; font-size: 12px; font-weight: 500; color: #71717a;
  margin-bottom: 6px;
}
.auth-box input {
  width: 100%; padding: 10px 12px;
  background: #18181b; border: 1px solid #27272a;
  border-radius: 8px; color: #e4e4e7; font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-box input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.auth-box input::placeholder { color: #3f3f46; }
.auth-box .g-recaptcha,
.auth-box .captcha-widget { margin: 12px 0 4px; }
.auth-box .btn-primary,
.login-box .btn-primary {
  width: 100%; padding: 10px; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  background: #6366f1;
  transition: all .15s; margin-top: 6px;
}
.auth-box .btn-primary:hover,
.login-box .btn-primary:hover { background: #818cf8; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.auth-theme-customer .btn-primary { background: #6366f1; }
.auth-theme-customer .btn-primary:hover { background: #818cf8; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.auth-theme-reseller .btn-primary { background: #6366f1; }
.auth-theme-reseller .btn-primary:hover { background: #818cf8; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.auth-theme-admin .btn-primary,
.auth-theme-admin .login-btn { background: #6366f1; color: #fff; }
.auth-theme-admin .btn-primary:hover,
.auth-theme-admin .login-btn:hover { background: #818cf8; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.auth-box .btn-primary:active { transform: scale(.98); }
.auth-box .error-msg {
  background: rgba(239,68,68,.08); color: #ef4444; padding: 8px 12px; border-radius: 6px;
  font-size: 12px; margin-bottom: 12px; display: none; border: 1px solid rgba(239,68,68,.15);
}

.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: #52525b; }
.auth-switch a { font-weight: 600; color: #818cf8; }
.auth-switch a:hover { color: #a5b4fc; }
.auth-back,
.auth-footer { text-align: center; margin-top: 14px; }
.auth-back a,
.auth-footer a { color: #3f3f46; font-size: 12px; text-decoration: none; transition: color .15s; }
.auth-back a:hover,
.auth-footer a:hover { color: #71717a; }

.login-input {
  width: 100%; text-align: center; font-family: var(--mono);
  font-size: 13px; letter-spacing: 2px; padding: 10px 14px;
  background: #18181b; border: 1px solid #27272a; border-radius: 8px;
  color: #e4e4e7; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.login-input::placeholder { color: #3f3f46; }
.login-box .g-recaptcha,
.login-box .captcha-widget { margin: 12px 0 4px; }
.login-btn {
  width: 100%; margin-top: 10px; padding: 10px;
  font-size: 13px; font-weight: 600; border-radius: 8px;
  border: none; cursor: pointer; background: #6366f1; color: #fff;
  transition: all .15s;
}
.login-btn:hover { background: #818cf8; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.login-btn:active { transform: scale(.98); }
.login-error { color: #ef4444; font-size: 12px; margin-top: 12px; min-height: 16px; }

/* ==================== APP LAYOUT ==================== */
.app { display: none; min-height: 100vh; background: #050507; position: relative; }
.app.visible { display: flex; flex-direction: column; }
.app > canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 48px;
  background: #09090b;
  border-bottom: 1px solid #27272a;
  position: sticky; top: 0; z-index: 100;
  position: relative;
}
.topbar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 40%, #06b6d4 70%, transparent 100%);
  opacity: .8;
}
.topbar::after {
  display: none;
}
.topbar .brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: -.02em;
  color: var(--text);
}
.topbar .brand svg { opacity: .5; }
.topbar .user-info,
.topbar .right { display: flex; align-items: center; gap: 10px; }
.topbar .user-info .username,
.topbar .user { font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.topbar .balance {
  padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 700;
  background: var(--success-dim); color: var(--success-light); border: 1px solid var(--success-border);
}
.topbar .btn-logout {
  padding: 5px 12px; background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted); font-size: 12px;
  font-weight: 600; font-family: inherit; cursor: pointer; transition: all .18s;
}
.topbar .btn-logout:hover { border-color: var(--danger-border); color: var(--danger); background: var(--danger-dim); }

/* ==================== NAV TABS (customer portal) ==================== */
.nav-tabs {
  display: flex; gap: 4px; padding: 8px 16px;
  background: #09090b; border-bottom: 1px solid #27272a;
  position: relative; z-index: 50;
}
.nav-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-radius: 20px; transition: color .18s, background .18s;
  user-select: none; display: flex; align-items: center; gap: 6px;
  border: none; background: none; position: relative;
}
.nav-tab::after {
  display: none;
}
.nav-tab svg { opacity: .35; flex-shrink: 0; width: 14px; height: 14px; transition: opacity .18s; }
.nav-tab.active svg { opacity: .9; }
.nav-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,.04); }
.nav-tab.active {
  color: #fff; background: var(--primary); font-weight: 600;
}

/* ==================== PILL TABS (reseller panel) ==================== */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  padding: 7px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-radius: 20px; border: 1px solid transparent;
  transition: all var(--transition); user-select: none;
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.active { color: #fff; background: var(--primary); border-color: transparent; font-weight: 600; }

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; font-size: 10px; font-weight: 700;
  background: var(--primary); color: #fff; line-height: 1;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  flex: 1; padding: 20px 24px; max-width: 1200px; margin: 0 auto; width: 100%;
  position: relative; z-index: 1;
}
.main { flex: 1; max-width: 920px; margin: 0 auto; width: 100%; padding: 20px 24px; position: relative; z-index: 1; }

.view { display: none; animation: viewFade .2s var(--ease); }
.view.active { display: block; }
@keyframes viewFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.section-title, .sec-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.02em; color: var(--text); }
.summary, .sec-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; color: var(--text); letter-spacing: -.02em; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-secondary); padding: 6px 14px; border-radius: 8px;
  cursor: pointer; font-weight: 600; font-size: 12px; font-family: var(--font);
  transition: all var(--transition); white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-hover); }
.btn:active { transform: scale(.97); }

.btn-primary { background: #6366f1; color: #fff; border-color: transparent; }
.btn-primary:hover { background: #818cf8; box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--border-hover); }

.btn-danger { border-color: var(--danger-border); background: var(--danger-dim); color: var(--danger-light); }
.btn-danger:hover { background: rgba(239,68,68,.16); }
.btn-success { border-color: var(--success-border); background: var(--success-dim); color: var(--success-light); }
.btn-success:hover { background: rgba(16,185,129,.16); }
.btn-warn { border-color: var(--warn-border); background: var(--warn-dim); color: var(--warn-light); }
.btn-warn:hover { background: rgba(245,158,11,.16); }

.btn-extend { background: var(--primary-dim); color: var(--primary-light); border: 1px solid var(--primary-border); }
.btn-extend:hover { background: rgba(99,102,241,.16); }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 16px; padding: 4px 6px; border-radius: var(--radius-sm); transition: all var(--transition); }
.btn-icon:hover { color: var(--primary-light); background: var(--primary-dim); }
.btn-small { background: var(--primary-dim); color: var(--primary-light); border: 1px solid var(--primary-border); padding: 4px 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all var(--transition); }
.btn-small:hover { background: rgba(99,102,241,.18); }
.btn-accent-small { background: rgba(130,80,255,.12); color: rgb(170,140,255); border-color: rgba(130,80,255,.3); }
.btn-accent-small:hover { background: rgba(130,80,255,.22); }

.abtn {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary); transition: all var(--transition); white-space: nowrap;
}
.abtn:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text); }
.abtn-danger { border-color: var(--danger-border); color: var(--danger-light); background: var(--danger-dim); }
.abtn-danger:hover { background: rgba(239,68,68,.16); }
.abtn-warn { border-color: var(--warn-border); color: var(--warn-light); background: var(--warn-dim); }
.abtn-warn:hover { background: rgba(245,158,11,.16); }
.abtn-green { border-color: var(--success-border); color: var(--success-light); background: var(--success-dim); }
.abtn-green:hover { background: rgba(16,185,129,.16); }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px; letter-spacing: .03em;
}
.form-input {
  width: 100%; padding: 10px 12px; background: #18181b;
  color: #e4e4e7; border: 1px solid #27272a;
  border-radius: 8px; font-size: 13px; font-family: var(--font);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-input::placeholder { color: #3f3f46; }
.form-input:hover:not(:focus) { border-color: rgba(255,255,255,.1); }

/* ==================== TABLE ==================== */
.table-wrap {
  background: var(--bg-card); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-surface); position: sticky; top: 0; z-index: 10; }
th {
  padding: 10px 14px; text-align: left; font-weight: 600; font-size: 10px;
  letter-spacing: .8px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 14px; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
tbody tr { transition: background-color var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.success { border-left: 3px solid var(--success); }
tbody tr.fail { border-left: 3px solid var(--danger); }
tbody tr.paused { border-left: 3px solid var(--warn); }
tbody tr.active { border-left: 3px solid var(--success); }
tbody tr.expired { border-left: 3px solid var(--danger); }

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: var(--radius-sm); font-size: 10px; font-weight: 700;
  letter-spacing: .4px;
}
.badge-success { background: var(--success-dim); color: var(--success-light); border: 1px solid var(--success-border); }
.badge-danger, .badge-red { background: var(--danger-dim); color: var(--danger-light); border: 1px solid var(--danger-border); }
.badge-warn, .badge-warning { background: var(--warn-dim); color: var(--warn-light); border: 1px solid var(--warn-border); }
.badge-info, .badge-purple { background: var(--primary-dim); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-green { background: var(--success-dim); color: var(--success-light); border: 1px solid var(--success-border); }
.badge-muted { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border); }
.badge-test { background: var(--primary-dim); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-media { background: rgba(139,92,246,.10); color: var(--accent-light); border: 1px solid rgba(139,92,246,.25); }

.key-cell {
  font-family: var(--mono); font-size: 11px; background: var(--primary-dim);
  padding: 3px 7px; border-radius: var(--radius-sm); word-break: break-all; border: 1px solid var(--primary-border);
  color: var(--primary-light);
}
.hwid-cell {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  cursor: pointer; transition: color var(--transition);
}
.hwid-cell:hover { color: var(--primary-light); }

.mono { font-family: var(--mono); }
.highlight { background: rgba(245,158,11,.12); padding: 2px 4px; border-radius: 3px; }

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: none; align-items: center; justify-content: center;
  padding: 20px; z-index: 1000;
}
.modal-overlay.open { display: flex; animation: modalBgIn .15s ease; }
@keyframes modalBgIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(600px, 95vw); max-height: 85vh;
  background: #18181b; border: 1px solid #27272a;
  border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow-lg); animation: modalIn .2s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: #09090b; border-bottom: 1px solid #27272a;
}
.modal .modal-header h2 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.modal .modal-close, .modal .btn-close {
  background: none; border: none; color: var(--text-muted); font-size: 18px;
  cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); transition: all .18s; line-height: 1;
}
.modal .modal-close:hover, .modal .btn-close:hover { background: var(--bg-hover); color: var(--text); }
.modal .modal-body { padding: 20px; overflow-y: auto; max-height: calc(85vh - 56px); }

.modal h2 { font-size: 15px; font-weight: 700; margin-bottom: 16px; letter-spacing: -.02em; }
.modal .form-group { margin-bottom: 12px; }
.modal label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; letter-spacing: .03em; }
.modal input, .modal select {
  width: 100%; padding: 9px 12px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.modal input:focus, .modal select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-dim); }
.modal input::placeholder { color: var(--text-dim); }
.modal .btn-primary { width: 100%; padding: 11px; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; margin-top: 8px; }
.modal .btn-close { position: absolute; top: 14px; right: 14px; }

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 10px 14px; border-radius: 8px; font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.22,1,.36,1);
  display: flex; align-items: center; gap: 8px; max-width: 320px;
  border: 1px solid #27272a; border-left: 2px solid transparent;
  background: #18181b;
}
.toast-success { border-left-color: var(--success); color: var(--success-light); }
.toast-error { border-left-color: var(--danger); color: var(--danger-light); }
.toast-info { border-left-color: var(--primary); color: var(--primary-light); }
.toast-warn { border-left-color: var(--warn); color: var(--warn-light); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.fade-out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(120%); opacity: 0; } }

/* ==================== EMPTY STATE ==================== */
.empty-state, .empty { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 13px; }
.empty-state svg { margin-bottom: 12px; opacity: .2; color: var(--primary-light); }
.empty-state h3 { font-size: 15px; margin-bottom: 4px; color: var(--text-secondary); font-weight: 700; }
.empty-state p { font-size: 13px; color: var(--text-muted); line-height: 1.5; max-width: 320px; margin: 0 auto; }
.no-data { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }

/* ==================== HISTORY / KV ==================== */
.history-item {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  margin-bottom: 6px; background: var(--bg-card); transition: border-color var(--transition);
}
.history-item:hover { border-color: var(--border-hover); }
.history-item:last-child { margin-bottom: 0; }
.history-top { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-muted); font-size: 12px; margin-bottom: 8px; align-items: center; }
.history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.history-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.kv { display: flex; gap: 6px; align-items: baseline; }
.k { color: var(--text-muted); min-width: 52px; font-size: 10px; font-weight: 600; letter-spacing: .3px; }
.v { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kd { display: flex; flex-direction: column; gap: 1px; }
.kd-label { font-size: 10px; font-weight: 600; letter-spacing: .4px; color: var(--text-muted); }
.kd-val { font-size: 13px; color: var(--text); font-weight: 500; }
.action-group { display: flex; gap: 4px; flex-wrap: wrap; }

/* ==================== SEARCH INPUT ==================== */
.search-input-wrap {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card);
  flex: 1; min-width: 160px; max-width: 380px; transition: border-color .18s;
}
.search-input-wrap:focus-within { border-color: var(--primary); }
.search-input-wrap svg { flex-shrink: 0; color: var(--text-muted); }
.search-input-wrap input {
  background: none; border: none; outline: none; color: var(--text);
  font-family: inherit; font-size: 13px; width: 100%;
}
.search-input-wrap input::placeholder { color: var(--text-dim); }

/* ==================== FILTER TABS ==================== */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; font-family: inherit; transition: all .18s;
}
.filter-tab:hover { background: var(--bg-hover); color: var(--text-secondary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: transparent; }

/* ==================== KEY CARDS ==================== */
.key-cards { display: flex; flex-direction: column; gap: 8px; }
.key-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; transition: border-color .18s, box-shadow .18s;
}
.key-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow); }
.key-card.unused { border-left: 3px solid var(--success); }
.key-card.used { border-left: 3px solid var(--primary-light); }
.key-card.paused { border-left: 3px solid var(--warn); }
.key-card.expired { border-left: 3px solid var(--text-muted); }
.key-card.banned { border-left: 3px solid var(--danger); }
.key-card.deleted { border-left: 3px solid var(--border); opacity: .7; }
.key-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.key-card-key {
  font-family: var(--mono); font-size: 13px; color: var(--primary-light); cursor: pointer;
  word-break: break-all; transition: color .15s;
}
.key-card-key:hover { color: var(--text); }
.key-card-details { margin-bottom: 10px; }
.key-card-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px 14px; margin-bottom: 6px;
}
.key-card-bl {
  margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--danger-dim); border: 1px solid var(--danger-border);
  font-size: 12px; font-weight: 600; color: var(--danger-light);
}
.key-card-actions {
  display: flex; gap: 5px; flex-wrap: wrap; padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ==================== CHART ==================== */
.chart-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; position: relative;
}
.chart-wrap canvas { max-height: 260px; }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.chart-title { font-size: 14px; font-weight: 700; color: var(--text); }
.chart-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 130px; }
.chart-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.chart-bar-stack { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; height: 100px; gap: 2px; }
.chart-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .5s var(--ease); }
.chart-bar.success { background: linear-gradient(180deg, var(--success), rgba(16,185,129,.4)); }
.chart-bar.fail { background: linear-gradient(180deg, var(--danger), rgba(239,68,68,.4)); border-radius: 0 0 3px 3px; }
.chart-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.chart-count { font-size: 10px; color: var(--text-secondary); font-weight: 700; }
.chart-legend { display: flex; gap: 20px; margin-top: 14px; justify-content: center; }
.chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.chart-legend-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ==================== RANGE PILLS ==================== */
.range-pills { display: flex; gap: 3px; }
.range-pill {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; font-family: var(--font); transition: all .18s;
}
.range-pill:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.range-pill.active { background: var(--primary); color: #fff; border-color: transparent; }

/* ==================== STAT GRID ==================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
  transition: all .2s var(--ease);
}
.stat-box:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-label { font-size: 10px; color: var(--text-muted); letter-spacing: .4px; margin-bottom: 4px; font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius); padding: 14px 16px; transition: all .2s var(--ease);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.03em; line-height: 1.1; }
.stat-card .stat-label { font-size: 10px; color: var(--text-muted); letter-spacing: .8px; margin-top: 3px; font-weight: 600; }

/* ==================== CREATE FORM ==================== */
.create-form {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.create-form .form-row { display: flex; gap: 10px; margin-bottom: 12px; }
.create-form .form-group { flex: 1; }
.create-form label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: .03em; }
.create-form select, .create-form input {
  width: 100%; padding: 9px 10px; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.create-form select option { background: var(--bg-card); color: var(--text); }
.create-form select:focus, .create-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-dim); }
.create-form .price-display {
  padding: 12px 14px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 700; text-align: center; margin-bottom: 12px; color: var(--text-muted);
  border-left: 3px solid var(--primary);
}
.create-form .price-display .amount { color: var(--primary-light); font-size: 22px; }
.create-form .btn-create {
  width: 100%; padding: 11px; background: var(--primary); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .18s;
}
.create-form .btn-create:hover { background: var(--primary-hover); box-shadow: 0 4px 16px rgba(99,102,241,.25); }
.create-form .btn-create:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }

/* ==================== KEY RESULT ==================== */
.key-result {
  margin-top: 14px; padding: 14px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 8px; display: none;
}
.key-result.show { display: block; animation: viewFade .2s var(--ease); }
#keyValues { display: flex; flex-direction: column; gap: 5px; }
.key-result .key-value {
  font-family: var(--mono); font-size: 13px; color: var(--primary-light);
  word-break: break-all; cursor: pointer; padding: 8px 12px;
  background: var(--primary-dim); border: 1px solid var(--primary-border); border-radius: 8px;
  text-align: center; transition: background .15s;
}
.key-result .key-value:hover { background: rgba(99,102,241,.16); }
.key-result .key-meta { text-align: center; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.btn-copy-all {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
  padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border);
  cursor: pointer; font-family: inherit; transition: all .18s;
}
.btn-copy-all:hover { background: var(--primary-dim); border-color: var(--primary-border); color: var(--primary-light); }

/* ==================== KEY TYPE SELECTOR ==================== */
.key-type-option {
  flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all .18s;
}
.key-type-option:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.key-type-option.active { background: var(--primary-dim); border-color: var(--primary-border); }
.kt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kt-color, var(--success)); flex-shrink: 0; box-shadow: 0 0 6px var(--kt-color, var(--success)); }
.kt-title { font-size: 13px; font-weight: 600; color: var(--text); }
.kt-desc { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* ==================== CUSTOM PRODUCT DROPDOWN ==================== */
.custom-dropdown { position: relative; }
.cd-selected {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 9px 10px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; cursor: pointer;
  transition: border-color .18s;
}
.cd-selected:hover { border-color: var(--border-hover); }
.custom-dropdown.open .cd-selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-dim); }
.cd-selected svg { margin-left: auto; color: var(--text-muted); flex-shrink: 0; }
.cd-placeholder { color: var(--text-dim); }
.cd-options {
  display: none; position: absolute; top: calc(100% + 3px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  max-height: 200px; overflow-y: auto; z-index: 50; box-shadow: var(--shadow-lg);
}
.custom-dropdown.open .cd-options { display: block; animation: viewFade .12s ease; }
.cd-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; transition: background .15s;
  font-size: 13px; color: var(--text);
}
.cd-option:hover { background: var(--bg-hover); }
.cd-icon { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.cd-icon-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px;
  background: var(--primary-dim); border: 1px solid var(--primary-border);
  font-size: 10px; font-weight: 700; color: var(--primary-light); flex-shrink: 0;
}
.cd-opt-text { flex: 1; }

/* ==================== PASSWORD GROUP ==================== */
.pw-group { display: flex; align-items: center; gap: 5px; }
.pw-dots { font-family: var(--mono); font-size: 12px; letter-spacing: 1px; color: var(--text-muted); }
.pw-btn {
  padding: 3px 8px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600;
  font-family: var(--font); cursor: pointer; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary); transition: all .15s;
}
.pw-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text); }

/* ==================== VIEW TABS (admin) ==================== */
.view-tabs { display: flex; gap: 3px; margin-bottom: 20px; }
.view-tab {
  padding: 6px 16px; font-size: 12px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-radius: 20px; transition: all .18s;
  font-family: var(--font); background: none; border: 1px solid transparent;
}
.view-tab:hover { color: var(--text-secondary); background: var(--bg-hover); }
.view-tab.active { color: #fff; background: var(--primary); border-color: transparent; font-weight: 600; }
.sub-view { display: none; }
.sub-view.active { display: block; }

/* ==================== INFO BANNER ==================== */
.info-banner {
  background: var(--primary-dim); border: 1px solid var(--primary-border);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px;
  font-size: 13px; color: var(--text-secondary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; height: 44px; }
  .topbar .brand { font-size: 14px; }
  .topbar .user-info, .topbar .right { gap: 6px; }
  .topbar .balance { font-size: 12px; padding: 3px 8px; }
  .nav-tabs { padding: 6px 12px; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab { padding: 6px 12px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
  .main-content { padding: 16px 12px; }
  .main { padding: 16px 12px; }
  .tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 5px 12px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .sec-title { font-size: 16px; }
  .create-form .form-row { flex-direction: column; }
  .create-form { padding: 14px; }
  .key-card { padding: 12px; }
  .key-card-row { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 95vw; }
  .modal-body { padding: 16px; }
  .auth-box, .login-box { width: 95vw; max-width: 95vw; padding: 28px 20px; }
  .auth-glow-1, .auth-glow-2 { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .search-input-wrap { max-width: 100%; }
  .toast-container { right: 8px; left: 8px; }
  .toast { max-width: 100%; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 8px; }
  .topbar .brand { font-size: 13px; }
  .topbar .btn-logout { font-size: 11px; padding: 4px 8px; }
  .auth-box, .login-box { padding: 24px 16px; }
  .main-content, .main { padding: 12px 8px; }
  .key-card-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .key-card-row { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; gap: 8px; }
}
