/* Тема УТРО: предзаказ книг — окно «Витрина» на главной и форма на странице /predzakaz/.
   Форма светлая: поля и галочки берутся из main.css (.field, .check, .btn), здесь только то, чего там нет.
   Порядок разделов: защита hidden → карточка книги на главной → страница → форма (общее) → окно (каркас, лента, шаг и полоса, панель, плашка) → узкие экраны. */

/* ---------- Защита hidden ---------- */
/* Атрибут hidden должен побеждать display из классов ниже. Панель, плашка и лента лежат вне form.po, поэтому правило и для .modal--po. */
.po [hidden], .modal--po [hidden] { display: none !important; }

/* ---------- Карточка книги на главной ---------- */
.book__body .book__nopay { margin: -2px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); }

/* ---------- Страница /predzakaz/ ---------- */
.wrap.po-page__wrap { max-width: 760px; }
.po-page__panel { border: 1px solid var(--line-light); box-shadow: var(--shadow-card); }
.po-page__alert { margin: 0 0 24px; }
.po-page__after { margin-top: 20px; }
.po-page__panel .contact-list { margin-bottom: 4px; }

/* Форма на странице: одна колонка, разделы идут подряд и отделены линией. Панели, ленты и полосы с прокруткой здесь нет,
   кнопка отправки стоит в конце. Правила окна записаны под классом окна и сюда не доходят; общие правила, которым на странице
   нужен другой вид, переопределяются явно и только под .po-page (на один класс специфичнее общих). */
.po-page .po { display: grid; gap: 0; min-width: 0; }
.po-page .po__step:not([hidden]) { display: grid; gap: 16px; min-width: 0; }
.po-page .po__done:not([hidden]) { display: block; min-width: 0; }
.po-page .po__step + .po__step { margin-top: 36px; padding-top: 36px; border-top: 1px solid var(--line-light); }
.po-page .po__scroll { display: grid; align-content: start; gap: 16px; min-width: 0; flex: none; padding: 0; overflow: visible; }
.po-page .po__done .po__scroll { gap: 12px; }
.po-page .po__foot { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; background: none; }
.po-page .po__foot .form__status { margin-top: 0; }
.po-page .po__actions { margin-top: 0; justify-content: flex-start; }

/* Заголовок раздела и подзаголовок: подзаголовок ближе к своему заголовку, чем к содержимому. */
.po-page .po__title { font-size: clamp(20px, 1.2vw + 16px, 24px); }
.po-page .po__lead { margin: -8px 0 0; }

/* Панель страницы белая, поэтому карточки на ней — на --surface, иначе сольются с фоном. Счётчик, переключатель и поля остаются белыми.
   Выбранная карточка способа получает тёплую подложку и рамку из общих правил (они специфичнее этого). */
.po-page .po__book,
.po-page .po__way { background: var(--surface); }
.po-page .po__book-text { min-width: 0; }
.po-page .po__book-title { overflow-wrap: anywhere; }

/* Без скрипта поле количества не обёрнуто в счётчик: оно должно выглядеть таблеткой. Со скриптом поле внутри .po__stepper,
   прямым ребёнком строки оно уже не является, и это правило не действует. Рамка, наведение, фокус и ошибка — общие правила .po__qty ниже:
   здесь рамку (border) не задаём, иначе это правило перебило бы цвет рамки в этих состояниях. */
.po-page .po__row > .po__qty { display: block; flex: none; width: 84px; height: 48px; padding: 0 12px; border-radius: 999px; background: var(--white); color: var(--ink); font: 800 17px/1.2 var(--font-body); text-align: center; }

/* Строка итога — единственное место, где страница показывает состав: плашка, а не голая строка. Пустая строка не занимает места. */
.po-page .po__total:not(:empty) { margin: 0; padding: 14px 18px; border-radius: var(--r-s); background: var(--surface); }
.po-page .po__nopay { margin: 8px 0 0; font-size: 15px; font-weight: 800; }

@media (max-width: 599px) {
  .po-page__panel { padding: 22px 16px; }
  .po-page .po__step + .po__step { margin-top: 28px; padding-top: 28px; }
  .po-page .po__book { padding-left: 16px; padding-right: 16px; }
  .po-page .po__actions .btn { width: 100%; }
}
/* Узкая панель: строка цифровой книги не должна становиться колонкой в три слова, переключатель уходит под текст. */
@media (max-width: 479px) {
  .po-page .po__row--digital .po__row-text { flex: 1 1 128px; min-width: 0; }
}
@media (max-width: 380px) {
  .po-page .po__book { padding-left: 12px; padding-right: 12px; }
}

