/* ==========================================================================
   MKM Student · оплата — «посадочный талон» в той же системе, что mkmstudent.ru
   ========================================================================== */

:root {
  --ink: #0B1B3F;
  --ink-2: #13285A;
  --ink-3: #1D3672;
  --cobalt: #2442D6;
  --cobalt-soft: #7F95F0;
  --saffron: #F4B42A;
  --paper: #F3F5F8;
  --paper-2: #E7ECF4;
  --white: #FFFFFF;
  --slate: #4B5878;
  --line: #D3DBE8;
  --danger: #C2352B;
  --ok: #1E8A5A;
  --on-ink: #EEF2FA;
  --on-ink-muted: #9AABD0;
  --on-ink-line: rgba(238, 242, 250, .16);

  --f-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --radius: 22px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, dl, fieldset { margin: 0; }
ul, ol { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
a { color: var(--cobalt); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--saffron); color: var(--ink); }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); }

.wrap { width: 100%; max-width: calc(1200px + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--cobalt);
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }

/* --- Кнопки ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: 15.5px; text-decoration: none; cursor: pointer;
  transition: background .25s var(--ease), border-color .25s, color .25s, opacity .25s;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--cobalt); }
.btn-pay { background: var(--saffron); color: var(--ink); font-weight: 600; }
.btn-pay:hover { background: #FFC444; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); background: var(--white); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }

/* --- Шапка ------------------------------------------------------------- */

.p-head { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.55); }
.p-head-inner { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.logo-mark { font-family: var(--f-display); font-weight: 600; font-size: 24px; letter-spacing: -.06em; line-height: 1; }
.logo-mark i { font-style: normal; color: var(--saffron); }
.logo-sub {
  font-size: 10.5px; line-height: 1.25; text-transform: uppercase; letter-spacing: .08em;
  color: var(--slate); padding-left: 12px; border-left: 1px solid var(--line);
}
.p-head-exec { margin-left: auto; text-align: right; font-size: 13px; line-height: 1.35; color: var(--slate); }
.p-head-exec b { display: block; color: var(--ink); font-weight: 500; }

/* --- Hero оплаты ------------------------------------------------------- */

.p-hero {
  position: relative;
  padding: clamp(28px, 5vw, 56px) 0 clamp(20px, 3vw, 32px);
}
.p-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(to right, rgba(36, 66, 214, .07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(36, 66, 214, .07) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: linear-gradient(to bottom, #000, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
}
.p-title {
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(1.9rem, 4.6vw, 3.4rem); line-height: 1.04; letter-spacing: -.045em;
  margin: 16px 0 12px;
}
.p-lede { color: var(--slate); max-width: 56ch; }

/* Маршрут шагов */
.route {
  position: relative;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: clamp(24px, 4vw, 40px);
  counter-reset: stop;
}
.route::before { /* пунктир маршрута */
  content: ""; position: absolute; left: 10%; right: 10%; top: 17px;
  border-top: 1.5px dashed var(--cobalt-soft);
}
.route .route-fill {
  position: absolute; left: 10%; top: 16px; height: 3px;
  width: calc(80% * var(--progress, 0));
  background: var(--saffron); border-radius: 2px;
  transition: width .6s var(--ease);
}
.route li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.route button {
  position: relative; z-index: 1;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--cobalt-soft); background: var(--paper); color: var(--cobalt);
  font-family: var(--f-mono); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .3s, border-color .3s, color .3s, transform .3s var(--ease);
}
.route button:disabled { cursor: default; color: var(--cobalt-soft); }
.route span { font-size: 13px; color: var(--slate); }
.route li.is-done button { background: var(--cobalt); border-color: var(--cobalt); color: var(--white); }
.route li.is-current button { background: var(--saffron); border-color: var(--saffron); color: var(--ink); transform: scale(1.12); }
.route li.is-current span { color: var(--ink); font-weight: 500; }

/* --- Сетка: мастер + талон -------------------------------------------- */

.p-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
  padding-bottom: clamp(48px, 7vw, 96px);
}

.wizard {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 36px);
}
.step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.step-title { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.25rem, 2.2vw, 1.6rem); letter-spacing: -.035em; line-height: 1.15; }
.step-count { font-family: var(--f-mono); font-size: 12px; color: var(--slate); white-space: nowrap; }

.panel { animation: panelIn .45s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }

/* Тарифы */
.tariffs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tariff { position: relative; cursor: pointer; }
.tariff input { position: absolute; opacity: 0; inset: 0; }
.tariff-body {
  height: 100%;
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px;
  border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--paper);
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.tariff:hover .tariff-body { border-color: var(--cobalt-soft); }
.tariff input:checked + .tariff-body { border-color: var(--cobalt); background: var(--white); box-shadow: 0 0 0 3px rgba(36, 66, 214, .12); }
.tariff input:focus-visible + .tariff-body { outline: 2px solid var(--cobalt); outline-offset: 3px; }
.tariff-name { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; gap: 10px; }
.tariff-check {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--line); display: grid; place-items: center;
}
.tariff input:checked + .tariff-body .tariff-check { border-color: var(--cobalt); background: var(--cobalt); }
.tariff input:checked + .tariff-body .tariff-check::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--white); }
.tariff-price { font-family: var(--f-display); font-weight: 500; font-size: 1.7rem; letter-spacing: -.04em; line-height: 1; }
.tariff-price small { font-family: var(--f-body); font-size: 13px; letter-spacing: 0; color: var(--slate); font-weight: 400; }
.tariff ul { display: grid; gap: 6px; font-size: 14px; color: var(--slate); }
.tariff li { padding-left: 18px; position: relative; }
.tariff li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 1.5px; background: var(--cobalt); }
.tariff li.no::before { background: var(--line); }

