*{box-sizing:border-box}body{margin:0;background:#fcf3f5;color:#332027;font:16px system-ui,sans-serif}header{display:flex;align-items:center;gap:14px;padding:12px max(16px,calc((100% - 980px)/2));background:#381e2b;color:white;flex-wrap:wrap}header img{width:62px;border-radius:50%}header h1{font-size:1.3rem;margin:0;margin-inline-end:auto}header a{color:#fff}main{padding:18px;max-width:1010px;margin:auto}section,article,#login{background:white;border:1px solid #eedadf;border-radius:16px;padding:16px;margin:16px 0}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}.grid article{margin:0}form{display:grid;gap:10px;max-width:570px}label{display:grid;gap:5px}input,textarea,select,button{font:inherit;min-height:44px;padding:8px;border:1px solid #cbb0b8;border-radius:8px;width:100%}button{background:#783b55;color:white;cursor:pointer}button:disabled{opacity:.5;cursor:default}a{color:#783b55}footer{display:flex;flex-wrap:wrap;gap:15px}[hidden]{display:none!important}#status{font-weight:700;scroll-margin:12px}#status:empty{display:none}
.grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr));gap:18px}
.grid article{display:flex;flex-direction:column;gap:10px;padding:12px}
.grid article h3,.grid article p{margin:0;overflow-wrap:anywhere}
.grid article>button{margin-top:auto}
.cover{display:block;width:100%;aspect-ratio:4/5;object-fit:contain;border-radius:12px;background:#faf1f4}
.placeholder{display:grid;place-items:center}
.thumbnails,.saved-photos{display:flex;gap:8px;flex-wrap:wrap}
.thumbnails button{width:46px;height:48px;padding:2px;background:white}
.thumbnails button[aria-pressed=true]{outline:2px solid #783b55}
.thumbnails img,.saved-photos img{width:100%;height:100%;object-fit:cover;border-radius:5px}
.price{display:flex;align-items:center;flex-wrap:wrap;gap:8px;color:#783b55}
.price del{color:#62545a}
#productFields{display:grid;gap:10px;margin:0;padding:0;border:0;min-width:0}
.saved-photos>div{display:grid;gap:4px;width:min(100%,145px)}
.saved-photos img{height:105px}
.secondary{background:white;color:#783b55}

body[data-view="store"] {
  --store-ink: #321827;
  --store-accent: #942353;
  --store-border: #edccd9;
  background: #fff6f9;
  color: var(--store-ink);
}
.store-header {
  justify-content: space-between;
  background: #fffafd;
  color: var(--store-ink);
  border-bottom: 1px solid var(--store-border);
  padding: 12px max(16px, calc((100% - 1200px)/2));
}
.store-header .brand, .store-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.store-header a {
  color: var(--store-ink);
  text-decoration: none;
  min-height: 44px;
  align-content: center;
}
.store-header .brand {
  font-weight: 800;
  white-space: nowrap;
}
.store-header img { width: clamp(42px, 8vw, 62px); }
.store-header .basket-link {
  padding: 8px 12px;
  border-radius: 24px;
  background: #f8d5e3;
  font-weight: 700;
}
#count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  border-radius: 50%;
  background: #fff;
  margin-inline-start: 4px;
}
body[data-view="store"] main { max-width: 1240px; }
.store-intro {
  margin: 4px 0 22px;
  padding: clamp(24px, 5vw, 54px);
  border-radius: 24px;
  background: linear-gradient(120deg, #f7b8d1, #fbe0eb 70%, #fff0f6);
}
.store-intro h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 3.1rem); }
body[data-view="store"] .grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr));
  gap: clamp(10px, 2vw, 22px);
}
body[data-view="store"] .grid article {
  border-color: var(--store-border);
  box-shadow: 0 8px 24px #6624410b;
  min-width: 0;
}
body[data-view="store"] .cover { background: #f9eaf0; }
body[data-view="store"] button, body[data-view="store"] .price { color: var(--store-accent); }
body[data-view="store"] button { background: #fff1f6; border-color: var(--store-border); }
body[data-view="store"] [data-add], body[data-view="store"] #checkout button {
  background: var(--store-accent);
  color: white;
  font-weight: 700;
}
body[data-view="store"] :focus-visible { outline: 3px solid var(--store-accent); outline-offset: 3px; }
.gallery-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 5px;
  margin: 7px 0;
}
.gallery-controls button { padding-inline: 3px; font-size: .83rem; }
.photo-count { font-size: .8rem; white-space: nowrap; }
.product-gallery .thumbnails {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px;
  scroll-padding-inline: 4px;
}
.product-gallery .thumbnails button { flex: 0 0 44px; }
body[data-view="store"] #basket { border-color: var(--store-border); }
#lines button { width: auto; margin-inline-start: 8px; }
@media (min-width: 375px) and (max-width: 520px) {
  body[data-view="store"] .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-view="store"] main { padding-inline: 12px; }
  body[data-view="store"] .grid article { padding: 8px; }
}
@media (max-width: 360px) {
  .store-header nav a:first-child { display: none; }
}