/* ---------- Форма: общее для окна и страницы ---------- */
/* шаги и заголовки */
.po { display: grid; gap: 40px; min-width: 0; }
.po__step { display: grid; gap: 16px; min-width: 0; }
.po__scroll { display: grid; gap: 16px; align-content: start; min-width: 0; }
.po__foot { display: grid; gap: 16px; min-width: 0; }
.po__title { margin: 0; font-size: clamp(20px, 1.2vw + 16px, 24px); line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
.po__title:focus { outline: none; }
.po__lead { margin: -8px 0 0; font-size: 15.5px; line-height: 1.55; color: var(--muted); }
.po__help { margin: 6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.po__kindnote { margin: 0 0 6px; font-size: 13px; line-height: 1.4; font-weight: 700; color: var(--muted); }
.po__phonenote { grid-column: 1 / -1; margin-top: -6px; }

/* карточка книги: шапка (обложка, название, вид) и строки форматов */
.po__book { position: relative; display: grid; gap: 0; min-width: 0; margin: 0; padding: 20px 22px 8px; border: 1px solid var(--line-light); border-radius: var(--r-l); background: var(--white); box-shadow: var(--shadow-card); }
.po__book::before { content: ''; position: absolute; left: 24px; right: 24px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--accent), var(--gold)); box-shadow: 0 2px 10px rgba(226, 118, 79, .45); opacity: 0; }
.po__book.is-picked { border-color: var(--accent-ink); }
.po__book.is-picked::before { opacity: 1; }
.po__book-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.po__cover { flex: none; width: 58px; height: auto; border-radius: 6px; box-shadow: 0 8px 20px rgba(36, 26, 68, .22); }
.po__book-text { min-width: 0; }
.po__book-title { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; text-wrap: balance; }
.po__book-sub { margin: 2px 0 0; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--muted); }
.po__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; min-width: 0; min-height: 68px; margin-top: 14px; padding: 12px 0; border-top: 1px solid var(--line-light); }
.po__row + .po__row { margin-top: 0; }
.po__row-text { flex: 1 1 140px; min-width: 0; }
.po__row .field__error, .po__row .po__hint { flex-basis: 100%; }
.po__label { display: block; margin: 0; font-size: 15.5px; line-height: 1.3; font-weight: 800; }
.po__sub { display: block; margin-top: 1px; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--muted); }
/* Подпись цифровой книги — две части («цена уточняется», «придёт на почту»): перенос только между частями, а не посреди них.
   На телефоне части идут друг под другом и точка-разделитель не нужна; на компьютере и планшете они стоят в одну строку через точку. */
.po__sub-part { white-space: nowrap; }
@media (max-width: 479px) {
  .po__sub-sep { display: none; }
  .po__sub-part { display: block; }
}
.po__qty { display: block; width: 84px; height: 52px; padding: 0 12px; border: 1.5px solid var(--line-field); border-radius: var(--r-s); background: var(--white); color: var(--ink); font: 700 18px/1.4 var(--font-body); text-align: center; transition: border-color .2s, box-shadow .2s; }
.po__qty:hover { border-color: rgba(26, 19, 56, .7); }
.po__qty:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 4px rgba(226, 118, 79, .28); }
.po__qty[aria-invalid="true"] { border-color: #C0392B; }

/* счётчик: «−», поле, «+» в одной таблетке 48 px (обёртку строит скрипт; без скрипта остаётся обычное поле выше) */
.po__stepper { display: inline-flex; align-items: center; flex: none; height: 48px; border: 1.5px solid var(--line-field); border-radius: 999px; background: var(--white); }
.po__stepper:hover { border-color: rgba(26, 19, 56, .7); }
.po__stepper:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 4px rgba(226, 118, 79, .28); }
.po__stepper:has(.po__qty[aria-invalid="true"]) { border-color: #C0392B; }
.po__qbtn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 46px; height: 44px; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--ink); font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer; }
.po__qbtn:hover { color: var(--accent-ink); }
.po__qbtn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.po__qbtn[aria-disabled="true"]:hover { color: var(--ink); }
.po__stepper .po__qty { width: 52px; height: 44px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ink); font: 800 18px/1.2 var(--font-body); text-align: center; }
.po__stepper .po__qty:hover, .po__stepper .po__qty:focus, .po__stepper .po__qty[aria-invalid="true"] { outline: none; border: 0; box-shadow: none; }