.facts { display: grid; gap: 10px; margin-top: 20px; font-size: 14px; color: var(--slate); }
.facts p { padding: 14px 16px; border-radius: 12px; background: var(--paper); }
.facts b { color: var(--ink); font-weight: 500; }

/* Поля */
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field > span { font-size: 14px; font-weight: 500; }
.field small { font-size: 13px; color: var(--slate); }
.input, .select {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--white);
  font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(36, 66, 214, .14); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--slate) 50%), linear-gradient(135deg, var(--slate) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.field.has-error .input, .field.has-error .select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--line); border-radius: 999px; font-size: 15px; background: var(--white);
  transition: border-color .2s, background .2s, color .2s;
}
.chip input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--cobalt); outline-offset: 3px; }

.note { font-size: 13.5px; color: var(--slate); padding: 12px 14px; border-left: 2px solid var(--saffron); background: var(--paper); border-radius: 0 10px 10px 0; }

/* Согласия */
.check { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check:first-of-type { border-top: 1px solid var(--line); }
.check input {
  appearance: none; -webkit-appearance: none; margin: 1px 0 0;
  width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--slate); background: var(--white);
  display: grid; place-items: center; cursor: pointer; transition: background .2s, border-color .2s;
}
.check input:checked { background: var(--cobalt); border-color: var(--cobalt); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--white); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check .tag { display: inline-block; margin-left: 6px; font-size: 12px; color: var(--slate); }
.check .tag-req { color: var(--danger); }
.check.has-error input { border-color: var(--danger); }

/* Итог */
.review { display: grid; gap: 0; border-top: 1px solid var(--line); margin-bottom: 20px; }
.review div { display: grid; grid-template-columns: 11em 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.review dt { color: var(--slate); }
.review dd { margin: 0; overflow-wrap: anywhere; }
.pay-methods { font-size: 13.5px; color: var(--slate); margin: 14px 0 0; }
.form-error { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: #FCEDEB; color: var(--danger); font-size: 14.5px; }

.nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.nav-row .btn-primary, .nav-row .btn-pay { margin-left: auto; }

/* --- Посадочный талон --------------------------------------------------- */

.pass {
  position: sticky; top: 20px;
  color: var(--on-ink);
  filter: drop-shadow(0 30px 40px rgba(11, 27, 63, .28));
}
.pass-main, .pass-stub { background: var(--ink); }
.pass-main {
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 24px 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(36, 66, 214, .55), transparent 55%),
    var(--ink);
}
.pass-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pass-label { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-ink-muted); }
.pass-brand { font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: -.05em; }
.pass-brand i { font-style: normal; color: var(--saffron); }

.pass-route { display: flex; align-items: center; gap: 12px; margin: 22px 0 20px; }
.pass-city b { display: block; font-family: var(--f-display); font-weight: 600; font-size: 30px; letter-spacing: -.04em; line-height: 1; }
.pass-city small { font-size: 12px; color: var(--on-ink-muted); }
.pass-city:last-child { text-align: right; }
.pass-line { flex: 1; position: relative; height: 2px; border-top: 1.5px dashed var(--on-ink-line); }
.pass-plane {
  position: absolute; top: -9px; left: calc(var(--progress, 0) * (100% - 16px));
  width: 16px; height: 16px; color: var(--saffron);
  transition: left .6s var(--ease);
}

