*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #3d2b1f;
  color: #333;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: none; outline: none; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

input {
  border: none; outline: none; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* === Toast === */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85); color: #fff; padding: 12px 28px;
  border-radius: 12px; font-size: 16px; font-weight: 600;
  z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* === Page system === */
.page { display: none; }
.page.active { display: block; }

/* === Bottom tab === */
.bottom-tab {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex; background: #fffaf0;
  border-top: 1px solid #d7ccc8;
}
.bottom-tab .tab-item {
  flex: 1; padding: 16px 0; text-align: center;
  font-size: 18px; color: #8d6e63; font-weight: 600;
  background: transparent;
}
.bottom-tab .tab-item.active { color: #c62828; }

/* === Cover page (user landing) === */
.cover-header {
  display: flex; flex-direction: column; align-items: center;
  padding: 80px 24px 0;
}
.cover-logo { font-size: 60px; margin-bottom: 20px; }
.cover-title { font-size: 30px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.cover-subtitle { font-size: 16px; color: #bcaaa4; margin-bottom: 6px; }
.cover-address { font-size: 14px; color: #a1887f; margin-bottom: 40px; text-align: center; line-height: 1.6; }
.cover-btns { width: 100%; display: flex; flex-direction: column; gap: 16px; padding: 0 32px; }
.cover-btn {
  width: 100%; padding: 16px; border-radius: 16px;
  font-size: 20px; font-weight: 700; text-align: center;
  background: #fffaf0; color: #5d4037; border: 2px solid #d7ccc8;
}
.cover-btn-primary { background: #c62828; color: #fff; border: none; }

/* === Home page (admin) === */
.home-header {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 24px 0;
}
.home-logo { font-size: 50px; margin-bottom: 15px; }
.home-title { font-size: 26px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.home-subtitle { font-size: 14px; color: #bcaaa4; margin-bottom: 4px; }
.home-address { font-size: 13px; color: #a1887f; margin-bottom: 25px; text-align: center; line-height: 1.5; }
.home-btns { width: 100%; display: flex; flex-direction: column; gap: 14px; padding: 0 24px; }
.home-btn {
  width: 100%; padding: 15px; border-radius: 10px;
  font-size: 19px; font-weight: 700; text-align: center;
  background: #fffaf0; color: #5d4037; border: 2px solid #d7ccc8;
}
.home-btn.primary { background: #c62828; color: #fff; border: none; }

/* === Back button === */
.back-btn {
  display: block; margin: 20px auto; padding: 12px 36px;
  background: rgba(255,255,255,0.15); color: #fff; border-radius: 10px;
  font-size: 15px; font-weight: 600;
}

/* === Menu grid === */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
}
.item-card {
  background: #fffaf0; border-radius: 12px;
  padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.item-card .emoji { font-size: 28px; }
.item-card .name { font-size: 17px; font-weight: bold; color: #4e342e; margin: 6px 0 2px; }
.item-card .item-line { font-size: 12px; color: #a1887f; margin-bottom: 2px; }
.item-card .price { font-size: 14px; color: #c62828; font-weight: 600; margin-bottom: 5px; }

.item-line-sm { font-size: 11px; color: #a1887f; margin-left: 2px; }

.qty-row { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid #5d4037;
  background: #fff; font-size: 18px; color: #5d4037;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1;
}
.qty-btn.minus { color: #c62828; border-color: #c62828; }
.qty-btn.qty-touched { background: #5d4037; color: #fff; }
.qty-btn.minus.qty-touched { background: #c62828; color: #fff; }
.qty-count {
  font-size: 20px; font-weight: 700; min-width: 24px; text-align: center;
  color: #3e2723; cursor: pointer;
}
.qty-input {
  width: 50px; height: 32px; border: 2px solid #c62828; border-radius: 6px;
  font-size: 18px; text-align: center; color: #3e2723; background: #fff;
}

/* === Order panel === */
.order-panel {
  background: #fffaf0; border-radius: 16px 16px 0 0;
  padding: 14px 16px 18px; box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}
.order-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-title { font-size: 20px; color: #4e342e; }

.pickup-address { font-size: 13px; color: #a1887f; display: block; margin-bottom: 9px; }
.section-label { font-size: 16px; color: #4e342e; font-weight: 600; margin-bottom: 5px; }
.date-tabs { display: flex; gap: 7px; margin-bottom: 7px; }
.date-tab {
  flex: 1; padding: 7px; border-radius: 7px; border: 2px solid #d7ccc8;
  background: #fff; font-size: 15px; font-weight: 600; color: #6d4c41; text-align: center;
}
.date-tab.active { border-color: #c62828; background: #ffebee; color: #c62828; }

.time-slots {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
}
.time-slot {
  padding: 11px 6px; border-radius: 7px; border: 2px solid #d7ccc8;
  background: #fff; font-size: 14px; font-weight: 600; color: #4e342e; text-align: center;
}
.time-slot.active { border-color: #c62828; background: #ffebee; color: #c62828; }

.no-slots { color: #a1887f; font-size: 14px; text-align: center; padding: 9px 0; }

.order-list { padding: 0; }
.order-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px dashed #d7ccc8; font-size: 16px; font-weight: bold;
}
.order-item .item-left { display: flex; gap: 7px; align-items: center; }
.order-item .item-qty { color: #8d6e63; font-size: 16px; }
.order-item .item-subtotal { font-weight: 600; color: #c62828; }
.order-empty { text-align: center; color: #bcaaa4; padding: 16px 0; font-size: 15px; }

.total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0 7px; font-size: 20px; font-weight: 700;
}
.total-row .total-label { color: #4e342e; }
.total-row .total-price { color: #c62828; font-size: 24px; }

.pickup-notice {
  font-size: 13px; color: #bf360c; background: #fff3e0;
  border-radius: 6px; padding: 8px 10px;
  margin-top: 10px; line-height: 1.6; text-align: center;
}

.wechat-row {
  text-align: center; padding: 8px 10px; margin-top: 6px;
  font-size: 13px; color: #8d6e63; background: #f5f0e8;
  border-radius: 6px; line-height: 1.6; cursor: pointer;
}

.actions { display: flex; gap: 10px; margin-top: 8px; }
.btn { flex: 1; padding: 11px; border-radius: 10px; font-size: 17px; font-weight: 700; text-align: center; }
.btn-reset { background: #2e7d32; color: #fff; }
.btn-confirm { background: #c62828; color: #fff; }

/* === Order scroll === */
.order-scroll { padding-bottom: 60px; }

/* === Modal === */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: #fffaf0; border-radius: 16px; padding: 28px 24px 24px;
  margin: 20px; max-width: 320px; width: 100%; text-align: center;
}
.modal-icon { font-size: 40px; margin-bottom: 8px; }
.modal-h3 { font-size: 20px; color: #4e342e; margin-bottom: 4px; }
.modal-desc { font-size: 15px; color: #8d6e63; margin-bottom: 16px; }
.modal-input {
  width: 100%; padding: 14px 16px; border: 2px solid #d7ccc8; border-radius: 10px;
  font-size: 22px; text-align: center; letter-spacing: 4px; color: #3e2723; margin-bottom: 16px;
}
.btn-full {
  width: 100%; padding: 14px; border-radius: 10px; background: #c62828;
  color: #fff; font-size: 20px; font-weight: 700;
}

.pickup-code {
  font-size: 38px; font-weight: 900; color: #c62828; letter-spacing: 4px;
  background: #fff; border: 3px dashed #c62828; border-radius: 12px;
  padding: 10px 20px; margin-bottom: 5px;
}
.pickup-hint { font-size: 15px; color: #6d4c41; margin: 8px 0 14px; font-weight: 600; }
.order-summary {
  text-align: left; background: #f5f0e8; border-radius: 8px; padding: 11px;
  margin-bottom: 14px; font-size: 15px; line-height: 1.8; color: #4e342e;
}
.summary-divider { border-top: 1px dashed #d7ccc8; margin: 7px 0; padding-top: 5px; }
.btn-close {
  padding: 11px 36px; border-radius: 10px; background: #2e7d32;
  color: #fff; font-size: 17px; font-weight: 700;
}

/* Phone modal */
.phone-btn {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 16px; font-weight: 700; text-align: center;
}
.phone-btn-cancel { background: #bdbdbd; color: #fff; }
.phone-btn-ok { background: #c62828; color: #fff; }

/* === History page === */
.history-header { padding: 14px 12px 0; }
.orders-list { padding: 14px 12px 70px; }
.loading-text { text-align: center; color: #fff; font-size: 18px; padding: 60px 0; }

.tabs {
  display: flex; gap: 4px;
  background: rgba(255,255,255,0.1); border-radius: 10px; padding: 4px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 7px 8px; border-radius: 8px;
  font-size: 12px; font-weight: 600; background: transparent; color: #bcaaa4; text-align: center;
}
.tab-btn.active { background: #fff; color: #3e2723; }

.order-card {
  background: #fffaf0; border-radius: 12px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.order-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #d7ccc8;
}
.order-time { font-size: 16px; color: #6d4c41; font-weight: 600; }

.status {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 14px; font-weight: 600;
}
.status-pending { background: #fff3e0; color: #e65100; }
.status-confirmed { background: #e8f5e9; color: #2e7d32; }
.status-completed { background: #e3f2fd; color: #1565c0; }
.status-cancelled { background: #fce4ec; color: #880e4f; }
.status-overtime { background: #ffebee; color: #b71c1c; }
.status-rejected { background: #f3e5f5; color: #6a1b9a; }

.reject-note { font-size: 14px; color: #6a1b9a; margin-top: 6px; padding: 4px 8px; background: #f3e5f5; border-radius: 6px; }

.pickup-code {
  display: inline-block; padding: 4px 14px; border-radius: 8px;
  font-size: 22px; font-weight: 900; letter-spacing: 2px;
  color: #c62828; background: #ffebee; border: 2px solid #ef9a9a; margin-bottom: 6px;
}
.pickup-time { font-size: 18px; color: #2e7d32; font-weight: 600; margin-bottom: 6px; }
.pickup-phone { font-size: 15px; color: #6d4c41; margin-bottom: 6px; font-weight: 500; }

.item-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 18px;
}
.item-qty { color: #8d6e63; font-size: 16px; margin-left: 6px; }

.total-price { text-align: right; margin-top: 8px; font-size: 22px; font-weight: 700; color: #c62828; }

.btn-cancel {
  margin-top: 10px; padding: 6px 20px; border: 1px solid #c62828;
  border-radius: 8px; background: #fff; color: #c62828; font-size: 15px; font-weight: 600; text-align: center;
}

.empty { text-align: center; color: #bcaaa4; font-size: 20px; padding: 60px 0; }

/* === Dashboard page === */
.dash-header { padding: 14px 12px 0; }

.dash-search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.dash-search {
  flex: 1; padding: 8px 12px; border-radius: 8px;
  font-size: 16px; background: #fff; color: #3e2723;
}
.dash-search-btn {
  padding: 8px 16px; border-radius: 8px; background: #2e7d32;
  color: #fff; font-size: 15px; font-weight: 600;
}

.dash-date-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dash-date-btn {
  padding: 8px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.2); color: #fff; font-size: 14px;
}
.dash-date-input {
  flex: 1; padding: 8px 12px; border-radius: 8px;
  background: #fff; font-size: 16px; color: #3e2723;
}
.dash-refresh-btn {
  padding: 8px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.2); color: #fff; font-size: 16px;
}

.order-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #d7ccc8;
}

.action-btns { display: flex; gap: 6px; }
.btn-sm {
  padding: 6px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.btn-confirm { background: #2e7d32; color: #fff; }
.btn-complete { background: #1565c0; color: #fff; }
.btn-reject { background: #6a1b9a; color: #fff; }

/* === Computer page === */
.order-total { font-size: 22px; color: #c62828; font-weight: 700; }

/* === Products page === */
.prod-hint {
  text-align: center; padding: 12px 16px;
  font-size: 13px; color: #bcaaa4;
}
.prod-list { padding: 0 12px; }
.product-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 12px; margin-bottom: 7px;
  border-radius: 10px; background: #fffaf0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  cursor: pointer;
}
.product-row.online { border-left: 4px solid #2e7d32; }
.product-row.offline { border-left: 4px solid #bdbdbd; opacity: 0.7; }

.product-info { display: flex; align-items: center; gap: 10px; }
.product-emoji { font-size: 24px; }
.product-name { font-size: 18px; font-weight: 600; color: #4e342e; }

.product-switch {
  width: 50px; height: 28px; border-radius: 14px;
  position: relative; transition: background 0.2s;
}
.product-switch.on { background: #2e7d32; }
.product-switch.off { background: #bdbdbd; }
.switch-knob {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; position: absolute; top: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: left 0.2s;
}
.product-switch.on .switch-knob { left: 25px; }
.product-switch.off .switch-knob { left: 3px; }

/* === Phone modal === */
.phone-modal {
  background: #fffaf0; border-radius: 12px; padding: 24px 18px 18px;
  margin: 20px; max-width: 280px; width: 100%; text-align: center;
}
.phone-modal-title { font-size: 18px; font-weight: 700; color: #4e342e; }
.phone-modal-input {
  width: 100%; height: 44px; padding: 0 12px; border: 2px solid #d7ccc8; border-radius: 8px;
  font-size: 20px; text-align: center; letter-spacing: 3px; color: #3e2723;
  margin: 14px 0 4px; line-height: 40px;
}
.phone-error { color: #c62828; font-size: 14px; margin-bottom: 8px; }
.phone-modal-btns { display: flex; gap: 10px; }

/* === Password gate (admin.html) === */
.password-gate {
  display: flex; flex-direction: column; align-items: center;
  padding: 80px 24px 0;
}
.pwd-card {
  width: 100%; max-width: 300px; margin-top: 40px;
}
.pwd-error { color: #c62828; font-size: 14px; text-align: center; margin-top: 8px; }

/* === Hover / active === */
button:active { opacity: 0.8; }
.card-pressed { transform: scale(0.97); }
