:root {
  --navy-950: #0b1022;
  --navy-900: #10162b;
  --navy-800: #171f3d;
  --navy-700: #232c52;
  --teal: #16c7b6;
  --teal-dark: #0da695;
  --danger: #e14b4b;
  --danger-bg: #fdeaea;
  --warning-bg: #fff6e0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e4e8f2;
  --text: #1a2035;
  --text-muted: #6b7386;
  --sidebar-text: #aab2d1;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(16, 22, 43, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  /* "clip" en vez de "hidden": recorta el desborde horizontal igual,
     pero (a diferencia de "hidden") no crea una caja de scroll — en
     iOS Safari, cualquier overflow != visible en un ancestro (aunque
     sea "hidden") rompe position: sticky en los descendientes, que es
     justo lo que usa .mobile-topbar para quedarse fija arriba.
     Soportado desde Safari 16 (2022). */
  overflow-x: clip;
  /* Evita el zoom por doble toque en celulares (molesto al tocar
     rápido dos productos seguidos en Vender); el pellizco para hacer
     zoom sigue funcionando normal, por accesibilidad. */
  touch-action: manipulation;
}

a { color: var(--teal-dark); }

button {
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}

/* ---------- Login ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, var(--navy-800), var(--navy-950));
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand .logo-mark {
  display: inline-block;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 12px;
}

.auth-brand h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.auth-brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.field input, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fbfcfe;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.btn:disabled { opacity: 0.6; cursor: default; }
.btn:hover:not(:disabled) { opacity: 0.9; }

.btn-primary {
  background: var(--teal);
  color: #fff;
  width: 100%;
}

.btn-secondary {
  background: var(--navy-800);
  color: #fff;
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-switch button {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-weight: 600;
  font-size: 13px;
  padding: 0;
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.form-error.visible { display: block; }

.form-note {
  background: #eef6ff;
  color: #1c5fa8;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.form-note.visible { display: block; }

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy-950);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
}

.sidebar-brand > div {
  /* Sin esto, un flex item no se achica más allá de su contenido —
     con un nombre de empresa largo (ver .brand-name abajo) se saldría
     del sidebar en vez de recortarse con "...". */
  min-width: 0;
  flex: 1;
}

.sidebar-brand .logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  /* nav.js le pone fondo de color con el nombre de la empresa activa
     (ver requireSession) — que no reviente el ancho fijo del sidebar
     con un nombre largo. */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
}

.sidebar-user {
  padding: 10px 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 16px;
}

.sidebar-user .email {
  font-size: 12.5px;
  color: #fff;
  word-break: break-all;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-nav button,
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 10px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}

.sidebar-nav button.active,
.sidebar-nav button:hover,
.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(22, 199, 182, 0.14);
  color: #fff;
}

.sidebar-footer button {
  width: 100%;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--sidebar-text);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.sidebar-footer button:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

.main {
  flex: 1;
  padding: 28px 32px 60px;
  max-width: 100%;
  overflow-x: clip; /* ver comentario en html, body arriba */
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.main-header h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

.main-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Mobile: hamburger + off-canvas sidebar.
   También en pantallas táctiles hasta 1400px (tablet en horizontal):
   ahí el menú fijo de 240px ocupa demasiado. Una compu con mouse no cambia. */
.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px), (pointer: coarse) and (max-width: 1400px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy-950);
    /* env(safe-area-inset-top) solo hace algo en páginas con
       viewport-fit=cover en su <meta viewport> (hoy solo vender.html,
       por el home indicator/isla dinámica del iPhone en modo
       standalone) — en el resto queda en 0, sin cambiar nada. */
    padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .mobile-topbar .brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    /* nav.js le pone fondo de color con el nombre de la empresa activa
       (ver requireSession) — con nombres largos, que no reviente el
       ancho angosto del celular. */
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-topbar button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 4px 8px;
  }

  .app-shell { flex-direction: column; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.25);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 11, 24, 0.5);
    z-index: 25;
  }

  .main { padding: 20px 16px 48px; }
}

/* ---------- Summary cards ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.summary-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.summary-card .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 22px;
  font-weight: 700;
}

.summary-card.alert .value { color: var(--danger); }

.summary-card .delta {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 6px;
}
.summary-card .delta.up { color: var(--teal-dark); }
.summary-card .delta.down { color: var(--danger); }

/* ---------- Toolbar / filters ---------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar input[type="search"],
.toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
}

.toolbar input[type="search"] { flex: 1; min-width: 180px; }

.toolbar .spacer { flex: 1; }

/* ---------- Table ---------- */