/* переключатель цифровой книги: настоящая галочка накрывает всю кнопку (не display: none — иначе выпадет из Tab и из кликов мыши) */
.po__dig { position: relative; display: inline-flex; flex: none; }
input.po__dig-box { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.po__dig-face { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 124px; height: 48px; padding: 0 18px; border: 1.5px solid var(--line-field); border-radius: 999px; background: var(--white); color: var(--ink); font-size: 14.5px; font-weight: 800; line-height: 1; white-space: nowrap; }
.po__dig:hover .po__dig-face { border-color: var(--accent); }
.po__dig-check, .po__dig-on { display: none; flex: none; }
input.po__dig-box:checked + .po__dig-face { border-color: var(--indigo); background: var(--indigo); color: var(--white); box-shadow: 0 8px 22px rgba(36, 26, 68, .28), 0 0 18px rgba(226, 118, 79, .22); }
input.po__dig-box:checked + .po__dig-face .po__dig-check { display: block; }
input.po__dig-box:checked + .po__dig-face .po__dig-on { display: inline; }
input.po__dig-box:checked + .po__dig-face .po__dig-off { display: none; }
input.po__dig-box:focus-visible + .po__dig-face { outline: 3px solid var(--indigo); outline-offset: 3px; }

/* итог шага, ошибка состава, подсказки */
.po__total { margin: 4px 0 0; font-size: 17px; line-height: 1.4; font-weight: 800; }
.po__total:not(.sr-only):empty { display: none; }
.po__books-err { margin: 0; }
.po__hint { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; margin-top: 6px; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--accent-ink); }
.po__hint a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; }
.po__opt { font-weight: 500; color: var(--muted); }

/* кнопки шага */
.po__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.po__actions .btn { min-height: 52px; }
.po .form__submit[aria-disabled="true"] { opacity: .6; cursor: progress; }
.po .po__step[hidden], .po .po__kind[hidden], .po .po__done[hidden] { display: none; }

/* «Изменить» (панель переопределяет вид своим правилом ниже) и подсказка об опечатке */
.po__edit { min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--accent-ink); font: 700 14.5px/1.2 var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.po__edit:hover { color: var(--brick); }
.po__edit:focus-visible, .po__typo-fix:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.po__typo { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; margin: 8px 0 0; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--muted); }
.po__typo-fix { min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--accent-ink); font: 700 14px/1.2 var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* @T2: доставка */
/* Содержимое шагов «Доставка» и «Контакты» в окне — колонка с отступом 16 px: оболочка шага ушла во внутренний .po__scroll.
   Колонка, а не сетка: строки сетки не растут по высоте строки согласия, и текст налезает на соседние (проверено снимком). */
.modal--po .po__step[data-step="ship"] .po__scroll, .modal--po .po__step[data-step="contacts"] .po__scroll { display: flex; flex-direction: column; gap: 16px; }
.modal--po .po__step[data-step="ship"] .po__scroll > *, .modal--po .po__step[data-step="contacts"] .po__scroll > * { flex-shrink: 0; min-width: 0; }
.po__ways { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.po__ways legend { padding: 0; margin-bottom: 6px; }
.po__ways > .field__label { margin-bottom: 0; }
.po__way { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; min-height: 72px; padding: 14px 20px; border: 1.5px solid var(--line-light); border-radius: var(--r-l); background: var(--white); box-shadow: var(--shadow-card); cursor: pointer; }
.po__way input { flex-shrink: 0; width: 24px; height: 24px; margin: 0; accent-color: var(--accent-ink); cursor: pointer; }
.po__way:hover { border-color: var(--line-field); }
.po__way:has(input:checked), .po__way--one { border-color: var(--accent-ink); background: linear-gradient(rgba(226, 118, 79, .07), rgba(226, 118, 79, .07)), var(--white); box-shadow: 0 12px 32px rgba(226, 118, 79, .18); }
.po__way:has(input:focus-visible) { outline: 3px solid var(--indigo); outline-offset: 3px; }
/* Контур радиокнопки снимается, только если браузер понимает :has() и рисует контур вокруг всей карточки (правило выше). */
@supports selector(:has(*)) {
  .po__way input:focus-visible { outline: none; }
}
.po__way--one { cursor: default; }
.po__way-text { display: grid; flex: 1 1 9em; gap: 2px; min-width: 0; font-size: 16px; line-height: 1.3; }
.po__way-text b { font-weight: 800; overflow-wrap: anywhere; }
.po__way-text span { font-size: 14px; font-weight: 600; color: var(--muted); }
.po__way-price { flex-shrink: 0; margin-left: auto; font-size: 18px; font-weight: 800; white-space: nowrap; }
.po__way-price--tbd { max-width: 10em; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--muted); text-align: right; white-space: normal; }
@media (max-width: 480px) {
  .po__way { padding: 14px 16px; }
  .po__way-price--tbd { flex: 1 1 calc(100% - 38px); max-width: none; margin-left: 38px; text-align: left; }
  .po__way--one .po__way-price--tbd { flex-basis: 100%; margin-left: 0; }
}
.po__kind { display: grid; gap: 4px; min-width: 0; }
.po__dignote { margin-top: 0; padding: 14px 18px; border-radius: var(--r-m); background: var(--surface-2); font-size: 14.5px; font-weight: 600; line-height: 1.5; color: var(--muted); }

