/* ═══════════════════════════════════════════════════════════════
   V70 — размеры товаров, чат поддержки, телефон в профиле
   Загружается ПОСЛЕДНИМ: выравнивает то, что наслоилось в v57–v68.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Сетка товаров: всегда 2 колонки на телефоне, без «гигантских» карточек ── */
.pdd-catalog-grid,
.pdd-home .pdd-catalog-grid,
.pdd-catalog .pdd-catalog-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:12px!important;
  align-items:stretch!important;
}
.pdd-catalog-grid>*{min-width:0}
@media(min-width:600px){.pdd-catalog-grid,.pdd-home .pdd-catalog-grid,.pdd-catalog .pdd-catalog-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:14px!important}}
@media(min-width:900px){.pdd-catalog-grid,.pdd-home .pdd-catalog-grid,.pdd-catalog .pdd-catalog-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:16px!important}}
@media(min-width:1200px){.pdd-catalog-grid,.pdd-home .pdd-catalog-grid,.pdd-catalog .pdd-catalog-grid{grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:18px!important}}

/* Карточка: фото 1:1 с аккуратным кадром, текст в 2 строки, кнопка не переносится */
.pdd-product-card{gap:8px!important;border-radius:16px!important;height:100%}
.pdd-product-card .pdd-media,
.pdd-product-card .pdd-img-wrap{
  width:100%!important;height:auto!important;aspect-ratio:1/1!important;border-radius:0!important;
}
.pdd-product-card .pdd-img-wrap img{width:100%!important;height:100%!important;object-fit:cover}
.pdd-product-card > div:last-child{padding:0 10px 10px!important;gap:6px!important;flex:1}
.pdd-product-card button[aria-label]:not(.pdd-fav){
  white-space:nowrap!important;font-size:12.5px!important;padding:9px 6px!important;
  display:flex!important;align-items:center;justify-content:center;gap:5px;overflow:hidden;text-overflow:ellipsis;
}
.pdd-product-card button[aria-label]:not(.pdd-fav) svg{flex-shrink:0}
@media(max-width:380px){.pdd-product-card button[aria-label]:not(.pdd-fav) svg{display:none}}