.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
/* Solo con mouse: en pantallas táctiles el :hover se queda pegado. */
@media (hover: hover) {
  tbody tr:hover { background: #fafbff; }
}

/* Fila tocada (js/tabla.js): queda resaltada hasta tocar otra. La
   celda fija (.sticky-col) también se pinta. */
tbody tr.row-selected > td { background: #e8f8f6; }
tbody tr.row-selected > td:first-child { box-shadow: inset 4px 0 0 var(--teal); }

/* Columna del nombre fija a la izquierda al desplazar la tabla de lado
   (celular y iPad; en la computadora queda igual). */
@media (max-width: 1024px), (pointer: coarse) {
  .sticky-col {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--card);
    box-shadow: 4px 0 6px -4px rgba(15, 23, 42, 0.25);
  }
  thead th.sticky-col { z-index: 2; }
  /* El borde va en la celda fija (en Productos la 1.ª es la foto, que se va al desplazar). */
  tbody tr.row-selected > td.sticky-col { background: #e8f8f6; box-shadow: inset 4px 0 0 var(--teal), 4px 0 6px -4px rgba(15, 23, 42, 0.25); }
}

tr.day-group-header td {
  background: #f3f5fb;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 9px 16px;
}
tr.day-group-header:hover td { background: #f3f5fb; }

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.product-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #eef1fb;
  color: var(--navy-700);
}

.badge.low {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.ok {
  background: #e6f9f2;
  color: var(--teal-dark);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.icon-btn:hover { color: var(--text); border-color: var(--text-muted); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.qty-low { color: var(--danger); font-weight: 700; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 30, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

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

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal h2 {
  margin: 0 0 18px;
  font-size: 18px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.modal-grid .field.full { grid-column: 1 / -1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.confirm-modal .modal { max-width: 380px; }

/* ---------- Loading ---------- */

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.hidden { display: none !important; }

/* ---------- Recipe rows (Recetas) ---------- */

.recipe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recipe-row select {
  /* Base de 140px: en celular lo que no cabe (cantidad, "Solo para llevar",
     "Predeterminada") baja a la línea siguiente en vez de aplastar el selector. */
  flex: 1 1 140px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
}

/* Cantidad junto al selector. Desde la fase 2 de decimales los campos
   son type="text" inputmode="decimal" (coma del iPad): sin el segundo
   selector, el campo ocupaba todo el ancho y aplastaba el selector. */
.recipe-row input[type="number"],
.recipe-row input[inputmode="decimal"] {
  width: 90px;
  flex: 0 0 90px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
}

.recipe-row .unit-label {
  font-size: 12.5px;
  color: var(--text-muted);
  min-width: 32px;
}

.recipe-row .remove-row {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  color: var(--danger);
  font-size: 13px;
}

/* ---------- Vender (POS) ---------- */

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1050px) {
  .pos-layout { grid-template-columns: 1fr; }
}

/* Tablet en horizontal (táctil, sin menú fijo): el ticket cabe al costado. */
@media (pointer: coarse) and (min-width: 901px) and (max-width: 1050px) {
  .pos-layout { grid-template-columns: 1fr 300px; }
}

.pos-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pos-categories button {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.pos-categories button.active {
  background: var(--navy-950);
  color: #fff;
  border-color: var(--navy-950);
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.pos-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  text-align: left;
  border: 2px solid transparent;
}

/* Solo con mouse: en celular/iPad el :hover se queda pegado después del
   toque y la tarjeta parecía marcada (p. ej. al cancelar la bebida). */
@media (hover: hover) {
  .pos-card:hover { border-color: var(--teal); }
}

/* Marcar cantidad (ver schema_marcar_cantidad.sql): cuántas unidades de
   este producto hay ahora mismo en el carrito. Apagado por defecto. */
.pos-card-qty-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1f9d55;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  z-index: 1;
}

.pos-card-img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg);
}

.pos-card .pos-card-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.pos-card .pos-card-price {
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
}

.pos-card .pos-card-cat {
  font-size: 11px;
  color: var(--text);
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

@media (max-width: 600px) {
  .pos-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .pos-card { padding: 8px; }
  .pos-card-img { height: 56px; margin-bottom: 6px; }
  .pos-card .pos-card-cat { font-size: 9.5px; margin-bottom: 3px; }
  .pos-card .pos-card-name { font-size: 12px; margin-bottom: 2px; line-height: 1.2; }
  .pos-card .pos-card-price { font-size: 12px; }
}

/* Tarjeta "+" al final de la cuadrícula (solo para quien puede crear
   productos, ver vender.js renderGrid) — mismo tamaño que una tarjeta
   de producto, gris, sin foto/precio. */
.pos-card-add {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 32px;
  font-weight: 300;
  min-height: 112px;
}

@media (hover: hover) {
  .pos-card-add:hover { border-color: var(--teal); color: var(--teal-dark); }
}

@media (max-width: 600px) {
  .pos-card-add { min-height: 78px; font-size: 26px; }
}

.cart-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  position: sticky;
  top: 20px;
}

.cart-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.cart-empty {
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: 24px 0;
}

.cart-line {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.cart-line:last-child { border-bottom: none; }

.cart-line-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.cart-line-name {
  font-weight: 600;
  font-size: 13.5px;
}

.cart-line-mods {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-controls button {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  line-height: 1;
}

.cart-line-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 12px;
  padding: 0;
}

.cart-line-mod-btn {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-size: 11.5px;
  font-weight: 600;
  padding: 0;
  margin-top: 4px;
}

.order-courtesy-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.order-courtesy-toggle:has(input:checked) {
  border-color: #1c8a4c;
  background: #e9f9ef;
  color: #1c8a4c;
}

.order-courtesy-toggle input { width: 16px; height: 16px; }

.cart-totals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}

/* Franja fija de cobro, SOLO celular (no tablet táctil ni compu) —
   pedido de Paul (con dibujo). El total y el botón son los REALES de
   cobrar (vender.js la sincroniza con #confirm-sale-btn, nunca duplica
   su lógica), a diferencia de la barra "Ver ticket" que se había
   probado antes y Paul rechazó por completo (a4a2dc1/d1a18c2).
   Lecciones de esa barra, aplicadas de nuevo: left/right/bottom SIN
   width (si no, se sale del borde derecho), padding-bottom con
   env(safe-area-inset-bottom) para el home indicator del iPhone (hace
   falta viewport-fit=cover en el <meta viewport>, solo en vender.html),
   y hueco abajo de la cuadrícula para que la franja no tape el último
   producto ni la tarjeta "+". */
.mobile-cart-bar { display: none; }

@media (max-width: 900px) {
  .mobile-cart-bar:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    background: #fff;
    border-top: 2px solid var(--teal);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(16, 22, 43, 0.18);
  }

  .mobile-cart-bar-summary {
    background: none;
    border: none;
    text-align: left;
    padding: 4px 0;
    flex: 1;
    min-width: 0;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text);
  }

  .mobile-cart-bar-action {
    width: auto;
    white-space: nowrap;
    padding: 10px 18px;
    margin-top: 0;
  }

  /* Deja hueco abajo de toda la cuadrícula para que la franja fija no
     tape el último producto ni la tarjeta "+" (alto de la franja +
     margen de sobra, con o sin isla dinámica). */
  .pos-layout > div:first-child {
    padding-bottom: 110px;
  }
}

/* Grupos de elección de la receta (ej. "Bebida") como chips grandes —
   reemplaza el <select> chico que el cajero pasaba por alto (pedido
   explícito de Paul). Mismo estilo en el modal de agregado rápido y en
   "Personalizar" (vender.js: choiceGroupBlockHtml), en cualquier
   tamaño de pantalla — celular, tablet y compu. */
.choice-group {
  margin-bottom: 14px;
}

.choice-group-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 8px;
}

/* Grupo obligatorio sin elección (no debería pasar en uso normal: el
   modal siempre arranca con el default — queda para cuando sí haga
   falta, ej. un payload viejo). */
.choice-group.missing {
  border: 2px solid var(--danger);
  border-radius: 12px;
  padding: 10px;
  background: var(--danger-bg);
}

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

.choice-chip {
  min-height: 48px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.choice-chip.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.modifier-chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.modifier-chip-row:last-child { border-bottom: none; }

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
}

.color-swatch.selected {
  border-color: var(--navy-950);
  box-shadow: 0 0 0 2px #fff inset;
}

.color-swatch.none {
  background: #fff;
  border: 2px dashed var(--border);
  position: relative;
}
.color-swatch.none::after {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}

.stepper span {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
}

/* ---------- Ventas / stats ---------- */

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.stat-row:last-child { border-bottom: none; }

.badge.voided {
  background: #f1f2f6;
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ---------- Recibo de cortesía / búsqueda de cliente ---------- */

.customer-results-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.customer-result-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}
.customer-result-row:last-child { border-bottom: none; }
.customer-result-row:hover { background: var(--bg); }

/* Al imprimir el recibo: oculta todo lo demás de la página y centra
   el recibo como una tarjeta pequeña en la hoja A4 (en vez de
   estirarlo al ancho completo, que se veía como una foto pegada). */
@media print {
  @page { size: A4; margin: 0; }
  body * { visibility: hidden; }
  #receipt-print-area, #receipt-print-area * { visibility: visible; }
  #receipt-print-area {
    position: absolute;
    top: 40mm;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }
}

/* Pantalla de PIN (compartida: Vender y Asistencia) — identifica a la
   persona con los últimos 4 dígitos de su cédula, sin correo ni
   contraseña. */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.pin-dot.filled {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.pin-key {
  background: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 16px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.pin-key:hover { opacity: 0.85; }
.pin-key.pin-key-muted { background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* Sin zoom en tablet y celular (pedido de Paul).
   - iOS hace zoom solo al tocar un campo con letra < 16px: en pantallas
     táctiles los campos van a 16px (también los que traen font-size en
     línea, por eso el !important). Escritorio no cambia.
   - Doble toque: touch-action manipulation (quita el zoom por doble
     toque y la espera de 300 ms).
   - Pellizco: maximum-scale=1 / user-scalable=no en el <meta viewport>
     de cada página + gesturestart en nav.js (Safari ignora el meta). */
html, body { touch-action: manipulation; }
@media (pointer: coarse), (max-width: 1024px) {
  input, select, textarea { font-size: 16px !important; }
}
