:root {
  --paper: #f4efe7;
  --ink: #241e1a;
  --muted: #6e645b;
  --line: #e4dacd;
  --card: #fffdfb;
  --accent: #8a4630;
  --accent-soft: #f3e4dc;
  --good: #1f6b45;
  --shadow: 0 18px 50px rgba(48, 32, 20, 0.12);
  --serif: "Frank Ruhl Libre", "Times New Roman", serif;
  --sans: "Heebo", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 100% -10%, #efe4d4 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.top {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 28px 8px;
}
.brand { min-width: 180px; }
.eyebrow {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 11px;
  color: var(--muted);
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
}

.search { position: relative; flex: 1; }
.search input, .order-form input, .order-form textarea, .pager input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 12px 18px;
  outline: none;
}
.search input:focus, .order-form input:focus, .order-form textarea:focus, .pager input:focus {
  border-color: #c4a892;
}
.search-results {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow: auto;
}
.search-results button {
  display: block;
  width: 100%;
  text-align: right;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.search-results button:hover { background: #faf6f1; }
.search-results small { display: block; color: var(--muted); }

.cart-btn, .primary, .actions button, .pager button, .text-btn {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 10px 16px;
}
.cart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #f7f1e8;
  border-color: var(--ink);
}
.cart-btn span {
  min-width: 22px;
  height: 22px;
  border-radius: 99px;
  background: #f3e4dc;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
}

.categories {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 8px 28px 14px;
  scrollbar-width: thin;
}
.categories button {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
}
.categories button.active {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}

.layout { padding: 0 28px 48px; }
.stage-bar, .pager, .picker-actions, .cart-head, .actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stage-bar { justify-content: space-between; }
.page-label { margin: 0; color: var(--muted); }
.pager label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pager input { width: 72px; border-radius: 12px; padding: 8px 10px; text-align: center; }
.hint, .fine, .status { color: var(--muted); font-size: 14px; }
.hint { margin: 4px 0 12px; }

.sheet-wrap {
  display: flex;
  justify-content: center;
}
.sheet {
  position: relative;
  width: min(920px, 100%);
  background: var(--card);
  box-shadow: var(--shadow);
  line-height: 0;
}
.sheet img { width: 100%; height: auto; display: block; }
#hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 0;
  line-height: 0;
}
.hotspot:hover, .hotspot:focus-visible {
  border-color: rgba(138, 70, 48, 0.55);
  background: rgba(138, 70, 48, 0.08);
}
.hotspot.selected {
  border-color: var(--good);
  background: rgba(31, 107, 69, 0.14);
}
.hotspot .qty {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--good);
  color: white;
  font-size: 12px;
  line-height: 22px;
  font-weight: 600;
}
.hotspot.flash { animation: flash 1s ease; }
@keyframes flash {
  0% { box-shadow: 0 0 0 0 rgba(138, 70, 48, 0.45); }
  100% { box-shadow: 0 0 0 16px transparent; }
}

.page-products {
  width: min(920px, 100%);
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.mini {
  display: flex;
  gap: 10px;
  text-align: right;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
}
.mini.selected { border-color: var(--good); }
.mini img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #eee;
}
.mini strong { display: block; font-weight: 600; font-size: 14px; }
.mini span { display: block; color: var(--muted); font-size: 12px; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 30, 26, 0.35);
  z-index: 30;
}
.cart {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(420px, 100%);
  background: #fbf7f2;
  border-inline-start: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 24px;
}
.cart.open { transform: translateX(0); }
.cart-head { justify-content: space-between; }
.cart-head h2 { font-family: var(--serif); font-weight: 500; margin: 0; }
.cart-items { overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 8px 0 16px; }
.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
}
.cart-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.cart-item h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.cart-item p { margin: 0; color: var(--muted); font-size: 12px; }
.qty-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-row button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}
.empty { color: var(--muted); margin: 24px 0; }
.order-form { display: flex; flex-direction: column; gap: 8px; }
.order-form label, .store-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.order-form textarea { border-radius: 14px; resize: vertical; }
.store-settings { border-top: 1px solid var(--line); padding-top: 8px; }
.actions { flex-wrap: wrap; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.danger { color: #8a3030; }
.text-btn { background: transparent; }
.status { min-height: 1.2em; margin: 0; }

dialog {
  border: 0;
  border-radius: 18px;
  padding: 18px;
  width: min(440px, calc(100% - 24px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(36, 30, 26, 0.4); }
dialog h3 { font-family: var(--serif); font-weight: 500; margin: 0 0 12px; }
.option {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.option input[type="number"] { width: 72px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.picker-actions { justify-content: flex-end; margin-top: 12px; }

@media (max-width: 800px) {
  .top { flex-wrap: wrap; padding: 14px 14px 4px; }
  .brand h1 { font-size: 26px; }
  .search { order: 3; flex-basis: 100%; }
  .categories, .layout { padding-inline: 14px; }
  .stage-bar { align-items: flex-start; flex-direction: column; }
  .cart { width: 100%; }
}
