/* payment.regulatory-centre.ru — страницы покупателя по дизайн-системе ЦРК.
   Цвета и шрифты — только токены из crc-tokens.css. Тени и градиенты не используются: разделение — рамкой --line или фоном --mist. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
:root { --gutter: 16px; }
@media (min-width: 700px) { :root { --gutter: 40px; } }

body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 400 1rem/1.55 var(--font-sans);
}
[hidden], .hidden { display: none !important; }
img { max-width: 100%; height: auto; }
.icon { display: inline-block; flex: none; vertical-align: middle; }

/* --- Типографика (§ 3.3) --- */
h1, h2, h3, legend { font-family: var(--font-serif); font-weight: 700; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem); line-height: 1.15; margin: 0 0 20px; }
h2 { font-size: clamp(1.5rem, 1.35rem + .5vw, 1.75rem); line-height: 1.2; margin: 32px 0 16px; }
h3 { font-size: 1.25rem; line-height: 1.25; margin: 24px 0 12px; }
p { margin: 0 0 16px; max-width: 65ch; }
.lead { font-size: 1.125rem; line-height: 1.55; color: var(--muted); max-width: 58ch; }
.label { display: block; margin: 0 0 8px; font: 700 .8125rem/1.3 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--label); }
.label .mono { text-transform: none; letter-spacing: 0; font-size: .8125rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; line-height: 1.5; }
.mono, time { font-family: var(--font-mono); font-size: .8125rem; font-weight: 400; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

/* Фокус — 2px var(--blue) на расстоянии 3px (§ 6.2) */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.wrap {
  width: 100%; max-width: calc(1200px + 2 * var(--gutter)); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* --- «Перейти к содержанию» --- */
.skip {
  position: absolute; left: var(--gutter); top: -200px; z-index: 50;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--link); font-weight: 700;
}
.skip:focus, .skip:focus-visible { top: 8px; }

/* --- Тестовый режим: жёлтая плашка, тёмный текст --- */
.test-banner {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 6px var(--gutter); background: var(--yel); color: var(--on-yel);
  font-size: .875rem; font-weight: 700; text-align: center;
}

/* --- Шапка сервиса (§ 8.2): знак + название → меню → «← Сайт Центра» → тема → кабинет; под шапкой линия 3px акцента --- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 3px solid var(--accent); }
.top__row { display: flex; align-items: center; gap: 12px 32px; min-height: 80px; padding-top: 12px; padding-bottom: 12px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; flex: none; }
.brand:hover .brand__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.brand__mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 8px; background: var(--mark-bg); flex: none; }
.brand__mark img { display: block; width: 46px; height: 46px; }
.brand__text { display: flex; flex-direction: column; gap: 2px; }
.brand__name { font: 700 1.1875rem/1.2 var(--font-serif); }
.brand__desc { font-size: .78125rem; line-height: 1.3; color: var(--muted); }

.top__nav { display: flex; align-items: center; gap: 8px 28px; flex: 1 1 auto; min-width: 0; }
.menu { display: flex; align-items: center; gap: 28px; }
.menu a, .top__site {
  display: inline-flex; align-items: center; min-height: 44px;
  border-bottom: 2px solid transparent; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.menu a { font-weight: 700; font-size: 1rem; }
.menu a:hover, .menu a[aria-current="page"] { border-bottom-color: var(--green); }
.top__site { margin-left: auto; color: var(--link); font-size: .9375rem; }
.top__site:hover { border-bottom-color: var(--link); }

.top__tools { display: flex; align-items: center; gap: 12px; flex: none; }

/* Переключатель темы: виден, только когда работает скрипт (иначе он ничего не умеет) */
.theme {
  display: none; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 700 .875rem/1 var(--font-sans); cursor: pointer; white-space: nowrap;
}
.js .theme { display: inline-flex; }
.theme:hover { border-color: var(--link); }
.theme__sun, .theme__to-light { display: none; }
[data-mode="dark"] .theme__sun, [data-mode="dark"] .theme__to-light { display: inline; }
[data-mode="dark"] .theme__moon, [data-mode="dark"] .theme__to-dark { display: none; }

/* Личный кабинет: имя и выход */
.account { position: relative; }
.account > summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 4px;
  list-style: none; cursor: pointer; color: var(--ink); font-weight: 700; font-size: .9375rem;
}
.account > summary::-webkit-details-marker { display: none; }
.account__name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account > summary .icon:last-child { transition: transform .15s ease; }
.account[open] > summary .icon:last-child { transform: rotate(180deg); }
.account__menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 240px;
  display: grid; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
