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

:root {
  --bg: #0d0b1a;
  --bg-2: #16132b;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f0ff;
  --muted: #9b96c2;
  --accent: #7c5cff;
  --accent-2: #38e4ff;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 16px;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 80% -10%, rgba(124, 92, 255, 0.18), transparent),
    radial-gradient(900px 500px at 0% 110%, rgba(56, 228, 255, 0.1), transparent);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100vh;
  width: 100%;
}

.hidden { display: none !important; }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(13, 11, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand .logo {
  width: 34px;
  height: 34px;
  color: var(--accent);
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand .logo svg,
.nav-icon svg,
.auth-icon svg,
.balance-emoji svg,
.success-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tariff-emoji {
  width: 34px;
  height: 34px;
  display: inline-block;
}

.tariff-emoji svg { width: 34px; height: 34px; color: var(--accent); }

.tv { width: 1em; height: 1em; margin-right: 3px; color: var(--muted); }

.ti { color: var(--accent); }
.ti svg { width: 34px; height: 34px; }

.ps { color: var(--yellow); }
.ps svg { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }

.btn-ic { margin-right: 4px; }
.btn-ic svg { width: 1em; height: 1em; }

.m-ic, .iv, .sm-ic { vertical-align: -0.18em; }
.m-ic svg { width: 1em; height: 1em; }
.iv svg { width: 0.95em; height: 0.95em; vertical-align: -0.15em; margin-right: 2px; color: var(--muted); }
.sm-ic svg { width: 0.85em; height: 0.85em; vertical-align: -0.12em; color: var(--yellow); }

.balance-emoji {
  width: 52px;
  height: 52px;
  color: var(--yellow);
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  background: rgba(52, 211, 153, 0.14);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
}

.user-name { font-weight: 600; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.15s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-primary {
  background: linear-gradient(90deg, var(--accent), #9c7cff);
  border: none;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: 0.15s;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-block { display: block; width: 100%; margin-top: 10px; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 110px;
}

.view { padding-top: 8px; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--yellow);
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
}

.balance-pill svg { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }

.section-head { margin-bottom: 20px; }

.section-head h1 {
  font-size: 28px;
  letter-spacing: 0.3px;
}

.muted { color: var(--muted); }

.small { font-size: 13px; }

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 13px;
}

.auth-card {
  max-width: 440px;
  margin: 40px auto;
  text-align: center;
  padding: 36px 28px;
}

.auth-icon { width: 42px; height: 42px; margin: 0 auto 12px; color: var(--accent); }

.auth-card h1 { font-size: 24px; margin-bottom: 10px; }

.auth-card p { margin-bottom: 16px; }

.auth-card input,
.modal input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
}

.auth-card input:focus { border-color: var(--accent); }

.error { color: var(--red); margin-top: 10px; font-size: 14px; }

.tariff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.tariff-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: 0.15s;
}

.tariff-card:hover { border-color: rgba(124, 92, 255, 0.5); }

.tariff-card.premium {
  border-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.06), transparent);
}

.tariff-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tariff-head .emoji { font-size: 30px; }

.tariff-head h3 { font-size: 19px; }

.tariff-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.tariff-desc { color: var(--muted); font-size: 13px; }

.keys-avail { font-size: 12px; color: var(--green); }

.device-options {
  display: flex;
  gap: 8px;
}

.device-option {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  transition: 0.15s;
}

.device-option.selected {
  background: rgba(124, 92, 255, 0.16);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.tariff-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.price-stars {
  font-size: 22px;
  font-weight: 700;
}

.price-stars small { color: var(--muted); font-weight: 400; font-size: 14px; }

.price-points { color: var(--muted); font-size: 13px; }

.tariff-card .btn-primary { margin-top: auto; }

.balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.2), rgba(56, 228, 255, 0.08));
  border: 1px solid rgba(124, 92, 255, 0.4);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.balance-amount {
  font-size: 36px;
  font-weight: 800;
  margin-top: 4px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.account-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sub-active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-active .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sub-active .row span:last-child { font-weight: 600; text-align: right; }

.key-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.key-box code {
  flex: 1;
  padding: 10px 12px;
  font-size: 12px;
  word-break: break-all;
  max-height: 72px;
  overflow: hidden;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 22px 10px;
  font-size: 14px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child { border-bottom: none; }

.list-item .left { display: flex; flex-direction: column; gap: 3px; }

.list-item .left small { color: var(--muted); }

.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.status.pending { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }

.status.paid { background: rgba(52, 211, 153, 0.14); color: var(--green); }

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  z-index: 20;
  display: flex;
  gap: 6px;
  background: rgba(22, 19, 43, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 22px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  transition: 0.15s;
}

.nav-item.active {
  background: rgba(124, 92, 255, 0.18);
  color: var(--text);
  font-weight: 600;
}

.nav-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal h2 { margin-bottom: 14px; }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.modal-body .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.modal-body .row span:last-child { font-weight: 600; }

.modal-actions { display: flex; flex-direction: column; gap: 8px; }

.success-icon { width: 46px; height: 46px; text-align: center; margin: 0 auto 6px; color: var(--green); }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 90px;
  z-index: 60;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 14px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(13, 11, 26, 0.6);
  backdrop-filter: blur(12px);
  padding: 16px 20px;
  position: relative;
  z-index: 10;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: 0.15s;
}

.footer-links a:hover { color: var(--text); }

.site-footer--nav-offset { padding-bottom: 96px; }

@media (max-width: 480px) {
  .tariff-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; }
}