:root {
  color-scheme: light;
  --coffee: #753715;
  --coffee-dark: #32160b;
  --ink: #211713;
  --muted: #7d6d63;
  --line: #eadfd5;
  --paper: #fffaf4;
  --bg: #f7efe6;
  --accent: #16875c;
  --shadow: 0 14px 40px rgb(58 30 12 / 12%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

.hero {
  min-height: 260px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: center;
  padding: 24px;
  background: var(--coffee-dark);
  color: #ffe7c7;
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  margin: 8px 0;
}

.eyebrow {
  color: #f1b96d;
}

.profile,
.orders,
.products,
.categories {
  background: #fff;
  border: 1px solid var(--line);
}

.profile {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
}

#loginPanel,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

input,
select,
textarea,
button {
  min-height: 40px;
  border: 1px solid #d6c8bc;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

button {
  border: 0;
  background: var(--coffee);
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary,
button.ghost {
  background: #efe4d8;
  color: var(--coffee);
}

.layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  margin-top: 14px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 10px;
}

.categories {
  padding: 8px;
  align-self: start;
  position: sticky;
  top: 12px;
}

.category {
  width: 100%;
  margin-bottom: 8px;
  background: #f4ebe2;
  color: var(--ink);
}

.category.active {
  background: var(--coffee);
  color: #fff;
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  padding: 12px;
}

.product {
  display: grid;
  grid-template-rows: 150px 1fr;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}

.product-cover {
  display: block;
  width: 100%;
  height: 150px;
  padding: 0;
  border-radius: 0;
  background: #1b1009;
}

.product img,
#detailImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.product-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.price {
  color: var(--coffee);
  font-weight: 700;
}

.cart {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  width: min(1000px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 -8px 28px rgb(65 39 17 / 14%);
}

.cart span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

dialog {
  border: 0;
  padding: 0;
  width: min(460px, calc(100vw - 24px));
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(26 15 8 / 45%);
}

.dialog {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fff;
}

#detailImage {
  height: 220px;
  border-radius: 8px;
}

.dialog label,
fieldset {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.chip {
  min-height: 34px;
  background: #f6eee7;
  color: var(--coffee);
  border: 1px solid #e0c7b4;
}

.chip.active {
  background: var(--coffee);
  color: #fff;
  border-color: var(--coffee);
}

.quantity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quantity-row span {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.checkout-items {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff7ef;
}

.checkout-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
}

.checkout-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.success {
  justify-items: center;
  text-align: center;
  padding: 32px 18px;
}

.success-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #31b96c;
  color: #fff;
  font-size: 42px;
}

.orders {
  margin-top: 14px;
  padding: 14px;
}

.order {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
  main {
    padding: 0 0 96px;
  }

  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
    padding: 14px;
  }

  .hero img {
    height: 170px;
  }

  h1 {
    font-size: 32px;
  }

  .profile {
    display: grid;
  }

  .categories {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 8px;
  }

  .category {
    min-width: 96px;
    margin-bottom: 0;
  }

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