/* ── ORDER PAGE (table QR) ────────────────────────────────────────────────── */

/* Header */
.order-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(12px);
}
.order-header-inner {
  height: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.order-table-info { display: flex; align-items: center; gap: 0.75rem; }
.order-logo { height: 34px; width: auto; border-radius: 4px; }
.order-table-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(232,160,32,0.12);
  border: 1px solid rgba(232,160,32,0.3);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}
.order-cart-fab {
  position: relative;
  width: 44px; height: 44px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232,160,32,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}
.order-cart-fab:active { transform: scale(0.92); }
.order-cart-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: #ef4444;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bg-secondary);
}

/* Category pills */
.order-cats-wrap {
  position: fixed;
  top: 60px; left: 0; right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: 0;
}
.order-cats {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 700px;
  margin: 0 auto;
}
.order-cats::-webkit-scrollbar { display: none; }
.order-cat-pill {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.order-cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232,160,32,0.3);
}

/* Items page */
.order-page {
  margin-top: 112px;
  padding: 1rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 6rem;
}
.order-section-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 1.25rem 0 0.6rem;
}
.order-items-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Item card */
.order-item-card {
  display: flex;
  gap: 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  align-items: center;
  transition: var(--transition);
  cursor: pointer;
}
.order-item-card:active { transform: scale(0.98); }
.order-item-card.in-cart { border-color: var(--accent); background: rgba(232,160,32,0.04); }
.order-item-img {
  width: 72px; height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-primary);
}
.order-item-body { flex: 1; min-width: 0; }
.order-item-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.order-item-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.order-item-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(232,160,32,0.1);
  color: var(--accent);
}
.order-item-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
}
.order-item-action {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.order-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.order-qty-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 700;
  line-height: 1;
}
.order-qty-btn.add {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  width: 36px; height: 36px;
  box-shadow: 0 2px 8px rgba(232,160,32,0.3);
}
.order-qty-btn:active { transform: scale(0.88); }
.order-qty-val { font-weight: 800; font-size: 0.95rem; min-width: 1.5rem; text-align: center; }

/* Loading spinner */
.order-loading { display: flex; justify-content: center; padding: 4rem; }
.order-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Cart drawer */
.order-cart-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  backdrop-filter: blur(3px);
}
.order-cart-backdrop.active { display: block; }
.order-cart-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-secondary);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  max-width: 700px;
  margin: 0 auto;
}
.order-cart-drawer.open { transform: translateY(0); }
.cart-drawer-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0.75rem auto 0;
  flex-shrink: 0;
}
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem 0.5rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.cart-drawer-title { font-weight: 800; font-size: 1.05rem; color: var(--text-primary); }
.cart-drawer-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}
.cart-drawer-items { flex: 1; overflow-y: auto; padding: 0.75rem 1.25rem; }
.cart-drawer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.cart-drawer-row:last-child { border-bottom: none; }
.cart-drawer-name { flex: 1; font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.cart-drawer-price { font-size: 0.85rem; font-weight: 700; color: var(--accent); min-width: 50px; text-align: right; }
.cart-drawer-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.cart-drawer-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.cart-drawer-total-label { font-size: 0.85rem; color: var(--text-muted); }
.cart-drawer-total-value { font-size: 1.25rem; font-weight: 900; color: var(--text-primary); }

/* Checkout overlay */
.order-checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}
.order-checkout-sheet {
  background: var(--bg-secondary);
  border-radius: 20px 20px 0 0;
  padding: 0.5rem 1.25rem 2rem;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
}
.checkout-sheet-title { font-size: 1.15rem; font-weight: 800; margin: 0.75rem 0 1rem; }
.checkout-sheet-summary {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}
.checkout-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  color: var(--text-secondary);
}
.checkout-summary-total {
  display: flex;
  justify-content: space-between;
  padding-top: 0.6rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--border);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
}

/* Order confirmed */
.order-confirmed-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.order-confirmed-card {
  text-align: center;
  max-width: 340px;
  width: 100%;
}
.order-confirmed-icon {
  width: 80px; height: 80px;
  background: var(--green, #10b981);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: #fff;
  margin: 0 auto 1.25rem;
  animation: popIn 0.5s cubic-bezier(0.32,1.6,0.5,1);
}
@keyframes popIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.order-confirmed-title { font-size: 1.6rem; font-weight: 900; margin-bottom: 0.4rem; }
.order-confirmed-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.order-confirmed-id {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(232,160,32,0.1);
  border: 1px solid rgba(232,160,32,0.2);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin-bottom: 0.85rem;
}
.order-confirmed-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
}

