:root {
  --bg: #07111f;
  --panel: #0d1b32;
  --panel-2: #122443;
  --text: #eef4ff;
  --muted: #9fb0cf;
  --accent: #1f7aff;
  --success: #23c16b;
  --danger: #ef5350;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  --bottom-nav-h: 92px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #0e2345 0%, #08111f 40%, #050b14 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
  min-height: 100%;
}

body {
  overflow-x: hidden;
}

.page {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 54px)
    18px
    calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 18px);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.top-block {
  margin-top: 36px;
}

.top-block--home {
  margin-top: 44px;
}

.hello-title,
.section-page-title {
  font-size: 2rem;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}

.section-page-title--no-margin {
  margin-bottom: 0;
}

.stats-grid {
  display: grid;
  gap: 14px;
}

.stats-grid--home {
  grid-template-columns: 1fr;
}

.stat-card,
.limit-card,
.create-card,
.key-card,
.setup-wizard,
.subscription-card,
.app-card {
  background: linear-gradient(180deg, rgba(19, 38, 72, 0.96), rgba(12, 27, 52, 0.96));
  border: 1px solid rgba(93, 129, 197, 0.18);
  box-shadow: var(--shadow);
}

.stat-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 132px;
}

.stat-card__label,
.subscription-card__label,
.limit-card__label,
.field-label,
.setup-label,
.create-card__subtitle,
.stat-card__hint,
.key-card__date,
.section-meta {
  color: var(--muted);
}

.stat-card__label,
.subscription-card__label {
  font-size: 0.98rem;
  margin-bottom: 10px;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.stat-card__hint {
  margin-top: 10px;
  font-size: 0.98rem;
  line-height: 1.35;
}

.limit-card {
  margin-top: 14px;
  border-radius: 24px;
  padding: 18px;
}

.limit-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.limit-card__percent {
  color: #dce8ff;
  font-weight: 700;
}

.limit-progress {
  height: 14px;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.limit-progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3e8dff, #75a9ff);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.limit-card__summary {
  margin-top: 12px;
  color: #d5e4ff;
  font-size: 0.98rem;
}

.create-card {
  margin-top: 16px;
  border-radius: 26px;
  padding: 20px;
}

.create-card--keys {
  margin-top: 8px;
  margin-bottom: 14px;
}

.create-card__title {
  font-size: 1.12rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.create-box {
  margin-top: 14px;
}

.field-label,
.setup-label {
  display: block;
  font-size: 0.96rem;
  margin-bottom: 10px;
}

.text-input,
.setup-select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 18px;
  padding: 16px 18px;
  outline: none;
  font: inherit;
}

.text-input::placeholder {
  color: #8798b9;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.install-btn {
  border: 0;
  outline: none;
  cursor: pointer;
  font: inherit;
  border-radius: 20px;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.primary-btn[disabled],
.secondary-btn[disabled],
.install-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-btn {
  width: 100%;
  margin-top: 14px;
  padding: 17px 18px;
  background: linear-gradient(180deg, #6aa4ff, #4f88eb);
  color: white;
  font-weight: 800;
  font-size: 1.05rem;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.04);
  color: #eef4ff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 15px 16px;
  font-weight: 700;
}

.secondary-btn--soft {
  background: rgba(255, 255, 255, 0.03);
}

.secondary-btn--wide {
  width: 100%;
  border-radius: 22px;
  padding: 16px;
  font-size: 1.02rem;
}

.danger-btn {
  background: rgba(239, 83, 80, 0.12);
  color: #ffb4b2;
  border: 1px solid rgba(239, 83, 80, 0.24);
  padding: 15px 16px;
  font-weight: 700;
}

.danger-btn--full {
  width: 100%;
  margin-top: 12px;
}

.section-meta {
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.list-loader,
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
}

.hidden {
  display: none !important;
}

.keys-list {
  display: grid;
  gap: 14px;
}

.key-card {
  border-radius: 24px;
  padding: 18px;
}

.key-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.key-card__left {
  min-width: 0;
}

.key-card__badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(56, 112, 226, 0.18);
  color: #d8e6ff;
  font-weight: 800;
}

.key-card__date {
  margin-top: 10px;
  font-size: 0.93rem;
}

.key-card__traffic-badge {
  white-space: nowrap;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #dce8ff;
  font-weight: 700;
  font-size: 0.94rem;
}

.key-card__url {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  color: #cfe0ff;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-all;
}

.key-card__actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.setup-wizard {
  border-radius: 28px;
  padding: 18px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.wizard-step {
  text-align: center;
  opacity: 0.55;
}

.wizard-step.active,
.wizard-step.done {
  opacity: 1;
}

.wizard-step__circle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #d9e7ff;
  font-weight: 800;
  font-size: 1.05rem;
}

.wizard-step.active .wizard-step__circle {
  background: var(--accent);
  color: white;
}

.wizard-step.done .wizard-step__circle {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.wizard-step__text {
  font-size: 0.95rem;
  line-height: 1.25;
  color: #cdd9f3;
}

.wizard-screen {
  display: none;
}

.wizard-screen.active {
  display: block;
}

.wizard-title {
  font-size: 1.95rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
}

.setup-field--full {
  margin-bottom: 18px;
}

.select-wrap {
  position: relative;
}

.setup-select {
  appearance: none;
  padding-right: 54px;
}

.select-arrow {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  color: #aebfe0;
  pointer-events: none;
}

.select-arrow svg {
  width: 100%;
  height: 100%;
}

.app-card {
  border-radius: 26px;
  padding: 18px;
}

.app-card__top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-card__icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #005d46, #00392d);
  color: white;
  font-size: 1.8rem;
  font-weight: 800;
}

.app-card__title {
  font-size: 1.15rem;
  font-weight: 800;
}

.app-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #dbe8ff;
  font-size: 0.9rem;
  font-weight: 700;
}

