/* Compatibility boundary: legacy rules use !important extensively. Keep the
   responsive overrides here until each legacy component is retired. */
html { background: var(--surface); scroll-padding-top: calc(var(--header-height) + 24px); }
body {
  width: 100%; max-width: none; margin: 0; box-shadow: none;
  min-height: 100dvh; overflow-x: clip;
  padding-bottom: calc(var(--bottom-height) + env(safe-area-inset-bottom)) !important;
}
body *, body *::before, body *::after { letter-spacing: 0 !important; }
body :is(button, input, select, textarea) { font: inherit; }
body :is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #2961bd !important; outline-offset: 3px;
}
body :is(button, input, select) { min-height: 44px; }
body :is(input, select, textarea) { min-width: 0; max-width: 100%; }
body :is(input, textarea) { font-size: 16px !important; }
body :is(button, a) { touch-action: manipulation; }
body :is(button:disabled, [aria-disabled="true"]) { cursor: not-allowed; opacity: .55; }
body :is(h1,h2,h3,h4,p,strong,small,label) { overflow-wrap: anywhere; }
body :is(h1,h2,h3,h4) { text-wrap: pretty; }
body img { max-width: 100%; }
body #app { width: 100%; min-height: calc(100dvh - var(--bottom-height)); overflow: visible !important; }
body #main { min-height: calc(100dvh - var(--header-height) - var(--bottom-height)); overflow: visible !important; padding-bottom: 0 !important; }
body #app .container {
  width: calc(100% - var(--page-gutter) * 2) !important;
  max-width: var(--content-width) !important;
  margin-inline: auto !important; padding-inline: 0 !important;
}
body #app :is(.hero,.promotions-page,.shop-view,.seller-shell) { padding-block: 20px 32px; }
body #app :is(.hero,.promotions-page,.shop-view) > h1 { font-size: 28px !important; line-height: 1.2; }
.skip-link { position: fixed; top: 8px; left: 16px; transform: translateY(-160%); z-index: 2000; padding: 12px 20px; background: #fff; color: var(--ink); }
.skip-link:focus { transform: none; }

/* A single header and shared controls; no duplicate IDs across viewports. */
body #app .topbar {
  display: block !important;
  position: sticky !important; top: 0; height: auto !important;
  padding: 8px 0 !important; background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: none; z-index: 40;
}
body #app .topbar-inner {
  display: grid !important; grid-template-columns: 52px minmax(0,1fr);
  width: calc(100% - var(--page-gutter) * 2) !important; max-width: var(--content-width);
  margin: auto !important; gap: 8px !important; align-items: center;
}
body #app .topbar-left { display: flex !important; min-width: 0; width: auto; grid-column: 1; grid-row: 1; order: 0; }
body #app .brand { display: flex !important; padding: 0; width: 52px; height: 44px; overflow: hidden; }
body #app .brand img { width: 52px !important; height: 36px !important; max-width: 100% !important; transform: none !important; object-fit: cover; object-position: center; }
body #app .topbar-left .nav { display: none !important; }
body #app .topbar-right {
  display: flex !important; order: 0 !important; width: auto !important;
  min-width: 0; margin: 0 !important; gap: 4px !important; grid-column: 2; grid-row: 1;
}
body #app .topbar-mascot { display: none !important; }
body #app .address {
  display: flex !important; flex: 1 1 auto !important; min-width: 0 !important;
  width: auto !important; max-width: none !important; padding: 4px !important;
  gap: 6px; font-size: 13px !important; background: transparent;
}
body #app #addressLabel { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body #app .address svg { flex: 0 0 20px; width: 20px; }
body #app .header-icon { display: flex !important; flex: 0 0 44px; width: 44px !important; height: 44px !important; padding: 10px !important; }
body #app .topbar-inner > .search {
  display: flex !important; grid-column: 1 / -1; grid-row: 2;
  position: static !important; width: 100% !important; max-width: none !important;
  height: 44px !important; margin: 0 !important; background: var(--soft); border-radius: var(--radius);
}
body #app .search input { width: 100%; min-width: 0; height: 44px; padding: 0; background: transparent; }
body #app .cart-cluster { display: none !important; }
body #app #adminCouponsBtn { display: none; }
body .bottom-nav {
  position: fixed !important; inset: auto 0 0 !important; width: 100% !important;
  max-width: none !important; height: calc(var(--bottom-height) + env(safe-area-inset-bottom)) !important;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom)) !important;
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr));
  border-top: 1px solid var(--line); background: #fff; z-index: 60;
}
body .bottom-nav button { min-height: 56px; min-width: 0; font-size: 12px !important; }
body .bottom-nav button.active { color: var(--red); }
body .floating-cart-btn {
  left: auto !important; right: var(--page-gutter) !important;
  bottom: calc(var(--bottom-height) + env(safe-area-inset-bottom) + 12px) !important;
  width: min(340px,calc(100% - var(--page-gutter) * 2)) !important; max-width: none !important; z-index: 55;
}

