:root {
  /* Colors - Premium Twilight Theme */
  --bg-main: #06090e;
  --bg-panel: rgba(14, 20, 31, 0.6);
  --bg-panel-solid: #0e141f;
  --border-color: rgba(255, 255, 255, 0.04);
  --border-light: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  /* Accents */
  --accent-primary: #38bdf8; /* Soft bright cyan */
  --accent-primary-glow: rgba(56, 189, 248, 0.4);
  --accent-secondary: #818cf8; /* Soft Indigo */
  --accent-danger: #f43f5e;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  
  /* Fixture Colors */
  --grid-line: rgba(255, 255, 255, 0.03);

  --sidebar-width: 330px;
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.08), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(129, 140, 248, 0.08), transparent 40%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.4) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Typography */
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text-main); }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; letter-spacing: -0.5px; }
h3 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 1.5rem; }
.subtitle { font-size: 0.95rem; color: var(--accent-primary); font-weight: 400; margin-bottom: 2.5rem; opacity: 0.9;}
.instruction-text { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Sidebar */
.sidebar {
  width: 330px;
  min-width: 330px;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-icon {
  font-size: 2.2rem;
  color: var(--accent-primary);
  filter: drop-shadow(0 0 8px var(--accent-primary-glow));
}

/* Tool Grid */
.tools-section, .stats-section {
  margin-bottom: 2.5rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.hidden { display: none !important; }

.tool-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.02);
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.tool-btn.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(129, 140, 248, 0.15) 100%);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-primary-glow), inset 0 2px 10px rgba(255,255,255,0.05);
}

.tool-btn .material-symbols-outlined {
  font-size: 1.8rem;
  transition: transform var(--transition-fast);
}
.tool-btn:hover .material-symbols-outlined {
  transform: scale(1.1);
}

#eraser-btn {
  grid-column: span 2;
}

.grid-cell.drag-over {
  background: rgba(56, 189, 248, 0.1) !important;
  border: 1px dashed var(--accent-primary) !important;
  z-index: 2;
}

.product-card {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  border-color: var(--accent-primary) !important;
}

#eraser-btn.active {
  background: rgba(255, 51, 102, 0.1);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.3);
}

/* Stats */
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.stat-val {
  font-weight: 800;
  color: var(--accent-primary);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  letter-spacing: 0.5px;
}
.btn-primary {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 5px 15px var(--accent-primary-glow);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(129, 140, 248, 0.4);
  transform: translateY(-2px);
}
.btn-danger {
  background: transparent;
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
}
.btn-danger:hover {
  background: var(--accent-danger);
  color: #fff;
  box-shadow: 0 0 15px rgba(255,51,102,0.4);
}
.btn-sm {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
.btn-sm.btn-active {
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.action-buttons {
  margin-top: auto;
}

/* Main Grid Area */
.grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.grid-header {
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.view-toggles {
  display: flex;
  gap: 0.75rem;
}

.canvas-wrapper {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  background-image: 
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: center;
  -webkit-mask-image: radial-gradient(circle, black 50%, transparent 100%);
  mask-image: radial-gradient(circle, black 50%, transparent 100%);
  transition: background-color 0.4s ease;
}

/* ===== Floor Plan Settings Bar ===== */
.floor-settings {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1.5rem;
  background: rgba(15,23,42,0.85);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-smooth);
  flex-wrap: wrap;
  font-size: 0.75rem;
}
.floor-settings.hidden {
  display: none;
}
.floor-setting-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.floor-setting-group label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  min-width: 28px;
}
.floor-setting-val {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-primary);
  min-width: 26px;
  text-align: center;
}
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 3px;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
  margin-bottom: 0;
  cursor: pointer;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 4px var(--accent-primary-glow);
}
.range-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: none;
}
.floor-select {
  background: rgba(0,0,0,0.4);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0;
  cursor: pointer;
}

.fixture.type-eraser {
  display: none;
}
.fixture.type-table {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid #f59e0b;
  border-radius: 50%;
}
.fixture.type-kitchen {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px dashed #ef4444;
}
.fixture.table-seated {
  background: rgba(245, 158, 11, 0.6) !important;
  color: #fff !important;
  border: 2px solid #fff !important;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(25, var(--grid-size));
  grid-template-rows: repeat(15, var(--grid-size));
  gap: 2px;
  background-color: var(--border-color); 
  border: 2px solid var(--border-color);
  box-shadow: 0 30px 60px -15px rgba(0,0,0,0.8), 0 0 80px rgba(56, 189, 248, 0.05);
  border-radius: 12px;
  transform-origin: center;
  transform: perspective(1000px) rotateX(1deg);
  transition: transform var(--transition-smooth);
}
.store-grid.mode-edit {
  touch-action: none;
}
.store-grid:hover {
  transform: perspective(1000px) rotateX(0deg);
}

