:root {
  --bg: transparent;
  --surface: rgba(10, 18, 32, 0.35);
  --surface-light: rgba(255, 255, 255, 0.08);
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --secondary: #2563eb;
  --text: #ffffff;
  --text-muted: #cbd5e1;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.22);
  --gold: #38bdf8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

option {
  background: var(--surface);
  color: var(--text);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-light); border-radius: 4px; }

/* Remove number input spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 220px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.sidebar-header p {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.nav-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem 0;
}

.nav-item {
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text-muted);
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}

.nav-item:hover {
  background-color: rgba(255,255,255,0.05);
  color: var(--text);
}

.nav-item.active {
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  transition: color 0.2s;
}

.back-link:hover { color: var(--text); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
  flex-shrink: 0;
}

.top-bar h1 { font-size: 1.6rem; font-weight: 600; }

/* Breadcrumb / Step indicator */
.step-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.step-breadcrumb .crumb {
  color: var(--text-muted);
}

.step-breadcrumb .crumb.active {
  color: var(--primary);
  font-weight: 600;
}

.step-breadcrumb .sep {
  color: var(--surface-light);
}

.step-back-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.step-back-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.search-bar {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 260px;
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
}

/* ============================================================
   CONTENT SCREENS (dynamically shown/hidden)
   ============================================================ */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: flex;
}

/* KVS screen needs to pass full height to its scrollable child */
#screen-kvs {
  overflow: hidden;
}
#screen-kvs .kvs-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SCREEN 1: ORDER TYPE SELECTION
   ============================================================ */
.order-type-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
}

.order-type-title {
  text-align: center;
}

.order-type-title h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.order-type-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.order-type-cards {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.order-type-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 3rem 3.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 220px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.order-type-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 18px;
}

.order-type-card.dine-in::before {
  background: radial-gradient(circle at top left, rgba(59,130,246,0.15), transparent 70%);
}

.order-type-card.take-out::before {
  background: radial-gradient(circle at top left, rgba(139,92,246,0.15), transparent 70%);
}

.order-type-card:hover::before { opacity: 1; }

.order-type-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.order-type-card.dine-in:hover {
    border-color: #3B82F6;
    box-shadow: 0 20px 40px rgba(59,130,246,0.3);
  }
  
  .order-type-card.take-out:hover {
    border-color: #8B5CF6;
    box-shadow: 0 20px 40px rgba(139,92,246,0.3);
  }
  
  #btn-delivery:hover {
    border-color: #10B981;
    box-shadow: 0 20px 40px rgba(16,185,129,0.3);
  }

  #btn-pending-takeouts:hover {
    border-color: var(--gold);
    box-shadow: 0 20px 40px rgba(245,158,11,0.3);
  }

.order-type-icon {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.order-type-card h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.order-type-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

.order-type-badge {
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.order-type-card.dine-in .order-type-badge {
  background: rgba(59,130,246,0.15);
  color: var(--primary);
  border: 1px solid rgba(59,130,246,0.3);
}

.order-type-card.take-out .order-type-badge {
  background: rgba(139,92,246,0.15);
  color: var(--secondary);
  border: 1px solid rgba(139,92,246,0.3);
}

/* ============================================================
   SCREEN 2: TABLE SELECTION
   ============================================================ */
.table-screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
}

.table-screen-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-legend {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.available { background: var(--success); }
.legend-dot.occupied  { background: var(--danger); }
.legend-dot.reserved  { background: var(--warning); }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.2rem;
}

.table-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  transition: all 0.25s;
  position: relative;
  text-align: center;
}

.table-card.available {
  border-color: rgba(16, 185, 129, 0.3);
}

.table-card.available:hover {
  border-color: var(--success);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(16,185,129,0.2);
  background: rgba(16,185,129,0.06);
  cursor: pointer;
}

.table-card.occupied {
  border-color: rgba(239, 68, 68, 0.3);
  opacity: 0.75;
  cursor: not-allowed;
}

.table-card.reserved {
  border-color: rgba(245, 158, 11, 0.3);
  opacity: 0.80;
  cursor: pointer;
}

.table-card.merged {
  border-color: rgba(156, 163, 175, 0.3);
  background: rgba(156, 163, 175, 0.05);
  opacity: 0.60;
  cursor: not-allowed;
}

.table-icon {
  font-size: 2rem;
}

.table-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.table-capacity {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.table-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table-status-badge.available {
  background: rgba(16,185,129,0.15);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.3);
}

.table-status-badge.occupied {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}

.table-status-badge.reserved {
  background: rgba(245,158,11,0.15);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}

