:root {
  --wood-darkest: #120a05;
  --wood-dark: #1d1008;
  --wood-panel: #28160b;
  --wood-card: #341d0f;
  --wood-hover: #422514;
  --wood-border: #5c351d;
  --rope-gold: #c89654;
  --carved-cream: #f4dcb5;
  --carved-light: #fff3df;
  --ember-orange: #e85d1a;
  --ember-glow: #ff7b29;
  --sea-salt: #38bdf8;
  --herb-green: #22c55e;
  --wait-amber: #f59e0b;
  --danger-red: #ef4444;
  --text-main: #f9ebd2;
  --text-muted: #c2a077;
  --shadow-deep: 0 10px 30px rgba(0, 0, 0, 0.75);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  /* Guarantees full-screen background coverage while keeping interactive elements
     safely clear of the iPhone clock (11:00), Dynamic Island/Notch & Home bar */
  --safe-top: max(env(safe-area-inset-top, 52px), 52px);
  --safe-bottom: max(env(safe-area-inset-bottom, 34px), 34px);
  --safe-left: max(env(safe-area-inset-left, 0px), 10px);
  --safe-right: max(env(safe-area-inset-right, 0px), 10px);
}

@media (min-width: 768px) {
  :root {
    --safe-top: max(env(safe-area-inset-top, 26px), 26px);
    --safe-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
  }
}

html.android-native {
  --safe-top: 6px;
  --safe-bottom: 6px;
  --safe-left: 8px;
  --safe-right: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, select {
  user-select: text;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--wood-darkest);
  color: var(--text-main);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ========================================================================== */
/* 100% FULL-SCREEN SAFEAREA SCAFFOLD                                         */
/* ========================================================================== */
.safe-area-scaffold {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--wood-darkest);
  position: relative;
}

/* ========================================================================== */
/* TOP HEADER — EXTENDS BEHIND STATUS BAR, CONTENT PADDED BY --safe-top       */
/* ========================================================================== */
.top-header {
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 2px) var(--safe-right) 8px var(--safe-left);
  background: linear-gradient(180deg, #2b160b 0%, #1d0f07 100%);
  border-bottom: 2px solid var(--rope-gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  gap: 6px;
  z-index: 30;
  flex-shrink: 0;
  position: relative;
  width: 100%;
}

.top-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  min-height: 36px;
}

.header-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #44140a 0%, #220803 100%);
  border: 1.5px solid #dc2626;
  color: #fca5a5;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-logout-btn:hover {
  background: linear-gradient(180deg, #5c1b0e 0%, #350c05 100%);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.header-logout-btn:active {
  transform: scale(0.96);
}

.header-logout-btn .logout-icon {
  font-size: 0.8rem;
  line-height: 1;
}

.header-logout-btn .logout-label {
  letter-spacing: 0.02em;
}

.back-nav-btn {
  background: linear-gradient(135deg, var(--ember-orange) 0%, #9a3412 100%);
  border: 1.5px solid var(--carved-light);
  color: #fff;
  font-weight: 900;
  font-size: 0.76rem;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.back-nav-btn.visible {
  display: inline-flex;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--rope-gold);
  object-fit: cover;
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--carved-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-rif {
  font-size: 0.64rem;
  color: var(--rope-gold);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-pills {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  flex-shrink: 0;
}

.bcv-pill {
  background: #182e1b;
  border: 1.5px solid #4ade80;
  border-radius: 999px;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex: 1 1 0%;
  min-width: 0;
}

.bcv-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 6px #4ade80;
  flex-shrink: 0;
}

.bcv-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ecfdf5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bcv-val {
  color: #86efac;
  font-weight: 900;
  font-size: 0.74rem;
}

.session-pill {
  background: var(--wood-card);
  border: 1.5px solid var(--rope-gold);
  border-radius: 999px;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--carved-light);
  cursor: pointer;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}

.session-pill #googleSessionLabel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
  overflow: hidden;
  text-overflow: ellipsis;
}

