/* /static/style.css - Tienda Nacho POS - rediseno v0.3 */

:root{
  /* ===== Paleta exacta del MOBILE_DESIGN.md =====
     No inventar HEX. Si necesitas un tono nuevo, agregalo aqui primero. */

  /* Navy (primary) */
  --primary:      #0B2545;
  --primary-2:    #13315C;     /* hover, gradiente inicio */
  --primary-3:    #06182E;     /* gradiente final (oscuro) */
  --primary-soft: rgba(11, 37, 69, 0.08);
  --grad-total:   linear-gradient(135deg, #13315C 0%, #0B2545 55%, #06182E 100%);

  /* Cian (Producto especial - v2) */
  --cyan-bg:      #ECFEFF;
  --cyan-bg-2:    #CFFAFE;
  --cyan-border:  #A5F3FC;
  --cyan-icon:    #0891B2;
  --cyan-text:    #155E75;
  --cyan-text-2:  #0E7490;

  /* Aliases legacy (NO los uses en codigo nuevo) */
  --primary-dark: #0B2545;
  --bg-dark:      #0B2545;
  --bg-darker:    #07193b;

  /* Texto */
  --text-900: #0F172A;
  --text-700: #334155;
  --text-500: #64748B;
  --text-400: #94A3B8;
  /* Aliases legacy */
  --text-main:  #0F172A;
  --text-soft:  #64748B;
  --text-muted: #94A3B8;

  /* Fondos */
  --bg:         #F4F5F7;       /* fondo app */
  --bg-app:     #F4F5F7;
  --bg-card:    #FFFFFF;
  --bg-soft:    #F8FAFC;
  --bg-icon:    #F4F5F7;
  --panel:      #FFFFFF;
  --panel-soft: #F8FAFC;
  --panel-tint: #F4F5F7;

  /* Bordes y dividers */
  --divider:     #F1F5F9;
  --border:      rgba(11, 37, 69, 0.06);
  --border-soft: #F1F5F9;
  --border-dash: #CBD5E1;

  /* Amber (acento) */
  --amber:        #FBBF24;
  --amber-bg:     #FEF6DD;
  --amber-border: #F8E4A0;
  --amber-text:   #3F2A00;
  --amber-text-2: #5B3F00;
  /* Aliases legacy */
  --accent:      #FBBF24;
  --accent-dark: #F0A000;
  --accent-text: #3F2A00;

  /* Danger */
  --danger:      #DC2626;
  --danger-bg:   #FEF2F2;
  --danger-soft: #FEF2F2;

  /* Success */
  --success:     #10B981;
  --success-bg:  #ECFDF5;
  --success-tx:  #047857;
  --success-soft:#ECFDF5;

  /* Sombras */
  --shadow-soft:    0 1px 2px rgba(11, 37, 69, 0.04), 0 8px 24px -8px rgba(11, 37, 69, 0.08);
  --ring-soft:      inset 0 0 0 1px rgba(11, 37, 69, 0.06);
  --shadow-pagar:   0 12px 24px -10px #0B2545;
  --shadow-guardar: 0 12px 24px -12px #FBBF24;
  /* Aliases legacy */
  --shadow-card:  var(--shadow-soft);
  --shadow-hover: 0 8px 22px rgba(11, 37, 69, 0.10);
  --shadow-modal: 0 30px 60px rgba(11, 37, 69, 0.35);

  /* Radios (del spec) */
  --radius-btn:   16px;        /* Pagar, Guardar (botones grandes) */
  --radius-pill-soft: 12px;    /* Inputs, chips, pills */
  --radius-icon:  8px;          /* Iconos cuadrados, mini-cards */
  --radius-tag:   6px;          /* Tags, badges pequenos */
  --radius-sheet: 28px;         /* Action sheet (arriba) */
  /* Aliases legacy */
  --radius:    16px;
  --radius-sm: 12px;
  --radius-lg: 22px;
  --radius-pill: 999px;
}

*{ box-sizing:border-box; }

html, body{
  margin:0;
  padding:0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text-900);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Utility para codigos/precios/atajos */
.mono, .font-mono{
  font-family: "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}
/* Por defecto numeros en UI con tabular-nums (precios, cantidades) */
.tabular, input[type="number"]{
  font-variant-numeric: tabular-nums;
}

body{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button{
  font-family: inherit;
}

input, select, textarea{
  font-family: inherit;
}

/* iOS Safari: prevenir zoom automatico al hacer focus en inputs (requiere >= 16px) */
@media (max-width: 768px){
  input[type="text"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="email"],
  input[type="password"],
  input:not([type]),
  select,
  textarea{
    font-size: 16px !important;
  }
}

/* =========================
   TICKER (marquee navy del spec)
   ========================= */
.ticker{
  background: var(--primary);
  color: #fff;
  overflow: hidden;
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
/* Fades laterales navy -> transparente */
.ticker::before,
.ticker::after{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  z-index: 2;
  pointer-events: none;
}
.ticker::before{
  left: 0;
  background: linear-gradient(to right, var(--primary), transparent);
}
.ticker::after{
  right: 0;
  background: linear-gradient(to left, var(--primary), transparent);
}
/* Punto pulsante amarillo a 12px del borde izquierdo */
.ticker .liveDot{
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  z-index: 3;
  animation: pulseDot 1.8s ease-in-out infinite;
}

.ticker-track{
  display: inline-flex;
  white-space: nowrap;
  animation: tickerMove 28s linear infinite;
  padding-left: 28px;
}
.ticker-track:hover{ animation-play-state: paused; }

.ticker-item{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.90);
  padding-right: 28px;
}
.ticker-item .tag{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--amber);
  color: var(--amber-text);
  padding: 2px 8px;
  border-radius: var(--radius-tag);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.ticker-item .tag::before{
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber-text);
}
.ticker-item .tag.live{ background: #ff5252; color: #fff; }
.ticker-item .tag.live::before{ background: #fff; animation: pulseDot 1.2s ease-in-out infinite; }
.ticker-item .strike{
  text-decoration: line-through;
  color: rgba(255, 255, 255, 0.45);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}
.ticker-item .price{
  color: var(--amber);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", monospace;
}
.ticker-item .sep{ color: rgba(255, 255, 255, 0.25); }
.ticker-item.empty{
  padding-left: 28px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.55);
}

@keyframes tickerMove{
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}
@keyframes pulseDot{
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* =========================
   TOPBAR
   ========================= */
.topbar{
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand::before{
  content: "tn";
  width: 38px;
  height: 38px;
  background: var(--bg-dark);
  color: #fff;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.brandTitle{
  font-weight: 900;
  font-size: 16px;
  color: var(--text-main);
  line-height: 1.1;
}
.brandSubtitle{
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.tabs{
  display: inline-flex;
  background: var(--panel-tint);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
}
.tab{
  background: transparent;
  border: 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover{ color: var(--text-main); }
.tab.active{
  background: var(--panel);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(12, 21, 37, 0.08);
}
.tab .badge{
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  min-width: 18px;
  text-align: center;
}

.topInputs{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.field{
  background: var(--panel-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.field span{
  color: var(--text-soft);
  font-weight: 700;
  font-size: 12px;
}
.field input{
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  min-width: 140px;
  width: 100%;
}
.field input::placeholder{ color: var(--text-muted); font-weight: 600; }

/* Sesion bar */
.sessionBar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.sessionUser{
  font-weight: 800;
  color: var(--text-main);
  background: var(--primary-soft);
  padding: 6px 10px 6px 32px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  position: relative;
}
.sessionUser::before{
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
}
.sessionUser::after{
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}

.connectivityBadge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: #155f31;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid #b6e0c2;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.connectivityBadge .dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(30, 155, 72, 0.18);
  animation: connDotPulse 2s ease-in-out infinite;
}
.connectivityBadge.offline{
  background: var(--danger-soft);
  color: #922020;
  border-color: #f0b8b8;
}
.connectivityBadge.offline .dot{
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(207, 64, 64, 0.18);
}
@keyframes connDotPulse{
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.adminSheetClose,
.adminSheetTitle,
.adminSheetHead,
.adminSheetGrab,
.adminSheetBackdrop,
.mobileMenuBtn,
.mobileBellBtn,
.brandBoat,
.fieldIcon,
.tabIcon,
.auxAction{ display: none; }

/* fieldStack es transparente en desktop (la estructura mobile no estorba) */
.fieldStack{ display: contents; }

/* En desktop los actionCard se ven como pills (solo el title visible) */
.actionCard .actionIcon,
.actionCard .actionHint{ display: none; }
.actionCard .actionLabel{ display: contents; }
.actionCard .actionTitle{ display: inline; }

.sessionActions{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}
.sessionActions .btn{
  padding: 7px 12px;
  font-size: 12px;
}

/* =========================
   BOTONES
   ========================= */
.btn{
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}
.btn:hover{ background: var(--panel-tint); border-color: #d6dde9; }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity: 0.6; cursor: not-allowed; transform: none; }

.btn.primary, .btn.blue{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover, .btn.blue:hover{ background: var(--primary-dark); border-color: var(--primary-dark); }

.btn.yellow, .btn.accent{
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.yellow:hover, .btn.accent:hover{ background: var(--accent-dark); border-color: var(--accent-dark); }

.btn.red, .btn.danger{
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.red:hover, .btn.danger:hover{ background: #c93737; border-color: #c93737; }

.btn.orange{
  background: #ff8a3d;
  border-color: #ff8a3d;
  color: #fff;
}
.btn.orange:hover{ background: #e87326; border-color: #e87326; }

.btn.ghost{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
}

/* =========================
   PANEL PRINCIPAL
   ========================= */
.panel{
  padding: 18px;
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

#status{
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 10px;
}
#status:empty{ display: none; }
@media (max-width: 768px){
  #status{ display: none !important; }
}

/* Layout principal escritorio: tabla + sidebar derecho */
#viewStore, #viewOrders{
  display: grid;
  gap: 18px;
}

@media (min-width: 1100px){
  #storeCaptureWrap, #ordersCaptureWrap{
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 18px;
    align-items: start;
  }
  #tableWrap, #ordersTableWrap{
    grid-column: 1;
    grid-row: 1;
  }
  .bottomRow{
    grid-column: 1;
    grid-row: 2;
  }
  .btnRow{
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: stretch;
  }
}

/* =========================
   TABLA PRODUCTOS (desktop)
   ========================= */
#tableWrap, #ordersTableWrap, #salesListWrap, #ordersListWrap{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th{
  text-align: left;
  background: var(--panel-tint);
  color: var(--text-soft);
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th.center{ text-align: center; }
thead th.right{ text-align: right; }
tbody td{
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: 13px;
}
tbody tr:last-child td{ border-bottom: 0; }
tbody td.mono{
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}
tbody td.center{ text-align: center; }
tbody td.right{ text-align: right; font-weight: 800; }
tbody tr:hover{ background: var(--panel-tint); }
.cellFlex{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cellFlexCenter{ justify-content: center; }
.miniCaret{
  background: var(--panel-tint);
  border: 1px solid var(--border);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 900;
  color: var(--text-soft);
}
.miniCaret:hover{ background: var(--primary-soft); color: var(--primary); }

/* =========================
   MOBILE LIST (cards)
   ========================= */
.mobileList{ display: none; }
.mobileCard{
  background: var(--bg-card);
  border: 0;
  border-bottom: 1px solid var(--divider);
  border-radius: 0;
  padding: 14px 10px;
  margin: 0;
  box-shadow: none;
  display: block;
}
.mobileCard:last-child{ border-bottom: 0; }
/* =========================
   HISTORY (Ventas / Pedidos)
   ========================= */
.historyHeader{
  background: var(--bg-card);
  border-radius: var(--radius-btn);
  box-shadow: var(--ring-soft);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.historyTitleRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.historyTitleStack{ min-width: 0; flex: 1; }
.historyTitle{
  font-size: 16px;
  font-weight: 700;
  color: var(--text-900);
  line-height: 1.2;
}
.historyMeta{
  font-size: 11px;
  color: var(--text-500);
  margin-top: 2px;
  font-weight: 500;
}
.historySearchToggle{
  width: 36px;
  height: 36px;
  border-radius: var(--radius-icon);
  background: var(--bg-icon);
  border: 0;
  color: var(--text-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.historySearchToggle.active{
  background: var(--primary);
  color: #fff;
}
.historySearchToggle:hover{ background: var(--bg-soft); }
.historySearchToggle.active:hover{ background: var(--primary-2); }

/* Search bar colapsable */
.historySearchBar{
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 10px;
}
.historySearchBar[hidden]{ display: none; }
.historySearchBar .historySearchInputRow{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  height: 32px;
}
.historySearchBar .historySearchTabs{
  display: flex;
  gap: 4px;
  padding: 2px;
  background: rgba(0,0,0,0.04);
  border-radius: 10px;
}
.historySearchBar .historySearchTabs .hstab{
  flex: 1;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-400);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.historySearchBar .historySearchTabs .hstab.active{
  background: var(--bg-card);
  color: var(--text-900);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.historySearchBar .hsbIcon{ color: var(--text-400); flex-shrink: 0; }
.historySearchBar input{
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-900);
  min-width: 0;
}
.historySearchBar input::placeholder{ color: var(--text-400); font-weight: 400; }
.historySearchClear{
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-icon);
  border: 0;
  color: var(--text-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.historySearchClear:hover{ background: var(--divider); color: var(--text-900); }

/* Sync indicator (4 estados: synced/pending/offline/syncing) */
.syncIndicator{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-pill-soft);
  background: var(--green-bg, #ECFDF5);
  color: var(--success-tx, #047857);
}
.syncIndicator .syncDot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success, #10B981);
  flex-shrink: 0;
  animation: pulseDot 1.8s ease-in-out infinite;
}
.syncIndicator .syncText{
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}
.syncIndicator .syncTitle{
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.syncIndicator .syncSubtitle{
  font-size: 10px;
  opacity: 0.85;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.syncIndicator .syncBtn{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: currentColor;
  color: var(--bg-card);
  border: 0;
  border-radius: var(--radius-icon);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.syncIndicator .syncBtn span{ color: inherit; }
.syncIndicator .syncBtn:hover{ filter: brightness(0.92); }
.syncIndicator .syncBtn.spinning svg{ animation: spin 0.9s linear infinite; }
@keyframes spin{ to { transform: rotate(360deg); } }

/* Estado: pending (amarillo) */
.syncIndicator[data-state="pending"]{ background: var(--amber-bg); color: #7A5800; }
.syncIndicator[data-state="pending"] .syncDot{ background: #F59E0B; }

/* Estado: offline (rojo) */
.syncIndicator[data-state="offline"]{ background: var(--danger-bg); color: var(--danger-tx, #B91C1C); }
.syncIndicator[data-state="offline"] .syncDot{ background: var(--danger); animation: none; }

/* Estado: syncing (azul) */
.syncIndicator[data-state="syncing"]{ background: #EFF6FF; color: #1D4ED8; }
.syncIndicator[data-state="syncing"] .syncDot{
  background: transparent;
  border: 2px solid #BFDBFE;
  border-top-color: #3B82F6;
  width: 12px;
  height: 12px;
  animation: spin 0.8s linear infinite;
}

/* Status filter chips — 3 columnas iguales (Impreso/Pagado · Guardado · Cancelado) */
.historyChips{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.historyChip{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-700);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
}
.historyChip .chipLabel{
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.historyChip:hover{ background: var(--bg-icon); }
.historyChip .chipDot{
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot, #94A3B8);
}
.historyChip .chipCount{
  font-size: 10px;
  color: var(--text-500);
  font-weight: 600;
  background: var(--bg-card);
  border-radius: var(--radius-tag);
  padding: 1px 5px;
}
/* Chip activo: relleno del color del estado */
.historyChip.active{
  color: #fff;
  border-color: transparent;
}
.historyChip.active .chipDot{ background: #fff; }
.historyChip.active .chipCount{ background: rgba(255, 255, 255, 0.2); color: #fff; }
.historyChip.active[data-chip-status="impreso"]{ background: #10B981; }
.historyChip.active[data-chip-status="guardado"]{ background: #F59E0B; }
.historyChip.active[data-chip-status="cancelado"]{ background: #DC2626; }

/* History card (venta/pedido) */
.historyCard{
  background: var(--bg-card);
  border-radius: var(--radius-btn);
  box-shadow: var(--ring-soft);
  padding: 14px;
  margin-bottom: 10px;
}
.historyCardHead{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.historyFolio{
  font-size: 11px;
  color: var(--text-500);
  letter-spacing: 0;
}
.statusBadge{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-tag);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.statusBadge .statusDot{
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.statusBadge.status-impreso, .statusBadge.status-cobrado{
  background: var(--green-bg, #ECFDF5);
  color: var(--success-tx, #047857);
}
.statusBadge.status-impreso .statusDot,
.statusBadge.status-cobrado .statusDot{ background: var(--success, #10B981); }
.statusBadge.status-guardado{
  background: var(--amber-bg);
  color: #7A5800;
}
.statusBadge.status-guardado .statusDot{ background: #F59E0B; }
.statusBadge.status-cancelado{
  background: var(--danger-bg);
  color: var(--danger);
}
.statusBadge.status-cancelado .statusDot{ background: var(--danger); }

.historyCardMid{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.historyCustomer{
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.historyDate{
  font-size: 10.5px;
  color: var(--text-400);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.historyCardSubRow{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--text-500);
  flex-wrap: wrap;
}
.historyMethod{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-tag);
  font-weight: 600;
  font-size: 10px;
}
.historyVendor{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--amber-bg);
  color: var(--amber-text);
  border-radius: var(--radius-tag);
  font-weight: 700;
  font-size: 11px;
}
.historyVendorTd{
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
  margin-top: 2px;
}
.historyPieces{ color: var(--text-500); font-weight: 500; }
.historyCardTotal{
  font-size: 20px;
  font-weight: 700;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
}
.historyActions{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.historyActions .actionBtn{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-700);
  transition: background 0.15s ease;
}
.historyActions .actionBtn:hover{ background: var(--bg-icon); }
.historyActions .actionBtn.danger{ color: var(--danger); }
.historyActions .actionBtn.danger:hover{ background: var(--danger-bg); }
.historyActions .actionBtn svg{ flex-shrink: 0; }

/* =========================
   ALMACEN (Stock)
   ========================= */
.stockStats{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.stockStat{
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border-radius: var(--radius-pill-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.stockStat.tone-green{ background: var(--green-bg, #ECFDF5); border-color: rgba(16,185,129,0.15); }
.stockStat.tone-amber{ background: var(--amber-bg); border-color: var(--amber-border); }
.stockStat.tone-red{ background: var(--danger-bg); border-color: rgba(220,38,38,0.15); }
.stockStatLabel{
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-500);
}
.stockStat.tone-green .stockStatLabel{ color: #047857; }
.stockStat.tone-amber .stockStatLabel{ color: #7A5800; }
.stockStat.tone-red .stockStatLabel{ color: var(--danger-tx, #B91C1C); }
.stockStatValue{
  font-size: 22px;
  font-weight: 700;
  color: var(--text-900);
}
.stockStat.tone-green .stockStatValue{ color: #047857; }
.stockStat.tone-amber .stockStatValue{ color: #7A5800; }
.stockStat.tone-red .stockStatValue{ color: var(--danger-tx, #B91C1C); }

.stockQuickActions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stockQuickBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border-radius: var(--radius-pill-soft);
  font-weight: 700;
  font-size: 12.5px;
}
.stockQuickBtn.primary{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.stockQuickBtn.primary:hover{ background: var(--primary-2); border-color: var(--primary-2); }
.stockQuickBtn.amber{
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-text);
}

.stockList{ display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }

.stockCard{
  background: var(--bg-card);
  border-radius: var(--radius-btn);
  box-shadow: var(--ring-soft);
  padding: 14px;
}
.stockCardHead{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.stockCat{
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-400);
  font-family: "JetBrains Mono", monospace;
}
.stockName{
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-900);
  margin-top: 3px;
  line-height: 1.2;
}
.stockCode{
  font-size: 10.5px;
  color: var(--text-500);
  margin-top: 3px;
  font-family: "JetBrains Mono", monospace;
}
.stockMiddle{
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.stockMainLabel, .stockValueLabel{
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-400);
}
.stockMainValue{
  font-size: 22px;
  font-weight: 700;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 2px;
}
.stockMainValue .unit{
  font-size: 11px;
  color: var(--text-500);
  font-weight: 500;
  margin-left: 4px;
}
.stockMainSub{
  font-size: 10.5px;
  color: var(--text-500);
  margin-top: 4px;
}
.stockValueAmount{
  font-size: 16px;
  font-weight: 700;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stockValueSub{
  font-size: 10.5px;
  color: var(--text-500);
  margin-top: 4px;
}
.stockProgress{
  height: 4px;
  background: var(--divider);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.stockProgressBar{
  height: 100%;
  border-radius: 999px;
  background: var(--success, #10B981);
  transition: width 0.3s ease;
}
.stockProgressBar.amber{ background: #F59E0B; }
.stockProgressBar.red{ background: var(--danger); }
.stockLast{
  font-size: 10.5px;
  color: var(--text-400);
  margin-bottom: 10px;
}
.stockActions{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.stockActions .actionBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: var(--radius-pill-soft);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-700);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.stockActions .actionBtn.entrada{
  background: var(--success, #10B981);
  border-color: var(--success, #10B981);
  color: #fff;
}
.stockActions .actionBtn.entrada:hover{ filter: brightness(0.95); }
.stockActions .actionBtn.movs{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.stockActions .actionBtn.movs:hover{ background: var(--primary-2); border-color: var(--primary-2); }

/* Empty state mobile en historial */
.historyEmpty{
  background: var(--bg-card);
  border-radius: var(--radius-btn);
  box-shadow: var(--ring-soft);
  padding: 32px 16px;
  text-align: center;
}
.historyEmpty .emptyTitle{
  font-size: 13px;
  font-weight: 600;
  color: var(--text-700);
}
.historyEmpty .emptySubtitle{
  font-size: 11px;
  color: var(--text-400);
  margin-top: 4px;
}

/* Empty state (cuando no hay productos) */
.emptyState{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}
.emptyIcon{
  width: 72px;
  height: 72px;
  border-radius: var(--radius-btn);
  background: var(--bg-icon);
  color: var(--text-500);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 16px;
}
.emptyIconBadge{
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--bg-card);
}
.emptyTitle{
  font-size: 14px;
  font-weight: 600;
  color: var(--text-700);
}
.emptySubtitle{
  font-size: 11.5px;
  color: var(--text-400);
  margin-top: 4px;
  max-width: 240px;
  line-height: 1.4;
}

/* Header "Productos · N + Buscar" */
.productsHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
}
.productsCount{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-900);
}
.productsSearch{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 0;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-500);
  cursor: pointer;
  font-family: inherit;
  padding: 4px 6px;
}
.productsSearch:hover{ color: var(--text-900); }

.mobileTop{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.mobileBody{ min-width: 0; flex: 1; }

/* Stepper inline (- N +) */
.qtyStepper{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background: #F1F5F9;
  border-radius: var(--radius-pill-soft);
  padding: 4px;
}
.qtyBtn{
  width: 34px;
  height: 34px;
  border-radius: var(--radius-icon);
  border: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease;
}
.qtyBtn:active{ transform: scale(0.95); }
.qtyBtn.primary{
  background: var(--primary);
  color: #fff;
}
.qtyBtn.primary:hover{ background: var(--primary-2); }
.qtyValue{
  min-width: 40px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  color: #0F172A;
  cursor: pointer;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.mobilePrices{ text-align: right; flex-shrink: 0; }
.mobilePrices .lineTotal{
  font-weight: 800;
  font-size: 22px;
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.mobilePrices .lineUnit{
  font-size: 14px;
  color: var(--text-500);
  font-weight: 600;
  text-align: right;
  margin-top: 4px;
}
.mobileName{
  font-weight: 700;
  font-size: 16px;
  color: var(--text-900);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mobileCode{
  font-size: 13px;
  color: var(--text-500);
  font-weight: 500;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
.mobileCode .sep{ color: #CBD5E1; }
.mobileCode .promoBadge{
  font-family: "Inter", sans-serif;
  background: var(--amber-bg);
  color: var(--amber-text);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: var(--radius-tag);
}
.mobileCode .wholesaleBadge{
  font-family: "Inter", sans-serif;
  background: #DCFCE7;
  color: #166534;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: var(--radius-tag);
}
.mobileCode .priceStrike{
  color: #94A3B8;
  text-decoration: line-through;
  font-weight: 500;
}
.mobileCode .wholesaleHint{
  color: #15803D;
  font-size: 11.5px;
  font-weight: 600;
}
.mobileCard.wholesale{
  background: linear-gradient(0deg, rgba(220,252,231,0.4), transparent 60%);
}
.mobileMobileBody{ min-width: 0; }

.mobileMeta{
  display: flex;
  gap: 6px;
  grid-column: 1 / -1;
  margin-top: 4px;
}
.mobileMeta .box{
  flex: 1;
  background: var(--panel-tint);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mobileMeta .lbl{
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mobileMeta .val{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  color: var(--text-main);
  font-size: 13px;
}
.miniBtn{
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  color: var(--text-soft);
  min-height: 32px;
}
.miniBtn:hover{ background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* =========================
   BOTTOM ROW (input codigo)
   ========================= */
.bottomRow{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
  margin-top: 12px;
}
.barcodeWrap{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.barcodeWrap label{
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ghostWrap{
  position: relative;
  background: var(--panel-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  padding-left: 38px;
}
.ghostWrap::before{
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%236b7a90" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="2" height="12"/><rect x="6" y="6" width="1" height="12"/><rect x="9" y="6" width="3" height="12"/><rect x="14" y="6" width="2" height="12"/><rect x="18" y="6" width="3" height="12"/></svg>');
  background-repeat: no-repeat;
}
.ghostWrap input{
  width: 100%;
  background: transparent;
  border: 0;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  color: var(--text-main);
}
.ghostWrap input::placeholder{ color: var(--text-muted); font-weight: 600; }
#ghostText, #ordersGhostText{
  position: absolute;
  left: 38px;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 14px;
  font-weight: 700;
  z-index: 0;
  white-space: nowrap;
  overflow: hidden;
}
@media (max-width: 768px){
  #ghostText, #ordersGhostText{ font-size: 16px; }
}
.ghostTyped{ visibility: hidden; }
.ghostRest{ color: var(--text-muted); opacity: 0.5; }

#btnAdd, #btnOrdersAdd{
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#btnAdd::before, #btnOrdersAdd::before{
  content: "+";
  font-size: 18px;
  line-height: 1;
}
#btnAdd:hover, #btnOrdersAdd:hover{ background: var(--primary-dark); }

/* Suggest box */
#suggestBox, #ordersSuggestBox{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
  box-shadow: var(--shadow-hover);
  max-height: 320px;
  overflow-y: auto;
}
#suggestBox:empty, #ordersSuggestBox:empty{ display: none; }
.suggestItem{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.suggestItem:last-child{ border-bottom: 0; }
.suggestItem:hover, .suggestItem.active{ background: var(--primary-soft); }
.suggestItemMain{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.suggestItemName{
  font-weight: 900;
  color: var(--text-main);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestItemCode{
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  font-family: "SF Mono", Consolas, monospace;
}
.suggestItemPrice{
  font-weight: 900;
  font-size: 13px;
  color: var(--primary);
  white-space: nowrap;
}

/* =========================
   SIDEBAR (Total + acciones)
   ========================= */
.btnRow{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 1100px){
  .btnRow{
    position: sticky;
    top: 14px;
  }
}
/* Iconos dentro de los botones (Pagar, Guardar) */
.btnIcon{ flex-shrink: 0; vertical-align: middle; }
.btnIconBox{
  width: 28px;
  height: 28px;
  border-radius: var(--radius-icon);
  background: rgba(63, 42, 0, 0.12);
  color: var(--amber-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#btnCobrar{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#btnSaveSale, #btnOrdersSave{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.totalBox{
  background: var(--grad-total);
  color: #fff;
  border-radius: var(--radius-btn);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
/* Dos circulos translucidos decorativos (uno tinte amber, otro blanco) */
.totalBox .circ{
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.totalBox .circ-1{
  top: -32px;
  right: -32px;
  width: 128px;
  height: 128px;
  background: rgba(251, 191, 36, 0.07);   /* tinte amarillo sutil */
}
.totalBox .circ-2{
  top: 24px;
  right: -48px;
  width: 112px;
  height: 112px;
  background: rgba(255, 255, 255, 0.05);
}
.totalBoxHead{
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.totalBoxLabel{
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.60);
}
.totalBoxCurrency{
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.60);
}
.totalBox .totalBoxAmount{
  display: block;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.totalBoxBreakdown{
  margin-top: 6px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.70);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}
.totalBoxBreakdown .dot{ opacity: 0.5; }
.discountSummary{
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.discountSummaryActions{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.discountSummaryActions .btn{
  padding: 6px 10px;
  font-size: 11px;
}

.btnGroup{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btnGroup .btn{
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  justify-content: center;
}
@media (min-width: 1100px){
  .btnGroup{
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-card);
  }
}

#btnCobrar, #btnOrdersCobrar{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-size: 15px;
  height: 56px;
  padding: 0 16px;
  font-weight: 700;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-pagar);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#btnCobrar:hover, #btnOrdersCobrar:hover{ background: var(--primary-2); border-color: var(--primary-2); }
#btnCobrar:active, #btnOrdersCobrar:active{ transform: scale(0.99); }
#btnCobrar:disabled, #btnCobrar.disabled,
#btnOrdersCobrar:disabled, #btnOrdersCobrar.disabled{ opacity: 0.4; background: var(--text-400); border-color: var(--text-400); box-shadow: none; }
.btnIconRight{ margin-left: 2px; }

#btnSaveSale, #btnOrdersSave{
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-text);
  font-size: 13px;
  height: 56px;
  padding: 0 16px;
  font-weight: 700;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-guardar);
  transition: transform 0.15s ease;
}
#btnSaveSale:hover, #btnOrdersSave:hover{ background: var(--accent-dark); border-color: var(--accent-dark); }
#btnSaveSale:active, #btnOrdersSave:active{ transform: scale(0.99); }

.secondaryPanel{
  display: none;
}
.secondaryPanel.open{ display: block; }
.secondaryPanel .btnGroup{
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
}

/* Filter row in history */
.filterRow input,
.filterRow select{
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  background: var(--panel);
}
.filterToggle{
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-soft);
}
.filterToggle:hover{ color: var(--text-main); }

/* =========================
   BOTTOM NAV (mobile)
   ========================= */
.bottomNav{
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)) 4px;
  box-shadow: 0 -8px 20px rgba(12, 21, 37, 0.06);
}
.bottomNavInner{
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
}
.bottomNavBtn{
  flex: 1 1 0;
  min-width: 0;
}
.bottomNavBtn{
  background: transparent;
  border: 0;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: relative;
  font-family: inherit;
  border-radius: 10px;
}
.bottomNavBtn:hover{ background: var(--panel-tint); color: var(--text-soft); }
.bottomNavBtn.active{ color: var(--primary); }
.bottomNavBtn .icon{
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.bottomNavBtn .badge{
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  min-width: 16px;
  text-align: center;
  border: 2px solid var(--panel);
}
.bottomNavBtn .badge:empty,
.bottomNavBtn .badge[data-count="0"]{ display: none; }

/* =========================
   MODALES
   ========================= */
.priceModal, .ticketModal, .discountModal, .confirmModal, .loginModal,
.specialModal, .qrModal, .adminModal{
  position: fixed;
  inset: 0;
  background: rgba(12, 21, 37, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 14px;
}
.priceModalCard, .ticketModalCard, .discountModalCard, .confirmModalCard,
.loginModalCard, .specialModalCard, .qrModalCard, .adminModalCard{
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-modal);
}
.priceModalHeader, .ticketModalHeader, .discountModalHeader, .confirmModalHeader,
.specialModalHeader, .qrModalHeader, .adminModalHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.priceModalTitle, .ticketModalTitle, .discountModalTitle, .confirmModalTitle,
.specialModalTitle, .qrModalTitle, .adminModalTitle{
  font-weight: 900;
  font-size: 16px;
  color: var(--text-main);
}
.closeBtn{
  background: var(--panel-tint);
  border: 0;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-soft);
}
.closeBtn:hover{ background: var(--border); color: var(--text-main); }

.priceModalBody, .ticketModalBody, .discountModalBody, .confirmModalBody,
.specialModalBody, .qrModalBody, .adminModalBody, .loginModalCard{
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.adminModalBody label,
.priceModalBody label,
.specialModalBody label,
.discountModalBody label{
  font-weight: 800;
  color: var(--text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: -6px;
}
.priceModalBody input,
.discountModalBody input,
.specialModalBody input,
.adminModalBody input,
.adminModalBody select,
.adminModalBody textarea,
.qrScanBody textarea{
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  background: var(--panel);
  color: var(--text-main);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}
.adminModalBody input:focus,
.adminModalBody select:focus,
.adminModalBody textarea:focus,
.priceModalBody input:focus{
  border-color: var(--primary);
  background: var(--panel);
}
.discountType{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}
.discountTotal{
  background: var(--panel-tint);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-weight: 800;
  color: var(--text-main);
  font-size: 14px;
}

.ticketActions, .specialModalActions, .adminModalActions, .loginModalActions,
.confirmModalActions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.ticketActions .btn,
.adminModalActions .btn,
.specialModalActions .btn,
.loginModalActions .btn,
.confirmModalActions .btn{
  flex: 1;
  min-width: 120px;
  padding: 12px 14px;
}

.loginModalCard{
  max-width: 380px;
  padding: 24px;
  gap: 12px;
}
.loginModalTitle{
  font-weight: 900;
  font-size: 20px;
  color: var(--text-main);
  text-align: center;
}
.loginModalText{
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.loginModalCard input{
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
}
.loginModalError{ color: var(--danger); font-weight: 800; font-size: 13px; text-align: center; min-height: 18px; }
.loginModalActions{ margin-top: 4px; }
.loginModalActions .btn{ flex: 1; padding: 12px; }

.confirmModalMessage{
  color: var(--text-main);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.5;
}

#priceModalPreview, .priceModalPreview,
.pricePreview{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin-top: -6px;
}
/* Cuando hay items dentro, se ve como dropdown: borde, fondo, sombra */
#priceModalPreview:not(:empty){
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: 0 4px 12px rgba(11, 37, 69, 0.08);
  max-height: 60vh;
  overflow-y: auto;
}
body.dark #priceModalPreview:not(:empty){
  background: #1E293B;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.pricePreview .row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--primary-soft);
  border: 1px solid #d4dffa;
  border-radius: var(--radius);
  padding: 14px;
}
.pricePreview .title{ font-weight: 900; color: var(--text-main); font-size: 14px; }
.pricePreview .sub{ font-size: 12px; color: var(--text-soft); font-weight: 700; margin-top: 2px; }
.pricePreview .prices{ font-weight: 900; color: var(--primary); font-size: 13px; }

/* Lista compacta de Consultar precio (estilo suggestBox) */
.priceListItem{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  margin-bottom: 6px;
}
body.dark .priceListItem{
  background: #1E293B;
  border-color: #334155;
}
.priceListItem.draft{
  background: #FEF9E7;
  border-color: #FBBF24;
}
body.dark .priceListItem.draft{
  background: #3B2C0A;
  border-color: #B45309;
}
.priceListMain{ flex: 1; min-width: 0; }
.priceListName{
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  word-break: break-word;
}
.priceListCode{
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.priceListMayoreo{
  font-size: 11.5px;
  font-weight: 700;
  color: #15803D;
  margin-top: 4px;
}
body.dark .priceListMayoreo{ color: #4ADE80; }
.priceListPrices{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-weight: 800;
  white-space: nowrap;
}
.priceListPz{ color: #1D4ED8; font-size: 15px; }
body.dark .priceListPz{ color: #93C5FD; }
.priceListCj{ color: var(--text-muted); font-size: 15px; font-weight: 800; }
body.dark .priceListCj{ color: #CBD5E1; }
.priceListDraft{
  font-size: 11px;
  font-weight: 800;
  background: #FEF3C7;
  color: #92400E;
  padding: 4px 8px;
  border-radius: 6px;
}
.priceListItem:active{ transform: scale(0.99); }
.priceListItem{ cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.priceListItem:hover{ border-color: #3B82F6; }
body.dark .priceListItem:hover{ border-color: #60A5FA; }

/* Boton volver a la lista */
.priceDetailBack{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #F1F5F9;
  color: #334155;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  margin-bottom: 12px;
  font-family: inherit;
}
.priceDetailBack:hover{ background: #E2E8F0; }
body.dark .priceDetailBack{ background: #334155; color: #F1F5F9; }
body.dark .priceDetailBack:hover{ background: #475569; }

/* Cards de Consultar precio (legacy - mantengo por si acaso) */
.priceCard{
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
body.dark .priceCard{
  background: #1E293B;
  border-color: #334155;
}
.priceCard.draft{
  background: #FEF9E7;
  border-color: #FBBF24;
}
body.dark .priceCard.draft{
  background: #3B2C0A;
  border-color: #B45309;
}
.priceCardHead{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.priceCardName{
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  word-break: break-word;
}
.priceCardCode{
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  letter-spacing: 0.04em;
}
.priceCardDraft{
  background: #FEF3C7;
  color: #92400E;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.priceCardGrid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.priceTile{
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.dark .priceTile{
  background: #334155;
  border-color: #475569;
}
.priceTile.menudeo{
  background: #EFF6FF;
  border-color: #BFDBFE;
}
body.dark .priceTile.menudeo{
  background: #1E40AF;
  border-color: #60A5FA;
}
body.dark .priceTile.menudeo .priceTileLabel{ color: #DBEAFE; }
body.dark .priceTile.menudeo .priceTileValue{ color: #FFFFFF; }
body.dark .priceTile.menudeo .priceTileUnit{ color: #BFDBFE; }
.priceTile.caja{
  background: #F1F5F9;
  border-color: #CBD5E1;
}
body.dark .priceTile.caja{
  background: #475569;
  border-color: #94A3B8;
}
body.dark .priceTile.caja .priceTileLabel{ color: #CBD5E1; }
body.dark .priceTile.caja .priceTileValue{ color: #FFFFFF; }
body.dark .priceTile.caja .priceTileUnit{ color: #CBD5E1; }
.priceTile.mayoreo{
  background: #DCFCE7;
  border-color: #86EFAC;
}
body.dark .priceTile.mayoreo{
  background: #166534;
  border-color: #4ADE80;
}
body.dark .priceTile.mayoreo .priceTileLabel{ color: #BBF7D0; }
body.dark .priceTile.mayoreo .priceTileValue{ color: #DCFCE7; }
body.dark .priceTile.mayoreo .priceTileUnit{ color: #BBF7D0; }
.priceTileLabel{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.priceTile.menudeo .priceTileLabel{ color: #1D4ED8; }
.priceTile.mayoreo .priceTileLabel{ color: #15803D; }
.priceTileValue{
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.priceTile.mayoreo .priceTileValue{ color: #15803D; }
.priceTileUnit{
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Ticket */
#ticketPreview{
  background: var(--panel-tint);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

/* QR */
#qrCanvas{ background: #fff; border-radius: 8px; }
.qrCodeWrap{ display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.qrHint{ font-size: 12px; color: var(--text-soft); font-weight: 700; }
.qrLink{ font-size: 11px; word-break: break-all; color: var(--primary); font-weight: 700; }

/* Preview del ticket QR (modal Ver pedido). Layout estilo lista en vez de tabla
   para que se vea bien en celular sin cortar el lado derecho. */
.qrTicketCustomer{
  font-weight: 900;
  font-size: 18px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.qrTicketMeta{
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 12px;
  word-break: break-all;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
.qrTicketItems{
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 6px 0;
  margin-bottom: 10px;
}
.qrTicketItem{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--divider);
}
.qrTicketItem:last-child{ border-bottom: 0; }
.qrTicketItemMain{
  flex: 1;
  min-width: 0;
}
.qrTicketItemName{
  font-weight: 800;
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.25;
  word-break: break-word;
}
.qrTicketItemSub{
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.qrTicketItemAmt{
  font-weight: 900;
  font-size: 15px;
  color: var(--text-main);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.qrTicketTotal{
  text-align: right;
  font-weight: 900;
  font-size: 18px;
  color: var(--text-main);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.qrScanCard{ max-width: 600px; }
.qrVideoWrap{ position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; }
.codeScanReader{ width: 100%; height: 100%; cursor: crosshair; }
.codeScanReader video{ width: 100% !important; height: 100% !important; object-fit: cover !important; }
.codeScanTorchBtn{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 23, 42, 0.7);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  z-index: 5;
  transition: background 150ms, color 150ms;
}
.codeScanTorchBtn:hover{ background: rgba(15, 23, 42, 0.85); }
.codeScanTorchBtn.on{
  background: #FBBF24;
  color: #3F2A00;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.4);
}
.scanFileBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: #FBBF24;
  color: #3F2A00;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  margin-top: 6px;
}
.scanFileBtn:hover{ background: #F59E0B; }
.scanFileBtn:active{ transform: scale(0.98); }
#qrVideo{ width: 100%; height: 100%; object-fit: cover; }
.qrScanStatus{ position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.7); color: #fff; padding: 6px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.qrScanTools{ display: flex; flex-direction: column; gap: 10px; }
.qrScanHint{ font-size: 12px; color: var(--text-soft); font-weight: 600; }
.qrScanActions{ display: flex; gap: 8px; flex-wrap: wrap; }
.qrScanActions .btn{ flex: 1; }

/* QR Standalone */
.qrStandalone{ padding: 16px; max-width: 600px; margin: 0 auto; }
.qrStandaloneCard{ background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-card); }
.qrStandaloneTitle{ font-weight: 900; font-size: 18px; margin-bottom: 12px; }
.qrStandaloneActions{ display: flex; gap: 8px; margin-top: 12px; }
.qrStandaloneActions .btn{ flex: 1; text-decoration: none; }

/* =========================
   Toast
   ========================= */
.toast{
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 2000;
  max-width: 90vw;
}
.toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success{ background: var(--success); }
.toast.error{ background: var(--danger); }

/* =========================
   Card placeholder Almacen
   ========================= */
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.card h3{ margin: 0 0 8px 0; font-size: 18px; }

/* =========================
   Admin modales (reusados)
   ========================= */
.adminToolbar{ display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.adminToolbar input{ flex: 1; min-width: 180px; }
.adminPricesList,
.adminUsersList,
.adminAnnounceList{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adminProductRow, .adminUserRow{
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
/* Usuarios: en mobile/cards usar flex column para que botones no sobrepongan el rol */
.adminUserRow{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.adminUserRow .adminUserInfo{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.adminUserActions{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
}
.adminProductInfo, .adminUserInfo{ min-width: 0; }
.adminProductName, .adminUserName{
  font-weight: 900;
  color: var(--text-main);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adminProductCode{
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 2px;
  font-family: "SF Mono", Consolas, monospace;
}
.adminProductPrices{
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  font-weight: 900;
  font-size: 13px;
  color: var(--text-main);
}
.adminProductPrices .cjPrice{ color: var(--text-muted); font-size: 11px; font-weight: 700; }
.adminProductPrices .boxBadge{
  align-self: flex-end;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #DCFCE7;
  color: #166534;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 2px;
}
.adminProductPrices .draftBadge{
  align-self: flex-end;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 2px;
}
.adminProductEdit{ padding: 8px 12px; font-size: 12px; }
.codeRow{
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  width: 100%;
}
.codeRow input{
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}
.scanBtn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: #0F172A;
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.scanBtn:hover{ background: #1E293B; }
.scanBtn:active{ transform: scale(0.97); }
@media (max-width: 380px){
  .scanBtn{ padding: 0 10px; font-size: 12px; }
  .scanBtn span{ display: none; }
}
.adminModalHint{
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: -4px;
  margin-bottom: 6px;
  line-height: 1.35;
}

.meTag{ font-size: 11px; color: var(--primary); font-weight: 800; }
.adminUserRole{
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.adminUserRole.role-admin{ color: #a04a1b; }
.adminUserActions .btn{ font-size: 11.5px; padding: 7px 11px; font-weight: 700; }
.adminUserForm{
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
}
.adminEmpty{ text-align: center; color: var(--text-muted); font-weight: 700; padding: 20px 0; }
.adminError, .adminModalError{ color: var(--danger); font-weight: 800; font-size: 13px; min-height: 18px; }

.adminAnnounceRow{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
.adminAnnounceText{ font-weight: 800; color: var(--text-main); grid-column: 1 / 2; }
.adminAnnounceMeta{ font-size: 11px; color: var(--text-muted); font-weight: 700; grid-column: 1 / 2; }
.adminAnnounceRow .btn{ grid-row: 1 / 3; grid-column: 2 / 3; }
.adminAnnounceListTitle{
  font-weight: 900;
  color: var(--text-main);
  font-size: 14px;
  margin-top: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

/* Reportes */
.reportsCard{ max-width: 660px; }
.reportPeriodTabs{ display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.reportTab{
  background: var(--panel-tint);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.reportTab.active{ background: var(--primary); border-color: var(--primary); color: #fff; }
.reportBody{ display: flex; flex-direction: column; gap: 14px; }
.reportLoading{ text-align: center; color: var(--text-muted); padding: 20px; font-weight: 700; }
.reportSummary{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reportCard{
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.reportCard.combined{
  grid-column: 1 / -1;
  background: var(--bg-dark);
  color: #fff;
  border-color: var(--bg-dark);
}
.reportCard.combined .reportCardLabel{ color: rgba(255,255,255,0.7); }
.reportCard.combined .reportCardValue{ color: #fff; }
.reportCard.combined .reportCardSub{ color: rgba(255,255,255,0.7); }
.reportCardLabel{ font-size: 10px; color: var(--text-muted); font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px; }
.reportCardValue{ font-size: 22px; font-weight: 900; color: var(--text-main); margin-top: 4px; }
.reportCard.combined .reportCardValue{ font-size: 30px; }
.reportCardSub{ font-size: 11px; color: var(--text-muted); font-weight: 700; margin-top: 2px; }
.reportSectionTitle{ font-weight: 900; color: var(--text-main); font-size: 14px; }
.topProductList{ display: flex; flex-direction: column; gap: 6px; }
.topProductRow{
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
.topRank{
  width: 26px; height: 26px;
  background: var(--primary); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 12px;
}
.topProductRow:nth-child(1) .topRank{ background: #d4a017; }
.topProductRow:nth-child(2) .topRank{ background: #7a8a99; }
.topProductRow:nth-child(3) .topRank{ background: #a05b2c; }
.topProductInfo{ min-width: 0; }
.topProductName{ font-weight: 900; color: var(--text-main); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topProductCode{ font-size: 10px; color: var(--text-muted); font-weight: 700; margin-top: 2px; }
.topProductStats{ text-align: right; white-space: nowrap; }
.topProductQty{ font-weight: 900; color: var(--text-main); font-size: 13px; }
.topProductTotal{ font-size: 12px; color: var(--success); font-weight: 900; }
.reportFooter{ font-size: 10px; color: var(--text-muted); text-align: center; font-weight: 700; padding-top: 8px; border-top: 1px dashed var(--border); }

/* Floating menu (row menu) */
#floatingMenu{
  position: fixed;
  z-index: 500;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-hover);
  display: none;
  min-width: 180px;
}
#floatingMenu.open{ display: block; }
#floatingMenu button{
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  border-radius: 8px;
  font-family: inherit;
}
#floatingMenu button:hover{ background: var(--panel-tint); }

/* Sync row */
.syncRow{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 10px;
}
.syncStatus{
  font-weight: 800;
  color: var(--text-soft);
  font-size: 13px;
  flex: 1;
}

/* =========================
   MEDIA QUERIES
   ========================= */

/* MOBILE: <= 768px */
@media (max-width: 768px){
  .panel{ padding: 12px; padding-bottom: 92px; }

  /* Topbar minimalista: boat logo | pill tabs | dark toggle */
  .topbar{
    padding: 10px 14px 10px;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  /* Ocultar todo lo viejo del header en mobile (hamburger, bell, brand "tn") */
  .mobileMenuBtn,
  .mobileBellBtn,
  .brand{ display: none !important; }

  /* Boat logo cyan — reemplazo del brand viejo en mobile */
  .brandBoat{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(11, 37, 69, 0.06);
    flex-shrink: 0;
  }
  body.dark .brandBoat{
    background: #1E293B;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  /* En historial (Ventas/Pedidos) y Almacén el topbar entero se oculta —
     cada vista tiene su propio historyHeader con título + buscador. */
  body[data-subview="history"] .topbar,
  body[data-view="stock"] .topbar{ display: none !important; }

  /* En mobile el contenido desktop del historial (tabla + boton "Volver a captura")
     se oculta. El header propio + las cards viven como hermanos. */
  #salesHistoryWrap, #ordersHistoryWrap{ display: none !important; }

  /* Orden del topbar mobile: boat | tabs | dark toggle, inputs abajo */
  .brandBoat{ order: 1; }
  .topbar .tabs{ order: 2; flex: 1; min-width: 0; }
  .darkToggle{ order: 3; }
  .topInputs{ order: 4; width: 100%; }

  /* Tabs: pills slate-50 con activo chrome graphite */
  .topbar .tabs{
    display: inline-flex;
    padding: 2px;
    background: var(--bg-soft);
    border-radius: var(--radius-pill-soft);
    gap: 0;
  }
  .topbar .tabs .tab{
    flex: 1;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 600;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-icon);
    gap: 6px;
    color: var(--text-500);
    background: transparent;
    box-shadow: none;
  }
  .topbar .tabs .tab.active{
    background: #1E293B;
    color: #FFFFFF;
    box-shadow: 0 4px 10px -4px #1E293B;
  }
  body.dark .topbar .tabs{ background: #1E293B; }
  body.dark .topbar .tabs .tab.active{
    background: #334155;
    color: #F1F5F9;
    box-shadow: 0 4px 10px -4px rgba(0,0,0,0.5);
  }
  .tabIcon{ display: inline-flex; flex-shrink: 0; }
  #tabStock{ display: none; }

  /* Vendedor + Cliente cards (spec 6.2): icono + stack(label uppercase, valor) */
  .topInputs{
    width: 100%;
    flex-direction: row;
    gap: 8px;
    order: 5;
  }
  .topInputs .field{
    flex: 1;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 0;
    box-shadow: var(--ring-soft);
    border-radius: var(--radius-pill-soft);
  }
  .topInputs .field .fieldIcon{
    display: inline-flex;
    color: var(--text-500);
    flex-shrink: 0;
  }
  .topInputs .field .fieldStack{
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.1;
  }
  .topInputs .field .fieldStack span{
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-400);
  }
  .topInputs .field:nth-child(3){ display: none; } /* Modo: oculto en mobile */
  .topInputs .field input{
    width: 100%;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-700);
    padding: 0;
    background: transparent;
    border: 0;
    outline: none;
  }
  .topInputs .field input::placeholder{ color: var(--text-400); font-weight: 400; }
  /* Input bloqueado (vendedor con sesión): se ve como label, no editable */
  .topInputs .field input.locked,
  .topInputs .field input[readonly]{
    cursor: default;
    opacity: 0.92;
    font-weight: 700;
  }

  /* sessionBar mobile: pantalla completa */
  .sessionBar{
    position: fixed;
    inset: 0;
    margin: 0;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
    background: var(--panel);
    border-top: 0;
    border-radius: 0;
    box-shadow: none;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    z-index: 1100;
    transform: translateY(100%);
    transition: transform 0.28s ease;
    max-height: 100vh;
    height: 100vh;
    overflow-y: auto;
  }
  .sessionBar.open{ transform: translateY(0); }

  /* Drag handle estilo iOS - ocultado en pantalla completa */
  .adminSheetGrab{ display: none; }
  /* Header del sheet (titulo + cerrar) */
  .adminSheetHead{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-soft);
  }
  .adminSheetTitle{
    display: block;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    text-transform: none;
    color: var(--text-900);
    padding: 0;
  }
  .adminSheetClose{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: static;
    width: 44px;
    height: 44px;
    background: var(--bg-icon);
    border: 0;
    border-radius: 14px;
    color: var(--text-700);
    cursor: pointer;
    padding: 0;
  }
  .adminSheetClose svg{ width: 22px; height: 22px; stroke-width: 2.3; }
  .adminSheetClose:active{ background: #E2E8F0; transform: scale(0.96); }
  .adminSheetBackdrop{
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 21, 37, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1099;
  }
  .adminSheetBackdrop.open{ opacity: 1; pointer-events: auto; }

  .sessionUser{
    font-size: 17px;
    font-weight: 800;
    color: var(--text-900);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    background: transparent;
    padding: 0;
    border-radius: 0;
  }
  .sessionUser::before,
  .sessionUser::after{ display: none !important; content: none !important; }
  /* Chip de rol oculto: el usuario lo prefiere limpio */
  .sessionUserRole{ display: none !important; }
  /* Quitar el badge "En linea" en el admin sheet mobile */
  .connectivityBadge{ display: none !important; }

  /* Grid 2xN de action cards en el sheet */
  .sessionActions{
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-direction: row;
    align-items: stretch;
  }
  .sessionActions > *{ min-width: 0; }
  .sessionBar{ box-sizing: border-box; }

  /* Action card en mobile (icono + titulo + hint) */
  .sessionBar .actionCard{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 72px;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-btn);
    background: var(--bg-card);
    box-shadow: var(--ring-soft);
    color: var(--text-700);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
  }
  .sessionBar .actionCard:active{ background: var(--bg-soft); }
  .sessionBar .actionCard .actionIcon{
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill-soft);
    background: var(--bg-icon);
    color: #475569;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .sessionBar .actionCard .actionLabel{
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
    flex: 1;
  }
  .sessionBar .actionCard .actionTitle{
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sessionBar .actionCard .actionHint{
    display: block;
    font-size: 10px;
    color: var(--text-400);
    margin-top: 2px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Tone variants en icon */
  .sessionBar .actionCard.tone-warn .actionIcon{
    background: var(--amber-bg);
    color: var(--amber-text-2);
  }
  .sessionBar .actionCard.tone-accent .actionIcon{
    background: rgba(11, 37, 69, 0.08);
    color: var(--primary);
  }

  /* Colores especificos por boton */
  .sessionBar #btnAdminReports         .actionIcon{ background: #DCFCE7; color: #166534; } /* verde */
  .sessionBar #btnAdminPrices          .actionIcon{ background: #FEF3C7; color: #92400E; } /* ambar */
  .sessionBar #btnAdminUsers           .actionIcon{ background: #EDE9FE; color: #5B21B6; } /* violeta */
  .sessionBar #btnAdminAnnounce        .actionIcon{ background: #FEE2E2; color: #B91C1C; } /* rojo */
  .sessionBar #btnAdminPrinter         .actionIcon{ background: #E0E7FF; color: #3730A3; } /* indigo */
  .sessionBar #btnAdminPrintQueue      .actionIcon{ background: #CFFAFE; color: #155E75; } /* cyan */
  .sessionBar #btnDesc                 .actionIcon,
  .sessionBar #btnOrdersDesc           .actionIcon{ background: #FEF3C7; color: #92400E; } /* ambar */
  .sessionBar #btnOrdersImportQr       .actionIcon,
  .sessionBar #btnSalesImportQr        .actionIcon{ background: #DBEAFE; color: #1E40AF; } /* azul */
  .sessionBar #btnOrdersHistory        .actionIcon,
  .sessionBar #btnSalesHistory         .actionIcon{ background: #F1F5F9; color: #334155; } /* gris */
  .sessionBar #btnChangeMyPassword     .actionIcon{ background: #FCE7F3; color: #9D174D; } /* rosa */
  .sessionBar .actionCard.tone-danger .actionIcon{
    background: var(--danger-bg);
    color: var(--danger);
  }

  /* Salir = full width al fondo, estilo rojo suave */
  .sessionBar .logoutCard{
    grid-column: 1 / -1;
    height: 44px;
    background: var(--danger-bg);
    color: var(--danger);
    justify-content: center;
    box-shadow: none;
    gap: 8px;
  }
  .sessionBar .logoutCard .actionIcon{
    width: auto;
    height: auto;
    background: transparent;
    color: var(--danger);
    box-shadow: none;
  }
  .sessionBar .logoutCard .actionHint{ display: none; }
  .sessionBar .logoutCard .actionTitle{
    color: var(--danger);
    font-size: 12.5px;
    font-weight: 600;
  }

  /* Layout: stack vertical en mobile */
  #storeCaptureWrap, #ordersCaptureWrap{
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  #tableWrap, #ordersTableWrap{ display: none; }
  .mobileList{ display: block; }

  /* Total + acciones en mobile: total queda ARRIBA, Pagar/Guardar lado a lado */
  .btnRow{
    position: static;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .totalBox{
    padding: 22px 20px;
    order: -2;
    border-radius: 18px;
  }
  .totalBox #total, .totalBox #ordersTotal{ font-size: 36px; }
  .totalBox::after{ width: 140px; height: 140px; right: -50px; top: -50px; }

  .btnGroup{
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    order: -1;
  }
  /* La mayoria de botones ocupan fila completa */
  .btnGroup .btn{ grid-column: 1 / -1; }
  /* Pagar/Guardar venta/Guardar pedido: medio ancho cada uno */
  .btnGroup #btnCobrar,
  .btnGroup #btnOrdersCobrar,
  .btnGroup #btnSaveSale,
  .btnGroup #btnOrdersSave{ grid-column: span 1; }

  /* Los botones extras se mueven al sheet de admin via JS.
     Si por algo se quedan dentro de btnGroup, los ocultamos. */
  .btnGroup #btnPrecio, .btnGroup #btnDesc, .btnGroup #btnLimpiar,
  .btnGroup #btnAddSpecial, .btnGroup #btnSalesMore,
  .btnGroup #btnOrdersPrecio, .btnGroup #btnOrdersDesc, .btnGroup #btnOrdersLimpiar,
  .btnGroup #btnOrdersAddSpecial, .btnGroup #btnOrdersImportQr, .btnGroup #btnOrdersMore{
    display: none;
  }
  /* Cuando esten en el admin sheet, full width */
  .sessionActions #btnPrecio,
  .sessionActions #btnDesc,
  .sessionActions #btnLimpiar,
  .sessionActions #btnAddSpecial,
  .sessionActions #btnSalesHistory,
  .sessionActions #btnOrdersPrecio,
  .sessionActions #btnOrdersDesc,
  .sessionActions #btnOrdersLimpiar,
  .sessionActions #btnOrdersAddSpecial,
  .sessionActions #btnOrdersImportQr,
  .sessionActions #btnOrdersHistory{
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Panel secundario ya no se usa en mobile */
  .secondaryPanel{ display: none !important; }

  /* Input arriba (full width); Consultar precio + Producto especial debajo en MISMA fila */
  .bottomRow{
    padding: 10px;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
    row-gap: 10px;
  }
  .bottomRow > .barcodeWrap{ grid-column: 1 / -1; }
  .bottomRow > .auxAction{
    margin-top: 0;
    min-width: 0;
    width: 100%;
  }
  /* Texto de aux mas chico para que entre en la mitad de pantalla */
  .bottomRow > .auxAction .auxTitle{ font-size: 13px; }
  .barcodeWrap{
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    flex-wrap: nowrap;
    position: relative;
  }
  .barcodeWrap label{ display: none; }
  .barcodeWrap .ghostWrap{ flex: 1; min-width: 0; }
  #btnAdd, #btnOrdersAdd{
    padding: 0 14px;
    font-size: 14px;
    white-space: nowrap;
    align-self: stretch;
    flex-shrink: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .scanInlineBtn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 11px;
    background: #0F172A;
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
    font-family: inherit;
  }
  .scanInlineBtn:active{ transform: scale(0.97); }
  .scanInlineBtn span{ display: none; }
  @media (min-width: 380px){
    .scanInlineBtn span{ display: inline; }
  }
  /* suggestBox flota como dropdown debajo del input */
  #suggestBox, #ordersSuggestBox{
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
  }
  /* Consultar precio: accion auxiliar abajo del input (en lugar de admin sheet) */
  .auxAction{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 12px;
    height: 48px;
    border: 1px dashed var(--border-dash);
    border-radius: var(--radius-pill-soft);
    background: var(--bg-soft);
    color: var(--text-700);
    width: 100%;
    margin-top: 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: transform 0.15s ease;
  }
  .auxAction .auxLabel{ flex: 0 1 auto; text-align: center; }
  .auxAction .auxTitle{ font-size: 14px; font-weight: 700; }
  .auxAction:active{ transform: scale(0.99); }
  .auxAction:hover{ background: var(--panel-tint); }
  .auxAction .auxIcon{
    width: 32px;
    height: 32px;
    border-radius: var(--radius-icon);
    background: var(--bg-card);
    box-shadow: var(--ring-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
  }
  .auxAction .auxLabel{ flex: 1; min-width: 0; line-height: 1.2; }
  .auxAction .auxTitle{
    display: block;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-900);
  }
  .auxAction .auxSubtitle{
    display: block;
    font-size: 10px;
    color: var(--text-500);
    margin-top: 1px;
  }

  /* Variante CIAN para "Producto especial" (spec v2 sec 6.7) */
  .auxAction.auxAction-cyan{
    border: 1px solid var(--cyan-border);
    background: linear-gradient(135deg, var(--cyan-bg) 0%, var(--cyan-bg-2) 100%);
  }
  .auxAction.auxAction-cyan .auxIcon{
    background: var(--cyan-icon);
    color: #fff;
    box-shadow: none;
  }
  .auxAction.auxAction-cyan .auxTitle{ color: var(--cyan-text); }
  .auxAction.auxAction-cyan .auxSubtitle{ color: var(--cyan-text-2); }

  /* Ocultar botones del view INACTIVO dentro del admin sheet (evita duplicados) */
  body[data-view="orders"] .sessionActions #btnPrecio,
  body[data-view="orders"] .sessionActions #btnDesc,
  body[data-view="orders"] .sessionActions #btnLimpiar,
  body[data-view="orders"] .sessionActions #btnAddSpecial,
  body[data-view="orders"] .sessionActions #btnSalesHistory,
  body[data-view="orders"] .sessionActions #btnSalesImportQr,
  body[data-view="store"] .sessionActions #btnOrdersPrecio,
  body[data-view="store"] .sessionActions #btnOrdersDesc,
  body[data-view="store"] .sessionActions #btnOrdersLimpiar,
  body[data-view="store"] .sessionActions #btnOrdersAddSpecial,
  body[data-view="store"] .sessionActions #btnOrdersImportQr,
  body[data-view="store"] .sessionActions #btnOrdersHistory{
    display: none;
  }
  /* Tambien ocultar Consultar precio del admin sheet: ahora vive como aux abajo del input */
  .sessionActions #btnPrecio,
  .sessionActions #btnOrdersPrecio{ display: none !important; }

  /* Controles bajo la card (toggle + stepper) */
  .mobileControls{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 12px;
    flex-wrap: wrap;
  }
  /* Unit toggle Pieza/Caja en la card */
  .unitToggle{
    display: inline-flex;
    background: #F1F5F9;
    border: 0;
    border-radius: var(--radius-pill-soft);
    padding: 4px;
    gap: 0;
  }
  .unitBtn{
    background: transparent;
    border: 0;
    padding: 0 14px;
    height: 32px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-500);
    border-radius: var(--radius-icon);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .unitBtn.active{
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: var(--shadow-soft);
  }
  /* En dark: contenedor más oscuro y activo en blanco con texto navy (contraste fuerte) */
  body.dark .unitToggle{ background: #334155; }
  body.dark .unitBtn{ color: #94A3B8; }
  body.dark .unitBtn.active{
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 4px 10px -4px rgba(0,0,0,0.5);
  }

  /* Card mobile usa los tamanos del spec (44px icon, 13.5px name, 11px code mono) */
  .mobileCard{ padding: 14px 8px; }
  .mobileName{ -webkit-line-clamp: 2; line-clamp: 2; }

  /* Modales: fullscreen-ish.
     Usar dvh + alinear arriba para que el header con X siempre quede visible
     aunque la barra de URL del navegador móvil tape parte del viewport. */
  .priceModal, .ticketModal, .discountModal, .confirmModal, .loginModal,
  .specialModal, .qrModal, .adminModal{
    align-items: flex-start;
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .adminModalCard, .priceModalCard, .discountModalCard, .specialModalCard,
  .qrModalCard, .ticketModalCard{
    max-height: 88dvh;
    max-height: 88vh; /* fallback */
    border-radius: 18px;
  }
  /* El header del modal queda pegado arriba aunque se haga scroll del body */
  .priceModalHeader, .ticketModalHeader, .discountModalHeader, .confirmModalHeader,
  .specialModalHeader, .qrModalHeader, .adminModalHeader{
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 2;
  }
  .adminProductRow{ grid-template-columns: 1fr auto; }
  .adminProductRow .adminProductEdit{ grid-column: 1 / -1; width: 100%; }
  .adminUserForm{ grid-template-columns: 1fr 1fr; }
  .adminUserForm select, .adminUserForm .btn{ grid-column: 1 / -1; }
  .reportSummary{ grid-template-columns: 1fr 1fr; }
  .reportCard.combined{ grid-column: 1 / -1; }

  /* Bottom nav mobile activado */
  .bottomNav{ display: block; }

  .ticker{ height: 32px; }
  .ticker-item{ font-size: 12px; }

  /* Inputs en codigo */
  .ghostWrap input{ font-size: 16px; } /* evita zoom en iOS */
  .field input{ font-size: 16px; min-width: 0; }
}

/* DESKTOP: > 768px */
@media (min-width: 769px){
  .bottomNav{ display: none !important; }
}

/* =========================
   DARK TOGGLE (botón en topbar)
   ========================= */
.darkToggle{
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  box-shadow: inset 0 0 0 1px rgba(11, 37, 69, 0.06);
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 200ms ease, color 200ms ease;
  padding: 0;
}
.darkToggle .sunIcon{ display: none; }
.darkToggle .moonIcon{ display: block; }
body.dark .darkToggle{
  background: #1E293B;
  color: #FBBF24;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
body.dark .darkToggle .moonIcon{ display: none; }
body.dark .darkToggle .sunIcon{ display: block; }

/* =========================
   DARK MODE — overrides
   Aplicar a body.dark con override de CSS vars + tweaks específicos.
   Lo que NO cambia: primary navy, amber, cyan, danger, success, marquee.
   ========================= */
body.dark{
  /* Fondos */
  --bg:         #0F172A;
  --bg-app:     #0F172A;
  --bg-card:    #1E293B;
  --bg-soft:    #1E293B;
  --bg-icon:    #334155;
  --panel:      #1E293B;
  --panel-soft: #1E293B;
  --panel-tint: #334155;

  /* Texto */
  --text-900:   #F1F5F9;
  --text-700:   #CBD5E1;
  --text-500:   #94A3B8;
  --text-400:   #64748B;
  --text-main:  #F1F5F9;
  --text-soft:  #CBD5E1;
  --text-muted: #94A3B8;

  /* Bordes / dividers */
  --divider:     #334155;
  --border:      rgba(255, 255, 255, 0.08);
  --border-soft: #334155;
  --border-dash: #475569;

  /* Sombras más fuertes */
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --ring-soft:   inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-card: var(--shadow-soft);
  --shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 30px 60px rgba(0, 0, 0, 0.6);

  background: #0F172A;
  color: #F1F5F9;
}

/* Bottom nav: activo en amarillo (crítico para visibilidad sobre fondo oscuro) */
body.dark .bottomNavBtn.active{ color: #FBBF24; }
body.dark .bottomNavBtn .badge{ border-color: #1E293B; }

/* Topbar oscuro: borde inferior se ve mejor más definido */
body.dark .topbar{ border-bottom-color: #334155; }

/* Brand: el cuadrito "tn" mantiene su fondo navy */

/* Tabs activos en dark — manda el chrome más claro para que se vea */
body.dark .tab.active{
  background: #334155;
  color: #F1F5F9;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
body.dark .tabs{ background: #1E293B; }

/* Bell button: fondo se oscurece */
body.dark .mobileBellBtn,
body.dark .mobileMenuBtn{
  background: #334155;
  color: #F1F5F9;
}

/* Inputs y fields: que no queden con borde claro */
body.dark .field{
  background: #334155;
  border-color: rgba(255, 255, 255, 0.08);
}
body.dark .field input,
body.dark .ghostWrap input,
body.dark input,
body.dark textarea,
body.dark select{
  color: #F1F5F9;
  background: transparent;
}
body.dark input::placeholder,
body.dark textarea::placeholder{ color: #64748B; }

/* Inputs standalone (ej. en modales) con fondo propio */
body.dark .adminModalBody input,
body.dark .adminModalBody textarea,
body.dark .adminModalBody select,
body.dark .loginModalCard input,
body.dark .priceModalBody input,
body.dark .discountModalBody input,
body.dark .specialModalBody input,
body.dark .qrScanBody textarea{
  background: #334155;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Status colors mantienen contraste pero se ajusta el fondo card */
body.dark .syncIndicator,
body.dark .historyChip,
body.dark .stockStat{
  border-color: rgba(255, 255, 255, 0.08);
}

/* Dark mode: tabs de busqueda */
body.dark .historySearchBar .historySearchTabs{
  background: rgba(255,255,255,0.06);
}
body.dark .historySearchBar .historySearchTabs .hstab{ color: #94A3B8; }
body.dark .historySearchBar .historySearchTabs .hstab.active{
  background: #334155;
  color: #F1F5F9;
}

/* Dark mode: estados del sync indicator con mejor contraste */
body.dark .syncIndicator[data-state="pending"]{
  background: #422006;
  color: #FCD34D;
}
body.dark .syncIndicator[data-state="pending"] .syncSubtitle{ color: #FBBF24; }
body.dark .syncIndicator[data-state="offline"]{
  background: #450A0A;
  color: #FCA5A5;
}
body.dark .syncIndicator[data-state="offline"] .syncSubtitle{ color: #F87171; }
body.dark .syncIndicator[data-state="syncing"]{
  background: #1E3A8A;
  color: #BFDBFE;
}
body.dark .syncIndicator[data-state="syncing"] .syncSubtitle{ color: #93C5FD; }

/* Aux buttons (Consultar precio / Producto especial) en dark mode */
body.dark .auxAction{
  background: #1E293B;
  border-color: #475569;
  color: #F1F5F9;
}
body.dark .auxAction .auxTitle{ color: #F1F5F9; }
body.dark .auxAction .auxSubtitle{ color: #94A3B8; }
body.dark .auxAction .auxIcon{
  background: #334155;
  color: #60A5FA;
  box-shadow: none;
}
body.dark .auxAction:hover{ background: #334155; }
body.dark .auxAction.auxAction-cyan{
  background: linear-gradient(135deg, #155E75 0%, #0E7490 100%);
  border-color: #0891B2;
}
body.dark .auxAction.auxAction-cyan .auxTitle{ color: #ECFEFF; }
body.dark .auxAction.auxAction-cyan .auxIcon{
  background: #0891B2;
  color: #F0F9FF;
}

/* Botón scanner inline */
body.dark .scanInlineBtn{ background: #475569; color: #F1F5F9; }
body.dark .scanInlineBtn:hover{ background: #64748B; }

/* Botón Agregar */
body.dark #btnAdd,
body.dark #btnOrdersAdd{ color: #FFFFFF; }

/* Admin sheet action cards en dark */
body.dark .sessionBar .actionCard{
  background: #1E293B;
  color: #F1F5F9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
body.dark .sessionBar .actionCard:active{ background: #334155; }
body.dark .sessionBar .actionCard .actionTitle{ color: #F1F5F9; }
body.dark .sessionBar .actionCard .actionHint{ color: #94A3B8; }
body.dark .sessionBar .adminSheetTitle{ color: #F1F5F9; }
body.dark .sessionBar .adminSheetClose{
  background: #334155;
  color: #F1F5F9;
}
body.dark .sessionUserName{ color: #F1F5F9; }

/* Colores especificos de botones admin sheet en dark - tonos mas oscuros con texto/icono claro */
body.dark .sessionBar #btnAdminReports         .actionIcon{ background: #052E16; color: #4ADE80; }
body.dark .sessionBar #btnAdminPrices          .actionIcon{ background: #451A03; color: #FCD34D; }
body.dark .sessionBar #btnAdminUsers           .actionIcon{ background: #2E1065; color: #C4B5FD; }
body.dark .sessionBar #btnAdminAnnounce        .actionIcon{ background: #450A0A; color: #FCA5A5; }
body.dark .sessionBar #btnAdminPrinter         .actionIcon{ background: #1E1B4B; color: #A5B4FC; }
body.dark .sessionBar #btnAdminPrintQueue      .actionIcon{ background: #083344; color: #67E8F9; }
body.dark .sessionBar #btnDesc                 .actionIcon,
body.dark .sessionBar #btnOrdersDesc           .actionIcon{ background: #451A03; color: #FCD34D; }
body.dark .sessionBar #btnOrdersImportQr       .actionIcon,
body.dark .sessionBar #btnSalesImportQr        .actionIcon{ background: #172554; color: #93C5FD; }
body.dark .sessionBar #btnOrdersHistory        .actionIcon,
body.dark .sessionBar #btnSalesHistory         .actionIcon{ background: #1E293B; color: #CBD5E1; }
body.dark .sessionBar #btnChangeMyPassword     .actionIcon{ background: #500724; color: #F9A8D4; }

/* PayModal en dark */
body.dark .payModalCard{ background: #1E293B; color: #F1F5F9; }
body.dark .payTitle{ color: #F1F5F9; }
body.dark .paySubtitle{ color: #94A3B8; }
body.dark .payClose{ background: #334155; color: #F1F5F9; }
body.dark .payCashInputWrap{
  background: #334155;
  border-color: #475569;
}
body.dark .payCashInput{ color: #F1F5F9; }
body.dark .payCashLabel{ color: #94A3B8; }
body.dark .payQuickBtn{
  background: #334155;
  color: #F1F5F9;
}
body.dark .payQuickBtn:hover{ background: #475569; }
body.dark .payChangeCard{
  background: #334155;
  color: #94A3B8;
}
body.dark .payMethodTab{
  background: #334155;
  color: #94A3B8;
}
body.dark .payMethodTab.disabled{
  background: #1E293B;
  color: #64748B;
}

/* Modal de Usuarios + cards */
body.dark .adminUserRow{
  background: #1E293B;
  border-color: #334155;
}
body.dark .adminUserName{ color: #F1F5F9; }
body.dark .adminUserRole.role-admin{ color: #FCA5A5; }
body.dark .adminUserRole.role-employee{ color: #93C5FD; }
body.dark .closeBtn{
  background: #334155;
  color: #F1F5F9;
}
body.dark .closeBtn:hover{ background: #475569; }

/* Ticker: ya es navy, sólo aseguramos contraste */

/* Mobile list cards en dark */
body.dark .mobileCard,
body.dark .stockCard{
  background: #1E293B;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Botones secundarios (.btn sin variante) en dark */
body.dark .btn{
  background: #334155;
  border-color: rgba(255, 255, 255, 0.08);
  color: #F1F5F9;
}
body.dark .btn:hover{ background: #475569; }

/* Modales: backdrop más oscuro y card oscura */
body.dark .priceModal,
body.dark .ticketModal,
body.dark .discountModal,
body.dark .confirmModal,
body.dark .loginModal,
body.dark .specialModal,
body.dark .qrModal,
body.dark .adminModal{
  background: rgba(0, 0, 0, 0.7);
}
body.dark .priceModalCard,
body.dark .ticketModalCard,
body.dark .discountModalCard,
body.dark .confirmModalCard,
body.dark .loginModalCard,
body.dark .specialModalCard,
body.dark .qrModalCard,
body.dark .adminModalCard{
  background: #1E293B;
  color: #F1F5F9;
}

/* Bottom nav en dark: fondo card oscuro, sombra fuerte */
body.dark .bottomNav{
  background: #1E293B;
  border-top-color: #334155;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.5);
}

/* Toast en dark */
body.dark .toast{
  background: #334155;
  color: #F1F5F9;
}

/* =========================
   PAY MODAL (bottom sheet)
   ========================= */
.payModal{
  position: fixed;
  inset: 0;
  background: rgba(12, 21, 37, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  z-index: 1100;
  padding: 0;
}
.payModalCard{
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  border-radius: 0;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)) 18px;
  box-shadow: 0 -20px 50px rgba(11, 37, 69, 0.25);
  animation: paySheetUp 240ms ease-out;
  /* 100dvh respeta el viewport real en iOS (sin barra de Safari) */
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
@keyframes paySheetUp{
  from{ transform: translateY(100%); }
  to{ transform: translateY(0); }
}
.payGrab{
  display: block;
  width: 44px;
  height: 5px;
  background: #CBD5E1;
  border-radius: 999px;
  margin: 0 auto 14px auto;
}
.payHeader{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.payHeadStack{ display: flex; flex-direction: column; gap: 2px; }
.payTitle{
  font-size: 16px;
  font-weight: 800;
  color: var(--text-900);
  letter-spacing: -0.2px;
}
.paySubtitle{
  font-size: 12px;
  color: var(--text-500);
  font-weight: 500;
}
.payClose{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 0;
  background: #F1F5F9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.payTotalCard{
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 14px 16px 16px 16px;
  background: var(--grad-total);
  color: #fff;
  margin-bottom: 14px;
}
.payTotalCard .circ{
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.payTotalCard .circ-1{
  top: -32px; right: -32px;
  width: 120px; height: 120px;
  background: rgba(251, 191, 36, 0.10);
}
.payTotalCard .circ-2{
  top: 22px; right: -50px;
  width: 110px; height: 110px;
  background: rgba(255, 255, 255, 0.05);
}
.payTotalLabel{
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
}
.payTotalAmount{
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  line-height: 1.05;
}
.payMethodTabs{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.payMethodTab{
  position: relative;
  background: #F8FAFC;
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 14px 8px 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: #64748B;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
  min-height: 76px;
  transition: background 150ms, border-color 150ms, color 150ms;
  box-shadow: inset 0 0 0 1px rgba(11, 37, 69, 0.06);
}
.payMethodTab .payMethodIcon{ opacity: 0.65; }
.payMethodTab:hover{ color: var(--text-900); }
.payMethodTab.active[data-method="efectivo"]{
  background: #10B981;
  color: #FFFFFF;
  border-color: #047857;
  box-shadow: 0 6px 14px -4px rgba(16, 185, 129, 0.55);
}
.payMethodTab.active[data-method="efectivo"] .payMethodIcon{ opacity: 1; color: #FFFFFF; }
.payMethodTab.active[data-method="tarjeta"]{
  background: #E2E8F0;
  color: #1E293B;
  border-color: #475569;
  box-shadow: none;
}
.payMethodTab.active[data-method="transferencia"]{
  background: #FEF6DD;
  color: #5B3F00;
  border-color: #FBBF24;
  box-shadow: none;
}
.payMethodTab.disabled{
  background: #F1F5F9;
  color: #94A3B8;
  cursor: not-allowed;
  opacity: 0.78;
  box-shadow: inset 0 0 0 1px rgba(11, 37, 69, 0.04);
}
.payMethodTab.disabled .payMethodIcon{ opacity: 0.35; }
.payMethodTab.disabled:hover{ color: #94A3B8; }
.payMethodSoon{
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #94A3B8;
  color: #FFFFFF;
  padding: 2px 6px;
  border-radius: 999px;
}
.payMethodBody{ margin-bottom: 14px; flex: 1; }
.payCashLabel{
  font-size: 10px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}
.payCashInputWrap{
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.payCashSign{
  font-size: 18px;
  font-weight: 700;
  color: #94A3B8;
}
.payCashInput{
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-900);
  min-width: 0;
}
.payCashInput::placeholder{ color: #CBD5E1; }
.payQuickRow{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.payQuickBtn{
  background: #F1F5F9;
  border: 0;
  border-radius: 10px;
  padding: 9px 4px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-700);
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: background 120ms, transform 80ms;
}
.payQuickBtn:hover{ background: #E2E8F0; }
.payQuickBtn:active{ transform: scale(0.97); }
.payChangeCard{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-radius: 16px;
  background: #F1F5F9;
  color: #94A3B8;
  font-weight: 700;
  font-size: 15px;
  transition: background 200ms, color 200ms, transform 200ms;
}
.payChangeCard .payChangeAmount{
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.payChangeCard.positive{
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 18px -6px rgba(16, 185, 129, 0.5);
  transform: scale(1.02);
}
.payChangeCard.positive .payChangeAmount{ color: #FFFFFF; }
.payInfoBox{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  border-radius: 14px;
  background: #F8FAFC;
  box-shadow: inset 0 0 0 1px rgba(11, 37, 69, 0.06);
  color: var(--text-700);
}
.payInfoIcon{
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(11, 37, 69, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--primary);
}
.payInfoTitle{
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text-900);
}
.payInfoSub{
  font-size: 12px;
  color: var(--text-500);
}
.payConfirm{
  width: 100%;
  height: 64px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 12px 24px -8px rgba(16, 185, 129, 0.65);
  font-family: inherit;
  margin-top: auto;
  flex-shrink: 0;
  /* sticky para que siempre se vea aunque haya scroll en el modal */
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + 4px);
  z-index: 5;
  transition: opacity 150ms, transform 80ms, box-shadow 200ms;
}
.payConfirm:not(:disabled):hover{
  box-shadow: 0 14px 28px -8px rgba(16, 185, 129, 0.75);
}
.payConfirm:disabled{
  background: #CBD5E1;
  color: #fff;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.9;
}
.payConfirm:not(:disabled):active{ transform: scale(0.99); }

/* Pay modal en dark */
body.dark .payModal{ background: rgba(0,0,0,0.7); }
body.dark .payModalCard{
  background: #1E293B;
  color: #F1F5F9;
  box-shadow: 0 -20px 50px rgba(0,0,0,0.5);
}
body.dark .payGrab{ background: #475569; }
body.dark .payClose{ background: #334155; color: #F1F5F9; }
body.dark .payMethodTab{
  background: #334155;
  color: #94A3B8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
body.dark .payCashInputWrap{
  background: #334155;
  border-color: rgba(255,255,255,0.08);
}
body.dark .payQuickBtn{
  background: #334155;
  color: #F1F5F9;
}
body.dark .payQuickBtn:hover{ background: #475569; }
body.dark .payChangeCard{ background: #334155; color: #64748B; }
body.dark .payInfoBox{
  background: #334155;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  color: #CBD5E1;
}
body.dark .payInfoIcon{
  background: #1E293B;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
body.dark .payConfirm:disabled{ background: #475569; color: #94A3B8; }

/* =========================
   TICKET POST (recibo térmico)
   ========================= */
.ticketPostModal{
  position: fixed;
  inset: 0;
  background: #0F172A;
  display: flex;
  flex-direction: column;
  z-index: 1100;
  padding: 0;
}
.ticketPostCard{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  background: #0F172A;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom)) 14px;
}
.ticketPostHeader{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #F1F5F9;
}
.ticketPostHeadStack{ display: flex; flex-direction: column; gap: 6px; }
.ticketPostChip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #10B981;
}
.ticketPostChipDot{
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  animation: pulseDot 1.8s ease-in-out infinite;
}
.ticketPostTitle{
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #F1F5F9;
}
.ticketPostClose{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 0;
  background: #334155;
  color: #F1F5F9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.ticketPostPaperWrap{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #FBFAF6;
  border-radius: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.ticketPaperZigzag{
  height: 8px;
  flex-shrink: 0;
  background:
    linear-gradient(135deg, transparent 50%, #0F172A 50%) 0 0 / 10px 8px repeat-x,
    linear-gradient(45deg,  transparent 50%, #0F172A 50%) 5px 0 / 10px 8px repeat-x;
  background-color: #FBFAF6;
}
.ticketPaperZigzag.top{
  background:
    linear-gradient(225deg, transparent 50%, #0F172A 50%) 0 0 / 10px 8px repeat-x,
    linear-gradient(315deg, transparent 50%, #0F172A 50%) 5px 0 / 10px 8px repeat-x;
  background-color: #FBFAF6;
}
.ticketPostPaper{
  flex: 1;
  padding: 20px 24px 22px 24px;
  background: #FBFAF6;
  color: #0F172A;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
}
.ticketHead{
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0 14px 0;
  border-bottom: 1px dashed #94A3B8;
  margin-bottom: 12px;
}
.ticketHead .ticketLogo{
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ticketHead .ticketLogo svg{ width: 100%; height: 100%; }
.ticketHead .ticketStore{
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #0F172A;
}
.ticketHead .ticketBranch{
  font-size: 11px;
  color: #334155;
}
.ticketMeta{
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  row-gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #94A3B8;
  margin-bottom: 12px;
  font-size: 11.5px;
}
.ticketMeta .label{ color: #64748B; }
.ticketMeta .val{ text-align: right; }
.ticketTableHead{
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #334155;
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.ticketItem{
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  padding: 6px 0;
}
.ticketItem .name{
  font-weight: 700;
  font-size: 12px;
  color: #0F172A;
}
.ticketItem .sub{
  font-size: 10.5px;
  color: #64748B;
  margin-top: 2px;
}
.ticketItem .amt{
  font-weight: 800;
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ticketTotals{
  border-top: 1px dashed #94A3B8;
  margin-top: 10px;
  padding-top: 10px;
  font-size: 12px;
}
.ticketTotalRow{
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}
.ticketTotalRow.disc{ color: #B91C1C; }
.ticketTotalRow.grand{
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 800;
  padding-top: 6px;
  margin-top: 2px;
}
.ticketPay{
  border-top: 1px dashed #94A3B8;
  margin-top: 12px;
  padding-top: 10px;
  font-size: 12px;
}
.ticketThanks{
  text-align: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #94A3B8;
  font-size: 11.5px;
  line-height: 1.6;
  color: #334155;
}
.ticketBarcode{
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.ticketBarcode svg{
  width: 110px;
  height: 110px;
  display: block;
}
.ticketBarcodeHint{
  text-align: center;
  font-size: 9px;
  color: #475569;
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.ticketBarcodeFolio{
  text-align: center;
  font-size: 10px;
  color: #334155;
  margin-top: 4px;
}
.ticketPostFooter{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.ticketPostBtn{
  height: 48px;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: transform 80ms, opacity 120ms;
}
.ticketPostBtn:active{ transform: scale(0.98); }
.ticketPostBtn.graphite{ background: #334155; color: #F1F5F9; }
.ticketPostBtn.amber{ background: #FBBF24; color: #3F2A00; }
.ticketPostBtn.navy{ background: #0B2545; color: #fff; }

/* No invertir el ticket en dark — el papel siempre es claro (es un recibo) */

/* =========================
   PRINTER CONFIG MODAL
   ========================= */
.printerHelp{
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text-700);
  line-height: 1.45;
}
.printerHelp p{ margin: 0 0 6px 0; }
.printerHelp p:last-child{ margin-bottom: 0; }
.printerStatus{
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-500);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.printerStatus.ok{ color: #047857; }
.printerStatus.err{ color: #B91C1C; }
body.dark .printerHelp{
  background: #334155;
  color: #CBD5E1;
}
.printerSection{ margin-bottom: 12px; }
.printerSectionTitle{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-900);
  margin-bottom: 8px;
}
.printerSectionBadge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.printerSectionTag{
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-500);
  background: var(--bg-soft);
  padding: 3px 8px;
  border-radius: 999px;
}
.printerDivider{
  border: 0;
  border-top: 1px dashed var(--border-soft);
  margin: 14px 0;
}
body.dark .printerSectionTag{
  background: #334155;
  color: #94A3B8;
}

/* =========================
   PRINT QUEUE MODAL
   ========================= */
.printQueueToolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.printQueueAuto{
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-500);
}
.printQueueList{
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.printedTicketsCount{
  font-size: 12px;
  font-weight: 700;
  color: var(--text-500);
  padding: 4px 2px 10px;
}
.printedTicketsList{
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}
.printedTicketItem{
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--ring-soft);
}
.printedTicketHead{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.printedTicketFolio{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-500);
}
.printedTicketBadge{
  background: #DCFCE7;
  color: #15803D;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.printedTicketCustomer{ font-weight: 700; font-size: 14px; color: var(--text-900); }
.printedTicketMeta{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-500);
  margin-top: 2px;
}
.printedTicketTotalRow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.printedTicketTotal{
  font-weight: 800;
  font-size: 15px;
  color: var(--text-900);
}
.printedTicketViewBtn{
  font-size: 12px;
  padding: 6px 12px;
  font-weight: 700;
}
.printedTicketEmpty{
  text-align: center;
  padding: 32px 12px;
  color: var(--text-500);
  font-size: 13px;
}
body.dark .printedTicketBadge{ background: #064E3B; color: #6EE7B7; }
.printQueueLoading,
.printQueueEmpty{
  text-align: center;
  padding: 24px 12px;
  color: var(--text-500);
  font-size: 13px;
}
.printJob{
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--ring-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}
.printJobMain{ min-width: 0; }
.printJobId{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.printJobMeta{
  font-size: 10.5px;
  color: var(--text-500);
  margin-top: 2px;
}
.printJobStatus{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.printJobStatus .dot{
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.printJobStatus.pending{ background: #FEF6DD; color: #7A5800; }
.printJobStatus.printing{ background: #EFF6FF; color: #1D4ED8; }
.printJobStatus.done{ background: #ECFDF5; color: #047857; }
.printJobStatus.failed{ background: #FEF2F2; color: #B91C1C; }
.printJobStatus.cancelled{ background: #F1F5F9; color: #475569; }
.printJobActions{
  display: flex;
  gap: 6px;
  grid-column: 1 / -1;
  flex-wrap: wrap;
}
.printJobBtn{
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.printJobBtn.cancel{ background: #FEF2F2; color: #B91C1C; }
.printJobBtn.retry{ background: var(--primary); color: #fff; }
.printJobBtn:active{ transform: scale(0.97); }
body.dark .printJob{ background: #1E293B; }
body.dark .printJobStatus.pending{ background: rgba(251,191,36,0.15); color: #FBBF24; }
body.dark .printJobStatus.printing{ background: rgba(59,130,246,0.15); color: #60A5FA; }
body.dark .printJobStatus.done{ background: rgba(16,185,129,0.15); color: #34D399; }
body.dark .printJobStatus.failed{ background: rgba(220,38,38,0.15); color: #F87171; }
body.dark .printJobStatus.cancelled{ background: rgba(100,116,139,0.20); color: #94A3B8; }

/* =========================
   SWIPE-TO-DELETE (mobile) + HOVER X (desktop)
   ========================= */
.swipeWrap{
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--divider);
  background: linear-gradient(90deg, #ef4444, #dc2626);
}
.swipeWrap:last-child{ border-bottom: 0; }
.swipeWrap > .mobileCard{
  border-bottom: 0;
  background: var(--bg-card);
  transition: transform 0.22s ease;
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  will-change: transform;
}
.swipeWrap.swiping > .mobileCard{ transition: none; }
.swipeAction{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding-left: 22px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.2px;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
.swipeAction svg{ flex-shrink: 0; }
body.dark .swipeWrap > .mobileCard{ background: var(--bg-card); }

.rowDeleteX{
  visibility: hidden;
  background: transparent;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  margin-left: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rowDeleteX:hover{ background: #fee2e2; color: #dc2626; }
body.dark .rowDeleteX:hover{ background: rgba(220,38,38,0.20); color: #fca5a5; }
tbody tr.dataRow:hover .rowDeleteX{ visibility: visible; }
.cellAmount{
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

/* =========================
   PRINT — al imprimir solo se ve el ticket, sin chrome ni botones
   ========================= */
@media print {
  @page {
    size: 80mm auto;
    margin: 0;
  }
  body * { visibility: hidden !important; }
  #ticketPostModal,
  #ticketPostModal * { visibility: visible !important; }
  #ticketPostModal {
    position: absolute !important;
    inset: 0 !important;
    background: #ffffff !important;
  }
  .ticketPostHeader,
  .ticketPostFooter,
  .ticketPostClose,
  .ticketPaperZigzag { display: none !important; }
  .ticketPostCard {
    padding: 0 !important;
    background: #ffffff !important;
    max-width: 80mm !important;
    margin: 0 !important;
  }
  .ticketPostPaperWrap {
    overflow: visible !important;
    background: #ffffff !important;
  }
  .ticketPostPaper {
    background: #ffffff !important;
    padding: 4mm !important;
    font-size: 10.5px !important;
    color: #000000 !important;
    width: 80mm !important;
    max-width: 80mm !important;
  }
  .ticketPostPaper * { color: #000000 !important; }
  .ticketTotalRow.disc { color: #000000 !important; font-weight: 700; }
  .ticketBarcode svg rect { fill: #000000 !important; }
  /* Ocultar otros modales y la nav inferior */
  .bottomNav,
  .topbar,
  .ticker,
  .payModal,
  .priceModal,
  .ticketModal,
  .discountModal,
  .confirmModal,
  .loginModal,
  .specialModal,
  .qrModal,
  .adminModal { display: none !important; }
}