/* ============================================================
   SCREEN 3: MENU + ORDER
   ============================================================ */
.menu-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.menu-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 0.6rem 1.2rem;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  bottom: -1px;
}

.cat-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.cat-tab.active {
  background: var(--bg);
  color: var(--primary);
  border-color: var(--border);
  border-bottom-color: var(--bg);
  font-weight: 600;
}

/* Food Items Grid */
.items-grid {
  flex: 1;
  padding: 1rem 1.5rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.8rem;
  align-content: start;
}

.item-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}

.item-card:hover .item-card-image img {
  transform: scale(1.08);
}

.item-card::after {
  content: '+ Add to Order';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.5rem;
  transform: translateY(100%);
  transition: transform 0.2s;
}

.item-card:hover::after { transform: translateY(0); }

.item-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.item-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.item-card .item-category {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.item-card .price {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  margin-top: auto;
}

/* ============================================================
   CART / ORDER SIDEBAR
   ============================================================ */
.cart-sidebar {
  width: 400px;
  background-color: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.cart-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h2 { font-size: 1.1rem; font-weight: 700; }

.cart-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.cart-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cart-type-badge.dine-in {
  background: rgba(59,130,246,0.15);
  color: var(--primary);
  border: 1px solid rgba(59,130,246,0.3);
}

.cart-type-badge.take-out {
  background: rgba(139,92,246,0.15);
  color: var(--secondary);
  border: 1px solid rgba(139,92,246,0.3);
}

.cart-table-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: rgba(16,185,129,0.12);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.25);
}

.clear-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.3rem;
  transition: opacity 0.2s;
}
.clear-btn:hover { opacity: 0.7; }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.empty-cart-msg {
  text-align: center;
  color: var(--text-muted);
  margin-top: 2.5rem;
  font-size: 0.9rem;
  line-height: 1.8;
}

.empty-cart-msg .empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255,255,255,0.03);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.7rem;
  border: 1px solid var(--border);
  gap: 0.5rem;
  transition: background 0.2s;
}

.cart-item:hover { background: rgba(255,255,255,0.05); }

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.cart-item-info .item-line-total {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.qty-btn {
  background: var(--surface-light);
  border: none;
  color: var(--text);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 0.2s;
}

.qty-btn:hover { background: var(--primary); }

.qty-btn.remove-btn {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  font-size: 0.75rem;
}

.qty-btn.remove-btn:hover { background: var(--danger); color: white; }

.qty-display {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* Cart Summary */
.cart-summary {
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--border);
  background-color: rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.summary-row.total {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  border-top: 1px dashed var(--border);
  padding-top: 0.8rem;
  margin-top: 0.5rem;
  margin-bottom: 1.2rem;
}

.payment-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.payment-section .btn {
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: white; }
.btn-secondary { background: linear-gradient(135deg, var(--secondary), #7c3aed); color: white; }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: white; }
.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 460px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal.modal-lg { max-width: 560px; }

.modal-header {
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.1);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.close-modal {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.close-modal:hover { background: var(--danger); color: white; border-color: var(--danger); }

.modal-body { padding: 1.5rem; }

.modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.modal-body select,
.modal-body input[type="text"],
.modal-body input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}

.modal-body select:focus,
.modal-body input:focus {
  border-color: var(--primary);
}

.modal-footer {
  padding: 1.2rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.7rem;
}

.modal-footer .btn { flex: 1; }

/* ============================================================
   RECEIPT MODAL
   ============================================================ */
.receipt-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  font-size: 0.88rem;
}

.receipt-header {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}

.receipt-header h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.receipt-header p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.receipt-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.receipt-info span.label { color: var(--text-muted); }
.receipt-info span.value { color: var(--text); font-weight: 600; text-align: right; }

.receipt-items {
  border-top: 1px dashed var(--border);
  padding-top: 0.8rem;
  margin-bottom: 0.8rem;
}

.receipt-item-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.83rem;
}

.receipt-item-row .item-name { flex: 1; color: var(--text); }
.receipt-item-row .item-qty { color: var(--text-muted); padding: 0 0.8rem; }
.receipt-item-row .item-amt { color: var(--primary); font-weight: 600; }

.receipt-totals {
  border-top: 1px dashed var(--border);
  padding-top: 0.8rem;
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
}

.receipt-total-row.grand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.3rem;
}

.receipt-change {
  text-align: center;
  margin-top: 1rem;
  padding: 0.7rem;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 8px;
  color: var(--success);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Cash input */
.cash-input-group {
  position: relative;
}

.cash-input-group .peso-symbol {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
  margin-top: -0.5rem;
}

.cash-input-group input {
  padding-left: 2rem !important;
}

.change-display {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.change-display .label { color: var(--text-muted); font-size: 0.85rem; }
.change-display .value { color: var(--success); font-size: 1.2rem; font-weight: 700; }

/* Order info box */
.order-info-box {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.order-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.order-info-row .label { color: var(--text-muted); }
.order-info-row .value { color: var(--text); font-weight: 600; }

/* Success animation */
.success-icon {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: rgba(16,185,129,0.4); color: var(--success); }
.toast.error   { border-color: rgba(239,68,68,0.4); color: var(--danger); }
.toast.info    { border-color: rgba(59,130,246,0.4); color: var(--primary); }

/* No items placeholder */
.no-items-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.no-items-placeholder .placeholder-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.7rem;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

/* ─── LIGHT MODE OVERRIDES ────────────────────────────────── */
:root.light-mode {
  --bg: #e2e8f0;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-light: rgba(255, 255, 255, 0.85);
  --text: #0f172a;
  --text-muted: #64748b;
  
  /* Neon Lining */
  --system-neon: var(--primary);
  --border: var(--system-neon);
}

:root.light-mode .menu-item,
:root.light-mode .cart-panel,
:root.light-mode .categories-sidebar,
:root.light-mode .pos-header {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--system-neon);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--system-neon) 25%, transparent), inset 0 1px 2px rgba(255,255,255,0.9);
  transform: translateZ(0);
}

/* ─── EXCLUDE LOGIN SCREENS FROM LIGHT MODE ────────────────────────────────── */
#login-screen {
  --bg: #0f172a !important;
  --surface: #1e293b !important;
  --surface-light: #334155 !important;
  --text: #f8fafc !important;
  --text-muted: #94a3b8 !important;
  --border: rgba(255, 255, 255, 0.1) !important;
  --system-neon: transparent !important;
}

