/* Корзина-попап для страниц со своей шапкой (главная): только то, что нужно
   панели корзины, счётчику, окну запроса и сообщению. Взято из base.css
   (оставлять в синхроне); шапка, футер и сброс стилей остаются главной. */
.cart-btn { position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* счётчик корзины */
.cart-n {
  position: absolute;
  top: 6px;
  right: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cart-n[hidden] { display: none; }
.cart-n.bump { animation: bump 400ms var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---------- фото товара: как загружено, целиком в квадрате ---------- */
.ph { display: block; height: 100%; width: 100%; object-fit: contain; }
.ph.is-ghost { opacity: .45; filter: grayscale(1); }
.ph-none {
  height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px dashed var(--ghost, #b8bdc3);
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  text-align: center;
}

/* ---------- кнопки покупки, переключатель количества, варианты ---------- */
.buy-btn {
  height: 44px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), opacity 150ms var(--ease);
}
.buy-btn:hover { background: var(--red); border-color: var(--red); }
.buy-btn[aria-disabled="true"] { opacity: .4; }
.buy-btn[aria-disabled="true"]:hover { background: var(--ink); border-color: var(--ink); }
.buy-btn.is-alt { background: transparent; color: var(--ink); }
.buy-btn.is-alt:hover { background: transparent; border-color: var(--red); color: var(--red); }

.stepper { height: 44px; display: inline-flex; align-items: center; border: 1px solid var(--ink); border-radius: 999px; }
.st-btn { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px; background: none; cursor: pointer; transition: color 150ms var(--ease); }
.st-btn:hover { color: var(--red); }
.st-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.st-q {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 150ms var(--ease);
}
.st-q:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.st-q:focus { outline: none; background: color-mix(in srgb, currentColor 10%, transparent); box-shadow: inset 0 0 0 1px currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-face {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.chip:hover .chip-face { border-color: var(--muted); }
.chip input:checked + .chip-face { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip input:focus-visible + .chip-face { outline: 2px solid var(--red); outline-offset: 2px; }
.chip.is-out .chip-face { border-style: dashed; color: var(--muted); }
.chip-dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(18 20 24 / .16); }
/* цвет — только кружок, название цвета — в подписи над ним */
.chip.is-swatch .chip-face { width: 44px; padding: 0; justify-content: center; border-color: transparent; }
.chip.is-swatch .chip-dot { width: 30px; height: 30px; }
.chip.is-swatch:hover .chip-face { border-color: var(--line); }
.chips.need .chip-face { border-color: var(--red); }
.chips.need .chip.is-swatch .chip-face { border-color: var(--red); }


/* ---------- панель корзины ---------- */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(480px, 100%);
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink);
}
.drawer::backdrop { background: rgb(10 10 10 / .4); }
.drawer[open] { animation: dr-in 250ms var(--ease); }
.drawer.is-closing { animation: dr-out 200ms var(--ease) forwards; }
@keyframes dr-in { from { transform: translateX(100%); } }
@keyframes dr-out { to { transform: translateX(100%); } }
.dr-open { overflow: hidden; }
.dr-panel { height: 100%; display: flex; flex-direction: column; }
.dr-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--line); }
.dr-title { font-size: 20px; font-weight: 600; line-height: 28px; }
.dr-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 24px; }
.dr-lines li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "th info info" "th step sum"; column-gap: 16px; row-gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.dr-line.is-fresh { position: relative; }
.dr-line.is-fresh::before { content: ""; position: absolute; left: -24px; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.dr-thumb, .rel-thumb { grid-area: th; width: 56px; height: 56px; overflow: hidden; border-radius: 8px; background: #fff; }
.dr-thumb .ph-none, .rel-thumb .ph-none { font-size: 0; border-radius: 8px; }
.dr-info { grid-area: info; display: flex; flex-direction: column; }
.dr-name { font-size: 16px; font-weight: 600; line-height: 22px; }
.dr-name:hover { color: var(--red); }
.dr-opt { font-weight: 400; color: var(--muted); }
.dr-unit { font-size: 14px; line-height: 20px; color: var(--muted); }
.dr-lines .stepper { grid-area: step; justify-self: start; }
.dr-sum { grid-area: sum; align-self: center; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dr-disc { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.dr-disc-text { font-size: 15px; font-weight: 500; line-height: 22px; }
.dr-disc-note { margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--muted); }
.dr-bar { position: relative; height: 4px; margin-top: 16px; border-radius: 2px; background: var(--line); }
.dr-bar::before { content: ""; position: absolute; inset: 0; border-radius: 2px; background: var(--red); transform: scaleX(var(--p)); transform-origin: 0 50%; transition: transform 250ms var(--ease); }
.dr-bar b { position: absolute; top: -4px; left: calc(var(--x) * 100%); width: 2px; height: 12px; margin-left: -1px; background: var(--muted); }
.dr-bar b.on { background: var(--red); }
.dr-rel { margin-top: 24px; }
.dr-rest-h { margin-top: 32px; font-size: 14px; font-weight: 500; line-height: 20px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dr-rel-h { font-size: 14px; font-weight: 500; line-height: 20px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rel { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "th info" "th buy"; column-gap: 16px; row-gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rel-info { grid-area: info; display: flex; flex-direction: column; }
.rel-kind { font-size: 13px; line-height: 18px; color: var(--muted); }
.rel-name { font-size: 16px; font-weight: 600; line-height: 22px; }
.rel-name:hover { color: var(--red); }
.rel-price { font-size: 14px; line-height: 20px; }
.rel-buy { grid-area: buy; display: flex; gap: 8px; }
.rel-sel { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 14px; }
.rel-sel.need { border-color: var(--red); }
.rel-add { flex: none; height: 40px; padding: 0 16px 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); border-radius: 999px; background: none; font-size: 14px; font-weight: 600; cursor: pointer; transition: color 150ms var(--ease), border-color 150ms var(--ease); }
.rel-add:hover { color: var(--red); border-color: var(--red); }
.rel-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dr-foot { padding: 16px 24px 24px; border-top: 1px solid var(--line); background: var(--bg); }
.dr-foot:empty { display: none; }
.dr-sums div { display: flex; justify-content: space-between; gap: 16px; font-size: 15px; line-height: 24px; }
.dr-minus dd { color: var(--red); }
.dr-total { margin-top: 4px; font-size: 20px !important; font-weight: 600; line-height: 28px !important; }
.dr-ship { margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--muted); }
.dr-actions { display: grid; gap: 8px; margin-top: 16px; }
.dr-go { width: 100%; }
.dr-more { height: 44px; border: 0; background: none; font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer; }
.dr-more:hover { color: var(--ink); }
.dr-empty { padding: 48px 0; display: grid; gap: 24px; justify-items: start; }
@media (max-width: 599px) {
  /* на телефоне — лист снизу */
  .drawer { inset: auto 0 0 0; width: 100%; height: auto; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .drawer[open] { animation-name: sheet-in; }
  .drawer.is-closing { animation-name: sheet-out; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
  .dr-panel { max-height: 92dvh; }
  .dr-head { padding-left: 16px; }
  .dr-body { padding: 8px 16px 16px; }
  .dr-line.is-fresh::before { left: -16px; }
  .dr-foot { padding: 16px; }
}

/* ---------- форма «Сообщить о поступлении» / «Запросить цену» ---------- */
.modal { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--bg); color: var(--ink); }
.modal::backdrop { background: rgb(10 10 10 / .4); }
.modal[open] { animation: m-in 200ms var(--ease); }
@keyframes m-in { from { opacity: 0; transform: translateY(12px); } }
.m-form, .m-done { position: relative; padding: 32px; }
.m-x { position: absolute; top: 12px; right: 12px; }
.m-title { padding-right: 48px; font-family: var(--font-display); font-weight: var(--display-weight); font-stretch: 125%; font-size: 24px; line-height: 1.15; }
.m-item { margin-top: 8px; font-size: 16px; line-height: 24px; color: var(--muted); }
.m-fields { display: grid; gap: 16px; margin-top: 24px; }
.m-ctl { display: grid; gap: 4px; }
.m-label { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--muted); }
.m-input { height: 48px; padding: 0; border: 0; border-bottom: 1px solid var(--muted); background: transparent; font-size: 18px; }
.m-input:focus { outline: none; border-bottom-color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }
.m-input[aria-invalid="true"] { border-bottom-color: var(--red); box-shadow: inset 0 -1px 0 var(--red); }
.m-err { display: block; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--red); }
.m-err:empty { display: none; }
.m-consent { display: flex; align-items: flex-start; gap: 12px; margin-top: 24px; font-size: 14px; line-height: 20px; cursor: pointer; }
.m-consent a { text-decoration: underline; text-underline-offset: 3px; }
.m-consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-box { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--muted); border-radius: 6px; color: transparent; transition: background 150ms var(--ease), border-color 150ms var(--ease); }
.m-box svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m-consent input:checked + .m-box { background: var(--ink); border-color: var(--ink); color: #fff; }
.m-consent input:focus-visible + .m-box { outline: 2px solid var(--red); outline-offset: 3px; }
.m-consent input[aria-invalid="true"] + .m-box { border-color: var(--red); }
.m-send { width: 100%; margin-top: 24px; }
.m-send[aria-disabled="true"] { opacity: .45; }
.m-done { display: grid; justify-items: start; gap: 16px; }
.m-done[hidden] { display: none; }
.m-done p { font-size: 18px; line-height: 1.5; }
.m-done-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; }
.m-done-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 599px) { .m-form, .m-done { padding: 24px 16px; } }

/* ---------- сообщение ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  line-height: 22px;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { flex: none; height: 36px; padding: 0 14px; border: 1px solid rgb(255 255 255 / .4); border-radius: 999px; background: none; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.toast button:hover { border-color: #fff; }