/* QR Table section header */
.table-qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.table-qr-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.table-qr-card img { width: 100%; max-width: 120px; border-radius: 6px; background: white; padding: 4px; }
.table-qr-label { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.table-qr-url { font-size: 0.65rem; color: var(--text-muted); word-break: break-all; }

/* Kanban live orders */
.live-orders-kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.kanban-col {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 120px;
}
.kanban-col-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kanban-cards { padding: 0.6rem; display: flex; flex-direction: column; gap: 0.6rem; }
.kanban-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  transition: var(--transition);
}
.kanban-card.new { border-left: 3px solid var(--accent); animation: slideInCard 0.35s ease; }
.kanban-card.prep { border-left: 3px solid #60a5fa; }
.kanban-card.ready { border-left: 3px solid var(--green, #10b981); }
@keyframes slideInCard { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.kanban-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.kanban-table-label {
  font-weight: 800; font-size: 0.92rem; color: var(--text-primary);
  display: flex; align-items: center; gap: 0.35rem;
}
.kanban-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.kanban-time.urgent { color: #ef4444; font-weight: 700; }
.kanban-items { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.6rem; line-height: 1.5; }
.kanban-footer { display: flex; align-items: center; justify-content: space-between; }
.kanban-total { font-size: 0.82rem; font-weight: 700; color: var(--accent); }
.kanban-actions { display: flex; gap: 0.35rem; }
.kanban-btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.kanban-btn.advance { background: var(--accent); color: #fff; }
.kanban-btn.done { background: var(--green, #10b981); color: #fff; }
.kanban-btn.advance:hover { opacity: 0.85; }
.kanban-empty {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Sound toggle */
.sound-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}
.sound-toggle-btn.on { color: var(--green, #10b981); border-color: var(--green, #10b981); }
.live-pulse {
  width: 8px; height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.7); } }

/* ── QUEUE STATUS TRACKER ─────────────────────────────────────────────────── */

.qs-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem 1.25rem 2rem;
  max-width: 460px;
  margin: 0 auto;
  width: 100%;
}
.qs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.qs-logo { height: 36px; width: auto; border-radius: 4px; }
.qs-home-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}
.qs-home-btn:hover, .qs-home-btn:active { color: var(--accent); border-color: var(--accent); }
.qs-table-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(232,160,32,0.12);
  border: 1px solid rgba(232,160,32,0.25);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

/* Step bar */
.qs-steps {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 0;
}
.qs-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.qs-step-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}
.qs-step.done .qs-step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}
.qs-step.active .qs-step-circle {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(232,160,32,0.15);
  animation: qsPulse 1.8s ease-in-out infinite;
}
@keyframes qsPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(232,160,32,0.15); }
  50%      { box-shadow: 0 0 0 8px rgba(232,160,32,0.05); }
}
.qs-step-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  max-width: 70px;
  line-height: 1.3;
}
.qs-step.active .qs-step-label { color: var(--accent); font-weight: 700; }
.qs-step.done  .qs-step-label  { color: var(--text-secondary); }
.qs-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-top: 19px;
  transition: background 0.4s ease;
}
.qs-step-line.done { background: var(--accent); }

/* Cards */
.qs-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
  animation: fadeInUp 0.35s ease;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.qs-pending  { border-top: 3px solid var(--accent); }
.qs-inprogress { border-top: 3px solid #60a5fa; }
.qs-ready    { border-top: 3px solid var(--green,#10b981); }

.qs-pos-number {
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.qs-pos-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.qs-divider {
  height: 1px;
  background: var(--border);
  margin: 0 -1.25rem 1.1rem;
}
.qs-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.1rem;
}
.qs-stat { flex: 1; }
.qs-stat-val { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); }
.qs-stat-lbl { font-size: 0.72rem; color: var(--text-muted); }
.qs-stat-sep { width: 1px; height: 36px; background: var(--border); }

.qs-message {
  display: flex;
  gap: 0.6rem;
  background: rgba(232,160,32,0.05);
  border: 1px solid rgba(232,160,32,0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: left;
}
.qs-message-icon { flex-shrink: 0; font-size: 1rem; }

/* In progress */
.qs-flame {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: inline-block;
  animation: flameWave 0.8s ease-in-out infinite alternate;
}
@keyframes flameWave { from { transform: scale(1) rotate(-3deg); } to { transform: scale(1.1) rotate(3deg); } }

.qs-progress-track {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 1rem;
}
.qs-progress-bar {
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, #60a5fa, var(--accent));
  border-radius: 4px;
  animation: progressSlide 2s ease-in-out infinite alternate;
}
@keyframes progressSlide { from { width: 40%; } to { width: 80%; } }

/* Ready */
.qs-ready-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: inline-block;
  animation: bellRing 0.5s ease-in-out infinite alternate;
}
@keyframes bellRing { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }

/* Footer */
.qs-footer {
  margin-top: auto;
  padding-top: 1.25rem;
}
.qs-order-id {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.5rem;
}
.qs-order-id strong { color: var(--accent); font-family: monospace; }
.qs-poll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .live-orders-kanban { grid-template-columns: 1fr; }
  .order-page { margin-top: 108px; padding: 0.75rem 0.75rem 5rem; }
}
@media (max-width: 480px) {
  .order-header-inner { padding: 0 0.75rem; }
  .order-item-img { width: 60px; height: 60px; }
  .qs-pos-number { font-size: 3.5rem; }

  /* QR order page: safe-area for iPhone */
  .qs-page {
    padding: 1.25rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    min-height: 100svh;
  }
  .order-submit-btn, .btn-primary {
    min-height: 52px;
    font-size: 1rem;
  }
  /* Ensure items in order form are easy to tap */
  .order-item { padding: 0.85rem; }
  .order-qty-btn { width: 44px; height: 44px; }
}