/* Catalog components */
body #app .categories {
  display: grid !important; grid-auto-flow: column; grid-auto-columns: 92px;
  grid-template-columns: none !important; gap: 12px !important;
  overflow-x: auto !important; overscroll-behavior-x: contain;
  padding: 4px 0 12px !important; margin: 0 0 12px !important;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
body #app .category {
  display: flex; flex-direction: column; align-items: center;
  width: 92px !important; min-width: 0 !important; padding: 0 !important; gap: 8px;
  scroll-snap-align: start; background: transparent; border-radius: 8px;
}
body #app .category .cat-img { width: 68px !important; height: 64px !important; min-height: 64px; margin: 0; }
body #app .category :is(.home-cat-art,.category-icon) { width: 100% !important; height: 100% !important; object-fit: contain; }
body #app .category span { width: 100% !important; font-size: 13px !important; min-height: 36px; line-height: 18px; white-space: normal !important; word-break: normal !important; overflow-wrap: normal; hyphens: none; }
body #app .category.selected span { color: var(--red-dark); font-weight: 700; }
body #app .section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin: 24px 0 12px !important; }
body #app :is(.section-head h2,.promotions-toolbar h2,.menu-section h3) { margin: 0; font-size: 20px !important; line-height: 1.3; }
body #app :is(.filters,.promotions-toolbar) { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
body #app .filters { display: flex !important; margin: 12px 0 20px; }
body #app .filter { display: inline-flex !important; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; }
body #app :is(.stores,.products,.promotions-products) {
  display: grid !important; grid-template-columns: minmax(0,1fr) !important;
  gap: 16px !important; align-items: stretch; width: 100%; min-width: 0;
}
body #app .stores > :is(p,.empty-cart,.sd-empty-note), body #app .products > :is(p,.empty-cart) { grid-column: 1 / -1; }
body #app .store-card {
  display: grid !important; grid-template-columns: 80px minmax(0,1fr) !important;
  gap: 14px !important; align-items: center; padding: 12px !important;
  min-width: 0; width: 100%; height: auto !important; min-height: 112px;
  border: 1px solid var(--line) !important; border-radius: var(--radius) !important; background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
body #app .store-card:hover { border-color: #c3c7ce !important; box-shadow: var(--shadow); transform: none !important; }
body #app .store-card .store-cover { width: 80px !important; height: 80px !important; min-width: 0 !important; border-radius: 8px !important; aspect-ratio: 1; object-fit: cover; }
body #app :is(.store-copy,.product-info-wrap,.sv-grow,.profile-menu-copy,.cart-line-copy) { min-width: 0; }
body #app .store-copy h3 { font-size: 16px !important; line-height: 1.35; margin: 0 0 6px !important; white-space: normal !important; }
body #app .store-meta { display: flex !important; flex-wrap: wrap; gap: 4px !important; font-size: 13px !important; line-height: 1.5; white-space: normal !important; }
body #app :is(.store-copy h3,.product-name-modern,.promo-offer-name) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body #app .product-card-modern {
  display: grid !important; grid-template-columns: 104px minmax(0,1fr) !important; gap: 16px !important;
  min-width: 0; padding: 16px !important; border-radius: 8px !important; border: 1px solid var(--line) !important;
  height: auto !important; min-height: 140px !important; background: #fff;
}
body #app .product-media-wrap { grid-column: 1; grid-row: 1; align-self: start; width: 104px !important; height: 104px !important; min-width: 0 !important; aspect-ratio: 1; }
body #app .product-card-image { width: 100% !important; height: 100% !important; object-fit: cover; border-radius: 8px !important; }
body #app .product-info-wrap { grid-column: 2; grid-row: 1; width: auto !important; padding: 0 !important; }
body #app .product-name-modern { font-size: 16px !important; line-height: 1.35 !important; margin: 0 0 8px; }
body #app .product-desc-modern { font-size: 14px !important; line-height: 1.45 !important; color: var(--muted); }
body #app :is(.product-price-modern,.promo-offer-prices) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
body #app :is(.product-price-modern strong,.promo-offer-prices strong) { font-size: 17px !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
body #app .promo-offer-card { border-radius: 8px !important; border: 1px solid var(--line); min-width: 0; }
body #app .promo-offer-media { aspect-ratio: 4 / 3; height: auto !important; }
body #app .promo-offer-img { width: 100%; height: 100% !important; object-fit: cover; }
body #app .promo-offer-body { padding: 16px !important; }
body #app .promo-offer-name { font-size: 16px !important; line-height: 1.35; }
body #app .home-coupon-banner { border-radius: 8px !important; min-height: 150px !important; }
body #app .promotions-banner { min-height: 180px; height: auto; border-radius: 8px; }
body #app .promotions-banner h2 { font-size: 26px !important; }
body #app .home-banner-dots { min-height: 32px; display: flex; align-items: center; justify-content: center; gap: 0; }
body #app .home-banner-dots i { position: relative; width: 28px !important; height: 32px !important; background: transparent !important; margin: 0 !important; cursor: pointer; }
body #app .home-banner-dots i::after { content: ''; position: absolute; inset: 14px 10px; border-radius: 3px; background: #c8ccd2; }
body #app .home-banner-dots i.active::after { background: var(--red); }

