:root {
  --bg: #e8f4fc;
  --bg-elevated: #ffffff;
  --bg-subtle: #f4faff;
  --surface: #ffffff;
  --border: rgba(21, 101, 192, 0.1);
  --price-accent: #0d47a1;
  --card: #ffffff;
  --muted: #5c6b7a;
  --text: #1a2332;
  --accent: #1565c0;
  --accent-light: #1976d2;
  --accent-soft: rgba(21, 101, 192, 0.1);
  --accent-contrast: #ffffff;
  --nav-icon-inactive: #7a8fa3;
  --chip: #f0f7fd;
  --chip-text: #1565c0;
  --line: rgba(21, 101, 192, 0.1);
  --shadow-sm: 0 1px 3px rgba(21, 101, 192, 0.06);
  --shadow-md: 0 8px 24px rgba(21, 101, 192, 0.1);
  --shadow-card: 0 2px 8px rgba(21, 101, 192, 0.07);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --nav-height: 58px;
}

* {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  min-height: 100%;
  scroll-padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  min-height: 100%;
}

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 16px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 20px);
  background: transparent;
}

.catalog-view {
  margin-top: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px 0 12px;
  margin: 0;
  background: var(--bg);
  border-bottom: none;
}

.brand-wrap {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border);
}

.lang-toggle__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-toggle__btn.is-active {
  background: var(--accent);
  color: #fff;
}

.search {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  padding: 0 12px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  box-shadow: none;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search::placeholder {
  color: var(--muted);
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-bottom: 2px;
}

.category-filter-strip {
  display: flex;
  gap: 8px;
  margin: 10px -16px 0;
  padding: 0 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-filter-strip::-webkit-scrollbar {
  display: none;
}

.category-segment {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.category-segment--active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: min(140px, 40vw);
  max-height: 32px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 1px 2px rgba(18, 20, 26, 0.06));
}

.catalog-sort-wrap {
  flex-shrink: 0;
}

.catalog-sort-select {
  max-width: 160px;
  padding: 7px 26px 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.catalog-sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

.catalog-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 16px;
}

.catalog-load-more-wrap.hidden {
  display: none;
}

.catalog-load-more-btn {
  min-width: 180px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.catalog-load-more-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.price-filter-btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.price-filter-btn__label {
  line-height: 1;
}

.price-filter-btn--active {
  border-color: var(--accent);
  color: var(--accent);
}

.price-filter-popover {
  position: fixed;
  z-index: 55;
  width: min(280px, calc(100vw - 20px));
  max-width: 280px;
}

.price-filter-popover.hidden {
  display: none !important;
}

.price-filter-popover__card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 10px 12px 10px;
}

.price-filter-popover__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.price-filter-popover__subtitle {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.price-filter-popover__subtitle--spaced {
  margin-top: 10px;
  margin-bottom: 6px;
}

.price-filter-custom--row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-bottom: 0;
  align-items: flex-end;
}

.price-filter-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.price-filter-label__text {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.04em;
}

.price-filter-input {
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  outline: none;
  width: 100%;
}

.price-filter-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
  font-size: 12px;
}

.price-filter-input:focus {
  border-color: rgba(37, 99, 235, 0.45);
}

