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

/* ─── VARIABLES ─────────────────────────────────────────────────────────────── */
:root {
  --bg:        #0D0D0D;
  --bg2:       #111111;
  --surface:   #161616;
  --surface2:  #1C1C1C;
  --surface3:  #222222;
  --blue:      #3B82F6;
  --text:      #EBEBEB;
  --text-muted:#8A8A8A;
  --text-dim:  #444444;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.14);
  --r-sm:      8px;
  --r-md:      10px;
  --r-lg:      14px;
  --r-xl:      16px;
  --t:         0.15s ease;
}

/* ─── RESET ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; transition: opacity var(--t); }
a:hover { opacity: 0.8; }

/* ─── DEAD CLASSES (kept for HTML compat, render nothing) ──────────────────── */
.bg-grid, .bg-glow, .bg-glow-1, .bg-glow-2, .bg-glow-3 { display: none; }
.orb-wrap, .orb, .orb-ring, .orb-core { display: none !important; }
.gradient-text { color: var(--text); }

/* ─── AUTH LAYOUT ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

/* ─── CARD ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
}

/* ─── LOGO ───────────────────────────────────────────────────────────────────── */
.logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.logo-mark {
  width: 34px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 18px; height: 18px; }
.logo-info { display: flex; flex-direction: column; }
.logo-name { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.logo-sub  { font-size: 10px; color: var(--text-dim); letter-spacing: 0.3px; margin-top: 1px; }

/* ─── HEADINGS ───────────────────────────────────────────────────────────────── */
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 5px; }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }

/* ─── FORM ───────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-muted); margin-bottom: 5px;
}
.input-wrap { position: relative; }
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t);
}
.input::placeholder { color: var(--text-dim); }
.input:focus { border-color: var(--border2); }
.input-suffix {
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim); cursor: pointer;
  transition: color var(--t); line-height: 0;
}
.input-suffix:hover { color: var(--text-muted); }
.input-wrap .input { padding-right: 38px; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 18px;
  border-radius: var(--r-md); font-size: 14px; font-weight: 500;
  font-family: inherit; cursor: pointer; border: none; outline: none;
  transition: opacity var(--t), background var(--t); position: relative;
  user-select: none;
}
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:not(:disabled):hover { opacity: 0.9; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-secondary:not(:disabled):hover { border-color: var(--border2); color: var(--text); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:not(:disabled):hover { border-color: var(--border2); color: var(--text); }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.3);
  color: #F87171;
}
.btn-danger:not(:disabled):hover { background: rgba(239,68,68,0.06); }

.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: var(--r-sm); width: auto; }
.btn-xs { padding: 4px 9px;  font-size: 11px; border-radius: 6px;          width: auto; }

/* ─── CODE INPUT BOXES ───────────────────────────────────────────────────────── */
.code-row { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.code-cell {
  width: 48px; height: 58px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 22px; font-weight: 700;
  color: var(--text); text-align: center;
  outline: none; font-family: 'Inter', monospace;
  transition: border-color var(--t);
  caret-color: transparent;
}
.code-cell:focus  { border-color: var(--border2); }
.code-cell.filled { border-color: rgba(59,130,246,0.4); color: var(--blue); }
.code-cell.err    { border-color: rgba(239,68,68,0.4); color: #F87171; animation: shake .3s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%,75% { transform: translateX(-4px); }
  50%     { transform: translateX(4px); }
}

/* ─── ALERT ──────────────────────────────────────────────────────────────────── */
.alert {
  display: none; align-items: flex-start; gap: 8px;
  padding: 10px 13px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5; margin-bottom: 13px;
}
.alert.show { display: flex; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.alert-error   { background: rgba(239,68,68,0.06);  border: 1px solid rgba(239,68,68,0.18);  color: #FCA5A5; }
.alert-success { background: rgba(34,197,94,0.06);  border: 1px solid rgba(34,197,94,0.18);  color: #86EFAC; }
.alert-info    { background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.18); color: #93C5FD; }
.alert-warn    { background: rgba(234,179,8,0.06);  border: 1px solid rgba(234,179,8,0.18);  color: #FDE047; }

/* ─── SPINNER ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TOAST ──────────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: 290px;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 11px 14px;
  font-size: 13px; color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex; align-items: center; gap: 9px;
  pointer-events: auto;
  animation: toastIn .2s ease, toastOut .2s ease 2.8s forwards;
}
.toast-ok   { border-color: rgba(34,197,94,0.2); }
.toast-err  { border-color: rgba(239,68,68,0.2); }
.toast-info { border-color: rgba(59,130,246,0.2); }
@keyframes toastIn  { from { opacity:0; transform:translateX(10px); } to { opacity:1; transform:none; } }
@keyframes toastOut { to   { opacity:0; transform:translateX(10px); } }

/* ─── DIVIDER ────────────────────────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-dim); font-size: 11px; margin: 14px 0;
}
.divider::before,.divider::after { content:''; flex:1; height:1px; background:var(--border); }

/* ─── UTILS ──────────────────────────────────────────────────────────────────── */
.tc  { text-align: center; }
.mt2 { margin-top: 8px; }
.mt3 { margin-top: 12px; }
.mt4 { margin-top: 16px; }
.mt5 { margin-top: 20px; }
.sm  { font-size: 12px; }
.muted { color: var(--text-muted); }

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }


/* ════════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ════════════════════════════════════════════════════════════════════════════ */

.dash { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 60px; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0 18px;
}
.sidebar-logo {
  width: 34px; height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px; flex-shrink: 0;
}
.sidebar-logo svg { width: 18px; height: 18px; }

.nav-items { display: flex; flex-direction: column; gap: 2px; flex: 1; width: 100%; padding: 0 8px; }
.nav-btn {
  width: 100%; height: 42px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: pointer;
  border: none; background: transparent;
  transition: color var(--t), background var(--t); position: relative;
}
.nav-btn:hover { color: var(--text-muted); background: rgba(255,255,255,0.04); }
.nav-btn.on    { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-btn.on::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 16px; background: var(--blue); border-radius: 2px;
}

.nav-tip {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r-sm); padding: 5px 10px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  color: var(--text); pointer-events: none;
  opacity: 0; transform: translateY(-50%) translateX(-4px);
  transition: opacity .15s, transform .15s; z-index: 300;
}
.nav-btn:hover .nav-tip { opacity: 1; transform: translateY(-50%) translateX(0); }

.sidebar-foot { margin-top: auto; padding: 0 8px; width: 100%; display: flex; flex-direction: column; gap: 2px; }

/* ─── MAIN ───────────────────────────────────────────────────────────────────── */
.main { flex: 1; margin-left: 60px; padding: 28px 32px; max-width: calc(100vw - 60px); }

/* ─── PANEL ──────────────────────────────────────────────────────────────────── */
.panel { display: none; }
.panel.on { display: block; animation: fadeUp .2s ease-out; }
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ─── PAGE HEADER ────────────────────────────────────────────────────────────── */
.ph { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.ph-left h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.ph-left p  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.ph-right   { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── BLOCK ──────────────────────────────────────────────────────────────────── */
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
}
.block + .block, .block + .grid, .grid + .block { margin-top: 12px; }

/* ─── INFO GRID ──────────────────────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 10px; }

.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
}
.stat-label { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 8px; }
.stat-val   { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.blue   { color: var(--blue); }
.green  { color: #22C55E; }
.red    { color: #EF4444; }
.yellow { color: #EAB308; }
.white  { color: var(--text); }

/* ─── SUBSCRIPTION URL ───────────────────────────────────────────────────────── */
.url-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px;
}
.url-text {
  flex: 1; font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'SFMono-Regular','Consolas',monospace;
}
.copy-btn {
  flex-shrink: 0; width: 28px; height: 28px;
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); transition: border-color var(--t), color var(--t);
}
.copy-btn:hover { border-color: var(--border2); color: var(--text); }
.copy-btn svg   { width: 12px; height: 12px; }

/* ─── PLAN CARDS (VPN dashboard buy panel) ──────────────────────────────────── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(185px,1fr)); gap: 10px; }
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  cursor: pointer; transition: border-color var(--t);
  position: relative;
}
.plan-card:hover { border-color: var(--border2); }
.plan-card.hot   { border-color: rgba(59,130,246,0.35); }
.plan-badge {
  position: absolute; top: 12px; right: 12px;
  background: rgba(59,130,246,0.12); color: var(--blue);
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.plan-name  { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text-muted); }
.plan-price { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.plan-price sup { font-size: 14px; font-weight: 600; vertical-align: top; margin-top: 5px; display: inline-block; }
.plan-old   { font-size: 12px; color: var(--text-dim); text-decoration: line-through; margin-left: 5px; }
.plan-perks { margin-top: 12px; }
.plan-perk  { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; line-height: 1.9; }
.plan-perk::before { content:''; width:3px; height:3px; border-radius:50%; background:var(--text-dim); flex-shrink:0; }

/* ─── SECTION HEADER ─────────────────────────────────────────────────────────── */
.sh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sh-title { font-size: 13px; font-weight: 600; }

/* ─── LIST ITEMS ─────────────────────────────────────────────────────────────── */
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.list-row:last-child  { border-bottom: none; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }
.list-main  { font-size: 13px; font-weight: 500; }
.list-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.list-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge-green  { background: rgba(34,197,94,0.08);  border: 1px solid rgba(34,197,94,0.18);  color: #22C55E; }
.badge-blue   { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.18); color: var(--blue); }
.badge-red    { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.18);  color: #EF4444; }
.badge-yellow { background: rgba(234,179,8,0.08);  border: 1px solid rgba(234,179,8,0.18);  color: #EAB308; }
.badge-dim    { background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text-muted); }

.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: #22C55E; }
.dot-red    { background: #EF4444; }
.dot-yellow { background: #EAB308; }
.dot-blue   { background: var(--blue); }

/* ─── MODAL ──────────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500; display: none;
  align-items: center; justify-content: center; padding: 16px;
}
.overlay.on { display: flex; animation: fadeIn .15s ease; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  padding: 24px; width: 100%; max-width: 460px;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  animation: scaleIn .18s ease;
}
@keyframes scaleIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }
.modal-x {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px;
  background: transparent; border: none;
  border-radius: var(--r-sm);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t), color var(--t);
}
.modal-x:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.modal-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }

/* ─── TERMS ──────────────────────────────────────────────────────────────────── */
.terms-scroll {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
  max-height: 220px; overflow-y: auto;
  font-size: 12px; color: var(--text-muted); line-height: 1.7;
  margin-bottom: 12px;
}
.terms-scroll h5 { color: var(--text); font-size: 12px; margin: 10px 0 3px; font-weight: 600; }
.terms-scroll h5:first-child { margin-top: 0; }
.terms-check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  margin-bottom: 14px; user-select: none;
}
.terms-check input { accent-color: var(--blue); width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* ─── LOADER DOTS ────────────────────────────────────────────────────────────── */
.dots span {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; margin: 0 2px;
  animation: dotBounce 1.2s ease infinite;
}
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce {
  0%,100% { opacity: .35; }
  50%     { opacity: 1; }
}

/* ─── DEVICE WARN ────────────────────────────────────────────────────────────── */
.device-warn {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(239,68,68,0.05); border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--r-md); padding: 11px 13px;
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 14px;
}
.device-warn svg { color: #F87171; flex-shrink: 0; margin-top: 1px; }
.device-warn strong { color: var(--text); display: block; margin-bottom: 2px; }

/* ─── QR WRAP ────────────────────────────────────────────────────────────────── */
.qr-box {
  background: #fff; border-radius: var(--r-md);
  padding: 14px; display: flex;
  align-items: center; justify-content: center;
  margin: 0 auto;
}

/* ─── MONO CODE ──────────────────────────────────────────────────────────────── */
.mono-box {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 13px;
  font-family: 'SFMono-Regular','Consolas','Fira Code',monospace;
  font-size: 11px; color: var(--text-muted);
  word-break: break-all; line-height: 1.6;
}

/* ─── PROGRESS ───────────────────────────────────────────────────────────────── */
.progress { height: 2px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width .4s ease; }

/* ─── SKELETON ───────────────────────────────────────────────────────────────── */
.skel {
  background: var(--surface2);
  border-radius: 6px;
  animation: skelPulse 1.5s ease infinite;
}
@keyframes skelPulse { 0%,100% { opacity:.5; } 50% { opacity:1; } }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .main { padding: 16px 14px; }
  .ph { flex-direction: column; gap: 10px; }
  .plans-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .main { padding: 12px; }
  .sidebar { width: 52px; }
  .main { margin-left: 52px; max-width: calc(100vw - 52px); }
  .plans-grid { grid-template-columns: 1fr; }
  .grid-4,.grid-3 { grid-template-columns: 1fr 1fr; }
  .block { padding: 16px; }
  .modal { padding: 20px; }
  .code-row { gap: 6px; }
  .code-cell { width: 42px; height: 52px; font-size: 20px; }
}
@media (max-width: 380px) {
  .card { padding: 22px 16px; }
  .code-cell { width: 38px; height: 48px; font-size: 18px; }
  .grid-4,.grid-3,.grid-2 { grid-template-columns: 1fr; }
}
