:root {
  color-scheme: light;
  --bg: #f7f9f8;
  --surface: #ffffff;
  --surface-soft: #edf7f4;
  --ink: #17211f;
  --muted: #65726f;
  --line: #dce5e2;
  --accent: #0f766e;
  --accent-strong: #0a5a54;
  --accent-soft: #dff3ee;
  --coral: #d85d4f;
  --amber: #d39424;
  --blue: #3974a8;
  --shadow: 0 12px 34px rgba(27, 52, 47, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111917;
  --surface: #18221f;
  --surface-soft: #1d2d29;
  --ink: #eef5f2;
  --muted: #9baca7;
  --line: #30403b;
  --accent: #46b9aa;
  --accent-strong: #75d5c9;
  --accent-soft: #203c37;
  --coral: #ed8376;
  --amber: #e3ae52;
  --blue: #6ca2d0;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
}

.header-status {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-size: 0.86rem;
}

.header-status strong {
  color: var(--ink);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-text-button,
.basket-button,
.search-button,
.pager-button,
.close-button,
.add-button,
.text-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.icon-text-button,
.basket-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 13px;
}

.icon-text-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.basket-button {
  background: var(--accent);
  color: #fff;
}

.basket-button strong {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--accent-strong);
  font-size: 0.76rem;
}

.search-band {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--accent-soft) 80%, var(--surface)), var(--surface) 58%, color-mix(in srgb, #f7d9a4 24%, var(--surface)));
}

