/* Вариант B: светлый, акцент — оранжевый, шапка чёрная. */
:root {
  --accent: #F26B1F;
  --accent-soft: #FFF1E8;
  --accent-line: #F6C7A6;
  --accent-ink: #4A2A12;
  --ink: #0E1116;
  --ink-2: #3A4150;
  --muted: #5B6170;
  --line: #E2E5EA;
  --line-2: #CFD4DC;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --dark: #111214;
  --danger: #B42318;
  --ok: #067647;
  --radius: 16px;
  --font: Manrope, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
button, input { font: inherit; color: inherit; }
button, a, .tile { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: var(--ink-2); text-decoration: none; }
a:hover { color: var(--ink); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Шапка */
.top { background: var(--dark); border-bottom: 3px solid var(--accent); }
.top__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; }
.brand:hover { color: #fff; }
.top__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; font-size: 14px; font-weight: 500; }
.top__link { color: #D5D7DC; }
.top__link:hover { color: #fff; }
.pill { padding: 6px 12px; background: #26272B; border-radius: 999px; color: #D5D7DC; font-variant-numeric: tabular-nums; }

/* main.wrap, не main: иначе .wrap { padding: 0 … } обнуляет отступы сверху и снизу. */
main.wrap { padding-top: 36px; padding-bottom: 48px; }
.lead { margin: 6px 0 28px; color: var(--muted); font-size: 16px; }
h1.title { font-size: 32px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }

.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.steps { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card h2 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #111; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.error { margin: 0; font-size: 14px; color: var(--danger); font-weight: 600; }

/* Способы оплаты */
.group-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.methods { display: flex; flex-direction: column; gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--line-2); }
.tile[aria-pressed="true"] { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.tile__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tile__name { font-weight: 600; overflow-wrap: anywhere; }
.tile[aria-pressed="true"] .tile__name { font-weight: 700; }
.tile__hint { font-size: 12px; color: var(--muted); }
.tile__limits { font-size: 12px; color: var(--muted); white-space: nowrap; }
.skeleton { padding: 18px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); }

/* Круглые значки банков. Официальные логотипы — по файлам от заказчика. */
.badge { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; letter-spacing: -0.02em; background: var(--bg); color: var(--ink); border: 1px solid rgba(0,0,0,.06); }
.badge svg { width: 18px; height: 18px; }
.badge--small { font-size: 10px; }
.badge--tbank_qr { background: #FFDD2D; color: #111; }
.badge--qr_sber { background: #21A038; color: #fff; }
.badge--psb_deeplink { background: #233A8B; color: #fff; }
.badge--gazprom_deeplink { background: #0A3B8F; color: #fff; }
.badge--nspk { background: #0E1116; color: #fff; }
.badge--sbp_phone_qr { background: var(--accent); color: #111; }
.badge--sbp { background: #5B2D90; color: #fff; }
.badge--alpha_sbp { background: #EF3124; color: #fff; }
.badge--sbp_trans { background: #0E1116; color: #fff; }
.badge--sim { background: #E2E5EA; color: #111; }

/* Поля */
.row2 { display: flex; flex-wrap: wrap; gap: 12px; }
.field { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 6px 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; }
.input:focus-within { border-color: var(--accent); }
.input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 18px; font-weight: 700; }
.input--ro { background: #FAFAFB; }
.unit { color: var(--muted); font-weight: 600; padding-right: 8px; }
.unit--chip { padding: 6px 12px; background: var(--bg); border-radius: 8px; font-weight: 700; color: var(--ink); }
/* 16px и больше: iOS не увеличивает страницу при фокусе на поле. */
.text { min-height: 52px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; outline: none; background: #fff; width: 100%; font-size: 16px; }
.input--text input { font-size: 16px; font-weight: 600; }
.paste { flex: none; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--bg); font-size: 14px; font-weight: 700; cursor: pointer; }
.text:focus { border-color: var(--accent); }
.is-invalid, .input.is-invalid { border-color: var(--danger); }

/* Заявка */
.summary { flex: 1 1 300px; position: sticky; top: 16px; }
.dl { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.dl > div { display: flex; justify-content: space-between; gap: 12px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }
.summary__total { border-top: 1px solid var(--line); padding-top: 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.summary__total span { color: var(--muted); font-size: 14px; }
.summary__total b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
/* Телефон: сумма и кнопка всегда внизу экрана. */
.mbar { display: none; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 800; font-size: 16px; }
.btn--accent:hover { background: #E35F14; border-color: #E35F14; color: #111; }
.btn--dark { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 700; }
.btn--dark:hover { background: #000; color: #fff; }
.btn--wide { flex: 1 1 220px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Как это работает */
.faq { margin-top: 32px; }
.faq h2 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.faq ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; counter-reset: faq; }
.faq li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; counter-increment: faq; }
.faq li::before { content: counter(faq); display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--dark); color: #fff; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.faq b { display: block; margin-bottom: 4px; }
.faq p { margin: 0; color: var(--muted); font-size: 14px; }

/* Подбор и оплата */
.flow { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.loader { flex: 1 1 380px; }
.pay { flex: 1 1 520px; }
.loader__head { display: flex; align-items: center; gap: 16px; }
.loader__head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.loader__head p { margin: 2px 0 0; }
.spinner { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.spinner--small { width: 22px; height: 22px; border-width: 3px; }
.state-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 22px; }
.state-icon--ok { background: var(--dark); }
.state-icon--fail { background: var(--line); color: var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; }
.timeline .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.mark--done { background: var(--dark); color: #fff; }
.mark--fail { background: var(--line); color: var(--ink-2); }
.mark--active { border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.mark--warn { background: var(--accent); color: #111; }
.timeline b { font-weight: 700; display: block; }
.timeline span { font-size: 14px; color: var(--muted); }

.notice { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; padding: 14px 16px; font-size: 14px; color: var(--accent-ink); }
.notice b { display: block; margin-bottom: 4px; color: var(--ink); }
.notice--danger { background: #FEF3F2; border-color: #FECDCA; color: #7A271A; }
.chip { display: inline-flex; align-self: flex-start; padding: 6px 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--accent-ink); }

.pay__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.pay__head h2, .pay > h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.mark svg, .state-icon svg { width: 70%; height: 70%; }
.timer { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--dark); color: #fff; border-radius: 999px; font-variant-numeric: tabular-nums; font-weight: 700; }
.timer--over { background: var(--danger); }

.req { margin: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; }
.req > div { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 56px; border-bottom: 1px solid var(--line); }
.req > div:last-child { border-bottom: 0; }
.req dt { flex: 0 0 150px; color: var(--muted); font-size: 14px; }
.req dd { margin: 0; flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.req dd.big { font-size: 20px; font-weight: 800; }
.req s { color: var(--muted); font-weight: 500; margin-right: 8px; }
.copy { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); border: 0; border-radius: 10px; cursor: pointer; }
.copy:hover { background: var(--line); }
.copy svg { width: 18px; height: 18px; }
.copy--done { background: var(--dark); color: #fff; }

.qr { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.qr img { width: 184px; height: 184px; image-rendering: pixelated; background: #fff; border-radius: 8px; }
.qr__text { flex: 1 1 200px; display: flex; flex-direction: column; gap: 10px; }
.receive { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 14px; background: var(--bg); border-radius: 12px; font-size: 14px; }
.receive b { font-weight: 800; }
.warn { margin: 0; font-size: 14px; color: var(--ink); font-weight: 700; }
.small { margin: 0; font-size: 14px; color: var(--ink-2); }
.status { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--bg); }
.status b { display: block; }
.txid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 28px; color: var(--muted); font-size: 13px; }

/* Спор по заявке: на странице заявки, под статусом. */
.dispute { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.dispute h3 { font-size: 17px; font-weight: 800; }
.dispute__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.chip--closed { background: var(--bg); border-color: var(--line); color: var(--ink-2); }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.msg--client { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.msg--support { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.msg__meta { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.msg__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
/* 16px: iOS не увеличивает страницу при фокусе. */
.area { width: 100%; min-height: 96px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font: inherit; font-size: 16px; color: var(--ink); resize: vertical; outline: none; }
.area:focus { border-color: var(--accent); }
.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.file-pick .btn { min-height: 46px; }
.file-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.banner { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.banner-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.banner-row .btn { min-height: 40px; padding: 0 16px; }

@media (max-width: 420px) {
  /* Узкий телефон: шапка в одну строку, курс — в блоке «Ваша заявка». */
  .pill { display: none; }
}

@media (max-width: 900px) {
  /* После подбора на телефоне видна только оплата: подбор уже не нужен. */
  .flow--paying .loader { display: none; }
}

@media (max-width: 720px) {
  html { scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .wrap { padding: 0 14px; }
  .top__in { padding-top: 12px; padding-bottom: 12px; gap: 10px; }
  .top__link--wide { display: none; }
  .brand { font-size: 15px; letter-spacing: 0.05em; }
  .top__in { flex-wrap: nowrap; }
  .top__nav { gap: 12px; }
  .pill { padding: 4px 10px; font-size: 13px; }
  main.wrap { padding-top: 20px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  h1.title { font-size: 24px; }
  .lead { margin: 4px 0 16px; font-size: 15px; }
  .layout, .steps, .flow { gap: 12px; }
  .card { padding: 16px; gap: 14px; border-radius: 14px; }
  .card h2 { font-size: 17px; }

  /* Плитки в две колонки, без подсказок и лимитов: лимиты — под суммой. */
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 56px; padding: 8px 10px; gap: 10px; }
  .tile__hint, .tile__limits { display: none; }
  .tile__name { font-size: 14px; line-height: 1.25; }
  .badge { width: 32px; height: 32px; font-size: 12px; }
  .badge--small { font-size: 9px; }

  .row2 { gap: 10px; }
  .field { flex-basis: 100%; }
  .summary { position: static; }
  .summary__submit { display: none; }
  .mbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(17, 18, 20, .08);
  }
  .mbar__sum { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
  .mbar__sum span { font-size: 12px; color: var(--muted); }
  .mbar__sum b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar .btn { flex: none; min-height: 50px; padding: 0 22px; }

  .faq { margin-top: 20px; }
  .faq ol { grid-template-columns: minmax(0, 1fr); }

  .loader__head h1, .pay__head h2, .pay > h2 { font-size: 21px; }
  /* Подпись над значением: номер карты и телефон помещаются в одну строку. */
  .req > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; padding: 8px 12px; min-height: 52px; }
  .req dt { grid-column: 1; font-size: 12px; }
  .req dd { grid-column: 1; font-size: 17px; }
  .req dd.big { font-size: 21px; }
  .req .copy { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .qr { padding: 12px; }
  .qr__text .btn { width: 100%; }
  /* Кнопка «Я оплатил» на телефоне прилипает к низу экрана. */
  .pay .actions--sticky {
    position: sticky; bottom: 0; z-index: 5; margin: 0 -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px;
  }
  .pay .actions--sticky .btn { flex: 1 1 100%; }
  .pay .actions .btn, .loader .actions .btn { flex: 1 1 100%; }
  .pay .actions--more .btn { flex: 1 1 0; min-height: 46px; padding: 0 12px; font-size: 14px; }
  .msg { max-width: 94%; }
  .dispute .file-pick .btn { flex: 1 1 100%; }
  .foot { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* QR на телефоне свёрнут: свой экран телефоном не отсканировать. */
.qr-more summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--ink-2); min-height: 44px; display: flex; align-items: center; }
.qr-more img { margin-top: 8px; }