.size-options{display:flex;flex-wrap:wrap;gap:6px 12px;border:1px solid #eedadf;border-radius:8px;padding:8px 12px;margin:0}
.size-options label{display:inline-flex;align-items:center;gap:5px;min-height:44px;cursor:pointer}
.size-options input{width:18px;height:18px;min-height:0;margin:0;accent-color:#942353}
#legacySize:not(:empty){flex-basis:100%}
.product-size{font-weight:650}
.product-description{white-space:pre-line}

body[data-view="store"] .basket-link{display:flex;align-items:center;gap:5px;width:auto}
.basket-actions{display:flex;justify-content:flex-end;margin:12px 0}
.basket-actions button,.basket-heading button{width:auto}
.basket-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.admin-nav{display:grid;grid-template-columns:repeat(auto-fit,minmax(95px,1fr));gap:8px;margin-top:10px}
.admin-nav button[aria-pressed="false"]{color:#783b55;background:white}
.color-options{min-width:0;border:1px solid #eedadf;border-radius:8px}
.color-row{display:grid;gap:8px;padding:10px 0;border-bottom:1px solid #eedadf}
.color-row img{width:82px;height:82px;object-fit:contain}
#addColor{margin-top:8px}

body[data-view="store"]{background:#fff}
.store-header{background:#fff7fb}
.store-intro{background:#fce2ed}
#storePolicyText{white-space:pre-wrap;overflow-wrap:anywhere}
#policyForm{margin-top:8px}

body[data-view="store"] button.zoom-trigger{padding:0;border:0;background:transparent;display:block;cursor:zoom-in}
#photoViewer{width:min(94vw,800px);max-height:94dvh;padding:12px;border:0;border-radius:12px;overflow:auto}
#photoViewer::backdrop{background:#241019c9}
#photoViewer form{margin:0 0 8px}
#photoViewer button{width:max-content}
#photoViewer img{display:block;width:100%;max-height:80dvh;object-fit:contain}

.analytics-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:12px}
.analytics-metrics>div{border:1px solid #f0ccdc;background:#fff6fa;border-radius:14px;padding:14px}
.analytics-metrics dd{margin:8px 0 0;color:#782044;font-weight:750;font-size:1.2rem}
.analytics-bars{display:grid;grid-template-columns:repeat(24,minmax(0,1fr));gap:3px;direction:ltr;min-height:112px;align-items:end}
.analytics-bars meter{width:100%;height:105px;writing-mode:vertical-lr;direction:rtl}
.analytics-bars meter::-webkit-meter-optimum-value{background:#a42b60}
.analytics-bars meter::-moz-meter-bar{background:#a42b60}

body[data-view="store"]{background:var(--website-background,#fff);color:var(--website-on-background,#321827)}
.store-header,.store-intro{background:var(--website-surface,#fff7fb);color:var(--website-on-surface,#321827)}
.store-header a{color:inherit}
body[data-view="store"] .basket-link,body[data-view="store"] [data-add],body[data-view="store"] #checkout button,body[data-view="store"] #continueShopping{background:var(--website-accent,#942353);color:var(--website-on-accent,#fff)}
body[data-view="store"] #count{color:#321827}
body[data-view="store"] article,body[data-view="store"] section{color:#321827}
.website-colors{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px}
#websiteLogoPreview{width:80px;height:80px;object-fit:contain}

.store-intro { padding-block: clamp(16px, 3vw, 30px); }
.store-footer {
  display: block;
  background: var(--website-surface, #fff7fb);
  color: var(--website-on-surface, #321827);
  border-top: 1px solid var(--store-border);
}
.store-footer-inner {
  display: grid;
  gap: 18px;
  max-width: 1240px;
  margin: auto;
  padding: 20px 18px 28px;
}
.store-footer nav { display: grid; gap: 8px; }
.store-footer details { border-bottom: 1px solid var(--store-border); }
.store-footer summary { min-height: 44px; align-content: center; font-weight: 700; cursor: pointer; }
.store-footer details p { margin: 0 0 12px; }
#shippingRates { display: grid; gap: 8px; max-width: 460px; margin: 0 0 12px; }
#shippingRates div { display: flex; justify-content: space-between; gap: 12px; }
#shippingRates dd { margin: 0; }
.store-contacts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.store-contacts a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding-inline: 12px;
  border: 1px solid var(--store-border);
  border-radius: 20px;
  color: inherit;
  text-decoration: none;
}
.store-contacts a:hover { text-decoration: underline; }
.store-contacts svg { width: 20px; height: 20px; flex: none; }


.store-menu { position: relative; }
.store-menu summary {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--store-border);
  border-radius: 12px;
  cursor: pointer;
  list-style: none;
}
.store-menu summary::-webkit-details-marker { display: none; }
.store-menu ul {
  position: absolute;
  z-index: 2;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  width: max-content;
  min-width: 160px;
  list-style: none;
  padding: 6px;
  margin: 0;
  background: #fff;
  color: #321827;
  border: 1px solid var(--store-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px #32182724;
}
.store-header .store-menu a {
  display: block;
  padding-inline: 12px;
  border-radius: 8px;
}
.store-header .store-menu a:hover { background: #fff0f6; }
.store-footer details ul { margin: 0 0 12px; padding-inline-start: 24px; }
.store-footer details li + li { margin-top: 6px; }

#shippingPolicyText, #storeTermsText { white-space: pre-wrap; overflow-wrap: anywhere; }
#adminPolicies textarea { resize: vertical; }
#policySaveStatus { margin: 0; }
#policySaveStatus:empty { display: none; }

.header-contacts, #headerSocialLinks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.header-contacts { font-size: .9rem; font-weight: 700; }
.store-header .header-contacts a {
  display: grid;
  place-items: center;
  width: 44px;
  border: 1px solid var(--store-border);
  border-radius: 50%;
}
.header-contacts svg { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .header-contacts {
    flex-basis: 100%;
    padding-top: 6px;
    border-top: 1px solid var(--store-border);
  }
}

body[data-view="store"] #catalog {
  grid-template-columns: repeat(4,minmax(0,1fr));
}
body[data-view="store"] .catalog-card { gap: 7px; padding: 9px; }
body[data-view="store"] .catalog-open {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: start;
}
.catalog-name { font-weight: 750; overflow-wrap: anywhere; }
.product-code { font-size: .85rem; overflow-wrap: anywhere; opacity: .85; }
body[data-view="store"] .catalog-add {
  background: var(--website-accent,#942353);
  color: var(--website-on-accent,#fff);
}
#productDialog {
  width: min(94vw,790px);
  max-height: 92dvh;
  padding: 16px;
  border: 1px solid var(--store-border);
  border-radius: 16px;
  color: #321827;
}
#productDialog::backdrop { background: #241019b3; }
#productDialog form { margin-bottom: 12px; }
#productDialog form button { width: max-content; }
#productDetail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#productDetail > * { min-width: 0; }
.product-info { display: grid; align-content: start; gap: 10px; }
.product-info :is(h2,p) { margin: 0; overflow-wrap: anywhere; }
#productMessage:empty { display: none; }
@media (max-width: 850px) {
  body[data-view="store"] #catalog { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  body[data-view="store"] #catalog { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #productDetail { grid-template-columns: minmax(0,1fr); }
  #productDetail .cover { max-height: 46dvh; }
}

/* Keep the catalog responsive to pointer, keyboard, and touch. */
body[data-view="store"] .catalog-card {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
body[data-view="store"] .catalog-card:has(:focus-visible) {
  border-color: var(--website-accent,#942353);
  box-shadow: 0 10px 24px #32182724;
}
@media (hover: hover) and (pointer: fine) {
  body[data-view="store"] .catalog-card:hover {
    transform: translateY(-4px);
    border-color: var(--website-accent,#942353);
    box-shadow: 0 12px 26px #32182724;
  }
}
body[data-view="store"] .catalog-card:active {
  transform: scale(.985);
}
@media (prefers-reduced-motion: reduce) {
  body[data-view="store"] .catalog-card { transition: none; }
  body[data-view="store"] .catalog-card:is(:hover,:active) { transform: none; }
}

#productDetail .product-gallery:has(.thumbnails) {
  display: grid;
  grid-template-columns: 54px minmax(0,1fr);
  grid-template-rows: auto auto;
  align-content: start;
  gap: 8px;
}
#productDetail .product-gallery:has(.thumbnails) .zoom-trigger {
  grid-column: 2;
  grid-row: 1;
}
#productDetail .gallery-controls {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
}
#productDetail .thumbnails {
  grid-column: 1;
  grid-row: 1 / span 2;
  flex-direction: column;
  align-self: start;
  overflow: visible;
}
#productDetail .thumbnails button { width: 100%; }
@media (max-width: 600px) {
  #productDetail .product-gallery:has(.thumbnails) { grid-template-columns: minmax(0,1fr); }
  #productDetail .product-gallery:has(.thumbnails) .zoom-trigger { grid-column: 1; }
  #productDetail .thumbnails {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    flex-direction: row;
    overflow-x: auto;
  }
  #productDetail .gallery-controls { grid-column: 1; grid-row: 3; }
}

.catalog-cover { position: relative; display: block; }
.discount-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 5px;
  background: #b91c1c;
  color: #fff;
  font-size: .82rem;
  font-weight: 750;
  line-height: 1.25;
}

#lines { list-style: none; display: grid; gap: 8px; padding: 0; }
.basket-item {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--store-border);
  border-radius: 10px;
}
.basket-item > :is(img,.basket-thumb-placeholder) {
  width: 58px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #faf1f4;
}
.basket-item div { display: grid; gap: 3px; overflow-wrap: anywhere; }
.basket-item div span { font-size: .85rem; }
.footer-brand strong { display: inline-block; font-size: 1.3rem; }
.footer-brand p { margin: 5px 0 0; }
.store-footer-inner { grid-template-columns: minmax(0,1fr) auto; align-items: center; }
@media (max-width: 650px) {
  .store-footer-inner { grid-template-columns: minmax(0,1fr); }
}
#policyDialog {
  width: min(94vw,650px);
  max-height: 90dvh;
  padding: 18px;
  border: 1px solid var(--store-border);
  border-radius: 16px;
  color: #321827;
}
#policyDialog::backdrop { background: #241019b3; }
#policyDialog form button { width: max-content; }
#policyDialog details { border-bottom: 1px solid var(--store-border); }
#policyDialog summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
#policyDialog details p { margin: 0 0 12px; }
.store-header .store-menu #openPolicies {
  text-align: start;
  padding-inline: 12px;
  background: transparent;
  border: 0;
  color: inherit;
}
.store-header .store-menu #openPolicies:hover { background: #fff0f6; }

.store-header .store-menu li > a:first-child { display: block; }

.order-receipt {
  padding: 16px;
  background: #f4faf6;
  border: 1px solid #bad7c4;
  border-radius: 12px;
}
.order-receipt :is(h3,p) { margin: 0; overflow-wrap: anywhere; }
.order-receipt p { margin-top: 8px; }

#lines .basket-quantity { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
#lines .basket-quantity button { width: 44px; padding: 0; margin: 0; }
.basket-quantity output { min-width: 1.3em; text-align: center; }

#receiptWhatsApp {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  padding-inline: 12px;
  border-radius: 8px;
  background: #166534;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