/* @T2: контакты */
.po .po__check { margin-top: -8px; min-height: 44px; padding: 8px 0; align-items: flex-start; }
.po .po__check .check__box { width: 22px; height: 22px; margin: 1px 0 0; }
.po .po__check + .field__error { margin-top: -8px; }
.po .po__check--opt { margin-top: 4px; padding-top: 18px; border-top: 1px solid var(--line-light); }
.po .po__check-links { margin: -6px 0 6px 34px; font-size: 13px; line-height: 1.5; color: var(--muted); }   /* ссылки согласия — строкой под галочкой, вне <label> */
.po .po__check-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.po .po__check--opt + .po__check-links { margin-top: -6px; }
.po__row--soon .po__label { color: var(--muted); }
.po__nopay { margin: 4px 0 0; font-size: 15px; font-weight: 800; }
.po-note { margin: 4px 0 0; padding: 14px 18px; border: 1px dashed rgba(226, 118, 79, .55); border-radius: var(--r-m); background: rgba(226, 118, 79, .07); font-size: 14.5px; font-weight: 600; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }

/* @T2: готово */
.po__done { min-width: 0; }
.po__done .po__scroll { display: flex; flex-direction: column; align-items: flex-start; }
.po__ring { position: relative; flex: none; display: grid; place-items: center; width: 84px; height: 84px; margin: 8px 0 22px; border-radius: 50%; background: var(--indigo); color: var(--gold-hi); box-shadow: 0 0 0 3px var(--gold-hi), 0 0 0 7px rgba(246, 198, 106, .22), 0 0 44px rgba(246, 198, 106, .5); }
.po__ring svg { width: 38px; height: 38px; }
.po__done .po__title:focus { outline: none; }
.po__done-body { display: flex; flex-direction: column; align-items: flex-start; align-self: stretch; min-width: 0; }
.po__mail { margin: 14px 0 0; font-size: 15px; line-height: 1.5; font-weight: 600; }
.po__note { margin: 14px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.po__done .po__summary { align-self: stretch; }
.po__close { margin: 0 0 0 auto; }
.po__summary:empty { display: none; }
.po__summary { margin: 24px 0 0; padding: 18px 20px; border: 1.5px solid var(--line-light); border-radius: var(--r-s); background: var(--surface); color: var(--ink); text-align: left; }
.po__sumblock + .po__sumblock { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-light); }
.po__sumtop { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.po__sumhead { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 800; }
.po__sumlist { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; }
.po__sumline { margin: 6px 0 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.po__sumtotal { margin: 14px 0 0; font-size: 15px; line-height: 1.4; font-weight: 800; }

/* ---------- Окно: каркас ---------- */
/* Пока окно открыто, страница под ним не прокручивается. */
html.po-lock { overflow: hidden; }

.modal.modal--po {
  width: min(1000px, calc(100vw - 40px)); max-width: none;
  height: min(820px, calc(100vh - 64px)); height: min(820px, calc(100dvh - 64px)); max-height: none;
  margin: auto; padding: 0; overflow: hidden;
  border: 0; border-radius: 32px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 40px 120px rgba(13, 10, 28, .6), 0 0 0 1px rgba(255, 226, 163, .16), 0 0 80px rgba(255, 158, 110, .14);
}
.modal.modal--po[open] {
  display: grid; grid-template-columns: 360px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  animation: po-in .18s ease-out;
}
@keyframes po-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.po-work { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.po-order { grid-column: 1; grid-row: 1 / -1; }
.po-bar { display: none; }
.modal--po :focus-visible { outline-color: var(--indigo); }

/* ---------- Окно: лента и крестик ---------- */
.po-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex: none; padding: 22px 28px 0 40px; }
.po-top .modal__x { margin-left: auto; }   /* на «Готово» ленты нет (hidden): крестик остаётся справа, как на шагах */
.po-steps { display: flex; gap: 10px; flex: 1; max-width: 400px; margin: 0; padding: 0; list-style: none; }
.po-steps__item { flex: 1; min-width: 0; }
.po-steps__seg { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; margin: 0; padding: 14px 0 6px; border: 0; background: none; text-align: left; font: 700 13.5px/1.3 var(--font-body); color: var(--muted-2); cursor: default; }
.po-steps__seg::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 4px; background: var(--line-field); }
.po-steps__seg--done { color: var(--muted); cursor: pointer; }
.po-steps__seg--done:hover { color: var(--ink); }
.po-steps__seg--done::before { background: var(--accent-ink); }
.po-steps__seg--now { color: var(--ink); font-weight: 800; }
.po-steps__seg--now::before { background: var(--accent-ink); box-shadow: 0 2px 10px rgba(226, 118, 79, .45); }
.po-steps__tick { flex: none; width: 14px; height: 14px; color: var(--accent-ink); }
.po-steps__label { min-width: 0; overflow-wrap: anywhere; }
.modal--po .modal__x { position: static; flex: none; width: 44px; height: 44px; border-color: var(--line-light); background: var(--white); color: var(--ink); }
.modal--po .modal__x { font-size: 30px; font-weight: 600; line-height: 1; padding: 0 0 3px; }   /* крест крупнее и толще: на светлом фоне рядом с заголовком он не терялся */
.modal--po .modal__x:hover { border-color: var(--accent); background: var(--white); }

/* ---------- Окно: шаг, содержимое, полоса ---------- */
.modal--po form.po { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 0; }
.modal--po .po__step:not([hidden]), .modal--po .po__done:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 0; }
.modal--po .po__scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 18px 40px 24px; }
.modal--po .po__foot { flex: none; display: block; padding: 16px 40px 22px; border-top: 1px solid var(--line-light); background: var(--white); }
.modal--po .po__foot .form__status { margin: 0 0 12px; }
.modal--po .po__foot .form__status:empty { margin: 0; }
.modal--po .po__title { font-size: 30px; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
.modal--po .po__actions { flex-wrap: nowrap; justify-content: space-between; align-items: center; margin-top: 0; }
/* «Готово»: текст крупнее и плотнее, пояснения с точкой-маркером; на компьютере содержимое стоит по вертикали посередине (авто-поля, а не justify-content: при высоком содержимом верх остаётся доступным для прокрутки) */
.modal--po .po__done .po__ring { margin: auto 0 20px; }
.modal--po .po__done .po__title { font-size: 34px; }
.modal--po .po__done .po__done-body { margin-bottom: auto; max-width: 560px; }
.modal--po .po__done .po__mail { margin: 16px 0 0; font-size: 18px; line-height: 1.5; font-weight: 600; }
.modal--po .po__done .po__note { position: relative; margin: 12px 0 0; padding: 12px 0 0 24px; border-top: 1px solid var(--line-light); font-size: 16.5px; line-height: 1.5; font-weight: 500; color: var(--ink); align-self: stretch; }
.modal--po .po__done .po__note::before { content: ""; position: absolute; left: 2px; top: 21px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-ink); }
.modal--po .po__done .po__note:first-of-type { margin-top: 20px; }
.modal--po .po__actions .btn { min-height: 0; }
.modal--po .po__actions .po__next, .modal--po .po__actions .form__submit { margin-left: auto; }
/* Главная кнопка шага «Книги» при пустой заявке: приглушена (серо-фиолетовая, без свечения), но нажимается и показывает ошибку.
   Белый текст на --muted-2 контрастнее, чем на терракоте (исключение DESIGN.md), движения нет. */
