@media (max-width: 640px) {
  .quick-filters { display: flex; }
  .wrap { padding: 12px; padding-bottom: 80px; padding-right: 12px; }
  .opt-catalog {
    max-width: 100%;
    padding: 18px 12px 108px;
  }
  .opt-catalog-head { margin-bottom: 16px; }
  .opt-catalog-head h1 {
    font-size: 28px;
    letter-spacing: 0;
  }
  .opt-catalog .quick-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 0 -12px 12px;
    padding: 0 12px;
  }
  .opt-catalog .quick-filters .chip {
    flex: 0 0 auto;
    min-height: 50px;
    padding: 12px 20px;
    font-size: 17px;
  }
  .opt-catalog-layout { display: block; }
  h1 { font-size: 20px; }
  .meta { font-size: 12px; margin-bottom: 16px; }
  .stats { gap: 8px; margin-bottom: 16px; }
  .stat { padding: 8px 12px; flex: 1; min-width: 0; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 11px; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .filters-toggle {
    display: inline-flex; align-items: center; gap: 8px; background: var(--color-white);
    border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px;
    font: inherit; cursor: pointer; min-height: 44px; margin-bottom: 12px; width: 100%;
    justify-content: center; font-weight: 500;
  }
  .filters-count {
    background: var(--coral); color: var(--color-white); border-radius: var(--radius-lg);
    padding: 1px 8px; font-size: 12px; font-weight: 600;
  }
  .filters {
    display: none; position: fixed; inset: 0; z-index: var(--z-modal); border: none;
    border-radius: 0; padding: 0; background: var(--color-white); overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
  }
  .filters.open { display: block; }
  .filters-header {
    display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
    border-bottom: 1px solid var(--border); position: sticky; top: 0;
    background: var(--color-white); z-index: 2;
  }
  .filters-header .btn { min-height: 36px; padding: 8px 14px; margin-left: 6px; }
  .filters > *:not(.filters-header) { padding: 0 16px; }
  .filters > .group { padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--color-gray-100); }
  .filters .group,
  .filters details { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .filters .group h3,
  .filters details summary { flex: 1 1 100%; }
  .filters .group > label,
  .filters .group > details > label { display: inline-flex !important; }
  .filters label {
    padding: 8px 12px; margin: 0; min-height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius-full); background: var(--color-white); font-size: 13px; gap: 6px;
  }
  .filters label:has(input:checked) { border-color: var(--coral); }
  .filters input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
  .filters .count { margin-left: 0; }
  .filters details[open] summary { margin-bottom: 4px; }
  .drawer-backdrop.active { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
  table, tbody, td, thead, tr { display: block; }
  table { border: none; background: transparent; }
  thead { display: none; }
  tbody.box-group {
    display: block; position: relative; background: var(--color-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 10px; padding-right: 140px; overflow: hidden;
  }
  /* RFQ-каталог: pack_info длинный («20 шт/пач. · 30 пач./кор.»), при viewport
     ≤ 414px карточка не помещается рядом с абсолютной кнопкой справа —
     кнопка съезжает за экран. Кладём её в нормальный поток под карточкой. */
  /* RFQ-карточка: горизонтальный flex-row.
     Photo (96×96 + overlay 65 см) | text (title/sub/КИТАЙ + pack-info) | "+" или stepper. */
  body.arrival-china-rfq tbody.box-group {
    padding: 0; border: 1px solid #f1f5f9; border-radius: 16px;
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 10px;
  }
  body.arrival-china-rfq tr.box-main {
    display: flex !important; flex-wrap: nowrap !important;
    align-items: center; padding: 12px; gap: 12px;
    background: transparent; border: none; border-radius: 16px;
  }
  body.arrival-china-rfq tr.box-main > td.col-product {
    flex: 1 1 auto !important; padding: 0 !important; padding-right: 0 !important;
    order: 1; min-width: 0;
  }
  body.arrival-china-rfq .prod-row {
    display: flex; align-items: center; gap: 12px;
    position: relative; padding: 0;
  }
  body.arrival-china-rfq .prod-photo,
  body.arrival-china-rfq .prod-photo-placeholder {
    width: 88px !important; height: 88px !important;
    object-fit: cover; border-radius: 12px; flex: 0 0 auto;
  }
  body.arrival-china-rfq .prod-photo-placeholder {
    display: flex !important; align-items: center; justify-content: center;
    font-size: 36px;
    background: linear-gradient(135deg, #fef3c7 0%, #fce7f3 100%);
  }
  body.arrival-china-rfq .prod-row[data-len]::before {
    content: attr(data-len); position: absolute;
    bottom: 6px; left: 6px;
    background: rgba(255,255,255,0.95); color: #475569;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500; z-index: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  body.arrival-china-rfq .prod-name .prod-length { display: none; }
  body.arrival-china-rfq .prod-name { font-size: 16px; font-weight: 700; color: #0f172a; }
  body.arrival-china-rfq .prod-sub { color: #64748b; font-size: 13px; margin-top: 2px; }
  body.arrival-china-rfq .prod-meta {
    display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px;
  }
  body.arrival-china-rfq .prod-pack {
    font-size: 12px; color: #64748b; font-variant-numeric: tabular-nums;
  }
  /* Бейдж «цена уточним...» — один раз в hero, не дублируем. */
  body.arrival-china-rfq td.col-params[data-label="Цена"] { display: none !important; }
  /* Right-side action area: «+»-кнопка ИЛИ стандартный stepper «− N +». */
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] {
    position: static !important; transform: none !important;
    flex: 0 0 auto !important; order: 2 !important;
    width: auto !important; max-width: none !important; min-width: 0 !important;
    margin: 0 !important; padding: 0 !important; border: none !important;
    background: transparent !important; z-index: 1;
    display: flex !important; flex-direction: row !important;
    align-items: center; justify-content: flex-end; gap: 0;
  }
  /* «+» при count=0: квадрат 48×48, светло-коралловая outline.
     Используем :not([hidden]) чтобы JS-управляемый hidden работал. */
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] > .add-btn.add-btn-noprice[hidden] {
    display: none !important;
  }
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] > .add-btn.add-btn-noprice:not([hidden]) {
    width: 48px !important; min-width: 48px !important; height: 48px;
    padding: 0; border-radius: 12px;
    background: #fff5f5; color: #ff6666;
    border: 1.5px solid #ffb3b3 !important;
    box-shadow: none;
    display: inline-flex !important; align-items: center; justify-content: center;
    flex: 0 0 auto !important;
  }
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] > .add-btn.add-btn-noprice:hover {
    background: #ffe5e5; border-color: #ff6666 !important;
  }
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] > .add-btn.add-btn-noprice .add-sign {
    font-size: 22px; font-weight: 600; line-height: 1;
  }
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] > .add-btn.add-btn-noprice .add-sum {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
  }
  /* Stepper при count>0: outline «− N +», коралловая рамка, без подписи. */
  body.arrival-china-rfq td.merged-cell[data-group-main="1"] > .stepper:not([hidden]) {
    display: inline-flex; align-items: center; justify-content: space-between;
    width: 124px; height: 48px;
    padding: 4px; gap: 0;
    border: 1.5px solid #ff9999; border-radius: 12px;
    background: #fff;
  }
  body.arrival-china-rfq .stepper-btn {
    width: 36px; height: 36px; border-radius: 8px;
    background: transparent !important; border: none; color: #ff6666;
    font-size: 20px; font-weight: 500; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: none !important;
  }
  body.arrival-china-rfq .stepper-btn:focus,
  body.arrival-china-rfq .stepper-btn:focus-visible,
  body.arrival-china-rfq .stepper-btn:active {
    outline: none; box-shadow: none !important;
  }
  body.arrival-china-rfq .stepper-btn:disabled { opacity: 0.35; cursor: not-allowed; }
  body.arrival-china-rfq .add-btn:focus,
  body.arrival-china-rfq .add-btn:focus-visible {
    outline: none;
  }
  /* Прячем все «человеко-читаемые» подписи, оставляем только число (b.stepper-count). */
  body.arrival-china-rfq .stepper-info {
    flex: 1; text-align: center; font-size: 16px;
    font-weight: 600; color: #0f172a;
  }
  body.arrival-china-rfq .stepper-info > b.stepper-count {
    font-size: 16px; font-weight: 700; color: #0f172a;
  }
  body.arrival-china-rfq .stepper-info { font-size: 0; line-height: 0; }
  body.arrival-china-rfq .stepper-info > b.stepper-count {
    font-size: 16px; line-height: 1;
  }
  body.arrival-china-rfq .stepper-sum,
  body.arrival-china-rfq .stepper-sum-hint,
  body.arrival-china-rfq .stepper-hint { display: none !important; }
  tr.box-main {
    display: flex; flex-wrap: wrap; align-items: flex-start; padding: 12px; background: transparent;
    border: none; border-radius: 0; margin: 0;
  }
  tr.box-main td { border-top: none; }
  tr.box-child {
    display: block; padding: 8px 12px; background: transparent; margin: 0; border: none;
    border-top: 1px dashed var(--border); border-radius: 0;
  }
  tr.box-child td:first-child { border-left: none; padding-left: 0; }
  td { border: none !important; padding: 3px 0; }
  td[data-label]::before {
    content: attr(data-label) ": "; color: var(--muted); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.03em; margin-right: 6px;
  }
  td.col-product::before { content: none; }
  .col-product .prod-name { font-size: 16px; }
  tr.box-main > td.col-product { flex: 1 1 100%; order: 1; }
  tr.box-main > td.col-params { flex: 1 1 100%; order: 2; margin-top: 6px; }
  .add-cell .add-cell-info { display: none; }
  td.merged-cell[data-group-main="1"] {
    position: absolute; top: 50%; right: 12px; transform: translateY(-50%); margin: 0; order: 0;
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex: 0 0 auto; background: transparent; padding: 0; z-index: 1;
    max-width: 50%;
  }
  td.merged-cell[data-group-main="1"] > .add-btn,
  td.merged-cell[data-group-main="1"] > .stepper,
  td.merged-cell[data-group-main="1"] > .add-btn-half,
  td.merged-cell[data-group-main="1"] > .stepper-half,
  td.merged-cell[data-group-main="1"] > .orphan-half-badge {
    margin: 0; width: 100%;
  }
  td.merged-cell[data-group-main="1"] .add-btn-half { font-size: 13px; padding: 8px 12px; }
  /* На мобиле название/ферма не должны заезжать под кнопки. */
  tr.box-main > td.col-product { padding-right: 160px; }
  /* RFQ — горизонтальный layout, не нужен резерв под абсолютную кнопку. */
  body.arrival-china-rfq tr.box-main > td.col-product { padding-right: 0 !important; }
  .btn { padding: 10px 14px; font-size: 14px; min-height: 44px; }
  .add-btn { min-width: 44px; padding: 10px 16px; font-size: 18px; font-weight: 600; }
  .qty { width: 56px; padding: 8px; font-size: 16px; min-height: 44px; }
  .qty-hint { font-size: 12px; }
  .cart-bar {
    position: fixed; top: auto; right: 16px; bottom: 16px; left: auto; width: auto; max-height: none;
    background: var(--color-gray-900); color: var(--color-white); border: none;
    border-radius: var(--radius-full); box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    padding: 12px 20px; gap: 10px; flex-direction: row; align-items: center; cursor: pointer;
  }
  .cart-bar::before {
    content: ""; width: 22px; height: 22px; flex: 0 0 auto;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18l-2 13H5L3 6z'/><path d='M8 6V4a4 4 0 0 1 8 0v2'/></svg>") no-repeat center/contain;
  }
  .cart-bar > span,
  .cart-bar > span b { color: var(--color-white); }
  .cart-bar > span { font-size: 15px; font-weight: 600; flex: 0 0 auto; }
  .cart-bar .cart-count-wrap,
  .cart-bar > div { display: none; }
  /* RFQ: сумма всегда 0 ₸, информативнее показать число позиций. */
  body.arrival-china-rfq .cart-bar .cart-count-wrap { display: inline; }
  body.arrival-china-rfq .cart-bar .cart-count-wrap b { color: var(--color-white); }
  body.arrival-china-rfq .cart-bar .cart-sum-wrap { display: none; }
  /* Mobile RFQ: компактный жёлтый pill в правом нижнем углу — появляется
     только при добавленных позициях (.active). Тап по pill открывает
     modal оформления; кнопки внутри bar спрятаны. */
  body.arrival-china-rfq .cart-bar {
    right: 16px; bottom: 16px; left: auto; width: auto;
    background: #ff6666; color: #fff; border: none;
    border-radius: 999px; padding: 12px 18px; gap: 10px;
    box-shadow: 0 6px 18px rgba(255,102,102,0.35);
    cursor: pointer; flex-direction: row; align-items: center;
  }
  body.arrival-china-rfq .cart-bar::before {
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18l-2 13H5L3 6z'/><path d='M8 6V4a4 4 0 0 1 8 0v2'/></svg>") no-repeat center/contain;
  }
  body.arrival-china-rfq .cart-bar > span,
  body.arrival-china-rfq .cart-bar > span b { color: #fff; font-weight: 700; }
  body.arrival-china-rfq .cart-bar > div { display: none; }
  /* Под sticky-баром добавляем отступ снизу, чтобы последняя карточка не пряталась. */
  body.arrival-china-rfq .wrap { padding-bottom: 24px; }
  .modal { align-items: flex-end; }
  .modal-card {
    width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; max-height: 90vh; overflow-y: auto;
  }
  /* Когда открыт modal — прячем sticky cart-bar, чтобы не перекрывал submit. */
  body:has(#modal.active) .cart-bar { display: none !important; }
  /* Submit просто крупная кнопка в конце формы — пользователь скроллит до неё. */
  #modal #modal-submit {
    width: 100%; padding: 16px; font-size: 16px; font-weight: 600;
    min-height: 52px; margin-top: 16px;
  }
  .field input, .field textarea { font-size: 16px; padding: 10px; min-height: 44px; }

  /* Mobile fallback for opt catalog cards. Some preorder arrivals are not RFQ-classed,
     but still use the catalog card data. Keep add/checkout controls inside viewport. */
  html, body { max-width: 100%; overflow-x: hidden; }
  .wrap {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 112px;
  }
  .layout,
  .layout > main,
  table#items {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  table#items {
    display: block;
    overflow: visible;
  }
  table#items tbody.box-group:not(.section-head) {
    width: 100%;
    max-width: 100%;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid #eef2f7;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15,23,42,0.04);
  }
  table#items tr.box-main {
    display: grid !important;
    grid-template-columns: minmax(120px, 38%) minmax(0, 1fr) minmax(48px, auto);
    grid-template-rows: auto auto;
    align-items: end;
    column-gap: 14px;
    row-gap: 12px;
    width: 100%;
    max-width: 100%;
    min-height: 184px;
    padding: 10px;
  }
  table#items tr.box-main > td.col-product {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    padding-right: 0 !important;
  }
  table#items tr.box-main > td.col-params {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    margin-top: 0;
  }
  table#items tr.box-main > td.merged-cell[data-group-main="1"] {
    position: static !important;
    transform: none !important;
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    align-self: end;
    width: auto !important;
    max-width: none !important;
    min-width: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    display: flex !important;
    align-items: flex-end;
    justify-content: flex-end;
  }
  table#items .prod-row {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(120px, 38%) minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 0;
    position: relative;
  }
  table#items .prod-photo,
  table#items .prod-photo-placeholder {
    width: 100% !important;
    height: 154px !important;
    border-radius: 9px !important;
    object-fit: contain;
    background: #f5f7fa;
  }
  table#items .prod-date-badge {
    position: absolute;
    left: 8px;
    top: 124px;
    max-width: calc(38% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    padding: 3px 9px;
  }
  table#items .prod-text {
    min-width: 0;
    align-self: start;
    padding-top: 4px;
  }
  table#items .prod-name {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: #1f2937;
  }
  table#items .prod-sub {
    margin-top: 5px;
    font-size: 14px;
    line-height: 1.2;
    color: #64748b;
  }
  table#items .prod-meta {
    margin-top: 10px;
    gap: 6px 8px;
    align-items: center;
  }
  table#items .prod-country {
    padding: 2px 7px;
    border-radius: 6px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 10px;
  }
  table#items .prod-pack {
    flex-basis: 100%;
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
  }
  table#items .prod-name,
  table#items .prod-sub,
  table#items .prod-pack {
    overflow-wrap: anywhere;
  }
  table#items .col-params {
    align-self: end;
    white-space: normal;
    line-height: 1.1;
  }
  table#items .col-params::before {
    display: none;
  }
  table#items .col-params .price-per-stem {
    display: inline-block;
    font-size: 22px;
    line-height: 1;
    font-weight: 800;
    color: #111827;
  }
  table#items .col-params .param-dim {
    display: inline;
    margin-left: 3px;
    font-size: 14px;
    color: #64748b;
    line-height: 1.2;
  }
  table#items .col-params .param-dim[style] {
    display: none !important;
  }
  table#items td.merged-cell[data-group-main="1"] > .add-btn:not(.add-btn-half) {
    width: 52px !important;
    min-width: 52px !important;
    height: 52px;
    padding: 0 !important;
    border-radius: 10px;
    justify-content: center;
    background: #f46b68;
    color: #fff;
    border: none !important;
    box-shadow: 0 8px 18px rgba(244,107,104,0.24);
  }
  table#items td.merged-cell[data-group-main="1"] > .add-btn:not(.add-btn-half):hover {
    background: #ef5f5c;
  }
  table#items td.merged-cell[data-group-main="1"] > .add-btn:not(.add-btn-half) .add-sum {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table#items td.merged-cell[data-group-main="1"] > .stepper:not(.stepper-half) {
    width: 156px;
    height: 50px;
    max-width: calc(100vw - 32px);
    transform: none;
    display: inline-grid;
    grid-template-columns: 42px minmax(48px, 1fr) 42px;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1.5px solid rgba(244,107,104,0.28);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(15,23,42,0.05);
  }
  table#items td.merged-cell[data-group-main="1"] .stepper-btn {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #f46b68;
    box-shadow: none;
  }
  table#items td.merged-cell[data-group-main="1"] .stepper-plus {
    background: #f46b68;
    color: #fff;
    border-color: #f46b68;
  }
  table#items td.merged-cell[data-group-main="1"] .stepper-info {
    min-width: 0;
    color: #111827;
    font-size: 0;
    line-height: 0;
    font-weight: 700;
  }
  table#items td.merged-cell[data-group-main="1"] .stepper-info > b {
    font-size: 18px;
    line-height: 1;
    font-weight: 800;
  }
  table#items td.merged-cell[data-group-main="1"] .stepper-sum {
    display: none;
  }

  #cart-bar.cart-bar {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    border-radius: 16px;
    padding: 10px 12px;
    justify-content: space-between;
    background: var(--color-white);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 10px 28px rgba(15,23,42,0.16);
  }
  #cart-bar.cart-bar::before { display: none; }
  #cart-bar.cart-bar > span,
  #cart-bar.cart-bar > span b {
    color: var(--text);
  }
  #cart-bar.cart-bar > div {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
  }
  #cart-bar #cart-clear { display: none; }
  #cart-bar #cart-checkout {
    min-height: 44px;
    border-radius: 12px;
    padding: 10px 14px;
    white-space: nowrap;
  }
}