/* Floor Themes */
.floor-theme-default .grid-cell { background-color: var(--bg-main); }
.floor-theme-hardwood .grid-cell {
  background: linear-gradient(135deg, #3e2723 0%, #4e342e 50%, #3e2723 100%);
  border-right: 1px solid rgba(62,39,35,0.5);
}
.floor-theme-hardwood {
  background-color: #2c1e17;
  border-color: rgba(78,52,46,0.5);
}
.floor-theme-marble .grid-cell {
  background: linear-gradient(145deg, #e0e0e0 0%, #f5f5f5 40%, #cfd8dc 100%);
}
.floor-theme-marble {
  background-color: #bdbdbd;
  border-color: rgba(189,189,189,0.5);
  gap: 1px;
}
.floor-theme-marble .fixture { color: #fff; }
.floor-theme-tile .grid-cell {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(255,255,255,0.04);
}
.floor-theme-tile {
  background-color: #0f0f1a;
  border-color: rgba(255,255,255,0.06);
  gap: 1px;
}
.floor-theme-blueprint .grid-cell {
  background: #1a3a5c;
  border: 1px solid rgba(56,189,248,0.12);
}
.floor-theme-blueprint {
  background-color: #0d2137;
  border-color: rgba(56,189,248,0.2);
  gap: 1px;
}
.floor-theme-blueprint .fixture {
  border: 1px solid rgba(56,189,248,0.6) !important;
  box-shadow: 0 0 8px rgba(56,189,248,0.3);
}

.grid-cell {
  background-color: var(--bg-main);
  position: relative;
  transition: background-color var(--transition-fast);
}

/* Edit Mode Hover */
.mode-edit .grid-cell:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Fixtures placed on grid */
.fixture {
  position: absolute;
  top: 1px; left: 1px; right: 1px; bottom: 1px;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), inset 0 -2px 6px rgba(0,0,0,0.4);
  transition: all var(--transition-smooth);
}

.mode-edit .fixture:hover {
  filter: brightness(1.2);
  transform: scale(0.92);
}

.mode-inventory .fixture:hover {
  box-shadow: 0 0 20px var(--accent-primary-glow), inset 0 0 10px rgba(255,255,255,0.2);
  transform: scale(1.08);
  z-index: 10;
}

.fixture.selected {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
  z-index: 11;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { outline-color: var(--accent-primary); box-shadow: 0 0 0 var(--accent-primary-glow); }
  50% { outline-color: #00faff; box-shadow: 0 0 15px var(--accent-primary-glow); }
  100% { outline-color: var(--accent-primary); box-shadow: 0 0 0 var(--accent-primary-glow); }
}

.fixture.type-shelf { background-color: var(--color-shelf); }
.fixture.type-cooler { background-color: var(--color-cooler); }
.fixture.type-register { background-color: var(--color-register); }
.fixture.type-door { background-color: var(--color-door); }

.fixture .material-symbols-outlined {
  font-size: 1.2rem;
}

/* Fixture label (e.g. table numbers) */
.fixture-label {
  position: absolute;
  bottom: 1px;
  right: 3px;
  font-size: 0.55rem;
  font-weight: 800;
  color: rgba(255,255,255,0.7);
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}
.fixture.type-table .fixture-label {
  color: #fde68a;
}

/* Split Check Seat Card */
.split-seat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: all var(--transition-fast);
}
.split-seat-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-light);
}
.split-seat-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.split-seat-info {
  flex: 1;
}
.split-seat-info h4 {
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.split-seat-info small {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.split-seat-select {
  background: rgba(0,0,0,0.4);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 100px;
  margin-bottom: 0;
  cursor: pointer;
}
.split-check-total-card {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.split-check-total-card .check-label {
  font-weight: 700;
  color: var(--accent-success);
}
.split-check-total-card .check-amount {
  font-weight: 800;
  color: var(--text-main);
}

/* Inventory Panel */
.inventory-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 350px;
  height: 100vh;
  z-index: 20;
  border-left: 1px solid var(--border-color);
  border-right: none;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform var(--transition-smooth);
}

.inventory-panel.hidden {
  transform: translateX(100%);
}

.icon-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}
.icon-btn:hover { color: var(--accent-danger); }

.inv-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.inv-icon {
  font-size: 3rem;
  color: var(--accent-primary);
}

.add-product-form {
  background: rgba(0,0,0,0.2);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid rgba(255,255,255,0.05);
}

.scan-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.barcode-input {
  margin-bottom: 0;
  border-color: var(--accent-secondary);
  box-shadow: inset 0 0 5px rgba(112, 0, 255, 0.2);
}
.barcode-input:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 8px rgba(112, 0, 255, 0.5);
}

