/* CSS Mobile First para Garçom Mobile */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #0b1120;
  color: #f8fafc;
  min-height: 100vh;
}

.waiter-app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px;
  padding-bottom: max(80px, env(safe-area-inset-bottom, 20px));
}

.waiter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.waiter-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ea580c;
  letter-spacing: -0.5px;
}

.waiter-badge {
  font-size: 0.85rem;
  color: #94a3b8;
}

.waiter-badge strong {
  color: #f1f5f9;
}

.waiter-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.waiter-header-actions .pwa-header-install-btn,
.pwa-header-install-btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: rgba(224, 86, 36, 0.15) !important;
  border: 1px solid rgba(224, 86, 36, 0.45) !important;
  color: #ff9466 !important;
  height: 34px !important;
  max-height: 34px !important;
  padding: 0 14px !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  cursor: pointer !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  user-select: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  box-sizing: border-box !important;
}

.waiter-header-actions .pwa-header-install-btn:hover,
.pwa-header-install-btn:hover {
  background: rgba(224, 86, 36, 0.3) !important;
  border-color: rgba(224, 86, 36, 0.8) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}

.waiter-header-actions .pwa-header-install-btn svg,
.pwa-header-install-btn svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  fill: none !important;
  flex-shrink: 0 !important;
}

.waiter-header-actions .logout-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.waiter-header-actions .logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #34d399;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.section-title-row h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.tables-meta-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tables-count {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.btn-add-table {
  background: rgba(234, 88, 12, 0.15);
  border: 1px solid rgba(234, 88, 12, 0.4);
  color: #fb923c;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-add-table:hover {
  background: #ea580c;
  color: #ffffff;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.table-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.table-card > div {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.table-card:hover {
  transform: translateY(-2px);
  border-color: #ea580c;
}

.table-card.occupied {
  border-color: rgba(234, 88, 12, 0.4);
  background: rgba(234, 88, 12, 0.1);
}

.table-card.bill_requested {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.15);
}

.table-card.deslocada {
  border: 2px dashed rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.35);
  opacity: 0.88;
}

.table-card.deslocada:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.55);
}

.table-card.apoio {
  border: 1.5px solid rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.1);
}

.table-card.apoio:hover {
  border-color: #c084fc;
  transform: translateY(-2px);
  background: rgba(168, 85, 247, 0.18);
}

.table-card.sem_lugares {
  border: 1.5px dashed rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
  opacity: 0.82;
}

.table-card.sem_lugares:hover {
  border-color: #f87171;
  transform: translateY(-2px);
}

.table-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 4px;
  white-space: nowrap;
}