.pass-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.pass-fields div { min-width: 0; }
.pass-fields .wide { grid-column: 1 / -1; }
.pass-fields dt { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-ink-muted); margin-bottom: 3px; }
.pass-fields dd { margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.pass-fields dd.is-empty { color: rgba(238, 242, 250, .35); font-weight: 400; }
.pass-fields dd.flash { animation: flash .8s var(--ease); }
@keyframes flash { from { color: var(--saffron); } }

.pass-tear { /* линия отрыва */
  position: relative; height: 22px; background: var(--ink);
  -webkit-mask: radial-gradient(circle 11px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 11px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 11px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 11px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.pass-tear::after { content: ""; position: absolute; left: 18px; right: 18px; top: 50%; border-top: 1.5px dashed var(--on-ink-line); }

.pass-stub { border-radius: 0 0 var(--radius) var(--radius); padding: 16px 24px 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pass-amount { font-family: var(--f-display); font-weight: 500; font-size: 2rem; letter-spacing: -.045em; line-height: 1; }
.pass-amount.is-empty { color: rgba(238, 242, 250, .35); font-size: 1.1rem; letter-spacing: -.02em; }
.pass-stub small { display: block; font-size: 12px; color: var(--on-ink-muted); margin-top: 6px; }
.pass-barcode { width: 84px; height: 40px; flex: none; opacity: .9; }

.pass-after { margin-top: 18px; font-size: 13.5px; color: var(--slate); padding: 0 6px; }

/* --- Подвал ------------------------------------------------------------- */

.p-foot { background: var(--ink); color: var(--on-ink-muted); padding: clamp(40px, 6vw, 64px) 0 32px; font-size: 14px; }
.p-foot-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 28px 40px; }
.p-foot h2 { font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--saffron); margin-bottom: 12px; }
.p-foot p + p { margin-top: 6px; }
.p-foot b { color: var(--on-ink); font-weight: 500; }
.p-foot a { color: var(--on-ink); }
.p-foot a:hover { color: var(--saffron); }
.doc-links { display: grid; gap: 7px; }
.p-foot-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--on-ink-line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; }

/* --- Документы ---------------------------------------------------------- */

.doc { max-width: 820px; padding: clamp(32px, 5vw, 64px) var(--gutter) clamp(56px, 8vw, 96px); margin: 0 auto; }
.doc-back { display: inline-block; margin-bottom: 24px; font-size: 14px; }
.doc h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.6rem, 3.6vw, 2.4rem); line-height: 1.12; letter-spacing: -.04em; margin-bottom: 18px; }
.doc h2 { font-family: var(--f-display); font-weight: 500; font-size: 1.15rem; letter-spacing: -.025em; margin: 36px 0 12px; }
.doc p, .doc li { color: #2A3554; }
.doc p + p { margin-top: 12px; }
.doc ul { margin: 10px 0; display: grid; gap: 6px; }
.doc ul li { padding-left: 18px; position: relative; }
.doc ul li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 8px; height: 1.5px; background: var(--cobalt); }
.doc .draft { padding: 14px 16px; border-left: 3px solid var(--saffron); background: var(--white); border-radius: 0 12px 12px 0; font-size: 14.5px; margin-bottom: 24px; }
.doc .meta { font-family: var(--f-mono); font-size: 12.5px; color: var(--slate); margin-bottom: 20px; }

/* Страницы результата */
.result { max-width: 640px; margin: 0 auto; padding: clamp(40px, 8vw, 96px) var(--gutter); text-align: center; }
.result-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 22px; font-size: 28px; }
.result-mark.ok { background: var(--saffron); color: var(--ink); }
.result-mark.wait { background: var(--paper-2); color: var(--cobalt); }
.result-mark.bad { background: #FCEDEB; color: var(--danger); }
.result h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.04em; line-height: 1.12; margin-bottom: 14px; }
.result p { color: var(--slate); }
.result p + p { margin-top: 10px; }
.result .contract { display: inline-block; margin: 18px 0 6px; padding: 10px 18px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-family: var(--f-mono); font-size: 18px; letter-spacing: .04em; }
.result .actions { margin-top: 28px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--cobalt-soft); border-top-color: transparent; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.mock { max-width: 480px; margin: 10vh auto; padding: 32px; background: var(--white); border-radius: var(--radius); display: grid; gap: 14px; }
.mock h1 { font-family: var(--f-display); font-weight: 500; }

/* --- Адаптив ------------------------------------------------------------ */

@media (max-width: 960px) {
  .p-grid { grid-template-columns: 1fr; }
  .pass { position: static; order: -1; }
  .p-foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .logo-sub { display: none; }
  .p-head-exec { font-size: 12px; }
  .route span { font-size: 11.5px; }
  .route::before, .route .route-fill { top: 15px; }
  .route button { width: 32px; height: 32px; }
  .tariffs { grid-template-columns: 1fr; }
  .review div { grid-template-columns: 1fr; gap: 2px; }
  .wizard { padding: 20px 18px; border-radius: 18px; }
  .nav-row { position: sticky; bottom: 0; margin: 24px -18px -20px; padding: 14px 18px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-radius: 0 0 18px 18px; }
  .nav-row .btn { flex: 1; }
  .nav-row .btn-ghost { flex: 0 0 auto; }
  .pass-main { padding: 18px 18px 16px; }
  .pass-route { margin: 14px 0 14px; }
  .pass-city b { font-size: 24px; }
  .pass-stub { padding: 12px 18px 16px; }
  .pass-amount { font-size: 1.6rem; }
  .p-foot-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.note-gap { margin-top: 18px; }
.foot-gap { margin-top: 14px !important; }

/* Подвал страниц документов — одна строка */
.doc + .p-foot, .result + .p-foot { padding: 24px 0; }

/* Телефон: компактный талон над формой — заказчик, тариф и сумма */
@media (max-width: 640px) {
  .pass-route, .pass-barcode, .pass-after { display: none; }
  .pass-top { margin-bottom: 12px; }
  .pass-fields div:nth-child(n+3) { display: none; }
  .pass-tear { height: 18px; }
}
