:root {
  --bg: #f7f3ec;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --text: #211a16;
  --muted: #776c61;
  --line: #e8ddd0;
  --brand: #15724f;
  --brand-dark: #0d5b3e;
  --accent: #f3b23f;
  --danger-soft: #fff2df;
  --shadow: 0 10px 24px rgba(42, 27, 12, 0.08);
  --shadow-soft: 0 4px 14px rgba(42, 27, 12, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
  min-height: 100vh;
}

.restaurant-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
}

.restaurant-header p {
  margin: 0;
  color: var(--brand);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.session-countdown {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid #cfe8d8;
  border-radius: 999px;
  background: #f3fbf5;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.session-countdown.warning {
  border-color: #f2d7a6;
  background: #fff7e8;
  color: #7a4300;
}

.session-countdown.preview {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.session-countdown.expired {
  border-color: #f0b3a6;
  background: #fff0ec;
  color: #8a2d16;
}

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.cart-toggle span {
  color: var(--text);
  font-weight: 900;
}

#itemCount {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.order-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-top: 16px;
}

.category-panel {
  position: sticky;
  top: 16px;
}

#categoryTabs {
  display: grid;
  gap: 7px;
}

.category-tab {
  width: 100%;
  padding: 10px 11px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.category-tab span,
.category-tab small {
  display: block;
}

.category-tab span {
  font-size: 14px;
  font-weight: 800;
}

.category-tab b {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  border-radius: 999px;
  background: #eef8f1;
  color: var(--brand-dark);
  font-size: 11px;
}

.category-tab small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.category-tab.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.menu-panel {
  min-width: 0;
}

.menu-tools {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: 10px;
  background: var(--bg);
}

#searchInput {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.availability-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #bfe5ce;
  border-radius: 8px;
  background: #f2fbf5;
  color: var(--brand-dark);
  font-size: 13px;
}

.availability-banner span {
  color: var(--muted);
  font-weight: 800;
}

.availability-banner.delayed {
  border-color: #f2d7a6;
  background: #fff7e8;
  color: #7a4300;
}

.availability-banner.delayed span {
  color: #7a4300;
}

.availability-banner.blocked {
  border-color: #f0b3a6;
  background: #fff0ec;
  color: #8a2d16;
}

.availability-banner.blocked span {
  color: #8a2d16;
}

.category-panel,
.menu-panel,
.cart-panel {
  min-width: 0;
}

.category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.category-heading h2 {
  margin: 0;
  font-size: 20px;
}

.category-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.menu-item {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-strong) 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.06);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.menu-item:hover {
  border-color: rgba(21, 114, 79, 0.25);
  box-shadow: 0 12px 28px rgba(31, 41, 55, 0.09);
}

.menu-item.selected {
  border-color: rgba(21, 114, 79, 0.45);
  background: linear-gradient(180deg, #f7fff9 0%, #ffffff 100%);
}

.menu-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.menu-row > div:first-child {
  min-width: 0;
}

.item-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.price {
  flex: 0 0 auto;
  padding-top: 1px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--brand-dark);
}

.description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.option-note {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef8f1;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.qty-row button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(31, 41, 55, 0.08);
}

.qty-row button[data-action="plus"] {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.qty {
  min-width: 34px;
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--surface);
  text-align: center;
  font-weight: 800;
}

.modifiers {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.modifier-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.modifier-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 5px 4px 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.modifier-option:has(input:checked) {
  border-color: var(--brand);
  background: #ecfdf3;
  color: var(--brand-dark);
}

.modifier-option input {
  flex: 0 0 auto;
}

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(390px, 92vw);
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 18px;
  box-shadow: -18px 0 42px rgba(31, 41, 55, 0.18);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.cart-panel.open {
  transform: translateX(0);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(17, 24, 39, 0.32);
}

.drawer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.cart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 34px;
}

.cart-header h2 {
  margin: 0;
  font-size: 18px;
}

#cartTotal {
  color: var(--brand-dark);
  font-weight: 900;
}

.cart-items {
  display: grid;
  gap: 9px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cart-items.empty {
  color: var(--muted);
  font-size: 14px;
}

.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
}

.cart-line-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
  flex: 0 0 auto;
}

.cart-line-actions > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.cart-line-actions button {
  min-width: 28px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

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

.order-type h3,
#addressBox h3 {
  margin: 14px 0 8px;
  font-size: 14px;
}

.discount-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf8;
}

.discount-box h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.reward-info {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.reward-info strong {
  color: var(--brand-dark);
  font-size: 13px;
}

.redeem-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.redeem-row input,
.coupon-row input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.coupon-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.coupon-row button {
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.discount-summary {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.discount-summary div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.discount-summary span {
  color: var(--muted);
  font-weight: 800;
}

.discount-summary .discount strong {
  color: #0f7b52;
}

.discount-summary .total {
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented label {
  margin: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

textarea {
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

#submitBtn {
  width: 100%;
  padding: 12px;
  margin-top: 14px;
  font-size: 15px;
  font-weight: 900;
  background: var(--text);
  color: white;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

#submitBtn:disabled {
  opacity: 0.65;
  cursor: default;
}

.hidden {
  display: none;
}

#message {
  margin: 10px 0 0;
  min-height: 20px;
  color: var(--brand-dark);
  font-weight: 800;
}

.cart-locked .menu-item,
.cart-locked .category-tab,
.cart-locked .cart-line-actions button,
.cart-locked .segmented span,
.cart-locked textarea {
  opacity: 0.58;
  pointer-events: none;
}

.cart-locked #message {
  padding: 10px 12px;
  border: 1px solid #f2d7a6;
  border-radius: 8px;
  background: #fff7e8;
  color: #7a4300;
}

.option-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.38);
}

.option-modal.hidden {
  display: none;
}

.option-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: min(760px, 92vh);
  overflow-y: auto;
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(31, 41, 55, 0.24);
}

.option-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-right: 36px;
}

.option-heading p {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
}

.option-heading span {
  color: var(--brand-dark);
  font-weight: 900;
  white-space: nowrap;
}

.modal-group {
  margin-top: 16px;
}

.option-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-quantity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 900;
}

.modal-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-stepper button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.modal-stepper strong {
  min-width: 28px;
  text-align: center;
}

#optionAdd {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 900px) {
  main {
    padding: 12px;
    overflow-x: hidden;
  }

  .order-layout {
    grid-template-columns: 1fr;
    gap: 14px;
    min-width: 0;
  }

  .category-panel {
    position: static;
  }

  #categoryTabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .availability-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-tab {
    flex: 0 0 132px;
    background: rgba(255, 255, 255, 0.65);
    border-color: var(--line);
  }

  .menu-item {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .restaurant-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .restaurant-header p {
    font-size: 24px;
  }

  #itemCount {
    font-size: 13px;
  }

  .menu-row {
    align-items: flex-start;
    gap: 8px;
  }

  .price {
    font-size: 13px;
  }

  .qty-row {
    justify-content: flex-start;
  }

  .qty-row button {
    width: 36px;
    height: 36px;
  }
}