/* Store details: one information hierarchy at every size. */
body #app .shop-layout { display: block !important; }
body #app .shop-view { display: block !important; overflow: visible !important; }
body #app .back-link { display: inline-flex !important; align-items: center; margin: 0 0 16px; padding: 8px 0; background: transparent; }
body #app .store-hero-card { grid-template-columns: 88px minmax(0,1fr) !important; gap: 8px 16px !important; padding: 16px 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
body #app .store-hero-avatar-wrap { width: 88px !important; height: 88px !important; min-width: 88px !important; max-width: 88px !important; min-height: 88px !important; margin: 0 !important; grid-row: 1 / span 3 !important; }
body #app .store-hero-title { font-size: 23px !important; line-height: 1.25 !important; }
body #app .store-hero-actions-row { grid-column: 1 / -1 !important; display: flex !important; flex-wrap: wrap; gap: 8px !important; }
body #app .store-hero-badges-row { flex-wrap: wrap; }
body #app .store-quick-btn { min-height: 44px; width: auto !important; flex: 1 1 auto; padding: 8px 12px !important; }
body #app .store-tabs-bar { max-width: 100%; overflow-x: auto; scroll-padding: 12px; }
body #app .store-tab-link { flex-shrink: 0; min-height: 44px; }
body #app .shop-top-bar { position: sticky; top: var(--header-height); z-index: 25; }
body #app .menu-section { scroll-margin-top: calc(var(--header-height) + 120px); margin-top: 24px; }
body #app .store-coupons-wrap { max-width: 100%; overflow-x: auto; }