.search-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 42px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 2.45rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 680px;
  margin: 12px auto 24px;
  color: var(--muted);
  font-size: 1rem;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: min(720px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid var(--surface);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-form:focus-within {
  border-color: var(--accent);
}

.search-form input {
  min-width: 0;
  min-height: 56px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0 18px;
  outline: 0;
  font-size: 1rem;
}

.search-button {
  min-width: 90px;
  margin: 5px;
  background: var(--accent);
  color: #fff;
}

.quick-search {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 0.84rem;
}

.quick-search button {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.quick-search button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.category-band,
.catalog-shell,
.site-footer {
  width: min(1380px, calc(100% - 40px));
  margin-right: auto;
  margin-left: auto;
}

.site-footer nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.site-footer nav a {
  color: inherit;
  font-weight: 700;
}

.category-band {
  padding: 28px 0 8px;
}

.section-line,
.filter-heading,
.results-head,
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-line h2,
.filter-heading h2,
.results-head h2,
.drawer-head h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.text-button {
  min-height: 34px;
  padding: 0 4px;
  background: transparent;
  color: var(--accent-strong);
  font-size: 0.84rem;
}

.category-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.category-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.category-chip:nth-child(3n + 2) .category-symbol {
  background: color-mix(in srgb, var(--amber) 17%, var(--surface));
  color: var(--amber);
}

.category-chip:nth-child(3n) .category-symbol {
  background: color-mix(in srgb, var(--blue) 16%, var(--surface));
  color: var(--blue);
}

.category-chip:hover,
.category-chip.is-active {
  border-color: var(--accent);
  box-shadow: 0 5px 18px rgba(15, 118, 110, 0.1);
}

.category-chip.is-active {
  background: var(--accent-soft);
}

.category-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.category-chip strong,
.category-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chip strong {
  font-size: 0.86rem;
}

.category-chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.catalog-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 22px 0 48px;
}

.filters-panel {
  position: sticky;
  top: 84px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.filter-heading.compact h3 {
  margin: 0;
  font-size: 0.92rem;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.field > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
}

.filter-group {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.category-filter-group {
  margin-top: 14px;
  padding-top: 0;
  border-top: 0;
}

.category-tree {
  display: grid;
  max-height: 510px;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.category-tree-group {
  border-bottom: 1px solid var(--line);
}

.category-tree-group:last-child {
  border-bottom: 0;
}

.category-tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 2px;
  align-items: center;
}

.category-tree-filter,
.category-tree-toggle,
.subcategory-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}

.category-tree-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 38px;
  padding: 7px 5px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 800;
}

.category-tree-filter span,
.subcategory-button span {
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.category-tree-filter small,
.subcategory-button small {
  flex: none;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
}

.category-tree-toggle {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 850;
}

.category-tree-filter:hover,
.category-tree-toggle:hover,
.subcategory-button:hover,
.category-tree-filter.is-active,
.subcategory-button.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.category-tree-group.has-active > .category-tree-row .category-tree-toggle {
  background: var(--accent-soft);
}

.subcategory-list {
  display: grid;
  gap: 2px;
  padding: 2px 0 8px 12px;
}

.subcategory-button {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 680;
}

.check-list {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 8px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  font-weight: 680;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.store-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.check-row:nth-child(2n) .store-dot {
  background: var(--coral);
}

.check-row:nth-child(3n) .store-dot {
  background: var(--amber);
}

.data-note {
  display: grid;
  gap: 3px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.data-note span,
.data-note small {
  color: var(--muted);
  font-size: 0.76rem;
}

.data-note strong {
  font-size: 0.82rem;
}

.results-area {
  min-width: 0;
}

.results-head {
  min-height: 50px;
  scroll-margin-top: 82px;
}

.active-filter {
  max-width: 45%;
  overflow: hidden;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin-top: 15px;
}

.product-card {
  display: grid;
  grid-template-rows: 150px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 20px rgba(30, 60, 54, 0.05);
}

.product-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow);
}

.product-media {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

[data-theme="dark"] .product-media {
  background: #f0f4f2;
}

.product-media img {
  display: block;
  width: calc(100% - 36px);
  height: 96px;
  min-width: 0;
  min-height: 0;
  max-height: 96px;
  margin-bottom: 20px;
  object-fit: contain;
  object-position: center;
}

.image-placeholder {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 1.4rem;
  font-weight: 900;
}

.category-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  max-width: calc(100% - 58px);
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #40504c;
  font-size: 0.69rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-button {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(20, 40, 35, 0.1);
}

.add-button.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.product-content {
  display: flex;
  min-width: 0;
  padding: 13px;
  flex-direction: column;
}

.product-content h3 {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  font-size: 0.94rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-meta {
  overflow: hidden;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-prices {
  display: flex;
  min-height: 27px;
  flex-wrap: wrap;
  gap: 5px;
  align-content: flex-start;
}

.store-price {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.68rem;
}

.store-price strong {
  color: var(--ink);
}

.more-prices {
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.best-price-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-height: 68px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.best-price-row > div {
  min-width: 0;
}

.best-label,
.best-price-row small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.best-price {
  display: block;
  color: var(--accent-strong);
  font-size: 1.18rem;
  line-height: 1.25;
}

.store-link {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 850;
  text-decoration: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.pager-button {
  min-width: 100px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.pager-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.loading-state,
.empty-state {
  grid-column: 1 / -1;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-state span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: loading 900ms ease-in-out infinite alternate;
}

.loading-state span:nth-child(2) {
  animation-delay: 160ms;
}

.loading-state span:nth-child(3) {
  animation-delay: 320ms;
}

@keyframes loading {
  to { opacity: 0.25; transform: translateY(-5px); }
}

.empty-state,
.empty-basket {
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong,
.empty-basket strong {
  color: var(--ink);
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 28px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 4px 0 0;
}

.site-footer > p {
  max-width: 420px;
  text-align: right;
}

.drawer-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgba(13, 24, 21, 0.52);
}

.basket-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  display: grid;
  width: min(460px, 100%);
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -15px 0 45px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.basket-drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  min-height: 78px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.close-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.35rem;
}

.drawer-body {
  overflow-y: auto;
  padding: 16px 18px 28px;
}

.basket-items,
.basket-totals {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.basket-item,
.basket-total {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.basket-item > div,
.basket-total > div {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.basket-item strong,
.basket-item span,
.basket-total strong,
.basket-total span {
  display: block;
}

.basket-item > div > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basket-item span,
.basket-total span {
  color: var(--muted);
  font-size: 0.75rem;
}

.basket-item button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--coral);
  font-size: 1.1rem;
}

.basket-comparison {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}

.basket-total.is-best {
  color: var(--accent-strong);
}

.empty-basket {
  min-height: 210px;
}

/* Local admin page */
.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.admin-band,
.admin-panel,
.status-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.admin-band h1 {
  margin: 0;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 16px 0;
  overflow: hidden;
}

.status-strip > div {
  min-width: 0;
  padding: 13px;
  border-right: 1px solid var(--line);
}

.status-strip > div:last-child {
  border-right: 0;
}

.status-strip strong,
.status-strip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-strip span {
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.admin-panel {
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
}

.log-box {
  min-height: 350px;
  max-height: 520px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 13px;
  border-radius: 8px;
  background: #101816;
  color: #d9ece7;
  font: 0.82rem/1.5 "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
}

.duplicate-workspace {
  margin-top: 16px;
  padding: 20px 0 4px;
  border-top: 2px solid var(--ink);
}

.duplicate-head,
.duplicate-row-head,
.duplicate-actions,
.duplicate-summary {
  display: flex;
  align-items: center;
}

.duplicate-head,
.duplicate-row-head {
  justify-content: space-between;
  gap: 16px;
}

.duplicate-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.duplicate-toolbar {
  display: grid;
  grid-template-columns: 190px minmax(240px, 1fr) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.duplicate-toolbar .field {
  margin-top: 0;
}

.duplicate-toolbar input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.duplicate-summary {
  gap: 7px;
  min-height: 48px;
  color: var(--muted);
  font-size: 0.86rem;
}

.duplicate-summary strong {
  color: var(--ink);
  font-size: 1rem;
}

#duplicateActionState {
  margin-left: auto;
  color: var(--accent-strong);
  font-weight: 750;
  text-align: right;
}

.duplicate-list {
  border-top: 1px solid var(--line);
}

.duplicate-row {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.duplicate-row-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.duplicate-row-head strong,
.duplicate-row-head span {
  overflow-wrap: anywhere;
}

.duplicate-row-head span {
  color: var(--muted);
  font-size: 0.8rem;
}

.duplicate-score {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--accent-soft);
  border-radius: 6px;
  background: var(--accent-pale);
  color: var(--accent-strong) !important;
  font-weight: 850;
}

.duplicate-products {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-top: 13px;
}

.duplicate-product {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.duplicate-image,
.duplicate-image img,
.duplicate-image-empty {
  width: 116px;
  height: 104px;
}

.duplicate-image {
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
}

.duplicate-image img {
  display: block;
  object-fit: contain;
}

.duplicate-image-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.duplicate-product-copy {
  min-width: 0;
}

.duplicate-product h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.duplicate-product p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.duplicate-offers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.duplicate-offers a,
.duplicate-offers span {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 750;
  text-decoration: none;
}

.duplicate-offers a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.duplicate-divider {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 900;
}

.duplicate-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.duplicate-actions .button {
  min-height: 38px;
}

.duplicate-empty {
  margin: 0;
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.duplicate-more {
  display: block;
  margin: 16px auto 0;
}

@media (max-width: 1120px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 14px;
  }

  .header-status,
  .desktop-label {
    display: none;
  }

  .icon-text-button {
    width: 42px;
    padding: 0;
  }

  .search-inner {
    width: min(100% - 28px, 720px);
    padding: 34px 0 30px;
  }

  h1 {
    font-size: 2rem;
  }

  .category-band,
  .catalog-shell,
  .site-footer {
    width: min(100% - 28px, 1380px);
  }

  .catalog-shell,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .filter-group {
    margin-top: 16px;
  }

  .check-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    flex-direction: column;
  }

  .site-footer > p {
    text-align: left;
  }

  .admin-band {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .duplicate-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .duplicate-search-field {
    grid-column: 1 / -1;
  }

  .duplicate-products {
    grid-template-columns: 1fr;
  }

  .duplicate-divider {
    min-height: 22px;
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand {
    font-size: 1.05rem;
  }

  .basket-button {
    padding: 0 10px;
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .search-form input {
    padding: 0 12px;
    font-size: 0.9rem;
  }

  .duplicate-workspace {
    padding-top: 16px;
  }

  .duplicate-head,
  .duplicate-actions,
  .duplicate-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .duplicate-toolbar {
    grid-template-columns: 1fr;
  }

  .duplicate-search-field {
    grid-column: auto;
  }

  .duplicate-product {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .duplicate-image,
  .duplicate-image img,
  .duplicate-image-empty {
    width: 88px;
    height: 88px;
  }

  .duplicate-actions .button {
    width: 100%;
  }

  #duplicateActionState {
    margin-left: 0;
    text-align: left;
  }

  .category-chips {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 78vw);
    overflow-x: auto;
    padding-bottom: 5px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .category-chip {
    scroll-snap-align: start;
  }

  .product-grid,
  .check-list {
    grid-template-columns: 1fr;
  }

  .product-card {
    grid-template-rows: 170px minmax(0, 1fr);
  }

  .section-line,
  .results-head {
    align-items: flex-start;
  }

  .active-filter {
    max-width: 44%;
  }

  .site-footer {
    padding-bottom: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
