:root {
  --bg: #0a0e16;
  --bg-alt: #0f1521;
  --surface: #131b2a;
  --surface-2: #182236;
  --border: #233048;
  --text: #e8edf6;
  --muted: #9aa8bd;
  --accent: #4f8cff;
  --accent-2: #38d39f;
  --accent-strong: #2f6ff0;
  --radius: 16px;
  --maxw: 1080px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

code {
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(79, 140, 255, 0.12);
  color: #cfe0ff;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(10, 14, 22, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand-mark {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark path:first-child {
  fill: rgba(79, 140, 255, 0.12);
}

.brand-mark-inner {
  stroke: var(--accent-2);
}

.topnav {
  display: flex;
  gap: 22px;
  font-size: 0.95rem;
}

.topnav a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.topnav a:hover {
  color: var(--text);
}

/* Hero */
.hero {
  padding: 80px 24px 64px;
  background:
    radial-gradient(1100px 480px at 70% -10%, rgba(79, 140, 255, 0.18), transparent 60%),
    radial-gradient(800px 400px at 10% 10%, rgba(56, 211, 159, 0.1), transparent 55%);
}

.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
}

.pill {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 22px 0 18px;
  max-width: 16ch;
  letter-spacing: -0.02em;
}

.lead {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 32px;
}