.table-status-pill.free { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.table-status-pill.occupied { background: rgba(234, 88, 12, 0.2); color: #fb923c; }
.table-status-pill.bill_requested { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.table-status-pill.deslocada { background: rgba(148, 163, 184, 0.2); color: #94a3b8; border: 1px dashed rgba(148, 163, 184, 0.5); }
.table-status-pill.apoio { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.table-status-pill.sem_lugares { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px dashed rgba(239, 68, 68, 0.5); }

.badge-linked-tables-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.table-total {
  font-size: 1rem;
  font-weight: 700;
  color: #10b981;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-meta-text {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* Bottom Sheet */
.bottom-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}

.bottom-sheet.open {
  display: flex;
}

.sheet-content {
  background: #1e293b;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.sheet-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.8rem;
  cursor: pointer;
}

.bill-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bill-summary-bar strong {
  font-size: 1.3rem;
  color: #10b981;
}

.consumed-items-list {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
  max-height: 180px;
  overflow-y: auto;
}

.consumed-item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.consumed-item-row > div:last-child {
  flex-shrink: 0;
  text-align: right;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 600;
}

.add-items-section {
  background: rgba(15, 23, 42, 0.8);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.add-items-section h4 {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 10px;
}

/* ==============================================================================
   CATEGORIAS DINÂMICAS & BUSCA RÁPIDA (GARÇOM / TEMPLATE)
   ============================================================================== */
.waiter-categories-container {
  margin-bottom: 10px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.waiter-categories-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  cursor: grab;
}

.waiter-categories-bar:active {
  cursor: grabbing;
}

.waiter-categories-bar::-webkit-scrollbar {
  display: none;
}

/* Modo Expandido: quebra em múltiplas linhas (grade / nuvem de categorias) */
.waiter-categories-container.is-expanded {
  align-items: flex-start;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 6px 8px;
}

.waiter-categories-container.is-expanded .waiter-categories-bar {
  flex-wrap: wrap;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 180px;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

.waiter-categories-container.is-expanded .cat-expand-btn {
  margin-top: 2px;
}

.waiter-categories-container.is-expanded .waiter-categories-bar::-webkit-scrollbar {
  display: block;
  width: 4px;
}

.waiter-categories-container.is-expanded .waiter-categories-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Suaves máscaras laterais para indicar continuidade sem corte abrupto */
.waiter-categories-bar.has-overflow-right:not(.has-overflow-left) {
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, black calc(100% - 22px), transparent 100%);
}

.waiter-categories-bar.has-overflow-left:not(.has-overflow-right) {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 22px);
  mask-image: linear-gradient(to right, transparent 0%, black 22px);
}

.waiter-categories-bar.has-overflow-left.has-overflow-right {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 22px, black calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 22px, black calc(100% - 22px), transparent 100%);
}

.waiter-categories-container.is-expanded .cat-nav-btn {
  display: none !important;
}

/* Botões de navegação horizontal (anterior / próximo) */
.cat-nav-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.cat-nav-btn:hover:not(:disabled) {
  background: #2563eb;
  color: #ffffff;
  border-color: #60a5fa;
  transform: scale(1.06);
}

.cat-nav-btn:disabled,
.cat-nav-btn.disabled {
  opacity: 0.22;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

/* Botão de alternar expansão (ver todas as categorias) */
.cat-expand-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.cat-expand-btn svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-expand-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.25);
}

.waiter-categories-container.is-expanded .cat-expand-btn {
  background: rgba(37, 99, 235, 0.22);
  border-color: #3b82f6;
  color: #60a5fa;
}

.waiter-categories-container.is-expanded .cat-expand-btn svg {
  transform: rotate(180deg);
}

.waiter-cat-pill {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  flex-shrink: 0;
  user-select: none;
}

.waiter-cat-pill:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}

.waiter-cat-pill.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.cat-count-badge {
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
}

.waiter-search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.waiter-search-box svg {
  position: absolute;
  left: 10px;
  color: #64748b;
  pointer-events: none;
}

.sheet-search-input {
  width: 100%;
  padding: 8px 30px 8px 32px;
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 0.82rem;
  transition: border-color 0.2s;
}

.sheet-search-input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.btn-clear-search {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.btn-clear-search:hover {
  color: #f8fafc;
}

/* Quick Chips para seleção com 1 toque */
.waiter-quick-items {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.waiter-quick-items::-webkit-scrollbar {
  display: none;
}

.waiter-quick-chip {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.waiter-quick-chip:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.4);
}

.waiter-quick-chip.selected {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.waiter-quick-chip-price {
  color: #34d399;
  font-weight: 700;
}

/* Optgroup styling inside select */
.sheet-select optgroup {
  background: #0f172a;
  color: #38bdf8;
  font-weight: 700;
  font-style: normal;
  padding: 6px 0;
}

.sheet-select option {
  background: #1e293b;
  color: #f8fafc;
  padding: 8px;
}

.product-selector-row {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 8px;
  margin-bottom: 10px;
}

.sheet-input, .sheet-select, .sheet-input-qty {
  width: 100%;
  padding: 10px;
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.btn-sheet-primary, .btn-sheet-secondary, .btn-sheet-warning, .btn-sheet-success {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  margin-bottom: 8px;
}

.btn-sheet-primary { background: #ea580c; color: #fff; }
.btn-sheet-secondary { background: #3b82f6; color: #fff; }
.btn-sheet-warning { background: #f59e0b; color: #000; }
.btn-sheet-success { background: #10b981; color: #fff; }

.sheet-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==============================================================================
   SUÍTE RESPONSIVA MOBILE & IPHONE SE (375x667)
   ============================================================================== */

@media (max-width: 640px) {
  .waiter-app {
    padding: 14px 12px;
    padding-bottom: max(75px, env(safe-area-inset-bottom, 20px));
  }

  .waiter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 16px;
  }

  .waiter-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .brand-title {
    font-size: 1.2rem;
    line-height: 1.2;
  }

  .waiter-badge {
    font-size: 0.78rem;
  }

  .waiter-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .header-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    gap: 5px;
  }

  .pulse-indicator {
    width: 6px;
    height: 6px;
  }

  .waiter-header-actions .pwa-header-install-btn,
  .pwa-header-install-btn {
    height: 31px !important;
    max-height: 31px !important;
    padding: 0 9px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
  }

  .waiter-header-actions .logout-btn {
    padding: 5px 10px;
    font-size: 11.5px;
    border-radius: 7px;
    height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #fb-master-nav-trigger.in-header {
    height: 31px !important;
    padding: 0 9px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
  }

  .section-title-row {
    margin-bottom: 12px;
  }

  .section-title-row h2 {
    font-size: 1.08rem;
  }

  .tables-count {
    font-size: 0.75rem;
    padding: 3px 10px;
  }

  .tables-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  /* Bottom Sheet Touch & Ergonomia Mobile */
  .bottom-sheet {
    padding: 0;
    align-items: flex-end;
  }

  .sheet-content {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    max-height: 90vh;
    padding: 16px 14px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    position: relative;
  }

  .sheet-content::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    margin: 0 auto 12px auto;
  }

  .sheet-header {
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .sheet-header h3 {
    font-size: 1.18rem;
  }

  .sheet-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    line-height: 1;
  }

  .bill-summary-bar {
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
  }

  .bill-summary-bar strong {
    font-size: 1.15rem;
  }

  .consumed-items-list {
    max-height: 140px;
    padding: 10px;
    margin-bottom: 12px;
  }

  .consumed-item-row {
    padding: 6px 0;
    font-size: 0.8rem;
  }

  .add-items-section {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .add-items-section h4 {
    font-size: 0.82rem;
    margin-bottom: 8px;
  }

  .product-selector-row {
    grid-template-columns: 1fr 65px;
    gap: 6px;
    margin-bottom: 8px;
  }

  /* Prevenção rigorosa do auto-zoom invasivo do iOS Safari */
  .sheet-input,
  .sheet-select,
  .sheet-input-qty,
  .sheet-search-input {
    font-size: 16px;
    padding: 9px 10px;
    margin-bottom: 8px;
    min-height: 42px;
  }

  .sheet-search-input {
    padding-left: 32px;
    padding-right: 30px;
  }

  .cat-nav-btn,
  .cat-expand-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }

  .waiter-cat-pill {
    padding: 5px 9px;
    font-size: 0.74rem;
    gap: 4px;
  }

  .cat-count-badge {
    padding: 1px 5px;
    font-size: 0.65rem;
  }

  .btn-sheet-primary,
  .btn-sheet-secondary,
  .btn-sheet-warning,
  .btn-sheet-success {
    min-height: 44px;
    padding: 11px 12px;
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .sheet-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .sheet-footer-actions button {
    font-size: 0.78rem;
    padding: 10px 4px;
    line-height: 1.25;
    margin-bottom: 0;
    white-space: normal;
  }
}

/* Específico para iPhone SE (375x667) e telas menores */
@media (max-width: 480px) {
  .waiter-app {
    padding: 12px 10px;
    padding-bottom: max(75px, env(safe-area-inset-bottom, 20px));
  }

  /* Grade de 2 Colunas rigorosamente simétrica (50% / 50%) */
  .tables-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .table-card {
    padding: 12px 10px;
    min-height: 106px;
    border-radius: 12px;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .table-card > div {
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .table-num {
    font-size: 1.1rem;
    letter-spacing: -0.3px;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .table-status-pill {
    font-size: 0.62rem;
    padding: 2px 6px;
    border-radius: 6px;
    letter-spacing: 0.2px;
    margin-top: 3px;
    white-space: nowrap !important;
    display: inline-block !important;
  }

  .table-total {
    font-size: 0.95rem;
    margin-top: 5px;
    font-weight: 800;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .table-meta-text {
    font-size: 0.68rem;
    margin-top: 2px;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .table-card > div:last-child > span {
    font-size: 0.68rem !important;
    line-height: 1.2;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .waiter-header {
    gap: 8px;
  }

  .waiter-info {
    min-width: 110px;
  }

  .brand-title {
    font-size: 1.12rem;
  }

  .waiter-header-actions {
    gap: 5px;
  }

  .header-status {
    font-size: 0.7rem;
    padding: 3px 7px;
  }

  .waiter-header-actions .pwa-header-install-btn,
  .pwa-header-install-btn {
    padding: 0 7px !important;
    font-size: 10.5px !important;
    gap: 4px !important;
  }

  .waiter-header-actions .logout-btn {
    padding: 4px 8px;
    font-size: 11px;
    height: 30px;
  }

  #fb-master-nav-trigger.in-header {
    padding: 0 7px !important;
    font-size: 10.5px !important;
    height: 30px !important;
  }
}

/* ==============================================================================
   ESTILOS DE MESAS JUNÇÃO & REMANEJAMENTO DE CADEIRAS / APOIO
   ============================================================================== */

/* Cards no Mapa de Mesas */
.table-card.deslocada {
  border: 2px dashed rgba(148, 163, 184, 0.45) !important;
  background: rgba(15, 23, 42, 0.55) !important;
  opacity: 0.85;
}

.table-card.deslocada .table-num {
  color: #94a3b8;
}

.table-card.apoio {
  border: 1.5px solid rgba(168, 85, 247, 0.55) !important;
  background: rgba(168, 85, 247, 0.12) !important;
}

.table-card.sem_lugares {
  border: 1.5px dashed rgba(239, 68, 68, 0.5) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* Pílulas de Status */
.table-status-pill.deslocada {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px dashed rgba(148, 163, 184, 0.4);
}

.table-status-pill.apoio {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.table-status-pill.sem_lugares {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Badge de Mesas Anexadas no card da Mesa Principal */
.badge-linked-tables-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 4px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Seção de Mesas Anexadas na Comanda */
.linked-tables-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.linked-tables-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.linked-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #38bdf8;
}

.btn-add-join-pill {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-join-pill:hover {
  background: #38bdf8;
  color: #0f172a;
}

.linked-tables-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linked-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.7);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.linked-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.linked-item-tag {
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn-unlink-pill {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-unlink-pill:hover {
  background: #ef4444;
  color: #ffffff;
}

.btn-quick-join-trigger {
  width: 100%;
  background: rgba(56, 189, 248, 0.08);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.btn-quick-join-trigger:hover {
  background: rgba(56, 189, 248, 0.18);
  border-style: solid;
}

/* Caixa de Alerta de Mesa Deslocada / Apoio */
.linked-table-alert-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.linked-alert-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}

.linked-table-alert-box h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 6px;
}

.linked-table-alert-box p {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.4;
}

.btn-sheet-danger {
  width: 100%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sheet-danger:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Grid de Opções de Junção (3 Cards Clicáveis) */
.join-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.join-option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.join-option-card:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
}

.join-option-card.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.15);
}

.opt-radio-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #64748b;
  margin-top: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.join-option-card.active .opt-radio-circle {
  border-color: #38bdf8;
  background: #38bdf8;
  box-shadow: inset 0 0 0 3px #1e293b;
}

.opt-content {
  flex: 1;
}

.opt-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 3px;
}

.opt-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.35;
}

/* ==============================================================================
   GERENCIAMENTO DE MESAS - ADMIN / GERENTE / SUPERADMIN (GARÇOM MOBILE)
   ============================================================================== */
.tables-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tables-admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-add-table {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.25), rgba(234, 88, 12, 0.12));
  border: 1px solid rgba(234, 88, 12, 0.5);
  color: #fb923c;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.15);
}

.btn-add-table:hover {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #ffffff;
  border-color: #ea580c;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.btn-add-table svg {
  stroke: currentColor;
}

/* Card Interativo de Adicionar Mesa na Grade */
.table-card.add-table-card {
  border: 2px dashed rgba(234, 88, 12, 0.45);
  background: rgba(234, 88, 12, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.22s ease;
  padding: 16px;
}

.table-card.add-table-card:hover {
  border-color: #ea580c;
  background: rgba(234, 88, 12, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.2);
}

.add-table-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.add-table-plus-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(234, 88, 12, 0.18);
  color: #ea580c;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.table-card.add-table-card:hover .add-table-plus-circle {
  background: #ea580c;
  color: #ffffff;
  transform: scale(1.1);
}

.add-table-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
}

.add-table-card-sub {
  font-size: 0.78rem;
  color: #fb923c;
  font-weight: 600;
}

/* Modal Dialog de Criação de Mesa */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog-card {
  background: #181c24;
  border: 1px solid #28303f;
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModal {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: rgba(30, 41, 59, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-dialog-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-badge {
  font-size: 1.5rem;
  line-height: 1;
}

.modal-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
}

.modal-dialog-subtitle {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.modal-dialog-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.table-input-number-wrap {
  display: flex;
  align-items: center;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.table-input-number-wrap:focus-within {
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}

.table-input-prefix {
  padding: 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fb923c;
  background: rgba(234, 88, 12, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  height: 44px;
  display: flex;
  align-items: center;
}

.table-number-input {
  border: none !important;
  background: transparent !important;
  padding: 0 14px !important;
  height: 44px;
  font-size: 1.15rem !important;
  font-weight: 800;
  color: #f8fafc !important;
  outline: none !important;
  box-shadow: none !important;
}

.seats-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}

.seat-chip {
  padding: 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.6);
  color: #cbd5e1;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}

.seat-chip:hover {
  background: rgba(234, 88, 12, 0.15);
  border-color: rgba(234, 88, 12, 0.4);
  color: #ffffff;
}

.seat-chip.active {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.modal-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.4);
}

.btn-delete-table-link {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-delete-table-link:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.btn-edit-table-link {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-edit-table-link:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

.admin-table-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-table-actions-sep {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  user-select: none;
}