/* ── 2. Страница товара: один слой отступов (раньше 16+16=32px), галерея на всю ширину ── */
@media(max-width:1099px){
.pdd-product-page{
  padding-left:0!important;padding-right:0!important;padding-bottom:12px!important;
  max-width:640px!important;gap:0!important;
}
.pdd-product-page > div:first-child{width:100%}
.pdd-product-page .pdd-gallery-shell,
.pdd-product-page > div:first-child{border-radius:0 0 24px 24px!important;overflow:hidden}
.pdd-product-page .pdd-img-wrap{
  width:100%!important;height:auto!important;aspect-ratio:1/1;max-height:min(100vw,560px);border-radius:0!important;
}
.pdd-product-page .pdd-img-wrap img{object-fit:contain!important;background:#fff}
.pdd-product-page > div:nth-child(2){padding:18px 16px 0!important}
.pdd-product-page h1{font-size:20px!important;line-height:1.3!important;overflow-wrap:anywhere}
/* Выбор размера/цвета — крупные, удобные для пальца, не ломаются */
.pdd-product-page [role="radiogroup"] button,
.pdd-product-page .pdd-chip{min-width:46px;min-height:44px}
/* «Похожие товары» внутри страницы — те же 2 колонки */
.pdd-product-page .pdd-catalog-grid{padding:0!important}
/* Нижняя панель покупки: во всю ширину страницы, текст не режется */
.pdd-buybar{padding-left:16px!important;padding-right:16px!important;border-radius:20px 20px 0 0}
.pdd-buybar button{min-width:0!important;white-space:nowrap}
}

/* ── 3. Чат поддержки: список сообщений занимает всё свободное место, поле ввода — внизу ── */
.pdd-chat-root{
  display:flex!important;flex-direction:column!important;
  flex:1 1 auto!important;min-height:0!important;
  height:calc(100dvh - env(safe-area-inset-top,0px))!important;max-height:100dvh;
  overflow:hidden!important;
}
.pdd-chat-scroll{
  position:static!important;inset:auto!important;
  flex:1 1 0!important;height:auto!important;min-height:0!important;
  overflow-y:auto!important;overflow-x:hidden!important;
  padding:14px 16px!important;
  display:flex!important;flex-direction:column!important;gap:10px!important;
  overscroll-behavior:contain;scroll-behavior:smooth;
}
.pdd-chat-scroll > *{flex-shrink:0;max-width:100%}
.pdd-chat-root > div:last-child{padding-bottom:max(10px,env(safe-area-inset-bottom,0px))}
.pdd-chat-root input,.pdd-chat-root textarea{font-size:16px!important;min-width:0}
@media(min-width:1100px){.pdd-chat-root{max-width:720px;margin:0 auto;width:100%;height:calc(100vh - 100px)!important}}

/* ── 4. Телефон в профиле ── */
.pdd-phone-card{
  margin:14px 0 0;padding:14px;border-radius:18px;background:#fff;color:var(--ink);
  box-shadow:0 8px 24px rgba(40,10,110,.18);
}
.pdd-phone-card b{display:block;font-size:14px;font-weight:800;margin-bottom:2px}
.pdd-phone-card p{margin:0 0 10px;font-size:12px;line-height:1.4;color:var(--ink2)}
.pdd-phone-row{display:flex;gap:8px;align-items:stretch}
.pdd-phone-row input{
  flex:1;min-width:0;height:46px;border-radius:12px;border:1.5px solid var(--line);background:var(--surf2);
  padding:0 12px;font-size:16px;font-weight:600;color:var(--ink);outline:none;font-family:var(--bd);
}
.pdd-phone-row input:focus{border-color:var(--accent);background:#fff}
.pdd-phone-row button{
  height:46px;padding:0 16px;border-radius:12px;border:none;background:var(--brand-grad);color:#fff;
  font-weight:800;font-size:14px;cursor:pointer;white-space:nowrap;
}
.pdd-phone-row button:disabled{opacity:.55;cursor:default}
.pdd-phone-err{margin-top:8px;font-size:12px;color:var(--del);font-weight:600}
.pdd-hero-phone{
  display:inline-flex;align-items:center;gap:6px;margin-top:4px;padding:5px 10px;border-radius:999px;
  background:rgba(255,255,255,.16);font-weight:700;font-size:13.5px;letter-spacing:.2px;color:#fff;
}
.pdd-hero-phone button{border:none;background:none;color:#fff;font-size:12px;font-weight:700;text-decoration:underline;cursor:pointer;padding:0 0 0 4px}

@media(max-width:1099px){
/* Галерея товара: квадрат на всю ширину (раньше ограничивалась 72vw и выглядела «обрезанной») */
.pdd-product-page .pdd-gallery-shell,
.pdd-product-page > div:first-child{
  height:auto!important;max-height:none!important;aspect-ratio:auto!important;
}
.pdd-product-page .pdd-img-wrap{
  aspect-ratio:1/1!important;max-height:min(100vw,520px)!important;height:auto!important;
}
.pdd-product-page .pdd-img-wrap img{height:100%!important}
}

/* Поиск в каталоге: прозрачное поле внутри белой «пилюли» (раньше — серая плашка поверх белой) */
.pdd-catalog input:not([type=checkbox]):not([type=radio]){background:transparent!important;box-shadow:none!important;border:none!important}
.pdd-hero-phone{white-space:nowrap;max-width:100%;font-size:13px;padding:5px 10px}
.pdd-hero-phone button{flex-shrink:0;font-size:11.5px;opacity:.9}
.pdd-hero-phone{align-self:flex-start}

/* Каталог: строка поиска не вытесняет кнопку фильтра за край экрана */
.pdd-catalog > div:first-child > div:first-child{min-width:0;max-width:100%}
.pdd-catalog > div:first-child > div:first-child > *{min-width:0}
.pdd-catalog input{min-width:0!important;width:100%}
.pdd-catalog-filter-btn{flex:0 0 44px!important}

/* ── Десктоп ≥1100px: широкая сетка каталога и двухколоночная страница товара (раньше всё сжималось в 560px) ── */
@media(min-width:1100px){
  .pdd-home,.pdd-catalog,.pdd-cart{max-width:1240px!important;padding-left:0!important;padding-right:0!important}
  .pdd-product-page{max-width:1240px!important;padding-left:0!important;padding-right:0!important}
  .pdd-product-page .pdd-img-wrap{height:100%!important;aspect-ratio:auto!important;max-height:none!important}
  .pdd-product-page .pdd-img-wrap img{padding:24px}
  .pdd-product-page > div:nth-child(2){padding:0!important}
  .pdd-catalog > div:first-child{max-width:none}
}
@media(min-width:700px) and (max-width:1099px){
  .pdd-home,.pdd-catalog{max-width:900px!important}
}
@media(min-width:700px){
  .pdd-catalog > div{max-width:none!important;margin-left:0!important;margin-right:0!important}
  .pdd-catalog .pdd-catalog-grid{padding:0 0 16px!important;margin-top:0!important}
}
@media(max-width:699px){
  .pdd-catalog .pdd-catalog-grid{padding:0 0 16px!important}
}

/* Доступность: видимый фокус с клавиатуры, нормальные зоны нажатия, уважение к reduce-motion */
:where(button,a,input,textarea,select,[role=button]):focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
