:root {
  --brand: #d9a441;
  --brand-dark: #b8862c;
  --bg: #14110f;
  --card: #1e1a17;
  --text: #f5efe6;
  --muted: #a89c8c;
  --border: #332c26;
  --success: #4caf7d;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { 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: 96px;
}

button { font-family: inherit; cursor: pointer; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { margin: 0; font-size: 1.15rem; letter-spacing: 0.06em; text-transform: uppercase; }
.table-chip {
  background: rgba(217, 164, 65, 0.18);
  color: var(--brand);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* States */
.state { text-align: center; padding: 60px 20px; color: var(--muted); }
.spinner {
  width: 36px; height: 36px;
  margin: 0 auto 12px;
  border: 4px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Category tabs */
.category-tabs {
  position: sticky;
  top: 64px;
  z-index: 9;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.category-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 20px;
  padding: 8px 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.category-tab.active { background: var(--brand); border-color: var(--brand); color: #14110f; }

/* Category sections */
.category-section { max-width: 640px; margin: 0 auto; padding: 16px; }
.category-title { font-size: 1.3rem; margin: 4px 0 12px; }

/* Menu item cards */
.menu-grid { display: grid; gap: 12px; }
.menu-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.item-head { display: flex; align-items: flex-start; gap: 10px; }
.item-info { flex: 1; }
.item-name-row { display: flex; align-items: center; gap: 8px; }
.diet-badge { font-size: 0.85rem; }
.price { font-weight: 700; color: var(--brand); white-space: nowrap; }
.item-desc { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
.add-btn {
  border: none;
  background: var(--brand);
  color: #14110f;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}
.add-btn:active { transform: scale(0.92); }

/* Cart bar */
.cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(transparent, var(--bg) 20%);
}
.cart-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--brand);
  color: #14110f;
  border: none;
  border-radius: 30px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 1rem;
}
.cart-count {
  background: #14110f;
  color: var(--brand);
  border-radius: 50%;
  min-width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
}
.cart-label { flex: 1; text-align: left; }
.cart-total { color: var(--brand); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 20;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%; max-width: 520px;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  max-height: 85vh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; }
.modal-close { border: none; background: none; font-size: 1.6rem; line-height: 1; }
.modal-body { padding: 16px; overflow-y: auto; }

.cart-items { list-style: none; margin: 0; padding: 0; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; }
.cart-item-price { color: var(--muted); font-size: 0.9rem; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card);
  font-size: 1rem; line-height: 1;
}
.qty-num { min-width: 20px; text-align: center; font-weight: 600; }
.cart-footer { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; margin: 12px 0; }
.instructions { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-family: inherit; margin-bottom: 12px; }

.btn {
  border: none; border-radius: 12px; padding: 12px 18px;
  font-weight: 600; font-size: 1rem;
}
.btn-primary { background: var(--brand); color: #14110f; }
.btn-primary:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
.btn-block { width: 100%; }

.confirm-body { text-align: center; padding: 32px 20px; }
.confirm-icon {
  width: 64px; height: 64px; margin: 0 auto 12px;
  background: var(--success); color: #14110f; border-radius: 50%;
  font-size: 2rem; line-height: 64px;
}
.confirm-body h2 { margin: 0 0 8px; }
.muted { color: var(--muted); }

/* My Order section (customer "what has been ordered", updates live) */
.my-order {
  max-width: 640px;
  margin: 8px auto 0;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.my-order-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.my-order-head h2 { margin: 0; font-size: 1.1rem; }
.order-status-badge {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px; color: #fff;
  background: var(--muted);
}
.order-status-badge[data-status="New"] { background: var(--brand); }
.order-status-badge[data-status="Preparing"] { background: #c98a3c; }
.order-status-badge[data-status="Ready"] { background: var(--success); }
.order-status-badge[data-status="Served"] { background: #6b7280; }
.order-status-badge[data-status="Cancelled"] { background: #6b7280; }
.order-status-badge[data-status="New"] { color: #14110f; }
.order-status-badge[data-status="Ready"] { color: #14110f; }
.my-order-items { list-style: none; margin: 0; padding: 0; }
.my-order-items li {
  display: flex; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.my-order-items li:last-child { border-bottom: none; }
.my-order-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-weight: 700;
}

/* Day-closed banner */
.day-closed-banner {
  max-width: 640px; margin: 12px auto 0; padding: 14px 16px;
  background: #3a2f14; border: 1px solid var(--brand); border-radius: var(--radius);
  color: #f0d9a8; text-align: center;
}
.day-closed-banner p { margin: 0; }

/* Location gate */
.location-gate {
  max-width: 640px;
  margin: 16px auto;
  padding: 20px 16px;
  background: var(--card);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.location-gate h2 { margin: 0 0 8px; font-size: 1.1rem; color: var(--brand); }
.location-gate .muted { font-size: 0.9rem; line-height: 1.5; margin: 0 0 14px; }
.location-message { margin: 12px 0 0; font-size: 0.9rem; color: #f0a8a8; min-height: 1.2em; }