/* Drawers, forms and purchase flow. */
body #overlay, body .photo-viewer, body .app-confirm { position: fixed; inset: 0 !important; width: 100% !important; max-width: none !important; height: 100dvh; margin: 0 !important; }
body #overlay { z-index: 100; padding: 0 !important; align-items: stretch !important; justify-content: flex-end !important; background: rgb(20 23 30 / 38%); }
body #overlay .drawer {
  position: relative !important; inset: auto !important; width: 100% !important; max-width: 100% !important;
  height: 100dvh !important; max-height: 100dvh !important; margin: 0 !important;
  min-height: 0 !important;
  padding: 0 20px calc(24px + env(safe-area-inset-bottom)) !important;
  border-radius: 0 !important; overflow-y: auto !important; overflow-x: clip;
  overscroll-behavior: contain; background: #fff;
}
body #overlay .drawer-head { position: sticky; top: 0; z-index: 5; background: #fff; padding: 16px 0; margin-bottom: 16px; border-bottom: 1px solid var(--line); gap: 12px; align-items: center; }
body #overlay .drawer-head h2 { font-size: 22px !important; line-height: 1.25; margin: 0; min-width: 0; }
body #overlay .close { display: grid !important; place-items: center; position: static; flex: 0 0 44px; width: 44px; height: 44px; font-size: 28px; }
body #overlay .form-grid { display: grid; gap: 20px; min-width: 0; }
body #overlay .field { min-width: 0; }
body #overlay .field > label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
body #overlay .field :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #c9cdd5; }
body #overlay .check-row { display: flex !important; align-items: center; gap: 10px; min-height: 44px; padding: 8px 0; }
body #overlay :is(input[type=checkbox],input[type=radio]) { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; accent-color: var(--red); }
body #overlay .primary { min-height: 48px; border-radius: 8px; padding: 12px 20px; font-size: 16px; }
body #overlay .checkout-summary { padding: 20px !important; background: var(--soft) !important; border: 1px solid var(--line); border-radius: 8px !important; line-height: 1.85 !important; margin: 0 0 20px !important; }
body #overlay #checkoutTotalValue { font-size: 22px; color: var(--ink); }
body #overlay .checkout-drawer > .settings-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; padding: 0 0 16px !important; }
body #overlay .cart-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding-block: 16px; }
body #overlay .cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
body #overlay .cart-line-copy { min-width: 0; }
body #overlay .qty { flex-shrink: 0; }
body #overlay .qty button { width: 44px; min-width: 44px; min-height: 44px; }
body #overlay .total-row { gap: 16px; }
body #overlay .total-row strong { white-space: nowrap; }
body #overlay :is(.profile-hero,.profile-order-card .row) { flex-wrap: wrap; gap: 12px; }
body #overlay :is(.profile-hero-copy,.profile-menu-copy) { min-width: 0; overflow-wrap: anywhere; }
body #overlay .profile-menu-item { min-height: 64px; border-radius: 8px; }
body #overlay .profile-menu { border-radius: 8px; }
body #overlay .profile-hero { grid-template-columns: 64px minmax(0,1fr) !important; }
body #overlay .profile-account-state { grid-column: 2; justify-self: start; }
body #overlay :is(.empty-cart,.sv-empty) { padding: 32px 16px; background: var(--soft); border-radius: 8px; text-align: center; }
body #overlay .product-order-modal { max-height: 100dvh !important; height: 100dvh !important; width: 100% !important; max-width: none !important; overflow-y: auto !important; border-radius: 0 !important; }
body #overlay .product-order-scroll { overflow: visible !important; flex: 1 0 auto; }
body #overlay .product-order-hero h2 { font-size: 22px !important; }
body #overlay .product-order-hero p { font-size: 15px !important; }
body #overlay .product-order-submit { min-height: 48px; }
body #overlay .product-order-stepper button { min-width: 44px; min-height: 44px; }
body #overlay .product-order-footer { position: sticky !important; bottom: 0; background: #fff; padding-bottom: max(16px,env(safe-area-inset-bottom)); }
.field-error { display: block; color: var(--danger); font-size: 13px; margin-top: 6px; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.form-feedback { padding: 12px 16px; border-left: 3px solid var(--danger); background: #fff3f4; color: var(--danger); border-radius: 4px; }
.form-feedback.success { border-left-color: var(--success); background: #effaf4; color: var(--success); }
body .toast { max-width: min(480px,calc(100% - 32px)); bottom: calc(var(--bottom-height) + env(safe-area-inset-bottom) + 20px) !important; z-index: 300; white-space: normal; }
body.sd-dialog-open { overflow: hidden; }
.sd-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }

/* Partner workspace: navigation remains independent on mobile. */
body #app .seller-shell { background: #fff; min-width: 0; }
body #app :is(.seller-panel,.sv-list,.sv-col) { border-radius: 0; box-shadow: none; min-width: 0; }
body #app .seller-panel { padding: 20px 0; border: 0; border-top: 1px solid var(--line); }
body #app .sv-nav { display: flex; overflow-x: auto; max-width: 100%; gap: 8px; }
body #app .sv-nav button { flex-shrink: 0; }
body #app .sv-nav .sidebar-toggle { display: none; }
body #app .sv-head { flex-wrap: wrap; gap: 16px; }
body #app .sv-hello { font-size: 24px; }
body #app :is(.sv-cards,.sv-fin) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
body #app .sv-card { min-width: 0; padding: 20px; border-radius: 8px; }
body #app .sv-card strong { font-size: 26px; }
body #app .sv-kanban { display: grid; grid-template-columns: repeat(4,minmax(260px,1fr)); max-width: 100%; overflow-x: auto; gap: 16px; padding-bottom: 16px; }
body #app .sv-col { background: var(--soft); padding: 12px; }
body #app .sv-kcard { border-radius: 8px; }
body #app :is(.sv-row,.sv-order,.sv-row-actions,.product-admin-actions) { flex-wrap: wrap; gap: 12px; min-width: 0; }
body #app .product-admin { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 16px; }
body #app .product-admin img { width: 72px; height: 72px; object-fit: cover; }
body #app .product-admin-actions { grid-column: 1 / -1; display: flex; }
body #app .sv-section-title { flex-wrap: wrap; gap: 12px; }
body #app .sv-section-title h2 { font-size: 20px; }
body #app .site-footer-card { border: 0; box-shadow: none; padding: 24px 0; border-radius: 0; background: #fff; }
body.is-seller #app :is(.topbar-inner > .search,.cart-cluster) { display: none !important; }

/* Merchant workspace: the customer header must not compete with the seller shell. */
body.is-seller #app .topbar-inner {
  display: flex !important;
  width: min(100% - 40px, 1440px) !important;
  max-width: 1440px !important;
  min-height: 56px;
  gap: 16px !important;
}
body.is-seller { padding-bottom: 0 !important; }
body.is-seller .bottom-nav,
body.is-seller .floating-cart-btn { display: none !important; }
body.is-seller #app .topbar-left { display: flex !important; flex: 0 0 auto; }
body.is-seller #app .topbar-left .nav { display: none !important; }
body.is-seller #app .brand { width: 64px !important; height: 42px !important; }
body.is-seller #app .brand img { width: 60px !important; height: 38px !important; }
body.is-seller #app .topbar-right {
  order: 0 !important;
  width: auto !important;
  margin-left: auto !important;
  flex: 0 1 auto !important;
  gap: 12px !important;
}
body.is-seller #app .topbar-right > .topbar-mascot,
body.is-seller #app .topbar-right > .address,
body.is-seller #app .topbar-right > #adminCouponsBtn,
body.is-seller #app .topbar-right > .cart-cluster { display: none !important; }
body.is-seller #app .topbar-right > #notificationBtn,
body.is-seller #app .topbar-right > #profileBtn { display: grid !important; }