.modal--po .po__next.po__next--idle, .modal--po .po__next.po__next--idle:hover { background: var(--muted-2); box-shadow: none; transform: none; transition: none; }
.modal--po .po__back { height: 48px; padding: 0 16px 0 10px; border: 0; background: none; box-shadow: none; color: var(--muted); font-size: 15px; font-weight: 800; }
.modal--po .po__back:hover { color: var(--ink); transform: none; }

/* ---------- Окно: панель заявки ---------- */
.po-order {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; color: var(--cream);
  background:
    radial-gradient(circle at 50% 22%, rgba(246, 198, 106, .2) 0%, rgba(246, 198, 106, 0) 46%),
    radial-gradient(circle at 10% 100%, rgba(255, 158, 110, .2) 0%, rgba(255, 158, 110, 0) 46%),
    var(--dawn-deep);
}
.po-order__in { display: flex; flex-direction: column; flex: 1 0 auto; padding: 30px 30px 28px; }
.po-order__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.po-order__title { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; }
.po-order__count { font-size: 14px; font-weight: 700; color: var(--lilac); }
.po-order__stamp { display: inline-flex; align-items: center; min-height: 30px; padding: 3px 12px; border: 1px solid rgba(246, 198, 106, .45); border-radius: 999px; background: rgba(246, 198, 106, .16); font-size: 13px; font-weight: 800; color: var(--gold-hi); }

