/* Native 431–860px grid. Exact tablet anchors: 770:68017 / 770:72556. */
@media (min-width: 431px) and (max-width: 860px) ,  (width > 430px) and (max-width: 860px) {
  /* [155]: min-height:100svh на наборах с 2–3 вкусами оставлял пустой
     хвост экрана до подвала — тот же баг уже чинили на ПК ([19].5).
     Высота страницы теперь по контенту. */
  body.tablet-flow :is(.set-composition-page,.edit-set-page) { width: 100%; min-width: 0; min-height: auto; padding: 0; overflow: visible; }
  /* [151]: у плашки не было верхней/боковой тени — box-shadow отсутствовал
     вовсе. Значения сняты с Figma-узла 770:38012 (тот же набор, что и
     desktop .sv-head/.es-sticky-head, только blur внешней тени 24 вместо
     12 — так в макете для планшета). */
  body.tablet-flow :is(.sv-head,.es-sticky-head) {
    position: sticky; top: 0; height: auto; min-height: 249px; padding: 35px 50px 36px;
    box-shadow: inset -4px -4px 10px #fff, inset 2px 2px 11px rgba(231,205,177,.9), 4px 4px 24px rgba(214,191,167,.45);
  }
  /* Full live ingredients can exceed the viewport; do not let a tall sticky
     summary permanently cover the selectable flavour grid. */
  /* [212]/[221]: тот же приём для page-edit-set.php — иначе длинный
     состав держит фиксированную шапку выше сетки вкусов. */
  body.tablet-flow :is(.set-composition-page .sv-head,.edit-set-page .es-sticky-head).sv-head--long-content { position: static; }
  body.tablet-flow .sv-back { position: relative; display: flex; width: fit-content; inset: auto; font-size: 12px; line-height: 16px; }
  /* Keep the product metadata wide enough for its readable edit label at
     700px, while returning to the authored 40px gap at the 860px reference. */
  body.tablet-flow .sv-summary { position: relative; inset: auto; display: grid; grid-template-columns: minmax(0,303fr) minmax(0,420fr); align-items: start; gap: 40px; height: auto; margin-top: 50px; }
  body.tablet-flow .sv-product { min-width: 0; width: 100%; height: auto; min-height: 84px; align-items: start; }
  /* [150]: the photo stays 84px high; let metadata grow when the title
     wraps so neither title lines nor the edit link are clipped. */
  body.tablet-flow .sv-product__meta { min-width: 0; height: auto; max-height: none; min-height: 0; gap: 8px; overflow: hidden; }
  body.tablet-flow .sv-product__title { margin-top: 0; white-space: normal; font-size: 15px; line-height: 18px; overflow-wrap: anywhere; }
  body.tablet-flow .edit-set-page .sv-product__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  body.tablet-flow .sv-product__bottom { flex-wrap: wrap; gap: 5px 12px; }
  /* [213]: кнопка «изменить состав» была мельче веса (8px против 11px) —
     трудно читаемая. Figma держит подписи одного кегля, выравниваем. */
  body.tablet-flow .sv-product__edit { flex-basis: 100%; font-size: 11px; }
  /* [73]/[77]: keep controls at the photo's lower edge for short titles,
     and let the metadata row grow when a title wraps. */
  body.tablet-flow .set-composition-page .sv-product__meta {
    display: flex;
    box-sizing: border-box;
    height: auto;
    min-height: 84px;
    padding: 4px 0 2px;
    gap: 0;
    overflow: visible;
  }
  body.tablet-flow .set-composition-page .sv-product__bottom {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 2px;
    min-width: 0;
    transform: translateY(4px);
  }
  body.tablet-flow .set-composition-page .sv-product__weight { white-space: nowrap; }
  body.tablet-flow .set-composition-page .sv-product__edit { min-width: 0; }
  body.tablet-flow .set-composition-page .sv-product__edit {
    width: auto;
    flex-basis: auto;
    font-size: 11px;
    line-height: 14px;
    text-align: left;
    overflow-wrap: anywhere;
  }
  /* [77]/[80]: align the editor's weight text to the same photo backing. */
  body.tablet-flow .edit-set-page .sv-product__meta {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    box-sizing: border-box;
    height: 84px;
    padding: 4px 0 2px;
    gap: 0;
    overflow: visible;
  }
  /* [73].1/[77].1.1/[77].2.1: убираем серую подложку под фото набора. */
  body.tablet-flow .sv-product__photo { background: transparent; }
  body.tablet-flow .sv-product__photo img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; filter: none; }
  body.tablet-flow .sv-ingredients { width: 100%; height: auto; min-height: 112px; overflow: visible; font-size: 10px; line-height: 14px; margin: 0; }
  body.tablet-flow :is(.sv-mobile-hint,.es-hint) { display: none; }
  body.tablet-flow .set-composition-page { padding-bottom: 60px; }
  body.tablet-flow :is(.sv-grid,.es-grid,.es-add-grid) { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); grid-auto-rows: auto; gap: 10px 16px; width: 100%; height: auto; min-height: 0; margin: 40px 0 0; padding: 0 46px; overflow: visible; }
  body.tablet-flow :is(.sv-flavor,.es-grid .es-tile,.es-add-grid .es-tile) { display: grid; grid-template-rows: minmax(17px,auto) 68px 28px; align-content: start; justify-items: center; width: 100%; height: auto; min-height: 130.5px; padding: 5px 0 12.5px; overflow: visible; }
  body.tablet-flow :is(.sv-flavor__name,.sm-tile__name) { position: relative; inset: auto; width: 100%; margin: 0; font: 100 14px/17px var(--font-display); letter-spacing: .06em; text-align: center; overflow-wrap: anywhere; color: #401c0c; }
  /* [226]: фото макарона было 160×52 — крупнее, чем в макете (Figma
     770:68017: контейнер фото в плитке ~150×49px при ширине плитки 180px). */
  body.tablet-flow .sv-flavor__photo { position: relative; inset: auto; width: min(var(--photo-w,140px),100%); height: 46px; align-self: center; transform: none; display: flex; align-items: center; justify-content: center; }
  /* [p333]: редакторный vanilla image 770:72609 — 150.438×45.75px. */
  body.tablet-flow .sm-tile__photo { position: relative; inset: auto; width: min(var(--photo-w,150px),100%); height: 46px; align-self: center; transform: none; display: flex; align-items: center; justify-content: center; }
  body.tablet-flow :is(.sv-flavor__photo,.sm-tile__photo) img { width: 100%; height: 100%; max-width: 100%; object-fit: contain; }
  body.tablet-flow .sv-flavor__qty { position: relative; inset: auto; }
  body.tablet-flow .es-stage { width: 100%; height: auto; margin: 0; padding-bottom: calc(74px + max(28px,env(safe-area-inset-bottom)) + 12px); box-sizing: border-box; zoom: 1; }
  body.tablet-flow .es-grid { margin-bottom: 0; }
  body.tablet-flow .es-stepper { position: relative; inset: auto; transform: none; height: 28px; align-self: center; }
  body.tablet-flow .es-stepper__btn { position: relative; }
  body.tablet-flow .es-stepper__btn::after { content: ''; position: absolute; inset: -11px; }
  body.tablet-flow .es-stepper__val { padding: 0; display: flex; align-items: center; justify-content: center; color: #b01e2b; }
  body.tablet-flow .es-grid .es-add-tile { width: 100%; height: auto; min-height: 130.5px; }
  body.tablet-flow .es-add-btn { width: min(160px,100%); min-height: 46px; height: auto; padding: 12px; }
  /* [224]: попап «добавить вкус» — красная подчёркнутая ссылка не из
     макета; в Figma (как и на десктопе, main.style.css:8644/8781) это
     белая нейморфная пилюля без подчёркивания. */
  body.tablet-flow .es-add-flavor {
    width: 100px; min-width: 100px; height: 28px; padding: 0 28px;
    border-radius: 80px; box-sizing: border-box;
    background: linear-gradient(103.249deg,#fff6ed 15.549%,#f5e8db 90.822%);
    box-shadow: inset -4px -4px 10px #fff,inset 2px 2px 11px rgba(231,205,177,.9);
    filter: drop-shadow(4px 4px 7px rgba(214,191,167,.45));
    font-family: var(--font-body); font-size: 10px; font-weight: 500;
    line-height: normal; letter-spacing: .3px; text-decoration: none; color: #b01e2b;
  }
  body.tablet-flow .es-add-flavor:hover { transform: scale(1.02); background: linear-gradient(103.249deg,#fff6ed 15.549%,#f5e8db 90.822%); }
  body.tablet-flow .es-done-bar { position: fixed; inset: auto 0 0; z-index: 12; width: 100%; height: auto; min-height: calc(74px + max(28px,env(safe-area-inset-bottom))); margin: 0; padding: 28px 50px max(28px,env(safe-area-inset-bottom)); box-sizing: border-box; }
  body.tablet-flow .sm-panel { width: 100%; max-height: calc(100dvh - 40px); overflow-y: auto; }
  body.tablet-flow .edit-set-page .sm-overlay { z-index: 1100; }
  body.tablet-flow .es-add-grid { margin-top: 0; padding: 0; }
  body.tablet-flow .es-popup__panel { max-width: 100%; }
  body.tablet-flow .es-popup__cancel { min-width: 0; max-width: 100%; height: auto; min-height: 54px; }
  body.tablet-flow .set-ingredients-dialog { position: fixed; inset: 0; width: min(430px,100%); max-width: 100%; min-height: min(500px,80dvh); max-height: 90dvh; margin: auto; padding: 24px 40px 40px; border: 0; border-radius: 32px; color: #401c0c; background: linear-gradient(93deg,#fff6ed 15.549%,#f5e8db 90.822%); box-shadow: inset -4px -4px 10px #fff,inset 2px 2px 11px rgba(231,205,177,.9),4px 4px 24px rgba(214,191,167,.45); overflow-y: auto; }
  body.tablet-flow .set-ingredients-dialog::backdrop { background: rgba(0,0,0,.4); backdrop-filter: blur(4px); }
  body.tablet-flow .set-ingredients-dialog form { text-align: right; margin: 0 0 24px; }
  body.tablet-flow .set-ingredients-dialog__close { min-width: 44px; min-height: 44px; border: 0; color: inherit; background: none; font-size: 28px; cursor: pointer; }
  body.tablet-flow .set-ingredients-dialog h2 { margin: 0 0 24px; font: 100 32px/1.15 var(--font-display); letter-spacing: .06em; text-align: center; text-transform: uppercase; }
  body.tablet-flow .set-ingredients-dialog p { margin: 0; font: 14px/1.35 var(--font-body); }
  body.tablet-flow .sm-tile__photo[role="button"] { cursor: pointer; }
  body.tablet-flow :is(.sm-tile__photo[role="button"],.sv-flavor):focus-visible { outline: 2px solid #b01e2b; outline-offset: 4px; border-radius: 8px; }
}
/* Снят подбрейкпоинт «@media (min-width: 431px) and (max-width: 699px)»: полоса 431–860 показывает один макет 860, разницу делает zoom. */

/* Снят подбрейкпоинт «@media (min-width: 700px) and (max-width: 809px)»: полоса 431–860 показывает один макет 860, разницу делает zoom. */

/* [77]/[80]: нормализованные вырезки sostav — единый холст на все вкусы. */
@media (min-width: 431px) and (max-width: 860px) , (width > 430px) and (max-width: 860px){
  body.tablet-flow .edit-set-page .sm-tile__photo { width: min(176px,100%); height: 60px; }
  body.tablet-flow .edit-set-page .sm-tile__photo img { width: 100%; height: auto; max-height: none; object-fit: fill; filter: none; }
}

/* On short landscape/tablet-height viewports, a sticky composition summary can
   cover the entire working area even when its text fits on a normal page. */
@media (min-width: 431px) and (max-width: 860px) and (max-height: 600px) ,  (width > 430px) and (max-width: 860px) and (max-height: 600px) {
  body.tablet-flow .set-composition-page .sv-head { position: static; }
}
