/* Phone commerce geometry; existing theme tokens, artwork and DOM are retained.
 * Figma source: 742:635 (cart), 736:28992 (checkout/pickup).
 * Load after legacy commerce styles, only for the explicit phone-flow routes.
 */
.co-cert .co-pay__hint-copy--compact { display: none; }

@media (max-width: 430px) {
  body.phone-flow .cart-page,
  body.phone-flow .checkout-page,
  body.phone-flow .cart-page .ct-wrap,
  body.phone-flow .checkout-page .co-wrap {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  body.phone-flow .ct-body {
    grid-template-columns: minmax(0, 1fr);
  }

  body.phone-flow .ct-summary {
    position: static;
    min-width: 0;
  }

  /* Keep photo/info and controls in the same row when there is room. Unlike
   * a scaled canvas, narrow phones move controls into their own real row. */
  body.phone-flow .ct-item__row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  body.phone-flow .ct-item__main {
    flex: 1 1 210px;
    min-width: 0;
  }

  body.phone-flow .ct-item__info {
    height: auto;
    min-height: 84px;
    justify-content: flex-start;
  }

  body.phone-flow .ct-item__side {
    flex: 0 0 auto;
    height: auto;
    min-height: 84px;
    margin-left: auto;
  }

  body.phone-flow .ct-item__title {
    overflow-wrap: break-word;
  }

  body.phone-flow .ct-item__links { display: none; }

  body.phone-flow .ct-item__pills {
    display: flex;
    flex-wrap: wrap;
  }

  body.phone-flow .ct-item__pill {
    flex: 1 1 130px;
    min-width: 0;
    height: auto;
    min-height: 46px;
    white-space: normal;
  }

  /* The glyph stays 15px; the surrounding transparent area is clickable. */
  body.phone-flow .ct-item__remove {
    min-width: 24px;
    min-height: 28px;
    justify-content: center;
    align-items: center;
  }

  body.phone-flow .ct-sum-row__label {
    min-width: 0;
    white-space: normal;
    line-height: 14px;
  }

  body.phone-flow .ct-sum-row__value { flex-shrink: 0; }

  body.phone-flow .ct-empty {
    padding-inline: clamp(20px, 9.302vw, 40px);
  }

  body.phone-flow .ct-empty__actions .btn {
    white-space: normal;
    height: auto;
    min-height: 56px;
  }

  body.phone-flow .checkout-page .co-card,
  body.phone-flow .checkout-page .co-summary {
    width: 100%;
    min-width: 0;
    padding: 44px clamp(20px, 10.233vw, 44px);
    border-radius: 32px;
    background: linear-gradient(95deg, #fff6ed 15.549%, #f5e8db 90.822%);
    box-shadow: inset -4px -4px 10px #fff,
      inset 2px 2px 11px rgba(231, 205, 177, .9),
      4px 4px 12px rgba(214, 191, 167, .45);
  }

  body.phone-flow .checkout-page { padding-top: 89px; padding-bottom: 60px; }
  body.phone-flow .co-back { margin-bottom: 32px; font-size: 14px; }
  body.phone-flow .co-steps { margin-bottom: 68px; }
  body.phone-flow .co-step__label { font-size: 10px; top: calc(100% + 16px); }
  body.phone-flow .co-notes { margin: 0 25px 39px; gap: 10px; }
  body.phone-flow .co-notes li { font-size: 14px; line-height: 17px; gap: 15px; }
  body.phone-flow .co-notes b { font-weight: 500; }
  body.phone-flow .co-notes li:last-child > :last-child { max-width: 304px; }
  body.phone-flow .co-star { width: 22px; height: 22px; }
  body.phone-flow .co-grid,
  body.phone-flow .co-col-main { gap: 20px; }
  body.phone-flow .co-card__title {
    font-size: clamp(24px, 6.512vw, 28px);
    line-height: calc(1em + 4px);
    letter-spacing: .06em;
    margin-bottom: 36px;
  }
  body.phone-flow .co-summary .co-card__title { margin-bottom: 36px; }
  body.phone-flow .co-field { gap: 12px; }
  body.phone-flow .co-hint { font-size: 14px; line-height: normal; }
  body.phone-flow .co-field--note { margin-top: 36px; }
  body.phone-flow .co-field__label,
  body.phone-flow .co-radio { font-size: 14px; line-height: 16px; }
  body.phone-flow .co-input { height: 48px; padding-inline: 20px; }
  body.phone-flow .co-input { border-width: .5px; border-color: #b01e2b; border-radius: 23.5px; }
  body.phone-flow .co-input::placeholder { color: #6e6e6e; }
  body.phone-flow .co-radio__dot { width: 16px; height: 16px; border-width: 1px; }
  body.phone-flow .co-logo-mc { width: 34px; height: 26px; }
  body.phone-flow .co-logo-visa { width: 47px; height: 15px; }
  body.phone-flow .co-logo-pk { width: 53px; height: 15px; }
  body.phone-flow .co-pay__logos { gap: 7px; }
  body.phone-flow .co-pay__gift { display: flex; line-height: 0; }
  body.phone-flow .co-pay__hint { margin: 2px 0 0 26px; }
  body.phone-flow .co-cert__input,
  body.phone-flow .co-promo,
  body.phone-flow .co-cert__ok { height: 56px; }
  body.phone-flow .co-items li { font-size: 14px; line-height: 16px; align-items: flex-end; }
  body.phone-flow .co-items b,
  body.phone-flow .co-totals__row,
  body.phone-flow .co-ship__row { font-size: 14px; }
  body.phone-flow .co-final { font-size: 16px; }
  body.phone-flow .co-consent { font-size: 14px; line-height: 16px; gap: 14px; }
  body.phone-flow .co-submit { font-size: 14px; }

  /* Checkout summary uses the same 28px section rhythm as the live Figma
   * frame; dividers separate totals, delivery choice and final amount. */
  body.phone-flow .co-summary .co-promo { margin-bottom: 28px; }
  body.phone-flow .co-promo { border-color: #cf842d; }
  body.phone-flow .co-totals__row--accent dt,
  body.phone-flow .co-totals__row--accent dd { color: #d28b5c; }
  body.phone-flow .co-summary .co-divider { margin: 28px 0; }
  body.phone-flow .co-mid { gap: 28px; }
  body.phone-flow .co-totals,
  body.phone-flow .co-ship { gap: 12px; }
  body.phone-flow .co-ship {
    padding-top: 28px;
    border-top: 1px solid rgba(157, 31, 42, .35);
  }
  body.phone-flow .co-summary .co-final { margin-bottom: 36px; }
  body.phone-flow .co-consent { max-width: 286px; margin-bottom: 33px; }
  body.phone-flow .co-cert .co-pay__hint { margin-top: 12px; font-size: 12px; line-height: 14px; }

  body.phone-flow .co-grid,
  body.phone-flow .co-col-main,
  body.phone-flow .co-field,
  body.phone-flow .co-fields {
    min-width: 0;
  }

  body.phone-flow .co-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Real CSS-pixel text prevents automatic input zoom and canvas shrinkage.
   * Intentional usability deviation from the legacy 12–14px field values. */
  body.phone-flow .ct-promo__input,
  body.phone-flow .co-input,
  body.phone-flow .co-cert__input,
  body.phone-flow .co-promo {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  /* [64].* / [65].3.2 / [69].3.2 / [69].4.1: клиент просил уменьшить
   * плейсхолдеры «введите промокод» и «введите свс-код». Сам инпут не
   * трогаем (16px нужен, иначе Safari зумит поле при фокусе), а надпись
   * даём 12px — как в макете. */
  body.phone-flow .ct-promo__input::placeholder,
  body.phone-flow .co-promo::placeholder,
  body.phone-flow .co-cert__input::placeholder { font-size: 12px; }

  /* [134]: both payment hints use Figma's 26px inset from the card content. */

  body.phone-flow .co-notes li > :last-child { min-width: 0; }
  body.phone-flow .co-star,
  body.phone-flow .co-radio__dot { flex-shrink: 0; }

  body.phone-flow .co-pay__row {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  body.phone-flow .co-pay__logos { flex-shrink: 0; }

  body.phone-flow .co-items li > span,
  body.phone-flow .co-totals__row dt {
    min-width: 0;
    overflow-wrap: break-word;
  }

  body.phone-flow .co-items li > b,
  body.phone-flow .co-totals__row dd { flex-shrink: 0; }

  body.phone-flow .co-scheduler { max-width: 100%; }
  body.phone-flow .co-cal { min-width: 0; max-width: 100%; }
  body.phone-flow .co-cal__grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  /* A short viewport scrolls the dialog itself; text/map actions stay in flow.
   * Absolute positioning is retained only for the dialog's close icon. */
  body.phone-flow #co-after-hours.sm-overlay {
    align-items: flex-start;
    padding: max(16px, env(safe-area-inset-top)) 0
      max(16px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  body.phone-flow #co-after-hours .co-afterhours-panel {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 430px;
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body.phone-flow #co-after-hours .co-afterhours-panel__lead,
  body.phone-flow #co-after-hours .co-afterhours-panel__sub {
    max-width: 100%;
  }

  body.phone-flow #co-after-hours .co-afterhours-loc {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
    min-height: 177px;
    gap: 16px;
  }

  body.phone-flow #co-after-hours .co-afterhours-loc__left {
    flex-direction: row;
    min-width: 0;
    padding-left: 0;
  }

  body.phone-flow #co-after-hours .co-afterhours-loc__left > :last-child {
    min-width: 0;
  }

  body.phone-flow #co-after-hours .co-afterhours-loc__map {
    position: static;
    width: 100%;
    min-height: 56px;
    height: auto;
    white-space: normal;
  }
}

/* The 375px DOCX target needs two readable lines. Preserve every detail and
 * the authored 430px wording by shortening only its redundant phrasing. */
@media (max-width: 375px) {
  body.phone-flow .co-cert .co-pay__hint-copy--wide { display: none; }
  body.phone-flow .co-cert .co-pay__hint-copy--compact { display: inline; }
}
