:root {
  color-scheme: light;
  --paper: #fff;
  --surface: #f3f4f6;
  --action: #41454b;
  --ink: #202124;
  --line: #e5e7eb;
  --muted: #626975;
  --sale: #dc2626;
  --price: #166534;
  --shadow: 0 4px 16px #2021240b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 system-ui, sans-serif; }
header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px max(14px, calc((100% - 1100px) / 2)); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; line-height: 1.25; }
.brand strong { font-size: clamp(15px, 4.6vw, 24px); }
.brand small { display: block; margin-top: 3px; font-weight: 650; }
.brand-mark {
  position: relative; display: inline-block; flex: 0 0 29px; height: 29px; margin-top: 8px;
  border: 2px solid var(--ink); border-radius: 4px;
  background: linear-gradient(153deg, transparent 55%, #bc2634 56% 63%, white 64% 68%, #21804a 69% 78%, transparent 79%);
}
.brand-mark::before {
  content: ""; position: absolute; inset: -10px 6px auto; height: 11px;
  border: 2px solid var(--ink); border-bottom: 0; border-radius: 9px 9px 0 0;
}
main { max-width: 1132px; margin-inline: auto; padding: 16px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { font-size: clamp(26px, 4.8vw, 46px); line-height: 1.18; }
h2 { font-size: clamp(21px, 3.6vw, 28px); }
h3 { line-height: 1.35; }
a { color: var(--action); }
button, .cta, .tabs a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 1px solid transparent; border-radius: 11px; padding: 8px 14px;
  background: var(--action); color: white; font: inherit; font-weight: 650;
  text-align: center; text-decoration: none; cursor: pointer;
}
button:hover, .cta:hover { filter: brightness(.91); }
button:disabled { opacity: .53; cursor: not-allowed; }
:focus-visible { outline: 3px solid #535963; outline-offset: 3px; }
.language, .tabs a, .tabs button[aria-pressed=false] { background: var(--surface); color: var(--ink); border-color: var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.tabs > * { flex: 1 1 auto; }
.hero {
  background: linear-gradient(270deg, #202124 0%, #202124ce 39%, #20212400 76%), #41454b url("./modern-gray-hero.webp") center / cover; color: white;
  border-radius: 18px; padding: clamp(18px, 4vw, 48px); min-height: clamp(215px, 30vw, 360px);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.hero h1 { margin: 3px 0 0; }
.hero p { max-width: 37ch; margin: 7px 0 12px; color: #f3f4f6; }
.hero .hero-market { font-weight: 800; font-size: 19px; direction: ltr; }
.hero button { background: var(--paper); color: var(--ink); }
#cats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; margin-block: 18px; }
#cats button {
  flex-direction: column; min-height: 65px; padding: 5px; gap: 2px;
  color: var(--ink); background: var(--surface); border-color: var(--line); font-size: 13px;
}
#cats button[aria-pressed=true] { color: white; background: var(--action); }
.category-symbol { font-size: 21px; line-height: 1; }
.toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 9px; }
input:not([type=checkbox]), select {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px;
  border: 1px solid #9298a1; border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; margin-block: 12px 22px; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.card > :first-child { margin-top: 0; }
.card h3 { margin-block: .35rem; }
.card .cta { display: flex; }
.deal { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.deal p { margin: 0; }
.deal .cta { margin-top: auto; }
.price { color: var(--price); font-weight: 800; font-size: clamp(19px, 4vw, 27px); }
.price-reference { color: var(--muted); }
.badge { align-self: flex-start; background: var(--sale); color: white; border-radius: 20px; padding: 2px 8px; font-weight: 750; font-size: 13px; }
.product-image { width: 100%; height: 140px; object-fit: contain; }
.muted { color: var(--muted); font-size: 14px; }
.icon { font-size: 24px; filter: grayscale(1); }
.empty { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 15px; margin: 0; }
.information { margin-block: 24px 12px; background: var(--surface); }
footer { background: var(--surface); border-top: 1px solid var(--line); padding: 16px; text-align: center; }
.mobile-nav { display: none; }
dialog { max-width: min(520px, calc(100vw - 24px)); max-height: 90dvh; padding: 13px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); }
dialog::backdrop { background: #202124a8; }
dialog form { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.admin-page { background: var(--surface); }
.admin-page header { background: var(--paper); }
.admin-page main { max-width: 900px; }
.admin-page #form { max-width: 540px; }
.admin-page label { display: block; margin-bottom: 5px; font-weight: 600; }
.admin-page #error:empty, .admin-page #catalogMessage:empty { display: none; }
.status-card { margin-block: 13px; }
.status-card dl { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; overflow-wrap: anywhere; }
.status-card dt { color: var(--muted); }
.status-card dd { margin: 0; font-weight: 750; }
.status-chip { display: inline-block; padding: 3px 9px; border-radius: 8px; font-weight: 700; background: var(--surface); }
.status-chip[data-state=ok] { color: var(--price); background: #eaf5ed; }
.status-chip[data-state=failed], #error { color: #a51d22; }
.status-chip[data-state=failed] { background: #fef2f2; }

#categories { margin-block: 15px; }
#moreCategories { display: none; }
@media (max-width: 640px) {
  main { padding: 12px; }
  .storefront { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tabs > * { padding-inline: 7px; font-size: 13px; }
  #cats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-block: 0 8px; }
  #cats button { overflow-wrap: anywhere; }
  #cats:not(.categories-expanded) button:nth-child(n+5) { display: none; }
  #moreCategories { display: inline-flex; width: 100%; }
  .mobile-nav a[aria-current] { color: var(--ink); background: var(--surface); border-radius: 9px; }
  .storefront .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .storefront .grid .card { padding: 10px; }
  .storefront .grid .card .cta, .deal-details { padding-inline: 5px; font-size: 13px; }
  .product-image { height: 100px; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; inset: auto 0 0;
    z-index: 2; padding: 4px 5px calc(4px + env(safe-area-inset-bottom)); background: var(--paper);
    box-shadow: 0 -3px 15px #20212410; border-top: 1px solid var(--line);
  }
  .mobile-nav a { display: grid; justify-items: center; align-content: center; min-height: 52px; text-decoration: none; font-weight: 700; font-size: 12px; }
  .mobile-nav a span:first-child { font-size: 22px; line-height: 1.1; }
}
#productForm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}
#productForm label span { display: block; margin-block-end: 4px; }
#productForm input[type="checkbox"] { width: auto; margin: 8px 0; }
.product-admin-row { border-top: 1px solid var(--line); padding-block: 12px; }
.product-admin-row button { margin-inline-end: 6px; margin-block: 3px; }
#history p { overflow-wrap: anywhere; }
#productForm select { width: 100%; min-height: 42px; }
#overview a { display: inline-block; padding: 10px; margin: 4px; }
#overview dl { gap: 8px 18px; }

#amazonImport form { display: grid; gap: .65rem; }
#amazonImport button, #amazonImport select { margin-block: .55rem; margin-inline-end: .45rem; }
.amazon-preview { padding-block: .8rem; border-block-start: 1px solid var(--line); }
.amazon-preview img { display: block; width: min(100%, 180px); height: auto; }
#manualDetails { margin-block: 1rem; }
#amazonDetailsHeading, #amazonCatalogHeading { scroll-margin-block-start: 1rem; overflow-wrap: anywhere; }
.amazon-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-block-start: .8rem; }
#amazonImport .amazon-actions button { min-height: 44px; margin: 0; }
.amazon-preview label { display: block; margin-block-start: .75rem; }
.amazon-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  #amazonImport .amazon-actions button { flex: 1 1 100%; }
}

html[dir=ltr] .hero { background-image: linear-gradient(90deg, #202124 0%, #202124e8 42%, #20212420 83%), url("./modern-gray-hero.webp"); background-position: right center; }

.ui-icon {
  display: block;
  inline-size: 21px;
  block-size: 21px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.guide-card { display: flex; flex-direction: column; gap: 7px; }
.guide-card > * { margin: 0; }
.guide-card .cta { margin-block-start: auto; }
.guide-category { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.guide-category .ui-icon { inline-size: 18px; block-size: 18px; }
.guide-card p { font-size: .87rem; line-height: 1.45; margin-block-end: 3px; }
.tabs > * { flex-basis: calc(25% - 6px); min-inline-size: 0; }
#offerSection, #guides, #information, #categories { scroll-margin-block-start: 12px; }
.admin-page .card { overflow-wrap: anywhere; }
.admin-page #overview a { margin-inline: 0 5px; }
.admin-page select { text-overflow: ellipsis; }
.admin-page #history { min-inline-size: 0; }
@media (max-width: 640px) {
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .tabs > * { padding-inline: 4px; line-height: 1.28; }
  .toolbar { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .toolbar select { justify-self: start; width: auto; max-width: 100%; }
  .guide-card { gap: 5px; }
  .guide-card h3 { margin-block: 0; }
  .guide-card p { margin-block: 0 4px; }
  .storefront:has(#q:focus) .mobile-nav { visibility: hidden; }
  html:has(.storefront) { scroll-padding-block-end: calc(70px + env(safe-area-inset-bottom)); }
  .toolbar input, .toolbar select { font-size: .875rem; }
  .mobile-nav a { gap: 3px; }
  .mobile-nav a[aria-current] { box-shadow: inset 0 2px var(--action); }
}
@media (max-width: 330px) {
  .storefront .grid { grid-template-columns: minmax(0, 1fr); }
}

#guideForm { display: grid; gap: 9px; }
#guideForm textarea {
  display: block; width: 100%; min-height: 76px; padding: 9px;
  border: 1px solid #9298a1; border-radius: 10px; font: inherit; resize: vertical;
}
#guideForm button { justify-self: start; }
#guideAdminList a { display: inline-flex; min-height: 44px; align-items: center; margin-inline-end: 9px; }
