:root {
  --bg: #fbf8f2;
  --surface: #ffffff;
  --surface-soft: #f5efe7;
  --text: #2a211b;
  --muted: #6f655f;
  --border: #e4d8ca;
  --accent: #8a4d27;
  --accent-dark: #633416;
  --accent-soft: #f0ddcb;
  --danger: #a43e37;
  --success: #2e6847;
  --shadow: 0 18px 45px rgba(74, 47, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #fffaf4 0, var(--bg) 280px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 40px 0 28px;
  text-align: center;
}

.header-layout {
  display: grid;
  gap: 24px;
}

.site-logo {
  width: min(440px, 86vw);
  height: auto;
  display: block;
  margin: 0 auto 18px;
  filter: drop-shadow(0 12px 22px rgba(74, 47, 24, 0.12));
}

.eyebrow,
.step {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-header p:not(.eyebrow) {
  max-width: 700px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

h2,
h3 {
  margin-top: 0;
  line-height: 1.15;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
}

.date-grid,
.product-grid,
.category-grid,
.payment-grid,
.field-grid {
  display: grid;
  gap: 14px;
}

.date-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.product-grid {
  gap: 22px;
}

.product-category {
  display: grid;
  gap: 12px;
}

.category-heading {
  border-bottom: 1px solid var(--border);
}

.category-heading h3 {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.date-button {
  min-height: 94px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.date-button strong {
  font-size: 1.02rem;
}

.date-button span {
  color: var(--muted);
  font-weight: 700;
}

.date-button:hover,
.date-button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 77, 39, 0.14);
}

.date-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.product {
  width: 100%;
  min-height: 100%;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
}

.option-product {
  min-height: auto;
}

.product-image {
  width: min(100%, 220px);
  height: 140px;
  display: block;
  justify-self: center;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-soft);
}

.product h3 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.product p {
  margin: 0;
  color: var(--muted);
}

.item-subtotal {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.option-card-heading,
.card-subtotal {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.group-subtotal {
  display: grid;
  gap: 2px;
  min-width: 110px;
  text-align: right;
}

.group-subtotal span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.option-table {
  display: grid;
  gap: 8px;
}

.option-table-head,
.option-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(260px, auto);
  align-items: center;
  gap: 12px;
}

.option-table-head {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.option-row {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.option-controls {
  display: grid;
  grid-template-columns: auto minmax(58px, auto) minmax(66px, auto);
  align-items: center;
  justify-content: end;
  gap: 12px;
}

.option-price,
.option-subtotal {
  white-space: nowrap;
  text-align: right;
}

.card-subtotal {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.product-bottom,
.section-row,
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.quantity {
  display: grid;
  grid-template-columns: 40px 34px 40px;
  align-items: center;
  gap: 6px;
}

.quantity button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 800;
}

.quantity button:hover:not(:disabled) {
  border-color: var(--accent);
}

.quantity button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quantity span {
  min-width: 34px;
  text-align: center;
  font-weight: 800;
}

.capacity-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.summary {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 1.15rem;
}

.field-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(138, 77, 39, 0.2);
  outline-offset: 2px;
}

fieldset {
  margin: 8px 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  font-weight: 800;
}

.payment-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.radio {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  font-weight: 700;
}

.radio input {
  width: auto;
}

.hint,
.pickup-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.pickup-note {
  margin-bottom: 16px;
}

button[type="submit"],
.payment-link,
.copy-button,
.secondary-button {
  width: 100%;
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 13px 16px;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

button[type="submit"]:hover,
.payment-link:hover,
.copy-button:hover,
.secondary-button:hover {
  background: var(--accent-dark);
}

.copy-button,
.secondary-button {
  margin-bottom: 12px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
}

.copy-button:hover,
.secondary-button:hover {
  color: #fff;
}

.edit-payment {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.checkout-note {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 2px solid #d69e00;
  border-radius: 8px;
  background: #ffd84d;
  color: #111;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.edit-payment summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.edit-payment label {
  margin-top: 14px;
}

select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: wait;
}

.receipt {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.invoice-receipt {
  margin-bottom: 18px;
}

.invoice-items {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.invoice-items div,
.review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.invoice-item-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.invoice-item-image {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-soft);
}

.invoice-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  font-weight: 800;
}

.invoice-yes {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--accent-dark);
  font-size: 1.15rem;
}

.invoice-yes input {
  width: 28px;
  height: 28px;
  accent-color: var(--success);
}

.invoice-email-field {
  margin: -4px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
}

.review-actions {
  align-items: stretch;
}

.review-actions > button {
  flex: 1 1 0;
  margin-bottom: 0;
}

.review-edit-button {
  border-color: var(--accent-dark);
  background: #fff;
  color: var(--accent-dark);
}

.review-edit-button:hover {
  background: var(--accent-dark);
  color: #fff;
}

.review-place-button {
  width: 100%;
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--success);
  border-radius: 8px;
  background: var(--success);
  color: #fff;
  padding: 13px 16px;
  font-weight: 800;
  cursor: pointer;
}

.review-place-button:hover {
  background: #245238;
}

.success-actions {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.success-actions .copy-button {
  margin-bottom: 0;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.success-actions .copy-button:hover {
  background: var(--accent-dark);
}

.success-pay-button {
  margin-bottom: 0;
  border: 1px solid var(--success);
  background: var(--success);
  color: #fff;
}

.success-pay-button:hover {
  background: #245238;
}

#success-payment-details {
  display: grid;
  gap: 10px;
}

#success-payment-details p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.receipt div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.receipt dt {
  color: var(--muted);
  font-weight: 700;
}

.receipt dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
  word-break: break-word;
}

.pickup-details {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: left;
}

.pickup-details h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.pickup-details p {
  margin: 8px 0 0;
}

.invoice-page {
  background: #f7f2ea;
}

.invoice-shell {
  max-width: 820px;
  padding: 28px 0;
}

.invoice-page-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.invoice-logo {
  width: 112px;
  height: auto;
}

.invoice-page-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  line-height: 1.05;
}

.invoice-page-actions {
  margin-top: 20px;
}

.muted {
  color: var(--muted);
}

.message {
  min-height: 24px;
  margin-bottom: 0;
}

.error {
  color: var(--danger);
}

.success {
  color: var(--success);
}

@media (max-width: 760px) {
  .wrap {
    width: min(100% - 24px, 1080px);
  }

  .site-header {
    padding-top: 28px;
  }

  .site-logo {
    width: min(340px, 88vw);
  }

  .section-row,
  .product-bottom,
  .option-card-heading,
  .card-subtotal,
  .review-actions {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .section-row,
  .product-bottom,
  .option-card-heading,
  .card-subtotal,
  .review-actions {
    display: grid;
  }

  .panel {
    padding: 18px;
  }

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

  .quantity {
    justify-content: end;
  }

  .group-subtotal {
    text-align: left;
  }

  .product-image {
    width: min(100%, 180px);
    height: 112px;
  }
}

@media (max-width: 430px) {
  .date-grid {
    grid-template-columns: 1fr;
  }

  .receipt div {
    display: grid;
    gap: 2px;
  }

  .option-table-head {
    display: none;
  }

  .option-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .option-controls {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .option-price,
  .option-subtotal {
    text-align: left;
  }

  .receipt dd {
    text-align: left;
  }
}

@media print {
  body {
    background: #fff;
  }

  .wrap {
    width: 100%;
  }

  .printable-invoice {
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .invoice-page-actions {
    display: none;
  }
}