.lead strong {
  color: var(--text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex: none;
}

.btn span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.btn small {
  font-weight: 500;
  font-size: 0.78rem;
  opacity: 0.8;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5d97ff, var(--accent-strong));
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.btn-sm {
  padding: 9px 16px;
  font-size: 0.92rem;
  border-radius: 10px;
}

.topbar-cta {
  flex: none;
}

/* Sections — единый паттерн: секция во всю ширину, контент центрируется
   до --maxw. Так обычные и alt-секции выровнены идентично (как hero). */
.section {
  padding: 72px 24px;
}

.section > * {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  margin-bottom: 36px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.2;
  margin: 0 0 14px;
  max-width: 30ch;
  letter-spacing: -0.01em;
}

.section-lead {
  color: var(--muted);
  max-width: 68ch;
  margin: 0;
  font-size: 1.05rem;
}

/* Feature cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 30px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* Steps */
.steps {
  list-style: none;
  padding: 0;
  margin: 0 auto; /* left/right auto — иначе перекрывает центрирование .section > * */
  display: grid;
  gap: 18px;
}

.steps li {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.step-num {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.steps h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

/* On-prem */
.onprem-step {
  margin-bottom: 28px;
}

.onprem-step h3 {
  font-size: 1.15rem;
  margin: 0 0 10px;
}

.onprem-step p {
  margin: 8px 0;
}

.code {
  background: #0a1120;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 12px 0;
}

.code code {
  background: none;
  color: #aee0c8;
  padding: 0;
  white-space: pre;
}

.callout {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: rgba(79, 140, 255, 0.08);
  color: var(--text);
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 44px 24px;
  background: var(--bg-alt);
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

.footer-legal {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.footer-org {
  margin: 0 0 6px;
  color: var(--text);
  font-weight: 600;
}

.footer-contact {
  margin: 0 0 12px;
  color: var(--muted);
}

.footer-contact a {
  color: #c4cedd;
}

.footer-contact a:hover {
  color: var(--text);
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px 28px;
  margin: 0;
}

.legal-grid > div {
  display: flex;
  gap: 8px;
}

.legal-grid dt {
  flex: none;
  min-width: 118px;
  color: var(--muted);
}

.legal-grid dd {
  margin: 0;
  color: #c4cedd;
  word-break: break-word;
}

/* Legal / offer document */
.legal-doc {
  max-width: 860px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.65;
}

.legal-doc h3 {
  margin: 32px 0 10px;
  color: var(--text);
  font-size: 1.15rem;
}

.legal-doc p {
  margin: 0 0 14px;
}

.legal-doc ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.legal-doc li {
  margin: 0 0 8px;
}

.legal-doc a {
  color: #c4cedd;
  text-decoration: underline;
}

.legal-doc a:hover {
  color: var(--text);
}

.legal-doc strong {
  color: var(--text);
}

.legal-req {
  margin-top: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt, rgba(255, 255, 255, 0.02));
}

.legal-req .footer-org {
  font-size: 1rem;
}

.legal-req .legal-grid {
  margin-top: 12px;
}

.summary-offer {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.summary-offer a {
  color: #c4cedd;
  text-decoration: underline;
}

.summary-offer a:hover {
  color: var(--text);
}

/* Buy page */
.note-diff {
  margin-top: 22px;
  max-width: 68ch;
}

.section-wide > * {
  max-width: 1240px;
}

.buy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px 300px;
  gap: 28px;
  align-items: stretch;
}

/* Quantity cards */
.qty-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.qty-card:hover {
  border-color: rgba(79, 140, 255, 0.5);
}

.qty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 12px;
  background: rgba(79, 140, 255, 0.12);
  color: var(--accent);
}

.qty-icon svg {
  width: 24px;
  height: 24px;
}

.qty-text {
  flex: 1 1 auto;
  min-width: 0;
}

.qty-text h3 {
  margin: 0 0 2px;
  font-size: 1.08rem;
}

.qty-text p {
  margin: 0;
  font-size: 0.88rem;
}

.config-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

/* Единый заголовок всех трёх карточек */
.card-eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-title {
  margin: 0 0 18px;
  font-size: 1.2rem;
}

/* Stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.step-btn {
  width: 44px;
  height: 46px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.step-btn:hover {
  background: var(--accent-strong);
  color: #fff;
}

.step-btn:active {
  transform: translateY(1px);
}

.step-input {
  width: 76px;
  height: 46px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  -moz-appearance: textfield;
}

.step-input::-webkit-outer-spin-button,
.step-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.step-input:focus {
  outline: none;
}

/* Periods — 4 в ряд, только срок + скидка */
.period-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.period {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 80px;
  padding: 12px 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.period:hover {
  border-color: rgba(79, 140, 255, 0.55);
  transform: translateY(-2px);
}

.period.is-active {
  border-color: var(--accent);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(79, 140, 255, 0.18) 0%, rgba(79, 140, 255, 0) 60%),
    var(--surface);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 28px rgba(47, 111, 240, 0.22);
}

.period-name {
  font-weight: 700;
  font-size: 1rem;
}

.period-disc {
  font-size: 0.82rem;
  color: var(--muted);
}

.period.is-active .period-disc {
  color: var(--accent);
}

/* Payer */
.payer-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  margin-bottom: 18px;
}

.payer {
  padding: 10px 20px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.payer.is-active {
  background: var(--accent-strong);
  color: #fff;
}

.payer-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.payer-card .payer-switch {
  width: 100%;
}

.payer-card .payer {
  flex: 1 1 0;
}

.payer-fields {
  display: grid;
  gap: 14px;
  max-width: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.95rem;
  color: var(--muted);
}

.field input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}

/* Summary */
.buy-summary {
  position: static;
}

.summary-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
}

.summary-head {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.summary-eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-total {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-total strong {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.summary-total-sub {
  font-size: 0.92rem;
  color: var(--muted);
}

.summary-effective {
  margin: 8px 0 0;
  font-size: 0.88rem;
}

.summary-lines {
  list-style: none;
  margin: 18px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 11px;
}

.summary-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.summary-lines li span:last-child {
  color: var(--text);
  text-align: right;
}

.summary-sep {
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.summary-discount span:last-child {
  color: var(--accent-2) !important;
  font-weight: 600;
}

/* Расчёт может быть длинным (веб-линки, прорейт) — переносим на отдельную строку */
.summary-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.summary-stack span:last-child {
  text-align: left;
}

/* hidden-атрибут должен перебивать display:flex у строк сводки */
.summary-lines li[hidden] {
  display: none !important;
}

/* hidden для grid/flex-блоков продления */
.renew-lookup[hidden],
.renew-current[hidden] {
  display: none !important;
}

/* Вкладки «Покупка / Продление» */
.buy-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.buy-tab {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.buy-tab:hover {
  color: var(--text);
}

.buy-tab.is-active {
  background: var(--surface-2);
  color: var(--text);
}

/* Панель продления (ввод ключа + текущее состояние) */
.renew-lookup {
  margin: 0 0 22px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
}

.renew-lookup-head h3 {
  margin: 0 0 6px;
  font-size: 1.12rem;
}

.renew-lookup-head p {
  margin: 0 0 16px;
  max-width: 72ch;
}

.renew-key-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.renew-key-row input {
  flex: 1 1 280px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.98rem;
}

.renew-key-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.renew-key-row .btn {
  flex: none;
}

.renew-current {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.renew-cur-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.renew-cur-item span {
  font-size: 0.8rem;
  color: var(--muted);
}

.renew-cur-item strong {
  font-size: 1.05rem;
}

/* Конфигуратор заблокирован, пока ключ не проверен */
.buy-grid.is-locked {
  opacity: 0.5;
  pointer-events: none;
  filter: saturate(0.6);
}

/* Вторичная кнопка (Проверить) */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.summary-foot {
  margin-top: auto;
  padding-top: 20px;
}

.summary-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.84rem;
  color: var(--muted);
}

.lock-ico {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
  color: var(--accent-2);
}

.pay-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #5a2230;
  background: rgba(220, 80, 90, 0.12);
  color: #ffb4bd;
  font-size: 0.9rem;
}

.order-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 640px;
}

@media (max-width: 1080px) {
  .buy-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topnav {
    display: none;
  }
  .hero {
    padding: 56px 20px 48px;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  .qty-card {
    flex-wrap: wrap;
  }
  .qty-text {
    flex-basis: calc(100% - 64px);
  }
  .stepper {
    margin-left: 64px;
  }
  .period-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