.filter-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  max-height: 42vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.filter-category-chip {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-category-chip:hover {
  border-color: rgba(37, 99, 235, 0.28);
}

.filter-category-chip--active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

.price-filter-popover__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.price-filter-apply {
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

.price-filter-clear {
  height: 34px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sub-tabs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.sub-tabs.hidden {
  display: none !important;
}

.sub-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.counter button[data-action="dec"]:active {
  background: var(--bg-subtle);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.catalog-loading {
  grid-column: 1 / -1;
  margin: 24px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.product-card--skeleton {
  pointer-events: none;
}

.skeleton-line,
.skeleton-img,
.skeleton-counter {
  background: linear-gradient(90deg, #ececee 25%, #f5f5f7 50%, #ececee 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-line--chip {
  width: 42%;
  height: 18px;
  margin-bottom: 8px;
  border-radius: var(--radius-pill);
}

.skeleton-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.skeleton-img::after {
  content: "β";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 700;
  color: #aeaeb2;
  opacity: 0.35;
  pointer-events: none;
}

.skeleton-line--title {
  width: 92%;
  height: 14px;
  margin-bottom: 6px;
}

.skeleton-line--meta {
  width: 55%;
  height: 11px;
  margin-bottom: 8px;
}

.skeleton-line--price {
  width: 48%;
  height: 16px;
  margin-bottom: 10px;
}

.skeleton-counter {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-sm);
}

.products {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.product-card:active {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.image-wrap {
  position: relative;
  height: 148px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 6px;
}

/** Карточка каталога: flex-центрирование (без transform — iOS WebView не рисует чёрный фон). */
.image-wrap--product {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 2px;
  border-radius: 12px;
  overflow: hidden;
  background: #fafbfc !important;
  border: 1px solid rgba(15, 23, 42, 0.04);
  color-scheme: light;
  box-sizing: border-box;
}

.image-wrap--product::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #fff;
  pointer-events: none;
}

.image-wrap--product .image-placeholder,
.image-wrap--product .detail-img-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.image-wrap--product .product-card__img {
  position: relative;
  z-index: 1;
  display: block;
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain !important;
  object-position: center !important;
  background-color: #fff !important;
  mix-blend-mode: normal !important;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.image-wrap:not(.image-wrap--product) img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #94a3b8;
}

.image-placeholder .lucide-image-fallback {
  flex-shrink: 0;
}

.image-placeholder.is-hidden,
.detail-img-placeholder.is-hidden,
.cart-item-thumb-fallback.is-hidden {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

.p-brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: 5px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--chip);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--chip-text);
}

.p-name {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.p-sku {
  font-weight: 500;
  letter-spacing: 0.04em;
}

.p-meta-block {
  margin-top: 4px;
}

.p-sku-line {
  font-size: 11px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.p-pack-line {
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--muted);
}

.p-pack-icon {
  flex-shrink: 0;
  color: var(--muted);
  display: block;
}

.p-pack-num {
  font-weight: 500;
  color: var(--muted);
}

.p-pack-label,
.p-pack-suffix {
  font-weight: 400;
  color: var(--muted);
}

.detail-pack-num {
  font-weight: 500;
}

.p-price {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--price-accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.p-price--manager {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.p-price small {
  font-size: 10px;
  color: var(--muted);
  margin-left: 4px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
}

.counter {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 6px;
  align-items: center;
}

.counter button {
  min-height: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  box-shadow: none;
  transition: background 0.12s ease;
}

.counter button[data-action="inc"] {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.counter button[data-action="inc"]:active {
  background: var(--accent-light);
}

.counter-qty {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  height: 40px;
  margin: 0;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-sm);
  outline: none;
  box-sizing: border-box;
}

.counter-qty:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.counter-qty::-webkit-outer-spin-button,
.counter-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 4px max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(21, 101, 192, 0.08);
}

.nav-btn {
  position: relative;
  border: none;
  background: transparent;
  color: var(--nav-icon-inactive);
  font-size: 10px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  transition: color 0.12s ease;
}

.nav-btn .nav-icon {
  color: var(--nav-icon-inactive);
}

.nav-btn--checkout {
  position: relative;
}

.nav-icon-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.95);
  z-index: 1;
}

.nav-badge.hidden,
.cart-badge.hidden {
  display: none;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.nav-label {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-btn.active {
  color: var(--accent);
  background: transparent;
}

.nav-btn.active .nav-icon {
  color: var(--accent);
}

.guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 20, 40, 0.45);
}

.guide-backdrop.hidden {
  display: none !important;
}

.guide-modal {
  width: min(100%, 400px);
  max-height: min(88vh, 640px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 18px 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.guide-modal__title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.guide-modal__steps {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.guide-modal__steps li {
  margin-bottom: 10px;
}

.guide-modal__steps li:last-child {
  margin-bottom: 0;
}

.guide-modal__btn {
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 18, 0.48);
  z-index: 50;
}

.detail-backdrop.hidden {
  display: none;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 51;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  pointer-events: none;
}

.detail-modal.hidden {
  display: none;
}

.detail-modal-inner {
  pointer-events: auto;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: 22px 22px 0 0;
  padding: 0 0 32px;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.18);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.detail-modal-topbar {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top, 0px)) 12px 4px;
  background: var(--bg-elevated);
  z-index: 40;
}

.detail-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 18px 8px;
}

.detail-close {
  position: relative;
  top: auto;
  right: auto;
  z-index: 41;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.detail-close:active {
  transform: scale(0.96);
  background: var(--bg-elevated);
}

.detail-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  background: #fff !important;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px;
  box-shadow: none;
  color-scheme: light;
  box-sizing: border-box;
}

.detail-image-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #fff;
  pointer-events: none;
}

.detail-image-wrap--empty {
  color: #94a3b8;
}

.detail-img-placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #94a3b8;
  pointer-events: none;
}

.detail-image-wrap img {
  mix-blend-mode: normal;
  filter: none;
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  padding-right: 44px;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.detail-meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.detail-meta dl {
  margin: 0;
  display: grid;
  gap: 6px;
}

.detail-meta dt {
  display: inline;
  font-weight: 600;
  color: #5c616a;
}

.detail-meta dd {
  display: inline;
  margin: 0;
  color: var(--text);
}

.detail-meta-tight {
  margin-bottom: 8px;
}

.detail-price {
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 700;
  color: var(--price-accent);
}

.detail-desc-block {
  margin-bottom: 14px;
}

.detail-desc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #666);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 0;
}

.detail-modal .counter {
  max-width: 220px;
}

.product-card {
  cursor: pointer;
}

.product-card .counter {
  cursor: default;
}

.product-card .counter button {
  cursor: pointer;
}

.cart-screen {
  position: fixed;
  inset: 0;
  z-index: 280;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.cart-screen.hidden {
  display: none;
}

.cart-screen-header {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 52px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.cart-screen-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cart-screen-close {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--bg-elevated);
  font-size: 24px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.cart-screen-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 8px;
}

.cart-empty {
  margin: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.cart-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.cart-item-thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.cart-item-thumb-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: #94a3b8;
}

.cart-item-thumb--empty {
  color: #94a3b8;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.cart-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--text);
}

.cart-item-line {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.cart-item-remove {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.cart-item-qty {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cart-qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.cart-qty-btn:active {
  transform: scale(0.96);
}

.cart-qty-input {
  width: 44px;
  height: 36px;
  margin: 0;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow-sm);
  outline: none;
  box-sizing: border-box;
}

.cart-qty-input:focus {
  border-color: rgba(37, 99, 235, 0.45);
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-screen-footer {
  flex-shrink: 0;
  padding: 14px 16px max(16px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--bg-elevated);
  box-shadow: 0 -10px 32px rgba(37, 99, 235, 0.1);
}

body.cart-open .bottom-nav,
body.orders-open .bottom-nav {
  display: none;
}

.cart-screen-total {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.btn-checkout {
  display: block;
  width: 100%;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

.btn-checkout:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-checkout--cart {
  min-height: 52px;
  font-size: 17px;
  border-radius: 14px;
}

.btn-checkout:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-orders-link {
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.orders-screen {
  position: fixed;
  inset: 0;
  z-index: 280;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.orders-screen.hidden {
  display: none !important;
}

.orders-screen-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}

.orders-screen-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.orders-screen-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.orders-screen-list {
  flex: 1;
  overflow: auto;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px));
}

.orders-empty {
  margin: 24px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.order-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.order-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

.order-card__date {
  color: var(--muted);
  font-weight: 600;
}

.order-card__total {
  font-weight: 800;
  color: var(--text);
}

.order-card__items {
  display: grid;
  gap: 8px;
}

.order-card__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  font-size: 13px;
}

.order-card__name {
  grid-column: 1 / -1;
  font-weight: 600;
}

.order-card__meta {
  color: var(--muted);
}

.order-card__sum {
  text-align: right;
  font-weight: 700;
}

.catalog-view.hidden,
.brands-view.hidden,
.about-view.hidden {
  display: none !important;
}

.topbar.hidden {
  display: none !important;
}

/** Страница «О нас»: спокойная типографика, без карточек вокруг текста */
.about-view {
  margin-top: 4px;
  padding-bottom: 100px;
  min-height: min(70dvh, 520px);
}

.about-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px clamp(22px, 7vw, 40px) 36px;
}

.about-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.about-logo {
  display: block;
  height: auto;
  max-height: 42px;
  width: auto;
  max-width: min(200px, 78vw);
  object-fit: contain;
}

.about-prose {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 16px;
  line-height: 1.65;
  color: #3f4d5c;
  letter-spacing: 0.01em;
}

.about-prose p {
  margin: 0 0 1.15em;
}

.about-prose p:last-of-type {
  margin-bottom: 0;
}

.about-footer {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.about-ig-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #475569;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(16, 33, 63, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.about-ig-link:active {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.35);
  color: #334155;
}

.about-ig-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.about-ig-icon svg {
  display: block;
}

.active-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}

.active-brand-bar.hidden {
  display: none !important;
}

.active-brand-muted {
  color: var(--muted);
  font-weight: 400;
}

.active-brand-strong {
  font-weight: 500;
  color: var(--text);
}

.active-brand-clear {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.brands-view {
  margin-top: 8px;
  padding-bottom: 8px;
}

.brands-intro {
  margin-bottom: 16px;
}

.brands-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brands-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.35;
}

.brands-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 400px) {
  .brands-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.brand-card:active {
  transform: scale(0.99);
  box-shadow: var(--shadow-md);
}

.brand-card__logo-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
}

.brand-card__logo-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.brand-card__icon-fallback {
  color: var(--nav-icon-inactive);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-card__icon-fallback svg {
  display: block;
}

.brand-card__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 6px;
}

.brand-card__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.brands-empty {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin-top: 28px;
}

.brands-empty.hidden {
  display: none !important;
}

/* Не трогаем mask/background у всех img — ломает рендер в iOS WebView. */
.product-card__img,
.detail-image-wrap img,
.cart-item-thumb img {
  background-color: #fff;
  background-image: none;
}


/* Однотонный фон под фото везде — без вида «вставленной картинки» */
.detail-image-wrap {
  background: #fff !important;
  background-image: none !important;
  box-shadow: none !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
}
.detail-image-wrap img { mix-blend-mode: normal !important; filter: none !important; }
.cart-item-thumb {
  background: #fff !important;
  background-image: none !important;
}
.cart-item-thumb img { mix-blend-mode: normal !important; filter: none !important; }


/* === Деталь: фото целиком, flex (без transform) === */
.detail-image-wrap img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain !important;
  object-position: center !important;
  background-color: #fff !important;
  mix-blend-mode: normal !important;
  filter: none !important;
}

.cart-item-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  background-color: #fff !important;
}