.account__menu form { margin: 0; }
.account__menu .link {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 4px;
  text-align: left; text-decoration: none; color: var(--ink);
}
.account__menu .link:hover { background: var(--mist); }

@media (max-width: 899px) {
  .top__row { flex-wrap: wrap; min-height: 0; column-gap: 16px; padding-bottom: 0; }
  .top__tools { margin-left: auto; }
  .top__nav {
    order: 3; flex-basis: 100%; gap: 24px; overflow-x: auto; scrollbar-width: thin;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); border-top: 1px solid var(--line);
  }
}
@media (max-width: 519px) {
  .theme { min-height: 44px; min-width: 44px; padding: 0; justify-content: center; }
  .theme__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .account__name, .brand__desc { display: none; }
  .brand__mark { width: 44px; height: 44px; }
  .brand__mark img { width: 40px; height: 40px; }
  .top__tools { gap: 4px; }
}

/* --- Содержимое --- */
main { flex: 1 0 auto; display: grid; align-content: start; gap: 24px; padding-top: 40px; padding-bottom: 60px; }
.card { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.card > :last-child { margin-bottom: 0; }
.card--mist { border-color: var(--mist); background: var(--mist); }
.narrow { width: 100%; max-width: 640px; justify-self: center; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 900px) { .grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
@media (max-width: 519px) { main { padding-top: 24px; padding-bottom: 40px; gap: 16px; } .card { padding: 20px 16px; } }

/* Таблицы: цифры столбцами, на телефоне — своя горизонтальная прокрутка */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lines { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.lines th, .lines td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.lines th:first-child, .lines td:first-child { padding-left: 0; }
.lines th:last-child, .lines td:last-child { padding-right: 0; }
.lines thead th {
  padding-top: 0; font: 700 .75rem/1.3 var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border-bottom-color: var(--ink);
}
.lines tfoot th { padding-top: 16px; border-bottom: 0; font-size: 1.125rem; }
.lines tbody tr:last-child td { border-bottom-color: var(--ink); }
.card--mist .lines td, .card--mist .lines th { border-bottom-color: var(--line); }
.lines a { font-weight: 700; }

/* Сведения о заказе */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 24px; margin: 24px 0; font-size: .9375rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 519px) { .facts { grid-template-columns: minmax(0, 1fr); gap: 0; } .facts dd { margin-bottom: 12px; } }

/* Документы и чеки */
.docs { display: grid; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.docs li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 52px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; }
.docs li .icon { color: var(--muted); }
.docs a { font-weight: 700; }

/* --- Формы (UI-kit § 8.3) --- */
fieldset { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin: 0 0 12px; font-size: 1.25rem; line-height: 1.25; }
label { display: block; margin: 0 0 16px; font-size: .9375rem; font-weight: 700; }
input[type=text], input:not([type]), input[type=email], select {
  display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--field-line); border-radius: 4px; background: var(--surface); color: var(--ink);
  font: 400 1rem/1.4 var(--font-sans);
}
input::placeholder { color: var(--muted); opacity: 1; }
input:hover, select:hover { border-color: var(--ink); }
input:focus-visible, select:focus-visible { outline-offset: 2px; border-color: var(--blue); }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue); flex: none; }