.install-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 18px;
  padding: 18px;
  background: linear-gradient(90deg, #8f56eb, #a85aea);
  color: white;
  font-weight: 800;
  font-size: 1.04rem;
}

.install-btn--outline {
  margin-top: 12px;
}

.wizard-main-btn {
  margin-top: 22px;
}

.wizard-text {
  color: #d8e4fb;
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0 0 18px;
}

.wizard-text--secondary {
  color: #d3dff7;
  margin-top: 10px;
}

.wizard-separator {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 22px 0;
  color: #d6e3ff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.wizard-separator::before,
.wizard-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.wizard-list {
  margin: 18px 0 0;
  padding-left: 22px;
  color: #dce7fd;
  line-height: 1.55;
  font-size: 1rem;
}

.wizard-list li + li {
  margin-top: 8px;
}

.wizard-finish-text {
  color: #dde8ff;
  font-size: 1.05rem;
  line-height: 1.62;
}

.wizard-finish-text p {
  margin: 0 0 18px;
}

.subscription-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.subscription-badge {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 0.94rem;
  white-space: nowrap;
}

.subscription-badge--active {
  background: rgba(35, 193, 107, 0.18);
  color: #7cf0ac;
}

.subscription-badge--inactive {
  background: rgba(239, 83, 80, 0.16);
  color: #ffada9;
}

.subscription-grid {
  display: grid;
  gap: 12px;
}

.subscription-grid--new {
  grid-template-columns: 1fr;
}

.subscription-card {
  border-radius: 24px;
  padding: 18px;
}

.subscription-card__value {
  font-size: 1.12rem;
  font-weight: 800;
  color: #eef4ff;
  line-height: 1.35;
}

.subscription-buy-btn {
  margin-top: 16px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding:
    10px
    14px
    calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: rgba(5, 12, 22, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.bottom-nav__item {
  border: 0;
  background: transparent;
  color: #9cb0d3;
  border-radius: 18px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.bottom-nav__item.active {
  background: rgba(25, 49, 92, 0.92);
  color: white;
}

.bottom-nav__icon {
  width: 24px;
  height: 24px;
}

.bottom-nav__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav__label {
  font-size: 0.85rem;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
  transform: translateX(-50%);
  z-index: 200;
  min-width: 190px;
  max-width: calc(100vw - 28px);
  padding: 14px 18px;
  background: rgba(10, 16, 29, 0.95);
  color: white;
  border-radius: 18px;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(2, 5, 12, 0.62);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal__card {
  width: 100%;
  max-width: 560px;
  border-radius: 28px;
  padding: 22px;
  background: rgba(17, 23, 38, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.modal__text {
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.48;
  color: #f1f5ff;
  margin-bottom: 18px;
}

.modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal__btn {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 720px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hello-title,
  .section-page-title {
    font-size: 1.85rem;
  }

  .wizard-title {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .page {
    padding-top: calc(env(safe-area-inset-top, 0px) + 42px);
    padding-left: 12px;
    padding-right: 12px;
  }

  .top-block,
  .top-block--home {
    margin-top: 28px;
  }

  .hello-title,
  .section-page-title {
    font-size: 1.7rem;
  }

  .stat-card__value {
    font-size: 1.8rem;
  }

  .wizard-step__text {
    font-size: 0.88rem;
  }

  .wizard-title {
    font-size: 1.42rem;
  }

  .modal__actions {
    grid-template-columns: 1fr;
  }
}