#login-screen .login-card {
  border: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4) !important;
}

/* ─── MOBILE RESPONSIVENESS (PATCHED) ────────────────────────────────────────────── */
.mobile-toggle-btn {
  display: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--text-primary, #fff);
  font-size: 20px;
  cursor: pointer;
  margin-right: 12px;
  padding: 6px 12px;
  line-height: 1;
  transition: all 0.2s ease;
}
:root.light-mode .mobile-toggle-btn {
  border: 1px solid rgba(0,0,0,0.15);
  color: #333;
}

@media (max-width: 900px) {
  .mobile-toggle-btn {
    display: inline-block;
  }
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    box-shadow: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 0 0 40px rgba(0,0,0,0.8) !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
  /* Grids */
  .grid-2, .grid-3, .form-row { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
  .order-type-screen {
    overflow-y: auto !important;
    justify-content: flex-start !important;
    padding-top: 20px !important;
    padding-bottom: 50px !important;
  }
  .screen { overflow-y: auto !important; }
  
  /* Stack POS menu and cart on mobile */
  .menu-layout {
    flex-direction: column !important;
    overflow-y: auto !important;
  }
  .menu-area {
    flex: none !important;
    height: auto !important;
    overflow: visible !important;
  }
  .items-grid {
    overflow: visible !important;
    padding-bottom: 2rem !important;
  }
  .cart-sidebar {
    width: 100% !important;
    flex: none !important;
    height: auto !important;
    border-left: none !important;
    border-top: 2px solid var(--border) !important;
  }
  .cart-items {
    max-height: 400px;
    overflow-y: auto;
  }
}


/* ═══════════════════════════════════════════════════════════════
   ORDER TRAPPING & CONCURRENCY TABLE LOCKS
   ═══════════════════════════════════════════════════════════════ */
.table-card.order-trapped {
  border-color: rgba(239, 68, 68, 0.85) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.38) !important;
  position: relative !important;
  cursor: not-allowed !important;
}

.table-card.order-trapped:hover {
  transform: translateY(-1px) !important;
  border-color: rgba(239, 68, 68, 1) !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.55) !important;
}

.table-trapped-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(239, 68, 68, 0.95);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.3px;
  animation: pulse-trapped 2.2s infinite ease-in-out;
  z-index: 5;
}

@keyframes pulse-trapped {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.05);
    opacity: 0.88;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.75);
  }
}

/* Tablet & Phone Sandbox / Base POS Responsive Overrides */
@media (max-width: 1100px) {
  .mobile-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    transform: translateX(-105%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 0 0 40px rgba(0,0,0,0.8) !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
}