.choice { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.payer { display: grid; gap: 8px; }
.payer .choice { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.payer .choice:hover { border-color: var(--link); }
.payer .choice:has(input:checked) { border-color: var(--blue); outline: 1px solid var(--blue); outline-offset: -2px; }
.payer .choice .icon { color: var(--muted); }
.payer .choice:has(input:checked) .icon { color: var(--blue); }

.org-fields { margin: 0 0 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
@media (min-width: 560px) { .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
details { margin: 0 0 16px; }
summary { cursor: pointer; color: var(--link); font-weight: 700; padding: 10px 0; }
details[open] > summary { margin-bottom: 12px; }
.consent { margin: 20px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 16px; }
.back { display: inline-flex; align-items: center; min-height: 44px; }

/* --- Кнопки: основная, контурная; hover, focus, active, disabled (UI-kit) --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  border: 1px solid var(--blue); border-radius: 4px; background: var(--blue); color: var(--btn-fg);
  font: 700 1rem/1.25 var(--font-sans); text-align: center; text-decoration: none; cursor: pointer;
}
.btn:not(:disabled):hover { border-color: var(--navy); background: var(--navy); color: var(--btn-fg); }
.btn--ghost { background: transparent; color: var(--link); border-color: var(--link); }
.btn--ghost:not(:disabled):hover { background: var(--chip); border-color: var(--link); color: var(--link); }
.btn:not(:disabled):active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 519px) { .actions .btn { width: 100%; } }

.link {
  padding: 0; border: 0; background: none; color: var(--link); cursor: pointer;
  font: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em;
}
.inline { display: inline; margin: 0; }

/* --- Уведомления: значок и текст, не только цвет --- */
.alert, .notice {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 0 20px; padding: 14px 16px;
  border: 1px solid var(--danger); border-radius: 6px; background: var(--surface); color: var(--ink);
}
.alert .icon { color: var(--danger); }
.notice { border-color: var(--green); }
.notice .icon { color: var(--green); }

/* --- Статусы заказа: метки 999px, текст говорит сам за себя --- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border: 1px solid transparent; border-radius: 999px;
  background: var(--chip); color: var(--link); font: 700 .75rem/1.3 var(--font-sans); white-space: nowrap;
}
.badge--paid, .badge--partially_refunded { background: var(--soon); color: var(--soon-fg); }
.badge--refunded, .badge--canceled { background: transparent; border-color: var(--line); color: var(--muted); }

/* --- «Проверяем оплату»: фирменный бегущий пунктир (§ 8.2), неподвижен при reduced motion --- */
.progress { display: block; width: 100%; max-width: 320px; height: 4px; margin: 0 0 24px; color: var(--accent); }
.progress line { stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 5 8; animation: crc-dash 1.6s linear infinite; }
@keyframes crc-dash { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -26; } }
@media (prefers-reduced-motion: reduce) { .progress line { animation: none; } }

/* --- Подвал (общий для сайта и сервисов) --- */
.foot { margin-top: auto; background: var(--foot); color: var(--on-foot); font-size: .9375rem; }
.foot a { color: var(--on-foot); }
.foot__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 52px; padding-bottom: 40px; }
@media (min-width: 560px) { .foot__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .foot__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 4fr); } }
.foot__brand { display: flex; gap: 16px; align-items: flex-start; }
.foot__name { margin: 0 0 4px; font: 700 1.1875rem/1.25 var(--font-serif); color: var(--on-foot); }
.foot__desc { margin: 0; font-size: .78125rem; }
.foot__title { margin: 0 0 12px; font: 700 .8125rem/1.3 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; }
.foot ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.foot li a { display: inline-flex; align-items: center; min-height: 32px; }
.foot__note { margin: 0; max-width: 46ch; }
.foot__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; padding-bottom: 24px;
  border-top: 1px solid var(--muted); font-size: .8125rem;
}
@supports (color: color-mix(in srgb, red 50%, transparent)) {
  .foot__bottom { border-top-color: color-mix(in srgb, var(--on-foot) 25%, transparent); }
}
.foot__bottom p { margin: 0; max-width: none; }
@media (max-width: 559px) { .foot li a { min-height: 44px; } }
