:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #999999);
  --button: var(--tg-theme-button-color, #6f4e37);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f4f1ee);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 90px;
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}
.topbar h1 { font-size: 20px; margin: 0; }

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--secondary-bg);
}
.badge.open { color: #1a7f37; }
.badge.closed { color: #c0392b; }

.banner {
  margin: 0 16px 16px;
  padding: 14px;
  border-radius: 10px;
  background: #fdecea;
  color: #c0392b;
  font-size: 14px;
}

.points-bar {
  margin: 0 16px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--secondary-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.points-value { font-weight: 700; font-size: 15px; }
.points-hint { font-size: 12px; color: var(--hint); text-align: right; }

.redeem-banner {
  margin: 0 16px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #e6f6ea;
  color: #1a7f37;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#cancel-redeem-btn {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  flex-shrink: 0;
}

.redeem-btn {
  margin-top: 8px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px dashed var(--button);
  background: transparent;
  color: var(--button);
  font-size: 12px;
  font-weight: 600;
}
.redeem-btn:disabled {
  opacity: 0.45;
  border-style: solid;
  border-color: rgba(0,0,0,0.15);
  color: var(--hint);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--secondary-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.tab-btn.active {
  background: var(--button);
  color: var(--button-text);
}

#menu {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.group-heading {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hint);
}

.product-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--secondary-bg);
}
.product-card.out-of-stock {
  opacity: 0.6;
}

.product-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.product-row .product-info {
  flex: 1;
  min-width: 0;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(0,0,0,0.06);
}

.product-info .name { font-weight: 600; font-size: 15px; }
.product-info .price { font-size: 13px; color: var(--hint); }
.oos-tag {
  font-size: 11px;
  font-weight: 600;
  color: #c0392b;
  margin-left: 4px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stepper button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--button);
  color: var(--button-text);
  font-size: 16px;
  line-height: 1;
}
.stepper button:disabled {
  opacity: 0.4;
}
.stepper .qty {
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}

.product-options {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chip-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.chip-label {
  font-size: 12px;
  color: var(--hint);
  min-width: 42px;
}
.chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
}
.chip.active {
  background: var(--button);
  color: var(--button-text);
  border-color: var(--button);
}

#order-options {
  margin: 16px;
  padding: 14px;
  border-radius: 12px;
  background: var(--secondary-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#order-options label {
  font-size: 13px;
  color: var(--hint);
}
.slot-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.slot-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(0,0,0,0.12);
}
.slot-btn.active {
  background: var(--button);
  color: var(--button-text);
  border-color: var(--button);
}
/* Same-day options while the shop is shut - visible, so it's clear they
   exist, but plainly not selectable. */
.slot-btn.unavailable {
  opacity: 0.4;
  text-decoration: line-through;
}

.preorder-box {
  margin-top: 4px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid rgba(0,0,0,0.12);
}
#preorder-time {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  margin-top: 6px;
}
.preorder-hint { font-size: 12px; color: var(--hint); margin: 8px 0 0; }
.preorder-error { font-size: 12px; color: #c0392b; margin: 6px 0 0; min-height: 14px; }

#remarks-input {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.discount-row {
  display: flex;
  gap: 8px;
}
#discount-input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  min-width: 0;
}
#apply-discount-btn {
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  background: var(--button);
  color: var(--button-text);
  font-size: 13px;
  font-weight: 600;
}

#cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid rgba(0,0,0,0.08);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-summary { min-width: 0; }
.cart-total { font-weight: 600; }
.cart-note { font-size: 11px; color: var(--hint); margin-top: 2px; }
button#checkout-btn {
  background: var(--button);
  color: var(--button-text);
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--bg);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.modal-content h2 { margin-top: 0; font-size: 18px; }
.modal-content img { width: 100%; max-width: 260px; border-radius: 8px; margin: 10px 0; }
.amount { font-size: 22px; font-weight: 700; margin: 6px 0 16px; }
#pay-reference { color: var(--hint); font-size: 13px; }

/* What they're paying for, listed above the amount so it can be checked
   against the QR before paying. Scrolls if the order is a long one. */
.pay-items {
  text-align: left;
  margin: 12px 0 0;
  max-height: 132px;
  overflow-y: auto;
}
.pay-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  padding: 3px 0;
}
.pay-item .pay-item-name { flex: 1; min-width: 0; }
.pay-item .pay-item-opts { color: var(--hint); font-size: 11px; }
.pay-item .pay-item-price { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.pay-item .pay-item-free { color: #1a7f37; font-size: 11px; }

.pay-breakdown {
  text-align: left;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(128,128,128,0.25);
  font-size: 12px;
  color: var(--hint);
}
.pay-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}
.pay-breakdown .pay-credit { color: #1a7f37; }
.status-text { font-size: 13px; color: var(--hint); min-height: 18px; }

button#paid-btn {
  width: 100%;
  background: var(--button);
  color: var(--button-text);
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 6px;
}
button.secondary {
  width: 100%;
  background: transparent;
  color: var(--hint);
  border: none;
  padding: 10px;
  font-size: 14px;
  margin-top: 4px;
}