.google-avatar {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #4285F4;
  color: #fff;
  font-weight: 900;
  font-size: 0.66rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.admin-badge {
  background: #5c1f0b;
  border: 1.5px solid var(--ember-glow);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffedd5;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-badge.unlocked {
  background: #854d0e;
  border-color: #fde047;
  color: #fef9c3;
}

/* ========================================================================== */
/* MAIN WORKSPACE & INDEXEDSTACK NAVIGATION                                   */
/* ========================================================================== */
.workspace {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  display: flex;
  overflow: hidden;
  position: relative;
  background-color: var(--wood-darkest);
}

.nav-rail {
  width: 84px;
  background: #1a0e07;
  border-right: 2px solid var(--wood-border);
  display: flex;
  flex-direction: column;
  padding: 8px 6px var(--safe-bottom) 6px;
  gap: 6px;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 25;
}

.nav-btn {
  background: #2b170c;
  border: 1px solid var(--wood-border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  position: relative;
}

.nav-btn .nav-icon {
  font-size: 1.15rem;
}

.nav-btn.active {
  background: linear-gradient(145deg, var(--ember-orange) 0%, #9a3412 100%);
  color: #fff;
  border-color: var(--carved-cream);
  box-shadow: 0 3px 10px rgba(232, 93, 26, 0.45);
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  background: var(--herb-green);
  color: #052e16;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 999px;
}

/* CENTER STAGE (INDEXEDSTACK CONTAINER) */
.center-stage {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #160c06;
  position: relative;
}

/* VIEW PANELS: STRICT INDEXEDSTACK (ONLY ACTIVE VIEW VISIBLE, SOLID OPAQUE) */
.view-panel {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #160c06;
  position: relative;
}

.view-panel.active {
  display: flex !important;
  visibility: visible;
  pointer-events: auto;
}

.panel-toolbar {
  padding: 8px 12px;
  background: #28160b;
  border-bottom: 1.5px solid var(--wood-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 5;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.inline-back-btn {
  background: var(--wood-card);
  border: 1.5px solid var(--rope-gold);
  color: var(--carved-light);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.76rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--carved-cream);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* BRANCH TABS */
.branch-strip {
  display: flex;
  gap: 7px;
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #1d1008;
  border-bottom: 1px solid var(--wood-border);
  flex-shrink: 0;
  scrollbar-width: none;
}

.branch-strip::-webkit-scrollbar {
  display: none;
}

.branch-chip {
  background: var(--wood-card);
  border: 1.5px solid var(--wood-border);
  color: var(--carved-cream);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.branch-chip.active {
  background: linear-gradient(135deg, var(--rope-gold) 0%, #925f25 100%);
  color: #160b04;
  border-color: var(--carved-light);
}

/* PRODUCT TOUCH GRID */
.product-grid {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  padding: 8px 10px 88px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 8px;
  align-content: start;
  background-color: #160c06;
}

@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 8px 88px 8px;
  }
}

.product-card {
  background: linear-gradient(160deg, #3a2010 0%, #241309 100%);
  border: 1.5px solid var(--wood-border);
  border-radius: var(--radius-lg);
  padding: 9px 8px 8px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  min-height: 122px;
  height: 100%;
  box-sizing: border-box;
}

.product-card:active {
  transform: scale(0.96);
  border-color: var(--rope-gold);
}

.product-branch-tag {
  font-size: 0.61rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rope-gold);
  font-weight: 800;
  line-height: 1.2;
}

.product-title {
  font-size: 0.83rem;
  font-weight: 800;
  color: var(--carved-light);
  line-height: 1.2;
}

.product-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.product-prices {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding-top: 5px;
  border-top: 1px dashed rgba(200, 150, 84, 0.3);
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

.price-usd {
  font-size: 0.88rem;
  font-weight: 900;
  color: #4ade80;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.price-bs {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--carved-cream);
  background: rgba(0, 0, 0, 0.55);
  padding: 2.5px 5px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

/* TABLES & TAKEAWAY MAP */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px;
  align-content: start;
}

.table-card {
  background: linear-gradient(145deg, #2d190d 0%, #1d1008 100%);
  border: 2px solid var(--wood-border);
  border-radius: var(--radius-lg);
  padding: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.table-card.occupied {
  background: linear-gradient(145deg, #431d09 0%, #291004 100%);
  border-color: var(--ember-glow);
}

.table-card.waiting-bill {
  background: linear-gradient(145deg, #453008 0%, #291b04 100%);
  border-color: #fde047;
}

.table-card.selected-table {
  outline: 3px solid #38bdf8;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.table-name {
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--carved-light);
}

.table-status-badge {
  font-size: 0.6rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-status-badge.free {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid #22c55e;
}

.table-status-badge.busy {
  background: rgba(232, 93, 26, 0.3);
  color: #fed7aa;
  border: 1px solid var(--ember-glow);
}

.table-status-badge.sent {
  background: rgba(56, 189, 248, 0.25);
  color: #bae6fd;
  border: 1px solid #38bdf8;
}

.table-status-badge.waiting {
  background: rgba(245, 158, 11, 0.3);
  color: #fef08a;
  border: 1px solid #fde047;
}

.table-crud-bar {
  display: flex;
  gap: 5px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.mini-btn {
  flex: 1;
  background: #140b05;
  border: 1px solid var(--wood-border);
  color: var(--carved-cream);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

/* ========================================================================== */
/* RIGHT SIDEBAR / COMANDA VIEW: COMPACT HEADER/FOOTER + SPACIOUS ITEMS LIST  */
/* ========================================================================== */
.order-sidebar {
  width: 370px;
  background: #1b0f07;
  border-left: 2px solid var(--rope-gold);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 28;
  min-height: 0;
  height: 100%;
}

.order-sidebar.hidden-in-view {
  display: none !important;
}

.ticket-header {
  padding: 8px 12px;
  background: #2b170c;
  border-bottom: 1.5px solid var(--wood-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.ticket-mode-bar {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mode-pill {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--wood-border);
  background: var(--wood-dark);
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.mode-pill.active {
  background: var(--ember-orange);
  color: #fff;
  border-color: var(--carved-light);
}

.customer-mini-box {
  background: #120a05;
  border: 1px solid var(--wood-border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
}

/* SPACIOUS ITEMS AREA IN COMANDA */
.ticket-items {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #140b05;
}

.ticket-item {
  background: #29160b;
  border: 1.5px solid var(--wood-border);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.ticket-item.sent-item {
  border-left: 4px solid #38bdf8;
  background: #21130a;
}

.ticket-item.new-item {
  border-left: 4px solid var(--herb-green);
}

.ticket-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.ticket-item-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--carved-light);
  line-height: 1.2;
}

.ticket-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.qty-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1.5px solid var(--rope-gold);
  background: var(--wood-dark);
  color: var(--carved-light);
  font-weight: 900;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qty-btn.waiter-delete {
  border-color: #f87171;
  color: #fff;
  background: #b91c1c;
  font-size: 0.74rem;
  gap: 3px;
  padding: 0 9px;
}

.qty-btn.delete-lock {
  border-color: #fbbf24;
  color: #fde68a;
  background: #45260a;
  font-size: 0.72rem;
  padding: 0 9px;
}

.ticket-footer {
  padding: 8px 12px;
  background: #241309;
  border-top: 2px solid var(--rope-gold);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.totals-box {
  background: #100804;
  border: 1px solid var(--rope-gold);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.total-usd-big {
  font-size: 1.1rem;
  font-weight: 900;
  color: #4ade80;
}

.total-bs-big {
  font-size: 0.98rem;
  font-weight: 900;
  color: #fde047;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn {
  padding: 9px 11px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #fff;
  text-align: center;
}

.btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-ember {
  background: linear-gradient(135deg, var(--ember-orange) 0%, #b43c0e 100%);
  border-color: #fdba74;
}

.btn-wood {
  background: var(--wood-card);
  border-color: var(--rope-gold);
  color: var(--carved-light);
}

.btn-green {
  background: linear-gradient(135deg, #16a34a 0%, #14532d 100%);
  border-color: #86efac;
}

.btn-gold {
  background: linear-gradient(135deg, #d97706 0%, #78350f 100%);
  border-color: #fde047;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
  border-color: #fca5a5;
}

/* ========================================================================== */
/* SCROLLABLE PANELS (SingleChildScrollView INSIDE EACH VIEW PANEL)           */
/* ========================================================================== */
.scroll-content {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 12px 36px 12px;
  display: block;
  background-color: #160c06;
  position: relative;
  z-index: 1;
}

.scroll-content > .wood-box,
.scroll-content > .stats-grid {
  margin-bottom: 12px;
}

.wood-box {
  background: #26140a;
  border: 1.5px solid var(--wood-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.wood-box h3 {
  color: var(--carved-light);
  margin-bottom: 8px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 7px;
}

.field-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--rope-gold);
}

.wood-input {
  background: #120904;
  border: 1.5px solid var(--wood-border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--carved-light);
  font-size: 0.88rem;
  outline: none;
  width: 100%;
}

.wood-input:focus {
  border-color: var(--rope-gold);
}

/* STATS CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.stat-card {
  background: #2c180c;
  border: 1.5px solid var(--rope-gold);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.stat-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  font-weight: 700;
}

.stat-value-usd {
  font-size: 1.12rem;
  font-weight: 900;
  color: #4ade80;
  margin-top: 2px;
}

.stat-value-bs {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde047;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.data-table th, .data-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--wood-border);
  text-align: left;
}

.data-table th {
  color: var(--rope-gold);
  font-weight: 800;
  background: #180d06;
}

/* ========================================================================== */
/* BLUETOOTH PRINTER DISCOVERY LIST                                           */
/* ========================================================================== */
.bt-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.bt-device-row {
  background: #190d06;
  border: 1.5px solid var(--wood-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.bt-device-row:active {
  transform: scale(0.99);
}

.bt-device-row.connected {
  background: #132a17;
  border-color: #4ade80;
}

.bt-device-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.bt-device-name {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--carved-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bt-device-mac {
  font-family: "SF Mono", "Courier New", monospace;
  font-size: 0.69rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ========================================================================== */
/* SAFEAREA + SINGLECHILDSCROLLVIEW MODALS                                    */
/* ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 2, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding-top: max(var(--safe-top), env(safe-area-inset-top, 24px));
  padding-bottom: max(var(--safe-bottom), env(safe-area-inset-bottom, 24px));
  padding-left: max(var(--safe-left), env(safe-area-inset-left, 14px));
  padding-right: max(var(--safe-right), env(safe-area-inset-right, 14px));
  z-index: 120;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #26140a;
  border: 2px solid var(--rope-gold);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - max(var(--safe-top), env(safe-area-inset-top, 24px)) - max(var(--safe-bottom), env(safe-area-inset-bottom, 24px)) - 20px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 14px 20px 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95);
  display: block;
}

.modal-card > * + * {
  margin-top: 10px;
}

.modal-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--wood-border);
  position: sticky;
  top: -14px;
  background: #2c180c;
  margin: -14px -14px 10px -14px;
  padding: 10px 14px;
  z-index: 5;
}

.modal-top-bar h3 {
  font-size: 0.92rem;
  color: var(--carved-light);
  text-align: center;
  flex: 1;
}

/* CIRCULAR PROGRESS INDICATOR */
.circular-progress {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: flutterSpin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes flutterSpin {
  to { transform: rotate(360deg); }
}

/* FLOATING SNACKBAR */
.snackbar-container {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 66px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 92%;
  max-width: 440px;
  pointer-events: none;
}

.flutter-snackbar {
  background: #1e1108;
  border: 1.5px solid var(--rope-gold);
  color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}

.flutter-snackbar.success {
  background: #14532d;
  border-color: #4ade80;
  color: #dcfce7;
}

.flutter-snackbar.error {
  background: #450a0a;
  border-color: #f87171;
  color: #fecaca;
}

/* GOOGLE OAUTH NATIVE ACCOUNT CHOOSER SHEET */
.google-oauth-sheet {
  background: #ffffff;
  color: #202124;
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  max-height: calc(100vh - max(var(--safe-top), env(safe-area-inset-top, 24px)) - max(var(--safe-bottom), env(safe-area-inset-bottom, 24px)) - 20px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.85);
}

/* ========================================================================== */
/* LEGAL MODAL & PRIVACY STYLES (APP STORE GUIDELINES COMPLIANCE)              */
/* ========================================================================== */
.legal-tabs-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--wood-border);
  padding-bottom: 8px;
}

.legal-tab-btn {
  padding: 9px 12px;
  background: var(--wood-medium);
  border: 1px solid var(--wood-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.legal-tab-btn.active {
  background: var(--ember-orange);
  color: #ffffff;
  border-color: var(--carved-cream);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.legal-doc-content {
  background: #140b06;
  border: 1.5px solid var(--wood-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.77rem;
  line-height: 1.6;
  color: var(--carved-light);
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.legal-doc-content h4 {
  color: var(--rope-gold);
  font-size: 0.84rem;
  margin: 12px 0 4px 0;
  border-bottom: 1px dashed rgba(245, 158, 11, 0.3);
  padding-bottom: 2px;
}

.legal-doc-content h4:first-child {
  margin-top: 0;
}

.legal-doc-content p, .legal-doc-content ul {
  margin-bottom: 8px;
}

.legal-doc-content ul {
  padding-left: 18px;
}

.legal-doc-content strong {
  color: var(--carved-cream);
}

.account-deletion-card {
  margin-top: 12px;
  padding: 12px;
  background: #2b0e0e;
  border: 1.5px solid #ef4444;
  border-radius: var(--radius-sm);
}

.google-account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid #e8eaed;
  cursor: pointer;
  border-radius: 8px;
}

.google-account-row:hover, .google-account-row:active {
  background: #f1f3f4;
}

/* THERMAL PAPER PREVIEW */
.thermal-paper {
  background: #fffdf9;
  color: #111;
  font-family: "Courier New", Courier, monospace;
  width: 100%;
  max-width: 330px;
  margin: 0 auto;
  padding: 12px 10px;
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
  font-size: 12px;
  line-height: 1.35;
}

.thermal-paper .t-center { text-align: center; }
.thermal-paper .t-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 6px auto;
  display: block;
}
.thermal-paper .t-divider { border-top: 1.5px dashed #222; margin: 6px 0; }
.thermal-paper .t-row { display: flex; justify-content: space-between; gap: 6px; }
.thermal-paper .t-bold { font-weight: 900; }
.thermal-paper .t-big { font-size: 14px; font-weight: 900; }

/* MOBILE FLOATING CART BUTTON & RESPONSIVE RULES */
.mobile-ticket-fab {
  display: none;
}

@media (max-width: 900px) {
  .top-header {
    padding: calc(var(--safe-top) + 2px) 10px 7px 10px;
    gap: 6px;
  }
  .top-brand-row {
    width: 100%;
  }
  .header-pills {
    width: 100%;
    gap: 6px;
  }
  .workspace {
    flex-direction: column;
  }
  .nav-rail {
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 2px solid var(--rope-gold);
    order: 3;
    padding: 8px 6px max(var(--safe-bottom), env(safe-area-inset-bottom, 34px)) 6px;
    justify-content: space-around;
    flex-shrink: 0;
  }
  .nav-btn {
    flex: 1;
    padding: 5px 2px;
    font-size: 0.6rem;
  }
  .nav-btn .nav-icon {
    font-size: 1.08rem;
  }
  .order-sidebar {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #160c06;
    z-index: 95;
    display: none;
    padding-top: var(--safe-top);
  }
  .order-sidebar .ticket-footer {
    padding-bottom: var(--safe-bottom);
  }
  .order-sidebar.mobile-open {
    display: flex !important;
  }
  .mobile-ticket-fab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: calc(var(--safe-bottom) + 56px);
    left: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--ember-orange) 0%, #9a3412 100%);
    border: 2px solid var(--carved-light);
    color: #fff;
    padding: 10px 15px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 0.82rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.85);
    z-index: 45;
    cursor: pointer;
  }
  .mobile-ticket-fab.hidden-fab {
    display: none !important;
  }
}

@media print {
  body * { visibility: hidden !important; }
  #thermalPrintModal, #thermalPrintModal * { visibility: visible !important; }
  #thermalPrintModal {
    position: absolute !important;
    inset: 0 !important;
    background: #fff !important;
    padding: 0 !important;
    display: block !important;
  }
  .no-print { display: none !important; }
  .thermal-paper {
    box-shadow: none !important;
    max-width: 80mm !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 2mm !important;
  }
}

/* ========================================================================== */
/* AUTHENTICATION PORTAL & USER SESSION (MULTI-TENANT & FIREBASE AUTH)        */
/* ========================================================================== */
.auth-portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(18, 10, 5, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.auth-portal-card {
  background: linear-gradient(160deg, #2a160b 0%, #170d06 100%);
  border: 2px solid var(--wood-border);
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.95);
  margin: auto;
}

.auth-portal-header {
  text-align: center;
  margin-bottom: 18px;
}

.auth-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid var(--rope-gold);
  box-shadow: 0 4px 15px rgba(232, 93, 26, 0.35);
  margin-bottom: 8px;
  object-fit: cover;
}

.auth-portal-header h2 {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--carved-light);
  letter-spacing: 0.05em;
  margin: 0;
}

.auth-subtitle {
  font-size: 0.74rem;
  color: var(--rope-gold);
  font-weight: 700;
  margin-top: 3px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--wood-border);
}

.auth-tab-btn {
  flex: 1;
  padding: 9px;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: linear-gradient(135deg, var(--ember-orange) 0%, #b83a04 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 93, 26, 0.4);
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-error-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap input {
  width: 100% !important;
  padding-right: 42px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 4px 6px;
  color: var(--rope-gold);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  z-index: 2;
  transition: transform 0.1s ease;
}

.password-toggle-btn:active {
  transform: translateY(-50%) scale(0.9);
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 12px 0 10px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--wood-border);
}

.auth-divider span {
  padding: 0 10px;
}

.google-auth-btn {
  width: 100%;
  background: #ffffff;
  color: #3c4043;
  border: 1px solid #dadce0;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.15s;
}

.google-auth-btn:active {
  background: #f1f3f4;
}

.auth-legal-footer {
  margin-top: 16px;
  border-top: 1px solid rgba(200, 150, 84, 0.2);
  padding-top: 12px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.auth-legal-footer a {
  color: var(--rope-gold);
  text-decoration: none;
  font-weight: 700;
}

.auth-legal-footer span {
  margin: 0 6px;
  color: var(--wood-border);
}

/* ========================================================================== */
/* BOTÓN VISIBLE DE CERRAR SESIÓN EN HEADER                                   */
/* ========================================================================== */
@media (min-width: 901px) {
  .top-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(var(--safe-top) + 4px) var(--safe-right) 10px var(--safe-left);
  }
  .top-brand-row {
    width: auto;
    flex: 1 1 auto;
    justify-content: flex-start;
  }
  .header-logout-btn {
    order: 2;
    margin-left: 12px;
  }
  .header-pills {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 8px;
  }
  .bcv-pill, .session-pill {
    flex: 0 0 auto;
  }
}

/* ========================================================================== */
/* MODAL OVERLAY: VERIFICACIÓN 2FA EMAILJS                                    */
/* ========================================================================== */
.two-factor-overlay {
  position: fixed;
  inset: 0;
  z-index: 10005;
  background: rgba(14, 7, 3, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.two-factor-icon-wrap {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #3d1c0a 0%, #1a0b04 100%);
  border: 2px solid var(--rope-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 0 16px rgba(230, 93, 26, 0.35);
}

.otp-inputs-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0 12px;
}

.otp-digit-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--carved-light);
  background: #150904;
  border: 1.5px solid var(--rope-gold);
  border-radius: 8px;
  outline: none;
  transition: all 0.2s ease;
  caret-color: var(--ember-glow);
}

.otp-digit-input:focus {
  border-color: var(--ember-orange);
  box-shadow: 0 0 10px rgba(232, 93, 26, 0.65);
  background: #241108;
}

.two-factor-timer-wrap {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.auth-success-box {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid #22c55e;
  color: #86efac;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
  margin: 8px 0;
}