.icon-camera-btn {
  background: rgba(112, 0, 255, 0.15);
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
  border-radius: 6px;
  cursor: pointer;
  padding: 0 0.8rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-camera-btn:hover {
  background: var(--accent-secondary);
  color: #fff;
  box-shadow: 0 0 10px rgba(112, 0, 255, 0.4);
}

#reader-container {
  background: #000;
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}
#reader {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
}
#reader video {
  border-radius: 4px;
}

.csv-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  transition: all var(--transition-fast);
}
.csv-label:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
  border-color: var(--text-main);
}

input {
  width: 100%;
  padding: 0.8rem;
  margin-bottom: 1rem;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: inherit;
  transition: all var(--transition-fast);
}
input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary-glow);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.product-list-container {
  flex: 1;
  overflow-y: auto;
}

.product-list {
  list-style: none;
}

.product-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-fast);
}
.product-item:hover {
  background: rgba(255,255,255,0.08);
}

.prod-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.prod-barcode-badge {
  font-size: 0.65rem;
  background: rgba(112, 0, 255, 0.2);
  color: #cda3ff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(112, 0, 255, 0.4);
}
.prod-details {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.prod-price {
  color: var(--accent-success);
  font-weight: 600;
}

.del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
}
.del-btn:hover {
  background: rgba(255,51,102,0.2);
  color: var(--accent-danger);
}

/* Custom Scrollbar for panel */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity var(--transition-smooth);
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}
.modal-content {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  transform: scale(1);
  transition: transform var(--transition-smooth);
}
.modal-overlay.hidden .modal-content {
  transform: scale(0.95);
}

/* Master Table */
.master-table th {
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 2;
}
.master-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}
.master-table tr:hover {
  background: rgba(255,255,255,0.03);
}
.action-cell {
  display: flex;
  gap: 0.5rem;
}
.btn-icon-tiny {
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.btn-icon-tiny:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
}
.btn-icon-tiny.edit:hover {
  color: var(--accent-primary);
  background: rgba(0,240,255,0.1);
}
.btn-icon-tiny.delete:hover {
  color: var(--accent-danger);
  background: rgba(255,51,102,0.1);
}

/* Mobile Responsiveness for Phones */
@media screen and (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  
  .mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    background: var(--bg-panel-solid);
    border-bottom: 1px solid var(--border-color);
    z-index: 9000;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 290px;
    height: 100vh;
    z-index: 9500;
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    background: var(--bg-panel-solid);
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
    visibility: hidden;
    pointer-events: none;
  }

  .sidebar.show {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .canvas-wrapper {
    touch-action: none; /* Crucial for mobile grid editing */
    padding: 0.5rem;
    height: calc(100vh - 120px) !important;
  }

  .inventory-panel, .pos-panel {
    width: 100%;
    right: 0;
    max-height: 80vh;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 2px solid var(--border-color);
    transform: translateY(100%);
    z-index: 9200;
  }

  .inventory-panel:not(.hidden), .pos-panel:not(.hidden) {
    transform: translateY(0);
  }
  
  .modal-content {
    width: 95% !important;
    padding: 1.2rem;
    height: 92vh !important;
    max-height: 92vh !important;
  }
  
  .tool-grid {
    grid-template-columns: 1fr; /* Single column on narrow mobile */
    gap: 0.5rem;
  }
  
  .tool-btn {
    padding: 0.8rem 1rem;
    flex-direction: row;
    justify-content: flex-start;
    gap: 1rem;
  }
  
  .grid-header {
    padding: 0.8rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    position: relative;
    z-index: 100; /* Ensure it stays above the grid but below modals */
  }
  
  .view-toggles {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
  }
  
  .view-toggles button {
    flex: 1;
    font-size: 0.7rem;
    padding: 0.5rem 0.3rem;
    white-space: nowrap;
  }
}

.mobile-header { display: none; }
.mobile-close-sidebar { display: none; }

@media screen and (max-width: 900px) {
    .mobile-close-sidebar {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
}

/* ===== Payment Terminal Styles ===== */
.pay-check-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--accent-success);
}
.pay-amount-due {
  text-align: center;
  padding: 1.2rem;
  margin-bottom: 1rem;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}