.po-covers { position: relative; display: flex; align-items: center; justify-content: center; flex: none; height: 280px; margin: 14px 0 6px; }
.po-covers::before { content: ''; position: absolute; left: 50%; top: 50%; width: 310px; height: 250px; margin: -125px 0 0 -155px; border-radius: 50%; background: radial-gradient(closest-side, rgba(246, 198, 106, .34), rgba(246, 198, 106, .1) 62%, rgba(246, 198, 106, 0)); }
.po-cover { position: relative; flex: none; width: auto; height: 250px; }
.po-cover img { display: block; width: auto; height: 100%; max-width: none; border-radius: 7px; box-shadow: 0 0 0 1.5px rgba(255, 226, 163, .6), 0 0 34px rgba(246, 198, 106, .4), 0 22px 44px rgba(13, 10, 28, .5); }
.po-covers--1 .po-cover { height: 270px; }
.po-covers--2 .po-cover:nth-child(1) { z-index: 1; transform: rotate(-4deg) translateX(10px); }
.po-covers--2 .po-cover:nth-child(2) { z-index: 2; transform: rotate(3deg) translateX(-10px) translateY(6px); }
.po-covers--3 .po-cover { height: 200px; }
.po-covers--3 .po-cover:nth-child(1) { z-index: 1; margin-right: -44px; transform: rotate(-4deg); }
.po-covers--3 .po-cover:nth-child(2) { z-index: 3; transform: translateY(8px); }
.po-covers--3 .po-cover:nth-child(3) { z-index: 2; margin-left: -44px; transform: rotate(4deg); }
.po-cover--blank { display: grid; place-items: center; width: 150px; border: 1.5px solid rgba(255, 226, 163, .6); border-radius: 8px; background: linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)); box-shadow: 0 0 34px rgba(246, 198, 106, .25); }
.po-covers--3 .po-cover--blank { width: 120px; }
.po-cover__tag { position: absolute; right: -4px; top: -12px; z-index: 4; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; max-width: 150px; height: 32px; padding: 0 11px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 14px; font-weight: 800; white-space: nowrap; box-shadow: 0 6px 18px rgba(13, 10, 28, .4); }
.po-covers--2 .po-cover:nth-child(1) .po-cover__tag, .po-covers--3 .po-cover:nth-child(1) .po-cover__tag { right: auto; left: -10px; }
.po-covers--3 .po-cover__tag { top: -8px; height: 26px; padding: 0 8px; font-size: 12px; }
.po-cover__more { position: relative; z-index: 5; align-self: flex-end; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 32px; margin-left: -10px; padding: 0 11px; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 14px; font-weight: 800; box-shadow: 0 6px 18px rgba(13, 10, 28, .4); }
.po-covers__empty { position: relative; display: grid; place-items: center; width: 150px; height: 224px; padding: 16px; border: 1.5px dashed rgba(255, 226, 163, .45); border-radius: 8px; text-align: center; font-size: 14px; font-weight: 700; color: var(--lilac); }

