:root {
  --bg: #0f1419;
  --card: #15202b;
  --border: #38444d;
  --text: #e7e9ea;
  --muted: #8b98a5;
  --accent: #1d9bf0;
  --ok: #00ba7c;
  --warn: #f59e0b;
  --vip: #a855f7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(29, 155, 240, 0.12), transparent);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { flex: 1; }

.site-footer {
  margin-top: auto;
  padding: 12px 20px 20px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.4;
}
.site-footer-meta { margin: 0; }
.site-footer-meta a {
  color: inherit;
  text-decoration: none;
}
.site-footer-meta a:hover { color: var(--accent); opacity: 1; }
.site-footer-sep { margin: 0 0.35em; opacity: 0.5; }

.legal-page {
  max-width: 720px;
  margin: 24px auto 40px;
  padding: 28px 24px;
}
.legal-back { margin: 0 0 16px; font-size: 0.9rem; }
.legal-page h1 { margin: 0 0 20px; font-size: 1.5rem; }
.legal-page h2 { margin: 20px 0 8px; font-size: 1rem; color: var(--muted); }
.legal-body { line-height: 1.6; color: var(--text); }
.legal-body p { margin: 0 0 12px; }
.legal-table {
  width: 100%;
  border-collapse: collapse;
}
.legal-table th,
.legal-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.legal-table th { width: 32%; font-weight: 500; color: var(--muted); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-name span,
.hero h1 span { color: var(--accent); }
.brand-logo, .hero-logo { object-fit: contain; }
.hero-logo { margin-bottom: 12px; }

.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a, .nav-links button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
}
.nav-links a.active, .nav-links button:hover { color: var(--text); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

h1, h2 { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 0.9rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

input, select, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: #3a1c1c; border: 1px solid #7f1d1d; }
.alert-ok { background: #143628; border: 1px solid #166534; }

.tariff-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.tariff-none { background: #38444d; }
.tariff-basic { background: #1e3a5f; color: #93c5fd; }
.tariff-premium { background: #14532d; color: #86efac; }
.tariff-vip { background: #4c1d95; color: #e9d5ff; }

.code-box {
  font-size: 2rem;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 500; }

.table-wrap { overflow-x: auto; }

.tariff-select { min-width: 120px; }

.hidden { display: none !important; }

.hero {
  text-align: center;
  padding: 48px 20px 32px;
}
.hero h1 { font-size: 2rem; margin-bottom: 8px; }
.hero-lead {
  font-size: 1.15rem;
  color: var(--text);
  margin: 0 0 10px;
  font-weight: 500;
}

.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.price-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background: var(--card);
}
.price-card h3 { margin-bottom: 8px; }
.price-tag { font-size: 1.5rem; font-weight: 700; color: var(--accent); margin: 8px 0; }
.buy-hint { font-size: 0.85rem; color: var(--muted); margin-top: 12px; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.narrow { max-width: 420px; margin: 40px auto; }
.full { width: 100%; }
.foot { margin-top: 16px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.span-2 { grid-column: 1 / -1; }
.small { font-size: 0.8rem; }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.sub-extend { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

.field-full { grid-column: 1 / -1; width: 100%; }
.vless-block { margin-top: 8px; }
.input-vless {
  width: 100%;
  min-height: 140px;
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.input-vless:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.25), 0 0 20px rgba(29, 155, 240, 0.15);
}
.input-vless::placeholder { color: var(--muted); opacity: 0.7; }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.btn, .nav-links a, .nav-links button, .brand {
  transition: color 0.2s, background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(29, 155, 240, 0.55), 0 4px 14px rgba(29, 155, 240, 0.35);
  transform: translateY(-1px);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(29, 155, 240, 0.2);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(0); }

.card-hover {
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.25s;
}
.card-hover:hover {
  border-color: rgba(29, 155, 240, 0.45);
  box-shadow: 0 0 28px rgba(29, 155, 240, 0.12);
}

.price-card.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(29, 155, 240, 0.18);
}

.glow-box {
  transition: box-shadow 0.3s;
}
.glow-box:hover {
  box-shadow: 0 0 24px rgba(29, 155, 240, 0.2);
}

.link-glow {
  transition: color 0.2s, text-shadow 0.25s;
}
.link-glow:hover {
  text-shadow: 0 0 12px rgba(29, 155, 240, 0.6);
}

.table-row-hover {
  transition: background 0.2s;
}
.table-row-hover:hover {
  background: rgba(29, 155, 240, 0.06);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.2);
}

#app.app-loading {
  opacity: 0.65;
  pointer-events: none;
  transition: opacity 0.2s;
}
#app.app-loading::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  box-shadow: 0 0 20px rgba(29, 155, 240, 0.4);
}
@keyframes spin { to { transform: rotate(360deg); } }

.topbar .brand:hover .brand-logo {
  filter: drop-shadow(0 0 8px rgba(29, 155, 240, 0.7));
  transition: filter 0.25s;
}
