* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 160px;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "PingFang TC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
button, input, select {
  font: inherit;
  color: inherit;
}
button, select, input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}
button {
  cursor: pointer;
  font-weight: 600;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  gap: 12px;
  background: var(--surface);
}
header strong {
  font-size: 20px;
  font-weight: 600;
}
#table {
  color: var(--muted);
}
#notice {
  padding: 12px;
  min-height: 48px;
  background: var(--accentSoft);
}
#notice:empty {
  display: none;
}
#notice.fulfilment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  background: var(--surface);
}
#notice.fulfilment button {
  min-width: 0;
}
.fulfilment-pickup {
  background: var(--accent);
  color: var(--accentOn);
}
.fulfilment-table {
  background: var(--ink);
  color: var(--surface);
}
.fulfilment-pickup[aria-pressed="true"] {
  border-color: var(--ink);
  border-width: 2px;
}
.fulfilment-status {
  grid-column: 1 / -1;
}

nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
#home {
  flex: none;
  width: 48px;
  font-size: 24px;
  padding: 0;
}
#categories {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#categories::-webkit-scrollbar {
  display: none;
}
#home, #categories button {
  border-color: var(--accent);
}
#categories button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 12px;
}
#categories button[aria-current="true"] {
  background: var(--accent);
  color: var(--accentOn);
}
main {
  max-width: 1100px;
  margin: auto;
  padding: 12px 12px 112px;
}
section {
  scroll-margin-top: 172px;
}
h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 12px 0;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
.product {
  padding: 0;
  overflow: hidden;
  background: var(--tilePlain);
  text-align: left;
  border-radius: var(--radius);
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.product img {
  width: 100%;
  height: auto;
  aspect-ratio: 1.25;
  object-fit: cover;
  background: var(--tilePlain);
}
.product .label {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  overflow-wrap: anywhere;
}
.price {
  text-align: right;
  font-weight: 600;
}
.primary {
  background: var(--accent);
  color: var(--accentOn);
  border-color: var(--accent);
}
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 12px;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 3;
}
footer #cart {
  flex: 1;
}
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  width: min(96vw, 560px);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop {
  background: #0008;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: -12px;
  background: var(--surface);
  padding: 12px 0;
  z-index: 1;
}
.sheet-head h2 {
  margin: 0;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.row > div:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.row .controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.row .controls button {
  min-width: 48px;
}
.option-confirm {
  display: block;
  margin-inline-start: auto;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
}
.actions button {
  flex: 1;
}
.muted {
  color: var(--muted);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 12px 0;
  padding: 12px;
}
label.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}
label.choice input {
  width: 24px;
  min-height: 24px;
}
label.choice span {
  flex: 1;
}
input[type="email"], input[type="tel"] {
  display: block;
  width: 100%;
  margin: 6px 0 12px;
}
a {
  color: inherit;
  overflow-wrap: anywhere;
}
#sheet-content > p {
  overflow-wrap: anywhere;
}
img.logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
#sheet-content svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: auto;
}
@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1000px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

.product.photo {
  position: relative;
}
.product.photo .label {
  position: absolute;
  bottom: 0;
  background: #00000094;
  color: var(--surface);
}
.product.photo img {
  aspect-ratio: 1;
  min-height: 180px;
}

dialog:not([open]) {
  display: none;
}
dialog[open] {
  position: fixed;
  top: 5vh;
  top: 5dvh;
  z-index: 4;
}

header > div {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
header {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

/* HTML counterparts of CategorySectionHeader and the common order card. */
.category-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 4fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--gap);
  text-align: center;
}
.category-heading span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.category-heading::before, .category-heading::after {
  content: "";
  height: 1px;
  background: var(--accent);
}
.order-card {
  margin-top: var(--gap);
  min-width: 0;
}
.order-card-header {
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--gap);
  display: grid;
  gap: 6px;
  background: var(--surface);
}
.order-card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
.order-card-row > span, .order-line {
  min-width: 0;
  overflow-wrap: anywhere;
}
.order-card-meta {
  grid-template-columns: minmax(0, 1fr) auto;
}
.order-card-meta > .price {
  white-space: nowrap;
}
.order-line {
  padding: var(--gap) 0;
  border-bottom: 1px solid var(--line);
}
.order-line-details {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px var(--gap);
}
.order-line-details h3 {
  flex: 1 0 100%;
  min-width: 0;
}
.order-line-details > span {
  white-space: nowrap;
}
.order-line-details > .price {
  margin-inline-start: auto;
}
.order-totals {
  display: grid;
  gap: 6px;
  padding: var(--gap) 0;
}
.order-grand-total {
  font-size: 20px;
  font-weight: 600;
}

.order-history-total {
  border-top: 1px solid var(--line);
}

.product-prices { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:flex-end; gap:6px var(--gap); }
.product-prices .price { color:var(--accent); }

/* Same suite SALE tag as native product cards; never a separate action. */
.sale-tag {
  display: inline-block;
  align-self: flex-start;
  width: max-content;
  padding: 4px 6px 4px 16px;
  background: var(--danger);
  color: var(--surface);
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.sale-tag::before {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  left: 7px;
  top: calc(50% - 1.5px);
  border-radius: 50%;
  background: var(--surface);
}
.sale-tag, .product { position: relative; }
.product > .sale-tag { position: absolute; top: 6px; right: 6px; }