body.is-seller #app .seller-shell {
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 28px 32px 64px calc(var(--sidebar-width) + 32px) !important;
  background: #f8fafc;
}
body.is-seller #app .seller-shell > * { max-width: 1440px; margin-inline: auto; }
body.is-seller #app .sv-head {
  padding: 4px 0 22px;
  margin-bottom: 0;
  border-bottom: 1px solid #e7ebf0;
}
body.is-seller #app .sv-hello { font-size: clamp(22px, 2.2vw, 30px); letter-spacing: -0.02em !important; }
body.is-seller #app .sv-hello small { font-size: 13px; color: #657184; }
body.is-seller #app .sv-status { background: #fff; border-color: #dce2ea; min-height: 42px; }
body.is-seller #app .sv-nav {
  box-sizing: border-box;
  width: var(--sidebar-width);
  padding: 18px 12px;
  gap: 6px;
  background: #fff;
  border-right: 1px solid #e5e9ef;
  box-shadow: 8px 0 24px rgba(20, 33, 61, 0.04);
}
body.is-seller #app .sv-nav button {
  min-height: 44px;
  color: #536174;
  font-weight: 700;
}
body.is-seller #app .sv-nav .sv-nav-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  color: currentColor;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}
body.is-seller #app .sv-nav .sv-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
body.is-seller.sidebar-collapsed #app .sv-nav .sidebar-toggle { align-self: center; }
body.is-seller.sidebar-collapsed #app .sv-nav button:not(.sidebar-toggle) { display: flex !important; }
body.is-seller.sidebar-collapsed #app .sv-nav button:not(.sidebar-toggle) { justify-content: center; }
body.is-seller.sidebar-collapsed #app .sv-nav .sv-nav-label { display: none; }
body.is-seller #app .sv-nav button.active { background: #fff1f3; color: #c91836; border-bottom: 0; }
body.is-seller #app .sv-nav button:hover { background: #f7f9fb; }
body.is-seller #app :is(.sv-cards,.sv-fin) {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 16px !important;
}
body.is-seller #app .sv-card {
  min-height: 118px;
  border: 1px solid #e2e7ee;
  background: #fff;
  box-shadow: 0 8px 24px rgba(20, 33, 61, 0.045);
}
body.is-seller #app .sv-list,
body.is-seller #app .sv-order,
body.is-seller #app .seller-panel {
  border-color: #e2e7ee;
  background: #fff;
  box-shadow: 0 8px 24px rgba(20, 33, 61, 0.035);
}
body.is-seller #app .sv-section-title { margin-top: 28px !important; }
body.is-seller #app .sv-section-title h2 { font-size: 18px; letter-spacing: 0 !important; }
body.is-seller #app .seller-panel { border-radius: 10px; }

@media (max-width: 1023px) {
  body.is-seller #app .seller-shell { padding: 22px var(--page-gutter) 48px !important; }
  body.is-seller #app .sv-nav {
    position: sticky; top: var(--header-height); width: 100%; padding: 8px 0;
    border: 0; border-bottom: 1px solid #e5e9ef; box-shadow: none; flex-direction: row;
  }
  body.is-seller #app .sv-nav button { flex: 0 0 auto; }
}