.pay-due-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.pay-due-value {
  display: block;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent-success);
  text-shadow: 0 0 20px rgba(16,185,129,0.3);
}
.pay-section {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.8rem;
}
.pay-tip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.pay-tip-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.6rem 0.3rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.pay-tip-btn small {
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.7;
}
.pay-tip-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--border-light);
  color: var(--text-main);
}
.pay-tip-btn.active {
  background: rgba(16,185,129,0.15);
  border-color: var(--accent-success);
  color: var(--accent-success);
  box-shadow: 0 0 10px rgba(16,185,129,0.2);
}
.pay-new-total {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border-color);
}
.pay-total-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 3px 0;
}
.pay-final-total {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-success);
  padding-top: 0.4rem;
  margin-top: 0.3rem;
  border-top: 1px solid var(--border-color);
}
.pay-method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.pay-method-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.pay-method-btn .material-symbols-outlined {
  font-size: 1.6rem;
}
.pay-method-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
  border-color: var(--border-light);
}
.pay-method-btn.active {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(56,189,248,0.1));
  border-color: var(--accent-success);
  color: var(--accent-success);
  box-shadow: 0 0 12px rgba(16,185,129,0.2);
}
.pay-quick-cash {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.pay-quick-cash button {
  flex: 1;
  min-width: 60px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.pay-quick-cash button:hover {
  background: rgba(16,185,129,0.1);
  border-color: var(--accent-success);
  color: var(--accent-success);
}
.pay-change-display {
  background: rgba(16,185,129,0.1);
  border: 2px solid var(--accent-success);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  animation: pulse-glow 1.5s infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(16,185,129,0.3); }
  50% { box-shadow: 0 0 20px rgba(16,185,129,0.5); }
}
.pay-change-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-success);
}

/* Receipt payment block */
.receipt-payment-block {
  font-family: 'Courier New', Courier, monospace;
}
.receipt-payment-block .receipt-total-row {
  font-size: 0.88rem;
}


/* ===== Menu Manager Extras ===== */
.csv-label {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.csv-label:hover {
  background: rgba(245,158,11,0.15);
  border-color: var(--accent-warning);
  color: var(--accent-warning);
}

/* ===== Receipt Paper Styles ===== */
.receipt-paper {
  width: 380px;
  max-width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  background: #fefefe;
  color: #1a1a1a;
  border-radius: 4px;
  padding: 2rem 1.8rem;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.1);
  position: relative;
}
.receipt-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 3px,
    #ddd 3px,
    #ddd 6px
  );
}

.receipt-header {
  text-align: center;
  margin-bottom: 0.5rem;
}
.receipt-logo {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
}
.receipt-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #111;
  margin: 0;
}
.receipt-subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 4px;
  color: #666;
  margin: 2px 0 8px;
}
.receipt-meta {
  font-size: 0.75rem;
  color: #555;
  margin: 2px 0;
  line-height: 1.4;
}

.receipt-divider {
  border: none;
  border-top: 1px dashed #bbb;
  margin: 8px 0;
}
.receipt-divider-double {
  border-top: 2px dashed #999;
  margin: 10px 0;
}

/* Per-Seat Section */
.receipt-body {
  min-height: 80px;
}
.receipt-seat-section {
  margin-bottom: 6px;
}
.receipt-seat-header {
  font-weight: 700;
  font-size: 0.85rem;
  color: #333;
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px dotted #ccc;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.receipt-seat-header::before {
  content: '\1F37D';
  font-size: 0.8rem;
}
.receipt-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2px 0 2px 12px;
  font-size: 0.82rem;
  color: #444;
  line-height: 1.5;
}
.receipt-item-row .item-name {
  flex: 1;
  margin-right: 10px;
}
.receipt-item-row .item-price {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}
.receipt-seat-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 3px 0 3px 12px;
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
  border-top: 1px dotted #ddd;
  margin-top: 2px;
}

/* Totals */
.receipt-totals {
  margin-top: 4px;
}
.receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: #333;
  padding: 2px 0;
}
.receipt-grand-total {
  font-weight: 900;
  font-size: 1.3rem;
  color: #000;
  padding: 6px 0;
}

.receipt-footer {
  text-align: center;
  margin-top: 10px;
  padding-top: 8px;
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
}

.receipt-actions {
  text-align: center;
  margin-top: 1.5rem;
}

/* Accent colors for table label */
.accent-warning {
  color: var(--accent-warning, #f59e0b);
}

/* Print Receipt Styles */
@media print {
  body * {
    visibility: hidden;
  }
  #receipt-modal, #receipt-modal * {
    visibility: visible;
  }
  #receipt-modal {
    position: absolute;
    left: 0;
    top: 0;
    background: #fff;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .receipt-paper {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
  }
  .receipt-paper::before {
    display: none;
  }
  .receipt-actions {
    display: none !important;
  }
}