.po-lines { margin: 8px 0 0; padding: 0; list-style: none; }
.po-lines:empty { display: none; }
.po-lines__item { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-dark); }
.po-lines__text { min-width: 0; }
.po-lines__name { display: block; font-size: 15px; font-weight: 800; line-height: 1.3; color: var(--cream); overflow-wrap: anywhere; }
.po-lines__sub { display: block; margin-top: 1px; font-size: 13.5px; font-weight: 600; color: var(--lilac); }
.po-lines__sum { font-size: 15px; font-weight: 800; white-space: nowrap; color: var(--cream); }
.po-order .po__edit { align-self: flex-start; min-width: 44px; min-height: 44px; padding: 0 10px 0 0; border: 0; background: none; color: var(--peach); font: 700 14.5px/1.2 var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.po-order .po__edit:hover { color: var(--gold-hi); }
.modal--po .po-order :focus-visible { outline-color: var(--gold); }
/* Сама панель прокручивается и берёт фокус с клавиатуры (tabindex="0"), чтобы её можно было листать стрелками; контур — внутри, чтобы не обрезался. */
.modal--po .po-order:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

.po-order__ship { display: flex; flex-direction: column; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line-dark); }
.po-order__shiphead { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.po-order__shiptitle { font-size: 15px; font-weight: 800; color: var(--cream); }
.po-order__shipcost { font-size: 14px; font-weight: 700; color: var(--lilac); text-align: right; }
.po-order__shipcost:empty, .po-order__shipplace:empty { display: none; }
.po-order__shipname { margin: 4px 0 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; color: var(--cream); overflow-wrap: anywhere; }
.po-order__shipplace { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; color: var(--lilac); overflow-wrap: anywhere; }

.po-order__priceblock { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(246, 198, 106, .45); }
.po-order__price { margin: 0; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; color: var(--gold-hi); white-space: normal; }
.po-order__price-note { margin: 8px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.45; color: var(--lilac); }
.po-sums { margin-top: auto; padding-top: 10px; }
.po-sums__row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line-dark); font-size: 15px; font-weight: 700; color: var(--lilac); }
.po-sums__row b { font-weight: 800; color: var(--cream); white-space: nowrap; }
.po-sums__row--hint b { font-size: 13.5px; font-weight: 600; color: var(--lilac); text-align: right; white-space: normal; }
.po-order__final { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 4px; padding-top: 14px; border-top: 1px solid rgba(246, 198, 106, .45); }
.po-sums[hidden] + .po-order__final { margin-top: auto; }
.po-order__final-label { font-size: 16px; font-weight: 800; color: var(--cream); }
.po-order__final-sub { display: block; font-size: 13px; font-weight: 600; color: var(--lilac); }
.po-order__final-sum { font-size: 30px; line-height: 1; font-weight: 800; letter-spacing: -.02em; text-align: right; color: var(--gold-hi); white-space: normal; }
.po-order__note { margin: 14px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.45; color: var(--lilac); }

/* ---------- Окно: плашка ---------- */
/* Плашка заявки — кнопка над рабочей частью; видна только на телефоне (на компьютере её скрывает раздел «Окно: каркас»). */
@media (max-width: 859px) {
  .po-bar {
    display: flex; align-items: center; gap: 12px; flex: none;
    width: 100%; height: 68px; padding: 10px 16px; border: 0; border-radius: 0;
    background: radial-gradient(circle at 12% 0%, rgba(246, 198, 106, .2) 0%, rgba(246, 198, 106, 0) 60%), var(--dawn-deep);
    box-shadow: 0 1px 0 var(--line-dark);
    color: var(--cream); font: inherit; text-align: left; cursor: pointer;
  }
  .po-bar:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; border-radius: 0; }
  .po-bar__thumbs { display: flex; flex: none; padding-left: 4px; }
  .po-bar__thumbs:empty { display: none; }
  .po-bar__thumbs img {
    display: block; width: auto; max-width: none; height: 46px; border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 226, 163, .7), 0 0 16px rgba(246, 198, 106, .45);
    transform: rotate(-4deg);
  }
  .po-bar__thumbs img + img { margin-left: -12px; transform: rotate(4deg); }
  .po-bar__text { flex: 1; min-width: 0; line-height: 1.25; }
  .po-bar__title { display: block; overflow: hidden; font-size: 15px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
  .po-bar__count { display: block; overflow: hidden; font-size: 13.5px; font-weight: 600; color: var(--lilac); white-space: nowrap; text-overflow: ellipsis; }
  .po-bar__sum { flex: none; font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--gold-hi); white-space: nowrap; }
  .po-bar__chev { flex: none; color: var(--lilac); }
  .po-bar[aria-expanded="true"] .po-bar__chev { transform: rotate(180deg); }
}