@media (max-width: 767px) {
  body.is-seller #app .topbar-inner { width: calc(100% - 28px) !important; min-height: 48px; }
  body.is-seller #app .brand { width: 58px !important; }
  body.is-seller #app .sv-head { align-items: flex-start; padding-bottom: 16px; }
  body.is-seller #app .sv-head-left { width: 100%; }
  body.is-seller #app .sv-status { width: 100%; justify-content: center; }
  body.is-seller #app :is(.sv-cards,.sv-fin) { grid-template-columns: 1fr !important; }
}

@media (max-width: 374px) {
  :root { --page-gutter: 12px; }
  body #app .topbar-inner { grid-template-columns: 44px minmax(0,1fr); gap: 4px !important; }
  body #app .brand { width: 44px; }
  body #app .store-card { grid-template-columns: 64px minmax(0,1fr) !important; gap: 12px !important; }
  body #app .store-card .store-cover { width: 64px !important; height: 64px !important; }
  body #app .product-card-modern { grid-template-columns: 88px minmax(0,1fr) !important; padding: 12px !important; gap: 12px !important; }
  body #app .product-media-wrap { width: 88px !important; height: 88px !important; }
  body #overlay .drawer { padding-inline: 16px !important; }
  body #overlay .cart-line { grid-template-columns: minmax(0,1fr); }
  body #overlay .cart-line .qty { grid-column: 1; justify-self: start; }
}
@media (min-width: 768px) {
  body #app :is(.stores,.products,.promotions-products) { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 20px !important; }
  body #app .categories { grid-auto-columns: minmax(80px,1fr); }
  body #app .category { width: 100% !important; }
  body #app .home-coupon-banner { min-height: 220px !important; }
  body #overlay .drawer { width: 560px !important; max-width: calc(100% - 48px) !important; padding-inline: 28px !important; }
  body #overlay:has(.auth-drawer) { align-items: center !important; justify-content: center !important; padding: 24px !important; }
  body #overlay .auth-drawer { height: auto !important; max-height: calc(100dvh - 48px) !important; width: 480px !important; border-radius: 8px !important; }
  body #overlay .product-order-modal { width: 640px !important; max-width: calc(100% - 48px) !important; }
  body #overlay .wide-drawer { width: 800px !important; }
  body #overlay .wide-drawer .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body #overlay .wide-drawer .form-grid > :not(.field) { grid-column: 1 / -1; }
  body #overlay .wide-drawer .field:has(textarea) { grid-column: 1 / -1; }
  body #app .store-hero-card { grid-template-columns: 120px minmax(0,1fr) !important; }
  body #app .store-hero-avatar-wrap { width: 120px !important; height: 120px !important; min-width: 120px !important; max-width: 120px !important; min-height: 120px !important; }
  body #app .store-hero-actions-row { grid-column: 2 !important; }
  body #app .store-quick-btn { flex: 0 1 auto; }
}
@media (min-width: 1024px) {
  body #app .topbar { padding: 8px 0 !important; min-height: 56px; }
  body #app .topbar-inner {
    display: grid !important; grid-template-columns: 58px auto minmax(220px,306px) minmax(0,1fr) !important;
    flex-wrap: nowrap; width: min(100% - 32px, 1040px) !important;
    max-width: 1040px !important; gap: 14px !important;
  }
  body #app .topbar-left { display: contents !important; }
  body #app .brand { grid-column: 1; grid-row: 1; width: 58px; height: 40px; }
  body #app .brand img { width: 58px !important; height: 36px !important; }
  body #app .topbar-left .nav { display: flex !important; grid-column: 2; grid-row: 1; align-items: center; gap: 22px; }
  body #app .nav button { font-size: 14px; padding: 6px 0; background: transparent; border-radius: 0; }
  body #app .topbar-inner > .search { order: 0; grid-column: 3; grid-row: 1; flex: 1 1 auto; width: auto !important; max-width: none !important; }
  body #app .topbar-right { order: 0; grid-column: 4; grid-row: 1; flex: 1 1 auto; justify-content: flex-end; gap: 6px !important; }
  body #app .cart-cluster { display: flex !important; gap: 8px; align-items: center; flex: 0 0 auto; padding-left: 12px; border-left: 1px solid var(--line); }
  body #app .cart-trigger { width: 44px; height: 44px; display: grid; place-items: center; }
  body #app .cart-copy { display: flex !important; flex-direction: column; font-size: 14px; white-space: nowrap; }
  body #app .cart-copy small { color: var(--muted); font-size: 12px; }
  body #app .address { font-size: 13px !important; max-width: 116px !important; }
  body .bottom-nav { display: none !important; }
  body .floating-cart-btn { bottom: 24px !important; }
  body #app :is(.hero,.promotions-page,.shop-view) { padding-block: 36px 48px; }
  body #app .hero { max-width: 1040px !important; }
  body #app :is(.stores,.promotions-products) { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
  body #app .home-page .categories {
    display: grid !important; grid-template-columns: repeat(9,minmax(0,1fr)) !important; grid-auto-flow: row;
    gap: 24px !important; max-width: 860px; margin: 0 auto 30px !important; padding: 0 !important; overflow: visible !important;
  }
  body #app .home-page .category { width: 72px !important; justify-self: center; gap: 9px; }
  body #app .home-page .category .cat-img {
    width: 60px !important; height: 60px !important; margin: 0 !important; border-radius: 12px !important;
    overflow: hidden; background: #f9dce2 !important; box-shadow: none; transform: none !important;
  }
  body #app .home-page .category:nth-child(2) .cat-img { background: #ffdce4 !important; }
  body #app .home-page .category:nth-child(3) .cat-img { background: #ffe2d5 !important; }
  body #app .home-page .category:nth-child(4) .cat-img { background: #fff1bf !important; }
  body #app .home-page .category:nth-child(5) .cat-img { background: #eadcf7 !important; }
  body #app .home-page .category:nth-child(6) .cat-img { background: #d9efcf !important; }
  body #app .home-page .category:nth-child(7) .cat-img { background: #ffedbd !important; }
  body #app .home-page .category:nth-child(8) .cat-img { background: #dff2fa !important; }
  body #app .home-page .category:nth-child(9) .cat-img { background: #dff4f1 !important; }
  body #app .home-page .category .cat-img::before { display: none !important; }
  body #app .home-page .category .cat-img img.home-cat-art,
  body #app .home-page .category .cat-img img.category-icon { width: 100% !important; height: 100% !important; bottom: auto; left: auto; transform: none; object-fit: contain; filter: none; }
  body #app .home-page .category span { font-size: 12px !important; white-space: nowrap !important; line-height: 1.3 !important; }
  body #app .home-page .home-coupon-banner {
    width: 100% !important; max-width: 1032px; min-height: 0 !important; height: 243px !important; margin: 0 auto !important;
    border-radius: 12px !important; overflow: hidden; background-position: center !important;
  }
  body #app .home-page .home-coupon-copy { max-width: 54%; padding: 54px 32px !important; }
  body #app .home-page .home-coupon-copy > span { font-size: 13px !important; font-weight: 700; }
  body #app .home-page .home-coupon-copy h2 { font-size: 26px !important; line-height: 1.2; margin: 8px 0 4px; }
  body #app .home-page .home-coupon-copy p { font-size: 14px !important; margin: 0 0 12px; }
  body #app .home-page .home-coupon-copy button { min-height: 36px; padding: 7px 14px; font-size: 12px !important; }
  body #app .home-page .home-banner-dots { display: none !important; }
  body #app .home-page .filters { justify-content: center; gap: 10px; margin: 10px auto 26px; }
  body #app .home-page .filter { min-height: 32px; padding: 5px 16px; border-radius: 999px; background: #fff; font-size: 12px !important; }
  body #app .home-page .section-head { max-width: 1040px; margin: 0 auto 14px !important; }
  body #app .home-page .section-head h2 { font-size: 20px !important; }
  body #app .home-page .stores { max-width: 1040px; margin-inline: auto; }
  body #overlay:has(.checkout-drawer) { align-items: center !important; justify-content: center !important; padding: 24px !important; }
  body #overlay .checkout-drawer {
    display: grid; grid-template-columns: minmax(0,1fr) 320px; column-gap: 32px; align-content: start; align-items: start;
    width: 1100px !important; max-width: 100% !important; height: auto !important; max-height: calc(100dvh - 48px) !important; border-radius: 8px !important;
  }
  body #overlay .checkout-drawer .drawer-head { grid-column: 1 / -1; grid-row: 1; }
  body #overlay .checkout-summary { grid-column: 2; grid-row: 2 / span 3; position: sticky; top: 88px; }
  body #overlay .checkout-drawer > :not(.drawer-head):not(.checkout-summary) { grid-column: 1; }
  body #overlay #checkoutForm { grid-template-columns: minmax(0,1fr); }
  body #app .seller-shell { max-width: none !important; padding-left: var(--sidebar-width) !important; transition: padding-left .2s ease; }
  body #app .sv-nav {
    position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 30;
    width: var(--sidebar-width); margin: 0; padding: 16px 12px; display: flex; flex-direction: column;
    border-right: 1px solid var(--line); background: #fff; overflow-y: auto; overflow-x: hidden; transition: width .2s ease;
  }
  body #app .sv-nav button { text-align: left; border-radius: 8px; padding: 12px; min-width: 0; white-space: nowrap; }
  body #app .sv-nav .sidebar-toggle { display: block; align-self: flex-end; text-align: center; width: 44px; font-size: 26px; padding: 0; }
  body.sidebar-collapsed { --sidebar-width: 64px; }
  body.sidebar-collapsed #app .sv-nav { padding-inline: 10px; }
  body.sidebar-collapsed #app .sv-nav button:not(.sidebar-toggle) { display: none; }
  body #app :is(.sv-cards,.sv-fin) { grid-template-columns: repeat(4,minmax(0,1fr)); }
  body #app .sv-fin .sv-card.hero { grid-column: span 2; }
  body #app .product-admin { grid-template-columns: 72px minmax(0,1fr) auto; }
  body #app .product-admin-actions { grid-column: auto; }
  body #app .site-footer-grid { grid-template-columns: 1.4fr repeat(3,1fr); gap: 32px; }
  body.is-seller #app .topbar-inner { grid-template-columns: 100px minmax(0,1fr); }
  body.is-seller #app .topbar-right { grid-column: 2; max-width: 600px; justify-self: end; width: 100% !important; }
}
@media (min-width: 1280px) {
  body #app .topbar-inner {
    width: min(100% - 64px, 1320px) !important; max-width: 1320px !important;
    grid-template-columns: 58px minmax(252px,auto) minmax(360px,420px) minmax(0,1fr) !important;
  }
  body #app .topbar-inner > .search {
    width: 100% !important; min-width: 0; border: 1px solid #eef0f4;
    background: #f5f6f8; border-radius: 10px; padding-inline: 14px;
  }
  body #app .topbar-inner > .search input { flex: 1 1 auto; min-width: 0; }
  body #app .topbar-right > .address {
    flex: 0 1 180px !important; width: 180px !important; max-width: 180px !important;
    justify-content: center; padding-inline: 8px !important; gap: 8px;
  }
  body #app .topbar-right > .address #addressLabel {
    overflow: visible; text-overflow: clip; white-space: nowrap;
  }
  body #app .hero,
  body #app .promotions-page,
  body #app .shop-view { max-width: 1320px !important; }
  body #app .home-page .categories { max-width: 1120px; }
  body #app .home-page .home-coupon-banner { max-width: 1320px; }
  body #app .home-page .section-head,
  body #app .home-page .stores { max-width: 1320px; }
  body #app .stores { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
  body #app .promotions-products { grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
  body #app .shop-view .products { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
}
@media (min-width: 1440px) {
  body #app .topbar-right > .address {
    flex-basis: 240px !important; width: 240px !important; max-width: 240px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  body *,body *::before,body *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Visibility belongs to application state, never to the layout grid. */
body #app [hidden], body #overlay [hidden], body #app .hidden,
body #app .sd-hidden-section, body #overlay .hidden { display: none !important; }
@media (max-width: 767px) {
  body #app .home-page .home-filters {
    display: flex !important; flex-wrap: nowrap !important; justify-content: flex-start !important;
    gap: 8px; width: 100%; margin: 10px 0 26px; padding: 4px 2px 9px;
    overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none;
  }
  body #app .home-page .home-filters::-webkit-scrollbar { display: none; }
  body #app .home-page .home-filters .filter {
    flex: 0 0 auto; min-height: 42px; padding: 0 14px; border: 1px solid #e1e5eb;
    border-radius: 999px; background: #fff; color: #526071; box-shadow: 0 2px 7px #1522380b;
    font-size: 12px !important; font-weight: 700; white-space: nowrap;
  }
  body #app .home-page .home-filters .filter:active { transform: translateY(1px); }
  body #app .home-page .home-filters .filter.active {
    border-color: #e51d3d; background: #fff1f3; color: #c91836;
  }
}
.auth-partner-links {
  margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line);
  text-align: center;
}
.auth-partner-links p { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.auth-partner-links > div { display: grid; gap: 8px; }
.auth-partner-links button {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  min-height: 42px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 700;
}
.auth-partner-links button:hover { border-color: var(--red); color: var(--red); background: #fff8f8; }