/* ---------- Узкие экраны: до 859px ---------- */
/* Телефон и узкое окно: окно на весь экран; сверху плашка, лента с крестиком, содержимое шага, полоса. Панель заявки раскрывается
   поверх всего под плашкой (класс po-order--open ставит скрипт). Порог 859/860 — как у сцены дерева. */
@media (max-width: 859px) {
  .modal.modal--po[open] {
    display: flex; flex-direction: column;
    inset: 0; width: 100%; max-width: none; margin: 0;
    height: 100vh; height: 100dvh; max-height: none;
    border-radius: 0; box-shadow: none;
  }
  .modal--po .po-work { flex: 1 1 auto; min-width: 0; min-height: 0; }
  .modal--po .po-top { justify-content: flex-end; padding: 8px 12px 0 20px; }   /* на «Готово» ленты нет: крестик справа, под ним не остаётся пустого места слева */
  .modal--po .po-steps { max-width: none; gap: 8px; }
  .modal--po .po__title { font-size: 26px; }
  .modal--po .po__done .po__ring { margin: 4px 0 14px; }
  .modal--po .po__done .po__title { font-size: 28px; }
  .modal--po .po__done .po__mail { font-size: 17px; }
  .modal--po .po__done .po__note { font-size: 16px; }
  .modal--po .po__done .po__actions .po__close { width: 100%; margin: 0; }   /* «Закрыть» на всю ширину полосы, как в макете */
  .modal--po .po__scroll { padding: 12px 20px 20px; }
  .modal--po .po__foot { padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .modal--po .po__actions { gap: 10px; }
  .modal--po .po__actions .btn { width: auto; }
  .modal--po .po__next, .modal--po .form__submit { flex: 1 1 auto; min-width: 0; padding: 0 20px; }
  .modal--po .po__book { padding: 16px 16px 4px; }
  .modal--po .po__book-title { font-size: 17px; }
  .modal--po .po__row { gap: 10px; }
  .modal--po .form__grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  /* панель заявки: свёрнута; раскрытая закрывает ленту, шаг и полосу до низа окна */
  .modal--po .po-order {
    position: absolute; left: 0; right: 0; top: 68px; bottom: 0; z-index: 5;
    display: none; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  }
  .modal--po .po-order.po-order--open { display: flex; flex-direction: column; }
  .modal--po .po-order__in { padding: 8px 20px 22px; }
  /* заголовок и число книг панели повторяют плашку: на экране их нет, для чтения с экрана остаются; штамп «заявка принята» виден */
  .modal--po .po-order__head { gap: 0; min-height: 0; margin: 0; padding: 0; justify-content: flex-end; }
  .modal--po .po-order__title, .modal--po .po-order__count {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .modal--po .po-order__stamp { margin: 6px 0 0; }
  .modal--po .po-order .po-covers { height: 240px; margin: 6px 0 4px; }
  .modal--po .po-order .po-covers::before { width: 240px; height: 190px; }
  .modal--po .po-order .po-covers .po-cover,
  .modal--po .po-order .po-covers--1 .po-cover { height: 210px; }
  .modal--po .po-order .po-covers__empty { width: 130px; height: 190px; }
  /* в раскрытой панели телефона блок цены идёт следом за составом, а не прижат к низу (большой просвет читался как пустота) */
  .modal--po .po-order .po-order__priceblock,
  .modal--po .po-order .po-sums,
  .modal--po .po-order .po-sums[hidden] + .po-order__final { margin-top: 24px; }
}

/* ---------- Узкие экраны: до 380px ---------- */
@media (max-width: 380px) {
  .modal--po .po__book { padding-left: 12px; padding-right: 12px; }
  .modal--po .po__dig-face { min-width: 108px; padding: 0 12px; }
  .modal--po .po__row-text { flex-basis: 120px; }   /* строка «Печатная книга»: счётчик остаётся рядом с подписью, а не переносится под неё */
  .modal--po .po-steps .po-steps__label { font-size: 12.5px; }
  .po-bar__sum { font-size: 19px; }
  .po-bar__thumbs img { height: 40px; }
}

.price-after { display: block; margin-top: 1px; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--muted); }
.price-after s { text-decoration-thickness: 1px; }
